@steerable/agent-shell-web 0.14.2 → 0.14.4

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.
@@ -14,10 +14,16 @@ import {
14
14
  import type { ChatMessage } from '@steerable/agent-protocol';
15
15
  import type { LocalChat, LocalChatAgent } from '@/lib/local-api';
16
16
  import { t } from '@/i18n';
17
+ import { CurrentMessageIdContext } from '@/lib/chat-mode-store';
17
18
  import { Markdown } from './Markdown';
18
19
  import { ExecutedActionsCard, type ExecutedAction } from './ExecutedActionsCard';
19
20
  import type { ChildInfo } from './OrchestrationChildrenCard';
20
- import { collectTurnParticipants, extractMentionedAgentIds } from './executed-actions-model';
21
+ import {
22
+ collectTurnParticipants,
23
+ extractMentionedAgentIds,
24
+ filterRedundantPresentFiles,
25
+ shouldShowTurnAgentBadges,
26
+ } from './executed-actions-model';
21
27
  import type { InspectTaskInput } from './executed-actions-model';
22
28
  import { StreamingStatus } from './StreamingStatus';
23
29
  import { classifyErrorMessage } from '@steerable/agent-protocol';
@@ -514,12 +520,26 @@ export function AssistantMessage({
514
520
  ...(executedActions ?? []),
515
521
  ...blocks.flatMap((block) => (block.type === 'tools' ? block.actions : [])),
516
522
  ];
523
+ const mentionedAgentIds = extractMentionedAgentIds(previousUser, agents);
517
524
  const participants = collectTurnParticipants(displayAgent, {
518
525
  agents,
519
526
  children: orchestrationChildren,
520
527
  actions: toolActions,
521
- mentionedAgentIds: extractMentionedAgentIds(previousUser, agents),
528
+ mentionedAgentIds,
529
+ });
530
+ const showTurnAgentBadges = shouldShowTurnAgentBadges({
531
+ participants,
532
+ currentAgent,
533
+ mentionedAgentIds,
522
534
  });
535
+ const deliveredFilePaths =
536
+ !isStreaming && turnFiles && turnFiles.length > 0
537
+ ? new Set(turnFiles.map((file) => file.path))
538
+ : null;
539
+ const legacyVisibleActions =
540
+ executedActions && executedActions.length > 0
541
+ ? filterRedundantPresentFiles(executedActions, deliveredFilePaths)
542
+ : [];
523
543
  const now = useLiveNow(Boolean(isStreaming && llmSpeed?.live));
524
544
  const tokenSpeed = formatTokenSpeed(
525
545
  llmSpeed?.tokens ?? 0,
@@ -531,6 +551,7 @@ export function AssistantMessage({
531
551
  continued ? <ContinuedHereLine>{card}</ContinuedHereLine> : card;
532
552
 
533
553
  return (
554
+ <CurrentMessageIdContext.Provider value={message.id}>
534
555
  <motion.div
535
556
  className="group/message"
536
557
  data-message-role="assistant"
@@ -540,9 +561,13 @@ export function AssistantMessage({
540
561
  transition={{ duration: 0.25 }}
541
562
  >
542
563
  <div className="mx-auto w-full max-w-[var(--chat-input-box-width)] px-1">
543
- {(participants.length > 0 || isPlanMode) && (
544
- <div className="mb-1 flex min-h-4 items-center justify-between gap-2">
545
- {participants.length > 0 ? (
564
+ {(showTurnAgentBadges || isPlanMode) && (
565
+ <div
566
+ className={`mb-1 flex min-h-4 items-center gap-2 ${
567
+ showTurnAgentBadges ? 'justify-between' : 'justify-start'
568
+ }`}
569
+ >
570
+ {showTurnAgentBadges && (
546
571
  <div
547
572
  data-testid="turn-agent-badges"
548
573
  className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1"
@@ -556,13 +581,11 @@ export function AssistantMessage({
556
581
  />
557
582
  ))}
558
583
  </div>
559
- ) : (
560
- <div />
561
584
  )}
562
585
  {isPlanMode && (
563
586
  <span className="inline-flex items-center gap-1 rounded-full border border-amber-200 dark:border-amber-800/50 bg-amber-100/70 dark:bg-amber-900/30 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300 select-none">
564
- <LuListChecks className="h-3.5 w-3.5" />
565
- <span>{t('Plan mode (Plan)')}</span>
587
+ <LuListChecks className="h-3 w-3" />
588
+ <span>{t('Plan mode')}</span>
566
589
  </span>
567
590
  )}
568
591
  </div>
@@ -572,6 +595,7 @@ export function AssistantMessage({
572
595
  <TurnProcessGroup
573
596
  blocks={blocks}
574
597
  isStreaming={isStreaming}
598
+ turnFailed={Boolean(failure)}
575
599
  startedAtMs={startedAtMs}
576
600
  durationMs={durationMs}
577
601
  agents={agents}
@@ -582,6 +606,7 @@ export function AssistantMessage({
582
606
  turnUsage={turnUsage}
583
607
  onContinueChild={onContinueChild}
584
608
  onStopChild={onStopChild}
609
+ deliveredFilePaths={deliveredFilePaths}
585
610
  emptyFallback={
586
611
  failure ? (
587
612
  wrapContinued(
@@ -648,9 +673,9 @@ export function AssistantMessage({
648
673
  </>
649
674
  ) : (
650
675
  <>
651
- {executedActions && executedActions.length > 0 && (
676
+ {legacyVisibleActions.length > 0 && (
652
677
  <ExecutedActionsCard
653
- actions={executedActions}
678
+ actions={legacyVisibleActions}
654
679
  agents={agents}
655
680
  chatId={chatId}
656
681
  onInspectTask={onInspectTask}
@@ -789,6 +814,7 @@ export function AssistantMessage({
789
814
  )}
790
815
  </div>
791
816
  </motion.div>
817
+ </CurrentMessageIdContext.Provider>
792
818
  );
793
819
  }
794
820
 
@@ -210,6 +210,13 @@ type MentionQuery = {
210
210
  // 里的工具卡片走同一份数据。
211
211
 
212
212
  type SlashSuggestion =
213
+ | {
214
+ kind: 'command';
215
+ insertToken: string;
216
+ label: string;
217
+ description: string;
218
+ targetMode: ChatMode;
219
+ }
213
220
  | { kind: 'skill'; insertToken: string; skill: SkillItem }
214
221
  | { kind: 'mcp'; insertToken: string; mcp: McpToolItem };
215
222
 
@@ -1165,6 +1172,37 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
1165
1172
  useEffect(() => {
1166
1173
  if (slashQuery) {
1167
1174
  const query = slashQuery.query;
1175
+ const modeCommandDefs: Array<{
1176
+ insertToken: string;
1177
+ label: string;
1178
+ description: string;
1179
+ targetMode: ChatMode;
1180
+ }> =
1181
+ onModeChange && getWebChatModes().includes('plan')
1182
+ ? [
1183
+ {
1184
+ insertToken: 'plan',
1185
+ label: t('Plan mode'),
1186
+ description: t('Switch to Plan mode or send a planning request'),
1187
+ targetMode: 'plan',
1188
+ },
1189
+ {
1190
+ insertToken: 'agent',
1191
+ label: t('Agent mode'),
1192
+ description: t('Switch back to Agent mode'),
1193
+ targetMode: 'agent',
1194
+ },
1195
+ ]
1196
+ : [];
1197
+ const commandMatches: SlashSuggestion[] = modeCommandDefs
1198
+ .filter(
1199
+ (cmd) =>
1200
+ cmd.insertToken.includes(query) ||
1201
+ cmd.label.toLowerCase().includes(query) ||
1202
+ cmd.description.toLowerCase().includes(query),
1203
+ )
1204
+ .map((cmd) => ({ kind: 'command' as const, ...cmd }));
1205
+
1168
1206
  const builtinCommandSkills: SkillItem[] = [
1169
1207
  {
1170
1208
  name: 'compact',
@@ -1196,23 +1234,28 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
1196
1234
  (t.description && t.description.toLowerCase().includes(query))
1197
1235
  )
1198
1236
  .map((t) => ({ kind: 'mcp' as const, insertToken: t.token, mcp: t }));
1199
- const combined = [...skillMatches, ...mcpMatches];
1237
+ const combined = [...commandMatches, ...skillMatches, ...mcpMatches];
1200
1238
  setSuggestions(combined);
1201
1239
  setShowSuggestions(combined.length > 0);
1202
1240
  setSelectedIndex(0);
1203
1241
  } else {
1204
1242
  setShowSuggestions(false);
1205
1243
  }
1206
- }, [slashQuery, skills, mcpTools]);
1244
+ }, [slashQuery, skills, mcpTools, onModeChange]);
1207
1245
 
1208
1246
  // 渲染行:分组标题 + 候选项(idx 对应扁平 suggestions 的下标,供高亮/键盘导航)
1209
1247
  const suggestionRows = useMemo(() => {
1210
1248
  const rows: Array<
1211
1249
  { type: 'header'; label: string } | { type: 'item'; item: SlashSuggestion; idx: number }
1212
1250
  > = [];
1251
+ const commandGroup = suggestions.filter((s) => s.kind === 'command');
1213
1252
  const skillGroup = suggestions.filter((s) => s.kind === 'skill');
1214
1253
  const mcpGroup = suggestions.filter((s) => s.kind === 'mcp');
1215
1254
  let idx = 0;
1255
+ if (commandGroup.length > 0) {
1256
+ rows.push({ type: 'header', label: t('Chat mode') });
1257
+ for (const c of commandGroup) rows.push({ type: 'item', item: c, idx: idx++ });
1258
+ }
1216
1259
  if (skillGroup.length > 0) {
1217
1260
  rows.push({ type: 'header', label: t('Run a local skill (Skill)') });
1218
1261
  for (const s of skillGroup) rows.push({ type: 'item', item: s, idx: idx++ });
@@ -1236,14 +1279,44 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
1236
1279
  }
1237
1280
  setAgentMenuOpen(false);
1238
1281
  };
1282
+ const handleKeyDown = (event: globalThis.KeyboardEvent) => {
1283
+ if (event.key === 'Escape') {
1284
+ event.stopPropagation();
1285
+ setAgentMenuOpen(false);
1286
+ }
1287
+ };
1239
1288
  window.addEventListener('pointerdown', handlePointerDown);
1240
- return () => window.removeEventListener('pointerdown', handlePointerDown);
1289
+ window.addEventListener('keydown', handleKeyDown);
1290
+ return () => {
1291
+ window.removeEventListener('pointerdown', handlePointerDown);
1292
+ window.removeEventListener('keydown', handleKeyDown);
1293
+ };
1241
1294
  }, [agentMenuOpen]);
1242
1295
 
1243
1296
  const handleSelectSuggestion = (suggestion: SlashSuggestion) => {
1297
+ const range = slashQuery ?? { start: 0, end: value.length };
1298
+ if (suggestion.kind === 'command') {
1299
+ onModeChange?.(suggestion.targetMode);
1300
+ const before = value.slice(0, range.start);
1301
+ const after = value.slice(range.end).replace(/^\s+/, '');
1302
+ const nextValue = `${before}${after}`;
1303
+ const caret = before.length;
1304
+ pendingCaretOffsetRef.current = caret;
1305
+ onChange(nextValue);
1306
+ setSlashQuery(null);
1307
+ setShowSuggestions(false);
1308
+ setTimeout(() => {
1309
+ const editor = editorRef.current;
1310
+ if (editor) {
1311
+ editor.focus();
1312
+ setCaretOffset(editor, Math.min(caret, getEditableText(editor).length));
1313
+ }
1314
+ }, 50);
1315
+ return;
1316
+ }
1317
+
1244
1318
  const token = `/${suggestion.insertToken} `;
1245
1319
  // 只替换光标处的 "/xxx" token,保留输入框里已有的其它内容。
1246
- const range = slashQuery ?? { start: 0, end: value.length };
1247
1320
  const nextValue = `${value.slice(0, range.start)}${token}${value.slice(range.end)}`;
1248
1321
  const caret = range.start + token.length;
1249
1322
  pendingCaretOffsetRef.current = caret;
@@ -1934,6 +2007,21 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
1934
2007
  }
1935
2008
  }
1936
2009
 
2010
+ if (
2011
+ event.key === 'Tab' &&
2012
+ event.shiftKey &&
2013
+ !event.metaKey &&
2014
+ !event.ctrlKey &&
2015
+ !event.altKey &&
2016
+ mode &&
2017
+ onModeChange &&
2018
+ getWebChatModes().length > 1
2019
+ ) {
2020
+ event.preventDefault();
2021
+ onModeChange(mode === 'plan' ? 'agent' : 'plan');
2022
+ return;
2023
+ }
2024
+
1937
2025
  // 空闲时 Enter / ⌘/Ctrl+Enter 发送,Shift+Enter 换行。
1938
2026
  // IME 候选确认的 Enter 已被上面的 composition 守卫拦截,不会误发送。
1939
2027
  const isSendCombo =
@@ -2069,21 +2157,25 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
2069
2157
  <div className="chat-input-container @container relative px-2.5 pb-2.5 pt-1">
2070
2158
  {(leadingChrome || selectedAgent || trailingChrome) && (
2071
2159
  <div
2072
- className="relative mb-1.5 flex min-w-0 items-end gap-1.5"
2160
+ className="relative mb-1 flex min-w-0 items-end gap-1 pl-0.5"
2073
2161
  data-testid="composer-meta-row"
2074
2162
  >
2075
- {leadingChrome}
2076
- {selectedAgent && (
2077
- <AgentSelect
2078
- refEl={agentMenuRef}
2079
- agent={selectedAgent}
2080
- agents={sortedAgents}
2081
- open={agentMenuOpen}
2082
- disabled={disabled || isStreaming || !onSelectAgent}
2083
- onOpenChange={setAgentMenuOpen}
2084
- onSelect={handleSelectAgent}
2085
- mentionReferences={mentionReferences}
2086
- />
2163
+ {(leadingChrome || selectedAgent) && (
2164
+ <div className="flex h-6 min-w-0 items-center gap-1">
2165
+ {leadingChrome}
2166
+ {selectedAgent && (
2167
+ <AgentSelect
2168
+ refEl={agentMenuRef}
2169
+ agent={selectedAgent}
2170
+ agents={sortedAgents}
2171
+ open={agentMenuOpen}
2172
+ disabled={disabled || isStreaming || !onSelectAgent}
2173
+ onOpenChange={setAgentMenuOpen}
2174
+ onSelect={handleSelectAgent}
2175
+ mentionReferences={mentionReferences}
2176
+ />
2177
+ )}
2178
+ </div>
2087
2179
  )}
2088
2180
  {trailingChrome && (
2089
2181
  <div className="ml-auto flex items-center min-w-0">
@@ -2115,6 +2207,7 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
2115
2207
  >
2116
2208
  {item.type === 'agent' ? (
2117
2209
  <span
2210
+ aria-hidden="true"
2118
2211
  className="mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[9px] font-semibold text-white"
2119
2212
  style={{ backgroundColor: item.color || '#7c3aed' }}
2120
2213
  >
@@ -2171,13 +2264,31 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
2171
2264
  : 'text-agent-muted-foreground hover:bg-agent-foreground/5 hover:text-agent-foreground'
2172
2265
  }`}
2173
2266
  >
2174
- {row.item.kind === 'skill' ? (
2267
+ {row.item.kind === 'command' ? (
2268
+ row.item.targetMode === 'plan' ? (
2269
+ <LuListChecks className="h-3.5 w-3.5 mt-0.5 shrink-0 text-amber-600 dark:text-amber-400" />
2270
+ ) : (
2271
+ <LuInfinity className="h-3.5 w-3.5 mt-0.5 shrink-0 text-agent-muted-foreground" />
2272
+ )
2273
+ ) : row.item.kind === 'skill' ? (
2175
2274
  <LuBlocks className="h-3.5 w-3.5 mt-0.5 shrink-0 text-agent-muted-foreground" />
2176
2275
  ) : (
2177
2276
  <LuPlug className="h-3.5 w-3.5 mt-0.5 shrink-0 text-agent-muted-foreground" />
2178
2277
  )}
2179
2278
  <div className="min-w-0 flex-1">
2180
- {row.item.kind === 'skill' ? (
2279
+ {row.item.kind === 'command' ? (
2280
+ <>
2281
+ <div className="text-xs font-medium truncate">
2282
+ {row.item.label}
2283
+ <span className="ml-1.5 text-[10px] font-normal text-agent-muted-foreground/70">
2284
+ /{row.item.insertToken}
2285
+ </span>
2286
+ </div>
2287
+ <div className="text-[10px] text-agent-muted-foreground/80 line-clamp-1">
2288
+ {row.item.description}
2289
+ </div>
2290
+ </>
2291
+ ) : row.item.kind === 'skill' ? (
2181
2292
  <>
2182
2293
  <div className="text-xs font-medium truncate">
2183
2294
  {row.item.skill.displayName ? (
@@ -2325,7 +2436,7 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
2325
2436
  {mode && onModeChange && getWebChatModes().length > 1 && (
2326
2437
  <ModeToggle
2327
2438
  mode={mode}
2328
- disabled={disabled || isStreaming}
2439
+ disabled={Boolean(disabled)}
2329
2440
  onChange={onModeChange}
2330
2441
  />
2331
2442
  )}
@@ -2366,59 +2477,41 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
2366
2477
  {/* shrink-0:发送键是固定尺寸圆钮,窄容器下不允许被压扁;
2367
2478
  收缩量由左侧可截断的选择器吸收。 */}
2368
2479
  <div className="flex shrink-0 items-center gap-2">
2369
- {/* 快捷键提示:空间不足时优先隐藏(测量逻辑见上方 effect) */}
2370
- <div
2371
- ref={hintRef}
2372
- className={`${hintsSuppressed ? 'hidden' : 'block'} text-[11px] text-agent-muted-foreground/80`}
2373
- >
2374
- {isStreaming ? (
2375
- <>
2376
- {onFollowUp && (
2377
- <span className="ml-2">
2378
- <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2379
- Enter
2380
- </kbd>
2381
- <span className="ml-1">{t('Queue')}</span>
2382
- </span>
2383
- )}
2384
- {onSteer && (
2385
- <span className="ml-2">
2386
- <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2387
- {MOD_KEY_LABEL}
2388
- </kbd>
2389
- <span className="mx-0.5">+</span>
2390
- <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2391
- Enter
2392
- </kbd>
2393
- <span className="ml-1">{t('Interject')}</span>
2394
- </span>
2395
- )}
2480
+ {/* 快捷键提示:空闲态隐藏常规 Enter/Shift+Enter 教程以降噪;
2481
+ 仅在流式期间提示低频高价值的排队/插队/停止,空间不足时优先收起 */}
2482
+ {isStreaming && (
2483
+ <div
2484
+ ref={hintRef}
2485
+ className={`${hintsSuppressed ? 'hidden' : 'block'} text-[11px] text-agent-muted-foreground/80`}
2486
+ >
2487
+ {onFollowUp && (
2396
2488
  <span className="ml-2">
2397
2489
  <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2398
- Esc
2490
+ Enter
2399
2491
  </kbd>
2400
- <span className="ml-1">{t('Stop')}</span>
2492
+ <span className="ml-1">{t('Queue')}</span>
2401
2493
  </span>
2402
- </>
2403
- ) : (
2404
- <>
2405
- <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2406
- Enter
2407
- </kbd>
2408
- <span className="ml-1">{t('Send')}</span>
2494
+ )}
2495
+ {onSteer && (
2409
2496
  <span className="ml-2">
2410
2497
  <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2411
- Shift
2498
+ {MOD_KEY_LABEL}
2412
2499
  </kbd>
2413
2500
  <span className="mx-0.5">+</span>
2414
2501
  <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2415
2502
  Enter
2416
2503
  </kbd>
2417
- <span className="ml-1">{t('New line')}</span>
2504
+ <span className="ml-1">{t('Interject')}</span>
2418
2505
  </span>
2419
- </>
2420
- )}
2421
- </div>
2506
+ )}
2507
+ <span className="ml-2">
2508
+ <kbd className="rounded border border-agent-border bg-agent-muted px-1 font-sans text-[10px]">
2509
+ Esc
2510
+ </kbd>
2511
+ <span className="ml-1">{t('Stop')}</span>
2512
+ </span>
2513
+ </div>
2514
+ )}
2422
2515
  <button
2423
2516
  ref={sendButtonRef}
2424
2517
  type="button"
@@ -2490,17 +2583,17 @@ function ModeToggle({
2490
2583
  aria-checked={mode === 'agent'}
2491
2584
  disabled={disabled}
2492
2585
  onClick={() => onChange('agent')}
2493
- title={t('Agent mode: carry out the task directly')}
2586
+ title={t('Agent mode: carry out the task directly (Shift+Tab)')}
2494
2587
  data-testid="mode-agent"
2495
2588
  className={[
2496
2589
  'inline-flex h-5 items-center gap-1 rounded-full px-1.5 text-[12px] leading-[1.45] transition-colors disabled:cursor-not-allowed disabled:opacity-70',
2497
2590
  mode === 'agent'
2498
- ? 'bg-agent-foreground/10 text-agent-foreground'
2591
+ ? 'bg-agent-foreground/10 text-agent-foreground font-medium'
2499
2592
  : 'text-agent-muted-foreground hover:text-agent-foreground',
2500
2593
  ].join(' ')}
2501
2594
  >
2502
2595
  <LuInfinity className="h-3 w-3" />
2503
- <span className="@max-sm:hidden">Agent</span>
2596
+ <span className="@max-sm:hidden">{t('Agent')}</span>
2504
2597
  </button>
2505
2598
  <button
2506
2599
  type="button"
@@ -2508,17 +2601,17 @@ function ModeToggle({
2508
2601
  aria-checked={mode === 'plan'}
2509
2602
  disabled={disabled}
2510
2603
  onClick={() => onChange('plan')}
2511
- title={t('Plan mode: make a plan first, read only and no execution')}
2604
+ title={t('Plan mode: explore read-only and make a plan first (Shift+Tab)')}
2512
2605
  data-testid="mode-plan"
2513
2606
  className={[
2514
2607
  'inline-flex h-5 items-center gap-1 rounded-full px-1.5 text-[12px] leading-[1.45] transition-colors disabled:cursor-not-allowed disabled:opacity-70',
2515
2608
  mode === 'plan'
2516
- ? 'bg-amber-400/20 text-amber-600 dark:text-amber-400'
2609
+ ? 'bg-amber-400/20 text-amber-700 dark:text-amber-300 font-medium'
2517
2610
  : 'text-agent-muted-foreground hover:text-agent-foreground',
2518
2611
  ].join(' ')}
2519
2612
  >
2520
2613
  <LuListChecks className="h-3 w-3" />
2521
- <span className="@max-sm:hidden">Plan</span>
2614
+ <span className="@max-sm:hidden">{t('Plan')}</span>
2522
2615
  </button>
2523
2616
  </div>
2524
2617
  );
@@ -2573,18 +2666,25 @@ function AgentSelect({
2573
2666
  type="button"
2574
2667
  onClick={() => onOpenChange(!open)}
2575
2668
  disabled={disabled}
2576
- className="inline-flex max-w-[140px] items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] text-agent-muted-foreground/80 transition-colors hover:bg-agent-foreground/5 hover:text-agent-foreground disabled:cursor-not-allowed disabled:opacity-70 @sm:max-w-[220px]"
2669
+ className="inline-flex h-6 max-w-[140px] items-center gap-1.5 rounded-full px-2 text-[11px] leading-none text-agent-muted-foreground/85 transition-colors hover:bg-agent-foreground/5 hover:text-agent-foreground disabled:cursor-not-allowed disabled:opacity-70 @sm:max-w-[220px]"
2577
2670
  title={buttonTitle}
2578
2671
  aria-haspopup="menu"
2579
2672
  aria-expanded={open}
2580
2673
  data-testid="agent-select"
2581
2674
  >
2582
- <AgentDot agent={agent} />
2675
+ <span
2676
+ aria-hidden="true"
2677
+ data-testid="agent-color-dot"
2678
+ className="h-2 w-2 shrink-0 rounded-full"
2679
+ style={{ backgroundColor: agent.color || '#7c3aed' }}
2680
+ />
2583
2681
  <span className="truncate font-medium">
2584
2682
  {agentLabel(agent)}
2585
2683
  {mentionedAgentCount > 0 ? ` +${mentionedAgentCount}` : ''}
2586
2684
  </span>
2587
- <LuChevronDown className="h-3 w-3 shrink-0 text-agent-muted-foreground" />
2685
+ <LuChevronDown
2686
+ className={`h-3 w-3 shrink-0 text-agent-muted-foreground transition-transform ${open ? 'rotate-180' : ''}`}
2687
+ />
2588
2688
  </button>
2589
2689
 
2590
2690
  {open && (
@@ -2666,7 +2766,8 @@ function AgentSelect({
2666
2766
  function AgentDot({ agent }: { agent: LocalChatAgent }) {
2667
2767
  return (
2668
2768
  <span
2669
- className="inline-flex shrink-0 items-center justify-center rounded-full text-[9px] font-semibold text-white"
2769
+ aria-hidden="true"
2770
+ className="mt-0.5 inline-flex shrink-0 items-center justify-center rounded-full text-[9px] font-semibold text-white"
2670
2771
  style={{
2671
2772
  width: 14,
2672
2773
  height: 14,