@oomol-lab/open-flow 0.1.0-beta.63 → 0.1.0-beta.65

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.
@@ -1,4 +1,4 @@
1
- import { $n as connection, $t as DropdownMenu, At as WorkflowExportMenuItem, B as CacheResource, Ct as resetInputValues, Dt as setTriggerConnection, En as EventSourcesPage, Et as setInputSources, F as feishuResourceKind, G as designerGraph, Gn as allConnectorConnectionsQuery, Gt as InputGroupAddon, H as resourceData, Hn as errorNotice, I as supportsFeishuChatFilter, Jt as EmptyContent, Kt as InputGroupInput, L as combineSources, M as addNodeIntent, Mt as followWorkbenchLink, N as deriveAddNodeOptions, Nt as Popover, Ot as updateTriggerConfig, Pt as PopoverContent, Qn as isJsonObject, Qt as EmptyTitle, Rt as PopoverTitle, Sr as controlErrorCode, St as repairNodeNames, Tn as Badge, Tr as IconThemeContext, Tt as setConnectorConnection, U as resourceValue, Un as WorkbenchClient, W as connectorActionPorts, Wn as randomId, Wt as InputGroup, Xn as sampleErrorOutputs, Xt as EmptyHeader, Y as providerIcon, Yt as EmptyDescription, Zn as triggerOutputDefinitions, Zt as EmptyMedia, _ as updateValue, _r as invalidResponse, _t as restoreCanvasPresentation, a as nameCreatedNodes, at as Latest, br as string, bt as setNodeContentHidden, c as updateCondition, d as updateNodeName, dn as DropdownMenuTrigger, dt as actionWithConnections, er as connectorActionMetadata, et as RunStore, f as updateNodeSettings, ft as connectionCatalog, g as updateTaskPorts, gr as inputValue, gt as removeComments, h as updateTaskAdditionalInputs, ht as flowPresentation, i as deleteSelection, ir as workflowNameFromFile, it as flowResourceReferences, jt as IdTooltip, kn as createI18n, kt as updateTriggerSchedule, l as updateNodeDescription, m as updateTask, mt as commentIds, nr as parseWorkflowFile, o as setInputValue, ot as deriveInspectorDiagnostics, p as updateResolution, pt as canvasPresentationChange, qn as decodeTriggerCatalog, qt as Empty, r as applyFlowChanges, rn as DropdownMenuItem, rr as workflowFileName, rt as revisionView, s as setInputVariable, sn as DropdownMenuSeparator, sr as providerIconAppearance, st as diagnosticItems, t as addNode, tn as DropdownMenuContent, tr as encodeWorkflowFile, u as updateNodeIcon, v as updateWebhook, vr as jsonValue, vt as setComment, wt as setCodeActions, xr as ApiError, xt as setNodePositions, yr as record, yt as setFlowViewport, z as scopedValue } from "./flowChanges-DpZOQuJE.js";
1
+ import { $n as isJsonObject, $t as EmptyTitle, An as createI18n, At as updateTriggerSchedule, B as CacheResource, Cr as controlErrorCode, Ct as repairNodeNames, Dn as EventSourcesPage, Dt as setInputSources, En as Badge, Er as IconThemeContext, Et as setConnectorConnection, F as feishuResourceKind, Ft as PopoverContent, G as designerGraph, Gn as randomId, Gt as InputGroup, H as resourceData, I as supportsFeishuChatFilter, Jn as decodeTriggerCatalog, Jt as Empty, Kn as allConnectorConnectionsQuery, Kt as InputGroupAddon, L as combineSources, M as addNodeIntent, Mt as IdTooltip, N as deriveAddNodeOptions, Nt as followWorkbenchLink, Ot as setTriggerConnection, Pt as Popover, Qn as triggerOutputDefinitions, Qt as EmptyMedia, Sr as ApiError, St as setNodePositions, Tt as setCodeActions, U as resourceValue, Un as errorNotice, W as connectorActionPorts, Wn as WorkbenchClient, Xt as EmptyDescription, Y as providerIcon, Yt as EmptyContent, Zn as sampleErrorOutputs, Zt as EmptyHeader, _ as updateValue, _r as inputValue, _t as removeComments, a as nameCreatedNodes, ar as workflowNameFromFile, at as flowResourceReferences, br as record, bt as setFlowViewport, c as updateCondition, cn as DropdownMenuSeparator, cr as providerIconAppearance, ct as diagnosticItems, d as updateNodeName, en as DropdownMenu, er as connection, f as updateNodeSettings, fn as DropdownMenuTrigger, ft as actionWithConnections, g as updateTaskPorts, gt as flowPresentation, h as updateTaskAdditionalInputs, ht as commentIds, i as deleteSelection, in as DropdownMenuItem, ir as workflowFileName, it as revisionView, jt as WorkflowExportMenuItem, kt as updateTriggerConfig, l as updateNodeDescription, m as updateTask, mt as canvasPresentationChange, nn as DropdownMenuContent, nr as encodeWorkflowFile, o as setInputValue, ot as Latest, p as updateResolution, pt as connectionCatalog, qt as InputGroupInput, r as applyFlowChanges, rr as parseWorkflowFile, s as setInputVariable, st as deriveInspectorDiagnostics, t as addNode, tr as connectorActionMetadata, tt as RunStore, u as updateNodeIcon, v as updateWebhook, vr as invalidResponse, vt as restoreCanvasPresentation, wt as resetInputValues, xr as string, xt as setNodeContentHidden, yr as jsonValue, yt as setComment, z as scopedValue, zt as PopoverTitle } from "./flowChanges-DkvG5uDq.js";
2
2
  import { a as derive, i as compute, l as val } from "./dist-bO8nvHFH.js";
3
3
  import { c as useLang, l as useTranslate, o as I18nProvider, u as useVal } from "./dist-BFmpkX4P.js";
4
4
  import { B as FlowChangeError, Ci as cn, E as FieldLabel, Q as nodeInputMappings, S as Field, T as FieldGroup, V as applyFlowChanges$1, Z as mapConditionSources, a as DialogDescription, at as dequal$1, c as DialogTitle, d as TooltipContent, i as DialogContent, lr as Input, n as Dialog, o as DialogFooter, p as TooltipTrigger, q as resourceNameIssue, r as DialogClose, s as DialogHeader, t as Icon, u as Tooltip, w as FieldError, x as Spinner, xi as Button } from "./icons-Db2Jb2iX.js";
@@ -193,7 +193,6 @@ function Skeleton({ className, ...props }) {
193
193
  var CreateResourceDialog = lazy(() => import("./createResourceDialog-BAJXbzNH.js"));
194
194
  var flowIdTooltipAlignOffset = 44;
195
195
  var renamePopoverAlignOffset = -12;
196
- var renamePopoverVerticalShift = 8;
197
196
  function compactFlowId(flowId) {
198
197
  return flowId.length <= 20 ? flowId : `${flowId.slice(0, 10)}…${flowId.slice(-6)}`;
199
198
  }
@@ -370,54 +369,56 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
370
369
  finalFocus: actionsButton,
371
370
  positionMethod: "fixed",
372
371
  side: "top",
373
- sideOffset: ({ anchor, positioner }) => -(anchor.height + positioner.height) / 2 - renamePopoverVerticalShift,
372
+ sideOffset: ({ anchor, positioner }) => -(anchor.height + positioner.height) / 2,
374
373
  children: [/* @__PURE__ */ jsx(PopoverTitle, {
375
374
  className: "sr-only",
376
375
  children: t("sidebar.renameFlow", { name: flow.name })
377
- }), /* @__PURE__ */ jsxs("form", {
378
- className: "resource-rename-form",
376
+ }), /* @__PURE__ */ jsx("form", {
379
377
  onSubmit: (event) => void rename(event),
380
- children: [
381
- /* @__PURE__ */ jsxs(Field, {
382
- className: "min-w-0 flex-1",
383
- "data-invalid": name.length > 0 && issue != null,
384
- children: [
385
- /* @__PURE__ */ jsx(FieldLabel, {
386
- className: "sr-only",
387
- htmlFor: `rename-flow-${flow.flowId}`,
388
- children: t("resource.flowName")
389
- }),
390
- /* @__PURE__ */ jsx(Input, {
391
- autoComplete: "off",
392
- "aria-invalid": name.length > 0 && issue != null,
393
- "aria-describedby": name.length > 0 && issue != null ? `rename-error-${flow.flowId}` : void 0,
394
- id: `rename-flow-${flow.flowId}`,
395
- name: "flow-name",
396
- onChange: (event) => setName(event.target.value),
397
- ref: nameInput,
398
- required: true,
399
- value: name
400
- }),
401
- name.length > 0 && issue != null && /* @__PURE__ */ jsx(FieldError, {
402
- id: `rename-error-${flow.flowId}`,
403
- children: t(`resource.nameIssue.${issue}`, { max: 80 })
404
- })
405
- ]
406
- }),
407
- /* @__PURE__ */ jsx(Button, {
408
- onClick: () => setMode("idle"),
409
- size: "sm",
410
- type: "button",
411
- variant: "ghost",
412
- children: t("common.cancel")
413
- }),
414
- /* @__PURE__ */ jsx(Button, {
415
- disabled: busy != null || issue != null,
416
- size: "sm",
417
- type: "submit",
418
- children: t("common.save")
419
- })
420
- ]
378
+ children: /* @__PURE__ */ jsxs(Field, {
379
+ "data-invalid": name.length > 0 && issue != null,
380
+ children: [
381
+ /* @__PURE__ */ jsx(FieldLabel, {
382
+ className: "sr-only",
383
+ htmlFor: `rename-flow-${flow.flowId}`,
384
+ children: t("resource.flowName")
385
+ }),
386
+ /* @__PURE__ */ jsxs("div", {
387
+ className: "resource-rename-form",
388
+ children: [
389
+ /* @__PURE__ */ jsx(Input, {
390
+ controlSize: "field",
391
+ autoComplete: "off",
392
+ "aria-invalid": name.length > 0 && issue != null,
393
+ "aria-describedby": name.length > 0 && issue != null ? `rename-error-${flow.flowId}` : void 0,
394
+ id: `rename-flow-${flow.flowId}`,
395
+ name: "flow-name",
396
+ onChange: (event) => setName(event.target.value),
397
+ ref: nameInput,
398
+ required: true,
399
+ value: name
400
+ }),
401
+ /* @__PURE__ */ jsx(Button, {
402
+ onClick: () => setMode("idle"),
403
+ size: "sm",
404
+ type: "button",
405
+ variant: "ghost",
406
+ children: t("common.cancel")
407
+ }),
408
+ /* @__PURE__ */ jsx(Button, {
409
+ disabled: busy != null || issue != null,
410
+ size: "sm",
411
+ type: "submit",
412
+ children: t("common.save")
413
+ })
414
+ ]
415
+ }),
416
+ name.length > 0 && issue != null && /* @__PURE__ */ jsx(FieldError, {
417
+ id: `rename-error-${flow.flowId}`,
418
+ children: t(`resource.nameIssue.${issue}`, { max: 80 })
419
+ })
420
+ ]
421
+ })
421
422
  })]
422
423
  })
423
424
  })]
@@ -997,11 +998,30 @@ var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size | 0, r
997
998
  //#endregion
998
999
  //#region src/flow/common/edgeChanges.ts
999
1000
  function connect(content, edge) {
1000
- if (content.document.graph?.edges.some((candidate) => dequal$1(candidate, edge))) return [];
1001
- return [{
1001
+ const selected = content.document.graph;
1002
+ if (selected?.edges.some((candidate) => dequal$1(candidate, edge))) return [];
1003
+ const changes = [{
1002
1004
  edge,
1003
1005
  kind: "graph.edge.connect"
1004
1006
  }];
1007
+ const source = selected.nodes[edge.source];
1008
+ const target = selected.nodes[edge.target];
1009
+ if (edge.sourceHandle == "pending" && (source?.kind == "approval" || source?.kind == "wait") && target?.kind == "task" && "executor" in target.task && target.task.executor.kind == "connector" && target.task.executor.action == "leina.send_notification" && (target.inputs.message == null || target.inputs.message.kind == "unset")) changes.push({
1010
+ kind: "graph.node.input.set",
1011
+ nodeId: edge.target,
1012
+ handle: "message",
1013
+ before: target.inputs.message,
1014
+ value: {
1015
+ kind: "sources",
1016
+ sources: [{
1017
+ kind: "node",
1018
+ nodeId: edge.source,
1019
+ output: "pending",
1020
+ field: "message"
1021
+ }]
1022
+ }
1023
+ });
1024
+ return changes;
1005
1025
  }
1006
1026
  function disconnect(content, edge) {
1007
1027
  if (!content.document.graph?.edges.some((candidate) => dequal$1(candidate, edge))) return [];
@@ -3366,6 +3386,11 @@ function ports(values) {
3366
3386
  }));
3367
3387
  }
3368
3388
  function option$1(action, t) {
3389
+ if (action.actionId == "leina.send_notification") action = {
3390
+ ...action,
3391
+ name: t("leina.notification"),
3392
+ description: t("leina.description")
3393
+ };
3369
3394
  return {
3370
3395
  connector: action,
3371
3396
  description: action.authenticated && action.defaultConnection == null ? t("addNode.connectorNeedsConnection", {
@@ -3458,6 +3483,9 @@ function connectionDiagnostics(revision, actions, catalogs) {
3458
3483
  }
3459
3484
  var ConnectorStore = class {
3460
3485
  #client;
3486
+ listLeinaBots(flowId, signal) {
3487
+ return this.#client.listLeinaBots(flowId, signal);
3488
+ }
3461
3489
  #i18n;
3462
3490
  #language;
3463
3491
  #host;
@@ -5286,6 +5314,7 @@ var deletionMessageKeys = {
5286
5314
  webhookBody: "history.deleted.webhookBody"
5287
5315
  };
5288
5316
  var WorkspaceStore = class {
5317
+ #canvasCommandListeners;
5289
5318
  #client;
5290
5319
  #draftChanges;
5291
5320
  #draftSession;
@@ -5315,6 +5344,7 @@ var WorkspaceStore = class {
5315
5344
  this.flowCreated = flowCreated;
5316
5345
  this.accessChanged = accessChanged;
5317
5346
  this.filterTriggerConnections = filterTriggerConnections;
5347
+ this.#canvasCommandListeners = /* @__PURE__ */ new Set();
5318
5348
  this.#draftSession = new Latest();
5319
5349
  this.#history = new CanvasHistory();
5320
5350
  this.history$ = this.#history.state$;
@@ -5325,6 +5355,12 @@ var WorkspaceStore = class {
5325
5355
  this.#started = false;
5326
5356
  this.#draftSyncQueued = false;
5327
5357
  this.#nodeFocusId = 0;
5358
+ this.subscribeCanvasCommands = (execute) => {
5359
+ this.#canvasCommandListeners.add(execute);
5360
+ return () => {
5361
+ this.#canvasCommandListeners.delete(execute);
5362
+ };
5363
+ };
5328
5364
  this.#client = client;
5329
5365
  this.#setNotice = setNotice;
5330
5366
  this.#identity = identity;
@@ -5360,6 +5396,7 @@ var WorkspaceStore = class {
5360
5396
  this.#presentationChanges.dispose();
5361
5397
  this.#stopCatalogWatch?.();
5362
5398
  this.#stopFlowWatch?.();
5399
+ this.#canvasCommandListeners.clear();
5363
5400
  this.history$.dispose();
5364
5401
  this.#model.dispose();
5365
5402
  this.#flows.dispose();
@@ -5448,6 +5485,8 @@ var WorkspaceStore = class {
5448
5485
  this.accessChanged(flowId, accessRevision);
5449
5486
  this.#refreshLive(flowId, current);
5450
5487
  }
5488
+ }, (command) => {
5489
+ if (current() && !this.#model.value.workspaceLoading) for (const execute of this.#canvasCommandListeners) execute(command);
5451
5490
  });
5452
5491
  this.#stopFlowWatch = subscription.stop;
5453
5492
  await subscription.ready;
@@ -6813,7 +6852,7 @@ var WorkbenchStore = class {
6813
6852
  };
6814
6853
  //#endregion
6815
6854
  //#region src/workbench/browser/runtime/openFlowWorkbench.tsx
6816
- var FlowWorkspace = lazy(() => import("./flowWorkspace-B7a5NNA_.js"));
6855
+ var FlowWorkspace = lazy(() => import("./flowWorkspace-BEp-lxqF.js"));
6817
6856
  function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
6818
6857
  const hasToken = token != null && tokenLabel != null && onTokenChange != null;
6819
6858
  const tokenValue = token ?? "";