@reopt-ai/opt-workflow 0.1.1 → 0.1.3

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
- const require_branch_resolver = require("./branch-resolver-D_wM183Q.cjs");
1
+ const require_branch_resolver = require("./branch-resolver-BMbNYMjx.cjs");
2
2
  const require_end_node_ids = require("./end-node-ids-D6WBaCLm.cjs");
3
3
  // src/lib/id.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as evaluateCondition, d as collectUnresolvedVariables, m as resolveObjectVariables, r as resolveBranchPath, u as validateConditionConfig, x as msgf } from "./branch-resolver-BDi6Wu6m.js";
1
+ import { a as evaluateCondition, d as collectUnresolvedVariables, m as resolveObjectVariables, r as resolveBranchPath, u as validateConditionConfig, x as msgf } from "./branch-resolver-d5DC_s2D.js";
2
2
  import { r as _objectSpread2 } from "./end-node-ids-p85jFEcP.js";
3
3
  // src/lib/id.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_branch_resolver = require("./branch-resolver-D_wM183Q.cjs");
1
+ const require_branch_resolver = require("./branch-resolver-BMbNYMjx.cjs");
2
2
  const require_end_node_ids = require("./end-node-ids-D6WBaCLm.cjs");
3
3
  const require_node_definitions = require("./node-definitions-pS1Zp1dK.cjs");
4
4
  const require_step_type_for_node = require("./step-type-for-node-D9sdHfWA.cjs");
@@ -1532,6 +1532,31 @@ function validateConnection(from, to, connections) {
1532
1532
  })) return "순환 연결은 허용되지 않습니다.";
1533
1533
  return null;
1534
1534
  }
1535
+ /**
1536
+ * 빈 칸에 스텝을 추가할 때의 **자동 연결**을 정한다 — 이을 수 없으면 null(스텝만 추가한다).
1537
+ *
1538
+ * 🔴 예전의 자동 연결은 순환만 보고 이웃 스텝에서 선을 그었다. 그래서
1539
+ * - 조건 스텝 옆에 스텝을 추가하면 **분기 타입 없는 연결**이 생겼다. 타입 있는 형제 분기가
1540
+ * 하나라도 있으면 실행기는 그 연결을 고르지 않는다(fail-closed) — 선은 보이는데 그 길로는
1541
+ * 영영 가지 않았다.
1542
+ * - 종료 스텝에서도, 이미 나가는 연결이 있는 일반 스텝에서도(실행기는 첫 번째만 따라간다)
1543
+ * 아무 말 없이 선이 그어졌다.
1544
+ * 수동 연결(`validateConnection` + 분기 선택 대화상자 + 두 번째 연결 경고)과 같은 규칙을
1545
+ * 대화상자 없이 적용한다: 조건 스텝은 비어 있는 분기를 고르고(참 → 거짓, Switch는 기본),
1546
+ * 고를 분기가 없으면 잇지 않는다.
1547
+ */
1548
+ function planAutoConnection(from, to, connections) {
1549
+ if (validateConnection(from, to, connections)) return null;
1550
+ if (from.type === "end") return null;
1551
+ const outgoing = connections.filter((c) => c.fromStepId === from.id);
1552
+ if (from.type === "condition") {
1553
+ const used = new Set(outgoing.map((c) => c.branchType));
1554
+ const branchType = (require_branch_resolver.normalizeConditionConfig(from.config).conditionType === "switch" ? ["default"] : ["true", "false"]).find((candidate) => !used.has(candidate));
1555
+ return branchType ? { branchType } : null;
1556
+ }
1557
+ if (from.type !== "parallel" && outgoing.length > 0) return null;
1558
+ return {};
1559
+ }
1535
1560
  // src/lib/workflow-preview.ts
1536
1561
  /**
1537
1562
  * AI 제안 미리보기 — committed 그래프 + 제안 op 목록을 합쳐 "적용하면 이렇게 된다"를
@@ -1985,6 +2010,12 @@ Object.defineProperty(exports, "orderStepsForPreview", {
1985
2010
  return orderStepsForPreview;
1986
2011
  }
1987
2012
  });
2013
+ Object.defineProperty(exports, "planAutoConnection", {
2014
+ enumerable: true,
2015
+ get: function() {
2016
+ return planAutoConnection;
2017
+ }
2018
+ });
1988
2019
  Object.defineProperty(exports, "resolveConnectionFocus", {
1989
2020
  enumerable: true,
1990
2021
  get: function() {
@@ -1,4 +1,4 @@
1
- import { i as validateBranchConnections, l as normalizeConditionConfig, u as validateConditionConfig, x as msgf } from "./branch-resolver-BDi6Wu6m.js";
1
+ import { i as validateBranchConnections, l as normalizeConditionConfig, u as validateConditionConfig, x as msgf } from "./branch-resolver-d5DC_s2D.js";
2
2
  import { n as _objectWithoutProperties, r as _objectSpread2 } from "./end-node-ids-p85jFEcP.js";
3
3
  import { t as getNodeDefinition } from "./node-definitions-C-GMfjMm.js";
4
4
  import { a as endDefinitions, c as TRIGGER_PAYLOADS, i as conditionDefinitions, o as NODE_OUTPUTS, r as getStepNodeDefinition, s as SPECIAL_VARIABLES } from "./step-type-for-node-Blf5DKrp.js";
@@ -1532,6 +1532,31 @@ function validateConnection(from, to, connections) {
1532
1532
  })) return "순환 연결은 허용되지 않습니다.";
1533
1533
  return null;
1534
1534
  }
1535
+ /**
1536
+ * 빈 칸에 스텝을 추가할 때의 **자동 연결**을 정한다 — 이을 수 없으면 null(스텝만 추가한다).
1537
+ *
1538
+ * 🔴 예전의 자동 연결은 순환만 보고 이웃 스텝에서 선을 그었다. 그래서
1539
+ * - 조건 스텝 옆에 스텝을 추가하면 **분기 타입 없는 연결**이 생겼다. 타입 있는 형제 분기가
1540
+ * 하나라도 있으면 실행기는 그 연결을 고르지 않는다(fail-closed) — 선은 보이는데 그 길로는
1541
+ * 영영 가지 않았다.
1542
+ * - 종료 스텝에서도, 이미 나가는 연결이 있는 일반 스텝에서도(실행기는 첫 번째만 따라간다)
1543
+ * 아무 말 없이 선이 그어졌다.
1544
+ * 수동 연결(`validateConnection` + 분기 선택 대화상자 + 두 번째 연결 경고)과 같은 규칙을
1545
+ * 대화상자 없이 적용한다: 조건 스텝은 비어 있는 분기를 고르고(참 → 거짓, Switch는 기본),
1546
+ * 고를 분기가 없으면 잇지 않는다.
1547
+ */
1548
+ function planAutoConnection(from, to, connections) {
1549
+ if (validateConnection(from, to, connections)) return null;
1550
+ if (from.type === "end") return null;
1551
+ const outgoing = connections.filter((c) => c.fromStepId === from.id);
1552
+ if (from.type === "condition") {
1553
+ const used = new Set(outgoing.map((c) => c.branchType));
1554
+ const branchType = (normalizeConditionConfig(from.config).conditionType === "switch" ? ["default"] : ["true", "false"]).find((candidate) => !used.has(candidate));
1555
+ return branchType ? { branchType } : null;
1556
+ }
1557
+ if (from.type !== "parallel" && outgoing.length > 0) return null;
1558
+ return {};
1559
+ }
1535
1560
  // src/lib/workflow-preview.ts
1536
1561
  /**
1537
1562
  * AI 제안 미리보기 — committed 그래프 + 제안 op 목록을 합쳐 "적용하면 이렇게 된다"를
@@ -1739,4 +1764,4 @@ function selectAppliedGraph(preview) {
1739
1764
  connections: preview.previewConnections.filter((c) => preview.statusByConnectionId.get(c.id) !== "deleted")
1740
1765
  };
1741
1766
  }
1742
- export { viewportPointToCell as $, routeLabelFallbackPoint as A, findStepInDirection as B, VARIABLE_TOKEN_PATTERN as C, getUpstreamSteps as D, flattenFields as E, deriveRunPath as F, IDENTITY_TRANSFORM as G, listStepConnections as H, maskPiiDeep as I, getCellCenter as J, cellToViewportRect as K, maskPiiString as L, getStepSummary as M, missingRequiredFields as N, roundedPath as O, visibleConfigFields as P, getStepsRect as Q, orderStepsForPreview as R, triageFailedStep as S, findBrokenStepRefs as T, orderStepsByFlow as U, getConnectionFarEnd as V, resolveConnectionFocus as W, getCellOrigin as X, getCellEdge as Y, getContentSize as Z, formatDurationMs as _, findNearestFreeCell as a, FAILURE_CAUSES as b, getWorkflowPreflight as c, buildWorkflowBrief as d, viewportToContent as et, exportTemplate as f, aggregateStepMetrics as g, validateWorkflowDefinition as h, findFreeCommonNeighbor as i, routeLabelPoint as j, routeConnection as k, findWorkflowSetupProblems as l, serializeTemplate as m, selectAppliedGraph as n, validateConnection as o, importTemplate as p, contentToViewport as q, findFreeAdjacentCell as r, MULTI_OUTGOING_STEP_TYPES as s, computePreviewGraph as t, findRunBlockers as u, formatShare as v, buildVariableTree as w, findFailedStep as x, FAILURE_CAUSE_COPY as y, cycleStepConnection as z };
1767
+ export { getStepsRect as $, routeConnection as A, cycleStepConnection as B, triageFailedStep as C, flattenFields as D, findBrokenStepRefs as E, visibleConfigFields as F, resolveConnectionFocus as G, getConnectionFarEnd as H, deriveRunPath as I, contentToViewport as J, IDENTITY_TRANSFORM as K, maskPiiDeep as L, routeLabelPoint as M, getStepSummary as N, getUpstreamSteps as O, missingRequiredFields as P, getContentSize as Q, maskPiiString as R, findFailedStep as S, buildVariableTree as T, listStepConnections as U, findStepInDirection as V, orderStepsByFlow as W, getCellEdge as X, getCellCenter as Y, getCellOrigin as Z, aggregateStepMetrics as _, findNearestFreeCell as a, FAILURE_CAUSE_COPY as b, MULTI_OUTGOING_STEP_TYPES as c, findRunBlockers as d, viewportPointToCell as et, buildWorkflowBrief as f, validateWorkflowDefinition as g, serializeTemplate as h, findFreeCommonNeighbor as i, routeLabelFallbackPoint as j, roundedPath as k, getWorkflowPreflight as l, importTemplate as m, selectAppliedGraph as n, planAutoConnection as o, exportTemplate as p, cellToViewportRect as q, findFreeAdjacentCell as r, validateConnection as s, computePreviewGraph as t, viewportToContent as tt, findWorkflowSetupProblems as u, formatDurationMs as v, VARIABLE_TOKEN_PATTERN as w, FAILURE_CAUSES as x, formatShare as y, orderStepsForPreview as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reopt-ai/opt-workflow",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Keyboard-first workflow editor for React: cell-grid canvas, node contracts, host-driven save/run/replay, AI proposal preview.",
5
5
  "type": "module",
6
6
  "license": "MIT",