@steerable/agent-shell-web 0.14.3 → 0.14.5

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 (30) hide show
  1. package/package.json +4 -4
  2. package/src/components/AgentSidebar.tsx +189 -46
  3. package/src/components/ChatHeader.tsx +12 -1
  4. package/src/components/SidebarAccount.tsx +33 -41
  5. package/src/components/chat/AssistantMessage.tsx +36 -10
  6. package/src/components/chat/ChatInput.tsx +308 -131
  7. package/src/components/chat/ChatProjectBadge.tsx +311 -100
  8. package/src/components/chat/ContextUsagePill.tsx +20 -5
  9. package/src/components/chat/ExecPolicyPicker.tsx +72 -67
  10. package/src/components/chat/LocalChatPanel.tsx +33 -35
  11. package/src/components/chat/Markdown.tsx +109 -11
  12. package/src/components/chat/MessageList.tsx +109 -19
  13. package/src/components/chat/ModelPicker.tsx +2 -2
  14. package/src/components/chat/PlanTodoList.tsx +184 -78
  15. package/src/components/chat/SessionTodoList.tsx +63 -72
  16. package/src/components/chat/TurnFilesCard.tsx +270 -112
  17. package/src/components/chat/TurnProcessGroup.tsx +3 -0
  18. package/src/components/chat/TurnProcessTimeline.tsx +13 -0
  19. package/src/components/chat/UserMessage.tsx +8 -1
  20. package/src/components/chat/next-steps-tags.ts +13 -0
  21. package/src/components/chat/process-status.ts +112 -2
  22. package/src/components/chat/todo-list-model.ts +52 -4
  23. package/src/layouts/AgentLayout.tsx +173 -10
  24. package/src/layouts/PanelToggleButton.tsx +27 -9
  25. package/src/layouts/conversation-preview.ts +3 -0
  26. package/src/layouts/request-chat-slot.ts +20 -0
  27. package/src/layouts/right-panel-tabs.ts +32 -0
  28. package/src/lib/chat-mode-store.ts +241 -0
  29. package/src/lib/file-preview-registry.ts +57 -0
  30. package/src/pages/AgentPage.tsx +188 -78
@@ -14,6 +14,7 @@ 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';
@@ -36,7 +37,7 @@ import { TurnProcessGroup } from './TurnProcessGroup';
36
37
  import { TurnFilesCard } from './TurnFilesCard';
37
38
  import type { TurnFile } from './turn-files';
38
39
  import type { TurnUsage } from './turn-usage';
39
- import { stripNextStepsTags } from './next-steps-tags';
40
+ import { omitNextStepsBlocks, stripNextStepsTags } from './next-steps-tags';
40
41
  import {
41
42
  formatTokenSpeed,
42
43
  llmRequestElapsedMs,
@@ -174,6 +175,12 @@ interface AssistantMessageProps {
174
175
  /** R7:子代理面板的「继续」/「停止」。 */
175
176
  onContinueChild?: (childId: string, recordId: string) => void;
176
177
  onStopChild?: (childId: string) => void;
178
+ /**
179
+ * True when follow-up suggestion chips are rendered below this message
180
+ * (or while streaming the tail turn), omitting `[next_steps]...[/next_steps]`
181
+ * from inline Markdown so suggestions are not shown twice.
182
+ */
183
+ hideInlineNextSteps?: boolean;
177
184
  }
178
185
 
179
186
  function agentInitial(name: string): string {
@@ -491,6 +498,7 @@ export function AssistantMessage({
491
498
  onInspectTask,
492
499
  onContinueChild,
493
500
  onStopChild,
501
+ hideInlineNextSteps = false,
494
502
  }: AssistantMessageProps) {
495
503
  const content = message.content || '';
496
504
  const failure = readTurnFailure(message, content);
@@ -499,8 +507,14 @@ export function AssistantMessage({
499
507
  const continued = readContinued(message);
500
508
  // live 错误文本("[stream error] ...")不当正文渲染;落库的失败回合可能
501
509
  // 留有部分正文,此时正文与错误气泡都展示。
502
- const displayContent = failure?.contentIsError ? '' : content;
503
- const { copied, copy } = useCopy(stripNextStepsTags(content));
510
+ const rawDisplayContent = failure?.contentIsError ? '' : content;
511
+ const displayContent = hideInlineNextSteps
512
+ ? omitNextStepsBlocks(rawDisplayContent)
513
+ : rawDisplayContent;
514
+ const copySource = hideInlineNextSteps
515
+ ? omitNextStepsBlocks(content)
516
+ : stripNextStepsTags(content);
517
+ const { copied, copy } = useCopy(copySource);
504
518
  const [regenerating, setRegenerating] = useState(false);
505
519
  const [regenerateError, setRegenerateError] = useState<string | null>(null);
506
520
  const persistedAgentId =
@@ -514,7 +528,15 @@ export function AssistantMessage({
514
528
  // while it's actively streaming and hasn't flushed agentId to the DB yet.
515
529
  const displayAgent = persistedAgent ?? (isStreaming ? currentAgent : null);
516
530
  const useTimeline = timeline !== undefined;
517
- const blocks = timeline ?? [];
531
+ const rawBlocks = timeline ?? [];
532
+ const blocks: TurnBlock[] = hideInlineNextSteps
533
+ ? rawBlocks.flatMap<TurnBlock>((block) => {
534
+ if (block.type !== 'text') return [block];
535
+ const cleaned = omitNextStepsBlocks(block.content);
536
+ if (!cleaned.trim() && rawBlocks.length > 1) return [];
537
+ return [{ ...block, content: cleaned }];
538
+ })
539
+ : rawBlocks;
518
540
  const toolActions = [
519
541
  ...(executedActions ?? []),
520
542
  ...blocks.flatMap((block) => (block.type === 'tools' ? block.actions : [])),
@@ -550,6 +572,7 @@ export function AssistantMessage({
550
572
  continued ? <ContinuedHereLine>{card}</ContinuedHereLine> : card;
551
573
 
552
574
  return (
575
+ <CurrentMessageIdContext.Provider value={message.id}>
553
576
  <motion.div
554
577
  className="group/message"
555
578
  data-message-role="assistant"
@@ -560,8 +583,12 @@ export function AssistantMessage({
560
583
  >
561
584
  <div className="mx-auto w-full max-w-[var(--chat-input-box-width)] px-1">
562
585
  {(showTurnAgentBadges || isPlanMode) && (
563
- <div className="mb-1 flex min-h-4 items-center justify-between gap-2">
564
- {showTurnAgentBadges ? (
586
+ <div
587
+ className={`mb-1 flex min-h-4 items-center gap-2 ${
588
+ showTurnAgentBadges ? 'justify-between' : 'justify-start'
589
+ }`}
590
+ >
591
+ {showTurnAgentBadges && (
565
592
  <div
566
593
  data-testid="turn-agent-badges"
567
594
  className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1"
@@ -575,13 +602,11 @@ export function AssistantMessage({
575
602
  />
576
603
  ))}
577
604
  </div>
578
- ) : (
579
- <div />
580
605
  )}
581
606
  {isPlanMode && (
582
607
  <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">
583
- <LuListChecks className="h-3.5 w-3.5" />
584
- <span>{t('Plan mode (Plan)')}</span>
608
+ <LuListChecks className="h-3 w-3" />
609
+ <span>{t('Plan mode')}</span>
585
610
  </span>
586
611
  )}
587
612
  </div>
@@ -810,6 +835,7 @@ export function AssistantMessage({
810
835
  )}
811
836
  </div>
812
837
  </motion.div>
838
+ </CurrentMessageIdContext.Provider>
813
839
  );
814
840
  }
815
841