@reopt-ai/opt-workflow 0.0.0-stage → 0.1.0
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.
- package/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +213 -2
- package/dist/ai-stream-APc3uCiQ.js +389 -0
- package/dist/ai-stream-B_lk9_Rf.cjs +628 -0
- package/dist/branch-resolver-BDi6Wu6m.js +589 -0
- package/dist/branch-resolver-D_wM183Q.cjs +714 -0
- package/dist/core-CtqBb-6v.d.cts +919 -0
- package/dist/core-z3nXmUBj.d.ts +919 -0
- package/dist/core.cjs +301 -0
- package/dist/core.d.cts +5 -0
- package/dist/core.d.ts +5 -0
- package/dist/core.js +184 -0
- package/dist/define-template-Bmn96lF_.cjs +74 -0
- package/dist/define-template-BvGNB5Tv.js +69 -0
- package/dist/end-node-ids-D6WBaCLm.cjs +109 -0
- package/dist/end-node-ids-p85jFEcP.js +86 -0
- package/dist/execution-context-DVeybULC.d.cts +258 -0
- package/dist/execution-context-YFTRCj0y.d.ts +258 -0
- package/dist/grid-workflow-dto-C86EArJP.d.cts +300 -0
- package/dist/grid-workflow-dto-C86EArJP.d.ts +300 -0
- package/dist/index.cjs +11873 -0
- package/dist/index.d.cts +794 -0
- package/dist/index.d.ts +794 -0
- package/dist/index.js +11828 -0
- package/dist/mock.cjs +7295 -0
- package/dist/mock.d.cts +88 -0
- package/dist/mock.d.ts +88 -0
- package/dist/mock.js +7287 -0
- package/dist/node-definitions-C-GMfjMm.js +797 -0
- package/dist/node-definitions-pS1Zp1dK.cjs +940 -0
- package/dist/nodes-D_a8ZkRp.d.cts +50 -0
- package/dist/nodes-myp8R2zo.d.ts +50 -0
- package/dist/nodes.cjs +36 -0
- package/dist/nodes.d.cts +3 -0
- package/dist/nodes.d.ts +3 -0
- package/dist/nodes.js +4 -0
- package/dist/shadcn-bridge.css +72 -0
- package/dist/simulate.cjs +6 -0
- package/dist/simulate.d.cts +111 -0
- package/dist/simulate.d.ts +111 -0
- package/dist/simulate.js +1 -0
- package/dist/step-type-for-node-Blf5DKrp.js +228 -0
- package/dist/step-type-for-node-D9sdHfWA.cjs +281 -0
- package/dist/styles.css +4 -0
- package/dist/test-executor-C2AvI73G.cjs +342 -0
- package/dist/test-executor-DpT3qXIT.js +313 -0
- package/dist/types-Bj0VWFny.d.cts +126 -0
- package/dist/types-C5744w6f.d.cts +184 -0
- package/dist/types-DQcmIuAl.d.ts +126 -0
- package/dist/types-dVHX2CyI.d.ts +184 -0
- package/dist/workflow-preview-B0kul6f-.js +1742 -0
- package/dist/workflow-preview-CZzXKXqK.cjs +2065 -0
- package/package.json +119 -4
package/dist/core.cjs
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_ai_stream = require("./ai-stream-B_lk9_Rf.cjs");
|
|
3
|
+
const require_workflow_preview = require("./workflow-preview-CZzXKXqK.cjs");
|
|
4
|
+
const require_step_type_for_node = require("./step-type-for-node-D9sdHfWA.cjs");
|
|
5
|
+
const require_node_definitions = require("./node-definitions-pS1Zp1dK.cjs");
|
|
6
|
+
const require_end_node_ids = require("./end-node-ids-D6WBaCLm.cjs");
|
|
7
|
+
const require_define_template = require("./define-template-Bmn96lF_.cjs");
|
|
8
|
+
const require_branch_resolver = require("./branch-resolver-D_wM183Q.cjs");
|
|
9
|
+
// src/lib/workflow-proposal-session.ts
|
|
10
|
+
/**
|
|
11
|
+
* AI 제안 세션 — 서버 도구가 op 하나를 받을 때마다 **캔버스 미리보기와 같은 계산**으로
|
|
12
|
+
* 적용해 보고, 결과를 모델에게 돌려준다. 순수 모듈(클라이언트 안전).
|
|
13
|
+
*
|
|
14
|
+
* 🔴 왜 필요한가(2026-09-23): 에이전트 도구는 op를 받는 즉시 `success: true`를 돌려줬고,
|
|
15
|
+
* 배치·연결·검증은 클라이언트 미리보기가 따로 했다. 미리보기가 "연결 못 함"·
|
|
16
|
+
* "트리거 중복"을 경고해도 그 경고는 **사용자 화면에만** 떴고 모델은 몰랐다 — 모델은
|
|
17
|
+
* 성공했다고 요약하고 사용자가 뒷정리를 했다(프로덕션 유일한 대화가 정확히 그랬다:
|
|
18
|
+
* 트리거가 있는 워크플로우에 트리거를 하나 더 얹었다).
|
|
19
|
+
*
|
|
20
|
+
* 🔑 같은 계산을 쓰는 방법: 클라이언트가 **확정 그래프(좌표 포함) + 미적용 op 목록**을
|
|
21
|
+
* 보내고, 세션은 `computePreviewGraph(확정, [...미적용, ...이번 턴 op])`를 그대로 돈다.
|
|
22
|
+
* 클라이언트 미리보기도 같은 입력(확정 + pendingOps)으로 같은 함수를 돌리므로 배치·연결
|
|
23
|
+
* 결과가 갈리지 않는다.
|
|
24
|
+
*
|
|
25
|
+
* 판정은 둘로 나뉜다:
|
|
26
|
+
* - **거절**(op를 stage하지 않는다): 없는 스텝 참조, 트리거 중복, 연결 불가(순환·
|
|
27
|
+
* 중복), 카탈로그에 없는 노드·설정 키, 보이는 필수 필드 누락. 미리보기가 조용히 버리거나
|
|
28
|
+
* 경고만 할 op를 모델이 "했다"고 믿지 않게 한다.
|
|
29
|
+
* - **새 이슈**(stage하되 알린다): 이 op가 **새로 만든** 실행 전 점검 이슈. 원래 있던
|
|
30
|
+
* 이슈까지 매번 되돌려주면 모델이 자기 탓이 아닌 것을 고치려 든다(브랜드폼 AI에서
|
|
31
|
+
* "그 패치가 새로 만든 위반만"으로 수렴한 것과 같은 이유).
|
|
32
|
+
*/
|
|
33
|
+
/** 조건 스텝이 정규화(`normalizeConditionConfig`)로 읽는 런타임 키 — 카탈로그 밖이지만 허용. */
|
|
34
|
+
const RUNTIME_CONFIG_KEYS = { condition: ["conditionType"] };
|
|
35
|
+
function resolveCatalogNode(nodeDefinitionId) {
|
|
36
|
+
var _ref, _getNodeDefinition;
|
|
37
|
+
return (_ref = (_getNodeDefinition = require_node_definitions.getNodeDefinition(nodeDefinitionId)) !== null && _getNodeDefinition !== void 0 ? _getNodeDefinition : require_step_type_for_node.conditionDefinitions.find((node) => node.id === nodeDefinitionId)) !== null && _ref !== void 0 ? _ref : require_step_type_for_node.endDefinitions.find((node) => node.id === nodeDefinitionId);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 카탈로그 설정 검증 — 모르는 키·보이는 필수 필드 누락. 에디터 저장 버튼과 같은
|
|
41
|
+
* `missingRequiredFields`를 쓴다(숨겨진 필드는 요구하지 않는다).
|
|
42
|
+
*/
|
|
43
|
+
function validateStepConfig(step) {
|
|
44
|
+
var _node$config$fields, _node$config, _RUNTIME_CONFIG_KEYS$, _step$config;
|
|
45
|
+
const node = step.nodeDefinitionId ? resolveCatalogNode(step.nodeDefinitionId) : require_step_type_for_node.getStepNodeDefinition(step);
|
|
46
|
+
if (!node) return step.nodeDefinitionId ? `알 수 없는 nodeDefinitionId "${step.nodeDefinitionId}". 카탈로그의 정확한 id를 쓰세요.` : null;
|
|
47
|
+
if (node.comingSoon) return `"${node.id}"는 아직 쓸 수 없는 노드입니다(연동 예정).`;
|
|
48
|
+
const fields = (_node$config$fields = (_node$config = node.config) === null || _node$config === void 0 ? void 0 : _node$config.fields) !== null && _node$config$fields !== void 0 ? _node$config$fields : [];
|
|
49
|
+
const allowed = /* @__PURE__ */ new Set([...fields.map((field) => field.key), ...(_RUNTIME_CONFIG_KEYS$ = RUNTIME_CONFIG_KEYS[step.type]) !== null && _RUNTIME_CONFIG_KEYS$ !== void 0 ? _RUNTIME_CONFIG_KEYS$ : []]);
|
|
50
|
+
const config = (_step$config = step.config) !== null && _step$config !== void 0 ? _step$config : {};
|
|
51
|
+
const unknown = Object.keys(config).filter((key) => !allowed.has(key));
|
|
52
|
+
if (unknown.length > 0) return `노드 "${node.id}"에 없는 설정 키: ${unknown.join(", ")}. 허용: ${[...allowed].join(", ") || "(없음)"}.`;
|
|
53
|
+
const missing = require_workflow_preview.missingRequiredFields(fields, config);
|
|
54
|
+
if (missing.length > 0) return `필수 설정 누락: ${missing.map((field) => `${field.key}(${field.label})`).join(", ")}.`;
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function issueKeys(preview, gridSize) {
|
|
58
|
+
const applied = require_workflow_preview.selectAppliedGraph(preview);
|
|
59
|
+
const definition = require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2({}, applied), {}, { gridSize });
|
|
60
|
+
return new Map(require_workflow_preview.getWorkflowPreflight(definition).map((issue) => [issue.id, issue.message]));
|
|
61
|
+
}
|
|
62
|
+
/** 점검 이슈 id(`<종류>:<stepId>…`)가 가리키는 스텝의 라벨 — 스텝이 아니면 빈 문자열. */
|
|
63
|
+
function describeStep(preview, stepId) {
|
|
64
|
+
if (!stepId) return "";
|
|
65
|
+
const step = preview.previewSteps.find((s) => s.id === stepId);
|
|
66
|
+
return step ? `"${step.label}"(${step.id})` : "";
|
|
67
|
+
}
|
|
68
|
+
function createWorkflowProposalSession(input) {
|
|
69
|
+
var _input$gridSize, _input$pendingOps;
|
|
70
|
+
const gridSize = (_input$gridSize = input.gridSize) !== null && _input$gridSize !== void 0 ? _input$gridSize : 9;
|
|
71
|
+
const ops = [...(_input$pendingOps = input.pendingOps) !== null && _input$pendingOps !== void 0 ? _input$pendingOps : []];
|
|
72
|
+
let preview = require_workflow_preview.computePreviewGraph(input.steps, input.connections, ops);
|
|
73
|
+
const alive = (id) => preview.previewSteps.some((s) => s.id === id && preview.statusByStepId.get(s.id) !== "deleted");
|
|
74
|
+
const findAlive = (id) => alive(id) ? preview.previewSteps.find((s) => s.id === id) : void 0;
|
|
75
|
+
function reject(op) {
|
|
76
|
+
switch (op.kind) {
|
|
77
|
+
case "add": {
|
|
78
|
+
var _op$mergeFromStepIds, _op$config;
|
|
79
|
+
if (op.afterStepId && !alive(op.afterStepId)) return `afterStepId "${op.afterStepId}" 스텝이 없습니다. 현재 그래프나 이번 턴에 받은 stepId를 쓰세요.`;
|
|
80
|
+
if (op.insertBeforeStepId) {
|
|
81
|
+
if (!op.afterStepId) return "insertBeforeStepId는 afterStepId와 함께 줘야 합니다(그 둘 사이에 넣는다).";
|
|
82
|
+
if (!preview.previewConnections.some((c) => c.fromStepId === op.afterStepId && c.toStepId === op.insertBeforeStepId && preview.statusByConnectionId.get(c.id) !== "deleted")) return `"${op.afterStepId}" → "${op.insertBeforeStepId}" 연결이 없어 사이에 넣을 수 없습니다. 끼워 넣기는 이미 이어진 두 스텝 사이에만 됩니다.`;
|
|
83
|
+
}
|
|
84
|
+
const missingMerge = ((_op$mergeFromStepIds = op.mergeFromStepIds) !== null && _op$mergeFromStepIds !== void 0 ? _op$mergeFromStepIds : []).filter((id) => !alive(id));
|
|
85
|
+
if (missingMerge.length > 0) return `mergeFromStepIds에 없는 스텝이 있습니다: ${missingMerge.join(", ")}.`;
|
|
86
|
+
if (op.stepType === "trigger") {
|
|
87
|
+
const existing = preview.previewSteps.find((s) => s.type === "trigger" && preview.statusByStepId.get(s.id) !== "deleted");
|
|
88
|
+
if (existing) return `트리거는 워크플로우당 하나입니다 — 이미 "${existing.label}"(${existing.id})가 있습니다. 바꾸려면 updateWorkflowStep으로 그 트리거를 고치거나 먼저 삭제하세요.`;
|
|
89
|
+
}
|
|
90
|
+
if (op.stepType !== "trigger" && !op.afterStepId) return "트리거가 아닌 스텝은 afterStepId(어느 스텝 다음인지)가 필요합니다.";
|
|
91
|
+
return validateStepConfig({
|
|
92
|
+
type: op.stepType,
|
|
93
|
+
nodeDefinitionId: op.nodeDefinitionId,
|
|
94
|
+
config: (_op$config = op.config) !== null && _op$config !== void 0 ? _op$config : {}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
case "update": {
|
|
98
|
+
const step = findAlive(op.stepId);
|
|
99
|
+
if (!step) return `스텝 "${op.stepId}"이(가) 없습니다.`;
|
|
100
|
+
if (op.nodeDefinitionId !== void 0) {
|
|
101
|
+
var _op$stepType, _op$config2;
|
|
102
|
+
const nextType = (_op$stepType = op.stepType) !== null && _op$stepType !== void 0 ? _op$stepType : require_step_type_for_node.stepTypeForNode(op.nodeDefinitionId);
|
|
103
|
+
if (step.type === "trigger" !== (nextType === "trigger")) return "트리거와 다른 종류는 서로 바꿀 수 없습니다 — 트리거는 트리거 노드로만 교체하세요.";
|
|
104
|
+
return validateStepConfig({
|
|
105
|
+
type: nextType,
|
|
106
|
+
nodeDefinitionId: op.nodeDefinitionId,
|
|
107
|
+
config: (_op$config2 = op.config) !== null && _op$config2 !== void 0 ? _op$config2 : {}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (op.config === void 0) return null;
|
|
111
|
+
return validateStepConfig({
|
|
112
|
+
type: step.type,
|
|
113
|
+
nodeDefinitionId: step.nodeDefinitionId,
|
|
114
|
+
config: require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2({}, step.config), op.config)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
case "delete": return alive(op.stepId) ? null : `스텝 "${op.stepId}"이(가) 없습니다.`;
|
|
118
|
+
case "connect": {
|
|
119
|
+
const from = findAlive(op.fromStepId);
|
|
120
|
+
const to = findAlive(op.toStepId);
|
|
121
|
+
if (!from || !to) return `연결할 스텝이 없습니다: ${[!from && op.fromStepId, !to && op.toStepId].filter(Boolean).join(", ")}.`;
|
|
122
|
+
if (preview.previewConnections.some((c) => c.fromStepId === from.id && c.toStepId === to.id && preview.statusByConnectionId.get(c.id) === "deleted")) return null;
|
|
123
|
+
return require_workflow_preview.validateConnection(from, to, preview.previewConnections.filter((c) => preview.statusByConnectionId.get(c.id) !== "deleted"));
|
|
124
|
+
}
|
|
125
|
+
case "deleteConnection": return preview.previewConnections.some((c) => c.id === op.connectionId && preview.statusByConnectionId.get(c.id) !== "deleted") ? null : `연결 "${op.connectionId}"이(가) 없습니다. 현재 그래프의 연결 id를 쓰세요.`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
apply(rawOp) {
|
|
130
|
+
const op = (rawOp.kind === "add" || rawOp.kind === "update") && rawOp.nodeDefinitionId ? require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2({}, rawOp), {}, { stepType: require_step_type_for_node.stepTypeForNode(rawOp.nodeDefinitionId) }) : rawOp;
|
|
131
|
+
const error = reject(op);
|
|
132
|
+
if (error) return {
|
|
133
|
+
ok: false,
|
|
134
|
+
error
|
|
135
|
+
};
|
|
136
|
+
const before = preview;
|
|
137
|
+
const beforeIssues = issueKeys(before, gridSize);
|
|
138
|
+
const next = require_workflow_preview.computePreviewGraph(input.steps, input.connections, [...ops, op]);
|
|
139
|
+
ops.push(op);
|
|
140
|
+
preview = next;
|
|
141
|
+
const warnings = next.warnings.slice(before.warnings.length);
|
|
142
|
+
const issues = [];
|
|
143
|
+
for (const [id, message] of issueKeys(next, gridSize)) {
|
|
144
|
+
if (beforeIssues.has(id)) continue;
|
|
145
|
+
const stepId = id.split(":")[1];
|
|
146
|
+
const where = describeStep(next, stepId);
|
|
147
|
+
issues.push(where ? `${where}: ${message}` : message);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
ok: true,
|
|
151
|
+
warnings,
|
|
152
|
+
issues,
|
|
153
|
+
op
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
appliedGraph: () => require_workflow_preview.selectAppliedGraph(preview)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// src/engine/failure-kind.ts
|
|
160
|
+
/**
|
|
161
|
+
* 실패 종류(`FailureKind`) — **에러 클래스가 사라지기 전에** 붙잡아 두는 타입 신호.
|
|
162
|
+
*
|
|
163
|
+
* 🔴 왜 필요한가: 스텝 실패는 `StepExecutionResult.error`에 **문자열 하나**로만 남는다.
|
|
164
|
+
* 그 순간 `FatalError`/`RetryableError`/`TimeoutError`/`SsrfBlockedError`의 구분이
|
|
165
|
+
* 통째로 증발하고, 나중에 원인을 가르려면 한국어 문장을 정규식으로 더듬는 수밖에 없다
|
|
166
|
+
* (문구가 바뀌면 조용히 오분류된다 — 진단을 문구로 하지 말라는 규율과 정확히 반대).
|
|
167
|
+
*
|
|
168
|
+
* 그래서 **던진 쪽이 아는 사실**을 그 자리에서 타입으로 적는다. 실패 분석기는
|
|
169
|
+
* 문자열이 아니라 이 필드를 먼저 본다.
|
|
170
|
+
*
|
|
171
|
+
* 🔑 `unknown`은 "분류 실패"가 아니라 **"우리 코드가 만든 에러가 아니다"**라는 사실이다
|
|
172
|
+
* (외부 서비스 응답, 사용자 코드 예외, 프로바이더 SDK 에러). 0과 모름을 구분하듯
|
|
173
|
+
* 이 둘을 같은 값으로 적지 않는다 — 실패 분석기가 모델을 부를지 말지가 여기서 갈린다.
|
|
174
|
+
*/
|
|
175
|
+
const FAILURE_KINDS = [
|
|
176
|
+
"fatal",
|
|
177
|
+
"retryable",
|
|
178
|
+
"timeout",
|
|
179
|
+
"aborted",
|
|
180
|
+
"blocked-address",
|
|
181
|
+
"invalid-config",
|
|
182
|
+
"missing-handler",
|
|
183
|
+
"unknown"
|
|
184
|
+
];
|
|
185
|
+
exports.AI_TEXT_STREAM_NAMESPACE = require_ai_stream.AI_TEXT_STREAM_NAMESPACE;
|
|
186
|
+
exports.BRANCH_TYPE_COLORS = require_ai_stream.BRANCH_TYPE_COLORS;
|
|
187
|
+
exports.CELL_GAP = require_ai_stream.CELL_GAP;
|
|
188
|
+
exports.CELL_HEIGHT = require_ai_stream.CELL_HEIGHT;
|
|
189
|
+
exports.CELL_PITCH_X = require_ai_stream.CELL_PITCH_X;
|
|
190
|
+
exports.CELL_PITCH_Y = require_ai_stream.CELL_PITCH_Y;
|
|
191
|
+
exports.CELL_WIDTH = require_ai_stream.CELL_WIDTH;
|
|
192
|
+
exports.EMPTY_GRID_WORKFLOW_DEFINITION = require_ai_stream.EMPTY_GRID_WORKFLOW_DEFINITION;
|
|
193
|
+
exports.FAILURE_CAUSES = require_workflow_preview.FAILURE_CAUSES;
|
|
194
|
+
exports.FAILURE_CAUSE_COPY = require_workflow_preview.FAILURE_CAUSE_COPY;
|
|
195
|
+
exports.FAILURE_KINDS = FAILURE_KINDS;
|
|
196
|
+
exports.GRID_SIZE = require_ai_stream.GRID_SIZE;
|
|
197
|
+
exports.IDENTITY_TRANSFORM = require_workflow_preview.IDENTITY_TRANSFORM;
|
|
198
|
+
exports.MAX_COLS = require_ai_stream.MAX_COLS;
|
|
199
|
+
exports.MAX_GRID_COLS = require_ai_stream.MAX_GRID_COLS;
|
|
200
|
+
exports.MAX_GRID_ROWS = require_ai_stream.MAX_GRID_ROWS;
|
|
201
|
+
exports.MAX_ROWS = require_ai_stream.MAX_ROWS;
|
|
202
|
+
exports.MAX_STEPS = require_ai_stream.MAX_STEPS;
|
|
203
|
+
exports.MIN_COLS = require_ai_stream.MIN_COLS;
|
|
204
|
+
exports.MIN_ROWS = require_ai_stream.MIN_ROWS;
|
|
205
|
+
exports.MULTI_OUTGOING_STEP_TYPES = require_workflow_preview.MULTI_OUTGOING_STEP_TYPES;
|
|
206
|
+
exports.STEP_TYPE_COLORS = require_ai_stream.STEP_TYPE_COLORS;
|
|
207
|
+
exports.VARIABLE_TOKEN_PATTERN = require_workflow_preview.VARIABLE_TOKEN_PATTERN;
|
|
208
|
+
exports.aggregateStepMetrics = require_workflow_preview.aggregateStepMetrics;
|
|
209
|
+
exports.branchTypeSchema = require_ai_stream.branchTypeSchema;
|
|
210
|
+
exports.buildVariableTree = require_workflow_preview.buildVariableTree;
|
|
211
|
+
exports.buildWorkflowBrief = require_workflow_preview.buildWorkflowBrief;
|
|
212
|
+
exports.cellToViewportRect = require_workflow_preview.cellToViewportRect;
|
|
213
|
+
exports.collectUnresolvedVariables = require_branch_resolver.collectUnresolvedVariables;
|
|
214
|
+
exports.computePreviewGraph = require_workflow_preview.computePreviewGraph;
|
|
215
|
+
exports.contentToViewport = require_workflow_preview.contentToViewport;
|
|
216
|
+
exports.createThrottledEmitter = require_ai_stream.createThrottledEmitter;
|
|
217
|
+
exports.createWorkflowProposalSession = createWorkflowProposalSession;
|
|
218
|
+
exports.cycleStepConnection = require_workflow_preview.cycleStepConnection;
|
|
219
|
+
exports.defineTemplate = require_define_template.defineTemplate;
|
|
220
|
+
exports.deriveGridBounds = require_ai_stream.deriveGridBounds;
|
|
221
|
+
exports.deriveRunPath = require_workflow_preview.deriveRunPath;
|
|
222
|
+
exports.evaluateCondition = require_branch_resolver.evaluateCondition;
|
|
223
|
+
exports.evaluateConditionGroup = require_branch_resolver.evaluateConditionGroup;
|
|
224
|
+
exports.evaluateConditionWithDetails = require_branch_resolver.evaluateConditionWithDetails;
|
|
225
|
+
exports.exportTemplate = require_workflow_preview.exportTemplate;
|
|
226
|
+
exports.exportTemplateSchema = require_ai_stream.exportTemplateSchema;
|
|
227
|
+
exports.extractBranchInfo = require_branch_resolver.extractBranchInfo;
|
|
228
|
+
exports.extractVariablePaths = require_branch_resolver.extractVariablePaths;
|
|
229
|
+
exports.findBrokenStepRefs = require_workflow_preview.findBrokenStepRefs;
|
|
230
|
+
exports.findFailedStep = require_workflow_preview.findFailedStep;
|
|
231
|
+
exports.findFreeAdjacentCell = require_workflow_preview.findFreeAdjacentCell;
|
|
232
|
+
exports.findFreeCommonNeighbor = require_workflow_preview.findFreeCommonNeighbor;
|
|
233
|
+
exports.findNearestFreeCell = require_workflow_preview.findNearestFreeCell;
|
|
234
|
+
exports.findRunBlockers = require_workflow_preview.findRunBlockers;
|
|
235
|
+
exports.findStepInDirection = require_workflow_preview.findStepInDirection;
|
|
236
|
+
exports.findUnsupportedConditionExpression = require_branch_resolver.findUnsupportedConditionExpression;
|
|
237
|
+
exports.findWorkflowSetupProblems = require_workflow_preview.findWorkflowSetupProblems;
|
|
238
|
+
exports.flattenFields = require_workflow_preview.flattenFields;
|
|
239
|
+
exports.formatDurationMs = require_workflow_preview.formatDurationMs;
|
|
240
|
+
exports.formatShare = require_workflow_preview.formatShare;
|
|
241
|
+
exports.getAdjacentPosition = require_ai_stream.getAdjacentPosition;
|
|
242
|
+
exports.getBranchLabel = require_branch_resolver.getBranchLabel;
|
|
243
|
+
exports.getCellCenter = require_workflow_preview.getCellCenter;
|
|
244
|
+
exports.getCellEdge = require_workflow_preview.getCellEdge;
|
|
245
|
+
exports.getCellOrigin = require_workflow_preview.getCellOrigin;
|
|
246
|
+
exports.getConnectionDirection = require_ai_stream.getConnectionDirection;
|
|
247
|
+
exports.getConnectionFarEnd = require_workflow_preview.getConnectionFarEnd;
|
|
248
|
+
exports.getContentSize = require_workflow_preview.getContentSize;
|
|
249
|
+
exports.getStepSummary = require_workflow_preview.getStepSummary;
|
|
250
|
+
exports.getStepsRect = require_workflow_preview.getStepsRect;
|
|
251
|
+
exports.getUpstreamSteps = require_workflow_preview.getUpstreamSteps;
|
|
252
|
+
exports.getWorkflowPreflight = require_workflow_preview.getWorkflowPreflight;
|
|
253
|
+
exports.gridConnectionSchema = require_ai_stream.gridConnectionSchema;
|
|
254
|
+
exports.gridPositionSchema = require_ai_stream.gridPositionSchema;
|
|
255
|
+
exports.gridStepSchema = require_ai_stream.gridStepSchema;
|
|
256
|
+
exports.gridStepTypeSchema = require_ai_stream.gridStepTypeSchema;
|
|
257
|
+
exports.gridWorkflowDefinitionSchema = require_ai_stream.gridWorkflowDefinitionSchema;
|
|
258
|
+
exports.hasCycle = require_ai_stream.hasCycle;
|
|
259
|
+
exports.hasVariables = require_branch_resolver.hasVariables;
|
|
260
|
+
exports.importTemplate = require_workflow_preview.importTemplate;
|
|
261
|
+
exports.indexToPosition = require_ai_stream.indexToPosition;
|
|
262
|
+
exports.isAiTextStreamData = require_ai_stream.isAiTextStreamData;
|
|
263
|
+
exports.isSamePosition = require_ai_stream.isSamePosition;
|
|
264
|
+
exports.isValidPosition = require_ai_stream.isValidPosition;
|
|
265
|
+
exports.isWithinBounds = require_ai_stream.isWithinBounds;
|
|
266
|
+
exports.isWithinHardCap = require_ai_stream.isWithinHardCap;
|
|
267
|
+
exports.listStepConnections = require_workflow_preview.listStepConnections;
|
|
268
|
+
exports.maskPiiDeep = require_workflow_preview.maskPiiDeep;
|
|
269
|
+
exports.maskPiiString = require_workflow_preview.maskPiiString;
|
|
270
|
+
exports.mergeBounds = require_ai_stream.mergeBounds;
|
|
271
|
+
exports.missingRequiredFields = require_workflow_preview.missingRequiredFields;
|
|
272
|
+
exports.normalizeConditionConfig = require_branch_resolver.normalizeConditionConfig;
|
|
273
|
+
exports.orderStepsByFlow = require_workflow_preview.orderStepsByFlow;
|
|
274
|
+
exports.orderStepsForPreview = require_workflow_preview.orderStepsForPreview;
|
|
275
|
+
exports.parseChoiceList = require_ai_stream.parseChoiceList;
|
|
276
|
+
exports.parseGridWorkflowDefinition = require_ai_stream.parseGridWorkflowDefinition;
|
|
277
|
+
exports.parseGridWorkflowDefinitionStrict = require_ai_stream.parseGridWorkflowDefinitionStrict;
|
|
278
|
+
exports.positionToIndex = require_ai_stream.positionToIndex;
|
|
279
|
+
exports.resolveBranchPath = require_branch_resolver.resolveBranchPath;
|
|
280
|
+
exports.resolveCatalogNode = resolveCatalogNode;
|
|
281
|
+
exports.resolveConnectionFocus = require_workflow_preview.resolveConnectionFocus;
|
|
282
|
+
exports.resolveObjectVariables = require_branch_resolver.resolveObjectVariables;
|
|
283
|
+
exports.resolvePromptVariables = require_branch_resolver.resolvePromptVariables;
|
|
284
|
+
exports.resolveValueReference = require_branch_resolver.resolveValueReference;
|
|
285
|
+
exports.resolveVariableValue = require_branch_resolver.resolveVariableValue;
|
|
286
|
+
exports.resolveVariables = require_branch_resolver.resolveVariables;
|
|
287
|
+
exports.roundedPath = require_workflow_preview.roundedPath;
|
|
288
|
+
exports.routeConnection = require_workflow_preview.routeConnection;
|
|
289
|
+
exports.routeLabelFallbackPoint = require_workflow_preview.routeLabelFallbackPoint;
|
|
290
|
+
exports.routeLabelPoint = require_workflow_preview.routeLabelPoint;
|
|
291
|
+
exports.selectAppliedGraph = require_workflow_preview.selectAppliedGraph;
|
|
292
|
+
exports.serializeTemplate = require_workflow_preview.serializeTemplate;
|
|
293
|
+
exports.triageFailedStep = require_workflow_preview.triageFailedStep;
|
|
294
|
+
exports.validateBranchConnections = require_branch_resolver.validateBranchConnections;
|
|
295
|
+
exports.validateConditionConfig = require_branch_resolver.validateConditionConfig;
|
|
296
|
+
exports.validateConnection = require_workflow_preview.validateConnection;
|
|
297
|
+
exports.validateStepConfig = validateStepConfig;
|
|
298
|
+
exports.validateWorkflowDefinition = require_workflow_preview.validateWorkflowDefinition;
|
|
299
|
+
exports.viewportPointToCell = require_workflow_preview.viewportPointToCell;
|
|
300
|
+
exports.viewportToContent = require_workflow_preview.viewportToContent;
|
|
301
|
+
exports.visibleConfigFields = require_workflow_preview.visibleConfigFields;
|
package/dist/core.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { A as getConnectionDirection, C as MAX_GRID_COLS, D as STEP_TYPE_COLORS, E as PreviewStatus, F as positionToIndex, M as indexToPosition, N as isSamePosition, O as WorkflowTemplate, P as isValidPosition, S as HistoryItem, T as MAX_STEPS, _ as GridStep, a as CELL_PITCH_X, b as GridWorkflowDto, c as ConditionType, d as GRID_SIZE, f as GridCellState, g as GridSelectionState, h as GridPosition, i as CELL_HEIGHT, j as hasCycle, k as getAdjacentPosition, l as ConnectionDirection, m as GridEditorState, n as BranchType, o as CELL_PITCH_Y, p as GridConnection, r as CELL_GAP, s as CELL_WIDTH, t as BRANCH_TYPE_COLORS, u as ConnectionModeState, v as GridStepType, w as MAX_GRID_ROWS, x as HistoryActionType, y as GridWorkflowDefinition } from "./grid-workflow-dto-C86EArJP.cjs";
|
|
2
|
+
import { a as ExecutionPath, c as StepExecutionResult, d as WorkflowExecutionContext, f as WorkflowExecutionOptions, h as FailureKind, i as ExecutionGraphNode, l as StepExecutionStatus, m as FAILURE_KINDS, n as ExecutionEvent, o as ResolvedValue, p as WorkflowExecutionResult, r as ExecutionEventType, s as StepExecutionRecord, t as ConditionEvalDetails, u as TriggerSource } from "./execution-context-DVeybULC.cjs";
|
|
3
|
+
import { $ as selectAppliedGraph, $t as parseGridWorkflowDefinitionStrict, A as triageFailedStep, At as IDENTITY_TRANSFORM, B as exportTemplate, Bt as viewportPointToCell, C as FAILURE_CAUSE_COPY, Ct as cycleStepConnection, D as ResidualFailure, Dt as orderStepsByFlow, E as FailureTriage, Et as listStepConnections, F as parseChoiceList, Ft as getCellCenter, G as ProposalOpResult, Gt as MIN_COLS, H as serializeTemplate, Ht as GridBounds, I as ImportResult, It as getCellEdge, J as resolveCatalogNode, Jt as isWithinBounds, K as WorkflowProposalSession, Kt as MIN_ROWS, L as ValidationError, Lt as getCellOrigin, M as AiTextStreamData, Mt as ViewportTransform, N as createThrottledEmitter, Nt as cellToViewportRect, O as TriageOutcome, Ot as resolveConnectionFocus, P as isAiTextStreamData, Pt as contentToViewport, Q as computePreviewGraph, Qt as parseGridWorkflowDefinition, R as ValidationResult, Rt as getContentSize, S as defineTemplate, St as ConnectionFocus, T as FailureCause, Tt as getConnectionFarEnd, U as validateWorkflowDefinition, Ut as MAX_COLS, V as importTemplate, Vt as viewportToContent, W as buildWorkflowBrief, Wt as MAX_ROWS, X as PreviewGraph, Xt as mergeBounds, Y as validateStepConfig, Yt as isWithinHardCap, Z as WorkflowProposalOp, Zt as EMPTY_GRID_WORKFLOW_DEFINITION, _ as validateConditionConfig, _n as ConditionConfig, _t as routeLabelPoint, a as hasVariables, an as GridPositionOutput, at as ConnectionRunStatus, b as resolveBranchPath, bt as findNearestFreeCell, c as resolveValueReference, cn as GridWorkflowDefinitionInput, ct as deriveRunPath, d as ConditionResult, dn as exportTemplateSchema, dt as PreviewStep, en as ExportTemplateInput, et as missingRequiredFields, f as evaluateCondition, fn as gridConnectionSchema, ft as orderStepsForPreview, g as normalizeConditionConfig, gn as gridWorkflowDefinitionSchema, gt as routeLabelFallbackPoint, h as findUnsupportedConditionExpression, hn as gridStepTypeSchema, ht as routeConnection, i as extractVariablePaths, in as GridPositionInput, it as getStepSummary, j as AI_TEXT_STREAM_NAMESPACE, jt as Point, k as findFailedStep, kt as ContentRect, l as resolveVariableValue, ln as GridWorkflowDefinitionOutput, lt as findRunBlockers, m as evaluateConditionWithDetails, mn as gridStepSchema, mt as roundedPath, n as maskPiiString, nn as GridConnectionInput, nt as WorkflowSetupProblem, o as resolveObjectVariables, on as GridStepInput, ot as RunPath, p as evaluateConditionGroup, pn as gridPositionSchema, pt as IsCellOccupied, q as createWorkflowProposalSession, qt as deriveGridBounds, r as collectUnresolvedVariables, rn as GridConnectionOutput, rt as findWorkflowSetupProblems, s as resolvePromptVariables, sn as GridStepOutput, st as RunPathStepState, t as maskPiiDeep, tn as ExportTemplateOutput, tt as visibleConfigFields, u as resolveVariables, un as branchTypeSchema, ut as OrderedPreviewSteps, v as extractBranchInfo, vn as ConditionGroup, vt as findFreeAdjacentCell, w as FAILURE_CAUSES, wt as findStepInDirection, x as validateBranchConnections, xt as validateConnection, y as getBranchLabel, yn as SingleCondition, yt as findFreeCommonNeighbor, z as ValidationWarning, zt as getStepsRect } from "./core-CtqBb-6v.cjs";
|
|
4
|
+
import { S as formatShare, _ as RunStepSample, a as TemplateMetadata, b as aggregateStepMetrics, c as getWorkflowPreflight, d as VariableTreeGroup, f as VariableTreeItem, g as getUpstreamSteps, h as flattenFields, i as TemplateIconKey, l as VARIABLE_TOKEN_PATTERN, m as findBrokenStepRefs, n as TemplateCategory, o as MULTI_OUTGOING_STEP_TYPES, p as buildVariableTree, r as TemplateDefinition, s as WorkflowPreflightIssue, t as ExtendedWorkflowTemplate, u as VariableRefIssue, v as StepMetric, x as formatDurationMs, y as WorkflowStepMetrics } from "./types-Bj0VWFny.cjs";
|
|
5
|
+
export { AI_TEXT_STREAM_NAMESPACE, AiTextStreamData, BRANCH_TYPE_COLORS, BranchType, CELL_GAP, CELL_HEIGHT, CELL_PITCH_X, CELL_PITCH_Y, CELL_WIDTH, ConditionConfig, ConditionEvalDetails, ConditionGroup, ConditionResult, ConditionType, ConnectionDirection, ConnectionFocus, ConnectionModeState, ConnectionRunStatus, ContentRect, EMPTY_GRID_WORKFLOW_DEFINITION, ExecutionEvent, ExecutionEventType, ExecutionGraphNode, ExecutionPath, ExportTemplateInput, ExportTemplateOutput, ExtendedWorkflowTemplate, FAILURE_CAUSES, FAILURE_CAUSE_COPY, FAILURE_KINDS, FailureCause, FailureKind, FailureTriage, GRID_SIZE, GridBounds, GridCellState, GridConnection, GridConnectionInput, GridConnectionOutput, GridEditorState, GridPosition, GridPositionInput, GridPositionOutput, GridSelectionState, GridStep, GridStepInput, GridStepOutput, GridStepType, GridWorkflowDefinition, GridWorkflowDefinitionInput, GridWorkflowDefinitionOutput, GridWorkflowDto, HistoryActionType, HistoryItem, IDENTITY_TRANSFORM, ImportResult, IsCellOccupied, MAX_COLS, MAX_GRID_COLS, MAX_GRID_ROWS, MAX_ROWS, MAX_STEPS, MIN_COLS, MIN_ROWS, MULTI_OUTGOING_STEP_TYPES, OrderedPreviewSteps, Point, PreviewGraph, PreviewStatus, PreviewStep, ProposalOpResult, ResidualFailure, ResolvedValue, RunPath, RunPathStepState, RunStepSample, STEP_TYPE_COLORS, SingleCondition, StepExecutionRecord, StepExecutionResult, StepExecutionStatus, StepMetric, TemplateCategory, TemplateDefinition, TemplateIconKey, TemplateMetadata, TriageOutcome, TriggerSource, VARIABLE_TOKEN_PATTERN, ValidationError, ValidationResult, ValidationWarning, VariableRefIssue, VariableTreeGroup, VariableTreeItem, ViewportTransform, WorkflowExecutionContext, WorkflowExecutionOptions, WorkflowExecutionResult, WorkflowPreflightIssue, WorkflowProposalOp, WorkflowProposalSession, WorkflowSetupProblem, WorkflowStepMetrics, WorkflowTemplate, aggregateStepMetrics, branchTypeSchema, buildVariableTree, buildWorkflowBrief, cellToViewportRect, collectUnresolvedVariables, computePreviewGraph, contentToViewport, createThrottledEmitter, createWorkflowProposalSession, cycleStepConnection, defineTemplate, deriveGridBounds, deriveRunPath, evaluateCondition, evaluateConditionGroup, evaluateConditionWithDetails, exportTemplate, exportTemplateSchema, extractBranchInfo, extractVariablePaths, findBrokenStepRefs, findFailedStep, findFreeAdjacentCell, findFreeCommonNeighbor, findNearestFreeCell, findRunBlockers, findStepInDirection, findUnsupportedConditionExpression, findWorkflowSetupProblems, flattenFields, formatDurationMs, formatShare, getAdjacentPosition, getBranchLabel, getCellCenter, getCellEdge, getCellOrigin, getConnectionDirection, getConnectionFarEnd, getContentSize, getStepSummary, getStepsRect, getUpstreamSteps, getWorkflowPreflight, gridConnectionSchema, gridPositionSchema, gridStepSchema, gridStepTypeSchema, gridWorkflowDefinitionSchema, hasCycle, hasVariables, importTemplate, indexToPosition, isAiTextStreamData, isSamePosition, isValidPosition, isWithinBounds, isWithinHardCap, listStepConnections, maskPiiDeep, maskPiiString, mergeBounds, missingRequiredFields, normalizeConditionConfig, orderStepsByFlow, orderStepsForPreview, parseChoiceList, parseGridWorkflowDefinition, parseGridWorkflowDefinitionStrict, positionToIndex, resolveBranchPath, resolveCatalogNode, resolveConnectionFocus, resolveObjectVariables, resolvePromptVariables, resolveValueReference, resolveVariableValue, resolveVariables, roundedPath, routeConnection, routeLabelFallbackPoint, routeLabelPoint, selectAppliedGraph, serializeTemplate, triageFailedStep, validateBranchConnections, validateConditionConfig, validateConnection, validateStepConfig, validateWorkflowDefinition, viewportPointToCell, viewportToContent, visibleConfigFields };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { A as getConnectionDirection, C as MAX_GRID_COLS, D as STEP_TYPE_COLORS, E as PreviewStatus, F as positionToIndex, M as indexToPosition, N as isSamePosition, O as WorkflowTemplate, P as isValidPosition, S as HistoryItem, T as MAX_STEPS, _ as GridStep, a as CELL_PITCH_X, b as GridWorkflowDto, c as ConditionType, d as GRID_SIZE, f as GridCellState, g as GridSelectionState, h as GridPosition, i as CELL_HEIGHT, j as hasCycle, k as getAdjacentPosition, l as ConnectionDirection, m as GridEditorState, n as BranchType, o as CELL_PITCH_Y, p as GridConnection, r as CELL_GAP, s as CELL_WIDTH, t as BRANCH_TYPE_COLORS, u as ConnectionModeState, v as GridStepType, w as MAX_GRID_ROWS, x as HistoryActionType, y as GridWorkflowDefinition } from "./grid-workflow-dto-C86EArJP.js";
|
|
2
|
+
import { a as ExecutionPath, c as StepExecutionResult, d as WorkflowExecutionContext, f as WorkflowExecutionOptions, h as FailureKind, i as ExecutionGraphNode, l as StepExecutionStatus, m as FAILURE_KINDS, n as ExecutionEvent, o as ResolvedValue, p as WorkflowExecutionResult, r as ExecutionEventType, s as StepExecutionRecord, t as ConditionEvalDetails, u as TriggerSource } from "./execution-context-YFTRCj0y.js";
|
|
3
|
+
import { $ as selectAppliedGraph, $t as parseGridWorkflowDefinitionStrict, A as triageFailedStep, At as IDENTITY_TRANSFORM, B as exportTemplate, Bt as viewportPointToCell, C as FAILURE_CAUSE_COPY, Ct as cycleStepConnection, D as ResidualFailure, Dt as orderStepsByFlow, E as FailureTriage, Et as listStepConnections, F as parseChoiceList, Ft as getCellCenter, G as ProposalOpResult, Gt as MIN_COLS, H as serializeTemplate, Ht as GridBounds, I as ImportResult, It as getCellEdge, J as resolveCatalogNode, Jt as isWithinBounds, K as WorkflowProposalSession, Kt as MIN_ROWS, L as ValidationError, Lt as getCellOrigin, M as AiTextStreamData, Mt as ViewportTransform, N as createThrottledEmitter, Nt as cellToViewportRect, O as TriageOutcome, Ot as resolveConnectionFocus, P as isAiTextStreamData, Pt as contentToViewport, Q as computePreviewGraph, Qt as parseGridWorkflowDefinition, R as ValidationResult, Rt as getContentSize, S as defineTemplate, St as ConnectionFocus, T as FailureCause, Tt as getConnectionFarEnd, U as validateWorkflowDefinition, Ut as MAX_COLS, V as importTemplate, Vt as viewportToContent, W as buildWorkflowBrief, Wt as MAX_ROWS, X as PreviewGraph, Xt as mergeBounds, Y as validateStepConfig, Yt as isWithinHardCap, Z as WorkflowProposalOp, Zt as EMPTY_GRID_WORKFLOW_DEFINITION, _ as validateConditionConfig, _n as ConditionConfig, _t as routeLabelPoint, a as hasVariables, an as GridPositionOutput, at as ConnectionRunStatus, b as resolveBranchPath, bt as findNearestFreeCell, c as resolveValueReference, cn as GridWorkflowDefinitionInput, ct as deriveRunPath, d as ConditionResult, dn as exportTemplateSchema, dt as PreviewStep, en as ExportTemplateInput, et as missingRequiredFields, f as evaluateCondition, fn as gridConnectionSchema, ft as orderStepsForPreview, g as normalizeConditionConfig, gn as gridWorkflowDefinitionSchema, gt as routeLabelFallbackPoint, h as findUnsupportedConditionExpression, hn as gridStepTypeSchema, ht as routeConnection, i as extractVariablePaths, in as GridPositionInput, it as getStepSummary, j as AI_TEXT_STREAM_NAMESPACE, jt as Point, k as findFailedStep, kt as ContentRect, l as resolveVariableValue, ln as GridWorkflowDefinitionOutput, lt as findRunBlockers, m as evaluateConditionWithDetails, mn as gridStepSchema, mt as roundedPath, n as maskPiiString, nn as GridConnectionInput, nt as WorkflowSetupProblem, o as resolveObjectVariables, on as GridStepInput, ot as RunPath, p as evaluateConditionGroup, pn as gridPositionSchema, pt as IsCellOccupied, q as createWorkflowProposalSession, qt as deriveGridBounds, r as collectUnresolvedVariables, rn as GridConnectionOutput, rt as findWorkflowSetupProblems, s as resolvePromptVariables, sn as GridStepOutput, st as RunPathStepState, t as maskPiiDeep, tn as ExportTemplateOutput, tt as visibleConfigFields, u as resolveVariables, un as branchTypeSchema, ut as OrderedPreviewSteps, v as extractBranchInfo, vn as ConditionGroup, vt as findFreeAdjacentCell, w as FAILURE_CAUSES, wt as findStepInDirection, x as validateBranchConnections, xt as validateConnection, y as getBranchLabel, yn as SingleCondition, yt as findFreeCommonNeighbor, z as ValidationWarning, zt as getStepsRect } from "./core-z3nXmUBj.js";
|
|
4
|
+
import { S as formatShare, _ as RunStepSample, a as TemplateMetadata, b as aggregateStepMetrics, c as getWorkflowPreflight, d as VariableTreeGroup, f as VariableTreeItem, g as getUpstreamSteps, h as flattenFields, i as TemplateIconKey, l as VARIABLE_TOKEN_PATTERN, m as findBrokenStepRefs, n as TemplateCategory, o as MULTI_OUTGOING_STEP_TYPES, p as buildVariableTree, r as TemplateDefinition, s as WorkflowPreflightIssue, t as ExtendedWorkflowTemplate, u as VariableRefIssue, v as StepMetric, x as formatDurationMs, y as WorkflowStepMetrics } from "./types-DQcmIuAl.js";
|
|
5
|
+
export { AI_TEXT_STREAM_NAMESPACE, AiTextStreamData, BRANCH_TYPE_COLORS, BranchType, CELL_GAP, CELL_HEIGHT, CELL_PITCH_X, CELL_PITCH_Y, CELL_WIDTH, ConditionConfig, ConditionEvalDetails, ConditionGroup, ConditionResult, ConditionType, ConnectionDirection, ConnectionFocus, ConnectionModeState, ConnectionRunStatus, ContentRect, EMPTY_GRID_WORKFLOW_DEFINITION, ExecutionEvent, ExecutionEventType, ExecutionGraphNode, ExecutionPath, ExportTemplateInput, ExportTemplateOutput, ExtendedWorkflowTemplate, FAILURE_CAUSES, FAILURE_CAUSE_COPY, FAILURE_KINDS, FailureCause, FailureKind, FailureTriage, GRID_SIZE, GridBounds, GridCellState, GridConnection, GridConnectionInput, GridConnectionOutput, GridEditorState, GridPosition, GridPositionInput, GridPositionOutput, GridSelectionState, GridStep, GridStepInput, GridStepOutput, GridStepType, GridWorkflowDefinition, GridWorkflowDefinitionInput, GridWorkflowDefinitionOutput, GridWorkflowDto, HistoryActionType, HistoryItem, IDENTITY_TRANSFORM, ImportResult, IsCellOccupied, MAX_COLS, MAX_GRID_COLS, MAX_GRID_ROWS, MAX_ROWS, MAX_STEPS, MIN_COLS, MIN_ROWS, MULTI_OUTGOING_STEP_TYPES, OrderedPreviewSteps, Point, PreviewGraph, PreviewStatus, PreviewStep, ProposalOpResult, ResidualFailure, ResolvedValue, RunPath, RunPathStepState, RunStepSample, STEP_TYPE_COLORS, SingleCondition, StepExecutionRecord, StepExecutionResult, StepExecutionStatus, StepMetric, TemplateCategory, TemplateDefinition, TemplateIconKey, TemplateMetadata, TriageOutcome, TriggerSource, VARIABLE_TOKEN_PATTERN, ValidationError, ValidationResult, ValidationWarning, VariableRefIssue, VariableTreeGroup, VariableTreeItem, ViewportTransform, WorkflowExecutionContext, WorkflowExecutionOptions, WorkflowExecutionResult, WorkflowPreflightIssue, WorkflowProposalOp, WorkflowProposalSession, WorkflowSetupProblem, WorkflowStepMetrics, WorkflowTemplate, aggregateStepMetrics, branchTypeSchema, buildVariableTree, buildWorkflowBrief, cellToViewportRect, collectUnresolvedVariables, computePreviewGraph, contentToViewport, createThrottledEmitter, createWorkflowProposalSession, cycleStepConnection, defineTemplate, deriveGridBounds, deriveRunPath, evaluateCondition, evaluateConditionGroup, evaluateConditionWithDetails, exportTemplate, exportTemplateSchema, extractBranchInfo, extractVariablePaths, findBrokenStepRefs, findFailedStep, findFreeAdjacentCell, findFreeCommonNeighbor, findNearestFreeCell, findRunBlockers, findStepInDirection, findUnsupportedConditionExpression, findWorkflowSetupProblems, flattenFields, formatDurationMs, formatShare, getAdjacentPosition, getBranchLabel, getCellCenter, getCellEdge, getCellOrigin, getConnectionDirection, getConnectionFarEnd, getContentSize, getStepSummary, getStepsRect, getUpstreamSteps, getWorkflowPreflight, gridConnectionSchema, gridPositionSchema, gridStepSchema, gridStepTypeSchema, gridWorkflowDefinitionSchema, hasCycle, hasVariables, importTemplate, indexToPosition, isAiTextStreamData, isSamePosition, isValidPosition, isWithinBounds, isWithinHardCap, listStepConnections, maskPiiDeep, maskPiiString, mergeBounds, missingRequiredFields, normalizeConditionConfig, orderStepsByFlow, orderStepsForPreview, parseChoiceList, parseGridWorkflowDefinition, parseGridWorkflowDefinitionStrict, positionToIndex, resolveBranchPath, resolveCatalogNode, resolveConnectionFocus, resolveObjectVariables, resolvePromptVariables, resolveValueReference, resolveVariableValue, resolveVariables, roundedPath, routeConnection, routeLabelFallbackPoint, routeLabelPoint, selectAppliedGraph, serializeTemplate, triageFailedStep, validateBranchConnections, validateConditionConfig, validateConnection, validateStepConfig, validateWorkflowDefinition, viewportPointToCell, viewportToContent, visibleConfigFields };
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { A as MAX_GRID_COLS, B as positionToIndex, C as BRANCH_TYPE_COLORS, D as CELL_PITCH_Y, E as CELL_PITCH_X, F as getConnectionDirection, I as hasCycle, L as indexToPosition, M as MAX_STEPS, N as STEP_TYPE_COLORS, O as CELL_WIDTH, P as getAdjacentPosition, R as isSamePosition, S as mergeBounds, T as CELL_HEIGHT, _ as MIN_COLS, a as EMPTY_GRID_WORKFLOW_DEFINITION, b as isWithinBounds, c as branchTypeSchema, d as gridPositionSchema, f as gridStepSchema, g as MAX_ROWS, h as MAX_COLS, i as parseChoiceList, j as MAX_GRID_ROWS, k as GRID_SIZE, l as exportTemplateSchema, m as gridWorkflowDefinitionSchema, n as createThrottledEmitter, o as parseGridWorkflowDefinition, p as gridStepTypeSchema, r as isAiTextStreamData, s as parseGridWorkflowDefinitionStrict, t as AI_TEXT_STREAM_NAMESPACE, u as gridConnectionSchema, v as MIN_ROWS, w as CELL_GAP, x as isWithinHardCap, y as deriveGridBounds, z as isValidPosition } from "./ai-stream-APc3uCiQ.js";
|
|
2
|
+
import { $ as viewportPointToCell, A as routeLabelFallbackPoint, B as findStepInDirection, C as VARIABLE_TOKEN_PATTERN, D as getUpstreamSteps, E as flattenFields, F as deriveRunPath, G as IDENTITY_TRANSFORM, H as listStepConnections, I as maskPiiDeep, J as getCellCenter, K as cellToViewportRect, L as maskPiiString, M as getStepSummary, N as missingRequiredFields, O as roundedPath, P as visibleConfigFields, Q as getStepsRect, R as orderStepsForPreview, S as triageFailedStep, T as findBrokenStepRefs, U as orderStepsByFlow, V as getConnectionFarEnd, W as resolveConnectionFocus, X as getCellOrigin, Y as getCellEdge, Z as getContentSize, _ as formatDurationMs, a as findNearestFreeCell, b as FAILURE_CAUSES, c as getWorkflowPreflight, d as buildWorkflowBrief, et as viewportToContent, f as exportTemplate, g as aggregateStepMetrics, h as validateWorkflowDefinition, i as findFreeCommonNeighbor, j as routeLabelPoint, k as routeConnection, l as findWorkflowSetupProblems, m as serializeTemplate, n as selectAppliedGraph, o as validateConnection, p as importTemplate, q as contentToViewport, r as findFreeAdjacentCell, s as MULTI_OUTGOING_STEP_TYPES, t as computePreviewGraph, u as findRunBlockers, v as formatShare, w as buildVariableTree, x as findFailedStep, y as FAILURE_CAUSE_COPY, z as cycleStepConnection } from "./workflow-preview-B0kul6f-.js";
|
|
3
|
+
import { a as endDefinitions, i as conditionDefinitions, n as stepTypeForNode, r as getStepNodeDefinition } from "./step-type-for-node-Blf5DKrp.js";
|
|
4
|
+
import { t as getNodeDefinition } from "./node-definitions-C-GMfjMm.js";
|
|
5
|
+
import { r as _objectSpread2 } from "./end-node-ids-p85jFEcP.js";
|
|
6
|
+
import { t as defineTemplate } from "./define-template-BvGNB5Tv.js";
|
|
7
|
+
import { _ as resolveVariableValue, a as evaluateCondition, c as findUnsupportedConditionExpression, d as collectUnresolvedVariables, f as extractVariablePaths, g as resolveValueReference, h as resolvePromptVariables, i as validateBranchConnections, l as normalizeConditionConfig, m as resolveObjectVariables, n as getBranchLabel, o as evaluateConditionGroup, p as hasVariables, r as resolveBranchPath, s as evaluateConditionWithDetails, t as extractBranchInfo, u as validateConditionConfig, v as resolveVariables } from "./branch-resolver-BDi6Wu6m.js";
|
|
8
|
+
// src/lib/workflow-proposal-session.ts
|
|
9
|
+
/**
|
|
10
|
+
* AI 제안 세션 — 서버 도구가 op 하나를 받을 때마다 **캔버스 미리보기와 같은 계산**으로
|
|
11
|
+
* 적용해 보고, 결과를 모델에게 돌려준다. 순수 모듈(클라이언트 안전).
|
|
12
|
+
*
|
|
13
|
+
* 🔴 왜 필요한가(2026-09-23): 에이전트 도구는 op를 받는 즉시 `success: true`를 돌려줬고,
|
|
14
|
+
* 배치·연결·검증은 클라이언트 미리보기가 따로 했다. 미리보기가 "연결 못 함"·
|
|
15
|
+
* "트리거 중복"을 경고해도 그 경고는 **사용자 화면에만** 떴고 모델은 몰랐다 — 모델은
|
|
16
|
+
* 성공했다고 요약하고 사용자가 뒷정리를 했다(프로덕션 유일한 대화가 정확히 그랬다:
|
|
17
|
+
* 트리거가 있는 워크플로우에 트리거를 하나 더 얹었다).
|
|
18
|
+
*
|
|
19
|
+
* 🔑 같은 계산을 쓰는 방법: 클라이언트가 **확정 그래프(좌표 포함) + 미적용 op 목록**을
|
|
20
|
+
* 보내고, 세션은 `computePreviewGraph(확정, [...미적용, ...이번 턴 op])`를 그대로 돈다.
|
|
21
|
+
* 클라이언트 미리보기도 같은 입력(확정 + pendingOps)으로 같은 함수를 돌리므로 배치·연결
|
|
22
|
+
* 결과가 갈리지 않는다.
|
|
23
|
+
*
|
|
24
|
+
* 판정은 둘로 나뉜다:
|
|
25
|
+
* - **거절**(op를 stage하지 않는다): 없는 스텝 참조, 트리거 중복, 연결 불가(순환·
|
|
26
|
+
* 중복), 카탈로그에 없는 노드·설정 키, 보이는 필수 필드 누락. 미리보기가 조용히 버리거나
|
|
27
|
+
* 경고만 할 op를 모델이 "했다"고 믿지 않게 한다.
|
|
28
|
+
* - **새 이슈**(stage하되 알린다): 이 op가 **새로 만든** 실행 전 점검 이슈. 원래 있던
|
|
29
|
+
* 이슈까지 매번 되돌려주면 모델이 자기 탓이 아닌 것을 고치려 든다(브랜드폼 AI에서
|
|
30
|
+
* "그 패치가 새로 만든 위반만"으로 수렴한 것과 같은 이유).
|
|
31
|
+
*/
|
|
32
|
+
/** 조건 스텝이 정규화(`normalizeConditionConfig`)로 읽는 런타임 키 — 카탈로그 밖이지만 허용. */
|
|
33
|
+
const RUNTIME_CONFIG_KEYS = { condition: ["conditionType"] };
|
|
34
|
+
function resolveCatalogNode(nodeDefinitionId) {
|
|
35
|
+
var _ref, _getNodeDefinition;
|
|
36
|
+
return (_ref = (_getNodeDefinition = getNodeDefinition(nodeDefinitionId)) !== null && _getNodeDefinition !== void 0 ? _getNodeDefinition : conditionDefinitions.find((node) => node.id === nodeDefinitionId)) !== null && _ref !== void 0 ? _ref : endDefinitions.find((node) => node.id === nodeDefinitionId);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 카탈로그 설정 검증 — 모르는 키·보이는 필수 필드 누락. 에디터 저장 버튼과 같은
|
|
40
|
+
* `missingRequiredFields`를 쓴다(숨겨진 필드는 요구하지 않는다).
|
|
41
|
+
*/
|
|
42
|
+
function validateStepConfig(step) {
|
|
43
|
+
var _node$config$fields, _node$config, _RUNTIME_CONFIG_KEYS$, _step$config;
|
|
44
|
+
const node = step.nodeDefinitionId ? resolveCatalogNode(step.nodeDefinitionId) : getStepNodeDefinition(step);
|
|
45
|
+
if (!node) return step.nodeDefinitionId ? `알 수 없는 nodeDefinitionId "${step.nodeDefinitionId}". 카탈로그의 정확한 id를 쓰세요.` : null;
|
|
46
|
+
if (node.comingSoon) return `"${node.id}"는 아직 쓸 수 없는 노드입니다(연동 예정).`;
|
|
47
|
+
const fields = (_node$config$fields = (_node$config = node.config) === null || _node$config === void 0 ? void 0 : _node$config.fields) !== null && _node$config$fields !== void 0 ? _node$config$fields : [];
|
|
48
|
+
const allowed = /* @__PURE__ */ new Set([...fields.map((field) => field.key), ...(_RUNTIME_CONFIG_KEYS$ = RUNTIME_CONFIG_KEYS[step.type]) !== null && _RUNTIME_CONFIG_KEYS$ !== void 0 ? _RUNTIME_CONFIG_KEYS$ : []]);
|
|
49
|
+
const config = (_step$config = step.config) !== null && _step$config !== void 0 ? _step$config : {};
|
|
50
|
+
const unknown = Object.keys(config).filter((key) => !allowed.has(key));
|
|
51
|
+
if (unknown.length > 0) return `노드 "${node.id}"에 없는 설정 키: ${unknown.join(", ")}. 허용: ${[...allowed].join(", ") || "(없음)"}.`;
|
|
52
|
+
const missing = missingRequiredFields(fields, config);
|
|
53
|
+
if (missing.length > 0) return `필수 설정 누락: ${missing.map((field) => `${field.key}(${field.label})`).join(", ")}.`;
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function issueKeys(preview, gridSize) {
|
|
57
|
+
const applied = selectAppliedGraph(preview);
|
|
58
|
+
const definition = _objectSpread2(_objectSpread2({}, applied), {}, { gridSize });
|
|
59
|
+
return new Map(getWorkflowPreflight(definition).map((issue) => [issue.id, issue.message]));
|
|
60
|
+
}
|
|
61
|
+
/** 점검 이슈 id(`<종류>:<stepId>…`)가 가리키는 스텝의 라벨 — 스텝이 아니면 빈 문자열. */
|
|
62
|
+
function describeStep(preview, stepId) {
|
|
63
|
+
if (!stepId) return "";
|
|
64
|
+
const step = preview.previewSteps.find((s) => s.id === stepId);
|
|
65
|
+
return step ? `"${step.label}"(${step.id})` : "";
|
|
66
|
+
}
|
|
67
|
+
function createWorkflowProposalSession(input) {
|
|
68
|
+
var _input$gridSize, _input$pendingOps;
|
|
69
|
+
const gridSize = (_input$gridSize = input.gridSize) !== null && _input$gridSize !== void 0 ? _input$gridSize : 9;
|
|
70
|
+
const ops = [...(_input$pendingOps = input.pendingOps) !== null && _input$pendingOps !== void 0 ? _input$pendingOps : []];
|
|
71
|
+
let preview = computePreviewGraph(input.steps, input.connections, ops);
|
|
72
|
+
const alive = (id) => preview.previewSteps.some((s) => s.id === id && preview.statusByStepId.get(s.id) !== "deleted");
|
|
73
|
+
const findAlive = (id) => alive(id) ? preview.previewSteps.find((s) => s.id === id) : void 0;
|
|
74
|
+
function reject(op) {
|
|
75
|
+
switch (op.kind) {
|
|
76
|
+
case "add": {
|
|
77
|
+
var _op$mergeFromStepIds, _op$config;
|
|
78
|
+
if (op.afterStepId && !alive(op.afterStepId)) return `afterStepId "${op.afterStepId}" 스텝이 없습니다. 현재 그래프나 이번 턴에 받은 stepId를 쓰세요.`;
|
|
79
|
+
if (op.insertBeforeStepId) {
|
|
80
|
+
if (!op.afterStepId) return "insertBeforeStepId는 afterStepId와 함께 줘야 합니다(그 둘 사이에 넣는다).";
|
|
81
|
+
if (!preview.previewConnections.some((c) => c.fromStepId === op.afterStepId && c.toStepId === op.insertBeforeStepId && preview.statusByConnectionId.get(c.id) !== "deleted")) return `"${op.afterStepId}" → "${op.insertBeforeStepId}" 연결이 없어 사이에 넣을 수 없습니다. 끼워 넣기는 이미 이어진 두 스텝 사이에만 됩니다.`;
|
|
82
|
+
}
|
|
83
|
+
const missingMerge = ((_op$mergeFromStepIds = op.mergeFromStepIds) !== null && _op$mergeFromStepIds !== void 0 ? _op$mergeFromStepIds : []).filter((id) => !alive(id));
|
|
84
|
+
if (missingMerge.length > 0) return `mergeFromStepIds에 없는 스텝이 있습니다: ${missingMerge.join(", ")}.`;
|
|
85
|
+
if (op.stepType === "trigger") {
|
|
86
|
+
const existing = preview.previewSteps.find((s) => s.type === "trigger" && preview.statusByStepId.get(s.id) !== "deleted");
|
|
87
|
+
if (existing) return `트리거는 워크플로우당 하나입니다 — 이미 "${existing.label}"(${existing.id})가 있습니다. 바꾸려면 updateWorkflowStep으로 그 트리거를 고치거나 먼저 삭제하세요.`;
|
|
88
|
+
}
|
|
89
|
+
if (op.stepType !== "trigger" && !op.afterStepId) return "트리거가 아닌 스텝은 afterStepId(어느 스텝 다음인지)가 필요합니다.";
|
|
90
|
+
return validateStepConfig({
|
|
91
|
+
type: op.stepType,
|
|
92
|
+
nodeDefinitionId: op.nodeDefinitionId,
|
|
93
|
+
config: (_op$config = op.config) !== null && _op$config !== void 0 ? _op$config : {}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
case "update": {
|
|
97
|
+
const step = findAlive(op.stepId);
|
|
98
|
+
if (!step) return `스텝 "${op.stepId}"이(가) 없습니다.`;
|
|
99
|
+
if (op.nodeDefinitionId !== void 0) {
|
|
100
|
+
var _op$stepType, _op$config2;
|
|
101
|
+
const nextType = (_op$stepType = op.stepType) !== null && _op$stepType !== void 0 ? _op$stepType : stepTypeForNode(op.nodeDefinitionId);
|
|
102
|
+
if (step.type === "trigger" !== (nextType === "trigger")) return "트리거와 다른 종류는 서로 바꿀 수 없습니다 — 트리거는 트리거 노드로만 교체하세요.";
|
|
103
|
+
return validateStepConfig({
|
|
104
|
+
type: nextType,
|
|
105
|
+
nodeDefinitionId: op.nodeDefinitionId,
|
|
106
|
+
config: (_op$config2 = op.config) !== null && _op$config2 !== void 0 ? _op$config2 : {}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (op.config === void 0) return null;
|
|
110
|
+
return validateStepConfig({
|
|
111
|
+
type: step.type,
|
|
112
|
+
nodeDefinitionId: step.nodeDefinitionId,
|
|
113
|
+
config: _objectSpread2(_objectSpread2({}, step.config), op.config)
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
case "delete": return alive(op.stepId) ? null : `스텝 "${op.stepId}"이(가) 없습니다.`;
|
|
117
|
+
case "connect": {
|
|
118
|
+
const from = findAlive(op.fromStepId);
|
|
119
|
+
const to = findAlive(op.toStepId);
|
|
120
|
+
if (!from || !to) return `연결할 스텝이 없습니다: ${[!from && op.fromStepId, !to && op.toStepId].filter(Boolean).join(", ")}.`;
|
|
121
|
+
if (preview.previewConnections.some((c) => c.fromStepId === from.id && c.toStepId === to.id && preview.statusByConnectionId.get(c.id) === "deleted")) return null;
|
|
122
|
+
return validateConnection(from, to, preview.previewConnections.filter((c) => preview.statusByConnectionId.get(c.id) !== "deleted"));
|
|
123
|
+
}
|
|
124
|
+
case "deleteConnection": return preview.previewConnections.some((c) => c.id === op.connectionId && preview.statusByConnectionId.get(c.id) !== "deleted") ? null : `연결 "${op.connectionId}"이(가) 없습니다. 현재 그래프의 연결 id를 쓰세요.`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
apply(rawOp) {
|
|
129
|
+
const op = (rawOp.kind === "add" || rawOp.kind === "update") && rawOp.nodeDefinitionId ? _objectSpread2(_objectSpread2({}, rawOp), {}, { stepType: stepTypeForNode(rawOp.nodeDefinitionId) }) : rawOp;
|
|
130
|
+
const error = reject(op);
|
|
131
|
+
if (error) return {
|
|
132
|
+
ok: false,
|
|
133
|
+
error
|
|
134
|
+
};
|
|
135
|
+
const before = preview;
|
|
136
|
+
const beforeIssues = issueKeys(before, gridSize);
|
|
137
|
+
const next = computePreviewGraph(input.steps, input.connections, [...ops, op]);
|
|
138
|
+
ops.push(op);
|
|
139
|
+
preview = next;
|
|
140
|
+
const warnings = next.warnings.slice(before.warnings.length);
|
|
141
|
+
const issues = [];
|
|
142
|
+
for (const [id, message] of issueKeys(next, gridSize)) {
|
|
143
|
+
if (beforeIssues.has(id)) continue;
|
|
144
|
+
const stepId = id.split(":")[1];
|
|
145
|
+
const where = describeStep(next, stepId);
|
|
146
|
+
issues.push(where ? `${where}: ${message}` : message);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
ok: true,
|
|
150
|
+
warnings,
|
|
151
|
+
issues,
|
|
152
|
+
op
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
appliedGraph: () => selectAppliedGraph(preview)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// src/engine/failure-kind.ts
|
|
159
|
+
/**
|
|
160
|
+
* 실패 종류(`FailureKind`) — **에러 클래스가 사라지기 전에** 붙잡아 두는 타입 신호.
|
|
161
|
+
*
|
|
162
|
+
* 🔴 왜 필요한가: 스텝 실패는 `StepExecutionResult.error`에 **문자열 하나**로만 남는다.
|
|
163
|
+
* 그 순간 `FatalError`/`RetryableError`/`TimeoutError`/`SsrfBlockedError`의 구분이
|
|
164
|
+
* 통째로 증발하고, 나중에 원인을 가르려면 한국어 문장을 정규식으로 더듬는 수밖에 없다
|
|
165
|
+
* (문구가 바뀌면 조용히 오분류된다 — 진단을 문구로 하지 말라는 규율과 정확히 반대).
|
|
166
|
+
*
|
|
167
|
+
* 그래서 **던진 쪽이 아는 사실**을 그 자리에서 타입으로 적는다. 실패 분석기는
|
|
168
|
+
* 문자열이 아니라 이 필드를 먼저 본다.
|
|
169
|
+
*
|
|
170
|
+
* 🔑 `unknown`은 "분류 실패"가 아니라 **"우리 코드가 만든 에러가 아니다"**라는 사실이다
|
|
171
|
+
* (외부 서비스 응답, 사용자 코드 예외, 프로바이더 SDK 에러). 0과 모름을 구분하듯
|
|
172
|
+
* 이 둘을 같은 값으로 적지 않는다 — 실패 분석기가 모델을 부를지 말지가 여기서 갈린다.
|
|
173
|
+
*/
|
|
174
|
+
const FAILURE_KINDS = [
|
|
175
|
+
"fatal",
|
|
176
|
+
"retryable",
|
|
177
|
+
"timeout",
|
|
178
|
+
"aborted",
|
|
179
|
+
"blocked-address",
|
|
180
|
+
"invalid-config",
|
|
181
|
+
"missing-handler",
|
|
182
|
+
"unknown"
|
|
183
|
+
];
|
|
184
|
+
export { AI_TEXT_STREAM_NAMESPACE, BRANCH_TYPE_COLORS, CELL_GAP, CELL_HEIGHT, CELL_PITCH_X, CELL_PITCH_Y, CELL_WIDTH, EMPTY_GRID_WORKFLOW_DEFINITION, FAILURE_CAUSES, FAILURE_CAUSE_COPY, FAILURE_KINDS, GRID_SIZE, IDENTITY_TRANSFORM, MAX_COLS, MAX_GRID_COLS, MAX_GRID_ROWS, MAX_ROWS, MAX_STEPS, MIN_COLS, MIN_ROWS, MULTI_OUTGOING_STEP_TYPES, STEP_TYPE_COLORS, VARIABLE_TOKEN_PATTERN, aggregateStepMetrics, branchTypeSchema, buildVariableTree, buildWorkflowBrief, cellToViewportRect, collectUnresolvedVariables, computePreviewGraph, contentToViewport, createThrottledEmitter, createWorkflowProposalSession, cycleStepConnection, defineTemplate, deriveGridBounds, deriveRunPath, evaluateCondition, evaluateConditionGroup, evaluateConditionWithDetails, exportTemplate, exportTemplateSchema, extractBranchInfo, extractVariablePaths, findBrokenStepRefs, findFailedStep, findFreeAdjacentCell, findFreeCommonNeighbor, findNearestFreeCell, findRunBlockers, findStepInDirection, findUnsupportedConditionExpression, findWorkflowSetupProblems, flattenFields, formatDurationMs, formatShare, getAdjacentPosition, getBranchLabel, getCellCenter, getCellEdge, getCellOrigin, getConnectionDirection, getConnectionFarEnd, getContentSize, getStepSummary, getStepsRect, getUpstreamSteps, getWorkflowPreflight, gridConnectionSchema, gridPositionSchema, gridStepSchema, gridStepTypeSchema, gridWorkflowDefinitionSchema, hasCycle, hasVariables, importTemplate, indexToPosition, isAiTextStreamData, isSamePosition, isValidPosition, isWithinBounds, isWithinHardCap, listStepConnections, maskPiiDeep, maskPiiString, mergeBounds, missingRequiredFields, normalizeConditionConfig, orderStepsByFlow, orderStepsForPreview, parseChoiceList, parseGridWorkflowDefinition, parseGridWorkflowDefinitionStrict, positionToIndex, resolveBranchPath, resolveCatalogNode, resolveConnectionFocus, resolveObjectVariables, resolvePromptVariables, resolveValueReference, resolveVariableValue, resolveVariables, roundedPath, routeConnection, routeLabelFallbackPoint, routeLabelPoint, selectAppliedGraph, serializeTemplate, triageFailedStep, validateBranchConnections, validateConditionConfig, validateConnection, validateStepConfig, validateWorkflowDefinition, viewportPointToCell, viewportToContent, visibleConfigFields };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_node_definitions = require("./node-definitions-pS1Zp1dK.cjs");
|
|
2
|
+
const require_end_node_ids = require("./end-node-ids-D6WBaCLm.cjs");
|
|
3
|
+
// src/lib/templates/define-template.ts
|
|
4
|
+
/**
|
|
5
|
+
* 템플릿 작성 헬퍼 — 컴팩트 스펙을 완전한 `ExtendedWorkflowTemplate`로 확장한다.
|
|
6
|
+
*
|
|
7
|
+
* 작성자는 메타데이터와 스텝만 선언하면 된다. 헬퍼가:
|
|
8
|
+
* - `node`(nodeDefinitionId)로 `nodeDefinition`을 레지스트리에서 hydrate
|
|
9
|
+
* (에디터 미리보기용 — 저장 시 제거되고 런타임은 id로 재해석하므로 파생이 안전).
|
|
10
|
+
* - 스텝 위치에서 connection의 fromPosition/toPosition·id를 파생.
|
|
11
|
+
* - `flow` 생략 시 스텝을 순서대로 선형 연결(대부분의 템플릿).
|
|
12
|
+
* - 트리거 노드 id를 `triggerType`으로 파생.
|
|
13
|
+
*
|
|
14
|
+
* 잘못된 node id / 끊어진 flow 참조는 모듈 로드 시점에 throw해 빠르게 실패한다.
|
|
15
|
+
*/
|
|
16
|
+
/** 스텝을 갖지 않는 제어/종료 타입 (node 불필요) */
|
|
17
|
+
const NODELESS_STEP_TYPES = /* @__PURE__ */ new Set([
|
|
18
|
+
"condition",
|
|
19
|
+
"end",
|
|
20
|
+
"join"
|
|
21
|
+
]);
|
|
22
|
+
function defineTemplate(spec) {
|
|
23
|
+
var _steps$find, _spec$flow, _spec$gridSize;
|
|
24
|
+
const stepById = /* @__PURE__ */ new Map();
|
|
25
|
+
const steps = spec.steps.map((s, index) => {
|
|
26
|
+
var _s$pos, _s$config;
|
|
27
|
+
if (stepById.has(s.id)) throw new Error(`[template ${spec.id}] 중복 스텝 id: ${s.id}`);
|
|
28
|
+
const nodeDefinition = s.node ? require_node_definitions.getNodeDefinition(s.node) : void 0;
|
|
29
|
+
if (s.node && !nodeDefinition && !NODELESS_STEP_TYPES.has(s.type)) throw new Error(`[template ${spec.id}] 알 수 없는 node id: "${s.node}" (스텝 ${s.id})`);
|
|
30
|
+
const [row, col] = (_s$pos = s.pos) !== null && _s$pos !== void 0 ? _s$pos : [index, 1];
|
|
31
|
+
const step = require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2({
|
|
32
|
+
id: s.id,
|
|
33
|
+
position: {
|
|
34
|
+
row,
|
|
35
|
+
col
|
|
36
|
+
},
|
|
37
|
+
type: s.type,
|
|
38
|
+
label: s.label
|
|
39
|
+
}, s.node ? { nodeDefinitionId: s.node } : {}), nodeDefinition ? { nodeDefinition } : {}), {}, { config: (_s$config = s.config) !== null && _s$config !== void 0 ? _s$config : {} });
|
|
40
|
+
stepById.set(s.id, step);
|
|
41
|
+
return step;
|
|
42
|
+
});
|
|
43
|
+
const triggerType = (_steps$find = steps.find((s) => s.type === "trigger")) === null || _steps$find === void 0 ? void 0 : _steps$find.nodeDefinitionId;
|
|
44
|
+
const connections = ((_spec$flow = spec.flow) !== null && _spec$flow !== void 0 ? _spec$flow : steps.slice(0, -1).map((s, i) => [s.id, steps[i + 1].id])).map(([from, to, options], i) => {
|
|
45
|
+
const fromStep = stepById.get(from);
|
|
46
|
+
const toStep = stepById.get(to);
|
|
47
|
+
if (!fromStep || !toStep) throw new Error(`[template ${spec.id}] 끊어진 연결: ${from} -> ${to} (존재하지 않는 스텝)`);
|
|
48
|
+
return require_end_node_ids._objectSpread2({
|
|
49
|
+
id: `conn-${i + 1}`,
|
|
50
|
+
fromStepId: from,
|
|
51
|
+
toStepId: to,
|
|
52
|
+
fromPosition: fromStep.position,
|
|
53
|
+
toPosition: toStep.position
|
|
54
|
+
}, options !== null && options !== void 0 ? options : {});
|
|
55
|
+
});
|
|
56
|
+
const definition = {
|
|
57
|
+
gridSize: (_spec$gridSize = spec.gridSize) !== null && _spec$gridSize !== void 0 ? _spec$gridSize : 9,
|
|
58
|
+
steps,
|
|
59
|
+
connections
|
|
60
|
+
};
|
|
61
|
+
return require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2({
|
|
62
|
+
id: spec.id,
|
|
63
|
+
name: spec.name,
|
|
64
|
+
description: spec.description,
|
|
65
|
+
category: spec.category,
|
|
66
|
+
icon: spec.icon
|
|
67
|
+
}, spec.featured ? { featured: spec.featured } : {}), spec.order !== void 0 ? { order: spec.order } : {}), spec.tags ? { tags: spec.tags } : {}), triggerType ? { triggerType } : {}), {}, { definition });
|
|
68
|
+
}
|
|
69
|
+
Object.defineProperty(exports, "defineTemplate", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function() {
|
|
72
|
+
return defineTemplate;
|
|
73
|
+
}
|
|
74
|
+
});
|