DiffPanel renders a per-row agent badge (icon+label; null -> 'manual') + a 'Changes from X, Y' note when the pending set spans >1 agent. AgentComposerBar gains an optional sessionId prop -> resumed/history/new-session chip beside the Provider picker (gated, so BooChat callers are unchanged), driven by a new useAgentSessions hook (refetch on message-complete). providerIcon extracted to shared components/coder/providerIcons.tsx; api.coder gains agentSessions(sessionId); PendingChange type gains agent. web tsc clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
// Shared provider icon + label helpers for BooCoder UI.
|
|
//
|
|
// Single source of truth for the per-provider glyph used in the
|
|
// AgentComposerBar picker and the CoderPane DiffPanel agent-attribution
|
|
// badges (v2.6 Phase 1-UX §9a/§9b). Extracted from AgentComposerBar's local
|
|
// `providerIcon` switch so both call sites stay in sync.
|
|
|
|
import type { ReactNode } from 'react';
|
|
import { Bird, Dog, Terminal as TermIcon } from 'lucide-react';
|
|
import { ClaudeIcon, OpenCodeIcon } from '@/components/icons/ProviderIcons';
|
|
|
|
/**
|
|
* Glyph for a provider/agent name. Mirrors AgentComposerBar's original
|
|
* `providerIcon` switch verbatim — `boocode` (native) falls through to the
|
|
* neutral dog like any unmapped name, preserving the composer's prior look.
|
|
* Sized to match the picker (13px) by default; pass a different size for
|
|
* inline badges.
|
|
*/
|
|
export function providerIcon(name: string | null, size = 13): ReactNode {
|
|
switch (name) {
|
|
case 'claude':
|
|
return <ClaudeIcon size={size} className="shrink-0" />;
|
|
case 'opencode':
|
|
return <OpenCodeIcon size={size} className="shrink-0" />;
|
|
case 'goose':
|
|
return <Bird size={size} className="shrink-0" />;
|
|
case 'qwen':
|
|
return <TermIcon size={size} className="shrink-0" />;
|
|
default:
|
|
return <Dog size={size} className="shrink-0" />;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Human label for a provider/agent name. `null` → "manual" (a RightRail-staged
|
|
* change with no dispatching agent, per §9a). Unknown names pass through
|
|
* verbatim so a future provider still reads sensibly.
|
|
*/
|
|
export function providerLabel(name: string | null): string {
|
|
switch (name) {
|
|
case null:
|
|
return 'manual';
|
|
case 'boocode':
|
|
return 'BooCode';
|
|
case 'opencode':
|
|
return 'opencode';
|
|
case 'claude':
|
|
return 'Claude';
|
|
case 'goose':
|
|
return 'goose';
|
|
case 'qwen':
|
|
return 'Qwen';
|
|
default:
|
|
return name;
|
|
}
|
|
}
|