@oomol-lab/open-flow 0.1.0-beta.75 → 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 (125) hide show
  1. package/README.md +2 -1
  2. package/dist/browser/{ContentIcon-FCpKiwjp.js → ContentIcon-Cm1hbVzW.js} +2 -2
  3. package/dist/browser/{FlowCanvas-dzRBnlUT.js → FlowCanvas-NzKtla_c.js} +62 -62
  4. package/dist/browser/{createResourceDialog-BeYDdUl-.js → createResourceDialog-BgdedQqu.js} +3 -3
  5. package/dist/browser/{dialog-ZtpsFbl4.js → dialog-aSElFFw2.js} +49 -24
  6. package/dist/browser/{exportSvg-DqXw1yf-.js → exportSvg-Dcz4HTo_.js} +2 -2
  7. package/dist/browser/{flowChanges-b_5UobFj.js → flowChanges-NZyS7HSp.js} +207 -396
  8. package/dist/browser/{flowWorkspace-ItojZbO4.js → flowWorkspace-Bl0SDehy.js} +90 -13
  9. package/dist/browser/preview.css +515 -649
  10. package/dist/browser/preview.js +454 -545
  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 +515 -649
  17. package/dist/browser/workbench.js +7 -7
  18. package/dist/browser/{workbenchSelect-M441Lz0d.js → workbenchSelect-DBGP7Y4Z.js} +2 -2
  19. package/dist/command/index.js +33 -35
  20. package/dist/common/authoring.d.ts +3 -3
  21. package/dist/common/authoringSchema.d.ts +3 -0
  22. package/dist/common/connector-proxy.d.ts +1 -1
  23. package/dist/common/control-api-conformance.js +197 -136
  24. package/dist/common/control-api.d.ts +3 -2
  25. package/dist/common/control-api.js +192 -131
  26. package/dist/common/control-requests.js +126 -24
  27. package/dist/common/cron-trigger.d.ts +2 -1
  28. package/dist/common/decision.d.ts +4 -4
  29. package/dist/common/decision.js +5 -2
  30. package/dist/common/engine-contract.d.ts +5 -1
  31. package/dist/common/event-source-definition.d.ts +1 -1
  32. package/dist/common/event-source-view.d.ts +22 -0
  33. package/dist/common/event-source.d.ts +1 -1
  34. package/dist/common/event-source.js +24 -65
  35. package/dist/common/event-sources.d.ts +0 -21
  36. package/dist/common/flow-authoring.js +40 -18
  37. package/dist/common/flow-change-schema.d.ts +9 -1
  38. package/dist/common/flow-change.d.ts +7 -201
  39. package/dist/common/flow-change.js +46 -22
  40. package/dist/common/flow-encoding.js +40 -20
  41. package/dist/common/flow-input-value.d.ts +1 -1
  42. package/dist/common/flow-model.d.ts +121 -0
  43. package/dist/common/flow-notifications.d.ts +1 -1
  44. package/dist/common/flow-retry.d.ts +2 -4
  45. package/dist/common/flow-semantics.js +83 -86
  46. package/dist/common/flow-workflowReferences.d.ts +8 -0
  47. package/dist/common/flowInspection.d.ts +1 -1
  48. package/dist/common/http-hosts.d.ts +6 -0
  49. package/dist/common/http-request.d.ts +13 -5
  50. package/dist/common/http-request.js +23 -5
  51. package/dist/common/integration-trigger.d.ts +2 -1
  52. package/dist/common/mcp.js +195 -134
  53. package/dist/common/openapi.d.ts +4 -4
  54. package/dist/common/openapi.js +4 -1
  55. package/dist/common/poll-trigger.d.ts +2 -1
  56. package/dist/common/runtime-contract.d.ts +23 -1
  57. package/dist/common/runtime-contract.js +604 -72
  58. package/dist/common/runtime-nodejs-compat.d.ts +44 -0
  59. package/dist/common/runtime-nodejs-compat.js +5870 -0
  60. package/dist/common/scheduler-checkpoint.d.ts +1 -1
  61. package/dist/common/scheduler-node-execution.d.ts +1 -1
  62. package/dist/common/scheduler.d.ts +1 -1
  63. package/dist/common/scheduler.js +25 -4
  64. package/dist/common/trigger-catalog.d.ts +1 -7
  65. package/dist/common/trigger-config-options.d.ts +1 -1
  66. package/dist/common/trigger-config.d.ts +1 -1
  67. package/dist/common/trigger-contract.d.ts +2 -1
  68. package/dist/common/trigger-localization.d.ts +8 -2
  69. package/dist/common/trigger-model.d.ts +101 -0
  70. package/dist/common/webhook-response.d.ts +1 -1
  71. package/dist/common/webhook-trigger.d.ts +3 -1
  72. package/dist/common/workflow.d.ts +3 -12
  73. package/dist/common/workflow.js +25 -23
  74. package/dist/index.d.ts +41 -14
  75. package/package.json +5 -1
  76. package/src/base/common/json.ts +1 -1
  77. package/src/connector/common/proxy.ts +1 -1
  78. package/src/control/common/api.ts +6 -5
  79. package/src/control/common/authoringSchema.ts +9 -2
  80. package/src/control/common/authoringTools.ts +1 -1
  81. package/src/control/common/conformance.ts +1 -1
  82. package/src/control/common/connectorDecoders.ts +1 -1
  83. package/src/control/common/eventSources.ts +2 -29
  84. package/src/control/common/triggerCatalog.ts +1 -8
  85. package/src/decision/common/decision.ts +15 -7
  86. package/src/event-source/common/definition.ts +1 -1
  87. package/src/event-source/common/index.ts +1 -1
  88. package/src/event-source/common/view.ts +20 -0
  89. package/src/execution/common/checkpoint.ts +1 -1
  90. package/src/execution/common/node-execution.ts +1 -1
  91. package/src/execution/common/scheduler.ts +1 -1
  92. package/src/flow/common/change.ts +58 -192
  93. package/src/flow/common/changeSchema.ts +29 -4
  94. package/src/flow/common/connectionUsage.ts +1 -1
  95. package/src/flow/common/inputValue.ts +1 -1
  96. package/src/flow/common/model.ts +130 -0
  97. package/src/flow/common/modules.ts +1 -1
  98. package/src/flow/common/portChanges.ts +1 -1
  99. package/src/flow/common/retry.ts +2 -4
  100. package/src/flow/common/semantics.ts +11 -4
  101. package/src/flow/common/webhookResponse.ts +1 -1
  102. package/src/flow/common/workflowReferences.ts +31 -0
  103. package/src/http/common/authBindings.ts +6 -9
  104. package/src/http/common/hosts.ts +13 -0
  105. package/src/http/common/httpRequest.ts +30 -15
  106. package/src/openapi/common/openapi.ts +9 -5
  107. package/src/{execution → runtime}/common/engineContract.ts +20 -15
  108. package/src/runtime/common/nodejsCompat.ts +275 -0
  109. package/src/runtime/common/nodejsGuest.generated.json +47 -0
  110. package/src/runtime/common/runtime.ts +1138 -0
  111. package/src/trigger/common/config.ts +1 -1
  112. package/src/trigger/common/configOptions.ts +1 -1
  113. package/src/trigger/common/contract.ts +2 -1
  114. package/src/trigger/common/cron.ts +2 -1
  115. package/src/trigger/common/integration.ts +2 -1
  116. package/src/trigger/common/model.ts +87 -0
  117. package/src/trigger/common/poll.ts +2 -1
  118. package/src/trigger/common/webhook.ts +3 -1
  119. package/src/trigger/providers/fieldDescriptions.ts +1 -1
  120. package/src/trigger/providers/localization.ts +9 -2
  121. package/src/trigger/providers/remote.ts +1 -1
  122. package/src/types/index.ts +44 -15
  123. package/src/workflow/common/workflow.ts +3 -44
  124. package/src/execution/common/runtime.ts +0 -563
  125. /package/src/{control → connector}/common/providerIconSprite.ts +0 -0
@@ -2887,6 +2887,9 @@ function createSchemaComparer() {
2887
2887
  createSchemaComparer();
2888
2888
  //#endregion
2889
2889
  //#region src/decision/common/decision.ts
2890
+ function isDecisionExecutor(executor) {
2891
+ return executor.kind === "decision";
2892
+ }
2890
2893
  var decisionLimits = {
2891
2894
  choice: 255,
2892
2895
  score: 10
@@ -2909,7 +2912,7 @@ function limitDecisionQuestions(questions) {
2909
2912
  }
2910
2913
  /** Loading an oversized task also updates its previously generated output schemas. */
2911
2914
  function limitDecisionTask(task) {
2912
- if (task.executor.kind !== "decision") return task;
2915
+ if (!isDecisionExecutor(task.executor)) return task;
2913
2916
  const original = task.executor.questions;
2914
2917
  const questions = limitDecisionQuestions(original);
2915
2918
  if (questions === original) return task;
@@ -3009,15 +3012,6 @@ function decisionTask(questions = [defaultDecisionQuestion()], name = "AI Decisi
3009
3012
  };
3010
3013
  }
3011
3014
  //#endregion
3012
- //#region src/http/common/authBindings.ts
3013
- /** Never allow credentials to enter a Revision as literal node inputs. */
3014
- function assertHttpAuthBindings(document) {
3015
- for (const node of Object.values(document.graph.nodes)) {
3016
- if (node.kind != "task" || !("executor" in node.task) || !["openapi", "http-request"].includes(node.task.executor.kind)) continue;
3017
- 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.");
3018
- }
3019
- }
3020
- //#endregion
3021
3015
  //#region src/flow/common/inputValue.ts
3022
3016
  /** Converts explicit user values at authoring boundaries, never persisted legacy data. */
3023
3017
  function inputValues(values) {
@@ -8707,6 +8701,20 @@ function datetime(params) {
8707
8701
  return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
8708
8702
  }
8709
8703
  //#endregion
8704
+ //#region src/http/common/authBindings.ts
8705
+ /** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
8706
+ function assertHttpAuthBindings(inputs) {
8707
+ 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.");
8708
+ }
8709
+ //#endregion
8710
+ //#region src/http/common/hosts.ts
8711
+ /** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
8712
+ 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])?$/;
8713
+ /** Wildcards must name a registrable suffix, so `*.com` is rejected. */
8714
+ function isHttpHost(value) {
8715
+ return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
8716
+ }
8717
+ //#endregion
8710
8718
  //#region src/http/common/httpRequest.ts
8711
8719
  var parameterSchema = strictObject({
8712
8720
  mode: _enum(["fields", "object"]).default("fields"),
@@ -8929,7 +8937,14 @@ var workflowCapabilitySchema = strictObject({
8929
8937
  inputs: array(port),
8930
8938
  outputs: array(port).nullable()
8931
8939
  });
8932
- var capability = union([connectorCapabilitySchema, workflowCapabilitySchema]);
8940
+ var capability = union([
8941
+ connectorCapabilitySchema,
8942
+ workflowCapabilitySchema,
8943
+ strictObject({
8944
+ kind: literal("http"),
8945
+ 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.")
8946
+ })
8947
+ ]);
8933
8948
  var inline = object({
8934
8949
  ...ports,
8935
8950
  name: text,
@@ -9309,7 +9324,8 @@ var revision = object({
9309
9324
  literal(8),
9310
9325
  literal(9),
9311
9326
  literal(10),
9312
- literal(11)
9327
+ literal(11),
9328
+ literal(12)
9313
9329
  ]),
9314
9330
  document,
9315
9331
  modules: record$1(text, module)
@@ -9340,7 +9356,7 @@ function decodeRevisionContent(value) {
9340
9356
  checkJsonDepth(value);
9341
9357
  const content = revision.parse(value);
9342
9358
  checkModelVersion(content);
9343
- assertHttpAuthBindings(content.document);
9359
+ assertDocumentHttpAuthBindings(content.document);
9344
9360
  return content;
9345
9361
  }
9346
9362
  var shapes = {
@@ -9510,6 +9526,7 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
9510
9526
  ...shape
9511
9527
  })])).values()])).min(1);
9512
9528
  function checkModelVersion(content) {
9529
+ 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.");
9513
9530
  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.");
9514
9531
  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.");
9515
9532
  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.");
@@ -9525,6 +9542,9 @@ function checkModelVersion(content) {
9525
9542
  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.");
9526
9543
  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.");
9527
9544
  }
9545
+ function assertDocumentHttpAuthBindings(content) {
9546
+ 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);
9547
+ }
9528
9548
  //#endregion
9529
9549
  //#region src/flow/common/condition.ts
9530
9550
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -9603,6 +9623,8 @@ function decodeTaskCapabilities(value) {
9603
9623
  if (workflowToolNameIssue(item.name, names)) throw new TypeError("Workflow tool names must be unique provider-compatible names.");
9604
9624
  names.add(item.name);
9605
9625
  }
9626
+ const http = parsed.filter((item) => item.kind == "http");
9627
+ 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.");
9606
9628
  let connectorIndex = 0;
9607
9629
  return parsed.map((item) => item.kind == "connector" ? connectors[connectorIndex++] : item);
9608
9630
  }
@@ -9733,10 +9755,10 @@ function isTriggerNode(node) {
9733
9755
  function upgradeDecodedRevisionContent(content) {
9734
9756
  const graph = content.document.graph;
9735
9757
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9736
- if (!hasManual && content.modelVersion == 11) return content;
9758
+ if (!hasManual && content.modelVersion == 12) return content;
9737
9759
  return {
9738
9760
  ...content,
9739
- modelVersion: 11,
9761
+ modelVersion: 12,
9740
9762
  document: {
9741
9763
  ...content.document,
9742
9764
  graph: hasManual ? {
@@ -9771,7 +9793,7 @@ function invalid(message) {
9771
9793
  throw new FlowChangeError(message);
9772
9794
  }
9773
9795
  function applyFlowChanges(content, operations) {
9774
- const source = content.modelVersion != 11 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9796
+ const source = content.modelVersion != 12 || Object.values(content.document.graph.nodes).some((node) => node.kind == "manual") ? decodeRevisionContent(content) : content;
9775
9797
  const document = { ...source.document };
9776
9798
  const modules = { ...source.modules };
9777
9799
  for (const operation of operations) switch (operation.kind) {
@@ -10216,10 +10238,10 @@ function applyFlowChanges(content, operations) {
10216
10238
  break;
10217
10239
  }
10218
10240
  }
10219
- assertHttpAuthBindings(document);
10241
+ assertDocumentHttpAuthBindings(document);
10220
10242
  return upgradeDecodedRevisionContent({
10221
10243
  document,
10222
- modelVersion: 11,
10244
+ modelVersion: 12,
10223
10245
  modules
10224
10246
  });
10225
10247
  }
@@ -1,6 +1,6 @@
1
1
  import type { ChangeOperation, FlowDocument, JsonValue, RevisionContent } from './flow-change.js';
2
2
  import { z } from 'zod';
3
- export declare const currentFlowModelVersion = 11;
3
+ export declare const currentFlowModelVersion = 12;
4
4
  export declare const connectorCapabilitySchema: z.ZodUnion<readonly [z.ZodObject<{
5
5
  kind: z.ZodLiteral<"connector">;
6
6
  action: z.ZodString;
@@ -46,6 +46,10 @@ export declare const workflowCapabilitySchema: z.ZodObject<{
46
46
  handle: z.ZodString;
47
47
  }, z.core.$strip>>>;
48
48
  }, z.core.$strict>;
49
+ export declare const httpCapabilitySchema: z.ZodObject<{
50
+ kind: z.ZodLiteral<"http">;
51
+ hosts: z.ZodArray<z.ZodString>;
52
+ }, z.core.$strict>;
49
53
  export declare const agentToolFields: {
50
54
  id: z.ZodString;
51
55
  name: z.ZodString;
@@ -345,6 +349,9 @@ export declare const authoringDefinitionSchemas: {
345
349
  nullable: z.ZodBoolean;
346
350
  handle: z.ZodString;
347
351
  }, z.core.$strip>>>;
352
+ }, z.core.$strict>, z.ZodObject<{
353
+ kind: z.ZodLiteral<"http">;
354
+ hosts: z.ZodArray<z.ZodString>;
348
355
  }, z.core.$strict>]>>;
349
356
  connector: z.ZodObject<{
350
357
  action: z.ZodString;
@@ -474,3 +481,4 @@ export declare function parseOperation<Value>(candidate: unknown, index: number,
474
481
  export declare function decodeChangeOperation(candidate: unknown, index: number): ChangeOperation;
475
482
  export declare function decodeChangeOperations(value: unknown): readonly ChangeOperation[];
476
483
  export declare function changeOperationsSchema(kind?: string): JsonValue;
484
+ export declare function assertDocumentHttpAuthBindings(content: FlowDocument): void;
@@ -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 | 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/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"),
@@ -8925,7 +8933,7 @@ var webhookResponseTimeout = {
8925
8933
  }).jsonSchema;
8926
8934
  //#endregion
8927
8935
  //#region src/flow/common/changeSchema.ts
8928
- var currentFlowModelVersion = 11;
8936
+ var currentFlowModelVersion = 12;
8929
8937
  var text = string();
8930
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.");
8931
8939
  var json = json$1();
@@ -9005,7 +9013,14 @@ var workflowCapabilitySchema = strictObject({
9005
9013
  inputs: array(port),
9006
9014
  outputs: array(port).nullable()
9007
9015
  });
9008
- 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
+ ]);
9009
9024
  var inline = object({
9010
9025
  ...ports,
9011
9026
  name: text,
@@ -9385,7 +9400,8 @@ var revision = object({
9385
9400
  literal(8),
9386
9401
  literal(9),
9387
9402
  literal(10),
9388
- literal(11)
9403
+ literal(11),
9404
+ literal(12)
9389
9405
  ]),
9390
9406
  document,
9391
9407
  modules: record$1(text, module)
@@ -9416,7 +9432,7 @@ function decodeRevisionContent(value) {
9416
9432
  checkJsonDepth(value);
9417
9433
  const content = revision.parse(value);
9418
9434
  checkModelVersion(content);
9419
- assertHttpAuthBindings(content.document);
9435
+ assertDocumentHttpAuthBindings(content.document);
9420
9436
  return content;
9421
9437
  }
9422
9438
  var shapes = {
@@ -9610,6 +9626,7 @@ function changeOperationsSchema(kind) {
9610
9626
  return toJSONSchema(schema, { io: "input" });
9611
9627
  }
9612
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.");
9613
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.");
9614
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.");
9615
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.");
@@ -9625,6 +9642,9 @@ function checkModelVersion(content) {
9625
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.");
9626
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.");
9627
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
+ }
9628
9648
  //#endregion
9629
9649
  //#region src/flow/common/condition.ts
9630
9650
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -9713,6 +9733,11 @@ function nodeSystemOutputPorts(node) {
9713
9733
  } } : {};
9714
9734
  }
9715
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
9716
9741
  //#region src/flow/common/change.ts
9717
9742
  var resourceNameMaxLength = 80;
9718
9743
  function resourceNameIssue(value) {
@@ -9728,9 +9753,6 @@ function resourceNameIssue(value) {
9728
9753
  function validVariableName(value) {
9729
9754
  return value.length <= 256 && /^[A-Za-z_][A-Za-z0-9_]*$/.test(value) && value.slice(0, 3).toUpperCase() != "OO_";
9730
9755
  }
9731
- function portsByHandle(ports) {
9732
- return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
9733
- }
9734
9756
  var workflowToolNamePattern = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
9735
9757
  function workflowToolNameIssue(name, otherNames = []) {
9736
9758
  if (!workflowToolNamePattern.test(name)) return "invalid";
@@ -9746,6 +9768,8 @@ function decodeTaskCapabilities(value) {
9746
9768
  if (workflowToolNameIssue(item.name, names)) throw new TypeError("Workflow tool names must be unique provider-compatible names.");
9747
9769
  names.add(item.name);
9748
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.");
9749
9773
  let connectorIndex = 0;
9750
9774
  return parsed.map((item) => item.kind == "connector" ? connectors[connectorIndex++] : item);
9751
9775
  }
@@ -9881,10 +9905,10 @@ function upgradeRevisionContent(content) {
9881
9905
  function upgradeDecodedRevisionContent(content) {
9882
9906
  const graph = content.document.graph;
9883
9907
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9884
- if (!hasManual && content.modelVersion == 11) return content;
9908
+ if (!hasManual && content.modelVersion == 12) return content;
9885
9909
  return {
9886
9910
  ...content,
9887
- modelVersion: 11,
9911
+ modelVersion: 12,
9888
9912
  document: {
9889
9913
  ...content.document,
9890
9914
  graph: hasManual ? {
@@ -9931,7 +9955,7 @@ function invalid(message) {
9931
9955
  throw new FlowChangeError(message);
9932
9956
  }
9933
9957
  function applyFlowChanges(content, operations) {
9934
- 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;
9935
9959
  const document = { ...source.document };
9936
9960
  const modules = { ...source.modules };
9937
9961
  for (const operation of operations) switch (operation.kind) {
@@ -10376,10 +10400,10 @@ function applyFlowChanges(content, operations) {
10376
10400
  break;
10377
10401
  }
10378
10402
  }
10379
- assertHttpAuthBindings(document);
10403
+ assertDocumentHttpAuthBindings(document);
10380
10404
  return upgradeDecodedRevisionContent({
10381
10405
  document,
10382
- modelVersion: 11,
10406
+ modelVersion: 12,
10383
10407
  modules
10384
10408
  });
10385
10409
  }