@tangle-network/sandbox-ui 0.113.7 → 0.114.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/dist/WorkflowGraph-B-NsdYz_.js +1961 -0
- package/dist/assets.d.ts +214 -206
- package/dist/assets.js +1057 -908
- package/dist/auth-CWe17Hly.js +37 -0
- package/dist/auth.d.ts +2 -30
- package/dist/auth.js +2 -15
- package/dist/chat-BOvFAe6p.js +903 -0
- package/dist/chat.d.ts +2 -230
- package/dist/chat.js +2 -34
- package/dist/connectors.d.ts +52 -49
- package/dist/connectors.js +595 -643
- package/dist/dashboard-CZ3VgNPR.js +4969 -0
- package/dist/dashboard.d.ts +4 -1297
- package/dist/dashboard.js +4 -152
- package/dist/editor.d.ts +2 -1
- package/dist/editor.js +2 -31
- package/dist/files.d.ts +2 -6
- package/dist/files.js +2 -33
- package/dist/globals.css +63 -3
- package/dist/hooks.d.ts +146 -148
- package/dist/hooks.js +222 -55
- package/dist/index-CKRaj1pM.d.ts +776 -0
- package/dist/index-CXX5IpH2.d.ts +2 -0
- package/dist/index-DPePq7c8.d.ts +1340 -0
- package/dist/index-DiyLLZuJ.d.ts +230 -0
- package/dist/index-DvmZLMT1.d.ts +30 -0
- package/dist/index-I8ZLVtHd.d.ts +330 -0
- package/dist/index-PRM636Ex.d.ts +86 -0
- package/dist/index.d.ts +21 -33
- package/dist/index.js +21 -701
- package/dist/info-panel-C9cqDzOL.js +594 -0
- package/dist/integrations.d.ts +133 -141
- package/dist/integrations.js +491 -673
- package/dist/markdown.d.ts +2 -1
- package/dist/markdown.js +2 -13
- package/dist/model-I-NIxeM-.js +1250 -0
- package/dist/model-brand-B9A4H9pJ.d.ts +98 -0
- package/dist/model-brand-hMyDTUqB.js +624 -0
- package/dist/motion-DkyBRJb9.js +37 -0
- package/dist/openui.d.ts +2 -1
- package/dist/openui.js +2 -7
- package/dist/pages.d.ts +307 -300
- package/dist/pages.js +4404 -4181
- package/dist/primitives-Dh1vG6J3.js +113 -0
- package/dist/primitives.d.ts +2 -74
- package/dist/primitives.js +2 -204
- package/dist/provider-logo-DjqmConF.js +311 -0
- package/dist/run.d.ts +2 -1
- package/dist/run.js +2 -23
- package/dist/sdk-hooks.d.ts +3 -4
- package/dist/sdk-hooks.js +3 -31
- package/dist/sidecar-DgH_vQ6m.d.ts +9 -0
- package/dist/stores.d.ts +14 -15
- package/dist/stores.js +13 -81
- package/dist/styles.css +63 -3
- package/dist/template-card-L-4gmjx2.d.ts +90 -0
- package/dist/terminal-CN9ZgHRt.js +197 -0
- package/dist/terminal.d.ts +60 -60
- package/dist/terminal.js +2 -10
- package/dist/tokens.css +51 -0
- package/dist/types.d.ts +4 -11
- package/dist/types.js +0 -1
- package/dist/use-pty-session-C8cE0adT.js +669 -0
- package/dist/use-sidecar-auth-CCTJcrq7.d.ts +145 -0
- package/dist/use-sidecar-auth-DkdcufOz.js +742 -0
- package/dist/utils-DzWbktWG.js +2 -0
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +2 -37
- package/dist/workbench-BCaCKl-J.js +8347 -0
- package/dist/workbench.d.ts +2 -310
- package/dist/workbench.js +2 -44
- package/dist/workflows.d.ts +341 -339
- package/dist/workflows.js +74 -109
- package/dist/workspace-B6AtI6ld.js +2510 -0
- package/dist/workspace.d.ts +2 -761
- package/dist/workspace.js +2 -51
- package/package.json +46 -40
- package/dist/WorkflowGraph-2QOORYIR.js +0 -1722
- package/dist/chunk-2BUPSB7O.js +0 -0
- package/dist/chunk-3KBNPQQF.js +0 -2697
- package/dist/chunk-3LIXVEEE.js +0 -279
- package/dist/chunk-72UF2H5H.js +0 -707
- package/dist/chunk-AI25G5MX.js +0 -944
- package/dist/chunk-ANSC5AFC.js +0 -314
- package/dist/chunk-AZ3AWMTM.js +0 -8
- package/dist/chunk-BGVEHENC.js +0 -10
- package/dist/chunk-CZ7CSFO4.js +0 -39
- package/dist/chunk-DYXXYGS4.js +0 -4700
- package/dist/chunk-EI44GEQ5.js +0 -6
- package/dist/chunk-IACRDXER.js +0 -219
- package/dist/chunk-IOB2PW5Z.js +0 -55
- package/dist/chunk-M4K7ZGR2.js +0 -24
- package/dist/chunk-MYZAW4RX.js +0 -665
- package/dist/chunk-OMUIPJQZ.js +0 -555
- package/dist/chunk-RQZRXKMR.js +0 -398
- package/dist/chunk-SOKKTB7W.js +0 -230
- package/dist/chunk-TADGS4Q7.js +0 -1010
- package/dist/chunk-UCQNOUN3.js +0 -7964
- package/dist/chunk-ULPLRBMF.js +0 -34
- package/dist/chunk-WID73FPH.js +0 -89
- package/dist/chunk-X3YXP7FG.js +0 -38
- package/dist/logo-DiAjq759.d.ts +0 -15
- package/dist/model-brand-BNnaUKKZ.d.ts +0 -99
- package/dist/ports-list-CDIvTNnX.d.ts +0 -17
- package/dist/sdk-hooks-Djkjq4cp.d.ts +0 -145
- package/dist/template-card-Bn-Bw5xC.d.ts +0 -87
package/dist/workflows.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { a as modelBrandFor, n as ModelBrandStack, t as ModelBrandIdentity } from "./model-brand-B9A4H9pJ.js";
|
|
2
|
+
import "@xyflow/react";
|
|
3
|
+
import "@xyflow/react/dist/style.css";
|
|
4
|
+
//#region src/workflows/model.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Turns a workflow YAML definition into a positioned node/edge graph for the
|
|
7
7
|
* visualizer. Pure and React-Flow-agnostic so the parsing + layout is unit
|
|
@@ -35,23 +35,23 @@ type WfNodeStatus = "queued" | "running" | "waiting" | "succeeded" | "failed";
|
|
|
35
35
|
* teach `sameRunState` to compare it.
|
|
36
36
|
*/
|
|
37
37
|
interface WfNodeState {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
status: WfNodeStatus;
|
|
39
|
+
/** Amount booked for this action, USD. */
|
|
40
|
+
costUsd?: number;
|
|
41
|
+
/** Wall-clock the action took, ms. */
|
|
42
|
+
durationMs?: number;
|
|
43
|
+
/** Model the action actually used (may differ from the requested model). */
|
|
44
|
+
model?: string;
|
|
45
|
+
/** Failure message, when the node failed. */
|
|
46
|
+
error?: string;
|
|
47
|
+
/** Short preview of the action's output (or a failure's partial text). */
|
|
48
|
+
outputPreview?: string;
|
|
49
|
+
/** Input/output token usage, when known. */
|
|
50
|
+
inputTokens?: number;
|
|
51
|
+
outputTokens?: number;
|
|
52
|
+
/** Agent iteration count (agent.run only) — the number of reasoning/tool
|
|
53
|
+
* rounds the agent has taken, surfaced on the node's progress strip. */
|
|
54
|
+
rounds?: number;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* A node's card-facing content. Three tiers, so both densities can show the
|
|
@@ -69,67 +69,67 @@ interface WfNodeState {
|
|
|
69
69
|
* {@link config} for the full-detail view.
|
|
70
70
|
*/
|
|
71
71
|
interface WfNodeData extends Record<string, unknown> {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
72
|
+
/** Human headline for the node, e.g. "GitHub", "AI Agent". */
|
|
73
|
+
title: string;
|
|
74
|
+
/** The action/trigger kind verbatim, e.g. "agent.run", "schedule". Set on every
|
|
75
|
+
* node `buildWorkflowGraph` produces so a consumer can dispatch on the node's
|
|
76
|
+
* type (icon, detail rendering) regardless of what its title says; optional on
|
|
77
|
+
* the type so external consumers constructing `WfNodeData` directly aren't
|
|
78
|
+
* forced to supply it (the render guards its usage). */
|
|
79
|
+
kind?: string;
|
|
80
|
+
/** The one-phrase qualifier under the title, e.g. "create: pulls.reviews". */
|
|
81
|
+
subtitle?: string;
|
|
82
|
+
/** Free-text detail (agent prompt, notify URL, trigger events) — shown only by
|
|
83
|
+
* the expanded node, which has the room to clamp it to two lines. */
|
|
84
|
+
description?: string;
|
|
85
|
+
/** Requested model (agent.run). A live run's ACTUAL model (`state.model`)
|
|
86
|
+
* supersedes it on the card. */
|
|
87
|
+
model?: string;
|
|
88
|
+
/** `integration.invoke` provider.method path. */
|
|
89
|
+
path?: string;
|
|
90
|
+
/** The raw, UNTRUNCATED config for this node — the action/trigger config from
|
|
91
|
+
* the definition. The card shows the summary above; a full-detail view (e.g. a
|
|
92
|
+
* node drawer) reads this to render every field — the complete prompt, all
|
|
93
|
+
* profile/source/input keys — without the card-sized clamp. It is a JSON-safe
|
|
94
|
+
* deep copy of the config (cycles and non-JSON values normalized), so a
|
|
95
|
+
* consumer can serialize or render it freely. Omitted when the node has no
|
|
96
|
+
* config. */
|
|
97
|
+
config?: Record<string, unknown>;
|
|
98
|
+
/** Connector slug (e.g. `github`) — drives the node's brand logo, so a provider
|
|
99
|
+
* step is recognizable before any text is read. */
|
|
100
|
+
provider?: string;
|
|
101
|
+
/** Small corner tag, e.g. "×3" for a parallel fan-out. */
|
|
102
|
+
badge?: string;
|
|
103
|
+
/** Whether this node is the spine root (no incoming/target handle). */
|
|
104
|
+
isRoot: boolean;
|
|
105
|
+
tone: WfNodeTone;
|
|
106
|
+
/** Live run state, merged in by the host at render time (never from YAML). */
|
|
107
|
+
state?: WfNodeState;
|
|
108
108
|
}
|
|
109
109
|
/** Which edge of a node box an edge attaches to. Named in plain compass terms
|
|
110
110
|
* rather than React Flow's `Position` so the layouter stays free of it. */
|
|
111
111
|
type WfSide = "left" | "right" | "top" | "bottom";
|
|
112
112
|
interface WfNode {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
113
|
+
id: string;
|
|
114
|
+
position: {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
};
|
|
118
|
+
/** Authoritative rendered size (px). The card renders at exactly this box
|
|
119
|
+
* (`h-full`/`w-full`) so the layout — which spaces nodes by these dims — is
|
|
120
|
+
* collision-free by construction, with no measure-then-reflow pass. */
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
data: WfNodeData;
|
|
124
|
+
/**
|
|
125
|
+
* Where this node's edges attach, when the LAYOUT decides rather than the
|
|
126
|
+
* flow direction. A straight layer flow has one answer for every node (edges
|
|
127
|
+
* enter the leading edge and leave the trailing one, per `direction`), so it
|
|
128
|
+
* sets neither and the renderer derives both. A folded layout does not — a row
|
|
129
|
+
* that runs right-to-left mirrors them. Absent ⇒ derive from `direction`.
|
|
130
|
+
*/
|
|
131
|
+
sourceSide?: WfSide;
|
|
132
|
+
targetSide?: WfSide;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
135
|
* Node ids are PUBLIC contract, not an internal detail. A host keys its live
|
|
@@ -141,7 +141,7 @@ interface WfNode {
|
|
|
141
141
|
* and read everywhere else through them.
|
|
142
142
|
*/
|
|
143
143
|
/** The workflow's first (or only) trigger. */
|
|
144
|
-
declare const TRIGGER_NODE_ID = "trigger";
|
|
144
|
+
export declare const TRIGGER_NODE_ID = "trigger";
|
|
145
145
|
/** The node for the `index`th entry of a list-form `on:`. Entry 0 IS
|
|
146
146
|
* {@link TRIGGER_NODE_ID}, so a single-trigger graph — the overwhelmingly
|
|
147
147
|
* common one — keeps the plain id a host may already have persisted.
|
|
@@ -151,38 +151,38 @@ declare const TRIGGER_NODE_ID = "trigger";
|
|
|
151
151
|
* topology then rejects by name ("…names "trigger:NaN", which this definition
|
|
152
152
|
* has no step for") — reported there rather than thrown from here, because
|
|
153
153
|
* {@link buildWorkflowGraph} calls this and must never throw. */
|
|
154
|
-
declare function triggerNodeId(index: number): string;
|
|
154
|
+
export declare function triggerNodeId(index: number): string;
|
|
155
155
|
/** The `on:` entry a trigger node stands for, or null when the id names
|
|
156
156
|
* anything else — so a host can tell a trigger from an action without
|
|
157
157
|
* matching the id format itself. */
|
|
158
|
-
declare function triggerNodeIndex(nodeId: string): number | null;
|
|
158
|
+
export declare function triggerNodeIndex(nodeId: string): number | null;
|
|
159
159
|
/** The node for the `do` entry at `index`. */
|
|
160
|
-
declare function actionNodeId(index: number): string;
|
|
160
|
+
export declare function actionNodeId(index: number): string;
|
|
161
161
|
/** The node for the `branchIndex`th fan-out leaf of the `do` entry at
|
|
162
162
|
* `actionIndex` — a `parallel` branch or a `foreach` template. */
|
|
163
|
-
declare function branchNodeId(actionIndex: number, branchIndex: number): string;
|
|
163
|
+
export declare function branchNodeId(actionIndex: number, branchIndex: number): string;
|
|
164
164
|
type WfEdgeKind = "spine" | "fork" | "join";
|
|
165
165
|
interface WfEdge {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
166
|
+
id: string;
|
|
167
|
+
source: string;
|
|
168
|
+
target: string;
|
|
169
|
+
/** Spine = trigger→action→action; fork = fan-out into a branch leaf; join =
|
|
170
|
+
* a branch leaf reconverging onto the next spine node. Drives edge styling.
|
|
171
|
+
*
|
|
172
|
+
* A DECLARED edge ({@link BuildWorkflowGraphOptions.edges}) is a `spine`
|
|
173
|
+
* edge: it is the flow. Fork edges survive a declared topology unchanged (a
|
|
174
|
+
* branch leaf is this module's own node, which no declared spec addresses);
|
|
175
|
+
* join edges do not exist under one, because what follows a fan-out is then
|
|
176
|
+
* declared rather than inferred from list position. */
|
|
177
|
+
kind: WfEdgeKind;
|
|
178
|
+
/** Short, already-human summary of the edge's guard, when it carries one.
|
|
179
|
+
* Supplied by {@link WfEdgeSpec.whenLabel} — this module never interprets a
|
|
180
|
+
* condition, it only places the label its host wrote. */
|
|
181
|
+
whenLabel?: string;
|
|
182
|
+
/** True when this edge closes a cycle: it points back at a node that is
|
|
183
|
+
* already on the path reaching it. Rendered distinctly (dashed, with the
|
|
184
|
+
* visit budget) because such an edge is the one that can run a node twice. */
|
|
185
|
+
backEdge?: boolean;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* One edge of a DECLARED topology — the caller's answer to "what actually
|
|
@@ -202,9 +202,9 @@ interface WfEdge {
|
|
|
202
202
|
* step's row), which is what keeps the two readings identical.
|
|
203
203
|
*/
|
|
204
204
|
interface WfEdgeSpec {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
from: string;
|
|
206
|
+
to: string;
|
|
207
|
+
whenLabel?: string;
|
|
208
208
|
}
|
|
209
209
|
/** How serious an authoring problem is. An `error` stops the definition from
|
|
210
210
|
* compiling; a `warning` compiles but is worth saying out loud. */
|
|
@@ -235,75 +235,75 @@ type WfProblemSeverity = "error" | "warning";
|
|
|
235
235
|
* be handed over with the definition it was computed from.
|
|
236
236
|
*/
|
|
237
237
|
type WfProblem = {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
anchor: "node";
|
|
239
|
+
/** The node the problem sits on. */
|
|
240
|
+
node: string;
|
|
241
|
+
severity: WfProblemSeverity;
|
|
242
|
+
message: string;
|
|
243
243
|
} | {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
244
|
+
anchor: "edge";
|
|
245
|
+
/** The edge's endpoints, as {@link WfEdgeSpec} names them. */
|
|
246
|
+
from: string;
|
|
247
|
+
to: string;
|
|
248
|
+
severity: WfProblemSeverity;
|
|
249
|
+
message: string;
|
|
250
250
|
};
|
|
251
251
|
interface WfGraph {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
nodes: WfNode[];
|
|
253
|
+
edges: WfEdge[];
|
|
254
|
+
/** Set when the YAML couldn't be parsed into a renderable graph. */
|
|
255
|
+
error: string | null;
|
|
256
256
|
}
|
|
257
257
|
/** Main-axis flow direction: "LR" (left-to-right, default) suits the wide/short
|
|
258
258
|
* run-detail panel; "TB" (top-to-bottom) suits a narrow column. */
|
|
259
259
|
type WfDirection = "LR" | "TB";
|
|
260
260
|
/** Options for {@link buildWorkflowGraph}. */
|
|
261
261
|
interface BuildWorkflowGraphOptions {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
262
|
+
/**
|
|
263
|
+
* Reserve space for the rows live run state adds to a node (the metrics line,
|
|
264
|
+
* the output/error preview, the status footer), so the RUN view never overlaps
|
|
265
|
+
* once a node starts or terminates. The static/preview layout (no run overlay)
|
|
266
|
+
* leaves this off to stay compact. Defaults to `false`.
|
|
267
|
+
*/
|
|
268
|
+
reserveRunState?: boolean;
|
|
269
|
+
/** Flow direction. Defaults to "LR". */
|
|
270
|
+
direction?: WfDirection;
|
|
271
|
+
/** Collapse every node to the fixed icon-tile size, and pitch the layers for
|
|
272
|
+
* it. Defaults to `false` (the full, expanded card). */
|
|
273
|
+
compact?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Fold a long single-file pipeline into rows instead of one unbounded line,
|
|
276
|
+
* so it occupies both axes of the panel rather than running off one edge.
|
|
277
|
+
* Only a straight chain folds — a graph with any fan-out keeps its layered
|
|
278
|
+
* flow, whose branches need the cross axis. "LR" only. Defaults to `false`.
|
|
279
|
+
*/
|
|
280
|
+
wrap?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* The graph's DECLARED topology. Omit — the default — and edges are inferred
|
|
283
|
+
* from `do`-list order: a linear spine, which is exactly right for a workflow
|
|
284
|
+
* that runs as one, and wrong for any workflow whose definition declares its
|
|
285
|
+
* own edges (`needs`, guards, cycles). Supply it and the inferred spine is
|
|
286
|
+
* replaced wholesale by these edges, the layout is re-ranked to the shape they
|
|
287
|
+
* describe (so a diamond reads as a diamond rather than a chain drawn over
|
|
288
|
+
* one), and cycle-closing edges are marked {@link WfEdge.backEdge}.
|
|
289
|
+
*
|
|
290
|
+
* An edge naming a node this graph has no slot for is an ERROR
|
|
291
|
+
* ({@link WfGraph.error}), never a quiet fall back to the positional spine:
|
|
292
|
+
* the two disagreeing means the topology and the definition came from
|
|
293
|
+
* different places, and a graph that draws edges the run will not take is
|
|
294
|
+
* worse than one that says it cannot be drawn.
|
|
295
|
+
*/
|
|
296
|
+
edges?: readonly WfEdgeSpec[];
|
|
297
|
+
/**
|
|
298
|
+
* Widen the gap between layers so an edge has room for an in-line control at
|
|
299
|
+
* its midpoint — the insert affordance an EDITING canvas draws there. The
|
|
300
|
+
* compact densities pitch their layers at 20-34px, which is the whole button,
|
|
301
|
+
* so a canvas that renders one without asking for the lane puts it on top of
|
|
302
|
+
* the nodes either side. Reserved by the layout for the same reason run rows
|
|
303
|
+
* are: what a node or an edge renders is spaced for before it is drawn, never
|
|
304
|
+
* measured afterwards. Defaults to `false`.
|
|
305
|
+
*/
|
|
306
|
+
reserveEdgeInsert?: boolean;
|
|
307
307
|
}
|
|
308
308
|
/** Build a positioned graph from a workflow YAML string. Never throws —
|
|
309
309
|
* malformed YAML or an empty definition returns an `error` the UI can fall
|
|
@@ -311,179 +311,181 @@ interface BuildWorkflowGraphOptions {
|
|
|
311
311
|
* room for the rows live run state adds (see {@link nodeHeight}); `direction`
|
|
312
312
|
* picks the flow axis (default "LR"); `compact` collapses nodes to icon tiles;
|
|
313
313
|
* `edges` replaces the inferred positional spine with a declared topology. */
|
|
314
|
-
declare function buildWorkflowGraph(yaml: string, options?: BuildWorkflowGraphOptions): WfGraph;
|
|
315
|
-
|
|
314
|
+
export declare function buildWorkflowGraph(yaml: string, options?: BuildWorkflowGraphOptions): WfGraph;
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/workflows/WorkflowGraph.d.ts
|
|
316
317
|
interface WorkflowGraphProps {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
318
|
+
/** Workflow YAML to render. */
|
|
319
|
+
yaml: string;
|
|
320
|
+
/** "full" = interactive (pan/zoom/drag + controls); "preview" = static fit. */
|
|
321
|
+
variant?: "full" | "preview";
|
|
322
|
+
/** Flow direction: "LR" (default) reads left-to-right — best for the wide/short
|
|
323
|
+
* run-detail panel; "TB" is a vertical column. */
|
|
324
|
+
direction?: WfDirection;
|
|
325
|
+
/**
|
|
326
|
+
* Start collapsed (compact icon tiles) rather than expanded.
|
|
327
|
+
*
|
|
328
|
+
* Defaults to whether the graph has a RUN: a definition is read
|
|
329
|
+
* structure-first, so it opens as tiles, while a run is read result-first and
|
|
330
|
+
* opens as cards — the answers are the reason the reader opened it. Passing
|
|
331
|
+
* the prop pins the density either way; the full variant still exposes the
|
|
332
|
+
* toggle, and the preview variant is always compact.
|
|
333
|
+
*/
|
|
334
|
+
defaultCompact?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Called when the reader moves the density toggle, with the density they
|
|
337
|
+
* chose.
|
|
338
|
+
*
|
|
339
|
+
* `defaultCompact` seeds the graph; this reports back out of it, which is
|
|
340
|
+
* what a host needs to REMEMBER the choice. Without it a host can set an
|
|
341
|
+
* opening density but never learn that the reader wanted the other one, so
|
|
342
|
+
* every navigation puts them back where they started and the toggle has to
|
|
343
|
+
* be found again.
|
|
344
|
+
*/
|
|
345
|
+
onCompactChange?: (compact: boolean) => void;
|
|
346
|
+
/** Sizing for the wrapper; the caller controls height. */
|
|
347
|
+
className?: string;
|
|
348
|
+
/**
|
|
349
|
+
* Fold a long single-file pipeline into rows instead of one unbounded line,
|
|
350
|
+
* so it uses both axes of the panel rather than running off one edge. Only a
|
|
351
|
+
* straight chain folds; anything with fan-out keeps its layered flow. "LR"
|
|
352
|
+
* only. Defaults to `false`.
|
|
353
|
+
*/
|
|
354
|
+
wrap?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Live per-node run state, keyed by graph node id (`trigger`, `a0`, `a0-b1`).
|
|
357
|
+
* Absent ⇒ the static definition view (the proposal-card preview passes
|
|
358
|
+
* nothing). When present, each node shows its status/cost/duration/output and
|
|
359
|
+
* the running node pulses.
|
|
360
|
+
*
|
|
361
|
+
* Immutability contract: the node memo keys on this object's reference, so the
|
|
362
|
+
* host MUST pass a NEW top-level `nodeState` object whenever any node's state
|
|
363
|
+
* changes (mutating a nested entry in place will not re-render). Building a
|
|
364
|
+
* fresh record each update — e.g. from a poll/SSE tick — satisfies this.
|
|
365
|
+
*/
|
|
366
|
+
nodeState?: Record<string, WfNodeState>;
|
|
367
|
+
/**
|
|
368
|
+
* The graph's DECLARED topology, replacing the spine inferred from `do`-list
|
|
369
|
+
* order — see {@link WfEdgeSpec}. Name endpoints with the exported id helpers
|
|
370
|
+
* (`actionNodeId`, `branchNodeId`, `TRIGGER_NODE_ID`).
|
|
371
|
+
*
|
|
372
|
+
* Immutability contract, as for `nodeState`: the layout memo keys on this
|
|
373
|
+
* array's reference, so pass a stable one (a `useMemo`, or a value derived
|
|
374
|
+
* once per fetch) rather than a fresh literal each render.
|
|
375
|
+
*/
|
|
376
|
+
edges?: readonly WfEdgeSpec[];
|
|
377
|
+
/** Per-node visit budget for a cyclic graph, shown on cycle-closing edges.
|
|
378
|
+
* Meaningless without `edges` (an inferred spine cannot loop). */
|
|
379
|
+
maxNodeVisits?: number;
|
|
380
|
+
/** The node to ring as selected — e.g. the one whose detail panel is open.
|
|
381
|
+
* Selection is the host's state; the graph only reflects it. */
|
|
382
|
+
selectedNodeId?: string;
|
|
383
|
+
/** Click handler for a node (e.g. open a detail drawer). Absent ⇒ nodes are
|
|
384
|
+
* non-interactive on click. */
|
|
385
|
+
onNodeClick?: (nodeId: string, data: WfNodeData) => void;
|
|
386
|
+
/**
|
|
387
|
+
* Editing gestures. Supplying `onEdgeConnect` turns the canvas from a diagram
|
|
388
|
+
* into an EDITOR: node handles become visible and draggable, an edge can be
|
|
389
|
+
* selected and removed with Delete/Backspace, and clicking one asks to edit
|
|
390
|
+
* its guard. Omit it — the default — and the graph stays the read-only
|
|
391
|
+
* visualisation it has always been.
|
|
392
|
+
*
|
|
393
|
+
* `onEdgeConnect` is the ONE prop that decides it. Every other editing
|
|
394
|
+
* callback below (`onEdgeDelete`, `onEdgeClick`, `onEdgeInsert`,
|
|
395
|
+
* `onNodeInsert`, `onTriggerAdd`, `onTriggerDelete`) refines an editor and is
|
|
396
|
+
* inert without it — a canvas that cannot accept a new connection has no
|
|
397
|
+
* business drawing an add control either.
|
|
398
|
+
*
|
|
399
|
+
* Every callback speaks node ids (`actionNodeId`, `branchNodeId`), never
|
|
400
|
+
* positions: this component reports the gesture, and turning it into a
|
|
401
|
+
* definition edit is the host's job — it owns the YAML, and only it knows
|
|
402
|
+
* what a `needs` row is. Fan-out and trigger edges never fire any of these
|
|
403
|
+
* ({@link isEditableEdge}), because neither is a row in anyone's topology.
|
|
404
|
+
*
|
|
405
|
+
* The canvas holds no pending state: an accepted edit comes back as new
|
|
406
|
+
* `yaml` + `edges`, and a rejected one simply never arrives.
|
|
407
|
+
*/
|
|
408
|
+
onEdgeConnect?: (sourceId: string, targetId: string) => void;
|
|
409
|
+
onEdgeDelete?: (sourceId: string, targetId: string) => void;
|
|
410
|
+
onEdgeClick?: (sourceId: string, targetId: string) => void;
|
|
411
|
+
/**
|
|
412
|
+
* Add a step ON an edge: the edge draws a "+" at its midpoint, and pressing it
|
|
413
|
+
* reports the pair it sits between. The layout widens the corridor between
|
|
414
|
+
* layers to hold the control, so arming this RELAYS OUT the graph — a compact
|
|
415
|
+
* canvas pitches its layers at 20px, which is the whole button.
|
|
416
|
+
*
|
|
417
|
+
* Offered on exactly the edges the other three gestures are ({@link
|
|
418
|
+
* isEditableEdge}): inserting on a fan-out or trigger edge would name a pair
|
|
419
|
+
* that exists in no definition. "Add a step at the very start" is the
|
|
420
|
+
* {@link onNodeInsert} drop instead — dragged from the first step's inbound
|
|
421
|
+
* handle onto empty canvas, which names one node rather than a synthesized
|
|
422
|
+
* edge. (A definition with no `on:` at all has no inbound handle on its first
|
|
423
|
+
* step, because nothing points at it; there the step list is the only way in.)
|
|
424
|
+
*/
|
|
425
|
+
onEdgeInsert?: (sourceId: string, targetId: string) => void;
|
|
426
|
+
/**
|
|
427
|
+
* Add a step at the loose end of a connection dragged from a node's handle and
|
|
428
|
+
* released over empty canvas — the canvas's answer to "and then what?".
|
|
429
|
+
* `side` is which handle it left from: `"after"` for the outbound one (the new
|
|
430
|
+
* step follows `nodeId`), `"before"` for the inbound one (it precedes it).
|
|
431
|
+
*
|
|
432
|
+
* Reported for ANY node, including a trigger and a fan-out branch leaf: unlike
|
|
433
|
+
* an edge gesture, this names a node that certainly exists, and whether a step
|
|
434
|
+
* may go beside it is a question about the definition's schema — which this
|
|
435
|
+
* library does not model and the host already answers.
|
|
436
|
+
*/
|
|
437
|
+
onNodeInsert?: (nodeId: string, side: "before" | "after") => void;
|
|
438
|
+
/**
|
|
439
|
+
* The `on:` list gains an entry. Drawn as a canvas control rather than a
|
|
440
|
+
* per-node one, because the workflow that most needs it is the one with NO
|
|
441
|
+
* trigger — which has no trigger node to hang a "+" on.
|
|
442
|
+
*
|
|
443
|
+
* Offered whenever it is supplied, including on a definition that ALREADY has
|
|
444
|
+
* a trigger: `on:` is a list with OR semantics, and a second subscription is a
|
|
445
|
+
* normal thing to want. Whether THIS workflow may take another one is a
|
|
446
|
+
* question about the definition's schema and the provider behind it, which
|
|
447
|
+
* this library does not model — a host that must cap the list withholds the
|
|
448
|
+
* callback.
|
|
449
|
+
*/
|
|
450
|
+
onTriggerAdd?: () => void;
|
|
451
|
+
/** Remove the `on:` entry a trigger node stands for — the one node deletion
|
|
452
|
+
* that IS a canvas gesture (every other node is a `do` entry, reordered and
|
|
453
|
+
* removed in the list the host owns). Read the entry's position back with
|
|
454
|
+
* `triggerNodeIndex`. */
|
|
455
|
+
onTriggerDelete?: (nodeId: string) => void;
|
|
456
|
+
/**
|
|
457
|
+
* AUTHORING problems anchored to the nodes and edges that carry them, so a
|
|
458
|
+
* compile error is visible on the canvas rather than only in a list beside it.
|
|
459
|
+
* See {@link WfProblem} — and note it is a separate channel from `nodeState`,
|
|
460
|
+
* which is what a node DID rather than what is wrong with what it says.
|
|
461
|
+
*
|
|
462
|
+
* A problem tints the node's border in either density, and states itself on a
|
|
463
|
+
* mark in the card's identity row (a corner of the compact tile). A graph
|
|
464
|
+
* showing a RUN is not an authoring surface — its cards and edges state the
|
|
465
|
+
* run instead, which takes precedence over a problem's colour on both, and the
|
|
466
|
+
* problem's mark and chip still render beside it.
|
|
467
|
+
*
|
|
468
|
+
* What the canvas gives is a LOCATOR: which step or dependency is at fault,
|
|
469
|
+
* with the messages on the mark's `title` and in the accessibility tree. It is
|
|
470
|
+
* deliberately not a reader for them — at the zoom a whole pipeline is viewed
|
|
471
|
+
* at, a panel of message text on the canvas is unreadable, and the host
|
|
472
|
+
* already owns the problem list that the messages are read and acted on in.
|
|
473
|
+
*
|
|
474
|
+
* Pairing contract: anchors are positional node ids, so a problem list must be
|
|
475
|
+
* derived from the SAME definition passed as `yaml`. Hand over a list computed
|
|
476
|
+
* against an older draft and an id that still exists may now name a different
|
|
477
|
+
* step, which puts the diagnostic on an innocent one — the graph cannot tell
|
|
478
|
+
* the two apart, any more than it can for a run's `nodeState`. A host that
|
|
479
|
+
* validates asynchronously therefore holds each result against the text it was
|
|
480
|
+
* computed from, and passes neither until they agree.
|
|
481
|
+
*
|
|
482
|
+
* Immutability contract, as for `edges`: the index is memoized on this array's
|
|
483
|
+
* reference, so pass a stable one.
|
|
484
|
+
*/
|
|
485
|
+
problems?: readonly WfProblem[];
|
|
485
486
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region src/workflows/WorkflowGraphLazy.d.ts
|
|
489
|
+
declare function WorkflowGraph(props: WorkflowGraphProps): import("react").JSX.Element;
|
|
490
|
+
//#endregion
|
|
491
|
+
export { type BuildWorkflowGraphOptions, type ModelBrandIdentity, ModelBrandStack, type WfEdge, type WfEdgeKind, type WfEdgeSpec, type WfGraph, type WfNode, type WfNodeData, type WfNodeState, type WfNodeStatus, type WfNodeTone, type WfProblem, type WfProblemSeverity, WorkflowGraph as WorkflowGraphLazy, type WorkflowGraphProps, modelBrandFor };
|