Skip to content

Commit 534b6de

Browse files
committed
refactor(frontend): remove Event Flow section, unify mermaid graphs, fix bull avatar
- Remove Event Flow collapsible section and eventFlow data from Learn tab - Update pattern READMEs to use LR mermaid graphs matching frontend - Add name-based color override for bull agent (green background) - Truncate long reflection handoff reasons to prevent overflow
1 parent 5f88cbf commit 534b6de

File tree

8 files changed

+39
-142
lines changed

8 files changed

+39
-142
lines changed

frontend/src/components/AgentAvatar.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ const ROLE_COLORS: Record<string, { bg: string; text: string }> = {
1010
worker: { bg: "bg-teal-100", text: "text-teal-700" },
1111
};
1212

13+
/** Agent-name overrides — takes priority over role-based colors */
14+
const NAME_COLORS: Record<string, { bg: string; text: string }> = {
15+
bull: { bg: "bg-green-100", text: "text-green-700" },
16+
};
17+
1318
const DEFAULT_COLORS = { bg: "bg-gray-100", text: "text-gray-600" };
1419

15-
export function getAgentColors(role: string): { bg: string; text: string } {
20+
export function getAgentColors(role: string, name?: string): { bg: string; text: string } {
21+
if (name) {
22+
const byName = NAME_COLORS[name.toLowerCase()];
23+
if (byName) return byName;
24+
}
1625
return ROLE_COLORS[role.toLowerCase()] ?? DEFAULT_COLORS;
1726
}
1827

@@ -23,7 +32,7 @@ interface AgentAvatarProps {
2332
}
2433

2534
export function AgentAvatar({ name, role, size = "md" }: AgentAvatarProps) {
26-
const colors = getAgentColors(role);
35+
const colors = getAgentColors(role, name);
2736
const initial = name.charAt(0).toUpperCase();
2837

2938
const sizeClasses =

frontend/src/components/LearnView.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ const iconSteps = (
2525
</svg>
2626
);
2727

28-
const iconStream = (
29-
<svg className="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
30-
<path strokeLinecap="round" strokeLinejoin="round" d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5" />
31-
</svg>
32-
);
33-
3428
const iconAgents = (
3529
<svg className="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
3630
<path strokeLinecap="round" strokeLinejoin="round" d="M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z" />
@@ -144,13 +138,6 @@ function PatternContentView({ pattern, onTryPrompt }: PatternContentViewProps) {
144138
</ol>
145139
</CollapsibleSection>
146140

147-
{/* Event Flow */}
148-
<CollapsibleSection title="Event Flow" icon={iconStream}>
149-
<pre className="text-[10px] leading-relaxed bg-[var(--color-surface-tertiary)] rounded-lg p-3 overflow-x-auto font-mono text-[var(--color-text-secondary)]">
150-
<code>{pattern.eventFlow}</code>
151-
</pre>
152-
</CollapsibleSection>
153-
154141
{/* Agent Roles */}
155142
<CollapsibleSection title="Agent Roles" icon={iconAgents}>
156143
<div className="overflow-x-auto">

frontend/src/data/pattern-content.ts

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export interface PatternContent {
1919
whenToUse: string[];
2020
architectureMermaid: string;
2121
howItWorks: string[];
22-
eventFlow: string;
2322
agents: PatternAgent[];
2423
tradeoffs: {
2524
pros: string[];
@@ -55,14 +54,6 @@ const router: PatternContent = {
5554
"The matched specialist agent processes the original input with domain-specific expertise",
5655
"The specialist's streamed response becomes the final output",
5756
],
58-
eventFlow: `agent_start {agent: "router", role: "classifier"}
59-
chunk {agent: "router", content: "BILLING"}
60-
agent_end {agent: "router", ...}
61-
handoff {from: "router", to: "billing", reason: "billing intent detected"}
62-
agent_start {agent: "billing", role: "specialist"}
63-
chunk {agent: "billing", content: "I can help with your invoice..."}
64-
agent_end {agent: "billing", ...}
65-
done {totalUsage: {...}}`,
6657
agents: [
6758
{
6859
name: "router",
@@ -138,18 +129,6 @@ const pipeline: PatternContent = {
138129
"Output passes to the Editor, who refines for clarity, grammar, and coherence",
139130
"The editor's output is the final result",
140131
],
141-
eventFlow: `agent_start {agent: "researcher", role: "research expert"}
142-
chunk {agent: "researcher", content: "...research findings..."}
143-
agent_end {agent: "researcher", ...}
144-
handoff {from: "researcher", to: "writer", reason: "passing to next stage"}
145-
agent_start {agent: "writer", role: "content writer"}
146-
chunk {agent: "writer", content: "...draft article..."}
147-
agent_end {agent: "writer", ...}
148-
handoff {from: "writer", to: "editor", reason: "passing to next stage"}
149-
agent_start {agent: "editor", role: "editor"}
150-
chunk {agent: "editor", content: "...polished article..."}
151-
agent_end {agent: "editor", ...}
152-
done {totalUsage: {...}}`,
153132
agents: [
154133
{
155134
name: "researcher",
@@ -227,20 +206,6 @@ const supervisor: PatternContent = {
227206
"Retry loop: if output is inadequate, the worker retries with the supervisor's feedback appended (up to 3 attempts)",
228207
"Final output: the last worker's accepted output becomes the pattern's result",
229208
],
230-
eventFlow: `agent_start {agent: "supervisor", role: "planner"}
231-
chunk {agent: "supervisor", content: "Plan: search -> analysis -> summary"}
232-
agent_end {agent: "supervisor", ...}
233-
handoff {from: "supervisor", to: "search", reason: "Dispatching search task"}
234-
agent_start {agent: "search", role: "information gatherer"}
235-
chunk {agent: "search", content: "...findings..."}
236-
agent_end {agent: "search", ...}
237-
handoff {from: "search", to: "supervisor", reason: "Reviewing search output"}
238-
agent_start {agent: "supervisor", role: "reviewer"}
239-
chunk {agent: "supervisor", content: "Review: adequate. ..."}
240-
agent_end {agent: "supervisor", ...}
241-
handoff {from: "supervisor", to: "analysis", reason: "Dispatching analysis task"}
242-
...
243-
done {totalUsage: {...}}`,
244209
agents: [
245210
{
246211
name: "supervisor",
@@ -321,20 +286,6 @@ const debate: PatternContent = {
321286
"This repeats for 2 rounds (configurable), with each debater seeing the full transcript so far",
322287
"After all rounds, the judge receives the complete debate transcript and delivers a verdict with reasoning",
323288
],
324-
eventFlow: `agent_start {agent: "bull", role: "debater"}
325-
chunk {agent: "bull", content: "...arguments for..."}
326-
agent_end {agent: "bull", ...}
327-
handoff {from: "bull", to: "bear", reason: "round 1"}
328-
agent_start {agent: "bear", role: "debater"}
329-
chunk {agent: "bear", content: "...arguments against..."}
330-
agent_end {agent: "bear", ...}
331-
handoff {from: "bear", to: "bull", reason: "next round"}
332-
...
333-
handoff {from: "bear", to: "judge", reason: "debate complete"}
334-
agent_start {agent: "judge", role: "judge"}
335-
chunk {agent: "judge", content: "...verdict and reasoning..."}
336-
agent_end {agent: "judge", ...}
337-
done {totalUsage: {...}}`,
338289
agents: [
339290
{
340291
name: "bull",
@@ -417,14 +368,6 @@ const swarm: PatternContent = {
417368
"The target agent can also hand off to another agent if needed",
418369
"The chain continues until an agent responds without a handoff (max 5 iterations)",
419370
],
420-
eventFlow: `agent_start {agent: "triage", role: "triage"}
421-
chunk {agent: "triage", content: "...I'll connect you..."}
422-
agent_end {agent: "triage", ...}
423-
handoff {from: "triage", to: "billing", reason: "triage handed off to billing"}
424-
agent_start {agent: "billing", role: "specialist"}
425-
chunk {agent: "billing", content: "...I can help with your invoice..."}
426-
agent_end {agent: "billing", ...}
427-
done {totalUsage: {...}}`,
428371
agents: [
429372
{
430373
name: "triage",
@@ -507,22 +450,6 @@ const mapReduce: PatternContent = {
507450
"Fan-in \u2014 a single handoff event signals all mappers are done",
508451
"Reduce \u2014 the ReducerAgent synthesizes all mapper outputs into one coherent response",
509452
],
510-
eventFlow: `agent_start {agent: "splitter", role: "splitter"}
511-
chunk {agent: "splitter", content: "...subtask plan..."}
512-
agent_end {agent: "splitter", ...}
513-
handoff {from: "splitter", to: "mapper-1", reason: "fan-out"}
514-
handoff {from: "splitter", to: "mapper-2", reason: "fan-out"}
515-
agent_start {agent: "mapper-1", role: "mapper"}
516-
agent_start {agent: "mapper-2", role: "mapper"}
517-
chunk {agent: "mapper-1", content: "...analysis A..."}
518-
chunk {agent: "mapper-2", content: "...analysis B..."}
519-
agent_end {agent: "mapper-1", ...}
520-
agent_end {agent: "mapper-2", ...}
521-
handoff {from: "mappers", to: "reducer", reason: "fan-in"}
522-
agent_start {agent: "reducer", role: "reducer"}
523-
chunk {agent: "reducer", content: "...synthesis..."}
524-
agent_end {agent: "reducer", ...}
525-
done {totalUsage: {...}}`,
526453
agents: [
527454
{
528455
name: "splitter",
@@ -597,22 +524,6 @@ const reflection: PatternContent = {
597524
"The loop repeats until pass or max iterations (3) are reached",
598525
"On the final iteration, the critic is skipped \u2014 the generator's output is the final answer",
599526
],
600-
eventFlow: `agent_start {agent: "generator", role: "content generator"}
601-
chunk {agent: "generator", content: "...initial draft..."}
602-
agent_end {agent: "generator", ...}
603-
handoff {from: "generator", to: "critic", reason: "iteration 1 — reviewing"}
604-
agent_start {agent: "critic", role: "content critic"}
605-
chunk {agent: "critic", content: "...evaluation...{verdict: revise}"}
606-
agent_end {agent: "critic", ...}
607-
handoff {from: "critic", to: "generator", reason: "revision needed: ..."}
608-
agent_start {agent: "generator", role: "content generator"}
609-
chunk {agent: "generator", content: "...revised draft..."}
610-
agent_end {agent: "generator", ...}
611-
handoff {from: "generator", to: "critic", reason: "iteration 2 — reviewing"}
612-
agent_start {agent: "critic", role: "content critic"}
613-
chunk {agent: "critic", content: "...evaluation...{verdict: pass}"}
614-
agent_end {agent: "critic", ...}
615-
done {totalUsage: {...}}`,
616527
agents: [
617528
{
618529
name: "generator",

patterns/debate/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ Two debater agents argue opposing sides of a thesis over multiple rounds, then a
1111
## Architecture
1212

1313
```mermaid
14-
graph TB
15-
Input[Thesis] --> Bull[Bull Debater<br/>argues FOR]
16-
Bull -->|round 1| Bear[Bear Debater<br/>argues AGAINST]
14+
graph LR
15+
Input[Thesis] --> Bull[Bull<br/>argues FOR]
16+
Bull -->|round 1| Bear[Bear<br/>argues AGAINST]
1717
Bear -->|round 2| Bull
18-
Bull -->|round 2| Bear
19-
Bear -->|debate complete| Judge[Judge<br/>evaluates + verdict]
18+
Bear -->|debate complete| Judge[Judge<br/>verdict]
2019
Judge --> Output[Final Verdict]
2120
```
2221

patterns/reflection/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ A generator agent produces content, a critic agent evaluates it with a structure
1111
## Architecture
1212

1313
```mermaid
14-
graph TB
15-
Input[User Request] --> Gen1[Generator<br/>produces content]
16-
Gen1 -->|handoff| Critic1[Critic<br/>evaluates quality]
17-
Critic1 -->|verdict: pass| Output[Final Output]
18-
Critic1 -->|verdict: revise| Gen2[Generator<br/>revises with feedback]
19-
Gen2 -->|handoff| Critic2[Critic<br/>re-evaluates]
20-
Critic2 -->|pass or max iterations| Output
14+
graph LR
15+
Input[User Request] --> Generator[Generator]
16+
Generator -->|handoff| Critic[Critic]
17+
Critic -->|verdict: pass| Output[Final Output]
18+
Critic -->|verdict: revise| Generator
2119
```
2220

2321
## How It Works

patterns/reflection/src/reflection-loop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class ReflectionLoop {
124124
type: "handoff",
125125
from: "critic",
126126
to: "generator",
127-
reason: `iteration ${iteration} — revision needed: ${verdict.feedback}`,
127+
reason: `iteration ${iteration} — revision needed: ${verdict.feedback.length > 120 ? verdict.feedback.slice(0, 120) + "…" : verdict.feedback}`,
128128
});
129129
}
130130

patterns/supervisor/README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ A supervisor agent plans subtasks, dispatches them to specialized workers, revie
1111
## Architecture
1212

1313
```mermaid
14-
graph TB
15-
Input[User Input] --> Supervisor[Supervisor Agent<br/>planner + reviewer]
16-
Supervisor -->|plan| Plan["Subtask Plan<br/>[search, analysis, summary]"]
17-
Plan --> Search[Search Worker<br/>information gatherer]
18-
Search -->|output| Review1{Supervisor<br/>Review}
19-
Review1 -->|adequate| Analysis[Analysis Worker<br/>analyst]
20-
Review1 -->|retry| Search
21-
Analysis -->|output| Review2{Supervisor<br/>Review}
22-
Review2 -->|adequate| Summary[Summary Worker<br/>summarizer]
23-
Review2 -->|retry| Analysis
24-
Summary -->|output| Review3{Supervisor<br/>Review}
25-
Review3 -->|adequate| Output[Final Output]
26-
Review3 -->|retry| Summary
14+
graph LR
15+
Input[User Input] --> Supervisor[Supervisor<br/>planner + reviewer]
16+
Supervisor -->|plan| Search[Search]
17+
Search -->|review| Supervisor
18+
Supervisor -->|plan| Analysis[Analysis]
19+
Analysis -->|review| Supervisor
20+
Supervisor -->|plan| Summary[Summary]
21+
Summary -->|review| Supervisor
22+
Supervisor --> Output[Final Output]
2723
```
2824

2925
## How It Works

patterns/swarm/README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@ Dynamic agent-to-agent handoffs without central routing. Each agent decides inde
1111
## Architecture
1212

1313
```mermaid
14-
graph TB
15-
Input[Customer Query] --> Triage[Triage Agent]
16-
Triage -->|direct response| Output[Response]
17-
Triage -->|HANDOFF:sales| Sales[Sales Agent]
18-
Triage -->|HANDOFF:support| Support[Support Agent]
19-
Triage -->|HANDOFF:billing| Billing[Billing Agent]
20-
Sales -->|HANDOFF:support| Support
21-
Sales -->|HANDOFF:billing| Billing
22-
Support -->|HANDOFF:sales| Sales
23-
Support -->|HANDOFF:billing| Billing
24-
Billing -->|HANDOFF:sales| Sales
25-
Billing -->|HANDOFF:support| Support
14+
graph LR
15+
Input[Query] --> Triage[Triage]
16+
Triage --> Output[Response]
17+
Triage -->|handoff| Sales[Sales]
18+
Triage -->|handoff| Support[Support]
19+
Triage -->|handoff| Billing[Billing]
20+
Sales <-->|handoff| Support
21+
Sales <-->|handoff| Billing
22+
Support <-->|handoff| Billing
2623
Sales --> Output
2724
Support --> Output
2825
Billing --> Output

0 commit comments

Comments
 (0)