@tangle-network/sandbox-ui 0.113.6 → 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.
Files changed (106) hide show
  1. package/dist/WorkflowGraph-B-NsdYz_.js +1961 -0
  2. package/dist/assets.d.ts +214 -206
  3. package/dist/assets.js +1057 -908
  4. package/dist/auth-CWe17Hly.js +37 -0
  5. package/dist/auth.d.ts +2 -30
  6. package/dist/auth.js +2 -15
  7. package/dist/chat-BOvFAe6p.js +903 -0
  8. package/dist/chat.d.ts +2 -230
  9. package/dist/chat.js +2 -34
  10. package/dist/connectors.d.ts +52 -49
  11. package/dist/connectors.js +595 -643
  12. package/dist/dashboard-CZ3VgNPR.js +4969 -0
  13. package/dist/dashboard.d.ts +4 -1297
  14. package/dist/dashboard.js +4 -152
  15. package/dist/editor.d.ts +2 -1
  16. package/dist/editor.js +2 -31
  17. package/dist/files.d.ts +2 -6
  18. package/dist/files.js +2 -33
  19. package/dist/globals.css +63 -3
  20. package/dist/hooks.d.ts +146 -148
  21. package/dist/hooks.js +222 -55
  22. package/dist/index-CKRaj1pM.d.ts +776 -0
  23. package/dist/index-CXX5IpH2.d.ts +2 -0
  24. package/dist/index-DPePq7c8.d.ts +1340 -0
  25. package/dist/index-DiyLLZuJ.d.ts +230 -0
  26. package/dist/index-DvmZLMT1.d.ts +30 -0
  27. package/dist/index-I8ZLVtHd.d.ts +330 -0
  28. package/dist/index-PRM636Ex.d.ts +86 -0
  29. package/dist/index.d.ts +21 -33
  30. package/dist/index.js +21 -701
  31. package/dist/info-panel-C9cqDzOL.js +594 -0
  32. package/dist/integrations.d.ts +133 -139
  33. package/dist/integrations.js +491 -673
  34. package/dist/markdown.d.ts +2 -1
  35. package/dist/markdown.js +2 -13
  36. package/dist/model-I-NIxeM-.js +1250 -0
  37. package/dist/model-brand-B9A4H9pJ.d.ts +98 -0
  38. package/dist/model-brand-hMyDTUqB.js +624 -0
  39. package/dist/motion-DkyBRJb9.js +37 -0
  40. package/dist/openui.d.ts +2 -1
  41. package/dist/openui.js +2 -7
  42. package/dist/pages.d.ts +307 -300
  43. package/dist/pages.js +4404 -4181
  44. package/dist/primitives-Dh1vG6J3.js +113 -0
  45. package/dist/primitives.d.ts +2 -74
  46. package/dist/primitives.js +2 -204
  47. package/dist/provider-logo-DjqmConF.js +311 -0
  48. package/dist/run.d.ts +2 -1
  49. package/dist/run.js +2 -23
  50. package/dist/sdk-hooks.d.ts +3 -4
  51. package/dist/sdk-hooks.js +3 -31
  52. package/dist/sidecar-DgH_vQ6m.d.ts +9 -0
  53. package/dist/stores.d.ts +14 -15
  54. package/dist/stores.js +13 -81
  55. package/dist/styles.css +63 -3
  56. package/dist/template-card-L-4gmjx2.d.ts +90 -0
  57. package/dist/terminal-CN9ZgHRt.js +197 -0
  58. package/dist/terminal.d.ts +60 -60
  59. package/dist/terminal.js +2 -10
  60. package/dist/tokens.css +51 -0
  61. package/dist/types.d.ts +4 -11
  62. package/dist/types.js +0 -1
  63. package/dist/use-pty-session-C8cE0adT.js +669 -0
  64. package/dist/use-sidecar-auth-CCTJcrq7.d.ts +145 -0
  65. package/dist/use-sidecar-auth-DkdcufOz.js +742 -0
  66. package/dist/utils-DzWbktWG.js +2 -0
  67. package/dist/utils.d.ts +2 -1
  68. package/dist/utils.js +2 -37
  69. package/dist/workbench-BCaCKl-J.js +8347 -0
  70. package/dist/workbench.d.ts +2 -310
  71. package/dist/workbench.js +2 -44
  72. package/dist/workflows.d.ts +341 -339
  73. package/dist/workflows.js +74 -109
  74. package/dist/workspace-B6AtI6ld.js +2510 -0
  75. package/dist/workspace.d.ts +2 -761
  76. package/dist/workspace.js +2 -51
  77. package/package.json +46 -40
  78. package/dist/WorkflowGraph-2QOORYIR.js +0 -1722
  79. package/dist/chunk-2BUPSB7O.js +0 -0
  80. package/dist/chunk-3KBNPQQF.js +0 -2697
  81. package/dist/chunk-3LIXVEEE.js +0 -279
  82. package/dist/chunk-72UF2H5H.js +0 -707
  83. package/dist/chunk-AI25G5MX.js +0 -944
  84. package/dist/chunk-ANSC5AFC.js +0 -314
  85. package/dist/chunk-AZ3AWMTM.js +0 -8
  86. package/dist/chunk-BGVEHENC.js +0 -10
  87. package/dist/chunk-CZ7CSFO4.js +0 -39
  88. package/dist/chunk-DYXXYGS4.js +0 -4700
  89. package/dist/chunk-EI44GEQ5.js +0 -6
  90. package/dist/chunk-IACRDXER.js +0 -219
  91. package/dist/chunk-IOB2PW5Z.js +0 -55
  92. package/dist/chunk-M4K7ZGR2.js +0 -24
  93. package/dist/chunk-MYZAW4RX.js +0 -665
  94. package/dist/chunk-OMUIPJQZ.js +0 -555
  95. package/dist/chunk-RQZRXKMR.js +0 -398
  96. package/dist/chunk-SOKKTB7W.js +0 -230
  97. package/dist/chunk-TADGS4Q7.js +0 -1010
  98. package/dist/chunk-UCQNOUN3.js +0 -7964
  99. package/dist/chunk-ULPLRBMF.js +0 -34
  100. package/dist/chunk-WID73FPH.js +0 -89
  101. package/dist/chunk-X3YXP7FG.js +0 -38
  102. package/dist/logo-DiAjq759.d.ts +0 -15
  103. package/dist/model-brand-BNnaUKKZ.d.ts +0 -99
  104. package/dist/ports-list-CDIvTNnX.d.ts +0 -17
  105. package/dist/sdk-hooks-Djkjq4cp.d.ts +0 -145
  106. package/dist/template-card-Bn-Bw5xC.d.ts +0 -87
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
- export { M as ModelBrandIdentity, a as ModelBrandStack, m as modelBrandFor } from './model-brand-BNnaUKKZ.js';
3
- import '@tangle-network/agent-interface';
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
- 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;
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
- /** 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;
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
- 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;
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
- 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;
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
- from: string;
206
- to: string;
207
- whenLabel?: string;
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
- anchor: "node";
239
- /** The node the problem sits on. */
240
- node: string;
241
- severity: WfProblemSeverity;
242
- message: string;
238
+ anchor: "node";
239
+ /** The node the problem sits on. */
240
+ node: string;
241
+ severity: WfProblemSeverity;
242
+ message: string;
243
243
  } | {
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;
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
- nodes: WfNode[];
253
- edges: WfEdge[];
254
- /** Set when the YAML couldn't be parsed into a renderable graph. */
255
- error: string | null;
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
- * 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;
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
- /** Workflow YAML to render. */
318
- yaml: string;
319
- /** "full" = interactive (pan/zoom/drag + controls); "preview" = static fit. */
320
- variant?: "full" | "preview";
321
- /** Flow direction: "LR" (default) reads left-to-right — best for the wide/short
322
- * run-detail panel; "TB" is a vertical column. */
323
- direction?: WfDirection;
324
- /**
325
- * Start collapsed (compact icon tiles) rather than expanded.
326
- *
327
- * Defaults to whether the graph has a RUN: a definition is read
328
- * structure-first, so it opens as tiles, while a run is read result-first and
329
- * opens as cards — the answers are the reason the reader opened it. Passing
330
- * the prop pins the density either way; the full variant still exposes the
331
- * toggle, and the preview variant is always compact.
332
- */
333
- defaultCompact?: boolean;
334
- /**
335
- * Called when the reader moves the density toggle, with the density they
336
- * chose.
337
- *
338
- * `defaultCompact` seeds the graph; this reports back out of it, which is
339
- * what a host needs to REMEMBER the choice. Without it a host can set an
340
- * opening density but never learn that the reader wanted the other one, so
341
- * every navigation puts them back where they started and the toggle has to
342
- * be found again.
343
- */
344
- onCompactChange?: (compact: boolean) => void;
345
- /** Sizing for the wrapper; the caller controls height. */
346
- className?: string;
347
- /**
348
- * Fold a long single-file pipeline into rows instead of one unbounded line,
349
- * so it uses both axes of the panel rather than running off one edge. Only a
350
- * straight chain folds; anything with fan-out keeps its layered flow. "LR"
351
- * only. Defaults to `false`.
352
- */
353
- wrap?: boolean;
354
- /**
355
- * Live per-node run state, keyed by graph node id (`trigger`, `a0`, `a0-b1`).
356
- * Absent ⇒ the static definition view (the proposal-card preview passes
357
- * nothing). When present, each node shows its status/cost/duration/output and
358
- * the running node pulses.
359
- *
360
- * Immutability contract: the node memo keys on this object's reference, so the
361
- * host MUST pass a NEW top-level `nodeState` object whenever any node's state
362
- * changes (mutating a nested entry in place will not re-render). Building a
363
- * fresh record each update — e.g. from a poll/SSE tick — satisfies this.
364
- */
365
- nodeState?: Record<string, WfNodeState>;
366
- /**
367
- * The graph's DECLARED topology, replacing the spine inferred from `do`-list
368
- * order — see {@link WfEdgeSpec}. Name endpoints with the exported id helpers
369
- * (`actionNodeId`, `branchNodeId`, `TRIGGER_NODE_ID`).
370
- *
371
- * Immutability contract, as for `nodeState`: the layout memo keys on this
372
- * array's reference, so pass a stable one (a `useMemo`, or a value derived
373
- * once per fetch) rather than a fresh literal each render.
374
- */
375
- edges?: readonly WfEdgeSpec[];
376
- /** Per-node visit budget for a cyclic graph, shown on cycle-closing edges.
377
- * Meaningless without `edges` (an inferred spine cannot loop). */
378
- maxNodeVisits?: number;
379
- /** The node to ring as selected — e.g. the one whose detail panel is open.
380
- * Selection is the host's state; the graph only reflects it. */
381
- selectedNodeId?: string;
382
- /** Click handler for a node (e.g. open a detail drawer). Absent ⇒ nodes are
383
- * non-interactive on click. */
384
- onNodeClick?: (nodeId: string, data: WfNodeData) => void;
385
- /**
386
- * Editing gestures. Supplying `onEdgeConnect` turns the canvas from a diagram
387
- * into an EDITOR: node handles become visible and draggable, an edge can be
388
- * selected and removed with Delete/Backspace, and clicking one asks to edit
389
- * its guard. Omit it — the default — and the graph stays the read-only
390
- * visualisation it has always been.
391
- *
392
- * `onEdgeConnect` is the ONE prop that decides it. Every other editing
393
- * callback below (`onEdgeDelete`, `onEdgeClick`, `onEdgeInsert`,
394
- * `onNodeInsert`, `onTriggerAdd`, `onTriggerDelete`) refines an editor and is
395
- * inert without it — a canvas that cannot accept a new connection has no
396
- * business drawing an add control either.
397
- *
398
- * Every callback speaks node ids (`actionNodeId`, `branchNodeId`), never
399
- * positions: this component reports the gesture, and turning it into a
400
- * definition edit is the host's job — it owns the YAML, and only it knows
401
- * what a `needs` row is. Fan-out and trigger edges never fire any of these
402
- * ({@link isEditableEdge}), because neither is a row in anyone's topology.
403
- *
404
- * The canvas holds no pending state: an accepted edit comes back as new
405
- * `yaml` + `edges`, and a rejected one simply never arrives.
406
- */
407
- onEdgeConnect?: (sourceId: string, targetId: string) => void;
408
- onEdgeDelete?: (sourceId: string, targetId: string) => void;
409
- onEdgeClick?: (sourceId: string, targetId: string) => void;
410
- /**
411
- * Add a step ON an edge: the edge draws a "+" at its midpoint, and pressing it
412
- * reports the pair it sits between. The layout widens the corridor between
413
- * layers to hold the control, so arming this RELAYS OUT the graph — a compact
414
- * canvas pitches its layers at 20px, which is the whole button.
415
- *
416
- * Offered on exactly the edges the other three gestures are ({@link
417
- * isEditableEdge}): inserting on a fan-out or trigger edge would name a pair
418
- * that exists in no definition. "Add a step at the very start" is the
419
- * {@link onNodeInsert} drop instead — dragged from the first step's inbound
420
- * handle onto empty canvas, which names one node rather than a synthesized
421
- * edge. (A definition with no `on:` at all has no inbound handle on its first
422
- * step, because nothing points at it; there the step list is the only way in.)
423
- */
424
- onEdgeInsert?: (sourceId: string, targetId: string) => void;
425
- /**
426
- * Add a step at the loose end of a connection dragged from a node's handle and
427
- * released over empty canvas — the canvas's answer to "and then what?".
428
- * `side` is which handle it left from: `"after"` for the outbound one (the new
429
- * step follows `nodeId`), `"before"` for the inbound one (it precedes it).
430
- *
431
- * Reported for ANY node, including a trigger and a fan-out branch leaf: unlike
432
- * an edge gesture, this names a node that certainly exists, and whether a step
433
- * may go beside it is a question about the definition's schema — which this
434
- * library does not model and the host already answers.
435
- */
436
- onNodeInsert?: (nodeId: string, side: "before" | "after") => void;
437
- /**
438
- * The `on:` list gains an entry. Drawn as a canvas control rather than a
439
- * per-node one, because the workflow that most needs it is the one with NO
440
- * trigger — which has no trigger node to hang a "+" on.
441
- *
442
- * Offered whenever it is supplied, including on a definition that ALREADY has
443
- * a trigger: `on:` is a list with OR semantics, and a second subscription is a
444
- * normal thing to want. Whether THIS workflow may take another one is a
445
- * question about the definition's schema and the provider behind it, which
446
- * this library does not model — a host that must cap the list withholds the
447
- * callback.
448
- */
449
- onTriggerAdd?: () => void;
450
- /** Remove the `on:` entry a trigger node stands for — the one node deletion
451
- * that IS a canvas gesture (every other node is a `do` entry, reordered and
452
- * removed in the list the host owns). Read the entry's position back with
453
- * `triggerNodeIndex`. */
454
- onTriggerDelete?: (nodeId: string) => void;
455
- /**
456
- * AUTHORING problems anchored to the nodes and edges that carry them, so a
457
- * compile error is visible on the canvas rather than only in a list beside it.
458
- * See {@link WfProblem} — and note it is a separate channel from `nodeState`,
459
- * which is what a node DID rather than what is wrong with what it says.
460
- *
461
- * A problem tints the node's border in either density, and states itself on a
462
- * mark in the card's identity row (a corner of the compact tile). A graph
463
- * showing a RUN is not an authoring surface — its cards and edges state the
464
- * run instead, which takes precedence over a problem's colour on both, and the
465
- * problem's mark and chip still render beside it.
466
- *
467
- * What the canvas gives is a LOCATOR: which step or dependency is at fault,
468
- * with the messages on the mark's `title` and in the accessibility tree. It is
469
- * deliberately not a reader for them — at the zoom a whole pipeline is viewed
470
- * at, a panel of message text on the canvas is unreadable, and the host
471
- * already owns the problem list that the messages are read and acted on in.
472
- *
473
- * Pairing contract: anchors are positional node ids, so a problem list must be
474
- * derived from the SAME definition passed as `yaml`. Hand over a list computed
475
- * against an older draft and an id that still exists may now name a different
476
- * step, which puts the diagnostic on an innocent one — the graph cannot tell
477
- * the two apart, any more than it can for a run's `nodeState`. A host that
478
- * validates asynchronously therefore holds each result against the text it was
479
- * computed from, and passes neither until they agree.
480
- *
481
- * Immutability contract, as for `edges`: the index is memoized on this array's
482
- * reference, so pass a stable one.
483
- */
484
- problems?: readonly WfProblem[];
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
- declare function WorkflowGraph(props: WorkflowGraphProps): React.JSX.Element;
488
-
489
- export { type BuildWorkflowGraphOptions, TRIGGER_NODE_ID, 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, actionNodeId, branchNodeId, buildWorkflowGraph, triggerNodeId, triggerNodeIndex };
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 };