@blackbelt-technology/pi-dashboard-flows-plugin 0.5.3 → 0.6.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 (70) hide show
  1. package/package.json +48 -4
  2. package/src/AGENTS.md +8 -0
  3. package/src/__tests__/FlowGraph.test.ts +151 -5
  4. package/src/__tests__/FlowInputWiring.test.tsx +97 -0
  5. package/src/__tests__/FlowSummary.test.tsx +331 -0
  6. package/src/__tests__/FlowYamlPreview.test.tsx +75 -0
  7. package/src/__tests__/FlowsSessionStateContext.test.tsx +223 -0
  8. package/src/__tests__/FlowsUiStateContext.test.tsx +140 -0
  9. package/src/__tests__/authoring-renderers.test.tsx +190 -0
  10. package/src/__tests__/automation-actions.test.ts +117 -0
  11. package/src/__tests__/flow-agent-card-code-source.test.tsx +154 -0
  12. package/src/__tests__/flow-agent-cost.test.tsx +160 -0
  13. package/src/__tests__/flow-agent-error.test.ts +60 -0
  14. package/src/__tests__/flow-collapse-storage.test.ts +90 -0
  15. package/src/__tests__/flow-edges.test.ts +195 -0
  16. package/src/__tests__/flow-inputs.test.ts +69 -0
  17. package/src/__tests__/flow-reducer-bridge-contract.test.ts +108 -0
  18. package/src/__tests__/flow-reducer-seed-on-start.test.ts +61 -0
  19. package/src/__tests__/flow-yaml-parse.test.ts +124 -0
  20. package/src/__tests__/flows-for-cwd.test.ts +51 -0
  21. package/src/__tests__/flowsAvailability.test.ts +79 -0
  22. package/src/__tests__/manifest-discoverability.test.ts +97 -0
  23. package/src/__tests__/node-kind-reducer.test.ts +135 -0
  24. package/src/__tests__/plugin-action-handler.test.ts +54 -0
  25. package/src/__tests__/render-actions.test.ts +63 -0
  26. package/src/__tests__/session-flow-actions-edit.test.tsx +98 -0
  27. package/src/bridge/AGENTS.md +8 -0
  28. package/src/bridge/flow-question-adapter.ts +93 -0
  29. package/src/bridge/index.ts +30 -0
  30. package/src/client/AGENTS.md +32 -0
  31. package/src/client/FlowActivityBadge.tsx +41 -11
  32. package/src/client/FlowAgentCard.tsx +321 -61
  33. package/src/client/FlowAgentDetail.tsx +103 -154
  34. package/src/client/FlowAgentsToolRenderer.tsx +228 -0
  35. package/src/client/FlowAuthorPromptDialog.tsx +92 -0
  36. package/src/client/FlowDashboard.tsx +271 -43
  37. package/src/client/FlowGraph.tsx +425 -276
  38. package/src/client/FlowInputWiring.tsx +243 -0
  39. package/src/client/FlowLaunchDialog.tsx +52 -52
  40. package/src/client/FlowQuestionCard.tsx +216 -0
  41. package/src/client/FlowQuestionTranscriptPill.tsx +58 -0
  42. package/src/client/FlowSummary.tsx +285 -80
  43. package/src/client/FlowWriteToolRenderer.tsx +127 -0
  44. package/src/client/FlowYamlPopoverButton.tsx +110 -0
  45. package/src/client/FlowYamlPreview.tsx +67 -0
  46. package/src/client/FlowsCommandRoutes.tsx +237 -0
  47. package/src/client/FlowsSessionStateContext.tsx +142 -0
  48. package/src/client/FlowsSettings.tsx +68 -0
  49. package/src/client/FlowsUiStateContext.tsx +169 -0
  50. package/src/client/SessionFlowActions.tsx +172 -65
  51. package/src/client/flow-collapse-storage.ts +79 -0
  52. package/src/client/flow-edges.ts +173 -0
  53. package/src/client/flow-yaml-parse.ts +140 -0
  54. package/src/client/flowsAvailability.ts +44 -0
  55. package/src/client/index.tsx +95 -13
  56. package/src/client/shouldRender.ts +38 -0
  57. package/src/configSchema.json +14 -0
  58. package/src/flow-reducer.ts +94 -13
  59. package/src/i18n.ts +90 -0
  60. package/src/reducer.ts +5 -5
  61. package/src/server/AGENTS.md +10 -0
  62. package/src/server/automation-actions.ts +162 -0
  63. package/src/server/flow-inputs.ts +58 -0
  64. package/src/server/index.ts +171 -0
  65. package/src/server/render-actions.ts +88 -0
  66. package/src/server/state-store.ts +74 -0
  67. package/src/__tests__/ArchitectInputPrompt.test.tsx +0 -81
  68. package/src/__tests__/architect-reducer.test.ts +0 -307
  69. package/src/architect-reducer.ts +0 -386
  70. package/src/client/FlowArchitect.tsx +0 -622
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blackbelt-technology/pi-dashboard-flows-plugin",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Flow rendering plugin for pi-dashboard — pi-flows event reaction (FlowDashboard, FlowAgentCard, FlowArchitect, etc.)",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -29,20 +29,64 @@
29
29
  "files": [
30
30
  "src/"
31
31
  ],
32
- "//pi-dashboard-plugin-deferred-claims": "session-card-badge (FlowActivityBadge) and session-card-action-bar (SessionFlowActions) are deferred until migrate-flows-jsx-to-slots adapts those components to accept {session} and pull app state from context. Until then they remain wired via direct JSX in SessionCard.tsx.",
33
32
  "pi-dashboard-plugin": {
34
33
  "id": "flows",
35
34
  "displayName": "Flows",
35
+ "i18nCatalog": "catalog",
36
36
  "priority": 100,
37
+ "configSchema": "./src/configSchema.json",
37
38
  "client": "./src/client/index.tsx",
38
- "claims": []
39
+ "server": "./src/server/index.ts",
40
+ "bridge": "./src/bridge/index.ts",
41
+ "claims": [
42
+ {
43
+ "slot": "session-card-flows",
44
+ "component": "SessionFlowActionsClaim",
45
+ "shouldRender": "shouldRenderFlowsSubcard"
46
+ },
47
+ {
48
+ "slot": "content-header-sticky",
49
+ "component": "FlowDashboardClaim"
50
+ },
51
+ {
52
+ "slot": "content-view",
53
+ "component": "FlowYamlPreviewClaim",
54
+ "predicate": "isFlowYamlPreviewActive"
55
+ },
56
+ {
57
+ "slot": "tool-renderer",
58
+ "component": "FlowWriteToolRenderer",
59
+ "toolName": "flow_write"
60
+ },
61
+ {
62
+ "slot": "tool-renderer",
63
+ "component": "FlowAgentsToolRenderer",
64
+ "toolName": "flow_agents"
65
+ },
66
+ {
67
+ "slot": "settings-section",
68
+ "component": "FlowsSettings",
69
+ "tab": "general"
70
+ },
71
+ {
72
+ "slot": "automation-action-editor",
73
+ "component": "FlowInputWiringClaim",
74
+ "config": {
75
+ "actionId": "flows.run"
76
+ }
77
+ }
78
+ ]
39
79
  },
40
80
  "peerDependencies": {
41
81
  "react": ">=18.0.0",
42
82
  "react-dom": ">=18.0.0"
43
83
  },
84
+ "//deps-rationale": "client-utils retained for hooks (useMobile, useZoomPan) and Phase-2 extension-ui slot consumers (AgentMetricSlot, BreadcrumbSlot, GateSlot, aggregateGateState helper). All UI primitive components (AgentCardShell, MarkdownContent, ConfirmDialog, DialogPortal, SearchableSelectDialog, ZoomControls, format-tokens, format-duration) flow through the UI primitive registry per add-plugin-ui-primitive-registry.",
44
85
  "dependencies": {
45
- "@blackbelt-technology/pi-dashboard-shared": "^0.5.3"
86
+ "@blackbelt-technology/dashboard-plugin-runtime": "^0.6.0",
87
+ "@blackbelt-technology/pi-dashboard-client-utils": "^0.6.0",
88
+ "@blackbelt-technology/pi-dashboard-shared": "^0.6.0",
89
+ "yaml": "^2.9.0"
46
90
  },
47
91
  "devDependencies": {
48
92
  "@types/react": "^19.0.0",
package/src/AGENTS.md ADDED
@@ -0,0 +1,8 @@
1
+ # DOX — packages/flows-plugin/src
2
+
3
+ Files in this directory. One row per source file.
4
+
5
+ | File | Purpose |
6
+ |------|---------|
7
+ | `flow-reducer.ts` | Flow event fold. Reads `nodeKind` at `flow_agent_started` (decided once; agent-card fallback), `typedOutputs`/`branch`/`outcome` at complete, code target from `data.target`, `cost` from `result.cost` (verbatim, undefined when absent; see change surface-flow-agent-cost). Pre-lists code/code-decision steps as pending cards. `flow_complete` non-success downgrades in-flight cards to error/hard. See change: rework-flows-plugin-for-new-pi-flows. |
8
+ | `reducer.ts` | Re-export barrel for `isFlowEvent`, `reduceFlowEvent`. Architect reducer exports REMOVED (flow-architect deleted upstream). See change: rework-flows-plugin-for-new-pi-flows. L1/L2 reducer coverage: `__tests__/flow-reducer-seed-on-start.test.ts` (missing-start -> null; start-then-progression advances status + agents to terminal) and `__tests__/flow-reducer-bridge-contract.test.ts` (CONTRACT-PINNED: event types read from the bridge `FLOW_EVENT_MAP` values, never hand-typed; core lifecycle reduces to terminal, reducer never throws on any mapped `flow_*`, passthrough leaves state unchanged). See change: add-flow-plugin-e2e-tests. |
@@ -1,5 +1,56 @@
1
- import { describe, it, expect } from "vitest";
2
- import { computeLayout, type FlowGraphStep } from "../client/FlowGraph.js";
1
+ import {
2
+ createUiPrimitiveRegistry,
3
+ registerUiPrimitive,
4
+ UiPrimitiveProvider,
5
+ } from "@blackbelt-technology/dashboard-plugin-runtime";
6
+ import { UI_PRIMITIVE_KEYS } from "@blackbelt-technology/pi-dashboard-shared/dashboard-plugin/ui-primitives.js";
7
+ import { cleanup, render } from "@testing-library/react";
8
+ import { createElement } from "react";
9
+ import { afterEach, describe, expect, it } from "vitest";
10
+ import { computeLayout, FlowGraph, type FlowGraphStep, mapStepType } from "../client/FlowGraph.js";
11
+
12
+ const registry = createUiPrimitiveRegistry();
13
+ registerUiPrimitive(registry, UI_PRIMITIVE_KEYS.zoomControls, ((() => null) as never));
14
+
15
+ afterEach(() => cleanup());
16
+
17
+ describe("FlowGraph render: on_complete label suppression", () => {
18
+ it("renders branch labels but never the on_complete label", () => {
19
+ // See change: fix-flow-ui-graph-zoom-summary — on_complete is the happy-path
20
+ // default and renders as a plain arrow; branch labels stay visible.
21
+ const steps: FlowGraphStep[] = [
22
+ { id: "load", label: "load", status: "complete", blockedBy: [], type: "code", onComplete: "gate" },
23
+ { id: "gate", label: "gate", status: "complete", blockedBy: [], type: "code-decision", branches: { go: "done" } },
24
+ { id: "done", label: "done", status: "pending", blockedBy: [] },
25
+ ];
26
+ const { container } = render(
27
+ createElement(UiPrimitiveProvider, {
28
+ value: registry,
29
+ children: createElement(FlowGraph, { steps }),
30
+ }),
31
+ );
32
+ const text = container.textContent ?? "";
33
+ expect(text).toContain("go"); // branch label rendered
34
+ expect(text).not.toContain("on_complete"); // route happy-path label suppressed
35
+ });
36
+ });
37
+
38
+ describe("mapStepType (canonical node set)", () => {
39
+ it("maps the new code node kinds", () => {
40
+ expect(mapStepType("code")).toBe("code");
41
+ expect(mapStepType("code-decision")).toBe("code-decision");
42
+ });
43
+ it("maps fork + agent-decision to fork shape", () => {
44
+ expect(mapStepType("fork")).toBe("fork");
45
+ expect(mapStepType("agent-decision")).toBe("fork");
46
+ });
47
+ it("agent and removed legacy types (incl. flow-ref) map to default (undefined)", () => {
48
+ expect(mapStepType("agent")).toBeUndefined();
49
+ expect(mapStepType("conditional")).toBeUndefined();
50
+ expect(mapStepType("agent-loop-decision")).toBeUndefined();
51
+ expect(mapStepType("flow-ref")).toBeUndefined();
52
+ });
53
+ });
3
54
 
4
55
  describe("computeLayout", () => {
5
56
  it("lays out a linear flow A→B→C left-to-right", () => {
@@ -62,6 +113,22 @@ describe("computeLayout", () => {
62
113
  expect(nodeB.y).not.toBe(nodeC.y);
63
114
  });
64
115
 
116
+ it("places no-blockedBy parallel roots in the same rank (no false serialization)", () => {
117
+ // Two roots, no blockedBy, no separator between them. The engine runs both
118
+ // in wave 1 (parallel); the layout must NOT synthesize an impl→docs edge that
119
+ // pushes them into consecutive ranks (would read as sequential).
120
+ const steps: FlowGraphStep[] = [
121
+ { id: "impl", label: "impl", status: "running", blockedBy: [] },
122
+ { id: "docs", label: "docs", status: "running", blockedBy: [] },
123
+ ];
124
+ const result = computeLayout(steps);
125
+ expect(result.edges).toHaveLength(0);
126
+ const impl = result.nodes.find(n => n.id === "impl")!;
127
+ const docs = result.nodes.find(n => n.id === "docs")!;
128
+ expect(impl.x).toBe(docs.x); // same rank
129
+ expect(impl.y).not.toBe(docs.y); // stacked vertically = parallel
130
+ });
131
+
65
132
  it("handles single-step flow", () => {
66
133
  const steps: FlowGraphStep[] = [
67
134
  { id: "solo", label: "solo-step", status: "running", blockedBy: [] },
@@ -73,6 +140,54 @@ describe("computeLayout", () => {
73
140
  expect(result.width).toBeGreaterThan(0);
74
141
  });
75
142
 
143
+ it("marks a returning on_error route as a red loop-styled edge (isError + isReturning)", () => {
144
+ const steps: FlowGraphStep[] = [
145
+ { id: "validate", label: "validate", status: "complete", blockedBy: [], type: "code-decision", onError: "fixup" },
146
+ { id: "transform", label: "transform", status: "running", blockedBy: ["validate"] },
147
+ { id: "fixup", label: "fixup", status: "pending", blockedBy: [], onComplete: "validate" },
148
+ ];
149
+ const result = computeLayout(steps);
150
+ const e = result.edges.find(ed => ed.source === "validate" && ed.target === "fixup");
151
+ expect(e).toBeTruthy();
152
+ expect(e!.isError).toBe(true);
153
+ expect(e!.isReturning).toBe(true);
154
+ // dagre-routed: multi-segment polyline (does not cross the band naively)
155
+ expect(e!.points.length).toBeGreaterThanOrEqual(2);
156
+ });
157
+
158
+ it("collapses terminal on_error handlers into a single sink node", () => {
159
+ const steps: FlowGraphStep[] = [
160
+ { id: "a", label: "a", status: "complete", blockedBy: [], onError: "notify" },
161
+ { id: "b", label: "b", status: "running", blockedBy: ["a"], onError: "notify" },
162
+ { id: "notify", label: "notify", status: "pending", blockedBy: [] },
163
+ ];
164
+ const result = computeLayout(steps);
165
+ expect(result.errorSink).toBeTruthy();
166
+ expect(result.errorSink!.handlers).toEqual(["notify"]);
167
+ // the terminal handler is NOT laid out as a normal node
168
+ expect(result.nodes.some(n => n.id === "notify")).toBe(false);
169
+ // both terminal routes are present as error edges (routed to the sink)
170
+ expect(result.edges.filter(e => e.isError).map(e => e.source).sort()).toEqual(["a", "b"]);
171
+ });
172
+
173
+ it("removes error routes from layout when showErrorRoutes is false (zero footprint)", () => {
174
+ const withErr: FlowGraphStep[] = [
175
+ { id: "a", label: "a", status: "complete", blockedBy: [], onError: "notify" },
176
+ { id: "b", label: "b", status: "running", blockedBy: ["a"] },
177
+ { id: "notify", label: "notify", status: "pending", blockedBy: [] },
178
+ ];
179
+ const baseline: FlowGraphStep[] = [
180
+ { id: "a", label: "a", status: "complete", blockedBy: [] },
181
+ { id: "b", label: "b", status: "running", blockedBy: ["a"] },
182
+ ];
183
+ const off = computeLayout(withErr, { showErrorRoutes: false });
184
+ const base = computeLayout(baseline);
185
+ expect(off.errorSink).toBeUndefined();
186
+ expect(off.edges.some(e => e.isError)).toBe(false);
187
+ expect(off.nodes.some(n => n.id === "notify")).toBe(false);
188
+ expect(off.height).toBe(base.height);
189
+ });
190
+
76
191
  it("handles empty steps array", () => {
77
192
  const result = computeLayout([]);
78
193
  // Should return empty layout without throwing
@@ -146,14 +261,45 @@ describe("computeLayout", () => {
146
261
  expect(result.edges).toHaveLength(0); // no edge for missing dep
147
262
  });
148
263
 
149
- it("preserves type field on positioned nodes for flow-ref steps", () => {
264
+ it("preserves type field on positioned nodes", () => {
150
265
  const steps: FlowGraphStep[] = [
151
266
  { id: "a", label: "agent-step", status: "pending", blockedBy: [], type: "agent" },
152
- { id: "b", label: "subflow-step", status: "pending", blockedBy: ["a"], type: "flow-ref" },
267
+ { id: "b", label: "decision-step", status: "pending", blockedBy: ["a"], type: "code-decision" },
153
268
  ];
154
269
 
155
270
  const result = computeLayout(steps);
156
271
  expect(result.nodes.find(n => n.id === "a")!.type).toBe("agent");
157
- expect(result.nodes.find(n => n.id === "b")!.type).toBe("flow-ref");
272
+ expect(result.nodes.find(n => n.id === "b")!.type).toBe("code-decision");
273
+ });
274
+
275
+ it("renders forward decision-branch edges with labels while running", () => {
276
+ const steps: FlowGraphStep[] = [
277
+ { id: "choose", label: "choose", status: "running", blockedBy: [], type: "fork", branches: { PathA: "a", PathB: "b" } },
278
+ { id: "a", label: "a", status: "pending", blockedBy: [] },
279
+ { id: "b", label: "b", status: "pending", blockedBy: [] },
280
+ ];
281
+ const result = computeLayout(steps);
282
+ const labels = result.edges.map(e => e.label).sort();
283
+ expect(result.edges).toHaveLength(2);
284
+ expect(labels).toEqual(["PathA", "PathB"]);
285
+ });
286
+
287
+ it("marks a backward branch as a loop edge, routed by dagre (not a hand-arc)", () => {
288
+ const steps: FlowGraphStep[] = [
289
+ { id: "work", label: "work", status: "complete", blockedBy: [] },
290
+ { id: "gate", label: "gate", status: "running", blockedBy: ["work"], type: "code-decision", branches: { again: "work", go: "done" } },
291
+ { id: "done", label: "done", status: "pending", blockedBy: [] },
292
+ ];
293
+ const result = computeLayout(steps);
294
+ // Backward branch gate->work is a loop-styled edge (isLoop), routed by dagre.
295
+ const loop = result.edges.find(e => e.source === "gate" && e.target === "work");
296
+ expect(loop).toBeTruthy();
297
+ expect(loop!.isLoop).toBe(true);
298
+ expect(loop!.label).toBe("again");
299
+ expect(loop!.points.length).toBeGreaterThanOrEqual(2);
300
+ // forward branch gate->done carries its label and is not a loop.
301
+ const fwd = result.edges.find(e => e.source === "gate" && e.target === "done");
302
+ expect(fwd?.label).toBe("go");
303
+ expect(fwd?.isLoop).toBeFalsy();
158
304
  });
159
305
  });
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Group 6 (wire-flow-inputs-in-automation) — FlowInputWiring: reads a flow's
3
+ * declared inputs, binds each to a literal or the trigger value, writes only
4
+ * payload.inputs, and drops orphan keys when the selected flow changes.
5
+ */
6
+ import React, { useState } from "react";
7
+ import { describe, it, expect, afterEach, beforeEach, vi } from "vitest";
8
+ import { render, cleanup, fireEvent, waitFor } from "@testing-library/react";
9
+ import { FlowInputWiring } from "../client/FlowInputWiring.js";
10
+
11
+ const INPUTS: Record<string, Array<{ name: string; type: string; required: boolean }>> = {
12
+ "ns:a": [
13
+ { name: "invoice", type: "string", required: true },
14
+ { name: "priority", type: "number", required: false },
15
+ ],
16
+ "ns:b": [{ name: "region", type: "string", required: false }],
17
+ };
18
+
19
+ beforeEach(() => {
20
+ global.fetch = vi.fn((url: string) => {
21
+ const flow = new URL(url, "http://x").searchParams.get("flow") ?? "";
22
+ return Promise.resolve({
23
+ ok: true,
24
+ json: () => Promise.resolve({ inputs: INPUTS[flow] ?? [] }),
25
+ }) as unknown as Promise<Response>;
26
+ }) as unknown as typeof fetch;
27
+ });
28
+ afterEach(() => {
29
+ cleanup();
30
+ vi.restoreAllMocks();
31
+ });
32
+
33
+ /** Controlled harness so onChange feeds back into payload (real re-render loop). */
34
+ function Harness({ startFlow }: { startFlow: string }) {
35
+ const [payload, setPayload] = useState<Record<string, unknown>>({ flow: startFlow });
36
+ return (
37
+ <div>
38
+ <button data-testid="switch-b" onClick={() => setPayload((p) => ({ ...p, flow: "ns:b" }))}>
39
+ switch
40
+ </button>
41
+ <FlowInputWiring payload={payload} onChange={setPayload} cwd="/repo" />
42
+ <pre data-testid="payload">{JSON.stringify(payload)}</pre>
43
+ </div>
44
+ );
45
+ }
46
+
47
+ function payloadOf(getByTestId: (id: string) => HTMLElement): Record<string, unknown> {
48
+ return JSON.parse(getByTestId("payload").textContent || "{}");
49
+ }
50
+
51
+ describe("FlowInputWiring", () => {
52
+ it("renders one row per declared flow input", async () => {
53
+ const { getByTestId } = render(<Harness startFlow="ns:a" />);
54
+ await waitFor(() => expect(getByTestId("flow-input-invoice")).toBeTruthy());
55
+ expect(getByTestId("flow-input-priority")).toBeTruthy();
56
+ });
57
+
58
+ it("binding a row to the trigger writes ${{trigger}} into payload.inputs", async () => {
59
+ const { getByTestId } = render(<Harness startFlow="ns:a" />);
60
+ await waitFor(() => expect(getByTestId("flow-input-invoice-mode-trigger")).toBeTruthy());
61
+ fireEvent.click(getByTestId("flow-input-invoice-mode-trigger"));
62
+ await waitFor(() => {
63
+ const inputs = payloadOf(getByTestId).inputs as Record<string, unknown>;
64
+ expect(inputs.invoice).toBe("${{trigger}}");
65
+ });
66
+ });
67
+
68
+ it("a typed number literal persists as a number", async () => {
69
+ const { getByTestId } = render(<Harness startFlow="ns:a" />);
70
+ await waitFor(() => expect(getByTestId("flow-input-priority")).toBeTruthy());
71
+ fireEvent.change(getByTestId("flow-input-priority"), { target: { value: "5" } });
72
+ await waitFor(() => {
73
+ const inputs = payloadOf(getByTestId).inputs as Record<string, unknown>;
74
+ expect(inputs.priority).toBe(5);
75
+ });
76
+ });
77
+
78
+ it("dropping to a new flow prunes orphan wired keys", async () => {
79
+ const { getByTestId } = render(<Harness startFlow="ns:a" />);
80
+ await waitFor(() => expect(getByTestId("flow-input-invoice-mode-trigger")).toBeTruthy());
81
+ fireEvent.click(getByTestId("flow-input-invoice-mode-trigger"));
82
+ await waitFor(() => expect((payloadOf(getByTestId).inputs as any).invoice).toBe("${{trigger}}"));
83
+ // Switch to a flow that does not declare `invoice`.
84
+ fireEvent.click(getByTestId("switch-b"));
85
+ await waitFor(() => {
86
+ const inputs = (payloadOf(getByTestId).inputs as Record<string, unknown>) ?? {};
87
+ expect(inputs.invoice).toBeUndefined();
88
+ });
89
+ });
90
+
91
+ it("renders nothing for a flow with no declared inputs", async () => {
92
+ const { queryByTestId } = render(<Harness startFlow="ns:none" />);
93
+ await waitFor(() => expect(global.fetch).toHaveBeenCalled());
94
+ await Promise.resolve();
95
+ expect(queryByTestId("flow-input-wiring")).toBeNull();
96
+ });
97
+ });