@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
@@ -1,622 +0,0 @@
1
- import React, { useState } from "react";
2
- import { Icon } from "@mdi/react";
3
- import {
4
- mdiChevronRight,
5
- mdiChevronDown,
6
- mdiLoading,
7
- mdiArrowLeft,
8
- mdiFileDocumentOutline,
9
- mdiEyeOutline,
10
- mdiEyeOffOutline,
11
- } from "@mdi/js";
12
- import type {
13
- ArchitectState,
14
- ArchitectPrompt,
15
- ArchitectAgentEntry,
16
- FlowDetailEntry,
17
- } from "@blackbelt-technology/pi-dashboard-shared/types.js";
18
- import { MarkdownContent } from "../../../client/src/components/MarkdownContent.js";
19
- import { FlowGraph, architectStepsToGraphSteps } from "./FlowGraph.js";
20
- import { AgentCardShell } from "../../../client/src/components/AgentCardShell.js";
21
-
22
- // ── Detail view (reuses same patterns as FlowAgentDetail) ─────────
23
-
24
- function extractInputPreview(toolName: string, input: unknown): string {
25
- if (!input || typeof input !== "object") return "";
26
- const inp = input as Record<string, unknown>;
27
- switch (toolName.toLowerCase()) {
28
- case "read":
29
- case "write":
30
- case "edit":
31
- return String(inp.file_path || inp.path || "");
32
- case "bash":
33
- return String(inp.command || "").slice(0, 80);
34
- case "grep":
35
- return String(inp.pattern || "").slice(0, 40);
36
- default:
37
- return JSON.stringify(input).slice(0, 60);
38
- }
39
- }
40
-
41
- function ToolCallEntry({
42
- entry,
43
- }: {
44
- entry: FlowDetailEntry & { kind: "tool" };
45
- }) {
46
- const preview = extractInputPreview(entry.toolName, entry.input);
47
- const hasOutput = entry.output !== undefined;
48
- const [expanded, setExpanded] = React.useState(false);
49
-
50
- return (
51
- <div
52
- className={`border-l-2 pl-3 py-1.5 ${entry.isError ? "border-red-500/50" : "border-purple-500/30"}`}
53
- >
54
- <div
55
- className="flex items-center gap-1.5 cursor-pointer"
56
- onClick={() => hasOutput && setExpanded(!expanded)}
57
- >
58
- <span
59
- className={`text-xs font-mono ${entry.isError ? "text-red-400" : "text-purple-400"}`}
60
- >
61
- {entry.toolName}
62
- </span>
63
- <span className="text-xs text-[var(--text-tertiary)] truncate">
64
- {preview}
65
- </span>
66
- {hasOutput && (
67
- <span className="text-[10px] text-[var(--text-muted)] ml-auto flex-shrink-0">
68
- {expanded ? "▾" : "▸"}
69
- </span>
70
- )}
71
- </div>
72
- {expanded && hasOutput && (
73
- <pre className="text-[11px] text-[var(--text-secondary)] mt-1 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap break-words bg-[var(--bg-tertiary)] rounded p-2">
74
- {typeof entry.output === "string"
75
- ? entry.output
76
- : JSON.stringify(entry.output, null, 2)}
77
- </pre>
78
- )}
79
- </div>
80
- );
81
- }
82
-
83
- function TextEntry({ text }: { text: string }) {
84
- return (
85
- <div className="py-1.5 pl-3">
86
- <MarkdownContent content={text} />
87
- </div>
88
- );
89
- }
90
-
91
- function ThinkingEntry({ text }: { text: string }) {
92
- const [expanded, setExpanded] = React.useState(false);
93
- return (
94
- <div className="py-1 pl-3">
95
- <div
96
- className="flex items-center gap-1 cursor-pointer text-[11px] text-purple-400/70"
97
- onClick={() => setExpanded(!expanded)}
98
- >
99
- <span>{expanded ? "▾" : "▸"}</span>
100
- <span>Thinking</span>
101
- </div>
102
- {expanded && (
103
- <pre className="text-[11px] text-[var(--text-muted)] mt-1 whitespace-pre-wrap break-words max-h-64 overflow-y-auto">
104
- {text}
105
- </pre>
106
- )}
107
- </div>
108
- );
109
- }
110
-
111
- export function FlowArchitectDetail({
112
- state,
113
- onBack,
114
- }: {
115
- state: ArchitectState;
116
- onBack: () => void;
117
- }) {
118
- const isActive = state.phase === "context" || state.phase === "designing";
119
- const detailRef = React.useRef<HTMLDivElement>(null);
120
-
121
- // Auto-scroll to bottom as new entries arrive
122
- React.useEffect(() => {
123
- if (detailRef.current) {
124
- detailRef.current.scrollTop = detailRef.current.scrollHeight;
125
- }
126
- }, [state.detailHistory.length]);
127
-
128
- return (
129
- <div className="flex flex-col h-full overflow-hidden">
130
- {/* Header */}
131
- <div className="px-3 py-2 border-b border-[var(--border-subtle)] bg-[var(--bg-secondary)] flex items-center gap-2">
132
- <button
133
- onClick={onBack}
134
- className="text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors"
135
- >
136
- <Icon path={mdiArrowLeft} size={0.7} />
137
- </button>
138
- {isActive ? (
139
- <Icon
140
- path={mdiLoading}
141
- size={0.55}
142
- className="text-purple-400 animate-spin"
143
- />
144
- ) : (
145
- <span className="text-purple-400">◇</span>
146
- )}
147
- <span className="text-sm font-medium text-[var(--text-primary)]">
148
- Flow Architect
149
- </span>
150
- {state.flowName && (
151
- <span className="text-[11px] text-[var(--text-tertiary)]">
152
- {state.flowName}
153
- </span>
154
- )}
155
- <span className="text-[11px] text-[var(--text-muted)] ml-auto">
156
- {state.architectMode === "edit" ? "Edit" : "New"}
157
- {state.iteration > 1 && ` · Iteration ${state.iteration}`}
158
- </span>
159
- </div>
160
-
161
- {/* Detail history */}
162
- <div
163
- ref={detailRef}
164
- className="flex-1 overflow-y-auto px-3 py-2 space-y-0.5"
165
- >
166
- {state.detailHistory.length === 0 ? (
167
- <div className="text-sm text-[var(--text-muted)] py-4 text-center">
168
- {isActive ? "Working..." : "No activity yet"}
169
- </div>
170
- ) : (
171
- state.detailHistory.map((entry, i) => {
172
- switch (entry.kind) {
173
- case "tool":
174
- return <ToolCallEntry key={i} entry={entry} />;
175
- case "text":
176
- return <TextEntry key={i} text={entry.text} />;
177
- case "thinking":
178
- return <ThinkingEntry key={i} text={entry.text} />;
179
- case "error":
180
- return (
181
- <div key={i} className="py-1.5 pl-3 text-sm text-red-400">
182
- {entry.text}
183
- </div>
184
- );
185
- default:
186
- return null;
187
- }
188
- })
189
- )}
190
- </div>
191
- </div>
192
- );
193
- }
194
-
195
- // ── Inline prompt renderers ───────────────────────────────────────
196
-
197
- function ArchitectSelectPrompt({
198
- prompt,
199
- onRespond,
200
- }: {
201
- prompt: ArchitectPrompt;
202
- onRespond: (answer: string) => void;
203
- }) {
204
- return (
205
- <div className="mt-2 pt-2 border-t border-[var(--border-subtle)]">
206
- <div className="text-[11px] text-[var(--text-secondary)] mb-1.5">
207
- {prompt.question}
208
- </div>
209
- <div className="flex flex-wrap gap-1.5">
210
- {prompt.options?.map((opt) => (
211
- <button
212
- key={opt}
213
- onClick={() => onRespond(opt)}
214
- className={`text-[11px] px-2.5 py-1 rounded border transition-colors ${
215
- opt === "Cancel" || opt === "Don't save"
216
- ? "border-red-500/30 text-red-400 hover:bg-red-500/10"
217
- : opt === "Save"
218
- ? "border-green-500/30 text-green-400 hover:bg-green-500/10"
219
- : "border-purple-500/30 text-purple-400 hover:bg-purple-500/10"
220
- }`}
221
- >
222
- {opt}
223
- </button>
224
- ))}
225
- </div>
226
- </div>
227
- );
228
- }
229
-
230
- /** @internal — exported for testing */
231
- export function ArchitectInputPrompt({
232
- prompt,
233
- onRespond,
234
- }: {
235
- prompt: ArchitectPrompt;
236
- onRespond: (answer: string) => void;
237
- }) {
238
- const [value, setValue] = React.useState(prompt.defaultValue || "");
239
- const handleSubmit = () => {
240
- onRespond(value.trim());
241
- };
242
- return (
243
- <div className="mt-2 pt-2 border-t border-[var(--border-subtle)]">
244
- <div className="text-[11px] text-[var(--text-secondary)] mb-1.5">
245
- {prompt.question}
246
- </div>
247
- <div className="flex gap-1.5">
248
- <input
249
- type="text"
250
- value={value}
251
- onChange={(e) => setValue(e.target.value)}
252
- onKeyDown={(e) => e.key === "Enter" && handleSubmit()}
253
- className="flex-1 text-[11px] px-2 py-1 rounded border border-[var(--border-subtle)] bg-[var(--bg-primary)] text-[var(--text-primary)] outline-none focus:border-purple-500/50"
254
- placeholder="Enter a value..."
255
- autoFocus
256
- />
257
- <button
258
- onClick={handleSubmit}
259
- className="text-[11px] px-2.5 py-1 rounded border border-purple-500/30 text-purple-400 hover:bg-purple-500/10"
260
- >
261
- Submit
262
- </button>
263
- </div>
264
- </div>
265
- );
266
- }
267
-
268
- function ArchitectConfirmPrompt({
269
- prompt,
270
- onRespond,
271
- }: {
272
- prompt: ArchitectPrompt;
273
- onRespond: (answer: string) => void;
274
- }) {
275
- return (
276
- <div className="mt-2 pt-2 border-t border-[var(--border-subtle)]">
277
- <div className="text-[11px] text-[var(--text-secondary)] mb-1.5">
278
- {prompt.question}
279
- </div>
280
- <div className="flex gap-1.5">
281
- <button
282
- onClick={() => onRespond("true")}
283
- className="text-[11px] px-2.5 py-1 rounded border border-green-500/30 text-green-400 hover:bg-green-500/10"
284
- >
285
- Yes
286
- </button>
287
- <button
288
- onClick={() => onRespond("false")}
289
- className="text-[11px] px-2.5 py-1 rounded border border-red-500/30 text-red-400 hover:bg-red-500/10"
290
- >
291
- No
292
- </button>
293
- </div>
294
- </div>
295
- );
296
- }
297
-
298
- function ArchitectPromptInline({
299
- prompt,
300
- onRespond,
301
- }: {
302
- prompt: ArchitectPrompt;
303
- onRespond: (answer: string) => void;
304
- }) {
305
- switch (prompt.type) {
306
- case "select":
307
- return <ArchitectSelectPrompt prompt={prompt} onRespond={onRespond} />;
308
- case "input":
309
- return <ArchitectInputPrompt prompt={prompt} onRespond={onRespond} />;
310
- case "confirm":
311
- return <ArchitectConfirmPrompt prompt={prompt} onRespond={onRespond} />;
312
- default:
313
- return null;
314
- }
315
- }
316
-
317
- // ── Agent card for architect (similar to FlowAgentCard) ──────────
318
-
319
- const AGENT_STATUS_MAP: Record<
320
- string,
321
- "pending" | "running" | "complete" | "error"
322
- > = {
323
- pending: "pending",
324
- creating: "running",
325
- done: "complete",
326
- error: "error",
327
- };
328
-
329
- function ArchitectAgentCard({
330
- agent,
331
- onViewSource,
332
- }: {
333
- agent: ArchitectAgentEntry;
334
- onViewSource?: () => void;
335
- }) {
336
- return (
337
- <AgentCardShell
338
- name={agent.name}
339
- status={AGENT_STATUS_MAP[agent.status] || "pending"}
340
- >
341
- <div className="flex items-center justify-between">
342
- <span className="text-[10px] text-[var(--text-muted)] truncate">
343
- {agent.type === "custom" ? "custom agent" : agent.type}
344
- </span>
345
- {onViewSource && (
346
- <button
347
- onClick={(e) => {
348
- e.stopPropagation();
349
- onViewSource();
350
- }}
351
- className="text-[var(--text-tertiary)] hover:text-purple-400 transition-colors p-0.5 rounded hover:bg-[var(--bg-surface)]"
352
- title={`View ${agent.name} source`}
353
- >
354
- <Icon path={mdiFileDocumentOutline} size={0.5} />
355
- </button>
356
- )}
357
- </div>
358
- </AgentCardShell>
359
- );
360
- }
361
-
362
- /** Small icon button for viewing files (YAML, agent source, etc.) */
363
- function ViewFileButton({
364
- title,
365
- onClick,
366
- }: {
367
- title: string;
368
- onClick: () => void;
369
- }) {
370
- return (
371
- <button
372
- onClick={onClick}
373
- className="text-[var(--text-tertiary)] hover:text-purple-400 transition-colors p-0.5 rounded hover:bg-[var(--bg-surface)] inline-flex items-center"
374
- title={title}
375
- >
376
- <Icon path={mdiFileDocumentOutline} size={0.5} />
377
- </button>
378
- );
379
- }
380
-
381
- // ── Card (shown in the sticky header bar) ─────────────────────────
382
-
383
- export function FlowArchitect({
384
- state,
385
- onAbort,
386
- onClick,
387
- isDetailOpen,
388
- onPromptRespond,
389
- onViewYaml,
390
- onViewAgentSource,
391
- }: {
392
- state: ArchitectState;
393
- onAbort: () => void;
394
- onClick?: () => void;
395
- isDetailOpen?: boolean;
396
- onPromptRespond?: (promptId: string, answer: string) => void;
397
- onViewYaml?: () => void;
398
- onViewAgentSource?: (agentName: string, source: string) => void;
399
- }) {
400
- const [collapsed, setCollapsed] = useState(false);
401
- const isActive = state.phase === "context" || state.phase === "designing";
402
- const isPreview = state.phase === "preview";
403
- const customAgents = state.agents.filter((a) => a.type === "custom");
404
- const firstFlow = state.parsedFlows[0];
405
-
406
- return (
407
- <div className="bg-[var(--bg-secondary)] border-b border-[var(--border-subtle)] px-3 py-2">
408
- {/* Header */}
409
- <div className="flex items-center gap-2 mb-1.5">
410
- <span
411
- className="inline-flex text-[var(--text-tertiary)] cursor-pointer"
412
- onClick={() => setCollapsed(!collapsed)}
413
- >
414
- <Icon
415
- path={collapsed ? mdiChevronRight : mdiChevronDown}
416
- size={0.6}
417
- />
418
- </span>
419
- {isActive ? (
420
- <Icon path={mdiLoading} size={0.55} className="text-purple-400 animate-spin shrink-0" />
421
- ) : (
422
- <span className="text-purple-400 text-sm font-medium">π</span>
423
- )}
424
- <span className="text-sm text-[var(--text-primary)] truncate flex-1">
425
- Flow Architect
426
- <span className="text-[var(--text-tertiary)] ml-1.5">
427
- {state.phase === "context"
428
- ? "Analyzing conversation..."
429
- : state.phase === "designing"
430
- ? state.flowName
431
- ? `Designing: ${state.flowName}`
432
- : "Designing..."
433
- : state.phase === "preview"
434
- ? state.flowName
435
- ? `Preview: ${state.flowName}`
436
- : "Preview"
437
- : ""}
438
- </span>
439
- </span>
440
-
441
- {/* Model + alias */}
442
- {state.resolvedModel && (
443
- <span className="text-[10px] text-[var(--text-muted)] shrink-0">
444
- {state.resolvedModel.split("/").pop()}
445
- {state.modelAlias?.startsWith("@") && (
446
- <span className="text-[var(--text-tertiary)] ml-0.5">
447
- {state.modelAlias}
448
- </span>
449
- )}
450
- </span>
451
- )}
452
-
453
- {/* Iteration badge */}
454
- {state.iteration > 1 && (
455
- <span className="text-[10px] px-1.5 py-0.5 rounded border border-purple-500/30 text-purple-400">
456
- Iteration {state.iteration}
457
- </span>
458
- )}
459
-
460
- {/* Mode badge */}
461
- <span
462
- className={`text-[10px] px-1.5 py-0.5 rounded border ${
463
- state.architectMode === "edit"
464
- ? "border-yellow-500/30 text-yellow-400"
465
- : "border-purple-500/30 text-purple-400"
466
- }`}
467
- >
468
- {state.architectMode === "edit" ? "Edit" : "New"}
469
- </span>
470
-
471
- {/* Abort button */}
472
- {(isActive || isPreview || state.pendingPrompt) && (
473
- <button
474
- onClick={(e) => {
475
- e.stopPropagation();
476
- onAbort();
477
- }}
478
- className="text-[10px] px-1.5 py-0.5 rounded border border-red-500/30 text-red-400 hover:bg-red-500/10"
479
- title="Abort architect"
480
- >
481
- Abort
482
- </button>
483
- )}
484
- </div>
485
-
486
- {/* Content — always shown, flat layout */}
487
- <div className={`group-collapse ${collapsed ? "collapsed" : "expanded"}`}>
488
- <div>
489
- {/* Loading indicator when active but no content yet */}
490
- {isActive &&
491
- state.dagSteps.length === 0 &&
492
- customAgents.length === 0 &&
493
- state.recentTools.length === 0 && (
494
- <div className="flex items-center gap-2 py-3 text-[var(--text-muted)]">
495
- <Icon
496
- path={mdiLoading}
497
- size={0.55}
498
- className="text-purple-400 animate-spin"
499
- />
500
- <span className="text-[11px]">
501
- {state.phase === "context"
502
- ? "Generating session summary..."
503
- : "Initializing architect agent..."}
504
- </span>
505
- </div>
506
- )}
507
-
508
- {/* Flow graph + view YAML icon (only when file exists) */}
509
- {state.dagSteps.length > 0 && (
510
- <div>
511
- <FlowGraph steps={architectStepsToGraphSteps(state.dagSteps)} />
512
- <div className="flex items-center gap-2 mt-1">
513
- {firstFlow && (
514
- <span className="text-[10px] text-[var(--text-muted)]">
515
- {firstFlow.steps.length} steps · max{" "}
516
- {firstFlow.maxConcurrent}
517
- </span>
518
- )}
519
- {state.flowWriteStatus && (
520
- <span
521
- className={`text-[11px] ${state.flowWriteStatus === "validation-error" ? "text-red-400" : "text-green-400"}`}
522
- title={
523
- state.flowWriteStatus === "validation-error"
524
- ? "Flow has validation errors"
525
- : "Flow is valid"
526
- }
527
- >
528
- Flow:{" "}
529
- {state.flowWriteStatus === "validation-error" ? "✗" : "✓"}
530
- </span>
531
- )}
532
- {onViewYaml && state.flowYamlContent && (
533
- <ViewFileButton title="View flow YAML" onClick={onViewYaml} />
534
- )}
535
- </div>
536
- </div>
537
- )}
538
-
539
- {/* Agent cards grid with view-source icon per card */}
540
- {customAgents.length > 0 && (
541
- <div className="mt-2">
542
- <div className="text-[10px] text-[var(--text-muted)] mb-1">
543
- Created Agents · new:{" "}
544
- {customAgents.filter((a) => a.status === "done").length}
545
- </div>
546
- <div
547
- className="grid gap-2"
548
- style={{
549
- gridTemplateColumns: `repeat(auto-fill, minmax(180px, 1fr))`,
550
- }}
551
- >
552
- {customAgents.map((agent) => (
553
- <ArchitectAgentCard
554
- key={agent.name}
555
- agent={agent}
556
- onViewSource={
557
- agent.source && onViewAgentSource
558
- ? () => onViewAgentSource(agent.name, agent.source!)
559
- : undefined
560
- }
561
- />
562
- ))}
563
- </div>
564
- </div>
565
- )}
566
-
567
- {/* Process status + view detail icon */}
568
- <div className="mt-2">
569
- {state.catalogSummary && (
570
- <div className="text-[10px] text-[var(--text-muted)]">
571
- {state.catalogSummary}
572
- </div>
573
- )}
574
- <div className="space-y-0 mt-0.5">
575
- {state.recentTools.map((tool, i) => (
576
- <div
577
- key={i}
578
- className="text-[10px] text-[var(--text-tertiary)] truncate"
579
- >
580
- {i === state.recentTools.length - 1 ? "▸" : "·"}{" "}
581
- {tool.toolName} {tool.inputPreview}
582
- </div>
583
- ))}
584
- </div>
585
- <div className="flex items-center gap-2 mt-1">
586
- {onClick && (
587
- <button
588
- onClick={onClick}
589
- className={`transition-colors p-0.5 rounded inline-flex items-center ${
590
- isDetailOpen
591
- ? "text-purple-400 bg-purple-400/10"
592
- : "text-[var(--text-tertiary)] hover:text-purple-400 hover:bg-[var(--bg-surface)]"
593
- }`}
594
- title={isDetailOpen ? "Close architect detail" : "View full architect detail"}
595
- >
596
- <Icon path={isDetailOpen ? mdiEyeOffOutline : mdiEyeOutline} size={0.5} />
597
- </button>
598
- )}
599
- </div>
600
- </div>
601
- </div>
602
- </div>
603
-
604
- {/* Inline prompt (Save/Replan/Cancel etc.) */}
605
- {state.pendingPrompt && onPromptRespond && (
606
- <ArchitectPromptInline
607
- prompt={state.pendingPrompt}
608
- onRespond={(answer) =>
609
- onPromptRespond(state.pendingPrompt!.id, answer)
610
- }
611
- />
612
- )}
613
-
614
- {/* Error display */}
615
- {state.error && (
616
- <div className="text-[11px] text-red-400 mt-1.5 px-1">
617
- ⚠ {state.error}
618
- </div>
619
- )}
620
- </div>
621
- );
622
- }