@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/index.d.ts
ADDED
|
@@ -0,0 +1,794 @@
|
|
|
1
|
+
import { a as WorkflowExtensionContext, c as WorkflowHost, d as WorkflowRunsSource, f as WorkflowNotice, h as WorkflowToast, i as WorkflowEditorExtension, l as WorkflowRunDetail, m as WorkflowNoticeSink, n as RunRequestResult, o as WorkflowFieldRenderer, p as WorkflowNoticeKind, r as RunStartResult, s as WorkflowFieldRendererProps, t as RunEventStream, u as WorkflowRunner } from "./types-dVHX2CyI.js";
|
|
2
|
+
import { J as NodeDefinition, R as NodeContractRegistration, S as HistoryItem, Y as NodeOutputField, _ as GridStep, c as ConditionType, et as NodeIcon, f as GridCellState, h as GridPosition, l as ConnectionDirection, n as BranchType, p as GridConnection, v as GridStepType, y as GridWorkflowDefinition } from "./grid-workflow-dto-C86EArJP.js";
|
|
3
|
+
import { Ht as GridBounds, Mt as ViewportTransform, X as PreviewGraph, Z as WorkflowProposalOp, ut as OrderedPreviewSteps } from "./core-z3nXmUBj.js";
|
|
4
|
+
import { l as StepExecutionStatus, n as ExecutionEvent, s as StepExecutionRecord } from "./execution-context-YFTRCj0y.js";
|
|
5
|
+
import { s as WorkflowPreflightIssue, t as ExtendedWorkflowTemplate, y as WorkflowStepMetrics } from "./types-DQcmIuAl.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { ReactNode, RefObject } from "react";
|
|
8
|
+
import { DropdownContent, DropdownItem, DropdownMenu, DropdownSeparator } from "@reopt-ai/opt-ui/core";
|
|
9
|
+
import { MenuTrigger } from "@reopt-ai/opt-ui-primitives";
|
|
10
|
+
/**
|
|
11
|
+
* 화면 문구 — 원문(한국어)이 곧 키다.
|
|
12
|
+
*
|
|
13
|
+
* 코드에는 한국어 문장이 그대로 있고(`t("저장")`), 다른 언어는 "원문 → 번역" 사전 한 장이다.
|
|
14
|
+
* 사전에 없는 문장은 원문이 그대로 나온다 — 호스트가 등록한 노드의 이름처럼 이 패키지가 모르는
|
|
15
|
+
* 글은 호스트의 언어로 남는다. 값을 끼우는 자리는 `{이름}`이다.
|
|
16
|
+
*/
|
|
17
|
+
type WorkflowLocale = "ko" | "en";
|
|
18
|
+
/** 원문 → 번역. 일부만 줘도 된다(호스트가 문구 몇 개만 바꿀 때). */
|
|
19
|
+
type WorkflowMessages = Readonly<Record<string, string>>;
|
|
20
|
+
type Translate = (source: string, params?: Readonly<Record<string, string | number>>) => string;
|
|
21
|
+
export declare function createTranslator(locale?: WorkflowLocale, overrides?: WorkflowMessages): Translate;
|
|
22
|
+
export declare function WorkflowLocaleProvider({ locale, messages, children }: {
|
|
23
|
+
locale?: WorkflowLocale;
|
|
24
|
+
messages?: WorkflowMessages;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): React.JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* 에디터가 등록하는 명령. 선택은 비파괴적이고, 적용/폐기는 에디터의
|
|
29
|
+
* `commitProposal`/`discardPending` 에 위임한다(채팅 패널은 에디터 트리 바깥이라
|
|
30
|
+
* 직접 호출 불가 → 등록된 명령 경유). 등록은 1회, 호출은 ref 로 최신 클로저를 가리킨다.
|
|
31
|
+
*/
|
|
32
|
+
type WorkflowEditorCommands = {
|
|
33
|
+
selectStepById: (stepId: string | null) => void;
|
|
34
|
+
/** AI 제안 미리보기를 단일 undo 로 commit. */
|
|
35
|
+
applyProposal: () => void;
|
|
36
|
+
/** AI 제안 미리보기 폐기. */
|
|
37
|
+
discardProposal: () => void;
|
|
38
|
+
};
|
|
39
|
+
/** 에디터가 계산한 미리보기 요약 — 패널 리뷰 바가 읽는다(패널은 computePreviewGraph 미실행). */
|
|
40
|
+
type WorkflowPreviewSummary = {
|
|
41
|
+
added: number;
|
|
42
|
+
updated: number;
|
|
43
|
+
deleted: number;
|
|
44
|
+
warnings: string[];
|
|
45
|
+
};
|
|
46
|
+
type WorkflowEditorBridgeState = {
|
|
47
|
+
/** 에디터 마운트 여부 */
|
|
48
|
+
isRegistered: boolean;
|
|
49
|
+
/** 라이브 committed 스냅샷 (에디터가 변경마다 push) */
|
|
50
|
+
steps: GridStep[];
|
|
51
|
+
connections: GridConnection[];
|
|
52
|
+
selectedStep: GridStep | null;
|
|
53
|
+
/** 즉시-적용 명령 (미등록 시 null) */
|
|
54
|
+
commands: WorkflowEditorCommands | null;
|
|
55
|
+
/** AI 제안 staging 영역 (미리보기 후 승인) */
|
|
56
|
+
pendingOps: WorkflowProposalOp[];
|
|
57
|
+
/** 에디터가 push 하는 미리보기 요약 (패널 리뷰 바용, 미리보기 없으면 null) */
|
|
58
|
+
previewSummary: WorkflowPreviewSummary | null;
|
|
59
|
+
/**
|
|
60
|
+
* 생성 화면에서 방금 만들어진 워크플로우 id — 채팅 패널이 이 신호로 초안 대화를 새 id에
|
|
61
|
+
* 넘긴다(저장하면 편집 화면으로 옮겨 가는데, 세션 키가 워크플로우 id라 안 넘기면 대화가
|
|
62
|
+
* 끊긴다). 언마운트에도 지우지 않는다 — 바로 그 순간에 읽히는 값이다.
|
|
63
|
+
*/
|
|
64
|
+
createdWorkflowId: string | null;
|
|
65
|
+
registerEditor: (commands: WorkflowEditorCommands) => void;
|
|
66
|
+
unregisterEditor: () => void;
|
|
67
|
+
syncSnapshot: (snapshot: {
|
|
68
|
+
steps: GridStep[];
|
|
69
|
+
connections: GridConnection[];
|
|
70
|
+
selectedStep: GridStep | null;
|
|
71
|
+
}) => void;
|
|
72
|
+
setPreviewSummary: (summary: WorkflowPreviewSummary | null) => void;
|
|
73
|
+
/** 생성 화면이 저장에 성공했을 때 */
|
|
74
|
+
announceCreated: (workflowId: string) => void;
|
|
75
|
+
stageOp: (op: WorkflowProposalOp) => void;
|
|
76
|
+
discardPending: () => void;
|
|
77
|
+
};
|
|
78
|
+
type BridgeStore = {
|
|
79
|
+
getState: () => WorkflowEditorBridgeState;
|
|
80
|
+
subscribe: (listener: () => void) => () => void;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 브리지 저장소 하나를 만든다. 에디터 인스턴스마다 하나씩 가질 수 있다 — 한 화면에 에디터가
|
|
84
|
+
* 둘이어도 제안·선택이 섞이지 않는다.
|
|
85
|
+
*/
|
|
86
|
+
export declare function createWorkflowEditorBridge(): BridgeStore;
|
|
87
|
+
type WorkflowEditorBridge = BridgeStore;
|
|
88
|
+
/**
|
|
89
|
+
* 기본 브리지 — 에디터에 `bridge`를 따로 주지 않으면 이것을 쓴다(한 화면에 에디터 하나인
|
|
90
|
+
* 보통의 경우). 채팅 패널처럼 에디터 트리 밖에 있는 쪽이 같은 저장소를 읽는다.
|
|
91
|
+
*/
|
|
92
|
+
export declare const defaultWorkflowEditorBridge: WorkflowEditorBridge;
|
|
93
|
+
type BridgeHook = {
|
|
94
|
+
(): WorkflowEditorBridgeState;
|
|
95
|
+
<T>(selector: (state: WorkflowEditorBridgeState) => T): T;
|
|
96
|
+
getState: () => WorkflowEditorBridgeState;
|
|
97
|
+
};
|
|
98
|
+
/** 기본 브리지를 읽는 훅. `useWorkflowEditorBridge.getState()`로 렌더 밖에서도 읽는다. */
|
|
99
|
+
export declare const useWorkflowEditorBridge: BridgeHook;
|
|
100
|
+
/** 특정 브리지를 읽는 훅을 만든다(에디터가 주입받은 브리지용). */
|
|
101
|
+
export declare function bindWorkflowEditorBridge(store: BridgeStore): BridgeHook;
|
|
102
|
+
type GridWorkflowEditorProps = {
|
|
103
|
+
/** 저장된 문서의 id. 저장 전이면 비운다 — 실행은 "먼저 저장" 안내가 된다. */
|
|
104
|
+
workflowId?: string;
|
|
105
|
+
/** 바깥 세계와의 계약 — 실행·런 조회·커스텀 필드·템플릿·알림. 준 것만 화면에 나타난다. */
|
|
106
|
+
host?: WorkflowHost;
|
|
107
|
+
/**
|
|
108
|
+
* 제품 고유 노드. 내장 범용 노드에 더해진다. 🔑 참조를 고정할 것(모듈 최상위 상수) —
|
|
109
|
+
* 바뀔 때마다 카탈로그를 다시 등록한다. 이 에디터에만 보인다 — 한 화면의 다른 에디터는
|
|
110
|
+
* 자기 `nodes`만 본다. 모든 에디터가 함께 쓸 노드는 `registerNodeContracts`로 전역에 넣는다.
|
|
111
|
+
*/
|
|
112
|
+
nodes?: Omit<NodeContractRegistration, "scope"> & {
|
|
113
|
+
outputs?: Record<string, NodeOutputField[]>;
|
|
114
|
+
triggerPayloads?: Record<string, NodeOutputField[]>;
|
|
115
|
+
};
|
|
116
|
+
initialDefinition?: GridWorkflowDefinition;
|
|
117
|
+
initialName?: string;
|
|
118
|
+
/**
|
|
119
|
+
* 저장. 세 번째 인자는 `host.saveContext`를 그대로 돌려준 것이다. 성공하면 true.
|
|
120
|
+
* 없으면 읽기 전용에 가깝다 — 편집은 되지만 저장 버튼이 동작하지 않는다.
|
|
121
|
+
*/
|
|
122
|
+
onSave?: (name: string, definition: GridWorkflowDefinition, context: unknown) => Promise<boolean>;
|
|
123
|
+
onExecute?: () => void;
|
|
124
|
+
isSaving?: boolean;
|
|
125
|
+
/** 빈 상태일 때 템플릿 선택 다이얼로그 표시 */
|
|
126
|
+
showTemplateDialogOnEmpty?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* AI 제안 브리지. 한 화면에 에디터가 여럿이면 에디터마다 `createWorkflowEditorBridge()`로
|
|
129
|
+
* 만든 것을 준다. 안 주면 기본 브리지를 쓴다.
|
|
130
|
+
*/
|
|
131
|
+
bridge?: WorkflowEditorBridge;
|
|
132
|
+
/** 더보기 메뉴에 끼울 호스트 항목. */
|
|
133
|
+
menuExtras?: ReactNode;
|
|
134
|
+
/** 툴바 왼쪽에 호스트의 플로팅 버튼(뒤로가기 등) 자리를 비운다. */
|
|
135
|
+
reserveLeading?: boolean;
|
|
136
|
+
/** 화면 언어. 기본은 한국어. 사전에 없는 글(호스트 노드 이름 등)은 원문 그대로 나온다. */
|
|
137
|
+
locale?: WorkflowLocale;
|
|
138
|
+
/** 원문 → 문구. 일부만 줘도 된다 — 사전보다 먼저 본다. 🔑 참조를 고정할 것. */
|
|
139
|
+
messages?: WorkflowMessages;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* 워크플로우 에디터. 호스트 계약을 컨텍스트로 깔고 안쪽 에디터를 그린다 — 안쪽의 훅들이
|
|
143
|
+
* (실행·지표·알림) 그 컨텍스트에서 능력을 읽는다.
|
|
144
|
+
*/
|
|
145
|
+
declare function GridWorkflowEditor({ host, nodes, locale, messages, ...props }: GridWorkflowEditorProps): React.JSX.Element;
|
|
146
|
+
type StepExecutionState = Pick<StepExecutionRecord, "input" | "unresolvedVariables" | "failureKind" | "toleratedFailure"> & {
|
|
147
|
+
stepId: string;
|
|
148
|
+
stepLabel?: string;
|
|
149
|
+
status: StepExecutionStatus;
|
|
150
|
+
startedAt?: Date;
|
|
151
|
+
completedAt?: Date;
|
|
152
|
+
duration?: number;
|
|
153
|
+
error?: string;
|
|
154
|
+
output?: unknown;
|
|
155
|
+
retryCount?: number;
|
|
156
|
+
};
|
|
157
|
+
type StreamDataEvent = {
|
|
158
|
+
stepId: string;
|
|
159
|
+
stepLabel: string;
|
|
160
|
+
data: unknown;
|
|
161
|
+
namespace?: string;
|
|
162
|
+
timestamp: Date;
|
|
163
|
+
};
|
|
164
|
+
type WorkflowExecutionState = {
|
|
165
|
+
isConnected: boolean;
|
|
166
|
+
isRunning: boolean;
|
|
167
|
+
isCompleted: boolean;
|
|
168
|
+
isFailed: boolean;
|
|
169
|
+
isTimedOut: boolean;
|
|
170
|
+
isPaused: boolean;
|
|
171
|
+
pausedAtStepId: string | null;
|
|
172
|
+
debugVariables: Record<string, unknown> | null;
|
|
173
|
+
progress: number;
|
|
174
|
+
currentStepId: string | null;
|
|
175
|
+
totalSteps: number;
|
|
176
|
+
currentStep: number;
|
|
177
|
+
stepStates: Map<string, StepExecutionState>;
|
|
178
|
+
/** AI 생성 스텝의 부분 텍스트(누적) — 실행 중인 카드에 흘려 보여 준다 */
|
|
179
|
+
liveOutput: Map<string, string>;
|
|
180
|
+
error: string | null;
|
|
181
|
+
duration: number | null;
|
|
182
|
+
finalOutput: unknown | null;
|
|
183
|
+
events: ExecutionEvent[];
|
|
184
|
+
/** 마지막으로 수신한 이벤트의 인덱스 (재연결 시 사용) */
|
|
185
|
+
lastEventIndex: number;
|
|
186
|
+
/**
|
|
187
|
+
* 재연결 상한까지 붙지 못했다 — 실행이 서버에서 계속 도는지 **모른다**(끝났다는 뜻이
|
|
188
|
+
* 아니다). 화면은 "실행 기록에서 확인"으로 안내한다.
|
|
189
|
+
*/
|
|
190
|
+
connectionLost: boolean;
|
|
191
|
+
};
|
|
192
|
+
type UseWorkflowExecutionStreamOptions = {
|
|
193
|
+
workflowId: string;
|
|
194
|
+
runId: string | null;
|
|
195
|
+
enabled?: boolean;
|
|
196
|
+
onStepStart?: (stepId: string, stepLabel: string) => void;
|
|
197
|
+
onStepComplete?: (stepId: string, stepLabel: string, output: unknown) => void;
|
|
198
|
+
onStepFailed?: (stepId: string, stepLabel: string, error: string) => void;
|
|
199
|
+
onWorkflowComplete?: (output: unknown, duration: number) => void;
|
|
200
|
+
onWorkflowFailed?: (error: string, duration: number) => void;
|
|
201
|
+
/** 스텝에서 emit()으로 보낸 커스텀 데이터 수신 콜백 */
|
|
202
|
+
onStreamData?: (event: StreamDataEvent) => void;
|
|
203
|
+
};
|
|
204
|
+
export declare function useWorkflowExecutionStream({ workflowId, runId, enabled, onStepStart, onStepComplete, onStepFailed, onWorkflowComplete, onWorkflowFailed, onStreamData }: UseWorkflowExecutionStreamOptions): {
|
|
205
|
+
isRunning: boolean;
|
|
206
|
+
isCompleted: boolean;
|
|
207
|
+
isFailed: boolean;
|
|
208
|
+
isTimedOut: boolean;
|
|
209
|
+
isPaused: boolean;
|
|
210
|
+
pausedAtStepId: string | null;
|
|
211
|
+
debugVariables: Record<string, unknown> | null;
|
|
212
|
+
progress: number;
|
|
213
|
+
currentStepId: string | null;
|
|
214
|
+
totalSteps: number;
|
|
215
|
+
currentStep: number;
|
|
216
|
+
stepStates: Map<string, StepExecutionState>;
|
|
217
|
+
/** AI 생성 스텝의 부분 텍스트(누적) — 실행 중인 카드에 흘려 보여 준다 */
|
|
218
|
+
liveOutput: Map<string, string>;
|
|
219
|
+
error: string | null;
|
|
220
|
+
duration: number | null;
|
|
221
|
+
finalOutput: unknown | null;
|
|
222
|
+
events: ExecutionEvent[];
|
|
223
|
+
/** 마지막으로 수신한 이벤트의 인덱스 (재연결 시 사용) */
|
|
224
|
+
lastEventIndex: number;
|
|
225
|
+
/**
|
|
226
|
+
* 재연결 상한까지 붙지 못했다 — 실행이 서버에서 계속 도는지 **모른다**(끝났다는 뜻이
|
|
227
|
+
* 아니다). 화면은 "실행 기록에서 확인"으로 안내한다.
|
|
228
|
+
*/
|
|
229
|
+
connectionLost: boolean;
|
|
230
|
+
isConnected: boolean;
|
|
231
|
+
disconnect: () => void;
|
|
232
|
+
reset: () => void;
|
|
233
|
+
getStepState: (stepId: string) => StepExecutionState | undefined;
|
|
234
|
+
};
|
|
235
|
+
/** 재생할 런 — 실시간 스트림과 같은 모양이라 캔버스가 둘을 구분하지 않는다. */
|
|
236
|
+
type ViewerExecutionState = {
|
|
237
|
+
isRunning: boolean;
|
|
238
|
+
isCompleted: boolean;
|
|
239
|
+
isFailed: boolean;
|
|
240
|
+
isTimedOut: boolean;
|
|
241
|
+
progress: number;
|
|
242
|
+
currentStep: number;
|
|
243
|
+
totalSteps: number;
|
|
244
|
+
duration: number | null;
|
|
245
|
+
stepStates: Map<string, StepExecutionState>;
|
|
246
|
+
currentStepId: string | null;
|
|
247
|
+
};
|
|
248
|
+
type GridWorkflowViewerProps = {
|
|
249
|
+
/** 저장된 정의(원본 그대로). 읽지 못하면 빈 캔버스를 그린다. */
|
|
250
|
+
definition: unknown;
|
|
251
|
+
/** 과거 런 재생 — 지나간 연결 강조·안 간 스텝 흐림·상단 결과 바 */
|
|
252
|
+
executionState?: ViewerExecutionState;
|
|
253
|
+
/** 결과 바의 닫기 — 재생을 끝내고 정의만 보는 화면으로 */
|
|
254
|
+
onDismissExecution?: () => void;
|
|
255
|
+
/** 이 스텝이 보이게 카메라를 옮긴다(트레이스 행 → 캔버스) */
|
|
256
|
+
focusStepId?: string | null;
|
|
257
|
+
/**
|
|
258
|
+
* 화면 언어. 주지 않으면 바깥 `WorkflowLocaleProvider`를 따른다(없으면 한국어).
|
|
259
|
+
* `useRunReplay`처럼 뷰어 밖에서 부르는 훅까지 같은 언어로 하려면 바깥에 Provider를 둔다.
|
|
260
|
+
*/
|
|
261
|
+
locale?: WorkflowLocale;
|
|
262
|
+
messages?: WorkflowMessages;
|
|
263
|
+
};
|
|
264
|
+
declare function GridWorkflowViewer({ locale, messages, ...props }: GridWorkflowViewerProps): React.JSX.Element;
|
|
265
|
+
/** 스트리밍 중에도 셸의 뒤로가기와 캔버스 공간을 유지한다. */
|
|
266
|
+
declare function GridWorkflowSkeleton(): import("react").JSX.Element;
|
|
267
|
+
type WorkflowStepPreviewProps = {
|
|
268
|
+
/**
|
|
269
|
+
* 워크플로우/템플릿 정의. 런타임에 그리드 형태(steps/connections)로 덕타이핑되며
|
|
270
|
+
* (워크플로우 DTO·템플릿 GridWorkflowDefinition 모두 호환), 아니면 "단계 없음"으로 폴백.
|
|
271
|
+
*/
|
|
272
|
+
definition?: unknown;
|
|
273
|
+
/**
|
|
274
|
+
* 서버가 이미 정렬한 미리보기(`orderStepsForPreview` 결과) — 목록처럼 정의 전체를
|
|
275
|
+
* 내려보내지 않는 표면이 쓴다. 주면 `definition`보다 우선한다.
|
|
276
|
+
*/
|
|
277
|
+
preview?: OrderedPreviewSteps;
|
|
278
|
+
className?: string;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* 워크플로우 카드 좌측의 step 흐름 미리보기.
|
|
282
|
+
*
|
|
283
|
+
* 점 격자 캔버스 배경 위에 노드를 둥근 타일 아이콘 + 라벨로 한 줄 배치한다
|
|
284
|
+
* (`[시작, …중간, 끝]` 순서, 최대 {@link MAX_NODES}개 + `+N` 타일). 라벨은 노드 이름,
|
|
285
|
+
* 타일 아이콘 색은 타입별 {@link STEP_TYPE_COLORS}를 따른다. 데이터는
|
|
286
|
+
* {@link orderStepsForPreview}가 그리드 정의를 파싱·정렬해 제공한다.
|
|
287
|
+
*/
|
|
288
|
+
export declare function WorkflowStepPreview({ definition, preview, className }: WorkflowStepPreviewProps): React.JSX.Element;
|
|
289
|
+
type TestModePanelProps = {
|
|
290
|
+
definition: GridWorkflowDefinition;
|
|
291
|
+
/** 시뮬레이션 컨텍스트에 실을 식별자 — `{{workflowId}}` 같은 시스템 변수의 값이 된다. */
|
|
292
|
+
workspaceId?: string;
|
|
293
|
+
workflowId?: string;
|
|
294
|
+
userId?: string;
|
|
295
|
+
embedded?: boolean;
|
|
296
|
+
onClose?: () => void;
|
|
297
|
+
onStepHighlight?: (stepId: string | null) => void;
|
|
298
|
+
preflightIssues: WorkflowPreflightIssue[];
|
|
299
|
+
onOpenPreflight: () => void;
|
|
300
|
+
/** 워크플로우에 저장된 샘플 페이로드 — 시작 입력의 초기값 */
|
|
301
|
+
testParams?: Record<string, unknown>;
|
|
302
|
+
/** "이 입력을 워크플로우에 저장" — 다음 저장에 실린다 */
|
|
303
|
+
onSaveTestParams?: (params: Record<string, unknown>) => void;
|
|
304
|
+
};
|
|
305
|
+
declare function TestModePanel({ definition, workspaceId, workflowId, userId, onClose, embedded, onStepHighlight, preflightIssues, onOpenPreflight, testParams, onSaveTestParams }: TestModePanelProps): React.JSX.Element;
|
|
306
|
+
type WorkflowExecutionActions = {
|
|
307
|
+
/** 워크플로우 실행 시작. 내부적으로 runId 획득 → SSE 연결 → 실행을 자동 처리 */
|
|
308
|
+
startWorkflow: (options?: {
|
|
309
|
+
breakpoints?: string[];
|
|
310
|
+
params?: Record<string, unknown>;
|
|
311
|
+
dryRun?: boolean;
|
|
312
|
+
}) => void;
|
|
313
|
+
/** 디버그 일시정지에서 재개 */
|
|
314
|
+
resume: (command: "continue" | "step-over") => void;
|
|
315
|
+
/** 실행 모니터링 중지 */
|
|
316
|
+
stop: () => void;
|
|
317
|
+
/** 상태 초기화 */
|
|
318
|
+
reset: () => void;
|
|
319
|
+
};
|
|
320
|
+
type UseWorkflowExecutionReturn = WorkflowExecutionState & WorkflowExecutionActions & {
|
|
321
|
+
/** 실행 시작 중 (runId 획득 전) */
|
|
322
|
+
isStarting: boolean;
|
|
323
|
+
/** 현재 실행의 runId */
|
|
324
|
+
currentRunId: string | null;
|
|
325
|
+
};
|
|
326
|
+
type UseGridExecutionControllerReturn = UseWorkflowExecutionReturn & {
|
|
327
|
+
breakpoints: Set<string>;
|
|
328
|
+
/** isStarting || isRunning */
|
|
329
|
+
isExecuting: boolean;
|
|
330
|
+
/** startWorkflow with current breakpoints (+ 저장된 샘플 페이로드) */
|
|
331
|
+
execute: (params?: Record<string, unknown>) => void;
|
|
332
|
+
/** stop + toast */
|
|
333
|
+
stopExecution: () => void;
|
|
334
|
+
toggleBreakpoint: (stepId: string) => void;
|
|
335
|
+
};
|
|
336
|
+
type BranchDialogContext = {
|
|
337
|
+
/** 분기 종류는 **연결의 출발 조건 스텝** 설정이 정한다 — Switch에 참/거짓을 달지 않는다 */
|
|
338
|
+
conditionType: ConditionType;
|
|
339
|
+
existingBranches: {
|
|
340
|
+
branchType: BranchType;
|
|
341
|
+
branchValue?: string;
|
|
342
|
+
}[];
|
|
343
|
+
/** 이미 연결된 case 값 — 새 case와 겹치지 않게 보여 준다 */
|
|
344
|
+
switchCases: string[];
|
|
345
|
+
};
|
|
346
|
+
type StepMetricsState = {
|
|
347
|
+
/** 불러오기 전·실패·저장 전 워크플로우는 null — "0회"와 "모름"은 다른 사실이다 */
|
|
348
|
+
metrics: WorkflowStepMetrics | null;
|
|
349
|
+
windowDays: number | null;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* 최근 실행의 스텝별 누적 지표. 표본은 워크플로우를 열 때와 실행이 끝났을 때(`paused`가
|
|
353
|
+
* 풀릴 때) 한 번씩 불러오고, 집계는 지금 캔버스의 그래프에 대해 다시 한다 — 연결을 고치면
|
|
354
|
+
* 통과 횟수도 그 그래프 기준으로 바뀐다.
|
|
355
|
+
*/
|
|
356
|
+
export declare function useStepMetrics({ workflowId, steps, connections, paused }: {
|
|
357
|
+
workflowId: string | undefined;
|
|
358
|
+
steps: readonly GridStep[];
|
|
359
|
+
connections: readonly GridConnection[];
|
|
360
|
+
/** 실행 중 — 이 동안은 불러오지 않고(이전 표본 유지), 풀리는 순간 다시 불러온다 */
|
|
361
|
+
paused?: boolean;
|
|
362
|
+
}): StepMetricsState;
|
|
363
|
+
/**
|
|
364
|
+
* 카메라 상태 — 배율·이동과 "미끄러지게 옮기는 중인가".
|
|
365
|
+
*
|
|
366
|
+
* 🔑 **React 상태가 아니라 구독형 저장소다.** 휠·포인터는 프레임마다 카메라를 바꾸는데,
|
|
367
|
+
* 이것을 이 훅을 부르는 컴포넌트의 상태로 두면 그 컴포넌트(1,800줄 에디터 — 열린 패널·
|
|
368
|
+
* 툴바·레일까지) 전체가 프레임마다 다시 렌더됐다. 지금은 카메라를 그리는 것만 구독한다:
|
|
369
|
+
* 변환 레이어(`GridTransformLayer`), 배율 표시, 드롭 칸 강조. 이벤트 처리기는 그때그때
|
|
370
|
+
* `getTransform()`으로 읽는다.
|
|
371
|
+
*/
|
|
372
|
+
type GridViewportSnapshot = {
|
|
373
|
+
transform: ViewportTransform;
|
|
374
|
+
/** 프로그램적 이동(버튼·맞춤·보이게 스크롤)은 미끄러지고, 손으로 옮기는 중에는 바로 따라온다 */
|
|
375
|
+
animated: boolean;
|
|
376
|
+
};
|
|
377
|
+
type GridViewportStore = {
|
|
378
|
+
getSnapshot: () => GridViewportSnapshot;
|
|
379
|
+
subscribe: (listener: () => void) => () => void;
|
|
380
|
+
};
|
|
381
|
+
type UseGridViewportReturn = {
|
|
382
|
+
/** 카메라 저장소 — 구독은 `useGridViewportSnapshot`·`useGridViewportScale` */
|
|
383
|
+
transformStore: GridViewportStore;
|
|
384
|
+
/** 지금 카메라(렌더에 쓰지 말 것 — 이벤트 처리기용, 구독하지 않는다) */
|
|
385
|
+
getTransform: () => ViewportTransform;
|
|
386
|
+
viewportRef: React.RefObject<HTMLDivElement | null>;
|
|
387
|
+
zoomIn: () => void;
|
|
388
|
+
zoomOut: () => void;
|
|
389
|
+
resetZoom: () => void;
|
|
390
|
+
fitToContent: () => void;
|
|
391
|
+
fitToView: () => void;
|
|
392
|
+
fitToWidth: () => void;
|
|
393
|
+
ensureCellVisible: (position: GridPosition) => void;
|
|
394
|
+
centerOnCell: (position: GridPosition) => void;
|
|
395
|
+
setTranslate: (x: number, y: number) => void;
|
|
396
|
+
};
|
|
397
|
+
type WorkflowSaveSnapshot = {
|
|
398
|
+
name: string;
|
|
399
|
+
definition: GridWorkflowDefinition;
|
|
400
|
+
/** 문서와 함께 저장되는 호스트 값(`WorkflowHost.saveContext`). 내용은 모른다. */
|
|
401
|
+
context?: unknown;
|
|
402
|
+
};
|
|
403
|
+
type WorkflowSaveStatus = "unsaved" | "saving" | "saved" | "error";
|
|
404
|
+
/** 저장 요청 시점의 스냅샷만 확인한다. 대기 중 새 편집을 저장 완료로 표시하지 않는다. */
|
|
405
|
+
export declare function useWorkflowSave({ snapshot, initiallySaved, onSave }: {
|
|
406
|
+
snapshot: WorkflowSaveSnapshot;
|
|
407
|
+
initiallySaved: boolean;
|
|
408
|
+
onSave?: (name: string, definition: GridWorkflowDefinition, context: unknown) => Promise<boolean>;
|
|
409
|
+
}): {
|
|
410
|
+
save: (submitted?: WorkflowSaveSnapshot) => Promise<boolean>;
|
|
411
|
+
status: WorkflowSaveStatus;
|
|
412
|
+
isSaving: boolean;
|
|
413
|
+
};
|
|
414
|
+
type StepActionId = "edit" | "connections" | "start-connection" | "duplicate" | "copy" | "breakpoint" | "output" | "delete" | "add" | "paste";
|
|
415
|
+
type StepAction = {
|
|
416
|
+
id: StepActionId;
|
|
417
|
+
label: string;
|
|
418
|
+
description?: string;
|
|
419
|
+
icon: NodeIcon;
|
|
420
|
+
/** 실행 후 메뉴를 유지 (토글/반복 액션) 또는 패널 전환 액션 */
|
|
421
|
+
keepOpen?: boolean;
|
|
422
|
+
destructive?: boolean;
|
|
423
|
+
disabled?: boolean;
|
|
424
|
+
/** 액션바(★)에도 노출 */
|
|
425
|
+
primary?: boolean;
|
|
426
|
+
};
|
|
427
|
+
type WorkflowPanelState = {
|
|
428
|
+
kind: "menu";
|
|
429
|
+
} | {
|
|
430
|
+
kind: "config";
|
|
431
|
+
mode: "edit";
|
|
432
|
+
} | {
|
|
433
|
+
kind: "config";
|
|
434
|
+
mode: "create";
|
|
435
|
+
initialStepType?: GridStepType;
|
|
436
|
+
initialNodeDefinition?: NodeDefinition;
|
|
437
|
+
} | {
|
|
438
|
+
kind: "connections";
|
|
439
|
+
} | {
|
|
440
|
+
kind: "output";
|
|
441
|
+
} | {
|
|
442
|
+
kind: "outline";
|
|
443
|
+
} | {
|
|
444
|
+
kind: "library";
|
|
445
|
+
} | {
|
|
446
|
+
kind: "test";
|
|
447
|
+
} | {
|
|
448
|
+
kind: "debug";
|
|
449
|
+
} | {
|
|
450
|
+
kind: "preflight";
|
|
451
|
+
} | null;
|
|
452
|
+
type NodeDragState = {
|
|
453
|
+
fromPosition: GridPosition;
|
|
454
|
+
/** 현재 드롭 후보 셀 (바운드 밖이면 null) */
|
|
455
|
+
targetPosition: GridPosition | null;
|
|
456
|
+
};
|
|
457
|
+
type StepDraft = Omit<GridStep, "id"> & {
|
|
458
|
+
id?: string;
|
|
459
|
+
};
|
|
460
|
+
type StepConfigPanelHandle = {
|
|
461
|
+
getDraft: () => StepDraft | null;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* 에디터의 상태 조립 — 화면 없이(RFC-0046 §4.5).
|
|
465
|
+
*
|
|
466
|
+
* §3.2의 상태들(문서+히스토리·선택·고른 연결·연결 모드·패널·설정 초안·저장·클립보드·카메라·실행 표시·
|
|
467
|
+
* AI 제안 미리보기)을 한 벌로 엮는다. 규칙 하나하나는 각자의 훅이 갖고(`useWorkflowHistory`·
|
|
468
|
+
* `useWorkflowPanelState`·`useGridConnectionManager`·`useWorkflowSave`·`useStepMutations`·
|
|
469
|
+
* `useProposalPreview`·`useGridCellStates`·`useGridViewport`·`useGridKeyboardNav`), 여기는 그것들이
|
|
470
|
+
* 서로 어떻게 맞물리는지를 적는 자리다.
|
|
471
|
+
*
|
|
472
|
+
* 화면은 돌려받은 값으로 그린다. `editorRef`는 에디터 뿌리에, `viewport.viewportRef`는 캔버스에,
|
|
473
|
+
* `layout.frameRef`는 캔버스와 패널을 담는 틀에 달아야 한다 — 키 소유권 판정·알림 통로·맞춤 계산이
|
|
474
|
+
* 그 요소들을 읽는다. `WorkflowHostProvider`·`WorkflowNoticeProvider`·`WorkflowLocaleProvider`
|
|
475
|
+
* 아래에서 불러야 한다.
|
|
476
|
+
*/
|
|
477
|
+
export declare function useWorkflowEditor({ workflowId, bridge, initialDefinition, initialName: initialNameProp, onSave, isSaving: externalIsSaving, showTemplateDialogOnEmpty }: Pick<GridWorkflowEditorProps, "workflowId" | "bridge" | "initialDefinition" | "initialName" | "onSave" | "isSaving" | "showTemplateDialogOnEmpty">): {
|
|
478
|
+
stepConfigRef: import("react").RefObject<StepConfigPanelHandle | null>;
|
|
479
|
+
selectedStep: GridStep | null;
|
|
480
|
+
ui: {
|
|
481
|
+
showKeyboardHints: boolean;
|
|
482
|
+
showTemplateSelector: boolean;
|
|
483
|
+
importExportDialog: {
|
|
484
|
+
isOpen: boolean;
|
|
485
|
+
mode: "import" | "export";
|
|
486
|
+
};
|
|
487
|
+
isSaving: boolean;
|
|
488
|
+
setShowTemplateSelector: (show: boolean) => void;
|
|
489
|
+
setInternalIsSaving: (saving: boolean) => void;
|
|
490
|
+
toggleKeyboardHints: () => void;
|
|
491
|
+
openImportDialog: () => void;
|
|
492
|
+
openExportDialog: () => void;
|
|
493
|
+
closeImportExportDialog: () => void;
|
|
494
|
+
};
|
|
495
|
+
exec: UseGridExecutionControllerReturn;
|
|
496
|
+
focusedConnectionId: string | null;
|
|
497
|
+
conn: {
|
|
498
|
+
connectionMode: {
|
|
499
|
+
isActive: boolean;
|
|
500
|
+
startPosition: GridPosition | null;
|
|
501
|
+
startStepId: string | null;
|
|
502
|
+
};
|
|
503
|
+
branchSelectDialog: {
|
|
504
|
+
isOpen: boolean;
|
|
505
|
+
pendingConnection: {
|
|
506
|
+
fromStepId: string;
|
|
507
|
+
toStepId: string;
|
|
508
|
+
fromPosition: GridPosition;
|
|
509
|
+
toPosition: GridPosition;
|
|
510
|
+
} | null;
|
|
511
|
+
};
|
|
512
|
+
branchDialogContext: BranchDialogContext | null;
|
|
513
|
+
availableAdjacentSteps: {
|
|
514
|
+
step: GridStep;
|
|
515
|
+
direction: ConnectionDirection;
|
|
516
|
+
}[];
|
|
517
|
+
startConnection: (position: GridPosition, stepId: string) => void;
|
|
518
|
+
completeConnection: (position: GridPosition, stepId: string) => void;
|
|
519
|
+
cancelConnection: () => void;
|
|
520
|
+
addConnectionToStep: (targetStep: GridStep, direction: "outgoing" | "incoming") => void;
|
|
521
|
+
deleteConnection: (connectionId: string) => void;
|
|
522
|
+
selectBranch: (branchType: BranchType, branchValue?: string) => void;
|
|
523
|
+
closeBranchDialog: () => void;
|
|
524
|
+
findAdjacentStep: (position: GridPosition) => {
|
|
525
|
+
step: GridStep;
|
|
526
|
+
direction: ConnectionDirection;
|
|
527
|
+
} | null;
|
|
528
|
+
};
|
|
529
|
+
stepMetrics: StepMetricsState;
|
|
530
|
+
connectionTraffic: Map<string, string> | undefined;
|
|
531
|
+
selectedStepConnections: {
|
|
532
|
+
incoming: {
|
|
533
|
+
connection: GridConnection;
|
|
534
|
+
step: GridStep | undefined;
|
|
535
|
+
}[];
|
|
536
|
+
outgoing: {
|
|
537
|
+
connection: GridConnection;
|
|
538
|
+
step: GridStep | undefined;
|
|
539
|
+
}[];
|
|
540
|
+
};
|
|
541
|
+
bounds: GridBounds;
|
|
542
|
+
preflightIssues: WorkflowPreflightIssue[];
|
|
543
|
+
handleExpandCols: () => void;
|
|
544
|
+
handleExpandRows: () => void;
|
|
545
|
+
layout: {
|
|
546
|
+
width: number;
|
|
547
|
+
height: number;
|
|
548
|
+
frameRef: import("react").RefObject<HTMLDivElement | null>;
|
|
549
|
+
isMobile: boolean;
|
|
550
|
+
railWidth: number;
|
|
551
|
+
};
|
|
552
|
+
narrowEditor: boolean;
|
|
553
|
+
editorRef: import("react").RefObject<HTMLDivElement | null>;
|
|
554
|
+
noticeCenter: {
|
|
555
|
+
notices: (WorkflowNotice & {
|
|
556
|
+
id: number;
|
|
557
|
+
})[];
|
|
558
|
+
dismiss: (id: number) => void;
|
|
559
|
+
markActive: () => void;
|
|
560
|
+
};
|
|
561
|
+
viewport: UseGridViewportReturn;
|
|
562
|
+
focusCanvas: () => void | undefined;
|
|
563
|
+
closePanel: () => void;
|
|
564
|
+
cellStates: GridCellState[][];
|
|
565
|
+
persistence: {
|
|
566
|
+
save: (submitted?: WorkflowSaveSnapshot) => Promise<boolean>;
|
|
567
|
+
status: WorkflowSaveStatus;
|
|
568
|
+
isSaving: boolean;
|
|
569
|
+
};
|
|
570
|
+
handleSave: () => Promise<void>;
|
|
571
|
+
handleSelectTemplate: (template: ExtendedWorkflowTemplate) => void;
|
|
572
|
+
handleTemplateSelectorClose: (open: boolean) => void;
|
|
573
|
+
handleAdd: () => void;
|
|
574
|
+
handleSelectLibraryNode: (node: NodeDefinition, type: GridStepType) => void;
|
|
575
|
+
stepActions: StepAction[];
|
|
576
|
+
emptyCellActions: StepAction[];
|
|
577
|
+
handleStepAction: (id: StepActionId) => void;
|
|
578
|
+
handlePanelEscape: () => void;
|
|
579
|
+
handleConfigBack: () => void;
|
|
580
|
+
keyboard: {
|
|
581
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
582
|
+
clipboard: GridStep | null;
|
|
583
|
+
};
|
|
584
|
+
handleCellClick: (position: GridPosition) => void;
|
|
585
|
+
handleCellDoubleClick: (position: GridPosition) => void;
|
|
586
|
+
executionStateForCanvas: {
|
|
587
|
+
isRunning: boolean;
|
|
588
|
+
isCompleted: boolean;
|
|
589
|
+
isFailed: boolean;
|
|
590
|
+
isTimedOut: boolean;
|
|
591
|
+
progress: number;
|
|
592
|
+
currentStep: number;
|
|
593
|
+
totalSteps: number;
|
|
594
|
+
duration: number | null;
|
|
595
|
+
liveOutput: Map<string, string>;
|
|
596
|
+
stepStates: Map<string, StepExecutionState>;
|
|
597
|
+
currentStepId: string | null;
|
|
598
|
+
} | undefined;
|
|
599
|
+
mobileSelectionBar: boolean;
|
|
600
|
+
selectionLabel: string;
|
|
601
|
+
focusedConnectionLabel: string | null;
|
|
602
|
+
steps: GridStep[];
|
|
603
|
+
connections: GridConnection[];
|
|
604
|
+
undo: () => void;
|
|
605
|
+
redo: () => void;
|
|
606
|
+
canUndo: boolean;
|
|
607
|
+
canRedo: boolean;
|
|
608
|
+
initializeState: (state: {
|
|
609
|
+
steps: GridStep[];
|
|
610
|
+
connections: GridConnection[];
|
|
611
|
+
}) => void;
|
|
612
|
+
panel: WorkflowPanelState;
|
|
613
|
+
openPanel: (panel: NonNullable<WorkflowPanelState>) => void;
|
|
614
|
+
togglePanel: (panel: NonNullable<WorkflowPanelState>) => void;
|
|
615
|
+
preview: PreviewGraph | null;
|
|
616
|
+
displaySteps: GridStep[];
|
|
617
|
+
displayConnections: GridConnection[];
|
|
618
|
+
previewCounts: {
|
|
619
|
+
added: number;
|
|
620
|
+
updated: number;
|
|
621
|
+
deleted: number;
|
|
622
|
+
};
|
|
623
|
+
handleApplyProposal: () => void;
|
|
624
|
+
handleDiscardProposal: () => void;
|
|
625
|
+
isMobile: boolean;
|
|
626
|
+
dragState: NodeDragState | null;
|
|
627
|
+
handleSaveStep: (stepData: Omit<GridStep, "id"> & {
|
|
628
|
+
id?: string;
|
|
629
|
+
}, silent?: boolean) => {
|
|
630
|
+
steps: GridStep[];
|
|
631
|
+
connections: GridConnection[];
|
|
632
|
+
};
|
|
633
|
+
handleDeleteStep: (stepId: string) => void;
|
|
634
|
+
handleMoveStep: (step: GridStep, direction: "up" | "down" | "left" | "right") => void;
|
|
635
|
+
workflowName: string;
|
|
636
|
+
setWorkflowName: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
637
|
+
hasDraftChanges: boolean;
|
|
638
|
+
setHasDraftChanges: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
639
|
+
testParams: Record<string, unknown> | undefined;
|
|
640
|
+
setTestParams: import("react").Dispatch<import("react").SetStateAction<Record<string, unknown> | undefined>>;
|
|
641
|
+
selectedPosition: GridPosition | null;
|
|
642
|
+
setSelectedPosition: import("react").Dispatch<import("react").SetStateAction<GridPosition | null>>;
|
|
643
|
+
railFocusRequest: {
|
|
644
|
+
side: "left" | "right";
|
|
645
|
+
nonce: number;
|
|
646
|
+
} | null;
|
|
647
|
+
railFocusedSide: "left" | "right" | null;
|
|
648
|
+
setRailFocusedSide: import("react").Dispatch<import("react").SetStateAction<"left" | "right" | null>>;
|
|
649
|
+
};
|
|
650
|
+
export declare const WorkflowHostProvider: import("react").Provider<WorkflowHost>;
|
|
651
|
+
/**
|
|
652
|
+
* 이 에디터에 뜨는 알림. 에디터 안에서는 늦게 불러도(실행 완료·저장 응답) 일을 시작한 에디터로 간다.
|
|
653
|
+
* 에디터 밖에서는 지금 쓰고 있는 에디터를 찾는 공용 통로다.
|
|
654
|
+
*/
|
|
655
|
+
export declare function useWorkflowToast(): WorkflowToast;
|
|
656
|
+
/** 지금 에디터의 호스트. 에디터 밖에서 부르면 아무 능력도 없는 빈 호스트다. */
|
|
657
|
+
export declare function useWorkflowHost(): WorkflowHost;
|
|
658
|
+
type UseGridKeyboardNavProps = {
|
|
659
|
+
editorRef: RefObject<HTMLElement | null>;
|
|
660
|
+
canvasRef: RefObject<HTMLElement | null>;
|
|
661
|
+
onFocusRail?: (side: "left" | "right") => void;
|
|
662
|
+
onAddStep?: () => void;
|
|
663
|
+
onToggleOutline?: () => void;
|
|
664
|
+
onFitToContent?: () => void;
|
|
665
|
+
steps: GridStep[];
|
|
666
|
+
connections: GridConnection[];
|
|
667
|
+
/** 현재 렌더 바운드 — 셀 이동/복제 목적지의 유효 범위 */
|
|
668
|
+
bounds: GridBounds;
|
|
669
|
+
/**
|
|
670
|
+
* 열린 패널 종류 — null이 아니면 전역 그리드 키를 양보한다
|
|
671
|
+
* (⌘S/⌘Z류 전역 단축키와 Escape→onPanelEscape 제외).
|
|
672
|
+
* menu/config 패널은 자체 onKeyDown으로 키를 소유한다.
|
|
673
|
+
*/
|
|
674
|
+
panelKind?: string | null;
|
|
675
|
+
/** 패널 열림 상태에서 Escape — 한 단계 복귀 (에디터가 체인 결정) */
|
|
676
|
+
onPanelEscape?: () => void;
|
|
677
|
+
/** 선택 해제 (연결 모드도 패널도 없을 때 Escape) */
|
|
678
|
+
onDeselect?: () => void;
|
|
679
|
+
/** 선택도 없을 때 Escape — 실행 결과 표시를 닫는 등 "한 단계 더 바깥" */
|
|
680
|
+
onEscapeIdle?: () => void;
|
|
681
|
+
selectedPosition: GridPosition | null;
|
|
682
|
+
connectionMode: {
|
|
683
|
+
isActive: boolean;
|
|
684
|
+
startPosition: GridPosition | null;
|
|
685
|
+
startStepId: string | null;
|
|
686
|
+
};
|
|
687
|
+
onSelectPosition: (position: GridPosition) => void;
|
|
688
|
+
onOpenStepPanel: (stepType?: GridStepType) => void;
|
|
689
|
+
onDeleteStep: (stepId: string) => void;
|
|
690
|
+
onStartConnection: (position: GridPosition, stepId: string) => void;
|
|
691
|
+
onCompleteConnection: (position: GridPosition, stepId: string) => void;
|
|
692
|
+
onCancelConnection: () => void;
|
|
693
|
+
onSave: () => void;
|
|
694
|
+
onUndo: () => void;
|
|
695
|
+
onRedo: () => void;
|
|
696
|
+
/** 에디터 소유 클립보드 — 액션바/메뉴 복사와 공유 */
|
|
697
|
+
clipboard?: GridStep | null;
|
|
698
|
+
onCopyStep?: (step: GridStep) => void;
|
|
699
|
+
onPasteStep?: (position: GridPosition) => void;
|
|
700
|
+
onDuplicateStep?: (step: GridStep, direction: "up" | "down" | "left" | "right") => void;
|
|
701
|
+
onMoveStep?: (step: GridStep, direction: "up" | "down" | "left" | "right") => void;
|
|
702
|
+
onDeleteConnections?: (stepId: string) => void;
|
|
703
|
+
/**
|
|
704
|
+
* 키보드로 고른 연결 하나(`C`로 순회) — 고른 동안 Enter는 반대편 스텝으로, Delete는 그
|
|
705
|
+
* 연결만 지운다. 에디터가 소유하고 선택이 바뀌면 지운다.
|
|
706
|
+
*/
|
|
707
|
+
focusedConnectionId?: string | null;
|
|
708
|
+
onFocusConnection?: (connectionId: string | null) => void;
|
|
709
|
+
onDeleteConnection?: (connectionId: string) => void;
|
|
710
|
+
onToggleHelp?: () => void;
|
|
711
|
+
onToggleBreakpoint?: (stepId: string) => void;
|
|
712
|
+
onToggleDebugPanel?: () => void;
|
|
713
|
+
onZoomIn?: () => void;
|
|
714
|
+
onZoomOut?: () => void;
|
|
715
|
+
onResetZoom?: () => void;
|
|
716
|
+
disabled?: boolean;
|
|
717
|
+
};
|
|
718
|
+
type UseGridKeyboardNavReturn = {
|
|
719
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
720
|
+
clipboard: GridStep | null;
|
|
721
|
+
};
|
|
722
|
+
export declare function useGridKeyboardNav({ editorRef, canvasRef, onFocusRail, onAddStep, onToggleOutline, onFitToContent, steps, connections, bounds, panelKind, onPanelEscape, onDeselect, onEscapeIdle, selectedPosition, connectionMode, onSelectPosition, onOpenStepPanel, onDeleteStep, onStartConnection, onCompleteConnection, onCancelConnection, onSave, onUndo, onRedo, clipboard, onCopyStep, onPasteStep, onDuplicateStep, onMoveStep, onDeleteConnections, focusedConnectionId, onFocusConnection, onDeleteConnection, onToggleHelp, onToggleBreakpoint, onToggleDebugPanel, onZoomIn, onZoomOut, onResetZoom, disabled }: UseGridKeyboardNavProps): UseGridKeyboardNavReturn;
|
|
723
|
+
type WorkflowState = {
|
|
724
|
+
steps: GridStep[];
|
|
725
|
+
connections: GridConnection[];
|
|
726
|
+
};
|
|
727
|
+
type UseWorkflowHistoryProps = {
|
|
728
|
+
maxHistorySize?: number;
|
|
729
|
+
initialState?: WorkflowState;
|
|
730
|
+
};
|
|
731
|
+
type UseWorkflowHistoryReturn = {
|
|
732
|
+
steps: GridStep[];
|
|
733
|
+
connections: GridConnection[];
|
|
734
|
+
setSteps: (steps: GridStep[]) => void;
|
|
735
|
+
setConnections: (connections: GridConnection[]) => void;
|
|
736
|
+
addStep: (step: GridStep, connection?: GridConnection) => void;
|
|
737
|
+
updateStep: (stepId: string, updates: Partial<GridStep>) => void;
|
|
738
|
+
deleteStep: (stepId: string) => void;
|
|
739
|
+
moveStep: (stepId: string, newPosition: {
|
|
740
|
+
row: number;
|
|
741
|
+
col: number;
|
|
742
|
+
}) => void;
|
|
743
|
+
/** 두 스텝의 자리를 맞바꾼다(연결은 스텝을 따라간다) — 되돌리기 한 번에 함께 돌아온다 */
|
|
744
|
+
swapSteps: (stepId: string, otherStepId: string) => void;
|
|
745
|
+
addConnection: (connection: GridConnection) => void;
|
|
746
|
+
deleteConnection: (connectionId: string) => void;
|
|
747
|
+
undo: () => void;
|
|
748
|
+
redo: () => void;
|
|
749
|
+
canUndo: boolean;
|
|
750
|
+
canRedo: boolean;
|
|
751
|
+
resetHistory: (initialState?: WorkflowState) => void;
|
|
752
|
+
initializeState: (state: WorkflowState) => void;
|
|
753
|
+
commitProposal: (steps: GridStep[], connections: GridConnection[]) => HistoryItem;
|
|
754
|
+
/**
|
|
755
|
+
* 그 항목이 **지금 되돌리기 스택 맨 위일 때만** 되돌린다(아니면 false). "AI 제안 적용 →
|
|
756
|
+
* 되돌리기" 토스트가 그 사이의 다른 편집을 되돌리지 않게 한다.
|
|
757
|
+
*/
|
|
758
|
+
undoEntry: (entry: HistoryItem) => boolean;
|
|
759
|
+
};
|
|
760
|
+
export declare function useWorkflowHistory({ maxHistorySize, initialState }?: UseWorkflowHistoryProps): UseWorkflowHistoryReturn;
|
|
761
|
+
/**
|
|
762
|
+
* 과거 런을 캔버스에 **재생**하기 위한 상태 — 저장된 스텝 기록을 실시간 스트림과 같은
|
|
763
|
+
* `stepStates` 모양으로 투영한다. 그래서 캔버스는 "지금 도는 런"과 "예전 런"을 구분하지
|
|
764
|
+
* 않고 같은 코드(경로 강조·흐림·오버레이)로 그린다.
|
|
765
|
+
*/
|
|
766
|
+
type RunReplay = {
|
|
767
|
+
runId: string;
|
|
768
|
+
startedAt: Date | null;
|
|
769
|
+
stepStates: Map<string, StepExecutionState>;
|
|
770
|
+
/** 취소·일시정지는 `other` — 결과 바는 "대기 중"으로 그린다(성공도 실패도 아니다) */
|
|
771
|
+
status: "completed" | "failed" | "running" | "other";
|
|
772
|
+
duration: number | null;
|
|
773
|
+
totalSteps: number;
|
|
774
|
+
completedSteps: number;
|
|
775
|
+
};
|
|
776
|
+
type RunReplayCanvasState = Pick<WorkflowExecutionState, "isRunning" | "isCompleted" | "isFailed" | "isTimedOut" | "progress" | "currentStep" | "totalSteps" | "duration" | "stepStates" | "currentStepId">;
|
|
777
|
+
export declare function useRunReplay({ runId }: {
|
|
778
|
+
runId: string | null;
|
|
779
|
+
}): {
|
|
780
|
+
replay: RunReplay | null;
|
|
781
|
+
isLoading: boolean;
|
|
782
|
+
error: string | null;
|
|
783
|
+
canvasState: RunReplayCanvasState | undefined;
|
|
784
|
+
};
|
|
785
|
+
declare function DropdownMenuItem({ className, ...props }: React$1.ComponentProps<typeof DropdownItem>): React$1.JSX.Element;
|
|
786
|
+
declare function DropdownMenuSeparator(props: React$1.ComponentProps<typeof DropdownSeparator>): React$1.JSX.Element;
|
|
787
|
+
/**
|
|
788
|
+
* 영어 사전 — 원문(한국어) → 번역.
|
|
789
|
+
*
|
|
790
|
+
* 화면 문구(`t("…")`·`msg("…")`)는 하나도 빠지면 안 된다 — `i18n-coverage.test.ts`가 소스를 훑어
|
|
791
|
+
* 대조한다. 순수 계층(노드 계약·점검)의 문구는 그리는 자리에서 `t(값)`으로 옮겨지므로 여기에도 있다.
|
|
792
|
+
*/
|
|
793
|
+
export declare const EN_MESSAGES: WorkflowMessages;
|
|
794
|
+
export { type RunEventStream, type RunReplay, type RunRequestResult, type RunStartResult, type StepExecutionState, type Translate, GridWorkflowEditor as WorkflowEditor, type WorkflowEditorBridge, type WorkflowEditorCommands, type WorkflowEditorExtension, type GridWorkflowEditorProps as WorkflowEditorProps, GridWorkflowSkeleton as WorkflowEditorSkeleton, type WorkflowExecutionState, type WorkflowExtensionContext, type WorkflowFieldRenderer, type WorkflowFieldRendererProps, type WorkflowHost, type WorkflowLocale, DropdownMenuItem as WorkflowMenuItem, DropdownMenuSeparator as WorkflowMenuSeparator, type WorkflowMessages, type WorkflowNotice, type WorkflowNoticeKind, type WorkflowNoticeSink, type WorkflowPreviewSummary, type WorkflowRunDetail, type WorkflowRunner, type WorkflowRunsSource, type WorkflowSaveSnapshot, type WorkflowSaveStatus, TestModePanel as WorkflowTestPanel, GridWorkflowViewer as WorkflowViewer, type ViewerExecutionState as WorkflowViewerExecutionState };
|