@reopt-ai/opt-workflow 0.0.0-stage → 0.1.1
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 +20 -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 +11899 -0
- package/dist/index.d.cts +803 -0
- package/dist/index.d.ts +803 -0
- package/dist/index.js +11852 -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,228 @@
|
|
|
1
|
+
import { t as END_FAILURE_NODE_ID } from "./end-node-ids-p85jFEcP.js";
|
|
2
|
+
import { d as triggerDefinitions, r as actionDefinitions } from "./node-definitions-C-GMfjMm.js";
|
|
3
|
+
import { GitBranchIcon, StopCircleIcon } from "lucide-react";
|
|
4
|
+
// src/lib/node-definitions/output-schemas.ts
|
|
5
|
+
/** 액션/제어 노드 id → 출력 필드 ({{stepId.output.key}} 참조) */ const NODE_OUTPUTS = {
|
|
6
|
+
delay: [
|
|
7
|
+
{
|
|
8
|
+
key: "waited",
|
|
9
|
+
label: "대기 완료",
|
|
10
|
+
type: "boolean"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: "duration",
|
|
14
|
+
label: "대기 시간",
|
|
15
|
+
type: "number"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "unit",
|
|
19
|
+
label: "단위",
|
|
20
|
+
type: "string"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "totalMs",
|
|
24
|
+
label: "총 대기(ms)",
|
|
25
|
+
type: "number"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
httpRequest: [{
|
|
29
|
+
key: "status",
|
|
30
|
+
label: "응답 상태 코드",
|
|
31
|
+
type: "number",
|
|
32
|
+
example: "200"
|
|
33
|
+
}, {
|
|
34
|
+
key: "data",
|
|
35
|
+
label: "응답 데이터",
|
|
36
|
+
type: "object"
|
|
37
|
+
}],
|
|
38
|
+
transformData: [{
|
|
39
|
+
key: "result",
|
|
40
|
+
label: "변환 결과",
|
|
41
|
+
type: "object"
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
/** 트리거 노드 id → 페이로드 필드 ({{key}} 참조) */
|
|
45
|
+
const TRIGGER_PAYLOADS = { webhook: [{
|
|
46
|
+
key: "webhook",
|
|
47
|
+
label: "Webhook 요청",
|
|
48
|
+
type: "object",
|
|
49
|
+
description: "{{webhook.payload.*}} 로 본문 접근",
|
|
50
|
+
children: [
|
|
51
|
+
{
|
|
52
|
+
key: "payload",
|
|
53
|
+
label: "요청 본문",
|
|
54
|
+
type: "object"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "headers",
|
|
58
|
+
label: "요청 헤더",
|
|
59
|
+
type: "object"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "method",
|
|
63
|
+
label: "HTTP 메서드",
|
|
64
|
+
type: "string"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "ip",
|
|
68
|
+
label: "요청 IP",
|
|
69
|
+
type: "string"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}] };
|
|
73
|
+
/**
|
|
74
|
+
* 호스트 노드의 출력·페이로드 스키마를 더한다. 변수 픽커가 "이전 스텝이 무엇을 내놓는지"를
|
|
75
|
+
* 여기서 읽는다 — 안 넣으면 그 노드의 값은 픽커에 보이지 않는다(실행은 된다).
|
|
76
|
+
*/
|
|
77
|
+
function registerNodeOutputs(schemas) {
|
|
78
|
+
Object.assign(NODE_OUTPUTS, schemas.outputs);
|
|
79
|
+
Object.assign(TRIGGER_PAYLOADS, schemas.triggerPayloads);
|
|
80
|
+
}
|
|
81
|
+
const SPECIAL_VARIABLES = [
|
|
82
|
+
{
|
|
83
|
+
key: "runId",
|
|
84
|
+
label: "실행 ID",
|
|
85
|
+
type: "string"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "workflowId",
|
|
89
|
+
label: "워크플로우 ID",
|
|
90
|
+
type: "string"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "workspaceId",
|
|
94
|
+
label: "워크스페이스 ID",
|
|
95
|
+
type: "string"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "userId",
|
|
99
|
+
label: "실행 주체",
|
|
100
|
+
type: "string"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "triggeredBy",
|
|
104
|
+
label: "트리거 소스",
|
|
105
|
+
type: "string",
|
|
106
|
+
example: "event"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "now",
|
|
110
|
+
label: "현재 시각(ISO)",
|
|
111
|
+
type: "string"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "timestamp",
|
|
115
|
+
label: "현재 타임스탬프(ms)",
|
|
116
|
+
type: "number"
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
// src/lib/node-definitions/control-end-definitions.ts
|
|
120
|
+
/**
|
|
121
|
+
* 조건/종료 노드 정의 — UI 카탈로그(`allNodeDefinitions` = trigger + action) 밖에 있는
|
|
122
|
+
* 제어 노드의 단일 출처.
|
|
123
|
+
*
|
|
124
|
+
* 그리드 스텝 모달(`step-modal.tsx`)과 워크플로우 AI 에이전트(노드 카탈로그 프롬프트·
|
|
125
|
+
* 미리보기 노드 정의 해석)가 함께 소비한다 — 양쪽에 id/필드를 중복 정의하면 드리프트
|
|
126
|
+
* 한다(과거 step-modal 인라인 정의를 추출한 것).
|
|
127
|
+
*/
|
|
128
|
+
const conditionDefinitions = [{
|
|
129
|
+
id: "condition-if-else",
|
|
130
|
+
type: "condition",
|
|
131
|
+
name: "If/Else 조건",
|
|
132
|
+
description: "조건에 따라 분기합니다",
|
|
133
|
+
icon: GitBranchIcon,
|
|
134
|
+
color: "bg-yellow-500",
|
|
135
|
+
category: "조건",
|
|
136
|
+
config: { fields: [{
|
|
137
|
+
key: "expression",
|
|
138
|
+
label: "조건식",
|
|
139
|
+
type: "text",
|
|
140
|
+
required: true,
|
|
141
|
+
placeholder: "예: {{gender}} === \"male\"",
|
|
142
|
+
helpText: "{{변수}} === '값' · {{변수}} > 10 · 단일 값(참/거짓) 형식. 맞지 않으면 실행이 거절됩니다."
|
|
143
|
+
}] }
|
|
144
|
+
}, {
|
|
145
|
+
id: "condition-switch",
|
|
146
|
+
type: "condition",
|
|
147
|
+
name: "Switch 분기",
|
|
148
|
+
description: "여러 조건으로 분기합니다",
|
|
149
|
+
icon: GitBranchIcon,
|
|
150
|
+
color: "bg-yellow-600",
|
|
151
|
+
category: "조건",
|
|
152
|
+
config: { fields: [{
|
|
153
|
+
key: "switchValue",
|
|
154
|
+
label: "분기 기준",
|
|
155
|
+
type: "text",
|
|
156
|
+
required: true,
|
|
157
|
+
placeholder: "예: {{status}}",
|
|
158
|
+
helpText: "이 값이 각 case 연결의 값과 같으면 그 가지로, 없으면 default로 갑니다."
|
|
159
|
+
}] }
|
|
160
|
+
}];
|
|
161
|
+
const endDefinitions = [{
|
|
162
|
+
id: "end-success",
|
|
163
|
+
type: "action",
|
|
164
|
+
name: "성공 종료",
|
|
165
|
+
description: "워크플로우를 성공으로 종료합니다",
|
|
166
|
+
icon: StopCircleIcon,
|
|
167
|
+
color: "bg-green-500",
|
|
168
|
+
category: "종료"
|
|
169
|
+
}, {
|
|
170
|
+
id: END_FAILURE_NODE_ID,
|
|
171
|
+
type: "action",
|
|
172
|
+
name: "실패 종료",
|
|
173
|
+
description: "워크플로우를 실패로 종료합니다",
|
|
174
|
+
icon: StopCircleIcon,
|
|
175
|
+
color: "bg-red-500",
|
|
176
|
+
category: "종료"
|
|
177
|
+
}];
|
|
178
|
+
// src/lib/get-step-node-definition.ts
|
|
179
|
+
/**
|
|
180
|
+
* 스텝의 노드 정의 — webhook처럼 ID가 같은 트리거·액션도 스텝 종류로 구분한다.
|
|
181
|
+
*
|
|
182
|
+
* 🔑 조건·종료 스텝은 `nodeDefinitionId` 없이 저장된 행·템플릿이 많다(예전 에디터와
|
|
183
|
+
* `defineTemplate`이 안 적었다). 그때는 종류에서 기본 정의를 고른다 — 안 고르면 설정
|
|
184
|
+
* 패널이 "추가 설정이 필요하지 않습니다"라고 말하며 조건식 칸을 숨긴다(2026-09-23 실측).
|
|
185
|
+
*/
|
|
186
|
+
function getStepNodeDefinition(step) {
|
|
187
|
+
var _ref, _step$nodeDefinitionI, _step$nodeDefinition;
|
|
188
|
+
const definitions = step.type === "trigger" ? triggerDefinitions : step.type === "condition" ? conditionDefinitions : step.type === "end" ? endDefinitions : actionDefinitions;
|
|
189
|
+
const id = (_ref = (_step$nodeDefinitionI = step.nodeDefinitionId) !== null && _step$nodeDefinitionI !== void 0 ? _step$nodeDefinitionI : (_step$nodeDefinition = step.nodeDefinition) === null || _step$nodeDefinition === void 0 ? void 0 : _step$nodeDefinition.id) !== null && _ref !== void 0 ? _ref : step.type;
|
|
190
|
+
const found = definitions.find((node) => node.id === id);
|
|
191
|
+
if (found) return found;
|
|
192
|
+
if (step.type === "condition") {
|
|
193
|
+
var _step$config, _step$config2, _step$config3;
|
|
194
|
+
const wantsSwitch = ((_step$config = step.config) === null || _step$config === void 0 ? void 0 : _step$config.conditionType) === "switch" || ((_step$config2 = step.config) === null || _step$config2 === void 0 ? void 0 : _step$config2.conditionType) === void 0 && typeof ((_step$config3 = step.config) === null || _step$config3 === void 0 ? void 0 : _step$config3.switchValue) === "string";
|
|
195
|
+
return conditionDefinitions.find((node) => node.id === (wantsSwitch ? "condition-switch" : "condition-if-else"));
|
|
196
|
+
}
|
|
197
|
+
if (step.type === "end") return endDefinitions[0];
|
|
198
|
+
return step.nodeDefinition;
|
|
199
|
+
}
|
|
200
|
+
// src/lib/step-type-for-node.ts
|
|
201
|
+
/**
|
|
202
|
+
* 노드 id → 그리드 스텝 타입 — 한 벌. 에디터 설정 패널과 AI 에이전트가 같은 표를 본다.
|
|
203
|
+
*
|
|
204
|
+
* 🔴 예전에는 이 표가 에디터(`components/grid/lib/step-type-meta.ts`)에만 있었고, AI
|
|
205
|
+
* 에이전트는 모델에게 `stepType`을 **직접** 고르게 했다. 프롬프트는 제어 노드(forEach·
|
|
206
|
+
* parallel…)를 "액션(stepType=action)" 아래에 나열해, 모델이 반복을 액션 타입으로 넣을 수
|
|
207
|
+
* 있었다 — 실행기는 그 스텝을 반복이 아니라 액션 핸들러로 보낸다. 타입은 고르게 하지 않고
|
|
208
|
+
* 노드에서 파생한다.
|
|
209
|
+
*/
|
|
210
|
+
/** nodeDefinitionId → 실제 GridStepType 매핑 (제어 노드용) */
|
|
211
|
+
const NODE_ID_TO_STEP_TYPE = {
|
|
212
|
+
parallel: "parallel",
|
|
213
|
+
join: "join",
|
|
214
|
+
forEach: "forEach",
|
|
215
|
+
while: "while",
|
|
216
|
+
repeat: "repeat",
|
|
217
|
+
loopEnd: "loopEnd",
|
|
218
|
+
tryCatch: "tryCatch"
|
|
219
|
+
};
|
|
220
|
+
/** 노드 id가 들어갈 스텝 타입. 카탈로그 액션은 `action`. */
|
|
221
|
+
function stepTypeForNode(nodeDefinitionId) {
|
|
222
|
+
var _NODE_ID_TO_STEP_TYPE;
|
|
223
|
+
if (triggerDefinitions.some((node) => node.id === nodeDefinitionId)) return "trigger";
|
|
224
|
+
if (conditionDefinitions.some((node) => node.id === nodeDefinitionId)) return "condition";
|
|
225
|
+
if (endDefinitions.some((node) => node.id === nodeDefinitionId)) return "end";
|
|
226
|
+
return (_NODE_ID_TO_STEP_TYPE = NODE_ID_TO_STEP_TYPE[nodeDefinitionId]) !== null && _NODE_ID_TO_STEP_TYPE !== void 0 ? _NODE_ID_TO_STEP_TYPE : "action";
|
|
227
|
+
}
|
|
228
|
+
export { endDefinitions as a, TRIGGER_PAYLOADS as c, conditionDefinitions as i, registerNodeOutputs as l, stepTypeForNode as n, NODE_OUTPUTS as o, getStepNodeDefinition as r, SPECIAL_VARIABLES as s, NODE_ID_TO_STEP_TYPE as t };
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
const require_end_node_ids = require("./end-node-ids-D6WBaCLm.cjs");
|
|
2
|
+
const require_node_definitions = require("./node-definitions-pS1Zp1dK.cjs");
|
|
3
|
+
let lucide_react = require("lucide-react");
|
|
4
|
+
// src/lib/node-definitions/output-schemas.ts
|
|
5
|
+
/** 액션/제어 노드 id → 출력 필드 ({{stepId.output.key}} 참조) */ const NODE_OUTPUTS = {
|
|
6
|
+
delay: [
|
|
7
|
+
{
|
|
8
|
+
key: "waited",
|
|
9
|
+
label: "대기 완료",
|
|
10
|
+
type: "boolean"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: "duration",
|
|
14
|
+
label: "대기 시간",
|
|
15
|
+
type: "number"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "unit",
|
|
19
|
+
label: "단위",
|
|
20
|
+
type: "string"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "totalMs",
|
|
24
|
+
label: "총 대기(ms)",
|
|
25
|
+
type: "number"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
httpRequest: [{
|
|
29
|
+
key: "status",
|
|
30
|
+
label: "응답 상태 코드",
|
|
31
|
+
type: "number",
|
|
32
|
+
example: "200"
|
|
33
|
+
}, {
|
|
34
|
+
key: "data",
|
|
35
|
+
label: "응답 데이터",
|
|
36
|
+
type: "object"
|
|
37
|
+
}],
|
|
38
|
+
transformData: [{
|
|
39
|
+
key: "result",
|
|
40
|
+
label: "변환 결과",
|
|
41
|
+
type: "object"
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
/** 트리거 노드 id → 페이로드 필드 ({{key}} 참조) */
|
|
45
|
+
const TRIGGER_PAYLOADS = { webhook: [{
|
|
46
|
+
key: "webhook",
|
|
47
|
+
label: "Webhook 요청",
|
|
48
|
+
type: "object",
|
|
49
|
+
description: "{{webhook.payload.*}} 로 본문 접근",
|
|
50
|
+
children: [
|
|
51
|
+
{
|
|
52
|
+
key: "payload",
|
|
53
|
+
label: "요청 본문",
|
|
54
|
+
type: "object"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "headers",
|
|
58
|
+
label: "요청 헤더",
|
|
59
|
+
type: "object"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "method",
|
|
63
|
+
label: "HTTP 메서드",
|
|
64
|
+
type: "string"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "ip",
|
|
68
|
+
label: "요청 IP",
|
|
69
|
+
type: "string"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}] };
|
|
73
|
+
/**
|
|
74
|
+
* 호스트 노드의 출력·페이로드 스키마를 더한다. 변수 픽커가 "이전 스텝이 무엇을 내놓는지"를
|
|
75
|
+
* 여기서 읽는다 — 안 넣으면 그 노드의 값은 픽커에 보이지 않는다(실행은 된다).
|
|
76
|
+
*/
|
|
77
|
+
function registerNodeOutputs(schemas) {
|
|
78
|
+
Object.assign(NODE_OUTPUTS, schemas.outputs);
|
|
79
|
+
Object.assign(TRIGGER_PAYLOADS, schemas.triggerPayloads);
|
|
80
|
+
}
|
|
81
|
+
const SPECIAL_VARIABLES = [
|
|
82
|
+
{
|
|
83
|
+
key: "runId",
|
|
84
|
+
label: "실행 ID",
|
|
85
|
+
type: "string"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "workflowId",
|
|
89
|
+
label: "워크플로우 ID",
|
|
90
|
+
type: "string"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "workspaceId",
|
|
94
|
+
label: "워크스페이스 ID",
|
|
95
|
+
type: "string"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "userId",
|
|
99
|
+
label: "실행 주체",
|
|
100
|
+
type: "string"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "triggeredBy",
|
|
104
|
+
label: "트리거 소스",
|
|
105
|
+
type: "string",
|
|
106
|
+
example: "event"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "now",
|
|
110
|
+
label: "현재 시각(ISO)",
|
|
111
|
+
type: "string"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "timestamp",
|
|
115
|
+
label: "현재 타임스탬프(ms)",
|
|
116
|
+
type: "number"
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
// src/lib/node-definitions/control-end-definitions.ts
|
|
120
|
+
/**
|
|
121
|
+
* 조건/종료 노드 정의 — UI 카탈로그(`allNodeDefinitions` = trigger + action) 밖에 있는
|
|
122
|
+
* 제어 노드의 단일 출처.
|
|
123
|
+
*
|
|
124
|
+
* 그리드 스텝 모달(`step-modal.tsx`)과 워크플로우 AI 에이전트(노드 카탈로그 프롬프트·
|
|
125
|
+
* 미리보기 노드 정의 해석)가 함께 소비한다 — 양쪽에 id/필드를 중복 정의하면 드리프트
|
|
126
|
+
* 한다(과거 step-modal 인라인 정의를 추출한 것).
|
|
127
|
+
*/
|
|
128
|
+
const conditionDefinitions = [{
|
|
129
|
+
id: "condition-if-else",
|
|
130
|
+
type: "condition",
|
|
131
|
+
name: "If/Else 조건",
|
|
132
|
+
description: "조건에 따라 분기합니다",
|
|
133
|
+
icon: lucide_react.GitBranchIcon,
|
|
134
|
+
color: "bg-yellow-500",
|
|
135
|
+
category: "조건",
|
|
136
|
+
config: { fields: [{
|
|
137
|
+
key: "expression",
|
|
138
|
+
label: "조건식",
|
|
139
|
+
type: "text",
|
|
140
|
+
required: true,
|
|
141
|
+
placeholder: "예: {{gender}} === \"male\"",
|
|
142
|
+
helpText: "{{변수}} === '값' · {{변수}} > 10 · 단일 값(참/거짓) 형식. 맞지 않으면 실행이 거절됩니다."
|
|
143
|
+
}] }
|
|
144
|
+
}, {
|
|
145
|
+
id: "condition-switch",
|
|
146
|
+
type: "condition",
|
|
147
|
+
name: "Switch 분기",
|
|
148
|
+
description: "여러 조건으로 분기합니다",
|
|
149
|
+
icon: lucide_react.GitBranchIcon,
|
|
150
|
+
color: "bg-yellow-600",
|
|
151
|
+
category: "조건",
|
|
152
|
+
config: { fields: [{
|
|
153
|
+
key: "switchValue",
|
|
154
|
+
label: "분기 기준",
|
|
155
|
+
type: "text",
|
|
156
|
+
required: true,
|
|
157
|
+
placeholder: "예: {{status}}",
|
|
158
|
+
helpText: "이 값이 각 case 연결의 값과 같으면 그 가지로, 없으면 default로 갑니다."
|
|
159
|
+
}] }
|
|
160
|
+
}];
|
|
161
|
+
const endDefinitions = [{
|
|
162
|
+
id: "end-success",
|
|
163
|
+
type: "action",
|
|
164
|
+
name: "성공 종료",
|
|
165
|
+
description: "워크플로우를 성공으로 종료합니다",
|
|
166
|
+
icon: lucide_react.StopCircleIcon,
|
|
167
|
+
color: "bg-green-500",
|
|
168
|
+
category: "종료"
|
|
169
|
+
}, {
|
|
170
|
+
id: require_end_node_ids.END_FAILURE_NODE_ID,
|
|
171
|
+
type: "action",
|
|
172
|
+
name: "실패 종료",
|
|
173
|
+
description: "워크플로우를 실패로 종료합니다",
|
|
174
|
+
icon: lucide_react.StopCircleIcon,
|
|
175
|
+
color: "bg-red-500",
|
|
176
|
+
category: "종료"
|
|
177
|
+
}];
|
|
178
|
+
// src/lib/get-step-node-definition.ts
|
|
179
|
+
/**
|
|
180
|
+
* 스텝의 노드 정의 — webhook처럼 ID가 같은 트리거·액션도 스텝 종류로 구분한다.
|
|
181
|
+
*
|
|
182
|
+
* 🔑 조건·종료 스텝은 `nodeDefinitionId` 없이 저장된 행·템플릿이 많다(예전 에디터와
|
|
183
|
+
* `defineTemplate`이 안 적었다). 그때는 종류에서 기본 정의를 고른다 — 안 고르면 설정
|
|
184
|
+
* 패널이 "추가 설정이 필요하지 않습니다"라고 말하며 조건식 칸을 숨긴다(2026-09-23 실측).
|
|
185
|
+
*/
|
|
186
|
+
function getStepNodeDefinition(step) {
|
|
187
|
+
var _ref, _step$nodeDefinitionI, _step$nodeDefinition;
|
|
188
|
+
const definitions = step.type === "trigger" ? require_node_definitions.triggerDefinitions : step.type === "condition" ? conditionDefinitions : step.type === "end" ? endDefinitions : require_node_definitions.actionDefinitions;
|
|
189
|
+
const id = (_ref = (_step$nodeDefinitionI = step.nodeDefinitionId) !== null && _step$nodeDefinitionI !== void 0 ? _step$nodeDefinitionI : (_step$nodeDefinition = step.nodeDefinition) === null || _step$nodeDefinition === void 0 ? void 0 : _step$nodeDefinition.id) !== null && _ref !== void 0 ? _ref : step.type;
|
|
190
|
+
const found = definitions.find((node) => node.id === id);
|
|
191
|
+
if (found) return found;
|
|
192
|
+
if (step.type === "condition") {
|
|
193
|
+
var _step$config, _step$config2, _step$config3;
|
|
194
|
+
const wantsSwitch = ((_step$config = step.config) === null || _step$config === void 0 ? void 0 : _step$config.conditionType) === "switch" || ((_step$config2 = step.config) === null || _step$config2 === void 0 ? void 0 : _step$config2.conditionType) === void 0 && typeof ((_step$config3 = step.config) === null || _step$config3 === void 0 ? void 0 : _step$config3.switchValue) === "string";
|
|
195
|
+
return conditionDefinitions.find((node) => node.id === (wantsSwitch ? "condition-switch" : "condition-if-else"));
|
|
196
|
+
}
|
|
197
|
+
if (step.type === "end") return endDefinitions[0];
|
|
198
|
+
return step.nodeDefinition;
|
|
199
|
+
}
|
|
200
|
+
// src/lib/step-type-for-node.ts
|
|
201
|
+
/**
|
|
202
|
+
* 노드 id → 그리드 스텝 타입 — 한 벌. 에디터 설정 패널과 AI 에이전트가 같은 표를 본다.
|
|
203
|
+
*
|
|
204
|
+
* 🔴 예전에는 이 표가 에디터(`components/grid/lib/step-type-meta.ts`)에만 있었고, AI
|
|
205
|
+
* 에이전트는 모델에게 `stepType`을 **직접** 고르게 했다. 프롬프트는 제어 노드(forEach·
|
|
206
|
+
* parallel…)를 "액션(stepType=action)" 아래에 나열해, 모델이 반복을 액션 타입으로 넣을 수
|
|
207
|
+
* 있었다 — 실행기는 그 스텝을 반복이 아니라 액션 핸들러로 보낸다. 타입은 고르게 하지 않고
|
|
208
|
+
* 노드에서 파생한다.
|
|
209
|
+
*/
|
|
210
|
+
/** nodeDefinitionId → 실제 GridStepType 매핑 (제어 노드용) */
|
|
211
|
+
const NODE_ID_TO_STEP_TYPE = {
|
|
212
|
+
parallel: "parallel",
|
|
213
|
+
join: "join",
|
|
214
|
+
forEach: "forEach",
|
|
215
|
+
while: "while",
|
|
216
|
+
repeat: "repeat",
|
|
217
|
+
loopEnd: "loopEnd",
|
|
218
|
+
tryCatch: "tryCatch"
|
|
219
|
+
};
|
|
220
|
+
/** 노드 id가 들어갈 스텝 타입. 카탈로그 액션은 `action`. */
|
|
221
|
+
function stepTypeForNode(nodeDefinitionId) {
|
|
222
|
+
var _NODE_ID_TO_STEP_TYPE;
|
|
223
|
+
if (require_node_definitions.triggerDefinitions.some((node) => node.id === nodeDefinitionId)) return "trigger";
|
|
224
|
+
if (conditionDefinitions.some((node) => node.id === nodeDefinitionId)) return "condition";
|
|
225
|
+
if (endDefinitions.some((node) => node.id === nodeDefinitionId)) return "end";
|
|
226
|
+
return (_NODE_ID_TO_STEP_TYPE = NODE_ID_TO_STEP_TYPE[nodeDefinitionId]) !== null && _NODE_ID_TO_STEP_TYPE !== void 0 ? _NODE_ID_TO_STEP_TYPE : "action";
|
|
227
|
+
}
|
|
228
|
+
Object.defineProperty(exports, "NODE_ID_TO_STEP_TYPE", {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
get: function() {
|
|
231
|
+
return NODE_ID_TO_STEP_TYPE;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(exports, "NODE_OUTPUTS", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function() {
|
|
237
|
+
return NODE_OUTPUTS;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(exports, "SPECIAL_VARIABLES", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function() {
|
|
243
|
+
return SPECIAL_VARIABLES;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "TRIGGER_PAYLOADS", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function() {
|
|
249
|
+
return TRIGGER_PAYLOADS;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
Object.defineProperty(exports, "conditionDefinitions", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function() {
|
|
255
|
+
return conditionDefinitions;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
Object.defineProperty(exports, "endDefinitions", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function() {
|
|
261
|
+
return endDefinitions;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(exports, "getStepNodeDefinition", {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function() {
|
|
267
|
+
return getStepNodeDefinition;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
Object.defineProperty(exports, "registerNodeOutputs", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function() {
|
|
273
|
+
return registerNodeOutputs;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(exports, "stepTypeForNode", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function() {
|
|
279
|
+
return stepTypeForNode;
|
|
280
|
+
}
|
|
281
|
+
});
|