@oomol-lab/open-flow 0.1.0-beta.74 → 0.1.0-beta.76

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 (139) hide show
  1. package/README.md +3 -1
  2. package/dist/browser/{ContentIcon-CUQHjQIw.js → ContentIcon-Cm1hbVzW.js} +4 -3
  3. package/dist/browser/{FlowCanvas-Dtf8_cQp.js → FlowCanvas-NzKtla_c.js} +62 -62
  4. package/dist/browser/{createResourceDialog-DI9pL-Yr.js → createResourceDialog-BgdedQqu.js} +3 -3
  5. package/dist/browser/{dialog-BYJGvItc.js → dialog-aSElFFw2.js} +322 -26
  6. package/dist/browser/{exportSvg-BOoy7-Db.js → exportSvg-Dcz4HTo_.js} +2 -2
  7. package/dist/browser/{flowChanges-RL-H4CjD.js → flowChanges-NZyS7HSp.js} +490 -438
  8. package/dist/browser/{flowWorkspace-BkDsETj0.js → flowWorkspace-Bl0SDehy.js} +499 -61
  9. package/dist/browser/preview.css +696 -825
  10. package/dist/browser/preview.js +1399 -717
  11. package/dist/browser/theme.css +114 -262
  12. package/dist/browser/{tooltip-wZJRB9oP.js → tooltip-3XMK9jkr.js} +1 -1
  13. package/dist/browser/{typeScriptSession-CSRwWmZm.js → typeScriptSession-C9sBGOKZ.js} +1 -1
  14. package/dist/browser/ui.css +354 -460
  15. package/dist/browser/ui.js +1 -1
  16. package/dist/browser/workbench.css +696 -825
  17. package/dist/browser/workbench.js +13 -7
  18. package/dist/browser/{workbenchSelect-BcWPWGzw.js → workbenchSelect-DBGP7Y4Z.js} +2 -2
  19. package/dist/command/index.js +41 -43
  20. package/dist/common/authoring.d.ts +5 -5
  21. package/dist/common/authoringExamples.d.ts +3 -2
  22. package/dist/common/authoringSchema.d.ts +70 -4
  23. package/dist/common/connector-proxy.d.ts +1 -1
  24. package/dist/common/control-api-conformance.js +250 -138
  25. package/dist/common/control-api.d.ts +3 -2
  26. package/dist/common/control-api.js +246 -134
  27. package/dist/common/control-requests.d.ts +3 -3
  28. package/dist/common/control-requests.js +353 -79
  29. package/dist/common/cron-trigger.d.ts +2 -1
  30. package/dist/common/decision.d.ts +4 -4
  31. package/dist/common/decision.js +5 -2
  32. package/dist/common/engine-contract.d.ts +6 -1
  33. package/dist/common/event-source-definition.d.ts +1 -1
  34. package/dist/common/event-source-view.d.ts +22 -0
  35. package/dist/common/event-source.d.ts +1 -1
  36. package/dist/common/event-source.js +24 -65
  37. package/dist/common/event-sources.d.ts +0 -21
  38. package/dist/common/flow-authoring.js +90 -19
  39. package/dist/common/flow-change-schema.d.ts +9 -1
  40. package/dist/common/flow-change.d.ts +7 -201
  41. package/dist/common/flow-change.js +96 -23
  42. package/dist/common/flow-encoding.js +89 -21
  43. package/dist/common/flow-graph.d.ts +2 -1
  44. package/dist/common/flow-input-value.d.ts +1 -1
  45. package/dist/common/flow-model.d.ts +121 -0
  46. package/dist/common/flow-notifications.d.ts +1 -1
  47. package/dist/common/flow-retry.d.ts +3 -5
  48. package/dist/common/flow-semantics.js +816 -586
  49. package/dist/common/flow-workflowReferences.d.ts +8 -0
  50. package/dist/common/flowInspection.d.ts +1 -1
  51. package/dist/common/http-hosts.d.ts +6 -0
  52. package/dist/common/http-request.d.ts +164 -0
  53. package/dist/common/http-request.js +5272 -0
  54. package/dist/common/integration-trigger.d.ts +2 -1
  55. package/dist/common/mcp.d.ts +3 -3
  56. package/dist/common/mcp.js +248 -136
  57. package/dist/common/openapi.d.ts +4 -4
  58. package/dist/common/openapi.js +4 -1
  59. package/dist/common/poll-trigger.d.ts +2 -1
  60. package/dist/common/run-events.js +11 -9
  61. package/dist/common/runtime-contract.d.ts +23 -1
  62. package/dist/common/runtime-contract.js +607 -72
  63. package/dist/common/runtime-nodejs-compat.d.ts +44 -0
  64. package/dist/common/runtime-nodejs-compat.js +5870 -0
  65. package/dist/common/scheduler-checkpoint.d.ts +1 -1
  66. package/dist/common/scheduler-node-execution.d.ts +1 -1
  67. package/dist/common/scheduler.d.ts +2 -2
  68. package/dist/common/scheduler.js +95 -25
  69. package/dist/common/trigger-catalog.d.ts +1 -7
  70. package/dist/common/trigger-config-options.d.ts +1 -1
  71. package/dist/common/trigger-config.d.ts +1 -1
  72. package/dist/common/trigger-contract.d.ts +2 -1
  73. package/dist/common/trigger-localization.d.ts +8 -2
  74. package/dist/common/trigger-model.d.ts +101 -0
  75. package/dist/common/webhook-response.d.ts +1 -3
  76. package/dist/common/webhook-trigger.d.ts +3 -1
  77. package/dist/common/webhook-trigger.js +12 -11
  78. package/dist/common/workflow.d.ts +3 -12
  79. package/dist/common/workflow.js +25 -23
  80. package/dist/index.d.ts +41 -14
  81. package/package.json +9 -1
  82. package/skills/open-flow/references/flow-authoring.md +1 -0
  83. package/skills/open-flow/references/flow-n8n-conversion.md +19 -15
  84. package/src/base/common/json.ts +1 -1
  85. package/src/connector/common/proxy.ts +1 -1
  86. package/src/control/common/api.ts +7 -5
  87. package/src/control/common/authoring.ts +14 -3
  88. package/src/control/common/authoringExamples.ts +8 -0
  89. package/src/control/common/authoringSchema.ts +38 -25
  90. package/src/control/common/authoringTools.ts +1 -1
  91. package/src/control/common/conformance.ts +1 -1
  92. package/src/control/common/connectorDecoders.ts +1 -1
  93. package/src/control/common/eventSources.ts +2 -29
  94. package/src/control/common/triggerCatalog.ts +1 -8
  95. package/src/decision/common/decision.ts +15 -7
  96. package/src/event-source/common/definition.ts +1 -1
  97. package/src/event-source/common/index.ts +1 -1
  98. package/src/event-source/common/view.ts +20 -0
  99. package/src/execution/common/checkpoint.ts +1 -1
  100. package/src/execution/common/events.ts +3 -0
  101. package/src/execution/common/node-execution.ts +5 -3
  102. package/src/execution/common/scheduler.ts +2 -1
  103. package/src/flow/common/change.ts +59 -192
  104. package/src/flow/common/changeSchema.ts +39 -5
  105. package/src/flow/common/connectionUsage.ts +1 -1
  106. package/src/flow/common/graph.ts +10 -4
  107. package/src/flow/common/inputValue.ts +1 -1
  108. package/src/flow/common/model.ts +130 -0
  109. package/src/flow/common/modules.ts +1 -1
  110. package/src/flow/common/portChanges.ts +1 -1
  111. package/src/flow/common/retry.ts +3 -5
  112. package/src/flow/common/semantics.ts +71 -7
  113. package/src/flow/common/webhookResponse.ts +4 -8
  114. package/src/flow/common/workflowReferences.ts +31 -0
  115. package/src/http/common/authBindings.ts +9 -0
  116. package/src/http/common/headers.ts +5 -0
  117. package/src/http/common/hosts.ts +13 -0
  118. package/src/http/common/httpRequest.ts +266 -0
  119. package/src/openapi/common/openapi.ts +9 -5
  120. package/src/{execution → runtime}/common/engineContract.ts +24 -15
  121. package/src/runtime/common/nodejsCompat.ts +275 -0
  122. package/src/runtime/common/nodejsGuest.generated.json +47 -0
  123. package/src/runtime/common/runtime.ts +1138 -0
  124. package/src/trigger/common/config.ts +1 -1
  125. package/src/trigger/common/configOptions.ts +1 -1
  126. package/src/trigger/common/contract.ts +2 -1
  127. package/src/trigger/common/cron.ts +2 -1
  128. package/src/trigger/common/integration.ts +2 -1
  129. package/src/trigger/common/model.ts +87 -0
  130. package/src/trigger/common/poll.ts +2 -1
  131. package/src/trigger/common/webhook.ts +7 -4
  132. package/src/trigger/providers/fieldDescriptions.ts +1 -1
  133. package/src/trigger/providers/localization.ts +9 -2
  134. package/src/trigger/providers/remote.ts +1 -1
  135. package/src/types/index.ts +44 -15
  136. package/src/workflow/common/workflow.ts +3 -44
  137. package/src/execution/common/runtime.ts +0 -563
  138. package/src/openapi/common/authBindings.ts +0 -12
  139. /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('./workflow.js').WorkflowExecutor | import('./decision.js').DecisionExecutor | import('./openapi.js').OpenApiExecutor | {
74
+ export type ManagedTaskExecutor = import('./http-request.js').HttpRequestExecutor | 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,11 +158,6 @@ 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
163
  readonly modelVersion: 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | typeof currentFlowModelVersion;
@@ -1,12 +1,3 @@
1
- //#region src/openapi/common/authBindings.ts
2
- /** Never allow credentials to enter a Revision as literal node inputs. */
3
- function assertOpenApiAuthBindings(document) {
4
- for (const node of Object.values(document.graph.nodes)) {
5
- if (node.kind != "task" || !("executor" in node.task) || node.task.executor.kind != "openapi") continue;
6
- for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
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;
@@ -8779,6 +8773,66 @@ function answerSchema(question) {
8779
8773
  required: Object.keys(properties)
8780
8774
  };
8781
8775
  }
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
8791
+ //#region src/http/common/httpRequest.ts
8792
+ var parameterSchema = strictObject({
8793
+ mode: _enum(["fields", "object"]).default("fields"),
8794
+ names: array(string()).default([])
8795
+ });
8796
+ var httpRequestExecutorSchema = strictObject({
8797
+ method: _enum([
8798
+ "GET",
8799
+ "POST",
8800
+ "PUT",
8801
+ "PATCH",
8802
+ "DELETE",
8803
+ "HEAD",
8804
+ "OPTIONS"
8805
+ ]).default("GET"),
8806
+ query: parameterSchema.default({
8807
+ mode: "fields",
8808
+ names: []
8809
+ }),
8810
+ headers: parameterSchema.default({
8811
+ mode: "fields",
8812
+ names: []
8813
+ }),
8814
+ bodyFormat: _enum([
8815
+ "none",
8816
+ "json",
8817
+ "text",
8818
+ "form"
8819
+ ]).default("none"),
8820
+ authentication: union([
8821
+ strictObject({ type: literal("none") }),
8822
+ strictObject({ type: _enum(["bearer", "basic"]) }),
8823
+ strictObject({
8824
+ type: literal("apiKey"),
8825
+ name: string(),
8826
+ in: _enum(["header", "query"])
8827
+ })
8828
+ ]).default({ type: "none" }),
8829
+ responseFormat: _enum([
8830
+ "auto",
8831
+ "json",
8832
+ "text"
8833
+ ]).default("auto"),
8834
+ statusPolicy: _enum(["success", "all"]).default("success")
8835
+ }).extend({ kind: literal("http-request") });
8782
8836
  function checkJsonDepth(value, depth = 0) {
8783
8837
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
8784
8838
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -8789,6 +8843,7 @@ var retryNodeTypes = [
8789
8843
  "code",
8790
8844
  "connector",
8791
8845
  "openapi",
8846
+ "http-request",
8792
8847
  "llm",
8793
8848
  "decision"
8794
8849
  ];
@@ -8878,7 +8933,7 @@ var webhookResponseTimeout = {
8878
8933
  }).jsonSchema;
8879
8934
  //#endregion
8880
8935
  //#region src/flow/common/changeSchema.ts
8881
- var currentFlowModelVersion = 11;
8936
+ var currentFlowModelVersion = 12;
8882
8937
  var text = string();
8883
8938
  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.");
8884
8939
  var json = json$1();
@@ -8958,7 +9013,14 @@ var workflowCapabilitySchema = strictObject({
8958
9013
  inputs: array(port),
8959
9014
  outputs: array(port).nullable()
8960
9015
  });
8961
- var capability = union([connectorCapabilitySchema, workflowCapabilitySchema]);
9016
+ var capability = union([
9017
+ connectorCapabilitySchema,
9018
+ workflowCapabilitySchema,
9019
+ strictObject({
9020
+ kind: literal("http"),
9021
+ 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.")
9022
+ })
9023
+ ]);
8962
9024
  var inline = object({
8963
9025
  ...ports,
8964
9026
  name: text,
@@ -9068,7 +9130,8 @@ var managedFields = object({
9068
9130
  kind: literal("workflow"),
9069
9131
  flowId: text,
9070
9132
  revisionId: text
9071
- })
9133
+ }),
9134
+ httpRequestExecutorSchema
9072
9135
  ])
9073
9136
  });
9074
9137
  var managed = managedFields.transform(limitDecisionTask);
@@ -9337,7 +9400,8 @@ var revision = object({
9337
9400
  literal(8),
9338
9401
  literal(9),
9339
9402
  literal(10),
9340
- literal(11)
9403
+ literal(11),
9404
+ literal(12)
9341
9405
  ]),
9342
9406
  document,
9343
9407
  modules: record$1(text, module)
@@ -9368,7 +9432,7 @@ function decodeRevisionContent(value) {
9368
9432
  checkJsonDepth(value);
9369
9433
  const content = revision.parse(value);
9370
9434
  checkModelVersion(content);
9371
- assertOpenApiAuthBindings(content.document);
9435
+ assertDocumentHttpAuthBindings(content.document);
9372
9436
  return content;
9373
9437
  }
9374
9438
  var shapes = {
@@ -9562,6 +9626,8 @@ function changeOperationsSchema(kind) {
9562
9626
  return toJSONSchema(schema, { io: "input" });
9563
9627
  }
9564
9628
  function checkModelVersion(content) {
9629
+ 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.");
9630
+ 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.");
9565
9631
  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.");
9566
9632
  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.");
9567
9633
  if (content.modelVersion < 9 && Object.values(content.document.graph.nodes).some((candidateNode) => "retry" in candidateNode && candidateNode.retry != null)) throw new TypeError("Node retries require Flow model version 9.");
@@ -9576,6 +9642,9 @@ function checkModelVersion(content) {
9576
9642
  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.");
9577
9643
  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.");
9578
9644
  }
9645
+ function assertDocumentHttpAuthBindings(content) {
9646
+ 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);
9647
+ }
9579
9648
  //#endregion
9580
9649
  //#region src/flow/common/condition.ts
9581
9650
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -9664,6 +9733,11 @@ function nodeSystemOutputPorts(node) {
9664
9733
  } } : {};
9665
9734
  }
9666
9735
  //#endregion
9736
+ //#region src/flow/common/model.ts
9737
+ function portsByHandle(ports) {
9738
+ return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
9739
+ }
9740
+ //#endregion
9667
9741
  //#region src/flow/common/change.ts
9668
9742
  var resourceNameMaxLength = 80;
9669
9743
  function resourceNameIssue(value) {
@@ -9679,9 +9753,6 @@ function resourceNameIssue(value) {
9679
9753
  function validVariableName(value) {
9680
9754
  return value.length <= 256 && /^[A-Za-z_][A-Za-z0-9_]*$/.test(value) && value.slice(0, 3).toUpperCase() != "OO_";
9681
9755
  }
9682
- function portsByHandle(ports) {
9683
- return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
9684
- }
9685
9756
  var workflowToolNamePattern = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
9686
9757
  function workflowToolNameIssue(name, otherNames = []) {
9687
9758
  if (!workflowToolNamePattern.test(name)) return "invalid";
@@ -9697,6 +9768,8 @@ function decodeTaskCapabilities(value) {
9697
9768
  if (workflowToolNameIssue(item.name, names)) throw new TypeError("Workflow tool names must be unique provider-compatible names.");
9698
9769
  names.add(item.name);
9699
9770
  }
9771
+ const http = parsed.filter((item) => item.kind == "http");
9772
+ 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.");
9700
9773
  let connectorIndex = 0;
9701
9774
  return parsed.map((item) => item.kind == "connector" ? connectors[connectorIndex++] : item);
9702
9775
  }
@@ -9832,10 +9905,10 @@ function upgradeRevisionContent(content) {
9832
9905
  function upgradeDecodedRevisionContent(content) {
9833
9906
  const graph = content.document.graph;
9834
9907
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9835
- if (!hasManual && content.modelVersion == 11) return content;
9908
+ if (!hasManual && content.modelVersion == 12) return content;
9836
9909
  return {
9837
9910
  ...content,
9838
- modelVersion: 11,
9911
+ modelVersion: 12,
9839
9912
  document: {
9840
9913
  ...content.document,
9841
9914
  graph: hasManual ? {
@@ -9882,7 +9955,7 @@ function invalid(message) {
9882
9955
  throw new FlowChangeError(message);
9883
9956
  }
9884
9957
  function applyFlowChanges(content, operations) {
9885
- const source = content.modelVersion != 11 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9958
+ const source = content.modelVersion != 12 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9886
9959
  const document = { ...source.document };
9887
9960
  const modules = { ...source.modules };
9888
9961
  for (const operation of operations) switch (operation.kind) {
@@ -10327,10 +10400,10 @@ function applyFlowChanges(content, operations) {
10327
10400
  break;
10328
10401
  }
10329
10402
  }
10330
- assertOpenApiAuthBindings(document);
10403
+ assertDocumentHttpAuthBindings(document);
10331
10404
  return upgradeDecodedRevisionContent({
10332
10405
  document,
10333
- modelVersion: 11,
10406
+ modelVersion: 12,
10334
10407
  modules
10335
10408
  });
10336
10409
  }