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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/browser/{createResourceDialog-Btjes3wD.js → createResourceDialog-C23SBjYd.js} +2 -2
  2. package/dist/browser/flow-authoring-node.d.ts +6 -2
  3. package/dist/browser/flow-authoring.js +44 -12
  4. package/dist/browser/flow-change-schema.d.ts +266 -0
  5. package/dist/browser/flow-change.d.ts +5 -0
  6. package/dist/browser/flow-change.js +33 -2
  7. package/dist/browser/{flowChanges-BxutPLYO.js → flowChanges-fBiAeTzR.js} +954 -487
  8. package/dist/browser/{flowWorkspace-Dg4mqfa6.js → flowWorkspace-MqcEfg7T.js} +3 -3
  9. package/dist/browser/{icons-p2A9zs8t.js → icons-6oQ8Q9Wm.js} +4298 -4252
  10. package/dist/browser/preview.js +354 -36
  11. package/dist/browser/workbench.js +21 -10
  12. package/dist/browser/{workbenchSelect-LRp_Xjeq.js → workbenchSelect-DpLbIr29.js} +1 -1
  13. package/dist/common/authoring.d.ts +207 -0
  14. package/dist/common/authoringSchema.d.ts +1293 -0
  15. package/dist/common/control-api-conformance.js +975 -505
  16. package/dist/common/control-api-errors.d.ts +2 -1
  17. package/dist/common/control-api.d.ts +81 -0
  18. package/dist/common/control-api.js +973 -586
  19. package/dist/common/control-requests.d.ts +128 -0
  20. package/dist/common/control-requests.js +3122 -346
  21. package/dist/common/decision.js +12 -2
  22. package/dist/common/flow-encoding.js +12 -2
  23. package/dist/common/flow-semantics.d.ts +9 -0
  24. package/dist/common/flow-semantics.js +28 -3
  25. package/dist/common/integration-trigger.js +12 -2
  26. package/dist/common/lib-DrKav3HG.js +11403 -0
  27. package/dist/common/mcp.d.ts +120 -11
  28. package/dist/common/mcp.js +423 -51
  29. package/dist/common/openapi.js +12 -2
  30. package/dist/common/poll-trigger.js +12 -2
  31. package/dist/common/scheduler.js +12 -2
  32. package/dist/common/webhook-trigger.js +12 -2
  33. package/package.json +7 -1
  34. package/skills/open-flow/SKILL.md +32 -0
  35. package/skills/open-flow/references/flow-authoring.md +356 -0
  36. package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
@@ -22,139 +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
- var InvalidResponseError = class extends ApiError {
120
- constructor(detail) {
121
- super(502, "response.invalid", `The Control API returned an invalid response.${detail == null ? "" : ` ${detail}`}`);
122
- this.detail = detail;
123
- }
124
- };
125
- function invalidResponse(detail) {
126
- throw new InvalidResponseError(detail);
127
- }
128
- function record$3(value) {
129
- if (value == null || typeof value != "object" || Array.isArray(value)) return invalidResponse("Expected an object.");
130
- return value;
131
- }
132
- function string$1(value) {
133
- return typeof value == "string" && value.length > 0 ? value : invalidResponse("Expected a non-empty string.");
134
- }
135
- function exact(value, keys) {
136
- const actual = Object.keys(value);
137
- if (actual.length != keys.length || actual.some((key) => !keys.includes(key))) {
138
- const missing = keys.filter((key) => !Object.hasOwn(value, key));
139
- const unexpected = actual.filter((key) => !keys.includes(key));
140
- invalidResponse([missing.length > 0 ? `Missing fields: ${missing.join(", ")}.` : "", unexpected.length > 0 ? `Unexpected fields: ${unexpected.join(", ")}.` : ""].filter(Boolean).join(" "));
141
- }
142
- }
143
- function integer$1(value) {
144
- return Number.isSafeInteger(value) ? value : invalidResponse("Expected a safe integer.");
145
- }
146
- function jsonValue(value) {
147
- if (value === null || typeof value == "boolean" || typeof value == "string") return value;
148
- if (typeof value == "number" && Number.isFinite(value)) return value;
149
- if (Array.isArray(value)) return value.map(jsonValue);
150
- const source = record$3(value);
151
- return Object.fromEntries(Object.entries(source).map(([key, item]) => [key, jsonValue(item)]));
152
- }
153
- function optionalString(value) {
154
- if (value == null) return;
155
- return string$1(value);
156
- }
157
- //#endregion
158
25
  //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
159
26
  function getEnumValues(entries) {
160
27
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -1187,7 +1054,7 @@ function datetime(args) {
1187
1054
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1188
1055
  }
1189
1056
  var anyString = /^[\s\S]{0,}$/;
1190
- var integer = /^-?\d+$/;
1057
+ var integer$1 = /^-?\d+$/;
1191
1058
  var number$1 = /^-?\d+(?:\.\d+)?$/;
1192
1059
  var boolean$1 = /^(?:true|false)$/i;
1193
1060
  var _null$2 = /^null$/i;
@@ -4674,7 +4541,7 @@ function stringifyKeyNames(bySchema, json, visited) {
4674
4541
  else if (typeof rest.const === "number") rest.const = String(rest.const);
4675
4542
  if (!numericType) return rest;
4676
4543
  rest.type = "string";
4677
- if (!values) rest.pattern = (types.includes("number") ? number$1 : integer).source;
4544
+ if (!values) rest.pattern = (types.includes("number") ? number$1 : integer$1).source;
4678
4545
  return rest;
4679
4546
  }
4680
4547
  /** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
@@ -5207,7 +5074,7 @@ var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
5207
5074
  return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
5208
5075
  }
5209
5076
  });
5210
- function string(params) {
5077
+ function string$1(params) {
5211
5078
  return /* @__PURE__ */ _string(ZodString, params);
5212
5079
  }
5213
5080
  var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
@@ -5555,10 +5422,10 @@ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5555
5422
  inst.keyType = def.keyType;
5556
5423
  inst.valueType = def.valueType;
5557
5424
  });
5558
- function record$2(keyType, valueType, params) {
5425
+ function record$3(keyType, valueType, params) {
5559
5426
  if (!valueType || !valueType._zod) return new ZodRecord({
5560
5427
  type: "record",
5561
- keyType: string(),
5428
+ keyType: string$1(),
5562
5429
  valueType: keyType,
5563
5430
  ...normalizeParams(valueType)
5564
5431
  });
@@ -5803,15 +5670,15 @@ function refine(fn, _params = {}) {
5803
5670
  function superRefine(fn, params) {
5804
5671
  return /* @__PURE__ */ _superRefine(fn, params);
5805
5672
  }
5806
- function json$3(params) {
5673
+ function json$4(params) {
5807
5674
  const jsonSchema = lazy(() => {
5808
5675
  return union([
5809
- string(params),
5676
+ string$1(params),
5810
5677
  number(),
5811
5678
  boolean(),
5812
5679
  _null(),
5813
5680
  array(jsonSchema),
5814
- record$2(string(), jsonSchema)
5681
+ record$3(string$1(), jsonSchema)
5815
5682
  ]);
5816
5683
  });
5817
5684
  return jsonSchema;
@@ -5833,6 +5700,29 @@ function assertOpenApiAuthBindings(document) {
5833
5700
  }
5834
5701
  }
5835
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
5836
5726
  //#region src/json-schema-subset/utils.ts
5837
5727
  var nextId = 0;
5838
5728
  function createId() {
@@ -6252,7 +6142,7 @@ var ExpressionKind = Object.freeze({
6252
6142
  });
6253
6143
  //#endregion
6254
6144
  //#region src/json-schema-subset/expression/expression.ts
6255
- var expression = (delegate) => (e1, e2) => {
6145
+ var expression$1 = (delegate) => (e1, e2) => {
6256
6146
  const rootNode = {
6257
6147
  parent: null,
6258
6148
  swapped: false,
@@ -8240,7 +8130,7 @@ function checkWithResult(extendsContext, schema1, schema2) {
8240
8130
  const describe = describer();
8241
8131
  const equals = schemaEqualsChecker(extendsContext);
8242
8132
  context.isEquals = wrapEqualsCheckerWithCache(isDeepEquals);
8243
- context.calculate = expression({
8133
+ context.calculate = expression$1({
8244
8134
  describe,
8245
8135
  equals,
8246
8136
  calculate,
@@ -8686,8 +8576,8 @@ function checkJsonDepth(value, depth = 0) {
8686
8576
  //#region src/flow/common/triggerScheduleSchema.ts
8687
8577
  var triggerScheduleSchema = array(union([object({
8688
8578
  type: literal("cron"),
8689
- expression: string(),
8690
- timezone: string()
8579
+ expression: string$1(),
8580
+ timezone: string$1()
8691
8581
  }), object({
8692
8582
  type: literal("every"),
8693
8583
  unit: _enum([
@@ -8708,16 +8598,16 @@ var webhookMethods = [
8708
8598
  "PATCH",
8709
8599
  "DELETE"
8710
8600
  ];
8711
- var text = string();
8712
- var json$2 = json$3();
8713
- var strings = array(text);
8601
+ var text = string$1();
8602
+ var json$3 = json$4();
8603
+ var strings$1 = array(text);
8714
8604
  var port$1 = object({
8715
8605
  description: text.optional(),
8716
- jsonSchema: json$2,
8606
+ jsonSchema: json$3,
8717
8607
  nullable: boolean(),
8718
8608
  handle: text
8719
8609
  });
8720
- var input = port$1.extend({ value: json$2.optional() });
8610
+ var input = port$1.extend({ value: json$3.optional() });
8721
8611
  var group = object({
8722
8612
  collapsed: boolean().optional(),
8723
8613
  group: text
@@ -8733,13 +8623,13 @@ var source = union([object({
8733
8623
  })]);
8734
8624
  var fixedInput = union([object({ kind: literal("unset") }), object({
8735
8625
  kind: literal("value"),
8736
- value: json$2
8626
+ value: json$3
8737
8627
  })]);
8738
8628
  var mapping = union([fixedInput, object({
8739
8629
  kind: literal("sources"),
8740
8630
  sources: array(source)
8741
8631
  })]);
8742
- var inputs = record$2(text, mapping);
8632
+ var inputs = record$3(text, mapping);
8743
8633
  var ports$1 = {
8744
8634
  inputs: array(union([input, group])),
8745
8635
  outputs: array(union([port$1, group]))
@@ -8784,7 +8674,7 @@ var inline = object({
8784
8674
  });
8785
8675
  var agentValue = union([object({
8786
8676
  kind: literal("value"),
8787
- value: json$2
8677
+ value: json$3
8788
8678
  }), object({
8789
8679
  kind: literal("input"),
8790
8680
  input: text
@@ -8813,10 +8703,10 @@ var decisionQuestion = discriminatedUnion("type", [
8813
8703
  name: text,
8814
8704
  instructions: text,
8815
8705
  type: literal("score"),
8816
- criteria: strings
8706
+ criteria: strings$1
8817
8707
  })
8818
8708
  ]);
8819
- var managed = object({
8709
+ var managedFields = object({
8820
8710
  ...ports$1,
8821
8711
  name: text,
8822
8712
  executor: union([
@@ -8831,7 +8721,7 @@ var managed = object({
8831
8721
  method: text,
8832
8722
  path: text,
8833
8723
  serverUrl: text,
8834
- document: json$2,
8724
+ document: json$3,
8835
8725
  auth: array(object({
8836
8726
  id: text,
8837
8727
  type: _enum([
@@ -8871,15 +8761,16 @@ var managed = object({
8871
8761
  connectionId: text.optional(),
8872
8762
  inputDefinitions: array(input),
8873
8763
  messageHandle: text,
8874
- inputs: record$2(text, agentValue)
8764
+ inputs: record$3(text, agentValue)
8875
8765
  }).optional()
8876
8766
  })
8877
8767
  ])
8878
- }).transform(limitDecisionTask);
8879
- var operand = union([object({
8768
+ });
8769
+ var managed = managedFields.transform(limitDecisionTask);
8770
+ var operand$1 = union([object({
8880
8771
  kind: literal("value"),
8881
- value: json$2.optional(),
8882
- jsonSchema: json$2.optional()
8772
+ value: json$3.optional(),
8773
+ jsonSchema: json$3.optional()
8883
8774
  }), object({
8884
8775
  kind: literal("source"),
8885
8776
  source
@@ -8890,7 +8781,7 @@ var condition = {
8890
8781
  description: text.optional(),
8891
8782
  output: text,
8892
8783
  groups: array(object({ expressions: array(object({
8893
- left: operand,
8784
+ left: operand$1,
8894
8785
  operator: _enum([
8895
8786
  "!=",
8896
8787
  "<",
@@ -8913,7 +8804,7 @@ var condition = {
8913
8804
  "notHasValue",
8914
8805
  "startsWith"
8915
8806
  ]),
8916
- right: operand.optional()
8807
+ right: operand$1.optional()
8917
8808
  })) }))
8918
8809
  }))
8919
8810
  };
@@ -8923,10 +8814,10 @@ var wait = {
8923
8814
  };
8924
8815
  var webhookOptions = object({
8925
8816
  allowedMethods: never().optional(),
8926
- allowedOrigins: strings.optional(),
8817
+ allowedOrigins: strings$1.optional(),
8927
8818
  noResponseBody: never().optional(),
8928
8819
  responseData: text.optional(),
8929
- responseHeaders: record$2(text, text).optional(),
8820
+ responseHeaders: record$3(text, text).optional(),
8930
8821
  responseStatusCode: number().int().min(200).max(599).optional()
8931
8822
  });
8932
8823
  var webhook = {
@@ -8982,7 +8873,7 @@ var base = {
8982
8873
  var node = union([
8983
8874
  object({
8984
8875
  ...base,
8985
- inputs: record$2(text, never()),
8876
+ inputs: record$3(text, never()),
8986
8877
  kind: literal("condition"),
8987
8878
  ...condition
8988
8879
  }),
@@ -9031,7 +8922,7 @@ var node = union([
9031
8922
  ...trigger,
9032
8923
  kind: literal("poll"),
9033
8924
  connectionId: text.min(1).optional(),
9034
- config: record$2(text, fixedInput),
8925
+ config: record$3(text, fixedInput),
9035
8926
  definition: object({
9036
8927
  ...definition,
9037
8928
  type: literal("poll")
@@ -9042,7 +8933,7 @@ var node = union([
9042
8933
  ...trigger,
9043
8934
  kind: literal("integration"),
9044
8935
  connectionId: text.min(1).optional(),
9045
- config: record$2(text, fixedInput),
8936
+ config: record$3(text, fixedInput),
9046
8937
  definition: object({
9047
8938
  ...definition,
9048
8939
  type: literal("integration"),
@@ -9050,6 +8941,25 @@ var node = union([
9050
8941
  })
9051
8942
  })
9052
8943
  ]);
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
+ };
9053
8963
  var edge = object({
9054
8964
  source: text,
9055
8965
  target: text,
@@ -9060,7 +8970,7 @@ var at = {
9060
8970
  target: never().optional()
9061
8971
  };
9062
8972
  var graph = object({
9063
- nodes: record$2(text, node),
8973
+ nodes: record$3(text, node),
9064
8974
  edges: array(edge).default([])
9065
8975
  });
9066
8976
  var binding = object({
@@ -9069,11 +8979,11 @@ var binding = object({
9069
8979
  });
9070
8980
  var module = object({
9071
8981
  name: text,
9072
- imports: strings,
8982
+ imports: strings$1,
9073
8983
  source: text
9074
8984
  });
9075
8985
  var document = preprocess(rejectRetiredDefinitions, object({
9076
- bindings: record$2(text, binding),
8986
+ bindings: record$3(text, binding),
9077
8987
  graph
9078
8988
  }));
9079
8989
  var revision = object({
@@ -9084,22 +8994,22 @@ var revision = object({
9084
8994
  literal(6)
9085
8995
  ]),
9086
8996
  document,
9087
- modules: record$2(text, module)
8997
+ modules: record$3(text, module)
9088
8998
  });
9089
8999
  revision.extend({
9090
9000
  kind: literal("open-flow-flow-revision"),
9091
9001
  version: literal(1)
9092
9002
  });
9093
9003
  function rejectRetiredDefinitions(value) {
9094
- const candidate = record$1(value);
9004
+ const candidate = record$2(value);
9095
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.");
9096
- if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => Object.hasOwn(record$1(candidateNode), "taskId"))) throw new TypeError("Task references are no longer supported.");
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.");
9097
9007
  const subflows = candidate.subflows;
9098
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.");
9099
- if (Object.values(record$1(record$1(candidate.graph).nodes)).some((candidateNode) => record$1(candidateNode).kind === "subflow")) throw new TypeError("Subflow nodes are no longer supported.");
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.");
9100
9010
  return value;
9101
9011
  }
9102
- function record$1(value) {
9012
+ function record$2(value) {
9103
9013
  return value != null && typeof value == "object" && !Array.isArray(value) ? value : {};
9104
9014
  }
9105
9015
  function decodeRevisionContent(value) {
@@ -9137,6 +9047,11 @@ var shapes = {
9137
9047
  ...at,
9138
9048
  node
9139
9049
  },
9050
+ "graph.node.replace": {
9051
+ ...at,
9052
+ before: node,
9053
+ node
9054
+ },
9140
9055
  "graph.node.delete": at,
9141
9056
  "graph.node.field.set": union([
9142
9057
  object({
@@ -9241,9 +9156,9 @@ var shapes = {
9241
9156
  },
9242
9157
  "module.source.replace": {
9243
9158
  moduleId: text,
9244
- beforeImports: strings,
9159
+ beforeImports: strings$1,
9245
9160
  beforeSource: text,
9246
- imports: strings,
9161
+ imports: strings$1,
9247
9162
  source: text
9248
9163
  },
9249
9164
  "graph.node.task.set": {
@@ -9261,34 +9176,437 @@ function checkModelVersion(content) {
9261
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.");
9262
9177
  }
9263
9178
  //#endregion
9264
- //#region src/flow/common/change.ts
9265
- var schemaKeywords = /* @__PURE__ */ new Set([
9266
- "const",
9267
- "enum",
9268
- "exclusiveMaximum",
9269
- "exclusiveMinimum",
9270
- "maximum",
9271
- "maxItems",
9272
- "maxLength",
9273
- "maxProperties",
9274
- "minimum",
9275
- "minItems",
9276
- "minLength",
9277
- "minProperties",
9278
- "multipleOf",
9279
- "pattern",
9280
- "required",
9281
- "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
+ })
9282
9197
  ]);
9283
- function isSchemaKeyword(value) {
9284
- 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);
9285
9603
  }
9286
9604
  new TextEncoder();
9287
9605
  //#endregion
9288
9606
  //#region src/control/common/providerAccess.ts
9289
9607
  var sourceSchema = discriminatedUnion("kind", [strictObject({ kind: literal("admin-delegation") }), strictObject({
9290
9608
  kind: literal("policy"),
9291
- ruleId: string().min(1).nullable()
9609
+ ruleId: string$1().min(1).nullable()
9292
9610
  })]);
9293
9611
  function parseProviderAccessSource(value) {
9294
9612
  return sourceSchema.parse(value);
@@ -9296,7 +9614,7 @@ function parseProviderAccessSource(value) {
9296
9614
  //#endregion
9297
9615
  //#region src/control/common/connectorDecoders.ts
9298
9616
  function accessPermissions(value) {
9299
- const source = record$3(value);
9617
+ const source = record$1(value);
9300
9618
  exact(source, [
9301
9619
  "actionIds",
9302
9620
  "allActions",
@@ -9311,8 +9629,8 @@ function accessPermissions(value) {
9311
9629
  if (typeof source.allTriggers != "boolean") return invalidResponse("permissions.allTriggers: expected a boolean.");
9312
9630
  if (typeof source.configured != "boolean") return invalidResponse("permissions.configured: expected a boolean.");
9313
9631
  if (typeof source.proxy != "boolean") return invalidResponse("permissions.proxy: expected a boolean.");
9314
- const actionIds = source.actionIds.map(string$1);
9315
- const triggerIds = source.triggerIds.map(string$1);
9632
+ const actionIds = source.actionIds.map(string);
9633
+ const triggerIds = source.triggerIds.map(string);
9316
9634
  if (new Set(actionIds).size != actionIds.length) return invalidResponse("permissions.actionIds: duplicate IDs.");
9317
9635
  if (source.allActions && actionIds.length != 0) return invalidResponse("permissions.actionIds: must be empty when allActions is true.");
9318
9636
  if (new Set(triggerIds).size != triggerIds.length) return invalidResponse("permissions.triggerIds: duplicate IDs.");
@@ -9328,7 +9646,7 @@ function accessPermissions(value) {
9328
9646
  };
9329
9647
  }
9330
9648
  function accessBinding(value, candidate) {
9331
- const source = record$3(value);
9649
+ const source = record$1(value);
9332
9650
  const policyRevision = source.policyRevision;
9333
9651
  const status = source.status;
9334
9652
  const isDefault = source.isDefault;
@@ -9358,15 +9676,15 @@ function accessBinding(value, candidate) {
9358
9676
  return invalidResponse("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.");
9359
9677
  }
9360
9678
  return {
9361
- accessBindingId: string$1(source.accessBindingId),
9362
- connectionId: string$1(source.connectionId),
9679
+ accessBindingId: string(source.accessBindingId),
9680
+ connectionId: string(source.connectionId),
9363
9681
  source: bindingSource,
9364
- connectionDisplayName: string$1(legacy ? source.displayName : source.connectionDisplayName),
9682
+ connectionDisplayName: string(legacy ? source.displayName : source.connectionDisplayName),
9365
9683
  ...candidate && typeof isDefault == "boolean" ? { isDefault } : {},
9366
9684
  ...permissions == null ? {} : { permissions },
9367
9685
  ...permissionGroupName === void 0 ? {} : { permissionGroupName },
9368
9686
  ...policyRevision == null ? {} : { policyRevision },
9369
- providerId: string$1(source.providerId),
9687
+ providerId: string(source.providerId),
9370
9688
  ...candidate ? {} : { status }
9371
9689
  };
9372
9690
  }
@@ -9375,7 +9693,7 @@ function accessMode(value) {
9375
9693
  return value;
9376
9694
  }
9377
9695
  function connectorAccess(value) {
9378
- const source = record$3(value);
9696
+ const source = record$1(value);
9379
9697
  exact(source, [
9380
9698
  "accessRevision",
9381
9699
  "bindings",
@@ -9385,12 +9703,12 @@ function connectorAccess(value) {
9385
9703
  ..."discardedBindingCount" in source ? ["discardedBindingCount"] : [],
9386
9704
  "version"
9387
9705
  ]);
9388
- const accessRevision = integer$1(source.accessRevision);
9706
+ const accessRevision = integer(source.accessRevision);
9389
9707
  if (source.version != 1 || accessRevision < 0 || !Array.isArray(source.bindings)) return invalidResponse();
9390
9708
  if ("providerIds" in source && !Array.isArray(source.providerIds)) return invalidResponse();
9391
- 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));
9392
9710
  if (providerIds != null && new Set(providerIds).size != providerIds.length) return invalidResponse();
9393
- let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer$1(source.discardedBindingCount);
9711
+ let discardedBindingCount = source.discardedBindingCount == null ? 0 : integer(source.discardedBindingCount);
9394
9712
  if (discardedBindingCount < 0) return invalidResponse();
9395
9713
  const bindings = [];
9396
9714
  for (const entry of source.bindings) try {
@@ -9415,14 +9733,14 @@ function connectorAccess(value) {
9415
9733
  ...providerIds == null ? {} : { providerIds },
9416
9734
  bindings,
9417
9735
  mode: accessMode(source.mode),
9418
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9736
+ sharedAccessDigest: string(source.sharedAccessDigest),
9419
9737
  version: 1
9420
9738
  };
9421
9739
  }
9422
9740
  function accessGrants(value) {
9423
9741
  if (!Array.isArray(value)) return invalidResponse();
9424
9742
  const bindings = value.map((candidate) => {
9425
- const entry = record$3(candidate);
9743
+ const entry = record$1(candidate);
9426
9744
  exact(entry, [
9427
9745
  "accessBindingId",
9428
9746
  "connectionId",
@@ -9439,11 +9757,11 @@ function accessGrants(value) {
9439
9757
  }
9440
9758
  if (entry.permissionGroupName != null && typeof entry.permissionGroupName != "string") return invalidResponse();
9441
9759
  return {
9442
- accessBindingId: string$1(entry.accessBindingId),
9443
- connectionId: string$1(entry.connectionId),
9444
- providerId: string$1(entry.providerId),
9760
+ accessBindingId: string(entry.accessBindingId),
9761
+ connectionId: string(entry.connectionId),
9762
+ providerId: string(entry.providerId),
9445
9763
  source: identity,
9446
- connectionDisplayName: string$1(entry.connectionDisplayName),
9764
+ connectionDisplayName: string(entry.connectionDisplayName),
9447
9765
  ..."permissionGroupName" in entry ? { permissionGroupName: entry.permissionGroupName } : {}
9448
9766
  };
9449
9767
  });
@@ -9451,7 +9769,7 @@ function accessGrants(value) {
9451
9769
  return bindings;
9452
9770
  }
9453
9771
  function connectorAccessSnapshot(value) {
9454
- const source = record$3(value);
9772
+ const source = record$1(value);
9455
9773
  exact(source, [
9456
9774
  "mode",
9457
9775
  "sharedAccessDigest",
@@ -9466,14 +9784,14 @@ function connectorAccessSnapshot(value) {
9466
9784
  if (mode == "implicit" && (sharedBindings.length > 0 || selectedBindings.length > 0)) return invalidResponse();
9467
9785
  return {
9468
9786
  mode,
9469
- sharedAccessDigest: string$1(source.sharedAccessDigest),
9787
+ sharedAccessDigest: string(source.sharedAccessDigest),
9470
9788
  sharedBindings,
9471
9789
  selectedBindings,
9472
9790
  version: 2
9473
9791
  };
9474
9792
  }
9475
9793
  function connectorAccessCandidates(value, providerId) {
9476
- const source = record$3(value);
9794
+ const source = record$1(value);
9477
9795
  exact(source, [
9478
9796
  "candidates",
9479
9797
  "mode",
@@ -9481,7 +9799,7 @@ function connectorAccessCandidates(value, providerId) {
9481
9799
  "version"
9482
9800
  ]);
9483
9801
  if (source.version != 1) return invalidResponse("version: expected 1.");
9484
- if (string$1(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9802
+ if (string(source.providerId) != providerId) return invalidResponse("providerId: does not match the requested provider.");
9485
9803
  if (!Array.isArray(source.candidates)) return invalidResponse("candidates: expected an array.");
9486
9804
  const candidates = source.candidates.map((candidate) => accessBinding(candidate, true));
9487
9805
  if (candidates.some((candidate) => candidate.providerId != providerId)) return invalidResponse("candidates[].providerId: does not match the requested provider.");
@@ -9494,24 +9812,24 @@ function connectorAccessCandidates(value, providerId) {
9494
9812
  };
9495
9813
  }
9496
9814
  function connectorAccessCandidatesBatch(value, providerIds) {
9497
- const source = record$3(value);
9815
+ const source = record$1(value);
9498
9816
  exact(source, ["results", "version"]);
9499
9817
  if (source.version != 1) return invalidResponse("version: expected 1.");
9500
9818
  if (!Array.isArray(source.results)) return invalidResponse("results: expected an array.");
9501
9819
  const remaining = new Set(providerIds);
9502
9820
  const results = source.results.map((entry) => {
9503
- const item = record$3(entry);
9504
- const providerId = string$1(item.providerId);
9821
+ const item = record$1(entry);
9822
+ const providerId = string(item.providerId);
9505
9823
  if (!remaining.delete(providerId)) return invalidResponse("results[].providerId: duplicate or unrequested provider.");
9506
9824
  if (!Object.hasOwn(item, "error")) return connectorAccessCandidates(item, providerId);
9507
9825
  exact(item, ["providerId", "error"]);
9508
- const error = record$3(item.error);
9826
+ const error = record$1(item.error);
9509
9827
  exact(error, ["code", "message"]);
9510
9828
  return {
9511
9829
  providerId,
9512
9830
  error: {
9513
- code: string$1(error.code),
9514
- message: string$1(error.message)
9831
+ code: string(error.code),
9832
+ message: string(error.message)
9515
9833
  }
9516
9834
  };
9517
9835
  });
@@ -9522,7 +9840,7 @@ function connectorAccessCandidatesBatch(value, providerIds) {
9522
9840
  };
9523
9841
  }
9524
9842
  function connection(value) {
9525
- const source = record$3(value);
9843
+ const source = record$1(value);
9526
9844
  exact(source, [
9527
9845
  ...Object.hasOwn(source, "providerAccountId") ? ["providerAccountId"] : [],
9528
9846
  ...Object.hasOwn(source, "alias") ? ["alias"] : [],
@@ -9538,18 +9856,18 @@ function connection(value) {
9538
9856
  if (status != "active" && status != "disconnected" && status != "error" && status != "reauth_required") return invalidResponse();
9539
9857
  if (typeof source.isDefault != "boolean") return invalidResponse();
9540
9858
  return {
9541
- ...source.providerAccountId === void 0 ? {} : { providerAccountId: string$1(source.providerAccountId) },
9542
- ...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) },
9543
9861
  ...source.builtInAccount === void 0 ? {} : { builtInAccount: source.builtInAccount },
9544
- connectionId: string$1(source.connectionId),
9545
- displayName: string$1(source.displayName),
9862
+ connectionId: string(source.connectionId),
9863
+ displayName: string(source.displayName),
9546
9864
  isDefault: source.isDefault,
9547
- serviceId: string$1(source.serviceId),
9865
+ serviceId: string(source.serviceId),
9548
9866
  status
9549
9867
  };
9550
9868
  }
9551
9869
  function port(value, input = false) {
9552
- const source = record$3(value);
9870
+ const source = record$1(value);
9553
9871
  const description = source.description;
9554
9872
  const hasValue = input && Object.hasOwn(source, "value");
9555
9873
  exact(source, [
@@ -9571,10 +9889,10 @@ function inputPort(value) {
9571
9889
  return port(value, true);
9572
9890
  }
9573
9891
  function ports(value, decode) {
9574
- return Object.fromEntries(Object.entries(record$3(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9892
+ return Object.fromEntries(Object.entries(record$1(value)).map(([handle, candidate]) => [handle, decode(candidate)]));
9575
9893
  }
9576
9894
  function connectorActionMetadata(value) {
9577
- const source = record$3(value);
9895
+ const source = record$1(value);
9578
9896
  const homepageUrl = source.homepageUrl;
9579
9897
  const icon = source.icon;
9580
9898
  exact(source, [
@@ -9598,22 +9916,22 @@ function connectorActionMetadata(value) {
9598
9916
  return {
9599
9917
  ...source.inputSchema === void 0 ? {} : { inputSchema: jsonValue(source.inputSchema) },
9600
9918
  ...source.outputSchema === void 0 ? {} : { outputSchema: jsonValue(source.outputSchema) },
9601
- actionId: string$1(source.actionId),
9602
- ...source.operationType == null ? {} : { operationType: string$1(source.operationType) },
9919
+ actionId: string(source.actionId),
9920
+ ...source.operationType == null ? {} : { operationType: string(source.operationType) },
9603
9921
  authenticated: typeof source.authenticated == "boolean" ? source.authenticated : invalidResponse(),
9604
9922
  description: typeof source.description == "string" ? source.description : invalidResponse(),
9605
9923
  ...homepageUrl == null ? {} : { homepageUrl },
9606
9924
  ...icon == null ? {} : { icon },
9607
9925
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9608
9926
  inputs: ports(source.inputs, inputPort),
9609
- name: string$1(source.name),
9927
+ name: string(source.name),
9610
9928
  outputs: ports(source.outputs, port),
9611
- serviceId: string$1(source.serviceId),
9612
- serviceName: string$1(source.serviceName)
9929
+ serviceId: string(source.serviceId),
9930
+ serviceName: string(source.serviceName)
9613
9931
  };
9614
9932
  }
9615
9933
  function connectorAction(value) {
9616
- const { defaultConnection, ...metadata } = record$3(value);
9934
+ const { defaultConnection, ...metadata } = record$1(value);
9617
9935
  const action = connectorActionMetadata(metadata);
9618
9936
  if (defaultConnection == null) return action;
9619
9937
  const preferred = connection(defaultConnection);
@@ -9624,7 +9942,7 @@ function connectorAction(value) {
9624
9942
  };
9625
9943
  }
9626
9944
  function connectorProvider(value) {
9627
- const source = record$3(value);
9945
+ const source = record$1(value);
9628
9946
  const homepageUrl = source.homepageUrl;
9629
9947
  const icon = source.icon;
9630
9948
  if (source.noSetup !== void 0 && typeof source.noSetup != "boolean") return invalidResponse();
@@ -9642,16 +9960,16 @@ function connectorProvider(value) {
9642
9960
  ...homepageUrl == null ? {} : { homepageUrl },
9643
9961
  ...icon == null ? {} : { icon },
9644
9962
  ...providerIconAppearance(source.iconSprite, source.iconSpritePosition),
9645
- serviceId: string$1(source.serviceId),
9646
- serviceName: string$1(source.serviceName),
9963
+ serviceId: string(source.serviceId),
9964
+ serviceName: string(source.serviceName),
9647
9965
  ...source.noSetup === void 0 ? {} : { noSetup: source.noSetup }
9648
9966
  };
9649
9967
  }
9650
9968
  //#endregion
9651
9969
  //#region src/control/common/eventSources.ts
9652
- var id = string().min(1).max(256);
9653
- var eventType = string().regex(/^[a-z][a-z0-9_.]{0,127}$/);
9654
- 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);
9655
9973
  var eventSourceSchema = strictObject({
9656
9974
  version: literal(1),
9657
9975
  sourceId: id,
@@ -9666,13 +9984,13 @@ var eventSourceSchema = strictObject({
9666
9984
  manageSubscriptions: boolean(),
9667
9985
  verificationTokenConfigured: boolean(),
9668
9986
  encryptKeyConfigured: boolean(),
9669
- endpointUrl: string().nullable(),
9670
- verifiedAt: string().nullable(),
9671
- lastReceivedAt: string().nullable(),
9672
- updatedAt: string(),
9987
+ endpointUrl: string$1().nullable(),
9988
+ verifiedAt: string$1().nullable(),
9989
+ lastReceivedAt: string$1().nullable(),
9990
+ updatedAt: string$1(),
9673
9991
  consumers: array(strictObject({
9674
9992
  flowId: id,
9675
- flowName: string(),
9993
+ flowName: string$1(),
9676
9994
  triggerNodeId: id
9677
9995
  }))
9678
9996
  });
@@ -9701,32 +10019,32 @@ function isUiLanguage(value) {
9701
10019
  //#endregion
9702
10020
  //#region src/trigger/common/configSchema.ts
9703
10021
  var configInputsSchema = array(union([strictObject({
9704
- handle: string().min(1),
9705
- description: string().optional(),
9706
- jsonSchema: json$3(),
10022
+ handle: string$1().min(1),
10023
+ description: string$1().optional(),
10024
+ jsonSchema: json$4(),
9707
10025
  nullable: boolean(),
9708
- value: json$3().optional()
10026
+ value: json$4().optional()
9709
10027
  }), strictObject({
9710
- group: string(),
10028
+ group: string$1(),
9711
10029
  collapsed: boolean().optional()
9712
10030
  })]));
9713
10031
  //#endregion
9714
10032
  //#region src/control/common/triggerDecoders.ts
9715
10033
  function triggerKeySummary(value) {
9716
- const source = record$3(value);
10034
+ const source = record$1(value);
9717
10035
  const type = source.type;
9718
10036
  if (type != "integration" && type != "poll") return invalidResponse();
9719
10037
  return {
9720
10038
  description: typeof source.description == "string" ? source.description : invalidResponse(),
9721
- displayName: string$1(source.displayName),
9722
- key: string$1(source.key),
9723
- name: string$1(source.name),
9724
- 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),
9725
10043
  type
9726
10044
  };
9727
10045
  }
9728
10046
  function triggerKey(value) {
9729
- const source = record$3(value);
10047
+ const source = record$1(value);
9730
10048
  const summary = triggerKeySummary(source);
9731
10049
  const base = {
9732
10050
  configInputs: configInputsSchema.parse(source.configInputs),
@@ -9736,12 +10054,12 @@ function triggerKey(value) {
9736
10054
  key: summary.key,
9737
10055
  name: summary.name,
9738
10056
  outputs: (Array.isArray(source.outputs) ? source.outputs : invalidResponse()).map((entry) => {
9739
- const port = record$3(entry);
10057
+ const port = record$1(entry);
9740
10058
  return Object.assign({
9741
- handle: string$1(port.handle),
10059
+ handle: string(port.handle),
9742
10060
  jsonSchema: jsonValue(port.jsonSchema),
9743
10061
  nullable: typeof port.nullable === "boolean" ? port.nullable : invalidResponse()
9744
- }, port.description == null ? {} : { description: string$1(port.description) });
10062
+ }, port.description == null ? {} : { description: string(port.description) });
9745
10063
  }),
9746
10064
  provider: summary.provider
9747
10065
  };
@@ -9749,12 +10067,12 @@ function triggerKey(value) {
9749
10067
  ...base,
9750
10068
  type: "poll"
9751
10069
  };
9752
- const endpoint = record$3(source.endpoint);
9753
- const body = record$3(endpoint.body);
10070
+ const endpoint = record$1(source.endpoint);
10071
+ const body = record$1(endpoint.body);
9754
10072
  if (!Array.isArray(endpoint.methods) || !Array.isArray(body.formats) || typeof body.allowArray != "boolean" || typeof body.allowEmpty != "boolean") return invalidResponse();
9755
- const methods = endpoint.methods.map(string$1);
9756
- const formats = body.formats.map(string$1);
9757
- 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);
9758
10076
  if (methods.some((method) => ![
9759
10077
  "DELETE",
9760
10078
  "GET",
@@ -9806,38 +10124,38 @@ var triggerActivityKinds = /* @__PURE__ */ new Set([
9806
10124
  "operator.resumed"
9807
10125
  ]);
9808
10126
  function triggerBinding(value) {
9809
- const source = record$3(value);
10127
+ const source = record$1(value);
9810
10128
  const health = source.health;
9811
- const listener = source.listener == null ? void 0 : record$3(source.listener);
10129
+ const listener = source.listener == null ? void 0 : record$1(source.listener);
9812
10130
  if (listener != null && listener.health != "healthy" && listener.health != "failed" && listener.health != "needs_reauth") return invalidResponse();
9813
10131
  const kind = source.kind;
9814
10132
  const operatorState = source.operatorState;
9815
- const runtimeVersion = integer$1(source.runtimeVersion);
10133
+ const runtimeVersion = integer(source.runtimeVersion);
9816
10134
  if (source.version != 1 || typeof health != "string" || !triggerHealth.has(health)) return invalidResponse();
9817
10135
  if (typeof kind != "string" || !triggerKinds.has(kind)) return invalidResponse();
9818
10136
  if (operatorState != "active" && operatorState != "paused") return invalidResponse();
9819
10137
  if (runtimeVersion <= 0) return invalidResponse();
9820
10138
  return {
9821
- ...source.currentPublicationId == null ? {} : { currentPublicationId: string$1(source.currentPublicationId) },
9822
- ...source.currentRevisionId == null ? {} : { currentRevisionId: string$1(source.currentRevisionId) },
9823
- ...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) },
9824
10142
  ...listener == null ? {} : { listener: {
9825
10143
  health: listener.health,
9826
- ...listener.lastErrorCode == null ? {} : { lastErrorCode: string$1(listener.lastErrorCode) }
10144
+ ...listener.lastErrorCode == null ? {} : { lastErrorCode: string(listener.lastErrorCode) }
9827
10145
  } },
9828
- flowId: string$1(source.flowId),
10146
+ flowId: string(source.flowId),
9829
10147
  health,
9830
10148
  kind,
9831
- ...source.lastErrorCode == null ? {} : { lastErrorCode: string$1(source.lastErrorCode) },
10149
+ ...source.lastErrorCode == null ? {} : { lastErrorCode: string(source.lastErrorCode) },
9832
10150
  operatorState,
9833
10151
  runtimeVersion,
9834
- triggerNodeId: string$1(source.triggerNodeId),
9835
- updatedAt: string$1(source.updatedAt),
10152
+ triggerNodeId: string(source.triggerNodeId),
10153
+ updatedAt: string(source.updatedAt),
9836
10154
  version: 1
9837
10155
  };
9838
10156
  }
9839
10157
  function triggerBindingDetail(value) {
9840
- const source = record$3(value);
10158
+ const source = record$1(value);
9841
10159
  if (source.version != 1) return invalidResponse();
9842
10160
  return {
9843
10161
  binding: triggerBinding(source.binding),
@@ -9845,22 +10163,22 @@ function triggerBindingDetail(value) {
9845
10163
  };
9846
10164
  }
9847
10165
  function triggerActivity(value) {
9848
- const source = record$3(value);
10166
+ const source = record$1(value);
9849
10167
  const kind = source.kind;
9850
10168
  if (typeof kind != "string" || !triggerActivityKinds.has(kind)) return invalidResponse();
9851
10169
  const errorCode = optionalString(source.errorCode);
9852
10170
  const errorMessage = optionalString(source.errorMessage);
9853
10171
  if (errorMessage != null && errorMessage.length > 512) return invalidResponse();
9854
10172
  return {
9855
- activityId: string$1(source.activityId),
9856
- createdAt: string$1(source.createdAt),
10173
+ activityId: string(source.activityId),
10174
+ createdAt: string(source.createdAt),
9857
10175
  ...errorCode == null ? {} : { errorCode },
9858
10176
  ...errorMessage == null ? {} : { errorMessage },
9859
10177
  kind
9860
10178
  };
9861
10179
  }
9862
10180
  function triggerActivityPage(value) {
9863
- const source = record$3(value);
10181
+ const source = record$1(value);
9864
10182
  const nextCursor = optionalString(source.nextCursor);
9865
10183
  if (source.version != 1 || !Array.isArray(source.activities)) return invalidResponse();
9866
10184
  return {
@@ -9870,12 +10188,12 @@ function triggerActivityPage(value) {
9870
10188
  };
9871
10189
  }
9872
10190
  function pollTriggerTestResult(value) {
9873
- const source = record$3(value);
9874
- const filtered = integer$1(source.filtered);
10191
+ const source = record$1(value);
10192
+ const filtered = integer(source.filtered);
9875
10193
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.hasMore != "boolean" || filtered < 0) return invalidResponse();
9876
10194
  return {
9877
10195
  events: source.events.map((event) => {
9878
- const object = record$3(event);
10196
+ const object = record$1(event);
9879
10197
  return Object.fromEntries(Object.entries(object).map(([key, item]) => [key, jsonValue(item)]));
9880
10198
  }),
9881
10199
  filtered,
@@ -9886,7 +10204,7 @@ function pollTriggerTestResult(value) {
9886
10204
  //#endregion
9887
10205
  //#region src/control/common/triggerCatalog.ts
9888
10206
  function decodeTriggerCatalog(value) {
9889
- const source = record$3(value);
10207
+ const source = record$1(value);
9890
10208
  exact(source, [
9891
10209
  "version",
9892
10210
  "locale",
@@ -9895,12 +10213,12 @@ function decodeTriggerCatalog(value) {
9895
10213
  ]);
9896
10214
  if (source.version != 3 || !isUiLanguage(source.locale) || !Array.isArray(source.definitions)) return invalidResponse();
9897
10215
  const definitions = source.definitions.map(triggerKey);
9898
- const entries = record$3(source.display);
10216
+ const entries = record$1(source.display);
9899
10217
  const keys = new Set(definitions.map((definition) => definition.key));
9900
10218
  if (keys.size != definitions.length || Object.keys(entries).length != keys.size) return invalidResponse();
9901
10219
  const display = Object.fromEntries(definitions.map((definition) => {
9902
10220
  const { key } = definition;
9903
- const copy = record$3(entries[key]);
10221
+ const copy = record$1(entries[key]);
9904
10222
  exact(copy, [
9905
10223
  "configInputs",
9906
10224
  "configInputLabels",
@@ -9911,8 +10229,8 @@ function decodeTriggerCatalog(value) {
9911
10229
  return [key, {
9912
10230
  configInputs: descriptions(copy.configInputs, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
9913
10231
  configInputLabels: labels(copy.configInputLabels, definition.configInputs.flatMap((field) => "handle" in field ? [field.handle] : [])),
9914
- displayName: string$1(copy.displayName),
9915
- description: string$1(copy.description),
10232
+ displayName: string(copy.displayName),
10233
+ description: string(copy.description),
9916
10234
  outputs: descriptions(copy.outputs, definition.outputs.map((field) => field.handle))
9917
10235
  }];
9918
10236
  }));
@@ -9924,29 +10242,29 @@ function decodeTriggerCatalog(value) {
9924
10242
  };
9925
10243
  }
9926
10244
  function descriptions(value, handles) {
9927
- const source = record$3(value);
10245
+ const source = record$1(value);
9928
10246
  exact(source, handles);
9929
- 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)]));
9930
10248
  }
9931
10249
  function labels(value, handles) {
9932
- const source = record$3(value);
10250
+ const source = record$1(value);
9933
10251
  if (Object.keys(source).some((handle) => !handles.includes(handle))) return invalidResponse();
9934
10252
  return Object.fromEntries(Object.entries(source).map(([handle, label]) => {
9935
- const text = string$1(label);
10253
+ const text = string(label);
9936
10254
  return text.trim().length == 0 ? invalidResponse() : [handle, text];
9937
10255
  }));
9938
10256
  }
9939
10257
  strictObject({
9940
- pointer: string().max(4096).default(""),
10258
+ pointer: string$1().max(4096).default(""),
9941
10259
  offset: number().int().nonnegative().default(0),
9942
10260
  limit: number().int().min(1).max(100).default(20),
9943
10261
  maxBytes: number().int().min(1).max(1048576).default(15e3)
9944
10262
  });
9945
10263
  //#endregion
9946
10264
  //#region src/control/common/results.ts
9947
- var json$1 = json$3();
10265
+ var json$1 = json$4();
9948
10266
  var entry = strictObject({
9949
- pointer: string(),
10267
+ pointer: string$1(),
9950
10268
  type: _enum([
9951
10269
  "object",
9952
10270
  "array",
@@ -9965,26 +10283,26 @@ var page = entry.extend({
9965
10283
  entries: array(entry).optional()
9966
10284
  });
9967
10285
  var result = strictObject({
9968
- resultId: string().min(1),
9969
- callId: string().min(1),
9970
- toolId: string().min(1),
10286
+ resultId: string$1().min(1),
10287
+ callId: string$1().min(1),
10288
+ toolId: string$1().min(1),
9971
10289
  source: discriminatedUnion("kind", [strictObject({
9972
10290
  kind: literal("connector"),
9973
- action: string().min(1)
10291
+ action: string$1().min(1)
9974
10292
  }), strictObject({ kind: literal("code") })]),
9975
10293
  bytes: number().int().nonnegative(),
9976
- digest: string().regex(/^[a-f0-9]{64}$/),
9977
- createdAt: string().datetime()
10294
+ digest: string$1().regex(/^[a-f0-9]{64}$/),
10295
+ createdAt: string$1().datetime()
9978
10296
  });
9979
10297
  var listSchema = strictObject({
9980
10298
  version: literal(1),
9981
- runId: string(),
10299
+ runId: string$1(),
9982
10300
  results: array(result),
9983
- nextAfter: string().optional()
10301
+ nextAfter: string$1().optional()
9984
10302
  });
9985
10303
  var readSchema = strictObject({
9986
10304
  version: literal(1),
9987
- runId: string(),
10305
+ runId: string$1(),
9988
10306
  result,
9989
10307
  page
9990
10308
  });
@@ -10002,8 +10320,8 @@ function schemaPath(value) {
10002
10320
  return value.map((part) => typeof part == "string" || Number.isSafeInteger(part) ? part : invalidResponse());
10003
10321
  }
10004
10322
  function schemaMismatch(value) {
10005
- const source = record$3(value);
10006
- const kind = string$1(source.kind);
10323
+ const source = record$1(value);
10324
+ const kind = string(source.kind);
10007
10325
  if (kind == "artifact" || kind == "binary" || kind == "nullable") return { kind };
10008
10326
  if (kind == "schema") return {
10009
10327
  kind,
@@ -10019,30 +10337,30 @@ function schemaMismatch(value) {
10019
10337
  };
10020
10338
  }
10021
10339
  function diagnostic(value) {
10022
- const source = record$3(value);
10023
- const values = source.values == null ? void 0 : record$3(source.values);
10340
+ const source = record$1(value);
10341
+ const values = source.values == null ? void 0 : record$1(source.values);
10024
10342
  return {
10025
- code: string$1(source.code),
10026
- column: integer$1(source.column),
10027
- ...source.fields === void 0 ? {} : { fields: Array.isArray(source.fields) ? source.fields.map(string$1) : invalidResponse() },
10028
- line: integer$1(source.line),
10029
- 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),
10030
10348
  mismatch: source.mismatch == null ? void 0 : schemaMismatch(source.mismatch),
10031
10349
  path: typeof source.path == "string" ? source.path : invalidResponse(),
10032
10350
  ...values == null ? {} : { values: Object.fromEntries(Object.entries(values).map(([key, candidate]) => [key, typeof candidate == "string" || typeof candidate == "number" ? candidate : invalidResponse()])) }
10033
10351
  };
10034
10352
  }
10035
10353
  function flowCheck(value) {
10036
- const source = record$3(value);
10354
+ const source = record$1(value);
10037
10355
  if (source.version != 1 || typeof source.valid != "boolean" || !Array.isArray(source.diagnostics)) return invalidResponse();
10038
10356
  return {
10039
- closureDigest: string$1(source.closureDigest),
10357
+ closureDigest: string(source.closureDigest),
10040
10358
  diagnostics: source.diagnostics.map(diagnostic),
10041
- engineContract: string$1(source.engineContract),
10042
- flowId: string$1(source.flowId),
10043
- modelVersion: integer$1(source.modelVersion),
10044
- revisionDigest: string$1(source.revisionDigest),
10045
- 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),
10046
10364
  valid: source.valid,
10047
10365
  version: 1
10048
10366
  };
@@ -10058,7 +10376,7 @@ function connectorProvidersQuery(flowId, locale) {
10058
10376
  return {
10059
10377
  path: `/v1/connector/providers${parameters ? `?${parameters}` : ""}`,
10060
10378
  decode: (value) => {
10061
- const source = record$3(value);
10379
+ const source = record$1(value);
10062
10380
  exact(source, ["providers", "version"]);
10063
10381
  if (source.version != 1 || !Array.isArray(source.providers)) return invalidResponse();
10064
10382
  return source.providers.map(connectorProvider);
@@ -10073,7 +10391,7 @@ function connectorActionQuery(actionId, flowId, locale) {
10073
10391
  return {
10074
10392
  path: `/v1/connector/actions/${encodeURIComponent(actionId)}${parameters ? `?${parameters}` : ""}`,
10075
10393
  decode: (value) => {
10076
- const source = record$3(value);
10394
+ const source = record$1(value);
10077
10395
  exact(source, ["action", "version"]);
10078
10396
  if (source.version != 1) return invalidResponse();
10079
10397
  return connectorAction(source.action);
@@ -10084,7 +10402,7 @@ function allConnectorConnectionsQuery(flowId) {
10084
10402
  return {
10085
10403
  path: `/v1/connector/connections${scope(flowId)}`,
10086
10404
  decode: (value) => {
10087
- const source = record$3(value);
10405
+ const source = record$1(value);
10088
10406
  exact(source, ["connections", "version"]);
10089
10407
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10090
10408
  return source.connections.map(connection);
@@ -10095,44 +10413,82 @@ function connectorConnectionsQuery(serviceId, flowId) {
10095
10413
  return {
10096
10414
  path: `/v1/connector/connections/${encodeURIComponent(serviceId)}${scope(flowId)}`,
10097
10415
  decode: (value) => {
10098
- const source = record$3(value);
10416
+ const source = record$1(value);
10099
10417
  exact(source, [
10100
10418
  "connections",
10101
10419
  "serviceId",
10102
10420
  "version"
10103
10421
  ]);
10104
- 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();
10105
10423
  return source.connections.map(connection);
10106
10424
  }
10107
10425
  };
10108
10426
  }
10109
10427
  //#endregion
10110
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
+ }
10111
10466
  function flow(value) {
10112
- const source = record$3(value);
10467
+ const source = record$1(value);
10113
10468
  const status = source.status;
10114
10469
  if (source.version != 1) return invalidResponse();
10115
10470
  if (status != "active" && status != "retiring") return invalidResponse();
10116
- const target = source.live == null ? void 0 : record$3(source.live);
10471
+ const target = source.live == null ? void 0 : record$1(source.live);
10117
10472
  if (target != null && typeof target.enabled != "boolean") return invalidResponse();
10118
10473
  return {
10119
10474
  ...target == null ? {} : { live: {
10120
10475
  enabled: target.enabled,
10121
- publicationId: string$1(target.publicationId),
10122
- revisionId: string$1(target.revisionId)
10476
+ publicationId: string(target.publicationId),
10477
+ revisionId: string(target.revisionId)
10123
10478
  } },
10124
- createdAt: string$1(source.createdAt),
10125
- ...source.connectorTeamId == null ? {} : { connectorTeamId: string$1(source.connectorTeamId) },
10126
- draftRevisionId: string$1(source.draftRevisionId),
10127
- flowId: string$1(source.flowId),
10128
- 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),
10129
10485
  status,
10130
- updatedAt: string$1(source.updatedAt),
10486
+ updatedAt: string(source.updatedAt),
10131
10487
  version: 1
10132
10488
  };
10133
10489
  }
10134
10490
  function flowPage(value) {
10135
- const source = record$3(value);
10491
+ const source = record$1(value);
10136
10492
  if (source.version != 1 || !Array.isArray(source.flows)) return invalidResponse();
10137
10493
  const nextCursor = source.nextCursor;
10138
10494
  const total = source.total;
@@ -10146,7 +10502,7 @@ function flowPage(value) {
10146
10502
  };
10147
10503
  }
10148
10504
  function variable(value) {
10149
- const source = record$3(value);
10505
+ const source = record$1(value);
10150
10506
  exact(source, [
10151
10507
  "name",
10152
10508
  "updatedAt",
@@ -10154,35 +10510,35 @@ function variable(value) {
10154
10510
  "version"
10155
10511
  ]);
10156
10512
  if (source.version != 1 || typeof source.value != "string") return invalidResponse();
10157
- const updatedAt = string$1(source.updatedAt);
10513
+ const updatedAt = string(source.updatedAt);
10158
10514
  try {
10159
10515
  if (new Date(updatedAt).toISOString() != updatedAt) return invalidResponse();
10160
10516
  } catch {
10161
10517
  return invalidResponse();
10162
10518
  }
10163
10519
  return {
10164
- name: string$1(source.name),
10520
+ name: string(source.name),
10165
10521
  updatedAt,
10166
10522
  value: source.value,
10167
10523
  version: 1
10168
10524
  };
10169
10525
  }
10170
10526
  function errorListener(value) {
10171
- const source = record$3(value);
10527
+ const source = record$1(value);
10172
10528
  if (typeof source.enabled != "boolean") return invalidResponse();
10173
10529
  return {
10174
- flowId: string$1(source.flowId),
10175
- flowName: string$1(source.flowName),
10176
- nodeId: string$1(source.nodeId),
10177
- 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),
10178
10534
  enabled: source.enabled
10179
10535
  };
10180
10536
  }
10181
10537
  //#endregion
10182
10538
  //#region src/control/common/publicationDecoders.ts
10183
10539
  function publication(value) {
10184
- const source = record$3(value);
10185
- const liveEnd = source.liveEnd == null ? void 0 : record$3(source.liveEnd);
10540
+ const source = record$1(value);
10541
+ const liveEnd = source.liveEnd == null ? void 0 : record$1(source.liveEnd);
10186
10542
  if (liveEnd != null && typeof liveEnd.enabled != "boolean") return invalidResponse();
10187
10543
  const operation = source.operation;
10188
10544
  const sourcePublicationId = source.sourcePublicationId;
@@ -10192,32 +10548,32 @@ function publication(value) {
10192
10548
  return {
10193
10549
  ...liveEnd == null ? {} : { liveEnd: {
10194
10550
  enabled: liveEnd.enabled,
10195
- endedAt: string$1(liveEnd.endedAt)
10551
+ endedAt: string(liveEnd.endedAt)
10196
10552
  } },
10197
- actorId: string$1(source.actorId),
10198
- closureDigest: string$1(source.closureDigest),
10199
- createdAt: string$1(source.createdAt),
10200
- engineContract: string$1(source.engineContract),
10201
- flowId: string$1(source.flowId),
10202
- 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),
10203
10559
  operation,
10204
- publicationId: string$1(source.publicationId),
10205
- sharedAccessDigest: string$1(source.sharedAccessDigest),
10206
- revisionDigest: string$1(source.revisionDigest),
10207
- 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),
10208
10564
  ...sourcePublicationId == null ? {} : { sourcePublicationId },
10209
10565
  version: 1
10210
10566
  };
10211
10567
  }
10212
10568
  function publishOperation(value) {
10213
- const source = record$3(value);
10569
+ const source = record$1(value);
10214
10570
  const status = source.status;
10215
10571
  const common = {
10216
- createdAt: string$1(source.createdAt),
10217
- flowId: string$1(source.flowId),
10218
- operationId: string$1(source.operationId),
10219
- revisionId: string$1(source.revisionId),
10220
- 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),
10221
10577
  version: 1
10222
10578
  };
10223
10579
  if (source.version != 1) return invalidResponse();
@@ -10249,7 +10605,7 @@ function publishOperation(value) {
10249
10605
  ]);
10250
10606
  return {
10251
10607
  ...common,
10252
- publicationId: string$1(source.publicationId),
10608
+ publicationId: string(source.publicationId),
10253
10609
  status
10254
10610
  };
10255
10611
  case "failed": {
@@ -10263,7 +10619,7 @@ function publishOperation(value) {
10263
10619
  "updatedAt",
10264
10620
  "version"
10265
10621
  ]);
10266
- const issue = record$3(source.issue);
10622
+ const issue = record$1(source.issue);
10267
10623
  const nodeId = issue.nodeId;
10268
10624
  exact(issue, [
10269
10625
  "code",
@@ -10273,9 +10629,9 @@ function publishOperation(value) {
10273
10629
  return {
10274
10630
  ...common,
10275
10631
  issue: {
10276
- code: string$1(issue.code),
10277
- message: string$1(issue.message),
10278
- ...nodeId == null ? {} : { nodeId: string$1(nodeId) }
10632
+ code: string(issue.code),
10633
+ message: string(issue.message),
10634
+ ...nodeId == null ? {} : { nodeId: string(nodeId) }
10279
10635
  },
10280
10636
  status
10281
10637
  };
@@ -10284,7 +10640,7 @@ function publishOperation(value) {
10284
10640
  }
10285
10641
  }
10286
10642
  function live(value) {
10287
- const source = record$3(value);
10643
+ const source = record$1(value);
10288
10644
  const status = source.status;
10289
10645
  const candidate = source.publication;
10290
10646
  if (source.version != 1 || typeof source.hasUnpublishedChanges != "boolean") return invalidResponse();
@@ -10292,16 +10648,16 @@ function live(value) {
10292
10648
  if (status == "not-published" && candidate !== null) return invalidResponse();
10293
10649
  if (status != "not-published" && candidate === null) return invalidResponse();
10294
10650
  return {
10295
- flowId: string$1(source.flowId),
10651
+ flowId: string(source.flowId),
10296
10652
  hasUnpublishedChanges: source.hasUnpublishedChanges,
10297
10653
  publication: candidate === null ? null : publication(candidate),
10298
- revision: integer$1(source.revision),
10654
+ revision: integer(source.revision),
10299
10655
  status,
10300
10656
  version: 1
10301
10657
  };
10302
10658
  }
10303
10659
  function publicationPage(value) {
10304
- const source = record$3(value);
10660
+ const source = record$1(value);
10305
10661
  const nextCursor = source.nextCursor;
10306
10662
  const total = source.total;
10307
10663
  if (source.version != 1 || !Array.isArray(source.publications)) return invalidResponse();
@@ -10317,22 +10673,22 @@ function publicationPage(value) {
10317
10673
  //#endregion
10318
10674
  //#region src/control/common/revisionDecoders.ts
10319
10675
  function revisionMetadata(value) {
10320
- const source = record$3(value);
10676
+ const source = record$1(value);
10321
10677
  const parentRevisionId = source.parentRevisionId;
10322
10678
  if (source.version != 1 || parentRevisionId !== null && typeof parentRevisionId != "string") return invalidResponse();
10323
10679
  return {
10324
- actorId: string$1(source.actorId),
10325
- createdAt: string$1(source.createdAt),
10326
- digest: string$1(source.digest),
10327
- flowId: string$1(source.flowId),
10328
- 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),
10329
10685
  parentRevisionId,
10330
- revisionId: string$1(source.revisionId),
10686
+ revisionId: string(source.revisionId),
10331
10687
  version: 1
10332
10688
  };
10333
10689
  }
10334
10690
  function draft(value) {
10335
- const source = record$3(value);
10691
+ const source = record$1(value);
10336
10692
  try {
10337
10693
  return {
10338
10694
  ...revisionMetadata(source),
@@ -10343,17 +10699,17 @@ function draft(value) {
10343
10699
  }
10344
10700
  }
10345
10701
  function presentation(value) {
10346
- const source = record$3(value);
10347
- 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();
10348
10704
  return {
10349
- revision: integer$1(source.revision),
10350
- updatedAt: string$1(source.updatedAt),
10351
- value: Object.fromEntries(Object.entries(record$3(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)])),
10352
10708
  version: 1
10353
10709
  };
10354
10710
  }
10355
10711
  function draftChange(value) {
10356
- const source = record$3(value);
10712
+ const source = record$1(value);
10357
10713
  if (source.version != 1) return invalidResponse();
10358
10714
  return {
10359
10715
  revision: revisionMetadata(source.revision),
@@ -10361,7 +10717,7 @@ function draftChange(value) {
10361
10717
  };
10362
10718
  }
10363
10719
  function draftSync(value) {
10364
- const source = record$3(value);
10720
+ const source = record$1(value);
10365
10721
  if (source.version != 1 || source.kind != "snapshot") return invalidResponse();
10366
10722
  return {
10367
10723
  draft: draft(source.draft),
@@ -10387,7 +10743,7 @@ function runStatus(value) {
10387
10743
  return typeof value == "string" && runStatusSet.has(value) ? value : invalidResponse();
10388
10744
  }
10389
10745
  function run(value) {
10390
- const source = record$3(value);
10746
+ const source = record$1(value);
10391
10747
  const kind = source.source;
10392
10748
  const startedAt = source.startedAt;
10393
10749
  const finishedAt = source.finishedAt;
@@ -10395,11 +10751,11 @@ function run(value) {
10395
10751
  if (startedAt != null && typeof startedAt != "string") return invalidResponse();
10396
10752
  if (finishedAt != null && typeof finishedAt != "string") return invalidResponse();
10397
10753
  return {
10398
- createdAt: string$1(source.createdAt),
10754
+ createdAt: string(source.createdAt),
10399
10755
  ...finishedAt == null ? {} : { finishedAt },
10400
- flowId: string$1(source.flowId),
10401
- revisionId: string$1(source.revisionId),
10402
- runId: string$1(source.runId),
10756
+ flowId: string(source.flowId),
10757
+ revisionId: string(source.revisionId),
10758
+ runId: string(source.runId),
10403
10759
  source: kind,
10404
10760
  ...startedAt == null ? {} : { startedAt },
10405
10761
  status: runStatus(source.status),
@@ -10407,7 +10763,7 @@ function run(value) {
10407
10763
  };
10408
10764
  }
10409
10765
  function runWaiting(value) {
10410
- const source = record$3(value);
10766
+ const source = record$1(value);
10411
10767
  exact(source, [
10412
10768
  "actions",
10413
10769
  "expiresAt",
@@ -10420,15 +10776,15 @@ function runWaiting(value) {
10420
10776
  if (!Array.isArray(actions) || !(actions.length == 1 && actions[0] == "continue" || actions.length == 2 && actions[0] == "approve" && actions[1] == "reject")) return invalidResponse();
10421
10777
  return {
10422
10778
  actions,
10423
- expiresAt: string$1(source.expiresAt),
10424
- nodeId: string$1(source.nodeId),
10425
- prompt: string$1(source.prompt),
10426
- waitId: string$1(source.waitId),
10427
- 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)
10428
10784
  };
10429
10785
  }
10430
10786
  function runDetails(value) {
10431
- const source = record$3(value);
10787
+ const source = record$1(value);
10432
10788
  const summary = run(source);
10433
10789
  const eventsExpiresAt = source.eventsExpiresAt;
10434
10790
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
@@ -10448,13 +10804,13 @@ function runDetails(value) {
10448
10804
  const details = {
10449
10805
  ...summary,
10450
10806
  ...errorHandling(source),
10451
- closureDigest: string$1(source.closureDigest),
10452
- engineContract: string$1(source.engineContract),
10453
- engineDigest: string$1(source.engineDigest),
10807
+ closureDigest: string(source.closureDigest),
10808
+ engineContract: string(source.engineContract),
10809
+ engineDigest: string(source.engineDigest),
10454
10810
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
10455
- modelVersion: integer$1(source.modelVersion),
10456
- sharedAccessDigest: string$1(source.sharedAccessDigest),
10457
- revisionDigest: string$1(source.revisionDigest),
10811
+ modelVersion: integer(source.modelVersion),
10812
+ sharedAccessDigest: string(source.sharedAccessDigest),
10813
+ revisionDigest: string(source.revisionDigest),
10458
10814
  ...state
10459
10815
  };
10460
10816
  switch (summary.source) {
@@ -10464,40 +10820,40 @@ function runDetails(value) {
10464
10820
  };
10465
10821
  case "live": return {
10466
10822
  ...details,
10467
- publicationId: string$1(source.publicationId),
10823
+ publicationId: string(source.publicationId),
10468
10824
  source: "live",
10469
10825
  ...source.occurrenceId === void 0 ? {} : {
10470
- occurrenceId: string$1(source.occurrenceId),
10471
- triggerNodeId: string$1(source.triggerNodeId)
10826
+ occurrenceId: string(source.occurrenceId),
10827
+ triggerNodeId: string(source.triggerNodeId)
10472
10828
  }
10473
10829
  };
10474
10830
  }
10475
10831
  }
10476
10832
  function runPage(value) {
10477
- const source = record$3(value);
10833
+ const source = record$1(value);
10478
10834
  const nextCursor = source.nextCursor;
10479
10835
  if (source.version != 1 || !Array.isArray(source.runs)) return invalidResponse();
10480
10836
  if (nextCursor != null && typeof nextCursor != "string") return invalidResponse();
10481
10837
  return {
10482
- flowId: string$1(source.flowId),
10838
+ flowId: string(source.flowId),
10483
10839
  ...nextCursor == null ? {} : { nextCursor },
10484
10840
  runs: source.runs.map(run),
10485
10841
  version: 1
10486
10842
  };
10487
10843
  }
10488
10844
  function runCancellation(value) {
10489
- const source = record$3(value);
10845
+ const source = record$1(value);
10490
10846
  const status = runStatus(source.status);
10491
10847
  if (source.version != 1 || typeof source.cancelAccepted != "boolean" || status == "queued" || status == "starting" || status == "running" || status == "waiting") return invalidResponse();
10492
10848
  return {
10493
10849
  cancelAccepted: source.cancelAccepted,
10494
- runId: string$1(source.runId),
10850
+ runId: string(source.runId),
10495
10851
  status,
10496
10852
  version: 1
10497
10853
  };
10498
10854
  }
10499
10855
  function waitResolution(value) {
10500
- const source = record$3(value);
10856
+ const source = record$1(value);
10501
10857
  exact(source, [
10502
10858
  "action",
10503
10859
  "comment",
@@ -10516,19 +10872,19 @@ function waitResolution(value) {
10516
10872
  comment: source.comment,
10517
10873
  resolutionAccepted: source.resolutionAccepted,
10518
10874
  resolvedAt,
10519
- runId: string$1(source.runId),
10875
+ runId: string(source.runId),
10520
10876
  status: runStatus(source.status),
10521
10877
  version: 1,
10522
- waitId: string$1(source.waitId)
10878
+ waitId: string(source.waitId)
10523
10879
  };
10524
10880
  }
10525
10881
  function runResult(value) {
10526
- const source = record$3(value);
10882
+ const source = record$1(value);
10527
10883
  const status = source.status;
10528
10884
  if (source.version != 1) return invalidResponse();
10529
10885
  const base = {
10530
- finishedAt: string$1(source.finishedAt),
10531
- runId: string$1(source.runId),
10886
+ finishedAt: string(source.finishedAt),
10887
+ runId: string(source.runId),
10532
10888
  version: 1
10533
10889
  };
10534
10890
  if (status == "completed") {
@@ -10544,7 +10900,7 @@ function runResult(value) {
10544
10900
  status: "canceled"
10545
10901
  };
10546
10902
  if (status == "failed") {
10547
- const error = record$3(source.error);
10903
+ const error = record$1(source.error);
10548
10904
  return {
10549
10905
  ...base,
10550
10906
  error: runFailure(error),
@@ -10552,7 +10908,7 @@ function runResult(value) {
10552
10908
  };
10553
10909
  }
10554
10910
  if (status == "indeterminate") {
10555
- const error = record$3(source.error);
10911
+ const error = record$1(source.error);
10556
10912
  return {
10557
10913
  ...base,
10558
10914
  error: runFailure(error),
@@ -10562,16 +10918,16 @@ function runResult(value) {
10562
10918
  return invalidResponse();
10563
10919
  }
10564
10920
  function errorHandling(source) {
10565
- const errorSource = source.errorSource == null ? void 0 : record$3(source.errorSource);
10921
+ const errorSource = source.errorSource == null ? void 0 : record$1(source.errorSource);
10566
10922
  if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
10567
10923
  return {
10568
10924
  ...errorSource == null ? {} : { errorSource: {
10569
- flowId: string$1(errorSource.flowId),
10570
- runId: string$1(errorSource.runId)
10925
+ flowId: string(errorSource.flowId),
10926
+ runId: string(errorSource.runId)
10571
10927
  } },
10572
10928
  ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
10573
- const dispatch = record$3(value);
10574
- const flowId = string$1(dispatch.flowId);
10929
+ const dispatch = record$1(value);
10930
+ const flowId = string(dispatch.flowId);
10575
10931
  switch (dispatch.status) {
10576
10932
  case "pending": return {
10577
10933
  status: "pending",
@@ -10580,12 +10936,12 @@ function errorHandling(source) {
10580
10936
  case "dispatched": return {
10581
10937
  status: "dispatched",
10582
10938
  flowId,
10583
- runId: string$1(dispatch.runId)
10939
+ runId: string(dispatch.runId)
10584
10940
  };
10585
10941
  case "failed": return {
10586
10942
  status: "failed",
10587
10943
  flowId,
10588
- message: string$1(dispatch.message)
10944
+ message: string(dispatch.message)
10589
10945
  };
10590
10946
  default: return invalidResponse();
10591
10947
  }
@@ -10594,11 +10950,11 @@ function errorHandling(source) {
10594
10950
  }
10595
10951
  function runFailure(error) {
10596
10952
  return {
10597
- code: string$1(error.code),
10598
- message: string$1(error.message),
10599
- ...error.nodeId === void 0 ? {} : { nodeId: string$1(error.nodeId) },
10600
- ...error.jobId === void 0 ? {} : { jobId: string$1(error.jobId) },
10601
- ...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) }
10602
10958
  };
10603
10959
  }
10604
10960
  //#endregion
@@ -10622,14 +10978,14 @@ function randomId() {
10622
10978
  //#endregion
10623
10979
  //#region src/control/common/api.ts
10624
10980
  function decodeRunEvent(value) {
10625
- const source = record$3(value);
10626
- const sequence = integer$1(source.sequence);
10981
+ const source = record$1(value);
10982
+ const sequence = integer(source.sequence);
10627
10983
  if (sequence < 0) return invalidResponse();
10628
10984
  const base = {
10629
- createdAt: string$1(source.createdAt),
10985
+ createdAt: string(source.createdAt),
10630
10986
  sequence
10631
10987
  };
10632
- const payload = record$3(source.payload);
10988
+ const payload = record$1(source.payload);
10633
10989
  const kind = source.kind;
10634
10990
  switch (kind) {
10635
10991
  case "run.queued": return {
@@ -10641,17 +10997,17 @@ function decodeRunEvent(value) {
10641
10997
  ...base,
10642
10998
  kind,
10643
10999
  payload: {
10644
- flowId: string$1(payload.flowId),
10645
- scopeId: string$1(payload.scopeId),
10646
- ...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) }
10647
11003
  }
10648
11004
  };
10649
11005
  case "run.progress": return {
10650
11006
  ...base,
10651
11007
  kind,
10652
11008
  payload: {
10653
- flowId: string$1(payload.flowId),
10654
- scopeId: string$1(payload.scopeId),
11009
+ flowId: string(payload.flowId),
11010
+ scopeId: string(payload.scopeId),
10655
11011
  progress: eventProgress(payload.progress)
10656
11012
  }
10657
11013
  };
@@ -10660,16 +11016,16 @@ function decodeRunEvent(value) {
10660
11016
  return {
10661
11017
  ...base,
10662
11018
  kind,
10663
- payload: { waitIds: payload.waitIds.map((id) => string$1(id)) }
11019
+ payload: { waitIds: payload.waitIds.map((id) => string(id)) }
10664
11020
  };
10665
11021
  case "wait.created": return {
10666
11022
  ...base,
10667
11023
  kind,
10668
11024
  payload: {
10669
- expiresAt: string$1(payload.expiresAt),
10670
- nodeId: string$1(payload.nodeId),
10671
- waitId: string$1(payload.waitId),
10672
- 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)
10673
11029
  }
10674
11030
  };
10675
11031
  case "run.resolved": {
@@ -10682,8 +11038,8 @@ function decodeRunEvent(value) {
10682
11038
  payload: {
10683
11039
  action,
10684
11040
  comment: payload.comment,
10685
- resolvedAt: string$1(payload.resolvedAt),
10686
- waitId: string$1(payload.waitId)
11041
+ resolvedAt: string(payload.resolvedAt),
11042
+ waitId: string(payload.waitId)
10687
11043
  }
10688
11044
  };
10689
11045
  }
@@ -10707,10 +11063,10 @@ function decodeRunEvent(value) {
10707
11063
  case "node.progress":
10708
11064
  case "node.artifact": {
10709
11065
  const node = {
10710
- flowId: string$1(payload.flowId),
10711
- scopeId: string$1(payload.scopeId),
10712
- nodeId: string$1(payload.nodeId),
10713
- 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)
10714
11070
  };
10715
11071
  switch (kind) {
10716
11072
  case "node.started": {
@@ -10722,8 +11078,8 @@ function decodeRunEvent(value) {
10722
11078
  payload: {
10723
11079
  ...node,
10724
11080
  ...nodeKind === void 0 ? {} : { nodeKind },
10725
- ...payload.nodeTitle === void 0 ? {} : { nodeTitle: string$1(payload.nodeTitle) },
10726
- ...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) }
10727
11083
  }
10728
11084
  };
10729
11085
  }
@@ -10732,19 +11088,19 @@ function decodeRunEvent(value) {
10732
11088
  kind,
10733
11089
  payload: {
10734
11090
  ...node,
10735
- outputs: Object.fromEntries(Object.entries(record$3(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
11091
+ outputs: Object.fromEntries(Object.entries(record$1(payload.outputs)).map(([key, item]) => [key, jsonValue(item)]))
10736
11092
  }
10737
11093
  };
10738
11094
  case "node.failed": {
10739
- const error = record$3(payload.error);
11095
+ const error = record$1(payload.error);
10740
11096
  return {
10741
11097
  ...base,
10742
11098
  kind,
10743
11099
  payload: {
10744
11100
  ...node,
10745
11101
  error: {
10746
- code: string$1(error.code),
10747
- message: string$1(error.message)
11102
+ code: string(error.code),
11103
+ message: string(error.message)
10748
11104
  }
10749
11105
  }
10750
11106
  };
@@ -10758,7 +11114,7 @@ function decodeRunEvent(value) {
10758
11114
  payload: {
10759
11115
  ...node,
10760
11116
  level,
10761
- message: string$1(payload.message)
11117
+ message: string(payload.message)
10762
11118
  }
10763
11119
  };
10764
11120
  }
@@ -10771,9 +11127,9 @@ function decodeRunEvent(value) {
10771
11127
  }
10772
11128
  };
10773
11129
  case "node.artifact": {
10774
- const artifact = record$3(payload.artifact);
10775
- const size = integer$1(artifact.size);
10776
- 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);
10777
11133
  if (artifact.kind != "artifact" || size < 0 || !/^sha256:[0-9a-f]{64}$/.test(digest)) return invalidResponse();
10778
11134
  return {
10779
11135
  ...base,
@@ -10782,11 +11138,11 @@ function decodeRunEvent(value) {
10782
11138
  ...node,
10783
11139
  artifact: {
10784
11140
  kind: "artifact",
10785
- id: string$1(artifact.id),
10786
- name: string$1(artifact.name),
11141
+ id: string(artifact.id),
11142
+ name: string(artifact.name),
10787
11143
  size,
10788
11144
  digest,
10789
- ...artifact.mediaType === void 0 ? {} : { mediaType: string$1(artifact.mediaType) }
11145
+ ...artifact.mediaType === void 0 ? {} : { mediaType: string(artifact.mediaType) }
10790
11146
  }
10791
11147
  }
10792
11148
  };
@@ -10800,9 +11156,9 @@ function eventProgress(value) {
10800
11156
  return typeof value == "number" && Number.isFinite(value) && value >= 0 && value <= 100 ? value : invalidResponse();
10801
11157
  }
10802
11158
  function runEvents(value) {
10803
- const source = record$3(value);
11159
+ const source = record$1(value);
10804
11160
  const eventsExpiresAt = source.eventsExpiresAt;
10805
- const nextAfter = integer$1(source.nextAfter);
11161
+ const nextAfter = integer(source.nextAfter);
10806
11162
  if (source.version != 1 || !Array.isArray(source.events) || typeof source.done != "boolean" || typeof source.historyComplete != "boolean") return invalidResponse();
10807
11163
  if (eventsExpiresAt != null && typeof eventsExpiresAt != "string") return invalidResponse();
10808
11164
  if (nextAfter < 0) return invalidResponse();
@@ -10812,7 +11168,7 @@ function runEvents(value) {
10812
11168
  ...eventsExpiresAt == null ? {} : { eventsExpiresAt },
10813
11169
  historyComplete: source.historyComplete,
10814
11170
  nextAfter,
10815
- runId: string$1(source.runId),
11171
+ runId: string(source.runId),
10816
11172
  version: 1
10817
11173
  };
10818
11174
  }
@@ -10825,7 +11181,7 @@ var ControlClient = class {
10825
11181
  this.requestControl = requestControl;
10826
11182
  }
10827
11183
  async loadOpenApiDocument(url, signal) {
10828
- const result = record$3(await this.request("/v1/openapi/document", {
11184
+ const result = record$1(await this.request("/v1/openapi/document", {
10829
11185
  method: "POST",
10830
11186
  body: JSON.stringify({
10831
11187
  url,
@@ -10848,7 +11204,7 @@ var ControlClient = class {
10848
11204
  return decodeEventSources(await this.request("/v1/event-sources" + (flowId == null ? "" : `?flowId=${segment(flowId)}`), { signal }));
10849
11205
  }
10850
11206
  async listEventSourceConnections(teamId, signal) {
10851
- const source = record$3(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 }));
10852
11208
  exact(source, ["version", "connections"]);
10853
11209
  if (source.version != 1 || !Array.isArray(source.connections)) return invalidResponse();
10854
11210
  return source.connections.map(connection);
@@ -10875,7 +11231,7 @@ var ControlClient = class {
10875
11231
  });
10876
11232
  }
10877
11233
  async listVariables() {
10878
- const source = record$3(await this.request("/v1/variables"));
11234
+ const source = record$1(await this.request("/v1/variables"));
10879
11235
  exact(source, ["variables", "version"]);
10880
11236
  if (source.version != 1 || !Array.isArray(source.variables)) return invalidResponse();
10881
11237
  return {
@@ -10893,7 +11249,7 @@ var ControlClient = class {
10893
11249
  }));
10894
11250
  }
10895
11251
  async deleteVariable(name) {
10896
- const source = record$3(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
11252
+ const source = record$1(await this.request(`/v1/variables/${segment(name)}`, { method: "DELETE" }));
10897
11253
  exact(source, ["version"]);
10898
11254
  if (source.version != 1) return invalidResponse();
10899
11255
  }
@@ -10912,7 +11268,7 @@ var ControlClient = class {
10912
11268
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
10913
11269
  }
10914
11270
  async getErrorListeners(flowId, signal) {
10915
- const source = record$3(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 }));
10916
11272
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
10917
11273
  return source.listeners.map(errorListener);
10918
11274
  }
@@ -10929,12 +11285,12 @@ var ControlClient = class {
10929
11285
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
10930
11286
  }
10931
11287
  async listTriggerKeys(signal, locale) {
10932
- const source = record$3(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 }));
10933
11289
  if (source.version != 1 || !Array.isArray(source.keys)) return invalidResponse();
10934
11290
  return source.keys.map(triggerKeySummary);
10935
11291
  }
10936
11292
  async listTriggerDefinitions(signal) {
10937
- const source = record$3(await this.request("/v1/trigger-keys/catalog", { signal }));
11293
+ const source = record$1(await this.request("/v1/trigger-keys/catalog", { signal }));
10938
11294
  if (source.version != 2 || !Array.isArray(source.definitions)) return invalidResponse();
10939
11295
  return source.definitions.map(triggerKey);
10940
11296
  }
@@ -10976,13 +11332,13 @@ var ControlClient = class {
10976
11332
  };
10977
11333
  }
10978
11334
  async getTriggerKey(key, signal) {
10979
- const source = record$3(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
11335
+ const source = record$1(await this.request(`/v1/trigger-keys/${segment(key)}`, { signal }));
10980
11336
  if (source.version != 1) return invalidResponse();
10981
11337
  return triggerKey(source.definition);
10982
11338
  }
10983
11339
  async listFlowTriggerBindings(flowId, signal) {
10984
- const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/triggers`, { signal }));
10985
- 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();
10986
11342
  return source.bindings.map(triggerBinding);
10987
11343
  }
10988
11344
  async getFlowTriggerBinding(flowId, triggerNodeId) {
@@ -11014,7 +11370,7 @@ var ControlClient = class {
11014
11370
  }));
11015
11371
  }
11016
11372
  async getEditor(flowId) {
11017
- const source = record$3(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11373
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/editor`));
11018
11374
  if (source.version != 1) return invalidResponse();
11019
11375
  const result = {
11020
11376
  flow: flow(source.flow),
@@ -11027,7 +11383,7 @@ var ControlClient = class {
11027
11383
  return result;
11028
11384
  }
11029
11385
  async getPublicationPresentation(flowId, publicationId, signal) {
11030
- const source = record$3(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 }));
11031
11387
  if (source.version != 1) return invalidResponse();
11032
11388
  return {
11033
11389
  version: 1,
@@ -11047,30 +11403,30 @@ var ControlClient = class {
11047
11403
  return draft(await this.request(`/v1/flows/${segment(flowId)}/revisions/${segment(revisionId)}`, { signal }));
11048
11404
  }
11049
11405
  async listTriggerConfigOptions(flowId, nodeId, field, signal) {
11050
- const source = record$3(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 }));
11051
11407
  exact(source, ["options", "version"]);
11052
11408
  if (source.version != 1 || !Array.isArray(source.options) || source.options.length > 1e3) return invalidResponse();
11053
11409
  return source.options.map((value) => {
11054
- const item = record$3(value);
11410
+ const item = record$1(value);
11055
11411
  exact(item, [
11056
11412
  "value",
11057
11413
  "label",
11058
11414
  ...item.color == null ? [] : ["color"]
11059
11415
  ]);
11060
- const color = item.color == null ? void 0 : string$1(item.color);
11416
+ const color = item.color == null ? void 0 : string(item.color);
11061
11417
  if (color != null && !/^#[0-9a-fA-F]{6}$/.test(color)) return invalidResponse();
11062
11418
  return color == null ? {
11063
- value: string$1(item.value),
11064
- label: string$1(item.label)
11419
+ value: string(item.value),
11420
+ label: string(item.label)
11065
11421
  } : {
11066
- value: string$1(item.value),
11067
- label: string$1(item.label),
11422
+ value: string(item.value),
11423
+ label: string(item.label),
11068
11424
  color
11069
11425
  };
11070
11426
  });
11071
11427
  }
11072
11428
  async listConnectorTeams(signal) {
11073
- const source = record$3(await this.request("/v1/connector/teams", { signal }));
11429
+ const source = record$1(await this.request("/v1/connector/teams", { signal }));
11074
11430
  exact(source, [
11075
11431
  "enabled",
11076
11432
  "teams",
@@ -11080,7 +11436,7 @@ var ControlClient = class {
11080
11436
  return {
11081
11437
  enabled: source.enabled,
11082
11438
  teams: source.teams.map((value) => {
11083
- const team = record$3(value);
11439
+ const team = record$1(value);
11084
11440
  exact(team, [
11085
11441
  "id",
11086
11442
  "name",
@@ -11088,8 +11444,8 @@ var ControlClient = class {
11088
11444
  ]);
11089
11445
  if (typeof team.systemCreated != "boolean") return invalidResponse();
11090
11446
  return {
11091
- id: string$1(team.id),
11092
- name: string$1(team.name),
11447
+ id: string(team.id),
11448
+ name: string(team.name),
11093
11449
  systemCreated: team.systemCreated
11094
11450
  };
11095
11451
  }),
@@ -11187,20 +11543,51 @@ var ControlClient = class {
11187
11543
  const parameters = new URLSearchParams();
11188
11544
  if (flowId != null) parameters.set("flowId", flowId);
11189
11545
  if (teamId != null) parameters.set("teamId", teamId);
11190
- const source = record$3(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}`}`, {
11191
11547
  body: JSON.stringify({ version: 1 }),
11192
11548
  method: "POST"
11193
11549
  }));
11194
11550
  exact(source, ["url", "version"]);
11195
11551
  if (source.version != 1) return invalidResponse();
11196
11552
  try {
11197
- const url = new URL(string$1(source.url));
11553
+ const url = new URL(string(source.url));
11198
11554
  if (url.protocol != "http:" && url.protocol != "https:") return invalidResponse();
11199
11555
  return url.href;
11200
11556
  } catch {
11201
11557
  return invalidResponse();
11202
11558
  }
11203
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
+ }
11204
11591
  async changeDraft(flowId, expectedRevisionId, operations, changeId = operationKey("change")) {
11205
11592
  return draftChange(await this.request(`/v1/flows/${segment(flowId)}/draft/changes`, {
11206
11593
  body: JSON.stringify({
@@ -11358,7 +11745,7 @@ var ControlClient = class {
11358
11745
  const query = Object.entries(parameters).map(([key, value]) => `${segment(key)}=${segment(value)}`).join("&");
11359
11746
  const suffix = query == "" ? "" : `?${query}`;
11360
11747
  return this.connectorRequest(`/v1/connector/actions${suffix}`, "actions", signal, (value) => {
11361
- const source = record$3(value);
11748
+ const source = record$1(value);
11362
11749
  exact(source, ["actions", "version"]);
11363
11750
  if (source.version != 1 || !Array.isArray(source.actions)) return invalidResponse();
11364
11751
  return source.actions.map(connectorAction);
@@ -11381,9 +11768,9 @@ var ControlClient = class {
11381
11768
  } catch {
11382
11769
  return invalidResponse();
11383
11770
  }
11384
- const error = record$3(value).error;
11385
- const source = error == null ? void 0 : record$3(error);
11386
- 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));
11387
11774
  }
11388
11775
  return response;
11389
11776
  }
@@ -11562,6 +11949,84 @@ function liveRunRequest(harness, publicationId, key) {
11562
11949
  });
11563
11950
  }
11564
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
+ },
11565
12030
  {
11566
12031
  name: "admits simultaneous retries as one Run and preserves its Trigger identity",
11567
12032
  async verify(harness) {
@@ -11696,6 +12161,11 @@ var controlApiConformanceCases = [
11696
12161
  const draftRevisionId = requiredString(created.draftRevisionId, "Created Flow draftRevisionId");
11697
12162
  equal(created.name, "Control flow", "Created Flow name");
11698
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");
11699
12169
  equal(await json(await createFlowRequest(harness, "Control flow", "flow-lifecycle"), 200, "Replay Flow"), created, "Replayed Flow");
11700
12170
  await error(await createFlowRequest(harness, "Different flow", "flow-lifecycle"), 409, "flow.conflict", "Conflicting Flow");
11701
12171
  equal(await json(await request(harness, `/v1/flows/${flowId}`), 200, "Read Flow"), created, "Read Flow");