@oomol-lab/open-flow 0.1.0-beta.75 → 0.1.0-beta.77

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 (146) hide show
  1. package/README.md +3 -1
  2. package/dist/browser/{ContentIcon-FCpKiwjp.js → ContentIcon-VZQO8VZU.js} +9 -6
  3. package/dist/browser/{FlowCanvas-dzRBnlUT.js → FlowCanvas-BNGDMaWr.js} +75 -63
  4. package/dist/browser/{createResourceDialog-BeYDdUl-.js → createResourceDialog-BmtakfVg.js} +63 -57
  5. package/dist/browser/{dialog-ZtpsFbl4.js → dialog-BcFBfRB1.js} +126 -32
  6. package/dist/browser/{exportSvg-DqXw1yf-.js → exportSvg-CG8hEUNk.js} +2 -2
  7. package/dist/browser/{flowChanges-b_5UobFj.js → flowChanges-BGo_4Ypo.js} +6063 -11285
  8. package/dist/browser/{flowWorkspace-ItojZbO4.js → flowWorkspace-BFHGev7s.js} +1065 -2570
  9. package/dist/browser/preview.css +626 -653
  10. package/dist/browser/preview.js +1907 -9663
  11. package/dist/browser/theme.css +117 -263
  12. package/dist/browser/{tooltip-wZJRB9oP.js → tooltip-BAWSUexx.js} +2 -2
  13. package/dist/browser/{typeScriptSession-CSRwWmZm.js → typeScriptSession-CRoezJPN.js} +1 -1
  14. package/dist/browser/ui.css +464 -463
  15. package/dist/browser/ui.js +4 -3
  16. package/dist/browser/workbench.css +9891 -9897
  17. package/dist/browser/workbench.d.ts +6 -2
  18. package/dist/browser/workbench.js +838 -499
  19. package/dist/browser/{workbenchSelect-M441Lz0d.js → workbenchSelect-CjK-xdm3.js} +2 -2
  20. package/dist/command/index.js +48 -50
  21. package/dist/common/authoring.d.ts +5 -5
  22. package/dist/common/authoringExamples.d.ts +3 -2
  23. package/dist/common/authoringSchema.d.ts +26 -4
  24. package/dist/common/connector-proxy.d.ts +1 -1
  25. package/dist/common/control-api-conformance.js +352 -144
  26. package/dist/common/control-api-errors.d.ts +12 -0
  27. package/dist/common/control-api.d.ts +38 -4
  28. package/dist/common/control-api.js +373 -162
  29. package/dist/common/control-requests.d.ts +22 -3
  30. package/dist/common/control-requests.js +268 -28
  31. package/dist/common/cron-trigger.d.ts +2 -1
  32. package/dist/common/decision.d.ts +4 -4
  33. package/dist/common/decision.js +5 -2
  34. package/dist/common/engine-contract.d.ts +6 -1
  35. package/dist/common/event-source-definition.d.ts +1 -1
  36. package/dist/common/event-source-view.d.ts +22 -0
  37. package/dist/common/event-source.d.ts +1 -1
  38. package/dist/common/event-source.js +24 -65
  39. package/dist/common/event-sources.d.ts +0 -21
  40. package/dist/common/flow-authoring.js +90 -20
  41. package/dist/common/flow-change-schema.d.ts +9 -1
  42. package/dist/common/flow-change.d.ts +8 -202
  43. package/dist/common/flow-change.js +96 -24
  44. package/dist/common/flow-encoding.js +89 -21
  45. package/dist/common/flow-input-value.d.ts +1 -1
  46. package/dist/common/flow-model.d.ts +121 -0
  47. package/dist/common/flow-notifications.d.ts +1 -1
  48. package/dist/common/flow-retry.d.ts +2 -4
  49. package/dist/common/flow-semantics.js +161 -80
  50. package/dist/common/flow-state.d.ts +123 -0
  51. package/dist/common/flow-state.js +5852 -0
  52. package/dist/common/flow-workflowReferences.d.ts +8 -0
  53. package/dist/common/flowInspection.d.ts +1 -1
  54. package/dist/common/http-hosts.d.ts +6 -0
  55. package/dist/common/http-request.d.ts +13 -5
  56. package/dist/common/http-request.js +23 -5
  57. package/dist/common/integration-trigger.d.ts +2 -1
  58. package/dist/common/mcp.d.ts +96 -3
  59. package/dist/common/mcp.js +355 -142
  60. package/dist/common/openapi.d.ts +4 -4
  61. package/dist/common/openapi.js +4 -1
  62. package/dist/common/poll-trigger.d.ts +2 -1
  63. package/dist/common/run-events.js +1 -0
  64. package/dist/common/runtime-contract.d.ts +37 -1
  65. package/dist/common/runtime-contract.js +717 -72
  66. package/dist/common/runtime-nodejs-compat.d.ts +44 -0
  67. package/dist/common/runtime-nodejs-compat.js +5870 -0
  68. package/dist/common/scheduler-checkpoint.d.ts +1 -1
  69. package/dist/common/scheduler-node-execution.d.ts +2 -1
  70. package/dist/common/scheduler.d.ts +2 -2
  71. package/dist/common/scheduler.js +76 -6
  72. package/dist/common/state-conformance.d.ts +16 -0
  73. package/dist/common/tags.d.ts +4 -0
  74. package/dist/common/trigger-catalog.d.ts +1 -7
  75. package/dist/common/trigger-config-options.d.ts +1 -1
  76. package/dist/common/trigger-config.d.ts +1 -1
  77. package/dist/common/trigger-contract.d.ts +2 -1
  78. package/dist/common/trigger-localization.d.ts +8 -2
  79. package/dist/common/trigger-model.d.ts +101 -0
  80. package/dist/common/webhook-response.d.ts +1 -1
  81. package/dist/common/webhook-trigger.d.ts +3 -1
  82. package/dist/common/workflow.d.ts +3 -12
  83. package/dist/common/workflow.js +25 -23
  84. package/dist/index.d.ts +52 -14
  85. package/package.json +9 -1
  86. package/src/base/common/json.ts +1 -1
  87. package/src/connector/common/proxy.ts +1 -1
  88. package/src/control/common/api.ts +90 -16
  89. package/src/control/common/authoring.ts +6 -1
  90. package/src/control/common/authoringExamples.ts +8 -0
  91. package/src/control/common/authoringSchema.ts +26 -13
  92. package/src/control/common/authoringTools.ts +1 -1
  93. package/src/control/common/conformance.ts +1 -1
  94. package/src/control/common/connectorDecoders.ts +1 -1
  95. package/src/control/common/errors.ts +6 -0
  96. package/src/control/common/eventSources.ts +2 -29
  97. package/src/control/common/flowDecoders.ts +1 -0
  98. package/src/control/common/mcp.ts +16 -0
  99. package/src/control/common/requests.ts +10 -2
  100. package/src/control/common/tags.ts +20 -0
  101. package/src/control/common/triggerCatalog.ts +1 -8
  102. package/src/decision/common/decision.ts +15 -7
  103. package/src/event-source/common/definition.ts +1 -1
  104. package/src/event-source/common/index.ts +1 -1
  105. package/src/event-source/common/view.ts +20 -0
  106. package/src/execution/common/checkpoint.ts +1 -1
  107. package/src/execution/common/events.ts +3 -0
  108. package/src/execution/common/node-execution.ts +4 -1
  109. package/src/execution/common/scheduler.ts +3 -1
  110. package/src/flow/common/change.ts +60 -193
  111. package/src/flow/common/changeSchema.ts +39 -4
  112. package/src/flow/common/connectionUsage.ts +1 -1
  113. package/src/flow/common/errorHandling.ts +1 -1
  114. package/src/flow/common/inputValue.ts +1 -1
  115. package/src/flow/common/model.ts +130 -0
  116. package/src/flow/common/modules.ts +1 -1
  117. package/src/flow/common/portChanges.ts +1 -1
  118. package/src/flow/common/retry.ts +2 -4
  119. package/src/flow/common/semantics.ts +31 -4
  120. package/src/flow/common/webhookResponse.ts +1 -1
  121. package/src/flow/common/workflowReferences.ts +31 -0
  122. package/src/http/common/authBindings.ts +6 -9
  123. package/src/http/common/hosts.ts +13 -0
  124. package/src/http/common/httpRequest.ts +30 -15
  125. package/src/openapi/common/openapi.ts +9 -5
  126. package/src/{execution → runtime}/common/engineContract.ts +23 -15
  127. package/src/runtime/common/nodejsCompat.ts +275 -0
  128. package/src/runtime/common/nodejsGuest.generated.json +47 -0
  129. package/src/runtime/common/runtime.ts +1254 -0
  130. package/src/state/common/conformance.ts +86 -0
  131. package/src/state/common/state.ts +169 -0
  132. package/src/trigger/common/config.ts +1 -1
  133. package/src/trigger/common/configOptions.ts +1 -1
  134. package/src/trigger/common/contract.ts +2 -1
  135. package/src/trigger/common/cron.ts +2 -1
  136. package/src/trigger/common/integration.ts +2 -1
  137. package/src/trigger/common/model.ts +87 -0
  138. package/src/trigger/common/poll.ts +2 -1
  139. package/src/trigger/common/webhook.ts +3 -1
  140. package/src/trigger/providers/fieldDescriptions.ts +1 -1
  141. package/src/trigger/providers/localization.ts +9 -2
  142. package/src/trigger/providers/remote.ts +1 -1
  143. package/src/types/index.ts +55 -15
  144. package/src/workflow/common/workflow.ts +3 -44
  145. package/src/execution/common/runtime.ts +0 -563
  146. /package/src/{control → connector}/common/providerIconSprite.ts +0 -0
@@ -1,6 +1,6 @@
1
- import type { JsonValue, Port, PortDefinition } from '../index.js';
1
+ import type { TriggerNode, TriggerSchedule } from './trigger-model.js';
2
+ import type { CodeModule, ConnectorCapability, FixedInputValue, GraphNodeBase, InlineTaskDefinition, InputMapping, InputPort, JsonValue, ManagedTaskDefinitionOf, RetryConfiguration, Port, Source, TaskCapability, WorkflowCapability, WorkflowExecutor } from './flow-model.js';
2
3
  export { fixedInputValue, inputValue, inputValues } from './flow-input-value.js';
3
- import type { RetryConfiguration } from './flow-retry.js';
4
4
  import type { WebhookMethod } from './webhook-method.js';
5
5
  import { currentFlowModelVersion } from './flow-change-schema.js';
6
6
  export { changeOperationsSchema, currentFlowModelVersion, decodeChangeOperations } from './flow-change-schema.js';
@@ -9,56 +9,15 @@ export { supportsNodeRetry } from './flow-retry.js';
9
9
  export { nodeSystemOutputPorts, supportsNodeErrorHandling, nodeErrorSchema } from './flow-errorHandling.js';
10
10
  export type { NodeErrorData } from './flow-errorHandling.js';
11
11
  export type { WebhookMethod };
12
- export type { JsonValue, Port, PortDefinition } from '../index.js';
12
+ export type { BindingSource, CodeModule, ConnectorAccessCapability, ConnectorActionCapability, ConnectorCapability, ConnectorPermissionCapability, FixedInputValue, Group, InlineTaskDefinition, InputMapping, InputPort, InputPortDefinition, InputValues, JsonValue, NodeSource, Port, PortDefinition, Source, TaskCapability, WorkflowCapability, } from './flow-model.js';
13
+ export { portsByHandle } from './flow-model.js';
14
+ export type { IntegrationBodyFormat, IntegrationEndpointDeclaration, IntegrationEndpointMethod, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookBodyField, WebhookOptions, } from './trigger-model.js';
13
15
  export { isSchemaKeyword } from './flow-schemaKeywords.js';
14
16
  export type { SchemaKeyword, SchemaMismatch } from './flow-schemaKeywords.js';
15
17
  export declare const resourceNameMaxLength = 80;
16
18
  export type ResourceNameIssue = 'controlCharacter' | 'empty' | 'specialCharacter' | 'tooLong';
17
19
  export declare function resourceNameIssue(value: string): ResourceNameIssue | undefined;
18
20
  export declare function validVariableName(value: string): boolean;
19
- export interface InputPortDefinition extends PortDefinition {
20
- readonly value?: JsonValue;
21
- }
22
- export interface InputPort extends InputPortDefinition {
23
- readonly handle: string;
24
- }
25
- export interface Group {
26
- readonly collapsed?: boolean;
27
- readonly group: string;
28
- }
29
- export declare function portsByHandle<Value extends Port>(ports: readonly (Value | Group)[]): Readonly<Record<string, Value>>;
30
- export interface NodeSource {
31
- readonly system?: true;
32
- readonly field?: string;
33
- readonly kind: 'node';
34
- readonly nodeId: string;
35
- readonly output: string;
36
- }
37
- export interface BindingSource {
38
- readonly bindingId: string;
39
- readonly kind: 'binding';
40
- }
41
- export type FixedInputValue = {
42
- readonly kind: 'unset';
43
- } | {
44
- readonly kind: 'value';
45
- readonly value: JsonValue;
46
- };
47
- export type InputValues = Readonly<Record<string, FixedInputValue>>;
48
- export type InputMapping = FixedInputValue | {
49
- readonly kind: 'sources';
50
- readonly sources: readonly (BindingSource | NodeSource)[];
51
- };
52
- interface GraphNodeBase {
53
- readonly description?: string;
54
- readonly icon?: string;
55
- readonly inputs: Readonly<Record<string, InputMapping>>;
56
- readonly name?: string;
57
- readonly maxExecutions?: number;
58
- readonly timeoutMs?: number;
59
- readonly retry?: RetryConfiguration;
60
- readonly onError?: 'stop' | 'error';
61
- }
62
21
  export interface ValueNode extends GraphNodeBase {
63
22
  readonly kind: 'value';
64
23
  readonly values: readonly InputPort[];
@@ -86,7 +45,6 @@ export interface ApprovalNode extends ResolutionNodeBase {
86
45
  }
87
46
  export type ResolutionNode = ApprovalNode | WaitNode;
88
47
  export type ConditionOperator = '!=' | '<' | '<=' | '==' | '>' | '>=' | 'contains' | 'endsWith' | 'hasKey' | 'hasValue' | 'isEmpty' | 'isFalse' | 'isNotEmpty' | 'isNotNull' | 'isNull' | 'isTrue' | 'notContains' | 'notHasKey' | 'notHasValue' | 'startsWith';
89
- export type Source = BindingSource | NodeSource;
90
48
  export type ConditionOperand = {
91
49
  readonly kind: 'value';
92
50
  readonly value?: JsonValue;
@@ -113,7 +71,7 @@ export interface ConditionNode extends GraphNodeBase {
113
71
  readonly matchMode: 'first' | 'all';
114
72
  readonly kind: 'condition';
115
73
  }
116
- export type ManagedTaskExecutor = import('./http-request.js').HttpRequestExecutor | import('./workflow.js').WorkflowExecutor | import('./decision.js').DecisionExecutor | import('./openapi.js').OpenApiExecutor | {
74
+ export type ManagedTaskExecutor = import('./http-request.js').HttpRequestExecutor | import('./flow-state.js').DedupeExecutor | WorkflowExecutor | import('./decision.js').DecisionExecutor | import('./openapi.js').OpenApiExecutor | {
117
75
  readonly kind: 'connector';
118
76
  readonly action: string;
119
77
  readonly connectionId?: string;
@@ -161,66 +119,16 @@ export interface AgentConnectorTool extends AgentToolBase {
161
119
  readonly action: string;
162
120
  readonly connectionId?: string;
163
121
  }
164
- export interface WorkflowCapability {
165
- readonly kind: 'workflow';
166
- readonly name: string;
167
- readonly flowId: string;
168
- readonly revisionId: string;
169
- readonly inputs: readonly Port[];
170
- readonly outputs: readonly Port[] | null;
171
- }
172
122
  export interface AgentWorkflowTool extends AgentToolBase, Omit<WorkflowCapability, 'inputs'> {
173
123
  readonly action?: never;
174
124
  readonly connectionId?: never;
175
125
  }
176
126
  export type AgentTool = AgentConnectorTool | AgentWorkflowTool;
177
- export type TaskCapability = ConnectorCapability | WorkflowCapability;
178
127
  export declare const workflowToolNamePattern: RegExp;
179
128
  export declare function workflowToolNameIssue(name: string, otherNames?: Iterable<string>): 'invalid' | 'duplicate' | undefined;
180
129
  export declare function decodeTaskCapabilities(value: unknown): readonly TaskCapability[];
181
- export interface ConnectorAccessCapability {
182
- readonly actionHints?: readonly string[];
183
- readonly connectionHints?: readonly {
184
- readonly action: string;
185
- readonly connectionId: string;
186
- readonly alias?: string;
187
- }[];
188
- readonly kind: 'connector';
189
- }
190
- export interface ConnectorActionCapability {
191
- readonly action: string;
192
- readonly connections: readonly {
193
- readonly connectionId: string;
194
- readonly alias?: string;
195
- }[];
196
- readonly connectionId?: string;
197
- readonly kind: 'connector';
198
- }
199
- export type ConnectorPermissionCapability = {
200
- readonly kind: 'connector';
201
- readonly mode: 'shared';
202
- } | {
203
- readonly kind: 'connector';
204
- readonly mode: 'independent';
205
- readonly actions: readonly {
206
- readonly action: string;
207
- readonly connectionId?: string;
208
- }[];
209
- };
210
- export type ConnectorCapability = ConnectorAccessCapability | ConnectorActionCapability | ConnectorPermissionCapability;
211
130
  export declare function decodeConnectorCapabilities(value: unknown): readonly ConnectorCapability[];
212
- interface TaskDefinitionBase {
213
- readonly inputs: readonly (InputPort | Group)[];
214
- readonly name: string;
215
- readonly outputs: readonly (Port | Group)[];
216
- }
217
- export interface InlineTaskDefinition extends TaskDefinitionBase {
218
- readonly capabilities?: readonly TaskCapability[];
219
- readonly moduleId: string;
220
- }
221
- export interface ManagedTaskDefinition extends TaskDefinitionBase {
222
- readonly executor: ManagedTaskExecutor;
223
- }
131
+ export type ManagedTaskDefinition = ManagedTaskDefinitionOf<ManagedTaskExecutor>;
224
132
  export type TaskDefinition = InlineTaskDefinition | ManagedTaskDefinition;
225
133
  export interface TaskNode extends GraphNodeBase {
226
134
  readonly kind: 'task';
@@ -231,103 +139,6 @@ export interface Graph {
231
139
  readonly edges: readonly GraphEdge[];
232
140
  readonly nodes: Readonly<Record<string, GraphNode>>;
233
141
  }
234
- export type TriggerSchedule = {
235
- readonly expression: string;
236
- readonly timezone: string;
237
- readonly type: 'cron';
238
- } | {
239
- readonly type: 'every';
240
- readonly unit: 'day' | 'hour' | 'minute' | 'month' | 'week';
241
- readonly value: number;
242
- };
243
- interface TriggerKeySnapshotBase {
244
- readonly configInputs: readonly (InputPort | Group)[];
245
- readonly definitionVersion: number;
246
- readonly description: string;
247
- readonly displayName: string;
248
- readonly key: string;
249
- readonly name: string;
250
- readonly outputs: readonly Port[];
251
- readonly provider: string;
252
- }
253
- export type IntegrationEndpointMethod = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT';
254
- export type IntegrationBodyFormat = 'form' | 'json' | 'multipart' | 'text';
255
- export interface IntegrationEndpointDeclaration {
256
- readonly body: {
257
- readonly allowArray: boolean;
258
- readonly allowEmpty: boolean;
259
- readonly formats: readonly IntegrationBodyFormat[];
260
- };
261
- readonly methods: readonly IntegrationEndpointMethod[];
262
- readonly successStatus: number;
263
- }
264
- export type TriggerKeySnapshot = (TriggerKeySnapshotBase & {
265
- readonly type: 'poll';
266
- }) | (TriggerKeySnapshotBase & {
267
- readonly endpoint: IntegrationEndpointDeclaration;
268
- readonly type: 'integration';
269
- });
270
- export interface WebhookBodyField extends InputPort {
271
- }
272
- export interface WebhookOptions {
273
- readonly allowedOrigins?: readonly string[];
274
- readonly responseBody?: {
275
- readonly kind: 'workflow-outputs';
276
- readonly output?: string;
277
- readonly timeoutMs?: number;
278
- } | {
279
- readonly kind: 'webhook-response';
280
- readonly nodeId?: string;
281
- readonly timeoutMs?: number;
282
- };
283
- readonly responseData?: string;
284
- readonly responseHeaders?: Readonly<Record<string, string>>;
285
- readonly responseHeadersSource?: {
286
- readonly kind: 'workflow-outputs';
287
- readonly output?: string;
288
- };
289
- readonly responseHeaderOutputs?: Readonly<Record<string, string>>;
290
- readonly responseStatusCode?: number;
291
- readonly responseStatusCodeOutput?: string;
292
- }
293
- interface TriggerNodeBase {
294
- readonly onError?: never;
295
- readonly description?: string;
296
- readonly icon?: string;
297
- readonly name: string;
298
- }
299
- export type TriggerNode = (TriggerNodeBase & {
300
- readonly kind: 'manual';
301
- }) | (TriggerNodeBase & {
302
- readonly kind: 'start';
303
- readonly inputDefs: readonly Port[];
304
- }) | (TriggerNodeBase & {
305
- readonly kind: 'error';
306
- readonly sourceFlowIds?: readonly string[];
307
- }) | (TriggerNodeBase & {
308
- readonly bodyFields: readonly WebhookBodyField[];
309
- readonly kind: 'webhook';
310
- readonly method: WebhookMethod;
311
- readonly options?: WebhookOptions;
312
- }) | (TriggerNodeBase & {
313
- readonly cronTimes: readonly TriggerSchedule[];
314
- readonly kind: 'cron';
315
- }) | (TriggerNodeBase & {
316
- readonly connectionId?: string;
317
- readonly config: InputValues;
318
- readonly definition: TriggerKeySnapshot & {
319
- readonly type: 'poll';
320
- };
321
- readonly kind: 'poll';
322
- readonly pollTimes: readonly TriggerSchedule[];
323
- }) | (TriggerNodeBase & {
324
- readonly connectionId?: string;
325
- readonly config: InputValues;
326
- readonly definition: TriggerKeySnapshot & {
327
- readonly type: 'integration';
328
- };
329
- readonly kind: 'integration';
330
- });
331
142
  export interface OutputsNode extends Omit<GraphNodeBase, 'inputs'> {
332
143
  readonly kind: 'outputs';
333
144
  readonly outputDefs: readonly Port[];
@@ -347,14 +158,9 @@ export interface FlowDocument {
347
158
  }>>;
348
159
  readonly graph: Graph;
349
160
  }
350
- export interface CodeModule {
351
- readonly imports: readonly string[];
352
- readonly name: string;
353
- readonly source: string;
354
- }
355
161
  export interface RevisionContent {
356
162
  readonly document: FlowDocument;
357
- readonly modelVersion: 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | typeof currentFlowModelVersion;
163
+ readonly modelVersion: 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | typeof currentFlowModelVersion;
358
164
  readonly modules: Readonly<Record<string, CodeModule>>;
359
165
  }
360
166
  export interface GraphEdge {
@@ -1,12 +1,3 @@
1
- //#region src/http/common/authBindings.ts
2
- /** Never allow credentials to enter a Revision as literal node inputs. */
3
- function assertHttpAuthBindings(document) {
4
- for (const node of Object.values(document.graph.nodes)) {
5
- if (node.kind != "task" || !("executor" in node.task) || !["openapi", "http-request"].includes(node.task.executor.kind)) continue;
6
- for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
7
- }
8
- }
9
- //#endregion
10
1
  //#region src/flow/common/inputValue.ts
11
2
  /** An explicit clear suppresses the default; absent mappings still inherit it. */
12
3
  function inputValue(mapping, fallback) {
@@ -8691,6 +8682,9 @@ function isSchemaKeyword(value) {
8691
8682
  }
8692
8683
  //#endregion
8693
8684
  //#region src/decision/common/decision.ts
8685
+ function isDecisionExecutor(executor) {
8686
+ return executor.kind === "decision";
8687
+ }
8694
8688
  var decisionLimits = {
8695
8689
  choice: 255,
8696
8690
  score: 10
@@ -8713,7 +8707,7 @@ function limitDecisionQuestions(questions) {
8713
8707
  }
8714
8708
  /** Loading an oversized task also updates its previously generated output schemas. */
8715
8709
  function limitDecisionTask(task) {
8716
- if (task.executor.kind !== "decision") return task;
8710
+ if (!isDecisionExecutor(task.executor)) return task;
8717
8711
  const original = task.executor.questions;
8718
8712
  const questions = limitDecisionQuestions(original);
8719
8713
  if (questions === original) return task;
@@ -8780,6 +8774,20 @@ function answerSchema(question) {
8780
8774
  };
8781
8775
  }
8782
8776
  //#endregion
8777
+ //#region src/http/common/authBindings.ts
8778
+ /** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
8779
+ function assertHttpAuthBindings(inputs) {
8780
+ for (const [handle, mapping] of Object.entries(inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
8781
+ }
8782
+ //#endregion
8783
+ //#region src/http/common/hosts.ts
8784
+ /** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
8785
+ var httpHostPattern = /^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
8786
+ /** Wildcards must name a registrable suffix, so `*.com` is rejected. */
8787
+ function isHttpHost(value) {
8788
+ return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
8789
+ }
8790
+ //#endregion
8783
8791
  //#region src/http/common/httpRequest.ts
8784
8792
  var parameterSchema = strictObject({
8785
8793
  mode: _enum(["fields", "object"]).default("fields"),
@@ -8825,6 +8833,51 @@ var httpRequestExecutorSchema = strictObject({
8825
8833
  ]).default("auto"),
8826
8834
  statusPolicy: _enum(["success", "all"]).default("success")
8827
8835
  }).extend({ kind: literal("http-request") });
8836
+ strictObject({
8837
+ scope: _enum(["draft", "live"]),
8838
+ values: boolean().optional()
8839
+ });
8840
+ strictObject({
8841
+ scope: _enum(["draft", "live"]),
8842
+ key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
8843
+ });
8844
+ strictObject({
8845
+ scope: _enum(["draft", "live"]),
8846
+ space: string().regex(/^(flow|node:.+)$/)
8847
+ });
8848
+ var dedupeExecutorSchema = strictObject({
8849
+ field: string().default(""),
8850
+ mode: _enum(["new", "increasing"]).default("new"),
8851
+ space: _enum(["node", "flow"]).default("node")
8852
+ }).extend({ kind: literal("dedupe") });
8853
+ object({
8854
+ version: literal(1),
8855
+ scope: _enum(["draft", "live"]),
8856
+ limits: object({
8857
+ maxValueBytes: number().positive(),
8858
+ maxValues: number().int().positive(),
8859
+ maxSpaces: number().int().positive(),
8860
+ maxIdentities: number().positive(),
8861
+ maxRunWrites: number().positive()
8862
+ }),
8863
+ values: array(object({
8864
+ key: string(),
8865
+ size: number().nonnegative(),
8866
+ updatedAt: number(),
8867
+ value: json$1().optional()
8868
+ })),
8869
+ spaces: array(object({
8870
+ space: string(),
8871
+ mode: _enum(["new", "increasing"]),
8872
+ count: number().nonnegative(),
8873
+ watermark: union([
8874
+ string(),
8875
+ number(),
8876
+ _null()
8877
+ ]),
8878
+ updatedAt: number()
8879
+ }))
8880
+ });
8828
8881
  function checkJsonDepth(value, depth = 0) {
8829
8882
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
8830
8883
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -8925,7 +8978,7 @@ var webhookResponseTimeout = {
8925
8978
  }).jsonSchema;
8926
8979
  //#endregion
8927
8980
  //#region src/flow/common/changeSchema.ts
8928
- var currentFlowModelVersion = 11;
8981
+ var currentFlowModelVersion = 13;
8929
8982
  var text = string();
8930
8983
  var actionConnection = text.describe("Account selection: omit while unconfigured; use an account ID to select it; use \"\" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.");
8931
8984
  var json = json$1();
@@ -9005,7 +9058,14 @@ var workflowCapabilitySchema = strictObject({
9005
9058
  inputs: array(port),
9006
9059
  outputs: array(port).nullable()
9007
9060
  });
9008
- var capability = union([connectorCapabilitySchema, workflowCapabilitySchema]);
9061
+ var capability = union([
9062
+ connectorCapabilitySchema,
9063
+ workflowCapabilitySchema,
9064
+ strictObject({
9065
+ kind: literal("http"),
9066
+ hosts: array(text.refine(isHttpHost, "Use a lowercase host name or IPv4 address, optionally prefixed by \"*.\" for subdomains.")).min(1).max(20).describe("Hosts Code may call with context.fetch. \"*.example.com\" matches subdomains only.")
9067
+ })
9068
+ ]);
9009
9069
  var inline = object({
9010
9070
  ...ports,
9011
9071
  name: text,
@@ -9116,7 +9176,8 @@ var managedFields = object({
9116
9176
  flowId: text,
9117
9177
  revisionId: text
9118
9178
  }),
9119
- httpRequestExecutorSchema
9179
+ httpRequestExecutorSchema,
9180
+ dedupeExecutorSchema
9120
9181
  ])
9121
9182
  });
9122
9183
  var managed = managedFields.transform(limitDecisionTask);
@@ -9385,7 +9446,9 @@ var revision = object({
9385
9446
  literal(8),
9386
9447
  literal(9),
9387
9448
  literal(10),
9388
- literal(11)
9449
+ literal(11),
9450
+ literal(12),
9451
+ literal(13)
9389
9452
  ]),
9390
9453
  document,
9391
9454
  modules: record$1(text, module)
@@ -9416,7 +9479,7 @@ function decodeRevisionContent(value) {
9416
9479
  checkJsonDepth(value);
9417
9480
  const content = revision.parse(value);
9418
9481
  checkModelVersion(content);
9419
- assertHttpAuthBindings(content.document);
9482
+ assertDocumentHttpAuthBindings(content.document);
9420
9483
  return content;
9421
9484
  }
9422
9485
  var shapes = {
@@ -9610,6 +9673,8 @@ function changeOperationsSchema(kind) {
9610
9673
  return toJSONSchema(schema, { io: "input" });
9611
9674
  }
9612
9675
  function checkModelVersion(content) {
9676
+ if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "dedupe")) throw new Error("Deduplication requires Flow model v13.");
9677
+ if (content.modelVersion < 12 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "moduleId" in candidateNode.task && candidateNode.task.capabilities?.some((item) => item.kind == "http"))) throw new TypeError("Code HTTP access requires Flow model version 12.");
9613
9678
  if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind == "http-request")) throw new TypeError("HTTP Request requires Flow model version 11.");
9614
9679
  if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && ("moduleId" in candidateNode.task ? candidateNode.task.capabilities?.some((item) => item.kind == "workflow") : candidateNode.task.executor.kind == "agent" && candidateNode.task.executor.tools.some((item) => item.kind == "workflow")))) throw new TypeError("Workflow tools require Flow model version 11.");
9615
9680
  if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "webhook" && (candidateNode.options?.responseBody != null || candidateNode.options?.responseStatusCodeOutput != null || candidateNode.options?.responseHeadersSource != null || candidateNode.options?.responseHeaderOutputs != null))) throw new TypeError("Dynamic Webhook responses require Flow model version 10.");
@@ -9625,6 +9690,9 @@ function checkModelVersion(content) {
9625
9690
  if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
9626
9691
  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.");
9627
9692
  }
9693
+ function assertDocumentHttpAuthBindings(content) {
9694
+ for (const graphNode of Object.values(content.graph.nodes)) if (graphNode.kind == "task" && "executor" in graphNode.task && ["openapi", "http-request"].includes(graphNode.task.executor.kind)) assertHttpAuthBindings(graphNode.inputs);
9695
+ }
9628
9696
  //#endregion
9629
9697
  //#region src/flow/common/condition.ts
9630
9698
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -9704,7 +9772,7 @@ var nodeErrorSchema = {
9704
9772
  }
9705
9773
  };
9706
9774
  function supportsNodeErrorHandling(node) {
9707
- return supportsNodeRetry(node);
9775
+ return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "dedupe";
9708
9776
  }
9709
9777
  function nodeSystemOutputPorts(node) {
9710
9778
  return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
@@ -9713,6 +9781,11 @@ function nodeSystemOutputPorts(node) {
9713
9781
  } } : {};
9714
9782
  }
9715
9783
  //#endregion
9784
+ //#region src/flow/common/model.ts
9785
+ function portsByHandle(ports) {
9786
+ return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
9787
+ }
9788
+ //#endregion
9716
9789
  //#region src/flow/common/change.ts
9717
9790
  var resourceNameMaxLength = 80;
9718
9791
  function resourceNameIssue(value) {
@@ -9728,9 +9801,6 @@ function resourceNameIssue(value) {
9728
9801
  function validVariableName(value) {
9729
9802
  return value.length <= 256 && /^[A-Za-z_][A-Za-z0-9_]*$/.test(value) && value.slice(0, 3).toUpperCase() != "OO_";
9730
9803
  }
9731
- function portsByHandle(ports) {
9732
- return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
9733
- }
9734
9804
  var workflowToolNamePattern = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
9735
9805
  function workflowToolNameIssue(name, otherNames = []) {
9736
9806
  if (!workflowToolNamePattern.test(name)) return "invalid";
@@ -9746,6 +9816,8 @@ function decodeTaskCapabilities(value) {
9746
9816
  if (workflowToolNameIssue(item.name, names)) throw new TypeError("Workflow tool names must be unique provider-compatible names.");
9747
9817
  names.add(item.name);
9748
9818
  }
9819
+ const http = parsed.filter((item) => item.kind == "http");
9820
+ if (http.length > 1 || http.some((item) => new Set(item.hosts).size != item.hosts.length)) throw new TypeError("Code declares HTTP hosts once, without duplicates.");
9749
9821
  let connectorIndex = 0;
9750
9822
  return parsed.map((item) => item.kind == "connector" ? connectors[connectorIndex++] : item);
9751
9823
  }
@@ -9881,10 +9953,10 @@ function upgradeRevisionContent(content) {
9881
9953
  function upgradeDecodedRevisionContent(content) {
9882
9954
  const graph = content.document.graph;
9883
9955
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9884
- if (!hasManual && content.modelVersion == 11) return content;
9956
+ if (!hasManual && content.modelVersion == 13) return content;
9885
9957
  return {
9886
9958
  ...content,
9887
- modelVersion: 11,
9959
+ modelVersion: 13,
9888
9960
  document: {
9889
9961
  ...content.document,
9890
9962
  graph: hasManual ? {
@@ -9931,7 +10003,7 @@ function invalid(message) {
9931
10003
  throw new FlowChangeError(message);
9932
10004
  }
9933
10005
  function applyFlowChanges(content, operations) {
9934
- const source = content.modelVersion != 11 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
10006
+ const source = content.modelVersion != 13 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9935
10007
  const document = { ...source.document };
9936
10008
  const modules = { ...source.modules };
9937
10009
  for (const operation of operations) switch (operation.kind) {
@@ -10376,10 +10448,10 @@ function applyFlowChanges(content, operations) {
10376
10448
  break;
10377
10449
  }
10378
10450
  }
10379
- assertHttpAuthBindings(document);
10451
+ assertDocumentHttpAuthBindings(document);
10380
10452
  return upgradeDecodedRevisionContent({
10381
10453
  document,
10382
- modelVersion: 11,
10454
+ modelVersion: 13,
10383
10455
  modules
10384
10456
  });
10385
10457
  }