@oomol-lab/open-flow 0.1.0-beta.90 → 0.1.0-beta.91

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 (37) hide show
  1. package/dist/browser/{FlowCanvas-C4iuvVKB.js → FlowCanvas-CZEphIhX.js} +169 -2324
  2. package/dist/browser/{createResourceDialog-BstGO0m4.js → createResourceDialog-CJbZa2gA.js} +2 -2
  3. package/dist/browser/{dialog-Bi-MVTGj.js → dialog-E1WkapJU.js} +10 -2
  4. package/dist/browser/{exportPng-DMsB9ku_.js → exportPng-c4or5th8.js} +2 -2
  5. package/dist/browser/{flowChanges-SKYJBr6X.js → flowChanges-DsLZdENA.js} +20 -37
  6. package/dist/browser/{flowWorkspace-4UHRaHcz.js → flowWorkspace-CxLQWUdj.js} +54 -19
  7. package/dist/browser/{markdownContent-B75ojl0E.js → markdownContent-BsdTdwBU.js} +1 -1
  8. package/dist/browser/preview.js +231 -68
  9. package/dist/browser/workbench.js +6 -6
  10. package/dist/browser/{workbenchSelect-CHOeceKA.js → workbenchSelect-BfQfMWuY.js} +1 -1
  11. package/dist/browser/{wrapLayout-DU5HG1qH.js → wrapLayout-ZOG4AikN.js} +2493 -200
  12. package/dist/command/index.js +58 -55
  13. package/dist/common/control-api-conformance.js +896 -8
  14. package/dist/common/control-api.js +896 -8
  15. package/dist/common/control-requests.js +17 -6
  16. package/dist/common/decision.js +10 -2
  17. package/dist/common/flow-authoring.js +896 -8
  18. package/dist/common/flow-change.js +896 -8
  19. package/dist/common/flow-encoding.js +896 -8
  20. package/dist/common/flow-semantics.js +10 -2
  21. package/dist/common/integration-trigger.js +10 -2
  22. package/dist/common/licenses.md +2 -0
  23. package/dist/common/mcp.js +896 -8
  24. package/dist/common/openapi.js +10 -2
  25. package/dist/common/poll-trigger.js +10 -2
  26. package/dist/common/provider-triggers.js +1 -1
  27. package/dist/common/scheduler.js +10 -2
  28. package/dist/common/webhook-trigger.js +890 -2
  29. package/dist/common/workflow.js +14 -3
  30. package/dist/render/browser/runtime.js +966 -59
  31. package/dist/render/node/index.js +792 -4
  32. package/package.json +1 -1
  33. package/src/control/common/authoringTools.ts +4 -2
  34. package/src/flow/common/schemaComparer.ts +12 -2
  35. package/src/json-schema-subset/checker/equals.ts +3 -0
  36. package/src/trigger/providers/catalog.generated.json +9 -1
  37. package/src/workflow/common/workflow.ts +4 -3
@@ -1,7 +1,7 @@
1
1
  import { l as useTranslate } from "./dist-BFmpkX4P.js";
2
2
  import { xr as Button } from "./tooltip-BZ6tpqnr.js";
3
- import { a as DialogFooter, d as Field, f as FieldDescription, h as FieldLabel, hn as Input, l as Icon, m as FieldGroup, n as DialogClose, o as DialogHeader, p as FieldError, r as DialogContent, s as DialogTitle, t as Dialog, u as Spinner } from "./dialog-Bi-MVTGj.js";
4
- import { t as WorkbenchSelect } from "./workbenchSelect-CHOeceKA.js";
3
+ import { a as DialogFooter, d as Field, f as FieldDescription, h as FieldLabel, hn as Input, l as Icon, m as FieldGroup, n as DialogClose, o as DialogHeader, p as FieldError, r as DialogContent, s as DialogTitle, t as Dialog, u as Spinner } from "./dialog-E1WkapJU.js";
4
+ import { t as WorkbenchSelect } from "./workbenchSelect-BfQfMWuY.js";
5
5
  import { useEffect, useRef, useState } from "react";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
@@ -5193,6 +5193,7 @@ function schemaEqualsChecker(extendsContext) {
5193
5193
  if (value1 === null || value2 === null) return false;
5194
5194
  if (typeof value1 !== "object") return false;
5195
5195
  if (typeof value1 !== typeof value2) return false;
5196
+ if (extendsContext.isExtendsSchema(value1) || extendsContext.isExtendsSchema(value2)) return extendsContext.equals(value1, value2);
5196
5197
  if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
5197
5198
  return isObjectLikeEquals(value1, value2);
5198
5199
  }
@@ -5915,10 +5916,17 @@ var SingleSelectSchema = class SingleSelectSchema extends SpecialSchema {
5915
5916
  }
5916
5917
  constructor(id, value, context) {
5917
5918
  if (!SingleSelectSchema.isMatch(value)) throw new TypeError("Invalid single-select schema.");
5918
- super(id, value, context);
5919
+ const validator = new Validator(structuredClone(value), "7");
5920
+ super(id, { enum: value.enum.filter((item) => validator.validate(item).valid) }, context);
5919
5921
  }
5920
5922
  compareImpl(other) {
5921
- if (isStringLikeSchema(other)) return [ExpressionSingleResult.ContainedBy];
5923
+ if (this.value.enum.length == 0) return [(other instanceof SingleSelectSchema ? other.value.enum.length == 0 : isCompiledSchema(other) && getKind(other) === CompiledKind.Never) ? ExpressionSingleResult.Equals : ExpressionSingleResult.ContainedBy];
5924
+ if (isStringLikeSchema(other)) {
5925
+ const validator = new Validator(structuredClone(other), "7");
5926
+ const accepted = this.value.enum.filter((item) => validator.validate(item).valid).length;
5927
+ if (accepted == this.value.enum.length) return [ExpressionSingleResult.ContainedBy];
5928
+ return [accepted == 0 ? ExpressionSingleResult.Rejection : ExpressionSingleResult.Intersection];
5929
+ }
5922
5930
  if (other instanceof SingleSelectSchema) {
5923
5931
  const f = new Set(this.value.enum);
5924
5932
  let result = ExpressionSingleResult.Equals;
@@ -1,5 +1,5 @@
1
- import { C as IconifyProvider, pt as ProviderIconCacheContext, y as IconImageCrossOriginContext } from "./wrapLayout-DU5HG1qH.js";
2
- import { E as getFlowPngAspectRatio, t as FlowCanvas, y as CanvasStore } from "./FlowCanvas-C4iuvVKB.js";
1
+ import { T as IconifyProvider, ht as ProviderIconCacheContext, x as IconImageCrossOriginContext } from "./wrapLayout-ZOG4AikN.js";
2
+ import { E as getFlowPngAspectRatio, t as FlowCanvas, y as CanvasStore } from "./FlowCanvas-CZEphIhX.js";
3
3
  import { createElement } from "react";
4
4
  import "react/jsx-runtime";
5
5
  import { createRoot } from "react-dom/client";
@@ -1,9 +1,9 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
2
- import { A as DropdownMenuItem, E as DropdownMenu, O as DropdownMenuContent, P as DropdownMenuSeparator, Q as uiLocales, R as DropdownMenuTrigger, S as spriteIcon, T as useIconifyData, V as useCompositeItem, _ as Z, a as CompositeRoot, at as ja_default$3, b as imageIcon, c as PopoverContent, ct as I18n, et as waitBranchLocales, f as PopoverTitle, h as ScrollArea, i as Textarea, it as ko_default$3, lt as providerIconAppearance, n as wrapLayout, nt as zh_CN_default$3, o as ACTIVE_COMPOSITE_ITEM, ot as fr_default$3, p as PopoverTrigger, r as canvasDirection, rt as ru_default$3, s as Popover, st as en_default$3, tt as zh_TW_default$3, ut as Checkbox, v as ContentIcon, w as useIconifyCollectionLoader, x as placeholderIcon } from "./wrapLayout-DU5HG1qH.js";
2
+ import { A as DropdownMenuContent, B as DropdownMenuTrigger, C as placeholderIcon, D as useIconifyData, E as useIconifyCollectionLoader, I as DropdownMenuSeparator, M as DropdownMenuItem, O as DropdownMenu, S as imageIcon, U as useCompositeItem, _ as ScrollArea, a as canvasDirection, at as ru_default$3, b as ContentIcon, c as ACTIVE_COMPOSITE_ITEM, ct as fr_default$3, dt as providerIconAppearance, et as uiLocales, ft as Checkbox, h as PopoverTrigger, it as zh_CN_default$3, l as Popover, lt as en_default$3, m as PopoverTitle, n as wrapLayout, nt as waitBranchLocales, o as Textarea, ot as ko_default$3, r as graphLayout, rt as zh_TW_default$3, s as CompositeRoot, st as ja_default$3, u as PopoverContent, ut as I18n, w as spriteIcon, y as Z } from "./wrapLayout-ZOG4AikN.js";
3
3
  import { a as derive, i as compute, l as val, t as arrayShallowEqual } from "./dist-bO8nvHFH.js";
4
4
  import { a as toPlainObject, l as useTranslate, o as I18nProvider, s as useI18n, u as useVal } from "./dist-BFmpkX4P.js";
5
5
  import { $n as inputClear, A as string$1, Bn as transitionStatusMapping, Br as useStableCallback, C as literal, Cr as cn, Dn as getTarget, Dr as EMPTY_ARRAY, E as object$2, En as contains, Er as useRenderElement, Et as useFloatingRootContext, F as IndexGuessBehavior, Fr as formatErrorMessage, Ft as useDismiss, Gn as createGenericEventDetails, I as useCompositeListItem, In as useTransitionStatus, Ir as mergeProps, It as useClick, Jn as closePress, Kt as DROPDOWN_COLLISION_AVOIDANCE, Ln as useOpenChangeComplete, Lr as useIsoLayoutEffect, Lt as FloatingFocusManager, M as unknown, Mn as ownerDocument, Mr as useButton, Nn as useLabelableId, O as record$3, On as isAndroid, Or as EMPTY_OBJECT, Qn as inputChange, Qt as useStore, S as lazy$1, Sn as stopEvent, Sr as buttonVariants, T as number, Tn as activeElement, Tr as clsx, Un as useValueChanged, Vr as useRefWithInit, Wn as createChangeEventDetails, Wr as isElement, Wt as FloatingPortal, Yn as escapeKey, Zt as Store, _ as array, _r as fieldValidityMapping, an as useOnFirstRender, at as useAnchorPositioning, b as int, br as useControlled, bt as useListNavigation, ct as CompositeList, dr as useFormContext, er as inputPress, et as useAnchoredPopupScrollLock, fr as useRegisterFieldControl, ft as popupStateMapping, g as _enum, gr as DEFAULT_FIELD_STATE_ATTRIBUTES, ht as useOpenInteractionType, i as TooltipTrigger, in as useValueAsRef, it as InternalBackdrop, j as union, jr as useMergedRefs, k as strictObject, kn as isFirefox, kr as NOOP, lt as inertValue, mr as useBaseUiId, n as TooltipContent, nr as listNavigation, nt as usePositioner, p as timeZoneOffsetMinutes, pr as useFieldRootContext, pt as pressableTriggerOpenStateMapping, rn as createSelector, rr as none, rt as getDisabledMountTransitionStyles, sn as useTimeout, st as useDirection, t as Tooltip, tr as itemPress, ur as useLabelableContext, ut as getPseudoElementBounds, v as boolean, vr as visuallyHidden, vt as useTypeahead, wn as isInteractiveElement, wr as cva, x as json$3, xr as Button, xt as useInteractions, y as discriminatedUnion, yr as visuallyHiddenInput, zn as TransitionStatusDataAttributes } from "./tooltip-BZ6tpqnr.js";
6
- import { $t as SelectGroup, At as requestInputMappings, B as authoringDefinitionSchemas, Bt as schemaObject, Ct as connectorProxyInputs, D as nodeSystemOutputPorts, Dt as connectorProxyTask, G as workflowAgentToolSchema, Gt as flowStateValuesSchema, H as connectorCapabilitySchema, Ht as isSchemaKeyword, I as otherwiseOutput, It as webhookSupportsBody, J as webhookResponseAllowsBody, Jt as skipDuplicatesTask, K as webhookHeaderValuePort, Kt as flowStateViewSchema, Lt as comparePorts, Mt as renameOutputMapping, N as nodeInputMappings, Nt as renamedPort, Ot as withConnectorProxyParameterFields, Pt as httpHeaderNameIssue, Q as workflowOutputsPort, Qt as SelectContent, Rt as matchesSchema, S as resourceNameIssue, U as decodeRevisionContent, Ut as format, V as connectorAgentToolSchema, W as httpCapabilitySchema, Wt as flowStateSummarySchema, Xt as Select, Y as webhookResponseInputs, Yt as dequal$1, Z as webhookStatusCodePort, _ as applyFlowChanges$1, a as DialogFooter, an as hasNullItemLabel, bt as connectorProxyConfigSchema, cn as stringifyAsValue, d as Field, dn as findItemIndex, dt as withHttpParameterSource, en as SelectItem, fn as removeItem, gt as decisionTask, h as FieldLabel, hn as Input, i as DialogDescription, in as resolveAriaLabelledBy, it as checkJsonDepth, j as conditionInputPorts, jt as remapInputMappings, k as clearConditionBindings, kt as withConnectorProxyParameterSource, ln as compareItemEquality, lt as httpRequestTask, mn as Label, n as DialogClose, nn as SelectTrigger, nt as retryConfigurationSchema, o as DialogHeader, on as isGroupedItems, p as FieldError, pn as selectedValueIncludes, q as webhookHeadersPort, qt as skipDuplicatesConfigSchema, r as DialogContent, rn as SelectValue, s as DialogTitle, sn as stringifyAsLabel, st as httpRequestConfigSchema, t as Dialog, un as defaultItemEquality, ut as withHttpParameterFields, v as isTriggerNode, x as normalizeNodeName, xt as connectorProxyHasBody, y as nextNodeName, z as agentToolFields, zt as portsAssignable } from "./dialog-Bi-MVTGj.js";
6
+ import { $t as SelectGroup, At as requestInputMappings, B as authoringDefinitionSchemas, Bt as schemaObject, Ct as connectorProxyInputs, D as nodeSystemOutputPorts, Dt as connectorProxyTask, G as workflowAgentToolSchema, Gt as flowStateValuesSchema, H as connectorCapabilitySchema, Ht as isSchemaKeyword, I as otherwiseOutput, It as webhookSupportsBody, J as webhookResponseAllowsBody, Jt as skipDuplicatesTask, K as webhookHeaderValuePort, Kt as flowStateViewSchema, Lt as comparePorts, Mt as renameOutputMapping, N as nodeInputMappings, Nt as renamedPort, Ot as withConnectorProxyParameterFields, Pt as httpHeaderNameIssue, Q as workflowOutputsPort, Qt as SelectContent, Rt as matchesSchema, S as resourceNameIssue, U as decodeRevisionContent, Ut as format, V as connectorAgentToolSchema, W as httpCapabilitySchema, Wt as flowStateSummarySchema, Xt as Select, Y as webhookResponseInputs, Yt as dequal$1, Z as webhookStatusCodePort, _ as applyFlowChanges$1, a as DialogFooter, an as hasNullItemLabel, bt as connectorProxyConfigSchema, cn as stringifyAsValue, d as Field, dn as findItemIndex, dt as withHttpParameterSource, en as SelectItem, fn as removeItem, gt as decisionTask, h as FieldLabel, hn as Input, i as DialogDescription, in as resolveAriaLabelledBy, it as checkJsonDepth, j as conditionInputPorts, jt as remapInputMappings, k as clearConditionBindings, kt as withConnectorProxyParameterSource, ln as compareItemEquality, lt as httpRequestTask, mn as Label, n as DialogClose, nn as SelectTrigger, nt as retryConfigurationSchema, o as DialogHeader, on as isGroupedItems, p as FieldError, pn as selectedValueIncludes, q as webhookHeadersPort, qt as skipDuplicatesConfigSchema, r as DialogContent, rn as SelectValue, s as DialogTitle, sn as stringifyAsLabel, st as httpRequestConfigSchema, t as Dialog, un as defaultItemEquality, ut as withHttpParameterFields, v as isTriggerNode, x as normalizeNodeName, xt as connectorProxyHasBody, y as nextNodeName, z as agentToolFields, zt as portsAssignable } from "./dialog-E1WkapJU.js";
7
7
  import { a as uiLanguages, n as isUiLanguage, r as resolveUiLanguage } from "./languages-gYzoQqCi.js";
8
8
  import "./lib-Dws05GHj.js";
9
9
  import { i as objectValue, s as valueType, t as initialValue } from "./value-BbFQZZ_V.js";
@@ -462,7 +462,10 @@ function workflowAgentTool(id, name, target, previous) {
462
462
  id,
463
463
  description: previous?.description ?? target.name,
464
464
  approval: previous?.approval ?? false,
465
- inputs: capability.inputs.map((port) => Object.assign({}, port, { source: previous?.inputs.find((old) => old.handle == port.handle)?.source ?? { kind: "model" } }))
465
+ inputs: capability.inputs.map((input) => {
466
+ const { value: _value, ...port } = input;
467
+ return Object.assign({}, port, { source: previous?.inputs.find((old) => old.handle == port.handle)?.source ?? { kind: "model" } });
468
+ })
466
469
  };
467
470
  }
468
471
  //#endregion
@@ -25123,9 +25126,8 @@ function projectEdges(graph, nodeIds) {
25123
25126
  edges
25124
25127
  };
25125
25128
  }
25126
- function layoutNodes(nodeIds, dependencies, dependents) {
25129
+ function orderNodes(nodeIds, dependencies, dependents) {
25127
25130
  const indegree = new Map([...dependencies].map(([nodeId, sources]) => [nodeId, sources.size]));
25128
- const depth = /* @__PURE__ */ new Map();
25129
25131
  const ordered = [];
25130
25132
  const orderedIds = /* @__PURE__ */ new Set();
25131
25133
  const ready = [...indegree].filter(([, count]) => count == 0).map(([nodeId]) => nodeId).toSorted();
@@ -25133,23 +25135,14 @@ function layoutNodes(nodeIds, dependencies, dependents) {
25133
25135
  const nodeId = ready[cursor];
25134
25136
  ordered.push(nodeId);
25135
25137
  orderedIds.add(nodeId);
25136
- const nextDepth = (depth.get(nodeId) ?? 0) + 1;
25137
25138
  for (const targetId of [...dependents.get(nodeId)].toSorted()) {
25138
- depth.set(targetId, Math.max(depth.get(targetId) ?? 0, nextDepth));
25139
25139
  const count = indegree.get(targetId) - 1;
25140
25140
  indegree.set(targetId, count);
25141
25141
  if (count == 0) ready.push(targetId);
25142
25142
  }
25143
25143
  }
25144
- const cycleDepth = Math.max(0, ...depth.values()) + 1;
25145
- for (const nodeId of [...nodeIds].filter((candidate) => !orderedIds.has(candidate)).toSorted()) {
25146
- depth.set(nodeId, cycleDepth);
25147
- ordered.push(nodeId);
25148
- }
25149
- return {
25150
- depth,
25151
- ordered
25152
- };
25144
+ for (const nodeId of [...nodeIds].filter((candidate) => !orderedIds.has(candidate)).toSorted()) ordered.push(nodeId);
25145
+ return ordered;
25153
25146
  }
25154
25147
  function designerInputs(nodeId, node, ports, revision) {
25155
25148
  if (isTriggerNode(node)) return [];
@@ -25346,6 +25339,7 @@ function designerGraph(draft, presentation = {}, diagnostics = [], connectorActi
25346
25339
  const graph = revision == null ? void 0 : revision.graph();
25347
25340
  if (revision == null || graph == null) return {
25348
25341
  edges: [],
25342
+ needsLayout: false,
25349
25343
  nodes: [],
25350
25344
  viewport: {
25351
25345
  x: 0,
@@ -25359,7 +25353,7 @@ function designerGraph(draft, presentation = {}, diagnostics = [], connectorActi
25359
25353
  const nodeIds = new Set(entries.map(([nodeId]) => nodeId));
25360
25354
  const ports = new Map([...definitions].map(([nodeId, node]) => [nodeId, nodePorts(node, revision)]));
25361
25355
  const edgeProjection = projectEdges(graph, nodeIds);
25362
- const layout = layoutNodes(nodeIds, edgeProjection.dependencies, edgeProjection.dependents);
25356
+ const ordered = orderNodes(nodeIds, edgeProjection.dependencies, edgeProjection.dependents);
25363
25357
  const direction = savedDirection(presentation);
25364
25358
  const positions = savedPositions(presentation);
25365
25359
  const hiddenNodeContent = savedHiddenNodeContent(presentation);
@@ -25374,33 +25368,21 @@ function designerGraph(draft, presentation = {}, diagnostics = [], connectorActi
25374
25368
  runNodes: projectedRun.nodes,
25375
25369
  t
25376
25370
  };
25377
- const rows = /* @__PURE__ */ new Map();
25378
- const defaultNodes = layout.ordered.map((nodeId) => {
25379
- const column = layout.depth.get(nodeId) ?? 0;
25380
- const row = rows.get(column) ?? 0;
25381
- rows.set(column, row + 1);
25382
- return direction === "vertical" ? {
25383
- id: nodeId,
25384
- column,
25385
- x: 80 + row * 400,
25386
- y: 80 + column * 240,
25387
- width: 320,
25388
- height: 160
25389
- } : {
25371
+ const defaultNodes = ordered.every((nodeId) => positions[nodeId] != null) ? [] : graphLayout(ordered.map((nodeId) => {
25372
+ const { kind } = definitions.get(nodeId);
25373
+ return {
25390
25374
  id: nodeId,
25391
- column,
25392
- x: 80 + column * 500,
25393
- y: 80 + row * 240,
25394
- width: 420,
25395
- height: 240
25375
+ width: direction === "vertical" ? 320 : 420,
25376
+ height: direction === "vertical" ? 160 : 240,
25377
+ branchHandles: kind === "condition" || kind === "approval" || kind === "wait" ? [...ports.get(nodeId).outputs.keys()].map((handle) => "$branch:" + handle) : void 0
25396
25378
  };
25397
- });
25379
+ }), edgeProjection.edges, direction).nodes;
25398
25380
  const automaticPositions = direction === "horizontal" ? wrapLayout(defaultNodes) : Object.fromEntries(defaultNodes.map(({ id, x, y }) => [id, {
25399
25381
  x,
25400
25382
  y
25401
25383
  }]));
25402
25384
  const nodes = [];
25403
- for (const nodeId of layout.ordered) {
25385
+ for (const nodeId of ordered) {
25404
25386
  const position = positions[nodeId] ?? automaticPositions[nodeId];
25405
25387
  const resolved = definitions.get(nodeId);
25406
25388
  if (resolved.kind == "trigger") {
@@ -25428,6 +25410,7 @@ function designerGraph(draft, presentation = {}, diagnostics = [], connectorActi
25428
25410
  return {
25429
25411
  direction,
25430
25412
  edges: edgeProjection.edges,
25413
+ needsLayout: nodes.length > 0 && nodes.every((node) => positions[node.id] == null),
25431
25414
  nodes,
25432
25415
  ...projectedRun.status == null ? {} : { runStatus: projectedRun.status },
25433
25416
  viewport: savedViewport(presentation)
@@ -1,15 +1,15 @@
1
1
  import { o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
2
- import { $ as waitBranchDescription, A as DropdownMenuItem, B as CompositeItem, C as IconifyProvider, D as DropdownMenuCheckboxItem, E as DropdownMenu, F as DropdownMenuSub, I as DropdownMenuSubContent, L as DropdownMenuSubTrigger, M as DropdownMenuRadioGroup, N as DropdownMenuRadioItem, O as DropdownMenuContent, P as DropdownMenuSeparator, R as DropdownMenuTrigger, _ as Z$1, a as CompositeRoot, c as PopoverContent, d as PopoverPanelContent, dt as useAriaLabelledBy, f as PopoverTitle, g as VirtualScrollArea, h as ScrollArea, i as Textarea, j as DropdownMenuLabel, k as DropdownMenuGroup, l as PopoverDescription, m as NativeScrollArea, mt as useProviderIconCache, p as PopoverTrigger, s as Popover, u as PopoverHeader, ut as Checkbox, v as ContentIcon } from "./wrapLayout-DU5HG1qH.js";
2
+ import { A as DropdownMenuContent, B as DropdownMenuTrigger, F as DropdownMenuRadioItem, H as CompositeItem, I as DropdownMenuSeparator, L as DropdownMenuSub, M as DropdownMenuItem, N as DropdownMenuLabel, O as DropdownMenu, P as DropdownMenuRadioGroup, R as DropdownMenuSubContent, T as IconifyProvider, _ as ScrollArea, a as canvasDirection, b as ContentIcon, d as PopoverDescription, f as PopoverHeader, ft as Checkbox, g as NativeScrollArea, gt as useProviderIconCache, h as PopoverTrigger, j as DropdownMenuGroup, k as DropdownMenuCheckboxItem, l as Popover, m as PopoverTitle, o as Textarea, p as PopoverPanelContent, pt as useAriaLabelledBy, s as CompositeRoot, tt as waitBranchDescription, u as PopoverContent, v as VirtualScrollArea, y as Z$1, z as DropdownMenuSubTrigger } from "./wrapLayout-ZOG4AikN.js";
3
3
  import { i as compute, l as val } from "./dist-bO8nvHFH.js";
4
4
  import { c as useLang, l as useTranslate, o as I18nProvider, r as isPlainObject, s as useI18n, u as useVal } from "./dist-BFmpkX4P.js";
5
5
  import { $ as useToolbarRootContext, A as string, Bn as transitionStatusMapping, Br as useStableCallback, Cr as cn, Er as useRenderElement, Fr as formatErrorMessage, In as useTransitionStatus, Ir as mergeProps, Ln as useOpenChangeComplete, Lr as useIsoLayoutEffect, Mr as useButton, Nn as useLabelableId, Or as EMPTY_OBJECT, Qt as useStore, Sr as buttonVariants, Un as useValueChanged, Wn as createChangeEventDetails, _r as fieldValidityMapping, a as createTooltipHandle, br as useControlled, c as TooltipPositioner, d as TooltipRoot, dr as useFormContext, fr as useRegisterFieldControl, i as TooltipTrigger, jr as useMergedRefs, l as TooltipPortal, mr as useBaseUiId, mt as triggerOpenStateMapping, n as TooltipContent, nn as require_builtin_esm_external_require_react, o as TooltipArrow, p as timeZoneOffsetMinutes, pr as useFieldRootContext, qn as clearPress, r as TooltipProvider, rr as none, s as TooltipPopup, t as Tooltip, u as TooltipTrigger$1, ur as useLabelableContext, vr as visuallyHidden, wr as cva, xr as Button$1, yr as visuallyHiddenInput, zr as error$1 } from "./tooltip-BZ6tpqnr.js";
6
- import { $ as waitAutoContinueSchema, $t as SelectGroup, A as comparisonIssue, Bt as schemaObject, D as nodeSystemOutputPorts, Dt as connectorProxyTask, E as nodeErrorSchema, Et as connectorProxySupportsBody, F as operatorsForType, Ft as webhookMethods, It as webhookSupportsBody, J as webhookResponseAllowsBody, K as webhookHeaderValuePort, L as unaryOperator, O as supportsNodeErrorHandling, P as operandHandle, Pt as httpHeaderNameIssue, Q as workflowOutputsPort, Qt as SelectContent, R as valueType, Rt as matchesSchema, St as connectorProxyHeaderSchema, T as workflowToolNameIssue, Tt as connectorProxyQuerySchema, U as decodeRevisionContent, Vt as variableInputCompatible, X as webhookResponseTimeout, Xt as Select$1, Y as webhookResponseInputs, Yt as dequal, Z as webhookStatusCodePort, Zt as SelectChevron, _t as defaultDecisionQuestion, a as DialogFooter, at as httpHeaderSchema, b as nodeNameIssue, c as DialogTrigger, ct as httpRequestIssues, d as Field, en as SelectItem, et as defaultNodeRetry, f as FieldDescription, ft as isHttpHost, gn as ChevronDown, gt as decisionTask, h as FieldLabel, hn as Input, ht as decisionQuestionIssues, i as DialogDescription, l as Icon, lt as httpRequestTask, m as FieldGroup, mn as Label, n as DialogClose, nn as SelectTrigger, nt as retryConfigurationSchema, o as DialogHeader, ot as httpQuerySchema, p as FieldError, pt as decisionLimits, q as webhookHeadersPort, qt as skipDuplicatesConfigSchema, r as DialogContent, rn as SelectValue, rt as supportsNodeRetry, s as DialogTitle, t as Dialog, tn as SelectSeparator, tt as nodeRetryLimits, u as Spinner, vt as limitDecisionQuestions, wt as connectorProxyIssues, xt as connectorProxyHasBody, yt as connectorProxyBodyInput, zt as portsAssignable } from "./dialog-Bi-MVTGj.js";
7
- import { C as isMac, S as toManifestNodeId, T as flowPngAspectRatios, _ as E$1, a as CanvasNodeIcon, b as toViewEdge, c as collapseAllNested, d as IconStack, f as selectableTimeZones, g as cronDescription, h as timeZoneOffset, i as pasteVideoLink, l as formatDuration, m as timeZoneLongLabel, n as setAddItemId, o as defaultTriggerIcon, p as timeZoneLabel, s as JSONViewer, t as FlowCanvas, u as useDebouncedValue, v as CanvasTooltip, w as isSameViewport, x as toManifestHandleName, y as CanvasStore } from "./FlowCanvas-C4iuvVKB.js";
8
- import { $ as resourceValue, $t as WorkflowExportDialog, A as schemaForEditor, An as TabsTrigger, Ar as serverAddress, B as datePickerValue, Bn as EmptyMedia, Br as ApiError, Cn as selectors, Cr as inputValue, D as defaultValueEditorSchema, Dn as Tabs, Dr as openApiTask, Dt as diagnosticMessage, E as supportsFeishuChatFilter, En as IconPickerButton, Er as openApiFieldIssues, F as calendarChange, Fn as InputGroupInput, Fr as workflowCandidateGroup, G as indexAddNodeOptions, Gn as SourceSelect, H as isDateFormat, Hn as Badge, Hr as eventSourceKind, I as calendarDate, In as Empty, Ir as workflowCapability, Jn as EventSourceSetup, Kn as createI18n, L as dateFromTimeZone, Ln as EmptyContent, Lr as workflowSelectionTask, M as getDefaultValue, Mn as followWorkbenchLink, Mr as sameWorkflowInterface, N as isUnconstrainedSchema, Nn as InputGroup, Nr as workflowAgentTool, O as editorComponent, On as TabsContent, Or as securityOptions, Ot as diagnosticNodeId, P as typeOfSchema, Pn as InputGroupAddon, Q as resourceData, R as dateInTimeZone, Rn as EmptyDescription, Sn as ComboboxRoot, Sr as triggerConfigValues, St as revisionView, T as feishuResourceKind, Tn as useComboboxRootContext, Tr as object$1, V as dateTimeWall, Vn as EmptyTitle, Vr as controlErrorCode, Wn as SourceForm, Y as connectorActionPresentation, Yn as errorNotice, Z as observeResource, Zt as dequal$1, _n as ComboboxList, _t as actionSummary, ar as webhookResponseDiagnostics, bn as ComboboxInputGroup, bt as canCancelRun, cn as selectionMenuItemClass, dn as valueEditor_module_default, dr as isJsonObject, dt as loadJson, en as WorkflowExportMenuItem, er as decodeResultList, fn as ComboboxItemIndicator, ft as designerGraph, gn as ComboboxPortal, gt as triggerNodeIcon, hn as ComboboxPositioner, ht as semanticNodeIcon, ir as resolutionOutputPorts, it as decodeAppCatalogResponse, j as valueForEditor, jr as servers, jt as connectionCatalog, k as editorGroups, kn as TabsList, kr as selectOperation, kt as schemaMismatchMessage, ln as ValueControl, mn as ComboboxPopup, mt as nodeTitle, n as agentTool, nn as IdTooltip, nr as executionReachableNodes, or as sourceOutputLabel, ot as getAppCatalogCache, pn as ComboboxItem, pt as nodeIcon, q as mapSource, qn as FeishuEventPicker, rn as FlowSettingsButton, rr as inputSourceCandidates, sn as selectionMenuContentClass, sr as sourcePort, tn as useWorkflowExportAction, tt as provider, un as ValueEditorFeedback, ur as triggerOutputDefinitions, vn as GroupCollectionProvider, vt as providerIcon, wn as useComboboxInputValueContext, wr as listOperations, xn as ComboboxInput, xr as triggerConfigValue, xt as hasRunFilter, yn as ComboboxTrigger, z as datePickerChange, zn as EmptyHeader } from "./flowChanges-SKYJBr6X.js";
6
+ import { $ as waitAutoContinueSchema, $t as SelectGroup, A as comparisonIssue, Bt as schemaObject, D as nodeSystemOutputPorts, Dt as connectorProxyTask, E as nodeErrorSchema, Et as connectorProxySupportsBody, F as operatorsForType, Ft as webhookMethods, It as webhookSupportsBody, J as webhookResponseAllowsBody, K as webhookHeaderValuePort, L as unaryOperator, O as supportsNodeErrorHandling, P as operandHandle, Pt as httpHeaderNameIssue, Q as workflowOutputsPort, Qt as SelectContent, R as valueType, Rt as matchesSchema, St as connectorProxyHeaderSchema, T as workflowToolNameIssue, Tt as connectorProxyQuerySchema, U as decodeRevisionContent, Vt as variableInputCompatible, X as webhookResponseTimeout, Xt as Select$1, Y as webhookResponseInputs, Yt as dequal, Z as webhookStatusCodePort, Zt as SelectChevron, _t as defaultDecisionQuestion, a as DialogFooter, at as httpHeaderSchema, b as nodeNameIssue, c as DialogTrigger, ct as httpRequestIssues, d as Field, en as SelectItem, et as defaultNodeRetry, f as FieldDescription, ft as isHttpHost, gn as ChevronDown, gt as decisionTask, h as FieldLabel, hn as Input, ht as decisionQuestionIssues, i as DialogDescription, l as Icon, lt as httpRequestTask, m as FieldGroup, mn as Label, n as DialogClose, nn as SelectTrigger, nt as retryConfigurationSchema, o as DialogHeader, ot as httpQuerySchema, p as FieldError, pt as decisionLimits, q as webhookHeadersPort, qt as skipDuplicatesConfigSchema, r as DialogContent, rn as SelectValue, rt as supportsNodeRetry, s as DialogTitle, t as Dialog, tn as SelectSeparator, tt as nodeRetryLimits, u as Spinner, vt as limitDecisionQuestions, wt as connectorProxyIssues, xt as connectorProxyHasBody, yt as connectorProxyBodyInput, zt as portsAssignable } from "./dialog-E1WkapJU.js";
7
+ import { C as isMac, S as toManifestNodeId, T as flowPngAspectRatios, _ as E$1, a as CanvasNodeIcon, b as toViewEdge, c as collapseAllNested, d as IconStack, f as selectableTimeZones, g as cronDescription, h as timeZoneOffset, i as pasteVideoLink, l as formatDuration, m as timeZoneLongLabel, n as setAddItemId, o as defaultTriggerIcon, p as timeZoneLabel, s as JSONViewer, t as FlowCanvas, u as useDebouncedValue, v as CanvasTooltip, w as isSameViewport, x as toManifestHandleName, y as CanvasStore } from "./FlowCanvas-CZEphIhX.js";
8
+ import { $ as resourceValue, $t as WorkflowExportDialog, A as schemaForEditor, An as TabsTrigger, Ar as serverAddress, B as datePickerValue, Bn as EmptyMedia, Br as ApiError, Cn as selectors, Cr as inputValue, D as defaultValueEditorSchema, Dn as Tabs, Dr as openApiTask, Dt as diagnosticMessage, E as supportsFeishuChatFilter, En as IconPickerButton, Er as openApiFieldIssues, F as calendarChange, Fn as InputGroupInput, Fr as workflowCandidateGroup, G as indexAddNodeOptions, Gn as SourceSelect, H as isDateFormat, Hn as Badge, Hr as eventSourceKind, I as calendarDate, In as Empty, Ir as workflowCapability, Jn as EventSourceSetup, Kn as createI18n, L as dateFromTimeZone, Ln as EmptyContent, Lr as workflowSelectionTask, M as getDefaultValue, Mn as followWorkbenchLink, Mr as sameWorkflowInterface, N as isUnconstrainedSchema, Nn as InputGroup, Nr as workflowAgentTool, O as editorComponent, On as TabsContent, Or as securityOptions, Ot as diagnosticNodeId, P as typeOfSchema, Pn as InputGroupAddon, Q as resourceData, R as dateInTimeZone, Rn as EmptyDescription, Sn as ComboboxRoot, Sr as triggerConfigValues, St as revisionView, T as feishuResourceKind, Tn as useComboboxRootContext, Tr as object$1, V as dateTimeWall, Vn as EmptyTitle, Vr as controlErrorCode, Wn as SourceForm, Y as connectorActionPresentation, Yn as errorNotice, Z as observeResource, Zt as dequal$1, _n as ComboboxList, _t as actionSummary, ar as webhookResponseDiagnostics, bn as ComboboxInputGroup, bt as canCancelRun, cn as selectionMenuItemClass, dn as valueEditor_module_default, dr as isJsonObject, dt as loadJson, en as WorkflowExportMenuItem, er as decodeResultList, fn as ComboboxItemIndicator, ft as designerGraph, gn as ComboboxPortal, gt as triggerNodeIcon, hn as ComboboxPositioner, ht as semanticNodeIcon, ir as resolutionOutputPorts, it as decodeAppCatalogResponse, j as valueForEditor, jr as servers, jt as connectionCatalog, k as editorGroups, kn as TabsList, kr as selectOperation, kt as schemaMismatchMessage, ln as ValueControl, mn as ComboboxPopup, mt as nodeTitle, n as agentTool, nn as IdTooltip, nr as executionReachableNodes, or as sourceOutputLabel, ot as getAppCatalogCache, pn as ComboboxItem, pt as nodeIcon, q as mapSource, qn as FeishuEventPicker, rn as FlowSettingsButton, rr as inputSourceCandidates, sn as selectionMenuContentClass, sr as sourcePort, tn as useWorkflowExportAction, tt as provider, un as ValueEditorFeedback, ur as triggerOutputDefinitions, vn as GroupCollectionProvider, vt as providerIcon, wn as useComboboxInputValueContext, wr as listOperations, xn as ComboboxInput, xr as triggerConfigValue, xt as hasRunFilter, yn as ComboboxTrigger, z as datePickerChange, zn as EmptyHeader } from "./flowChanges-DsLZdENA.js";
9
9
  import { r as resolveUiLanguage } from "./languages-gYzoQqCi.js";
10
10
  import { a as renameObjectField, i as objectValue, n as isJsonValue, o as setObjectField, r as jsonDataTypes, s as valueType$1, t as initialValue } from "./value-BbFQZZ_V.js";
11
11
  import { n as compile, r as validate } from "./flowRunInputEditorStore-ys1-w9GW.js";
12
- import { t as WorkbenchSelect } from "./workbenchSelect-CHOeceKA.js";
12
+ import { t as WorkbenchSelect } from "./workbenchSelect-BfQfMWuY.js";
13
13
  import * as React from "react";
14
14
  import reactExports, { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
15
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -232,7 +232,7 @@ function CanvasHistoryScope({ history, disabled, ...props }) {
232
232
  }
233
233
  //#endregion
234
234
  //#region src/workbench/browser/runtime/editor/commentInspector.tsx
235
- var MarkdownContent = lazy(() => import("./markdownContent-B75ojl0E.js"));
235
+ var MarkdownContent = lazy(() => import("./markdownContent-BsdTdwBU.js"));
236
236
  /** A comment is presentation data; editing it does not require the canvas store. */
237
237
  function CommentInspector({ title, content, disabled = false, readOnly, dark, onSave }) {
238
238
  const t = useTranslate();
@@ -29901,6 +29901,7 @@ function callbacksFromProps(props) {
29901
29901
  onChangeDirection: props.onChangeDirection,
29902
29902
  onAddNode: props.onAddNode,
29903
29903
  onMoveNodes: props.onMoveNodes,
29904
+ onInitialLayout: props.onInitialLayout,
29904
29905
  onChangeNodeContentHidden: props.onChangeNodeContentHidden,
29905
29906
  onChangeNodeWidth: props.onChangeNodeWidth,
29906
29907
  onChangeComment: props.onChangeComment,
@@ -29921,6 +29922,10 @@ function FlowCanvasView(props) {
29921
29922
  defaultMiniMapExpanded: props.defaultMiniMapExpanded
29922
29923
  }), [props.identity]);
29923
29924
  const previousStore = useRef(store);
29925
+ const previousLayoutRequest = useRef({
29926
+ store,
29927
+ requested: props.autoLayout
29928
+ });
29924
29929
  const propsRef = useRef(props);
29925
29930
  const selectedEdge = useRef();
29926
29931
  propsRef.current = props;
@@ -29988,6 +29993,14 @@ function FlowCanvasView(props) {
29988
29993
  props.selectedNodeIds,
29989
29994
  props.ignoredNodeIds
29990
29995
  ]);
29996
+ useLayoutEffect(() => {
29997
+ const previous = previousLayoutRequest.current;
29998
+ previousLayoutRequest.current = {
29999
+ store,
30000
+ requested: props.autoLayout
30001
+ };
30002
+ if (previous.store === store && !previous.requested && props.autoLayout) store.requestLayout();
30003
+ }, [store, props.autoLayout]);
29991
30004
  useEffect(() => {
29992
30005
  if (props.focusNodeRequest != null) {
29993
30006
  const reducedMotion = typeof window != "undefined" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -30266,6 +30279,7 @@ var WorkbenchCanvas = forwardRef(function WorkbenchCanvas({ nodePicker, annotati
30266
30279
  tabIndex: 0,
30267
30280
  children: [
30268
30281
  /* @__PURE__ */ jsx(FlowCanvasView, {
30282
+ autoLayout: model.needsLayout,
30269
30283
  annotationContext,
30270
30284
  onRequestAddNode: (request) => {
30271
30285
  if (addNodeRequest == null) setPickerCentered(false);
@@ -31581,6 +31595,15 @@ function changeRevisionCanvasSession(session, graphId, change) {
31581
31595
  const previous = session[graphId];
31582
31596
  let next;
31583
31597
  switch (change.kind) {
31598
+ case "initialize":
31599
+ next = {
31600
+ ...previous,
31601
+ initialLayout: previous?.initialLayout ?? {
31602
+ direction: change.direction,
31603
+ positions: change.positions
31604
+ }
31605
+ };
31606
+ break;
31584
31607
  case "move":
31585
31608
  next = {
31586
31609
  ...previous,
@@ -31693,19 +31716,32 @@ function RevisionCanvas({ draft, presentation, theme, interactiveMode$, defaultI
31693
31716
  return baseline.nodes.filter((node) => ids.has(node.id)).map((node) => node.id);
31694
31717
  });
31695
31718
  const session = sessions[graphId];
31719
+ const needsInitialLayout = baseline.needsLayout && session?.initialLayout == null;
31696
31720
  const model = useMemo(() => ({
31697
31721
  ...baseline,
31698
- direction: session?.direction ?? baseline.direction,
31722
+ direction: session?.direction ?? session?.initialLayout?.direction ?? baseline.direction,
31699
31723
  viewport: session?.viewport ?? baseline.viewport,
31700
31724
  nodes: baseline.nodes.map((node) => ({
31701
31725
  ...node,
31702
- position: session?.positions?.[node.id] ?? node.position
31726
+ position: session?.positions?.[node.id] ?? session?.initialLayout?.positions[node.id] ?? node.position
31703
31727
  }))
31704
31728
  }), [baseline, session]);
31705
- const layoutChanged = model.direction !== baseline.direction || baseline.nodes.some((node) => {
31729
+ const layoutChanged = model.direction !== (session?.initialLayout?.direction ?? baseline.direction) || baseline.nodes.some((node) => {
31706
31730
  const position = session?.positions?.[node.id];
31707
- return position != null && (position.x !== node.position.x || position.y !== node.position.y);
31731
+ const original = session?.initialLayout?.positions[node.id] ?? node.position;
31732
+ return position != null && (position.x !== original.x || position.y !== original.y);
31708
31733
  });
31734
+ const changeLayout = (positions, direction) => {
31735
+ const change = direction == null ? {
31736
+ kind: "move",
31737
+ positions
31738
+ } : {
31739
+ kind: "direction",
31740
+ positions,
31741
+ direction
31742
+ };
31743
+ setSessions((current) => changeRevisionCanvasSession(current, graphId, change));
31744
+ };
31709
31745
  const selection = selected.length === 1 ? revision.node(selected[0]) : void 0;
31710
31746
  const selectedNode = selected.length === 1 ? model.nodes.find((node) => node.id === selected[0]) : void 0;
31711
31747
  const panelTitle = selectedNode?.title ?? (selected.length > 1 ? t("inspector.multipleSelected", { count: selected.length }) : t("inspector.outline"));
@@ -31737,6 +31773,7 @@ function RevisionCanvas({ draft, presentation, theme, interactiveMode$, defaultI
31737
31773
  children: [/* @__PURE__ */ jsxs("div", {
31738
31774
  className: "revision-viewer-canvas",
31739
31775
  children: [/* @__PURE__ */ jsx(FlowCanvasView, {
31776
+ autoLayout: needsInitialLayout,
31740
31777
  identity: graphId,
31741
31778
  model,
31742
31779
  editable: false,
@@ -31754,16 +31791,14 @@ function RevisionCanvas({ draft, presentation, theme, interactiveMode$, defaultI
31754
31791
  selectedNodeIds: selected,
31755
31792
  ignoredNodeIds: [],
31756
31793
  focusNodeRequest: focus,
31757
- onMoveNodes: (positions) => setSessions((current) => changeRevisionCanvasSession(current, graphId, {
31758
- kind: "move",
31759
- positions
31794
+ onMoveNodes: changeLayout,
31795
+ onInitialLayout: (layout) => setSessions((current) => changeRevisionCanvasSession(current, graphId, {
31796
+ kind: "initialize",
31797
+ direction: layout?.direction ?? canvasDirection(baseline.direction),
31798
+ positions: layout?.positions ?? Object.fromEntries(baseline.nodes.map((node) => [node.id, node.position]))
31760
31799
  })),
31761
31800
  onChangeDirection: (direction, positions) => {
31762
- setSessions((current) => changeRevisionCanvasSession(current, graphId, {
31763
- kind: "direction",
31764
- direction,
31765
- positions
31766
- }));
31801
+ changeLayout(positions, direction);
31767
31802
  return true;
31768
31803
  },
31769
31804
  onMoveViewport: (viewport) => setSessions((current) => changeRevisionCanvasSession(current, graphId, {
@@ -36144,7 +36179,7 @@ function FlowEditor({ portalRoot, navigationIsland, onRun, onRunStarted, onClose
36144
36179
  const iconCache = useProviderIconCache();
36145
36180
  const renderPng = useCallback(async (options) => {
36146
36181
  const model = store.$.designer.value;
36147
- const { flowToPng } = await import("./exportPng-DMsB9ku_.js");
36182
+ const { flowToPng } = await import("./exportPng-c4or5th8.js");
36148
36183
  return flowToPng(model, language, {
36149
36184
  ...options,
36150
36185
  ignoredNodeIds,
@@ -1,6 +1,6 @@
1
1
  import { o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
2
2
  import { i as isString, l as useTranslate } from "./dist-BFmpkX4P.js";
3
- import { r as getVideoLink } from "./FlowCanvas-C4iuvVKB.js";
3
+ import { r as getVideoLink } from "./FlowCanvas-CZEphIhX.js";
4
4
  import { memo, useEffect, useMemo, useRef } from "react";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region ../../node_modules/.bun/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js