@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,258 @@
|
|
|
1
|
+
import { _ as GridStep, p as GridConnection } from "./grid-workflow-dto-C86EArJP.js";
|
|
2
|
+
/**
|
|
3
|
+
* 실패 종류(`FailureKind`) — **에러 클래스가 사라지기 전에** 붙잡아 두는 타입 신호.
|
|
4
|
+
*
|
|
5
|
+
* 🔴 왜 필요한가: 스텝 실패는 `StepExecutionResult.error`에 **문자열 하나**로만 남는다.
|
|
6
|
+
* 그 순간 `FatalError`/`RetryableError`/`TimeoutError`/`SsrfBlockedError`의 구분이
|
|
7
|
+
* 통째로 증발하고, 나중에 원인을 가르려면 한국어 문장을 정규식으로 더듬는 수밖에 없다
|
|
8
|
+
* (문구가 바뀌면 조용히 오분류된다 — 진단을 문구로 하지 말라는 규율과 정확히 반대).
|
|
9
|
+
*
|
|
10
|
+
* 그래서 **던진 쪽이 아는 사실**을 그 자리에서 타입으로 적는다. 실패 분석기는
|
|
11
|
+
* 문자열이 아니라 이 필드를 먼저 본다.
|
|
12
|
+
*
|
|
13
|
+
* 🔑 `unknown`은 "분류 실패"가 아니라 **"우리 코드가 만든 에러가 아니다"**라는 사실이다
|
|
14
|
+
* (외부 서비스 응답, 사용자 코드 예외, 프로바이더 SDK 에러). 0과 모름을 구분하듯
|
|
15
|
+
* 이 둘을 같은 값으로 적지 않는다 — 실패 분석기가 모델을 부를지 말지가 여기서 갈린다.
|
|
16
|
+
*/
|
|
17
|
+
declare const FAILURE_KINDS: readonly [
|
|
18
|
+
/** 재시도해도 의미 없는 확정 실패 (설정·대상 없음 등) */
|
|
19
|
+
"fatal",
|
|
20
|
+
/** 일시적 실패 — 재시도 대상이었다 (429·5xx·네트워크) */
|
|
21
|
+
"retryable",
|
|
22
|
+
/** 스텝 타임아웃 */
|
|
23
|
+
"timeout",
|
|
24
|
+
/** 실행 중단 (취소·예산 소진·전체 타임아웃) */
|
|
25
|
+
"aborted",
|
|
26
|
+
/** SSRF 가드가 목적지를 막았다 */
|
|
27
|
+
"blocked-address",
|
|
28
|
+
/** 설정 스키마 검증 실패 — 실행 전에 거절됐다 */
|
|
29
|
+
"invalid-config",
|
|
30
|
+
/** 핸들러 미등록 — 배선 결함 */
|
|
31
|
+
"missing-handler",
|
|
32
|
+
/** 우리 코드가 만든 에러가 아니다 — 외부 응답·사용자 코드 */
|
|
33
|
+
"unknown"];
|
|
34
|
+
type FailureKind = (typeof FAILURE_KINDS)[number];
|
|
35
|
+
/**
|
|
36
|
+
* 워크플로우 실행 컨텍스트
|
|
37
|
+
* 워크플로우 실행 중 전달되는 공유 상태
|
|
38
|
+
*/
|
|
39
|
+
type WorkflowExecutionContext = {
|
|
40
|
+
/** 실행 ID (WorkflowRun.id) */
|
|
41
|
+
runId: string;
|
|
42
|
+
/** 워크플로우 ID */
|
|
43
|
+
workflowId: string;
|
|
44
|
+
/** 워크스페이스 ID */
|
|
45
|
+
workspaceId: string;
|
|
46
|
+
/** 실행한 사용자 ID */
|
|
47
|
+
userId: string;
|
|
48
|
+
/** 트리거 파라미터 (외부에서 전달된 입력) */
|
|
49
|
+
params: Record<string, unknown>;
|
|
50
|
+
/** 스텝 간 공유되는 변수 저장소 */
|
|
51
|
+
variables: Record<string, unknown>;
|
|
52
|
+
/** 현재 실행 중인 스텝 ID */
|
|
53
|
+
currentStepId?: string;
|
|
54
|
+
/** 이전 스텝들의 실행 결과 */
|
|
55
|
+
previousResults: Map<string, StepExecutionResult>;
|
|
56
|
+
/** 트리거 유형 */
|
|
57
|
+
triggeredBy: TriggerSource;
|
|
58
|
+
/**
|
|
59
|
+
* 현재 parallel/loop 중첩 깊이. 핸들러 진입 시 +1, finally에서 복원.
|
|
60
|
+
* MAX_NESTING_DEPTH 초과 시 FatalError로 종료된다.
|
|
61
|
+
*/
|
|
62
|
+
nestingDepth?: number;
|
|
63
|
+
/**
|
|
64
|
+
* 클라이언트로 커스텀 데이터를 스트리밍합니다.
|
|
65
|
+
* 핸들러 내에서 진행률, 중간 메시지 등을 실시간 전달할 때 사용합니다.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* context.emit({ progress: 50, message: "처리 중..." });
|
|
69
|
+
* context.emit({ log: "Step 2 완료" }, { namespace: "logs" });
|
|
70
|
+
*/
|
|
71
|
+
emit: (data: unknown, options?: {
|
|
72
|
+
namespace?: string;
|
|
73
|
+
}) => Promise<void>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 트리거 소스
|
|
77
|
+
*/
|
|
78
|
+
type TriggerSource = "manual" | "schedule" | "webhook" | "event";
|
|
79
|
+
/**
|
|
80
|
+
* 스텝 실행 결과
|
|
81
|
+
*/
|
|
82
|
+
type StepExecutionResult = {
|
|
83
|
+
stepId: string;
|
|
84
|
+
success: boolean;
|
|
85
|
+
output?: unknown;
|
|
86
|
+
error?: string;
|
|
87
|
+
executedAt: Date;
|
|
88
|
+
duration: number;
|
|
89
|
+
/** 타임아웃으로 실패했는지 여부 */
|
|
90
|
+
timedOut?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* 실패 종류 — 에러 **클래스를 아는 자리에서** 적는다.
|
|
93
|
+
* 문자열 error만 남으면 원인을 문구로 더듬어야 하므로(문구가 바뀌면 오분류),
|
|
94
|
+
* 던진 쪽이 아는 사실을 타입으로 보존한다. 상세: `engine/failure-kind.ts`.
|
|
95
|
+
*/
|
|
96
|
+
failureKind?: FailureKind;
|
|
97
|
+
/** 재시도 횟수 (0이면 첫 시도에 성공/실패) */
|
|
98
|
+
retryCount?: number;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* 스텝 실행 상태
|
|
102
|
+
*/
|
|
103
|
+
type StepExecutionStatus = "pending" | "running" | "completed" | "failed" | "skipped" | "timeout";
|
|
104
|
+
/**
|
|
105
|
+
* 스텝 실행 기록
|
|
106
|
+
*/
|
|
107
|
+
type StepExecutionRecord = {
|
|
108
|
+
stepId: string;
|
|
109
|
+
stepLabel: string;
|
|
110
|
+
stepType: string;
|
|
111
|
+
/**
|
|
112
|
+
* 노드 정의 id(`sendEmail`·`slackMessage`…).
|
|
113
|
+
*
|
|
114
|
+
* 🔑 `stepType`은 그리드 종류(`action`·`condition`)일 뿐 **어떤 통합인지**를 말하지
|
|
115
|
+
* 않는다. 실패 원인 판정에서 이 값이 가장 큰 단서다 — 실측(2026-09-19): 같은
|
|
116
|
+
* `channel_not_found` 문구가 `slackMessage`와 함께 가면 확신 0.63, `action`만
|
|
117
|
+
* 가면 0.39로 떨어져 문턱 아래가 됐다.
|
|
118
|
+
*/
|
|
119
|
+
nodeId?: string;
|
|
120
|
+
status: StepExecutionStatus;
|
|
121
|
+
startedAt?: Date;
|
|
122
|
+
completedAt?: Date;
|
|
123
|
+
duration?: number;
|
|
124
|
+
/** 변수 해석이 끝난 설정값 (디버깅용 — PII 마스킹 후 저장) */
|
|
125
|
+
input?: unknown;
|
|
126
|
+
/**
|
|
127
|
+
* 값을 찾지 못해 빈 문자열로 치환된 변수 경로들.
|
|
128
|
+
* 실행을 막지는 않지만(선택 변수 사용이 정상 패턴), 빈 값이 나간 이유를
|
|
129
|
+
* 런 상세에서 즉시 볼 수 있어야 한다.
|
|
130
|
+
*/
|
|
131
|
+
unresolvedVariables?: string[];
|
|
132
|
+
result?: unknown;
|
|
133
|
+
error?: string;
|
|
134
|
+
/**
|
|
135
|
+
* 실패 종류 — 에러 **클래스를 아는 자리에서** 적는다(`engine/failure-kind.ts`).
|
|
136
|
+
* 문자열 error만 남으면 원인을 문구로 더듬어야 하고, 문구가 바뀌면 조용히 오분류된다.
|
|
137
|
+
*/
|
|
138
|
+
failureKind?: FailureKind;
|
|
139
|
+
/**
|
|
140
|
+
* 실패했지만 `continueOnError`로 **흐름이 이어졌다**.
|
|
141
|
+
* 🔑 실패 사실을 지우지 않는다 — 화면이 "실패"와 "실패했지만 계속됨"을 구분해
|
|
142
|
+
* 보여줘야 사용자가 "왜 성공인데 스텝이 빨갛지?"에서 멈추지 않는다.
|
|
143
|
+
*/
|
|
144
|
+
toleratedFailure?: boolean;
|
|
145
|
+
retryCount: number;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* 워크플로우 실행 옵션
|
|
149
|
+
*/
|
|
150
|
+
type WorkflowExecutionOptions = {
|
|
151
|
+
/** 메인 체인의 최대 스텝 수 (무한 루프 방지) — 기본값: 100 */
|
|
152
|
+
maxSteps?: number;
|
|
153
|
+
/**
|
|
154
|
+
* 실행 **전체**(메인 체인 + 병렬 브랜치 + 반복 본문)의 스텝 수 하드 상한.
|
|
155
|
+
* 기본값: 50,000. `maxSteps`와 별개인 이유는 반복 본문이 정상적으로 수천 스텝을
|
|
156
|
+
* 돌 수 있기 때문이다 — 이 축은 "정상 반복"이 아니라 **순환 연결**을 잡는다.
|
|
157
|
+
*/
|
|
158
|
+
maxTotalSteps?: number;
|
|
159
|
+
/** 개별 스텝 타임아웃 (밀리초) - 기본값: 60000 */
|
|
160
|
+
stepTimeout?: number;
|
|
161
|
+
/** 전체 워크플로우 타임아웃 (밀리초) - 기본값: 300000 (5분) */
|
|
162
|
+
workflowTimeout?: number;
|
|
163
|
+
/** 디버그 모드 */
|
|
164
|
+
debug?: boolean;
|
|
165
|
+
/** 드라이런 모드 (실제 실행 없이 검증만) */
|
|
166
|
+
dryRun?: boolean;
|
|
167
|
+
/** 브레이크포인트가 설정된 스텝 ID 목록 */
|
|
168
|
+
breakpoints?: string[];
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* 워크플로우 실행 결과
|
|
172
|
+
*/
|
|
173
|
+
type WorkflowExecutionResult = {
|
|
174
|
+
success: boolean;
|
|
175
|
+
runId: string;
|
|
176
|
+
startedAt: Date;
|
|
177
|
+
completedAt: Date;
|
|
178
|
+
duration: number;
|
|
179
|
+
stepsExecuted: number;
|
|
180
|
+
stepResults: StepExecutionRecord[];
|
|
181
|
+
finalOutput?: unknown;
|
|
182
|
+
error?: string;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* 변수 해석 결과
|
|
186
|
+
*/
|
|
187
|
+
type ResolvedValue<T = unknown> = {
|
|
188
|
+
value: T;
|
|
189
|
+
wasVariable: boolean;
|
|
190
|
+
originalExpression?: string;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* 워크플로우 그래프 노드 (실행 순서 계산용)
|
|
194
|
+
*/
|
|
195
|
+
type ExecutionGraphNode = {
|
|
196
|
+
step: GridStep;
|
|
197
|
+
incomingConnections: GridConnection[];
|
|
198
|
+
outgoingConnections: GridConnection[];
|
|
199
|
+
inDegree: number;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* 실행 경로
|
|
203
|
+
*/
|
|
204
|
+
type ExecutionPath = {
|
|
205
|
+
steps: GridStep[];
|
|
206
|
+
connections: GridConnection[];
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* 실시간 실행 이벤트 타입 (SSE용)
|
|
210
|
+
*/
|
|
211
|
+
type ExecutionEventType = "connected" | "workflow-start" | "workflow-complete" | "workflow-failed" | "step-start" | "step-complete" | "step-failed" | "step-retry" | "step-skipped" | "step-paused" | "step-resumed" | "condition-evaluated" | "step-data";
|
|
212
|
+
/**
|
|
213
|
+
* 실시간 실행 이벤트 (SSE 스트리밍용)
|
|
214
|
+
*/
|
|
215
|
+
type ExecutionEvent = {
|
|
216
|
+
type: ExecutionEventType;
|
|
217
|
+
runId: string;
|
|
218
|
+
workflowId: string;
|
|
219
|
+
stepId?: string;
|
|
220
|
+
stepLabel?: string;
|
|
221
|
+
status?: StepExecutionStatus;
|
|
222
|
+
/** 이벤트 순번 (Resumable Stream용, 0부터 시작) */
|
|
223
|
+
index?: number;
|
|
224
|
+
data?: {
|
|
225
|
+
input?: unknown;
|
|
226
|
+
unresolvedVariables?: string[];
|
|
227
|
+
failureKind?: FailureKind;
|
|
228
|
+
toleratedFailure?: boolean;
|
|
229
|
+
output?: unknown;
|
|
230
|
+
error?: string;
|
|
231
|
+
duration?: number;
|
|
232
|
+
retryCount?: number;
|
|
233
|
+
progress?: number;
|
|
234
|
+
totalSteps?: number;
|
|
235
|
+
currentStep?: number;
|
|
236
|
+
message?: string;
|
|
237
|
+
variables?: Record<string, unknown>;
|
|
238
|
+
conditionDetails?: ConditionEvalDetails;
|
|
239
|
+
/** step-data 이벤트의 커스텀 데이터 */
|
|
240
|
+
streamData?: unknown;
|
|
241
|
+
/** step-data 이벤트의 네임스페이스 */
|
|
242
|
+
namespace?: string;
|
|
243
|
+
};
|
|
244
|
+
timestamp: Date;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* 조건 평가 상세 정보
|
|
248
|
+
*/
|
|
249
|
+
type ConditionEvalDetails = {
|
|
250
|
+
conditionType: "if-else" | "switch" | "group";
|
|
251
|
+
leftValue?: unknown;
|
|
252
|
+
operator?: string;
|
|
253
|
+
rightValue?: unknown;
|
|
254
|
+
result: boolean | string;
|
|
255
|
+
expression?: string;
|
|
256
|
+
resolvedExpression?: string;
|
|
257
|
+
};
|
|
258
|
+
export { ExecutionPath as a, StepExecutionResult as c, WorkflowExecutionContext as d, WorkflowExecutionOptions as f, FailureKind as h, ExecutionGraphNode as i, StepExecutionStatus as l, FAILURE_KINDS as m, ExecutionEvent as n, ResolvedValue as o, WorkflowExecutionResult as p, ExecutionEventType as r, StepExecutionRecord as s, ConditionEvalDetails as t, TriggerSource as u };
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* 노드 아이콘 — `className`을 받는 컴포넌트면 된다. 특정 아이콘 라이브러리에 묶지 않는다
|
|
4
|
+
* (호스트와 모듈의 아이콘 패키지 버전이 달라도 주입할 수 있어야 한다).
|
|
5
|
+
*/
|
|
6
|
+
type NodeIcon = ComponentType<{
|
|
7
|
+
className?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** 노드 카테고리 — 런타임 레지스트리의 분류. 화면 그룹은 `editorCategory`다. */
|
|
10
|
+
type NodeCategory = "trigger" | "communication" | "crm" | "integration" | "ai" | "flow" | "utility" | "control";
|
|
11
|
+
/**
|
|
12
|
+
* 필드 타입. 앞의 것들은 에디터가 직접 그린다. `json`·`code`·`variable`·`multiselect`는 의미
|
|
13
|
+
* 타입이라 `editorType`으로 그릴 컨트롤을 정해야 한다. 그 밖의 문자열은 **호스트가 등록한
|
|
14
|
+
* 필드 렌더러**의 이름이다(`WorkflowHost.fields`).
|
|
15
|
+
*/
|
|
16
|
+
type FieldType = "text" | "email" | "number" | "select" | "multiselect" | "textarea" | "code" | "json" | "boolean" | "variable" | (string & {});
|
|
17
|
+
/** UI 필드 정의 — 에디터와 런타임이 같은 선언을 쓴다. */
|
|
18
|
+
type NodeFieldDefinition = {
|
|
19
|
+
/** 필드 키 (config 객체의 키) */
|
|
20
|
+
key: string;
|
|
21
|
+
/** 필드 라벨 */
|
|
22
|
+
label: string;
|
|
23
|
+
/** 필드 타입 */
|
|
24
|
+
type: FieldType;
|
|
25
|
+
/** 필수 여부 */
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/** 플레이스홀더 */
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** 기본값 */
|
|
30
|
+
defaultValue?: unknown;
|
|
31
|
+
/** 도움말 텍스트 */
|
|
32
|
+
helpText?: string;
|
|
33
|
+
/** select/multiselect 옵션 */
|
|
34
|
+
options?: Array<{
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* 이 필드를 **설정 패널에 열지 않는다**(값은 다른 경로가 채운다). 캔버스 연결이 채우는
|
|
40
|
+
* 스텝 ID 목록 등에 쓴다.
|
|
41
|
+
*/
|
|
42
|
+
hiddenInEditor?: boolean;
|
|
43
|
+
/** 조건부 표시 (다른 필드 값에 따라) */
|
|
44
|
+
showWhen?: {
|
|
45
|
+
field: string;
|
|
46
|
+
value: unknown;
|
|
47
|
+
};
|
|
48
|
+
/** 유효성 검사 규칙 */
|
|
49
|
+
validation?: {
|
|
50
|
+
min?: number;
|
|
51
|
+
max?: number;
|
|
52
|
+
pattern?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** Browser-safe metadata shared by the editor and the executable node. */
|
|
57
|
+
type NodeContract = {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
icon: NodeIcon;
|
|
62
|
+
color: string;
|
|
63
|
+
category: NodeCategory;
|
|
64
|
+
/** Editor grouping is independent of the runtime registry category. */
|
|
65
|
+
editorCategory: string;
|
|
66
|
+
comingSoon?: boolean;
|
|
67
|
+
/** 이 노드로 새 스텝을 만들 때의 첫 설정값(예: "아직 대상을 고르지 않음"을 뜻하는 null). */
|
|
68
|
+
initialConfig?: Record<string, unknown>;
|
|
69
|
+
fields: Array<NodeFieldDefinition & {
|
|
70
|
+
/** Rendering substitute for semantic types such as json/code/variable. */
|
|
71
|
+
editorType?: string;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
type NodeConfigFieldOption = NonNullable<NodeFieldDefinition["options"]>[number];
|
|
75
|
+
type NodeConfigField = Pick<NodeFieldDefinition, "key" | "label" | "required" | "options" | "placeholder" | "helpText" | "showWhen"> & {
|
|
76
|
+
type: "text" | "email" | "number" | "select" | "textarea" | "boolean" |
|
|
77
|
+
/** 호스트가 등록한 필드 렌더러의 이름(`WorkflowHost.fields`). */
|
|
78
|
+
(string & {});
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* 노드 출력(또는 트리거 페이로드) 필드 메타 — 변수 픽커가 "이전 스텝이 어떤
|
|
82
|
+
* 값을 내놓는지"를 보여주기 위한 클라이언트 안전 스키마.
|
|
83
|
+
* 실제 값 형태의 단일 진실 공급원은 lib/nodes/* 의 Result 타입이며,
|
|
84
|
+
* lib/node-definitions/output-schemas.ts 가 이를 미러한다(드리프트 테스트로 고정).
|
|
85
|
+
*/
|
|
86
|
+
type NodeOutputField = {
|
|
87
|
+
key: string;
|
|
88
|
+
label: string;
|
|
89
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
90
|
+
description?: string;
|
|
91
|
+
/** 픽커 미리보기용 예시 값 */
|
|
92
|
+
example?: string;
|
|
93
|
+
/** object 타입의 하위 필드 (점 표기 경로로 펼쳐짐) */
|
|
94
|
+
children?: NodeOutputField[];
|
|
95
|
+
};
|
|
96
|
+
type NodeDefinition = {
|
|
97
|
+
id: string;
|
|
98
|
+
type: "trigger" | "action" | "condition";
|
|
99
|
+
name: string;
|
|
100
|
+
description: string;
|
|
101
|
+
icon: NodeIcon;
|
|
102
|
+
color: string;
|
|
103
|
+
category: string;
|
|
104
|
+
/** 외부 서비스 미연동 등으로 아직 사용할 수 없는 노드 — 에디터에서 비활성 표시 */
|
|
105
|
+
comingSoon?: boolean;
|
|
106
|
+
/** 이 노드로 새 스텝을 만들 때의 첫 설정값. 없으면 빈 설정이다. */
|
|
107
|
+
initialConfig?: Record<string, unknown>;
|
|
108
|
+
config?: {
|
|
109
|
+
fields: NodeConfigField[];
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* 노드 카탈로그 — 에디터의 피커·설정 패널·점검·AI 제안이 전부 여기서 읽는다.
|
|
114
|
+
*
|
|
115
|
+
* 내장 범용 노드(반복·병렬·대기·HTTP 등)는 모듈이 넣고, 제품 고유 노드는 호스트가
|
|
116
|
+
* `registerNodeContracts`로 더한다. 등록은 **덧붙이기**이고 같은 `종류:id`를 다시 넣으면
|
|
117
|
+
* 그 자리를 갈아 끼운다(HMR·재마운트에서 중복이 쌓이지 않는다). 배열 객체는 바뀌지 않는다 —
|
|
118
|
+
* 이미 import한 쪽이 등록 뒤의 내용을 본다.
|
|
119
|
+
*/
|
|
120
|
+
/** 내장 트리거 — 수동·일정·웹훅. 제품 이벤트 트리거는 호스트가 더한다. */
|
|
121
|
+
declare const builtInTriggerContracts: readonly NodeContract[];
|
|
122
|
+
/**
|
|
123
|
+
* 내장 액션·제어 노드. 반복·병렬은 캔버스가 구조로 아는 종류라(마커 짝짓기·브랜치 채우기)
|
|
124
|
+
* 모듈이 갖고, 대기·HTTP·데이터 변환은 어떤 제품에서도 뜻이 같은 범용 액션이다.
|
|
125
|
+
*/
|
|
126
|
+
declare const builtInActionContracts: readonly NodeContract[];
|
|
127
|
+
declare const triggerDefinitions: NodeDefinition[];
|
|
128
|
+
declare const actionDefinitions: NodeDefinition[];
|
|
129
|
+
type NodeContractRegistration = {
|
|
130
|
+
triggers?: readonly NodeContract[];
|
|
131
|
+
actions?: readonly NodeContract[];
|
|
132
|
+
/**
|
|
133
|
+
* `append`(기본)는 지금 카탈로그에 더한다. `replace`는 준 목록이 **그 종류의 카탈로그 전체**가
|
|
134
|
+
* 된다 — 피커에 보이는 순서까지 호스트가 정하고 싶을 때 쓴다. 내장 노드를 남기려면
|
|
135
|
+
* `builtInTriggerContracts`·`builtInActionContracts`에서 골라 목록에 함께 넣는다.
|
|
136
|
+
* 🔴 반복·병렬 마커(forEach·while·repeat·loopEnd·parallel·join)는 캔버스가 구조로 아는
|
|
137
|
+
* 노드다. `replace`로 빼면 그 스텝을 놓을 수 없다.
|
|
138
|
+
*/
|
|
139
|
+
mode?: "append" | "replace";
|
|
140
|
+
/**
|
|
141
|
+
* 이 등록의 주인(에디터 하나). 주면 **그 주인에게만 보이는** 노드가 된다 — 전역 카탈로그의
|
|
142
|
+
* 순서와 내용은 건드리지 않는다(`replace`도 그 주인의 목록만 정한다). 에디터가 `nodes` prop을
|
|
143
|
+
* 등록할 때 쓴다. 호스트가 직접 부를 때는 비운다(전역).
|
|
144
|
+
*/
|
|
145
|
+
scope?: NodeCatalogScope;
|
|
146
|
+
};
|
|
147
|
+
/** 카탈로그 범위의 정체 — 에디터마다 하나. 값이 아니라 참조로 구분한다. */
|
|
148
|
+
type NodeCatalogScope = object;
|
|
149
|
+
declare function registerNodeContracts({ triggers, actions, mode, scope }: NodeContractRegistration): void;
|
|
150
|
+
/** 카탈로그가 바뀔 때마다 오르는 숫자 — `useSyncExternalStore`의 스냅샷으로 쓴다. */
|
|
151
|
+
declare function getNodeCatalogVersion(): number;
|
|
152
|
+
declare function subscribeNodeCatalog(listener: () => void): () => void;
|
|
153
|
+
/** 트리거 + 액션. 호출할 때마다 지금의 카탈로그를 읽는다. */
|
|
154
|
+
declare function listNodeDefinitions(): NodeDefinition[];
|
|
155
|
+
declare function getNodeDefinition(id: string): NodeDefinition | undefined;
|
|
156
|
+
declare const GRID_SIZE = 9;
|
|
157
|
+
declare const CELL_WIDTH = 248;
|
|
158
|
+
declare const CELL_HEIGHT = 136;
|
|
159
|
+
declare const CELL_GAP = 40;
|
|
160
|
+
declare const CELL_PITCH_X: number;
|
|
161
|
+
declare const CELL_PITCH_Y: number;
|
|
162
|
+
declare const MAX_STEPS = 200;
|
|
163
|
+
declare const MAX_GRID_ROWS = 64;
|
|
164
|
+
declare const MAX_GRID_COLS = 16;
|
|
165
|
+
type GridStepType = "trigger" | "condition" | "action" | "end" | "parallel" | "join" | "forEach" | "while" | "repeat" | "loopEnd" | "tryCatch" | "errorHandler";
|
|
166
|
+
type GridPosition = {
|
|
167
|
+
row: number;
|
|
168
|
+
col: number;
|
|
169
|
+
};
|
|
170
|
+
type ConnectionDirection = "up" | "down" | "left" | "right";
|
|
171
|
+
type BranchType = "true" | "false" | "case" | "default";
|
|
172
|
+
type ConditionType = "if-else" | "switch";
|
|
173
|
+
declare const BRANCH_TYPE_COLORS: Record<BranchType, {
|
|
174
|
+
stroke: string;
|
|
175
|
+
fill: string;
|
|
176
|
+
label: string;
|
|
177
|
+
}>;
|
|
178
|
+
type GridStep = {
|
|
179
|
+
id: string;
|
|
180
|
+
position: GridPosition;
|
|
181
|
+
type: GridStepType;
|
|
182
|
+
label: string;
|
|
183
|
+
nodeDefinitionId?: string;
|
|
184
|
+
nodeDefinition?: NodeDefinition;
|
|
185
|
+
config: Record<string, unknown>;
|
|
186
|
+
/**
|
|
187
|
+
* 이 스텝이 실패해도 **다음 스텝으로 계속 진행**한다.
|
|
188
|
+
*
|
|
189
|
+
* 🔑 기본값은 중단이다 — 자동화가 절반만 돌고 성공으로 보고하는 것이 더 위험하다.
|
|
190
|
+
* 켜는 것은 사용자의 명시적 선택이고, 켜도 **스텝 기록은 실패로 남는다**(런 상세에서
|
|
191
|
+
* 자동으로 펼쳐진다). "계속 진행"은 실패를 지우는 것이 아니라 흐름을 잇는 것이다.
|
|
192
|
+
*
|
|
193
|
+
* ⚠️ 실행 중단(취소·예산 소진·전체 타임아웃)에는 적용되지 않는다 — 그것들은 스텝의
|
|
194
|
+
* 실패가 아니라 런의 종료 조건이다.
|
|
195
|
+
*/
|
|
196
|
+
continueOnError?: boolean;
|
|
197
|
+
};
|
|
198
|
+
type GridConnection = {
|
|
199
|
+
id: string;
|
|
200
|
+
fromStepId: string;
|
|
201
|
+
toStepId: string;
|
|
202
|
+
fromPosition: GridPosition;
|
|
203
|
+
toPosition: GridPosition;
|
|
204
|
+
label?: string;
|
|
205
|
+
condition?: string;
|
|
206
|
+
branchType?: BranchType;
|
|
207
|
+
branchValue?: string;
|
|
208
|
+
};
|
|
209
|
+
type GridWorkflowDefinition = {
|
|
210
|
+
steps: GridStep[];
|
|
211
|
+
connections: GridConnection[];
|
|
212
|
+
gridSize: number;
|
|
213
|
+
/**
|
|
214
|
+
* 테스트 실행에 쓰는 트리거 샘플 페이로드(`{{params.*}}`) — 워크플로우와 함께 저장한다.
|
|
215
|
+
* 참조 구현의 입력 노드 `sample`과 같은 뜻: 매번 다시 치지 않고 "실행"이 한 번에 된다.
|
|
216
|
+
*/
|
|
217
|
+
testParams?: Record<string, unknown>;
|
|
218
|
+
};
|
|
219
|
+
type GridWorkflowDto = {
|
|
220
|
+
id: string;
|
|
221
|
+
name: string;
|
|
222
|
+
description?: string;
|
|
223
|
+
status: "draft" | "active" | "inactive";
|
|
224
|
+
definition: GridWorkflowDefinition;
|
|
225
|
+
createdAt: Date;
|
|
226
|
+
updatedAt: Date;
|
|
227
|
+
};
|
|
228
|
+
type GridSelectionState = {
|
|
229
|
+
selectedCell: GridPosition | null;
|
|
230
|
+
selectedStepId: string | null;
|
|
231
|
+
};
|
|
232
|
+
type ConnectionModeState = {
|
|
233
|
+
isActive: boolean;
|
|
234
|
+
startPosition: GridPosition | null;
|
|
235
|
+
startStepId: string | null;
|
|
236
|
+
};
|
|
237
|
+
type GridEditorState = {
|
|
238
|
+
steps: GridStep[];
|
|
239
|
+
connections: GridConnection[];
|
|
240
|
+
selection: GridSelectionState;
|
|
241
|
+
connectionMode: ConnectionModeState;
|
|
242
|
+
isLoading: boolean;
|
|
243
|
+
isSaving: boolean;
|
|
244
|
+
error: string | null;
|
|
245
|
+
};
|
|
246
|
+
type HistoryActionType = "ADD_STEP" | "UPDATE_STEP" | "DELETE_STEP" | "ADD_CONNECTION" | "DELETE_CONNECTION" | "MOVE_STEP";
|
|
247
|
+
type HistoryItem = {
|
|
248
|
+
type: HistoryActionType;
|
|
249
|
+
timestamp: number;
|
|
250
|
+
previousState: {
|
|
251
|
+
steps: GridStep[];
|
|
252
|
+
connections: GridConnection[];
|
|
253
|
+
};
|
|
254
|
+
currentState: {
|
|
255
|
+
steps: GridStep[];
|
|
256
|
+
connections: GridConnection[];
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
type PreviewStatus = "added" | "updated" | "deleted";
|
|
260
|
+
type GridCellState = {
|
|
261
|
+
position: GridPosition;
|
|
262
|
+
step: GridStep | null;
|
|
263
|
+
isSelected: boolean;
|
|
264
|
+
isConnectionStart: boolean;
|
|
265
|
+
isConnectedTo: boolean;
|
|
266
|
+
/** 연결 모드에서 이 스텝으로는 이을 수 없다(이미 연결·순환) — 흐리게 그린다 */
|
|
267
|
+
isConnectionBlocked?: boolean;
|
|
268
|
+
hasConnectionUp: boolean;
|
|
269
|
+
hasConnectionDown: boolean;
|
|
270
|
+
hasConnectionLeft: boolean;
|
|
271
|
+
hasConnectionRight: boolean;
|
|
272
|
+
hasBreakpoint?: boolean;
|
|
273
|
+
problemCount?: number;
|
|
274
|
+
isCurrentlyExecuting?: boolean;
|
|
275
|
+
/** AI 제안 미리보기 중 이 셀 스텝의 변경 상태 (없으면 unchanged) */
|
|
276
|
+
previewStatus?: PreviewStatus;
|
|
277
|
+
};
|
|
278
|
+
type WorkflowTemplate = {
|
|
279
|
+
id: string;
|
|
280
|
+
name: string;
|
|
281
|
+
description: string;
|
|
282
|
+
definition: GridWorkflowDefinition;
|
|
283
|
+
};
|
|
284
|
+
declare const STEP_TYPE_COLORS: Record<GridStepType, {
|
|
285
|
+
bg: string;
|
|
286
|
+
border: string;
|
|
287
|
+
text: string;
|
|
288
|
+
}>;
|
|
289
|
+
declare function positionToIndex(position: GridPosition): number;
|
|
290
|
+
declare function indexToPosition(index: number): GridPosition;
|
|
291
|
+
declare function isSamePosition(a: GridPosition | null, b: GridPosition | null): boolean;
|
|
292
|
+
/** 절대 상한(하드캡) 검사 — 렌더 바운드 검사는 lib/grid-bounds.isWithinBounds */
|
|
293
|
+
declare function isValidPosition(position: GridPosition): boolean;
|
|
294
|
+
declare function getAdjacentPosition(position: GridPosition, direction: ConnectionDirection): GridPosition | null;
|
|
295
|
+
declare function getConnectionDirection(from: GridPosition, to: GridPosition): ConnectionDirection | null;
|
|
296
|
+
declare function hasCycle(connections: GridConnection[], newConnection?: {
|
|
297
|
+
fromStepId: string;
|
|
298
|
+
toStepId: string;
|
|
299
|
+
}): boolean;
|
|
300
|
+
export { NodeFieldDefinition as $, getConnectionDirection as A, builtInActionContracts as B, MAX_GRID_COLS as C, STEP_TYPE_COLORS as D, PreviewStatus as E, positionToIndex as F, triggerDefinitions as G, getNodeCatalogVersion as H, getNodeDefinition as I, NodeDefinition as J, NodeConfigField as K, listNodeDefinitions as L, indexToPosition as M, isSamePosition as N, WorkflowTemplate as O, isValidPosition as P, NodeContract as Q, NodeContractRegistration as R, HistoryItem as S, MAX_STEPS as T, registerNodeContracts as U, builtInTriggerContracts as V, subscribeNodeCatalog as W, FieldType as X, NodeOutputField as Y, NodeCategory as Z, GridStep as _, CELL_PITCH_X as a, GridWorkflowDto as b, ConditionType as c, GRID_SIZE as d, NodeIcon as et, GridCellState as f, GridSelectionState as g, GridPosition as h, CELL_HEIGHT as i, hasCycle as j, getAdjacentPosition as k, ConnectionDirection as l, GridEditorState as m, BranchType as n, CELL_PITCH_Y as o, GridConnection as p, NodeConfigFieldOption as q, CELL_GAP as r, CELL_WIDTH as s, BRANCH_TYPE_COLORS as t, ConnectionModeState as u, GridStepType as v, MAX_GRID_ROWS as w, HistoryActionType as x, GridWorkflowDefinition as y, actionDefinitions as z };
|