Skip to content

Commit 8b009fc

Browse files
committed
style: fix prettier formatting for agent collaboration panel
1 parent dd830e0 commit 8b009fc

3 files changed

Lines changed: 29 additions & 70 deletions

File tree

apps/mcp-server/src/tui/components/AgentDiscussionPanel.spec.tsx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ describe('pure/assignAgentColors', () => {
9797
reasoning: `r${i}`,
9898
}),
9999
);
100-
const rounds: DiscussionRound[] = [
101-
{ roundNumber: 1, opinions, crossReviews: [] },
102-
];
100+
const rounds: DiscussionRound[] = [{ roundNumber: 1, opinions, crossReviews: [] }];
103101
const colors = assignAgentColors(rounds);
104102
// The (PALETTE.length + 1)th agent wraps to palette[0]
105103
expect(colors[`a${AGENT_PALETTE.length}`]).toBe(AGENT_PALETTE[0]);
@@ -181,9 +179,7 @@ describe('pure/renderCollaborationBlocks', () => {
181179
const archBubble = bubbles.find(
182180
b => b.type === 'agent-bubble' && b.agentName === 'architecture',
183181
);
184-
const secBubble = bubbles.find(
185-
b => b.type === 'agent-bubble' && b.agentName === 'security',
186-
);
182+
const secBubble = bubbles.find(b => b.type === 'agent-bubble' && b.agentName === 'security');
187183

188184
expect(archBubble?.type === 'agent-bubble' && archBubble.isConflict).toBe(false);
189185
expect(secBubble?.type === 'agent-bubble' && secBubble.isConflict).toBe(true);
@@ -251,11 +247,7 @@ describe('tui/components/AgentDiscussionPanel', () => {
251247

252248
it('should highlight conflicts with lightning marker', () => {
253249
const { lastFrame } = render(
254-
<AgentDiscussionPanel
255-
rounds={[makeConflictRound()]}
256-
width={80}
257-
height={30}
258-
/>,
250+
<AgentDiscussionPanel rounds={[makeConflictRound()]} width={80} height={30} />,
259251
);
260252
const frame = lastFrame() ?? '';
261253
expect(frame).toContain('⚡');
@@ -270,9 +262,7 @@ describe('tui/components/AgentDiscussionPanel', () => {
270262
});
271263

272264
it('should render empty state when no rounds', () => {
273-
const { lastFrame } = render(
274-
<AgentDiscussionPanel rounds={[]} width={80} height={10} />,
275-
);
265+
const { lastFrame } = render(<AgentDiscussionPanel rounds={[]} width={80} height={10} />);
276266
const frame = lastFrame() ?? '';
277267
expect(frame).toContain('No agent discussion yet');
278268
});
@@ -302,9 +292,7 @@ describe('tui/components/AgentDiscussionPanel', () => {
302292
crossReviews: [],
303293
};
304294

305-
const { lastFrame } = render(
306-
<AgentDiscussionPanel rounds={[round]} width={80} height={8} />,
307-
);
295+
const { lastFrame } = render(<AgentDiscussionPanel rounds={[round]} width={80} height={8} />);
308296
const frame = lastFrame() ?? '';
309297
const lines = frame.split('\n');
310298
// Height constraint should limit rendered content

apps/mcp-server/src/tui/components/AgentDiscussionPanel.tsx

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ function SpeechBubble({
5454
5555
</Text>
5656
)}
57-
{block.stanceHistoryText !== '' && (
58-
<Text dimColor> ({block.stanceHistoryText})</Text>
59-
)}
57+
{block.stanceHistoryText !== '' && <Text dimColor> ({block.stanceHistoryText})</Text>}
6058
</Box>
6159
<Box
6260
borderStyle="round"
@@ -96,9 +94,7 @@ function ConsensusProgressBar({
9694
return (
9795
<Box flexDirection="column">
9896
<Box>
99-
<Text bold>
100-
{statusIcon} Consensus{' '}
101-
</Text>
97+
<Text bold>{statusIcon} Consensus </Text>
10298
<Text color="green">{filled.repeat(approveLen)}</Text>
10399
<Text color="yellow">{filled.repeat(concernLen)}</Text>
104100
{block.rejectCount > 0 ? (
@@ -109,22 +105,24 @@ function ConsensusProgressBar({
109105
<Text bold> {block.percentage}%</Text>
110106
</Box>
111107
<Box>
112-
<Text color="green">{'\u2705'} {block.approveCount}</Text>
113-
<Text> </Text>
114-
<Text color="yellow">{'\u26A0\uFE0F'} {block.concernCount}</Text>
115-
<Text> </Text>
116-
<Text color="red">{'\u274C'} {block.rejectCount}</Text>
108+
<Text color="green">
109+
{'\u2705'} {block.approveCount}
110+
</Text>
111+
<Text> </Text>
112+
<Text color="yellow">
113+
{'\u26A0\uFE0F'} {block.concernCount}
114+
</Text>
115+
<Text> </Text>
116+
<Text color="red">
117+
{'\u274C'} {block.rejectCount}
118+
</Text>
117119
</Box>
118120
</Box>
119121
);
120122
}
121123

122124
/** Cross-review line with colored agent names. */
123-
function CrossReviewItem({
124-
block,
125-
}: {
126-
block: CrossReviewBlock;
127-
}): React.ReactElement {
125+
function CrossReviewItem({ block }: { block: CrossReviewBlock }): React.ReactElement {
128126
return (
129127
<Box>
130128
<Text color={block.fromColor}>
@@ -134,10 +132,7 @@ function CrossReviewItem({
134132
<Text color={block.toColor}>
135133
{block.toAvatar} {block.toName}
136134
</Text>
137-
<Text>
138-
{' '}
139-
{block.verb}:{' '}
140-
</Text>
135+
<Text> {block.verb}: </Text>
141136
<Text dimColor>"{block.comment}"</Text>
142137
</Box>
143138
);
@@ -156,10 +151,7 @@ export function AgentDiscussionPanel({
156151
width,
157152
height,
158153
}: AgentDiscussionPanelProps): React.ReactElement {
159-
const blocks = useMemo(
160-
() => renderCollaborationBlocks(rounds, width),
161-
[rounds, width],
162-
);
154+
const blocks = useMemo(() => renderCollaborationBlocks(rounds, width), [rounds, width]);
163155

164156
// Truncate blocks to fit available height (minus 2 for outer border)
165157
const maxHeight = Math.max(0, height - 2);
@@ -191,19 +183,11 @@ export function AgentDiscussionPanel({
191183
</Text>
192184
);
193185
case 'agent-bubble':
194-
return (
195-
<SpeechBubble key={i} block={block} maxWidth={innerWidth} />
196-
);
186+
return <SpeechBubble key={i} block={block} maxWidth={innerWidth} />;
197187
case 'cross-review-block':
198188
return <CrossReviewItem key={i} block={block} />;
199189
case 'consensus-bar':
200-
return (
201-
<ConsensusProgressBar
202-
key={i}
203-
block={block}
204-
maxWidth={innerWidth}
205-
/>
206-
);
190+
return <ConsensusProgressBar key={i} block={block} maxWidth={innerWidth} />;
207191
case 'empty':
208192
return (
209193
<Text key={i} color="gray" dimColor>

apps/mcp-server/src/tui/components/agent-discussion-panel.pure.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ export function renderStanceHistory(stances: Stance[]): string {
113113
}
114114

115115
/** Assign a distinct palette color to each agent by first-appearance order. */
116-
export function assignAgentColors(
117-
rounds: readonly DiscussionRound[],
118-
): Record<string, string> {
116+
export function assignAgentColors(rounds: readonly DiscussionRound[]): Record<string, string> {
119117
const colors: Record<string, string> = {};
120118
let idx = 0;
121119
for (const round of rounds) {
@@ -134,9 +132,7 @@ export function assignAgentColors(
134132
* Conflict = both 'approve' and 'reject' stances coexist.
135133
* Returns the set of agent IDs holding the 'reject' stance.
136134
*/
137-
export function detectConflicts(
138-
opinions: readonly AgentOpinion[],
139-
): Set<string> {
135+
export function detectConflicts(opinions: readonly AgentOpinion[]): Set<string> {
140136
const hasApprove = opinions.some(o => o.stance === 'approve');
141137
const hasReject = opinions.some(o => o.stance === 'reject');
142138
if (!hasApprove || !hasReject) return new Set();
@@ -167,9 +163,7 @@ export function estimateBlockHeight(block: DiscussionBlock): number {
167163
// ---------------------------------------------------------------------------
168164

169165
/** Build agent name lookup from opinions. */
170-
function buildAgentNameMap(
171-
rounds: readonly DiscussionRound[],
172-
): Record<string, string> {
166+
function buildAgentNameMap(rounds: readonly DiscussionRound[]): Record<string, string> {
173167
const map: Record<string, string> = {};
174168
for (const round of rounds) {
175169
for (const opinion of round.opinions) {
@@ -180,9 +174,7 @@ function buildAgentNameMap(
180174
}
181175

182176
/** Build stance history for each agent across rounds. */
183-
function buildStanceHistories(
184-
rounds: readonly DiscussionRound[],
185-
): Record<string, Stance[]> {
177+
function buildStanceHistories(rounds: readonly DiscussionRound[]): Record<string, Stance[]> {
186178
const histories: Record<string, Stance[]> = {};
187179
for (const round of rounds) {
188180
for (const opinion of round.opinions) {
@@ -281,10 +273,7 @@ export function renderCollaborationBlocks(
281273
// ---------------------------------------------------------------------------
282274

283275
/** Render a single opinion line with stance history. */
284-
export function renderOpinionLine(
285-
opinion: AgentOpinion,
286-
stanceHistory?: Stance[],
287-
): DiscussionLine {
276+
export function renderOpinionLine(opinion: AgentOpinion, stanceHistory?: Stance[]): DiscussionLine {
288277
const avatar = getAgentAvatar(opinion.agentName);
289278
const icon = STANCE_ICONS[opinion.stance];
290279

@@ -321,9 +310,7 @@ export function renderCrossReviewLine(
321310
}
322311

323312
/** Render the consensus summary line. */
324-
export function renderConsensusLine(
325-
consensus: ConsensusResult,
326-
): DiscussionLine {
313+
export function renderConsensusLine(consensus: ConsensusResult): DiscussionLine {
327314
const icon = consensus.reached ? '✅' : '❌';
328315
return {
329316
text: `${icon} Consensus: ${consensus.approveCount}/${consensus.totalAgents} | Critical: ${consensus.criticalCount}`,

0 commit comments

Comments
 (0)