@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
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
const require_end_node_ids = require("./end-node-ids-D6WBaCLm.cjs");
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
// src/types/grid-workflow-dto.ts
|
|
4
|
+
const GRID_SIZE = 9;
|
|
5
|
+
const CELL_WIDTH = 248;
|
|
6
|
+
const CELL_HEIGHT = 136;
|
|
7
|
+
const CELL_GAP = 40;
|
|
8
|
+
const CELL_PITCH_X = 288;
|
|
9
|
+
const CELL_PITCH_Y = 176;
|
|
10
|
+
const MAX_STEPS = 200;
|
|
11
|
+
const MAX_GRID_ROWS = 64;
|
|
12
|
+
const MAX_GRID_COLS = 16;
|
|
13
|
+
const BRANCH_TYPE_COLORS = {
|
|
14
|
+
true: {
|
|
15
|
+
stroke: "stroke-green-500",
|
|
16
|
+
fill: "fill-green-500",
|
|
17
|
+
label: "참"
|
|
18
|
+
},
|
|
19
|
+
false: {
|
|
20
|
+
stroke: "stroke-red-500",
|
|
21
|
+
fill: "fill-red-500",
|
|
22
|
+
label: "거짓"
|
|
23
|
+
},
|
|
24
|
+
case: {
|
|
25
|
+
stroke: "stroke-blue-500",
|
|
26
|
+
fill: "fill-blue-500",
|
|
27
|
+
label: "Case"
|
|
28
|
+
},
|
|
29
|
+
default: {
|
|
30
|
+
stroke: "stroke-gray-500",
|
|
31
|
+
fill: "fill-gray-500",
|
|
32
|
+
label: "기본"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const STEP_TYPE_COLORS = {
|
|
36
|
+
trigger: {
|
|
37
|
+
bg: "bg-green-100 dark:bg-green-900/30",
|
|
38
|
+
border: "border-green-500",
|
|
39
|
+
text: "text-green-700 dark:text-green-300"
|
|
40
|
+
},
|
|
41
|
+
condition: {
|
|
42
|
+
bg: "bg-yellow-100 dark:bg-yellow-900/30",
|
|
43
|
+
border: "border-yellow-500",
|
|
44
|
+
text: "text-yellow-700 dark:text-yellow-300"
|
|
45
|
+
},
|
|
46
|
+
action: {
|
|
47
|
+
bg: "bg-blue-100 dark:bg-blue-900/30",
|
|
48
|
+
border: "border-blue-500",
|
|
49
|
+
text: "text-blue-700 dark:text-blue-300"
|
|
50
|
+
},
|
|
51
|
+
end: {
|
|
52
|
+
bg: "bg-red-100 dark:bg-red-900/30",
|
|
53
|
+
border: "border-red-500",
|
|
54
|
+
text: "text-red-700 dark:text-red-300"
|
|
55
|
+
},
|
|
56
|
+
parallel: {
|
|
57
|
+
bg: "bg-purple-100 dark:bg-purple-900/30",
|
|
58
|
+
border: "border-purple-500",
|
|
59
|
+
text: "text-purple-700 dark:text-purple-300"
|
|
60
|
+
},
|
|
61
|
+
join: {
|
|
62
|
+
bg: "bg-purple-100 dark:bg-purple-900/30",
|
|
63
|
+
border: "border-purple-500",
|
|
64
|
+
text: "text-purple-700 dark:text-purple-300"
|
|
65
|
+
},
|
|
66
|
+
forEach: {
|
|
67
|
+
bg: "bg-cyan-100 dark:bg-cyan-900/30",
|
|
68
|
+
border: "border-cyan-500",
|
|
69
|
+
text: "text-cyan-700 dark:text-cyan-300"
|
|
70
|
+
},
|
|
71
|
+
while: {
|
|
72
|
+
bg: "bg-cyan-100 dark:bg-cyan-900/30",
|
|
73
|
+
border: "border-cyan-500",
|
|
74
|
+
text: "text-cyan-700 dark:text-cyan-300"
|
|
75
|
+
},
|
|
76
|
+
repeat: {
|
|
77
|
+
bg: "bg-cyan-100 dark:bg-cyan-900/30",
|
|
78
|
+
border: "border-cyan-500",
|
|
79
|
+
text: "text-cyan-700 dark:text-cyan-300"
|
|
80
|
+
},
|
|
81
|
+
loopEnd: {
|
|
82
|
+
bg: "bg-cyan-100 dark:bg-cyan-900/30",
|
|
83
|
+
border: "border-cyan-400 border-dashed",
|
|
84
|
+
text: "text-cyan-700 dark:text-cyan-300"
|
|
85
|
+
},
|
|
86
|
+
tryCatch: {
|
|
87
|
+
bg: "bg-orange-100 dark:bg-orange-900/30",
|
|
88
|
+
border: "border-orange-500",
|
|
89
|
+
text: "text-orange-700 dark:text-orange-300"
|
|
90
|
+
},
|
|
91
|
+
errorHandler: {
|
|
92
|
+
bg: "bg-orange-100 dark:bg-orange-900/30",
|
|
93
|
+
border: "border-orange-500",
|
|
94
|
+
text: "text-orange-700 dark:text-orange-300"
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
function positionToIndex(position) {
|
|
98
|
+
return position.row * 9 + position.col;
|
|
99
|
+
}
|
|
100
|
+
function indexToPosition(index) {
|
|
101
|
+
return {
|
|
102
|
+
row: Math.floor(index / 9),
|
|
103
|
+
col: index % 9
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function isSamePosition(a, b) {
|
|
107
|
+
if (!a || !b) return false;
|
|
108
|
+
return a.row === b.row && a.col === b.col;
|
|
109
|
+
}
|
|
110
|
+
/** 절대 상한(하드캡) 검사 — 렌더 바운드 검사는 lib/grid-bounds.isWithinBounds */
|
|
111
|
+
function isValidPosition(position) {
|
|
112
|
+
return position.row >= 0 && position.row < 64 && position.col >= 0 && position.col < 16;
|
|
113
|
+
}
|
|
114
|
+
function getAdjacentPosition(position, direction) {
|
|
115
|
+
const newPosition = require_end_node_ids._objectSpread2({}, position);
|
|
116
|
+
switch (direction) {
|
|
117
|
+
case "up":
|
|
118
|
+
newPosition.row -= 1;
|
|
119
|
+
break;
|
|
120
|
+
case "down":
|
|
121
|
+
newPosition.row += 1;
|
|
122
|
+
break;
|
|
123
|
+
case "left":
|
|
124
|
+
newPosition.col -= 1;
|
|
125
|
+
break;
|
|
126
|
+
case "right": newPosition.col += 1;
|
|
127
|
+
}
|
|
128
|
+
return isValidPosition(newPosition) ? newPosition : null;
|
|
129
|
+
}
|
|
130
|
+
function getConnectionDirection(from, to) {
|
|
131
|
+
const rowDiff = to.row - from.row;
|
|
132
|
+
const colDiff = to.col - from.col;
|
|
133
|
+
if (Math.abs(rowDiff) + Math.abs(colDiff) !== 1) return null;
|
|
134
|
+
if (rowDiff === -1) return "up";
|
|
135
|
+
if (rowDiff === 1) return "down";
|
|
136
|
+
if (colDiff === -1) return "left";
|
|
137
|
+
if (colDiff === 1) return "right";
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
function hasCycle(connections, newConnection) {
|
|
141
|
+
const allConnections = newConnection ? [...connections, require_end_node_ids._objectSpread2(require_end_node_ids._objectSpread2({}, newConnection), {}, {
|
|
142
|
+
id: "temp",
|
|
143
|
+
fromPosition: {
|
|
144
|
+
row: 0,
|
|
145
|
+
col: 0
|
|
146
|
+
},
|
|
147
|
+
toPosition: {
|
|
148
|
+
row: 0,
|
|
149
|
+
col: 0
|
|
150
|
+
}
|
|
151
|
+
})] : connections;
|
|
152
|
+
const adjacencyList = /* @__PURE__ */ new Map();
|
|
153
|
+
for (const conn of allConnections) {
|
|
154
|
+
const existing = adjacencyList.get(conn.fromStepId) || [];
|
|
155
|
+
adjacencyList.set(conn.fromStepId, [...existing, conn.toStepId]);
|
|
156
|
+
}
|
|
157
|
+
const visited = /* @__PURE__ */ new Set();
|
|
158
|
+
const recursionStack = /* @__PURE__ */ new Set();
|
|
159
|
+
function dfs(nodeId) {
|
|
160
|
+
visited.add(nodeId);
|
|
161
|
+
recursionStack.add(nodeId);
|
|
162
|
+
const neighbors = adjacencyList.get(nodeId) || [];
|
|
163
|
+
for (const neighbor of neighbors) if (!visited.has(neighbor)) {
|
|
164
|
+
if (dfs(neighbor)) return true;
|
|
165
|
+
} else if (recursionStack.has(neighbor)) return true;
|
|
166
|
+
recursionStack.delete(nodeId);
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
const allNodes = /* @__PURE__ */ new Set();
|
|
170
|
+
for (const conn of allConnections) {
|
|
171
|
+
allNodes.add(conn.fromStepId);
|
|
172
|
+
allNodes.add(conn.toStepId);
|
|
173
|
+
}
|
|
174
|
+
for (const node of allNodes) if (!visited.has(node)) {
|
|
175
|
+
if (dfs(node)) return true;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
// src/lib/grid-bounds.ts
|
|
180
|
+
const MIN_COLS = 3;
|
|
181
|
+
const MIN_ROWS = 6;
|
|
182
|
+
const MAX_COLS = 16;
|
|
183
|
+
const MAX_ROWS = 64;
|
|
184
|
+
function clamp(value, min, max) {
|
|
185
|
+
return Math.min(Math.max(value, min), max);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 스텝 배치에서 렌더 바운드를 파생한다.
|
|
189
|
+
* 행은 항상 콘텐츠 아래 1행 성장 마진을 포함한다 (세로 흐름 기본).
|
|
190
|
+
*/
|
|
191
|
+
function deriveGridBounds(steps) {
|
|
192
|
+
let maxRow = -1;
|
|
193
|
+
let maxCol = -1;
|
|
194
|
+
for (const step of steps) {
|
|
195
|
+
if (step.position.row > maxRow) maxRow = step.position.row;
|
|
196
|
+
if (step.position.col > maxCol) maxCol = step.position.col;
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
rows: clamp(maxRow + 2, 6, MAX_ROWS),
|
|
200
|
+
cols: clamp(maxCol + 1, 3, MAX_COLS)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/** 두 바운드의 축별 최대값 (파생 바운드 + 수동 확장 floor 병합용) */
|
|
204
|
+
function mergeBounds(a, b) {
|
|
205
|
+
return {
|
|
206
|
+
rows: clamp(Math.max(a.rows, b.rows), 1, MAX_ROWS),
|
|
207
|
+
cols: clamp(Math.max(a.cols, b.cols), 1, MAX_COLS)
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function isWithinBounds(position, bounds) {
|
|
211
|
+
return position.row >= 0 && position.row < bounds.rows && position.col >= 0 && position.col < bounds.cols;
|
|
212
|
+
}
|
|
213
|
+
/** 하드캡 검사 — 저장/임포트 검증용 (렌더 바운드와 무관한 절대 상한) */
|
|
214
|
+
function isWithinHardCap(position) {
|
|
215
|
+
return position.row >= 0 && position.row < MAX_ROWS && position.col >= 0 && position.col < MAX_COLS;
|
|
216
|
+
}
|
|
217
|
+
// src/schemas/grid-workflow-schema.ts
|
|
218
|
+
/**
|
|
219
|
+
* 그리드 워크플로우 JSON 스키마 및 유효성 검사
|
|
220
|
+
*/
|
|
221
|
+
const gridPositionSchema = zod.z.object({
|
|
222
|
+
row: zod.z.number().int().min(0).max(63),
|
|
223
|
+
col: zod.z.number().int().min(0).max(15)
|
|
224
|
+
});
|
|
225
|
+
const gridStepTypeSchema = zod.z.enum([
|
|
226
|
+
"trigger",
|
|
227
|
+
"condition",
|
|
228
|
+
"action",
|
|
229
|
+
"end",
|
|
230
|
+
"parallel",
|
|
231
|
+
"join",
|
|
232
|
+
"forEach",
|
|
233
|
+
"while",
|
|
234
|
+
"repeat",
|
|
235
|
+
"loopEnd",
|
|
236
|
+
"tryCatch",
|
|
237
|
+
"errorHandler"
|
|
238
|
+
]);
|
|
239
|
+
const branchTypeSchema = zod.z.enum([
|
|
240
|
+
"true",
|
|
241
|
+
"false",
|
|
242
|
+
"case",
|
|
243
|
+
"default"
|
|
244
|
+
]);
|
|
245
|
+
const gridStepConfigSchema = zod.z.record(zod.z.string(), zod.z.json());
|
|
246
|
+
const gridStepSchema = zod.z.object({
|
|
247
|
+
id: zod.z.string().min(1, "스텝 ID는 필수입니다"),
|
|
248
|
+
position: gridPositionSchema,
|
|
249
|
+
type: gridStepTypeSchema,
|
|
250
|
+
label: zod.z.string().min(1, "스텝 라벨은 필수입니다"),
|
|
251
|
+
nodeDefinitionId: zod.z.string().optional(),
|
|
252
|
+
nodeDefinition: zod.z.unknown().optional(),
|
|
253
|
+
config: gridStepConfigSchema.default({}),
|
|
254
|
+
/**
|
|
255
|
+
* 실패해도 다음 스텝으로 진행.
|
|
256
|
+
* ⚠️ `.default(false)`가 아니라 `.optional()`이다 — "선언 없음"과 "끔"을 구분해야
|
|
257
|
+
* 옛 정의를 읽을 때 의미가 바뀌지 않는다(루트 CLAUDE.md 규율 7).
|
|
258
|
+
*/
|
|
259
|
+
continueOnError: zod.z.boolean().optional()
|
|
260
|
+
});
|
|
261
|
+
const gridConnectionSchema = zod.z.object({
|
|
262
|
+
id: zod.z.string().min(1, "연결 ID는 필수입니다"),
|
|
263
|
+
fromStepId: zod.z.string().min(1, "시작 스텝 ID는 필수입니다"),
|
|
264
|
+
toStepId: zod.z.string().min(1, "종료 스텝 ID는 필수입니다"),
|
|
265
|
+
fromPosition: gridPositionSchema,
|
|
266
|
+
toPosition: gridPositionSchema,
|
|
267
|
+
label: zod.z.string().optional(),
|
|
268
|
+
condition: zod.z.string().optional(),
|
|
269
|
+
branchType: branchTypeSchema.optional(),
|
|
270
|
+
branchValue: zod.z.string().optional()
|
|
271
|
+
});
|
|
272
|
+
const gridWorkflowDefinitionSchema = zod.z.object({
|
|
273
|
+
gridSize: zod.z.number().int().min(1).max(99).default(9),
|
|
274
|
+
steps: zod.z.array(gridStepSchema).max(200),
|
|
275
|
+
connections: zod.z.array(gridConnectionSchema),
|
|
276
|
+
/** 테스트 실행용 트리거 샘플 페이로드 — 선언 없음은 `.optional()`(기본값 주입 금지) */
|
|
277
|
+
testParams: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
278
|
+
});
|
|
279
|
+
const exportTemplateSchema = zod.z.object({
|
|
280
|
+
version: zod.z.string().default("1.0"),
|
|
281
|
+
exportedAt: zod.z.string().datetime(),
|
|
282
|
+
metadata: zod.z.object({
|
|
283
|
+
name: zod.z.string().min(1, "템플릿 이름은 필수입니다"),
|
|
284
|
+
description: zod.z.string().optional(),
|
|
285
|
+
category: zod.z.enum([
|
|
286
|
+
"basic",
|
|
287
|
+
"ai",
|
|
288
|
+
"marketing"
|
|
289
|
+
]).optional(),
|
|
290
|
+
icon: zod.z.string().optional(),
|
|
291
|
+
author: zod.z.string().optional()
|
|
292
|
+
}),
|
|
293
|
+
definition: gridWorkflowDefinitionSchema
|
|
294
|
+
});
|
|
295
|
+
// src/lib/parse-workflow-definition.ts
|
|
296
|
+
/** 파싱 실패 시의 안전값 — 뷰어는 빈 캔버스를 렌더한다 */
|
|
297
|
+
const EMPTY_GRID_WORKFLOW_DEFINITION = {
|
|
298
|
+
gridSize: 9,
|
|
299
|
+
steps: [],
|
|
300
|
+
connections: []
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Strict persistence/execution parser. Unlike the display parser below, this
|
|
304
|
+
* never turns corrupt stored JSON into an empty workflow.
|
|
305
|
+
*/
|
|
306
|
+
function parseGridWorkflowDefinitionStrict(raw) {
|
|
307
|
+
return gridWorkflowDefinitionSchema.parse(raw);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* 저장된 정의를 **표시용**으로 안전하게 읽는다. 읽지 못하면 빈 캔버스를 돌려주고, 왜 못
|
|
311
|
+
* 읽었는지는 `onFallback`으로 알린다(호스트가 로그에 남긴다).
|
|
312
|
+
*
|
|
313
|
+
* ⚠️ 표시 경로(뷰어·목록) 전용 — 실행 경로는 손상된 정의를 빈 정의로 조용히 바꾸면 안 된다
|
|
314
|
+
* (오실행 위험). 그쪽은 `parseGridWorkflowDefinitionStrict`의 실패를 에러로 다룬다.
|
|
315
|
+
*/
|
|
316
|
+
function parseGridWorkflowDefinition(raw, onFallback) {
|
|
317
|
+
try {
|
|
318
|
+
return parseGridWorkflowDefinitionStrict(raw);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
onFallback === null || onFallback === void 0 || onFallback(error);
|
|
321
|
+
return EMPTY_GRID_WORKFLOW_DEFINITION;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// src/lib/ai-stream.ts
|
|
325
|
+
/**
|
|
326
|
+
* AI 생성 스텝의 **부분 출력 스트리밍** 계약 — 서버(핸들러)와 클라이언트(캔버스)가 같은
|
|
327
|
+
* 이름·모양을 쓴다(클라이언트 안전, 순수).
|
|
328
|
+
*
|
|
329
|
+
* 핸들러는 `context.emit(data, { namespace: AI_TEXT_STREAM_NAMESPACE })`로 지금까지의
|
|
330
|
+
* 전체 텍스트를 보내고(조각이 아니라 누적 — 이벤트가 하나 빠져도 화면이 어긋나지 않는다),
|
|
331
|
+
* 캔버스는 실행 중인 카드에 그 텍스트를 흘려 보여 준다. 참조 구현(100ms 스로틀)과 같다.
|
|
332
|
+
*/
|
|
333
|
+
const AI_TEXT_STREAM_NAMESPACE = "ai-text";
|
|
334
|
+
function isAiTextStreamData(data) {
|
|
335
|
+
return typeof data === "object" && data !== null && data.kind === "ai-text" && typeof data.text === "string";
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* 스로틀 방출기 — 마지막 값만 기억했다가 간격마다 한 번 보내고, `flush`가 남은 값을
|
|
339
|
+
* 반드시 보낸다(끝 조각이 사라지면 "완료 직전에서 멈춘" 것처럼 보인다).
|
|
340
|
+
*/
|
|
341
|
+
function createThrottledEmitter(send, intervalMs, now = () => Date.now()) {
|
|
342
|
+
let pending;
|
|
343
|
+
let hasPending = false;
|
|
344
|
+
let lastSentAt = -Infinity;
|
|
345
|
+
let chain = Promise.resolve();
|
|
346
|
+
const dispatch = (value) => {
|
|
347
|
+
chain = chain.then(() => send(value)).catch(() => void 0);
|
|
348
|
+
};
|
|
349
|
+
return {
|
|
350
|
+
push(value) {
|
|
351
|
+
const at = now();
|
|
352
|
+
if (at - lastSentAt >= intervalMs) {
|
|
353
|
+
lastSentAt = at;
|
|
354
|
+
hasPending = false;
|
|
355
|
+
pending = void 0;
|
|
356
|
+
dispatch(value);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
pending = value;
|
|
360
|
+
hasPending = true;
|
|
361
|
+
},
|
|
362
|
+
async flush() {
|
|
363
|
+
if (hasPending) {
|
|
364
|
+
hasPending = false;
|
|
365
|
+
const value = pending;
|
|
366
|
+
pending = void 0;
|
|
367
|
+
lastSentAt = now();
|
|
368
|
+
dispatch(value);
|
|
369
|
+
}
|
|
370
|
+
await chain;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* 선택지 분류의 후보 목록 — 한 줄에 하나. 공백 줄·중복은 버린다(모델이 고를 수 없는
|
|
376
|
+
* 값이 목록에 남으면 구조화 출력이 거절된다).
|
|
377
|
+
*/
|
|
378
|
+
function parseChoiceList(text) {
|
|
379
|
+
const seen = /* @__PURE__ */ new Set();
|
|
380
|
+
const result = [];
|
|
381
|
+
for (const raw of (text !== null && text !== void 0 ? text : "").split(/\r?\n/)) {
|
|
382
|
+
const value = raw.trim();
|
|
383
|
+
if (!value || seen.has(value)) continue;
|
|
384
|
+
seen.add(value);
|
|
385
|
+
result.push(value);
|
|
386
|
+
}
|
|
387
|
+
return result;
|
|
388
|
+
}
|
|
389
|
+
Object.defineProperty(exports, "AI_TEXT_STREAM_NAMESPACE", {
|
|
390
|
+
enumerable: true,
|
|
391
|
+
get: function() {
|
|
392
|
+
return AI_TEXT_STREAM_NAMESPACE;
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
Object.defineProperty(exports, "BRANCH_TYPE_COLORS", {
|
|
396
|
+
enumerable: true,
|
|
397
|
+
get: function() {
|
|
398
|
+
return BRANCH_TYPE_COLORS;
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
Object.defineProperty(exports, "CELL_GAP", {
|
|
402
|
+
enumerable: true,
|
|
403
|
+
get: function() {
|
|
404
|
+
return CELL_GAP;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
Object.defineProperty(exports, "CELL_HEIGHT", {
|
|
408
|
+
enumerable: true,
|
|
409
|
+
get: function() {
|
|
410
|
+
return CELL_HEIGHT;
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
Object.defineProperty(exports, "CELL_PITCH_X", {
|
|
414
|
+
enumerable: true,
|
|
415
|
+
get: function() {
|
|
416
|
+
return CELL_PITCH_X;
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
Object.defineProperty(exports, "CELL_PITCH_Y", {
|
|
420
|
+
enumerable: true,
|
|
421
|
+
get: function() {
|
|
422
|
+
return CELL_PITCH_Y;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
Object.defineProperty(exports, "CELL_WIDTH", {
|
|
426
|
+
enumerable: true,
|
|
427
|
+
get: function() {
|
|
428
|
+
return CELL_WIDTH;
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
Object.defineProperty(exports, "EMPTY_GRID_WORKFLOW_DEFINITION", {
|
|
432
|
+
enumerable: true,
|
|
433
|
+
get: function() {
|
|
434
|
+
return EMPTY_GRID_WORKFLOW_DEFINITION;
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
Object.defineProperty(exports, "GRID_SIZE", {
|
|
438
|
+
enumerable: true,
|
|
439
|
+
get: function() {
|
|
440
|
+
return GRID_SIZE;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
Object.defineProperty(exports, "MAX_COLS", {
|
|
444
|
+
enumerable: true,
|
|
445
|
+
get: function() {
|
|
446
|
+
return MAX_COLS;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
Object.defineProperty(exports, "MAX_GRID_COLS", {
|
|
450
|
+
enumerable: true,
|
|
451
|
+
get: function() {
|
|
452
|
+
return MAX_GRID_COLS;
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
Object.defineProperty(exports, "MAX_GRID_ROWS", {
|
|
456
|
+
enumerable: true,
|
|
457
|
+
get: function() {
|
|
458
|
+
return MAX_GRID_ROWS;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
Object.defineProperty(exports, "MAX_ROWS", {
|
|
462
|
+
enumerable: true,
|
|
463
|
+
get: function() {
|
|
464
|
+
return MAX_ROWS;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
Object.defineProperty(exports, "MAX_STEPS", {
|
|
468
|
+
enumerable: true,
|
|
469
|
+
get: function() {
|
|
470
|
+
return MAX_STEPS;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
Object.defineProperty(exports, "MIN_COLS", {
|
|
474
|
+
enumerable: true,
|
|
475
|
+
get: function() {
|
|
476
|
+
return MIN_COLS;
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
Object.defineProperty(exports, "MIN_ROWS", {
|
|
480
|
+
enumerable: true,
|
|
481
|
+
get: function() {
|
|
482
|
+
return MIN_ROWS;
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
Object.defineProperty(exports, "STEP_TYPE_COLORS", {
|
|
486
|
+
enumerable: true,
|
|
487
|
+
get: function() {
|
|
488
|
+
return STEP_TYPE_COLORS;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
Object.defineProperty(exports, "branchTypeSchema", {
|
|
492
|
+
enumerable: true,
|
|
493
|
+
get: function() {
|
|
494
|
+
return branchTypeSchema;
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
Object.defineProperty(exports, "createThrottledEmitter", {
|
|
498
|
+
enumerable: true,
|
|
499
|
+
get: function() {
|
|
500
|
+
return createThrottledEmitter;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
Object.defineProperty(exports, "deriveGridBounds", {
|
|
504
|
+
enumerable: true,
|
|
505
|
+
get: function() {
|
|
506
|
+
return deriveGridBounds;
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
Object.defineProperty(exports, "exportTemplateSchema", {
|
|
510
|
+
enumerable: true,
|
|
511
|
+
get: function() {
|
|
512
|
+
return exportTemplateSchema;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
Object.defineProperty(exports, "getAdjacentPosition", {
|
|
516
|
+
enumerable: true,
|
|
517
|
+
get: function() {
|
|
518
|
+
return getAdjacentPosition;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
Object.defineProperty(exports, "getConnectionDirection", {
|
|
522
|
+
enumerable: true,
|
|
523
|
+
get: function() {
|
|
524
|
+
return getConnectionDirection;
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
Object.defineProperty(exports, "gridConnectionSchema", {
|
|
528
|
+
enumerable: true,
|
|
529
|
+
get: function() {
|
|
530
|
+
return gridConnectionSchema;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
Object.defineProperty(exports, "gridPositionSchema", {
|
|
534
|
+
enumerable: true,
|
|
535
|
+
get: function() {
|
|
536
|
+
return gridPositionSchema;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
Object.defineProperty(exports, "gridStepSchema", {
|
|
540
|
+
enumerable: true,
|
|
541
|
+
get: function() {
|
|
542
|
+
return gridStepSchema;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
Object.defineProperty(exports, "gridStepTypeSchema", {
|
|
546
|
+
enumerable: true,
|
|
547
|
+
get: function() {
|
|
548
|
+
return gridStepTypeSchema;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
Object.defineProperty(exports, "gridWorkflowDefinitionSchema", {
|
|
552
|
+
enumerable: true,
|
|
553
|
+
get: function() {
|
|
554
|
+
return gridWorkflowDefinitionSchema;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
Object.defineProperty(exports, "hasCycle", {
|
|
558
|
+
enumerable: true,
|
|
559
|
+
get: function() {
|
|
560
|
+
return hasCycle;
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
Object.defineProperty(exports, "indexToPosition", {
|
|
564
|
+
enumerable: true,
|
|
565
|
+
get: function() {
|
|
566
|
+
return indexToPosition;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
Object.defineProperty(exports, "isAiTextStreamData", {
|
|
570
|
+
enumerable: true,
|
|
571
|
+
get: function() {
|
|
572
|
+
return isAiTextStreamData;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
Object.defineProperty(exports, "isSamePosition", {
|
|
576
|
+
enumerable: true,
|
|
577
|
+
get: function() {
|
|
578
|
+
return isSamePosition;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
Object.defineProperty(exports, "isValidPosition", {
|
|
582
|
+
enumerable: true,
|
|
583
|
+
get: function() {
|
|
584
|
+
return isValidPosition;
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
Object.defineProperty(exports, "isWithinBounds", {
|
|
588
|
+
enumerable: true,
|
|
589
|
+
get: function() {
|
|
590
|
+
return isWithinBounds;
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
Object.defineProperty(exports, "isWithinHardCap", {
|
|
594
|
+
enumerable: true,
|
|
595
|
+
get: function() {
|
|
596
|
+
return isWithinHardCap;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
Object.defineProperty(exports, "mergeBounds", {
|
|
600
|
+
enumerable: true,
|
|
601
|
+
get: function() {
|
|
602
|
+
return mergeBounds;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
Object.defineProperty(exports, "parseChoiceList", {
|
|
606
|
+
enumerable: true,
|
|
607
|
+
get: function() {
|
|
608
|
+
return parseChoiceList;
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
Object.defineProperty(exports, "parseGridWorkflowDefinition", {
|
|
612
|
+
enumerable: true,
|
|
613
|
+
get: function() {
|
|
614
|
+
return parseGridWorkflowDefinition;
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
Object.defineProperty(exports, "parseGridWorkflowDefinitionStrict", {
|
|
618
|
+
enumerable: true,
|
|
619
|
+
get: function() {
|
|
620
|
+
return parseGridWorkflowDefinitionStrict;
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
Object.defineProperty(exports, "positionToIndex", {
|
|
624
|
+
enumerable: true,
|
|
625
|
+
get: function() {
|
|
626
|
+
return positionToIndex;
|
|
627
|
+
}
|
|
628
|
+
});
|