DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
feat(chat): fold a turn's working-out away once it reaches the answer
Bingxi Zhao (Frank)a37cb93947c6
diff --git a/web/components/activity/ActivityHeader.tsx b/web/components/activity/ActivityHeader.tsxindex 14e11748d..0a7ee839d 100644--- a/web/components/activity/ActivityHeader.tsx+++ b/web/components/activity/ActivityHeader.tsx@@ -21,6 +21,7 @@ export function ActivityHeader({orbSpeed = 1,label,duration,+ summary,settled = false,expandable = false,expanded = false,@@ -35,6 +36,12 @@ export function ActivityHeader({label: ReactNode;/** Elapsed time, already formatted. */duration?: string | null;+ /**+ * What the folded stack below holds ("2 tool calls"), shown only while it+ * is closed. A line that says nothing about what it hides gives the reader+ * no reason to open it — and once open, the rows say it better themselves.+ */+ summary?: ReactNode;/** Stop breathing the label and dim it: the work is over. */settled?: boolean;expandable?: boolean;@@ -58,6 +65,11 @@ export function ActivityHeader({· {duration}</span>) : null}+ {summary && expandable && !expanded ? (+ <span className="text-[12px] font-medium text-[var(--muted-foreground)]/55">+ · {summary}+ </span>+ ) : null}</>);diff --git a/web/components/chat/home/AskUserOptions.tsx b/web/components/chat/home/AskUserOptions.tsxindex 038520707..4b5fce918 100644--- a/web/components/chat/home/AskUserOptions.tsx+++ b/web/components/chat/home/AskUserOptions.tsx@@ -300,6 +300,16 @@ export type MessageSegment =*/| { kind: "trace"; events: StreamEvent[]; key: string };+/** Every id this event answers to, for matching a row against its call. */+function callIdsOf(event: StreamEvent): string[] {+ const meta = (event.metadata ?? {}) as Record<string, unknown>;+ return [+ (event as { tool_call_id?: string }).tool_call_id,+ typeof meta.tool_call_id === "string" ? meta.tool_call_id : undefined,+ typeof meta.call_id === "string" ? meta.call_id : undefined,+ ].filter((id): id is string => Boolean(id));+}+export function extractMessageSegments(events: StreamEvent[] | undefined,answerContent = "",@@ -337,6 +347,19 @@ export function extractMessageSegments(// A round a capability rejected was streamed and then taken back: its text// is trace material, never answer text. Ordinary commentary stays.const retractedCallIds = collectRetractedCallIds(events);+ // Calls the reader sees as a card. The card IS that call's presentation, so+ // drawing an "asked you a question" row for it as well says the same thing+ // twice — and that row lands *below* the card it produced, reading as work+ // done after the question rather than as the asking of it.+ // Both id fields are collected because the two sides name the call+ // differently: a dispatched result carries ``tool_call_id`` while the trace+ // groups rows by ``call_id``, and which one a given event has depends on the+ // provider.+ const cardCallIds = new Set<string>();+ for (const event of events) {+ if (!producesCard(event)) continue;+ for (const id of callIdsOf(event)) cardCallIds.add(id);+ }const ensureTextSegment = () => {// Text resuming closes the run of work above it, so the next tool call@@ -352,6 +375,7 @@ export function extractMessageSegments(/** Collect one trace event into the region currently open below the text. */const appendTraceEvent = (event: StreamEvent) => {+ if (callIdsOf(event).some((id) => cardCallIds.has(id))) return;// Where this event sat in the answer, when it recorded one. A live turn// records none — its text is on the wire and separates the regions by// itself. A reloaded one has no text events at all, so this mark is thediff --git a/web/features/chat/messages/ChatMessageList.tsx b/web/features/chat/messages/ChatMessageList.tsxindex f96936de8..f36e8af83 100644--- a/web/features/chat/messages/ChatMessageList.tsx+++ b/web/features/chat/messages/ChatMessageList.tsx@@ -1,7 +1,15 @@"use client";import dynamic from "next/dynamic";-import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";+import {+ memo,+ useCallback,+ useEffect,+ useMemo,+ useRef,+ useState,+ type ReactNode,+} from "react";import {BookMarked,BookOpen,@@ -62,6 +70,7 @@ import {extractAskUserPayload,extractMessageSegments,leadingTraceEvents,+ type MessageSegment,} from "@/components/chat/home/AskUserOptions";import { MasteryQuestionCard } from "@/components/chat/home/MasteryQuestionCard";import {@@ -88,7 +97,9 @@ import ContextReferenceTree, {import {AssistantActivity,NestedTraceFlow,+ TraceFlow,} from "@/features/chat/trace/TracePresentation";+import { hasSettledFinalRound } from "@/features/chat/trace/selectors";import type { MessageTraceMetadata } from "@/features/chat/trace/memory";import { agentGlyph } from "@/components/agents/agent-icons";import { useConnectedAgentKinds } from "@/hooks/useConnectedAgentKinds";@@ -153,6 +164,122 @@ const MODE_BADGE_LABELS: Record<string, string> = {// A capability with no entry is title-cased rather than printed raw: an// unlisted mode used to surface its internal id ("immersive_reading") in the// conversation, which reads as a bug to everyone who sees it.+/**+ * A run of working-out that folds itself away.+ *+ * Used for the runs that follow a card — the leading run rides in the+ * message's activity header instead, which is already a disclosure and+ * already pinned at the top, so the common turn shows one line of chrome+ * rather than two.+ */+function ProcessFold({+ segments,+ settled,+ children,+}: {+ segments: MessageSegment[];+ /** The turn has moved on: fold by default, and say what is inside. */+ settled: boolean;+ children: ReactNode;+}) {+ const { t } = useTranslation();+ const [userOpen, setUserOpen] = useState<boolean | null>(null);+ const open = userOpen ?? !settled;+ const { toolCalls, notes } = summariseProcess(segments);+ const parts = [+ toolCalls > 0 ? t("{{count}} tool calls", { count: toolCalls }) : null,+ notes > 0 ? t("{{count}} notes", { count: notes }) : null,+ ].filter(Boolean);++ return (+ <div className="mb-3">+ <button+ type="button"+ onClick={() => setUserOpen(!open)}+ aria-expanded={open}+ className="flex w-full items-center gap-1.5 text-left text-[12px] font-medium text-[var(--muted-foreground)]/55 transition-colors hover:text-[var(--foreground)]"+ >+ <ChevronRight+ className={`size-3 transition-transform ${open ? "rotate-90" : ""}`}+ />+ {parts.length ? parts.join(" · ") : t("Working notes")}+ </button>+ <div+ className={`grid transition-[grid-template-rows,opacity] duration-300 ease-out ${+ open ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"+ }`}+ >+ <div className="overflow-hidden">+ <div className="pt-1">{children}</div>+ </div>+ </div>+ </div>+ );+}++/**+ * One row of the assistant message: a run of working-out, a card, or answer+ * prose. Cards and the answer stand on their own; a process run is what the+ * turn did before either of them and folds away once the turn has settled.+ */+type MessageBlock =+ | { kind: "process"; key: string; segments: MessageSegment[] }+ | { kind: "card"; key: string; segment: MessageSegment }+ | { kind: "answer"; key: string; segment: MessageSegment };++/**+ * Split a message into its blocks.+ *+ * Everything before ``answerStart`` is working-out, broken at each card: a+ * question the reader was asked is part of the exchange, so it keeps its place+ * even when the work around it is folded.+ */+function buildMessageBlocks(+ segments: MessageSegment[],+ answerStart: number,+): MessageBlock[] {+ const blocks: MessageBlock[] = [];+ let run: MessageSegment[] = [];+ const flush = () => {+ if (!run.length) return;+ blocks.push({ kind: "process", key: `p-${run[0].key}`, segments: run });+ run = [];+ };+ segments.slice(0, answerStart).forEach((segment) => {+ if (segment.kind === "ask_user" || segment.kind === "mastery_question") {+ flush();+ blocks.push({ kind: "card", key: segment.key, segment });+ return;+ }+ run.push(segment);+ });+ flush();+ segments.slice(answerStart).forEach((segment) => {+ blocks.push({ kind: "answer", key: segment.key, segment });+ });+ return blocks;+}++/** What a folded run of working-out holds, for the line that stands in for it. */+function summariseProcess(segments: MessageSegment[]): {+ toolCalls: number;+ notes: number;+} {+ let toolCalls = 0;+ let notes = 0;+ for (const segment of segments) {+ if (segment.kind === "text") {+ if (segment.text.trim()) notes += 1;+ continue;+ }+ if (segment.kind !== "trace") continue;+ for (const event of segment.events) {+ if (event.type === "tool_call") toolCalls += 1;+ }+ }+ return { toolCalls, notes };+}+export function getModeBadgeLabel(capability?: string | null): string {if (!capability) return MODE_BADGE_LABELS.chat;const known = MODE_BADGE_LABELS[capability];@@ -416,6 +543,7 @@ export const AssistantMessage = memo(function AssistantMessage({questionId: string,) => void | boolean | Promise<void | boolean>;}) {+ const { t } = useTranslation();const events = useMemo(() => msg.events ?? [], [msg.events]);const readingMaterialId = researchRequestSnapshot?.readingMaterialId;const readingMaterialRevision =@@ -614,6 +742,99 @@ export const AssistantMessage = memo(function AssistantMessage({[useSegmentLayout, messageSegments, events],);+ // Where the working-out stops and the answer starts.+ //+ // Everything a turn writes is worth watching while it works, and almost+ // none of it is worth re-reading afterwards. So the two are separate+ // layers: the process stays open and streams live, then folds itself into+ // one line the moment the turn settles into its closing answer.+ //+ // The boundary is the trailing run of prose — the text after the last step.+ // It is only trusted once a round has actually completed as the terminal+ // one, because mid-turn every paragraph is briefly "trailing" and treating+ // it as the answer would fold the process shut on every line.+ const settledIntoAnswer =+ !isStreaming || hasSettledFinalRound(events);+ const answerStart = useMemo(() => {+ if (!settledIntoAnswer) return messageSegments.length;+ let idx = messageSegments.length;+ while (idx > 0 && messageSegments[idx - 1].kind === "text") idx -= 1;+ return idx;+ }, [messageSegments, settledIntoAnswer]);+ // Cards are not process: a question the reader was asked (and answered) is+ // part of the exchange, not working-out to be folded away. So they break+ // the process into runs, each of which folds on its own.+ const messageBlocks = useMemo(+ () => buildMessageBlocks(messageSegments, answerStart),+ [messageSegments, answerStart],+ );+ // The leading run rides in the activity header, which is already pinned at+ // the top and already is a disclosure — giving it the process keeps the+ // message to ONE line of chrome instead of a status line plus a fold.+ // Only the segment layout hands its process to the header. A message with+ // nothing but prose renders through the plain body branch below, and before+ // its first tool call every paragraph is still "process" — so without this+ // gate a turn's opening sentence rendered twice, once in each place.+ const headerProcess =+ useSegmentLayout && messageBlocks[0]?.kind === "process"+ ? messageBlocks[0]+ : null;+ const bodyBlocks = headerProcess ? messageBlocks.slice(1) : messageBlocks;++ /**+ * Prose and the steps it introduced, in the order they were written.+ *+ * Spacing is owned here rather than left to each piece. Markdown carries a+ * bottom margin and the trace rows carried only a top one, so a row sat 24px+ * below the sentence that introduced it and flush against the one that+ * followed — reading as a heading for the next paragraph instead of as the+ * step between them. Both margins are stripped and one gap governs the+ * whole column, so the rhythm is even whichever way you read it.+ */+ const renderSegments = useCallback(+ (segments: MessageSegment[]) => (+ <div className="flex flex-col gap-3 border-l border-[var(--border)] pl-3.5">+ {segments.map((seg) =>+ seg.kind === "text" ? (+ <div+ key={seg.key}+ className="[&_.md-renderer>*:last-child]:mb-0"+ >+ <AssistantResponse+ content={seg.text}+ language={language}+ isStreaming={isStreaming}+ readingMaterialId={readingMaterialId}+ readingMaterialRevision={readingMaterialRevision}+ events={events}+ />+ </div>+ ) : seg.kind === "trace" ? (+ <div key={seg.key} className="[&>div]:mb-0">+ <TraceFlow events={seg.events} isStreaming={isStreaming} />+ </div>+ ) : null,+ )}+ </div>+ ),+ [+ language,+ isStreaming,+ readingMaterialId,+ readingMaterialRevision,+ events,+ ],+ );+ const headerProcessSummary = useMemo(() => {+ if (!headerProcess) return undefined;+ const { toolCalls, notes } = summariseProcess(headerProcess.segments);+ const parts = [+ toolCalls > 0 ? t("{{count}} tool calls", { count: toolCalls }) : null,+ notes > 0 ? t("{{count}} notes", { count: notes }) : null,+ ].filter(Boolean);+ return parts.length ? parts.join(" · ") : undefined;+ }, [headerProcess, t]);+const researchInProgress =outlineStatus === "researching" ||outlineStatus === "done" ||@@ -650,6 +871,13 @@ export const AssistantMessage = memo(function AssistantMessage({? (open) => onTraceToggle?.(open): undefined}+ // The turn's working-out, folded behind this same header. One line of+ // chrome does both jobs: it says what is happening while the turn runs+ // and, once it settles, what it did on the way to the answer.+ processContent={+ headerProcess ? renderSegments(headerProcess.segments) : undefined+ }+ processSummary={headerProcessSummary}/>{outlinePreview && outlinePreview.sub_topics.length > 0 ? (<>@@ -726,39 +954,42 @@ export const AssistantMessage = memo(function AssistantMessage({/></>) : useSegmentLayout ? (- // Default chat surface: render text, tool work and cards in the exact- // order they were streamed. The sentence that introduced a step sits- // above it and whatever the next round said sits below, so the message- // reads as a running account rather than an answer with its working- // hidden in a block at the top.- messageSegments.map((seg) =>- seg.kind === "text" ? (+ // Default chat surface. The working-out (prose interleaved with the+ // steps it introduced) is one layer, folded once the turn settles; the+ // closing answer is the other and always stands plain. Cards sit+ // between them at the point they were asked.+ bodyBlocks.map((block) =>+ block.kind === "process" ? (+ <ProcessFold+ key={block.key}+ segments={block.segments}+ settled={settledIntoAnswer}+ >+ {renderSegments(block.segments)}+ </ProcessFold>+ ) : block.kind === "card" ? (+ block.segment.kind === "mastery_question" ? (+ <div key={block.key}>+ {renderMasteryCard(block.segment.question)}+ </div>+ ) : block.segment.kind === "ask_user" ? (+ <AskUserOptions+ key={block.key}+ data={block.segment.data}+ onSubmit={submitReply}+ />+ ) : null+ ) : block.segment.kind === "text" ? (<AssistantResponse- key={seg.key}- content={seg.text}+ key={block.key}+ content={block.segment.text}language={language}isStreaming={isStreaming}readingMaterialId={readingMaterialId}readingMaterialRevision={readingMaterialRevision}events={events}/>- ) : seg.kind === "trace" ? (- // One run of work, shown where it happened — between the text- // that introduced it and the text that followed.- <NestedTraceFlow- key={seg.key}- events={seg.events}- isStreaming={isStreaming}- />- ) : seg.kind === "mastery_question" ? (- <div key={seg.key}>{renderMasteryCard(seg.question)}</div>- ) : (- <AskUserOptions- key={seg.key}- data={seg.data}- onSubmit={submitReply}- />- ),+ ) : null,)) : (<AssistantResponsediff --git a/web/features/chat/trace/TracePresentation.tsx b/web/features/chat/trace/TracePresentation.tsxindex 10b3bef8c..8d7349b9b 100644--- a/web/features/chat/trace/TracePresentation.tsx+++ b/web/features/chat/trace/TracePresentation.tsx@@ -41,6 +41,7 @@ import {getTraceRole,groupTraceEvents,hasRenderableCallTrace as selectHasRenderableCallTrace,+ hasSettledFinalRound,isChatLoopAnswerContent,isRetractedRound,isTracePending,@@ -1493,6 +1494,7 @@ export function StreamingStatus({expandable = false,expanded = false,onToggle,+ summary,agentName,showMark = true,traceBounds,@@ -1511,6 +1513,8 @@ export function StreamingStatus({expandable?: boolean;expanded?: boolean;onToggle?: () => void;+ // What the folded stack holds, shown while it is closed.+ summary?: ReactNode;// Who is doing the thinking — partner chat passes the partner's name so// the status reads "Ada Exploring…" instead of the product name.agentName?: string;@@ -1593,6 +1597,7 @@ export function StreamingStatus({expandable={expandable}expanded={expanded}onToggle={onToggle}+ summary={summary}showOrb={showMark}className={className}/>@@ -1678,37 +1683,13 @@ function isChatLoopTurn(events: StreamEvent[]): boolean {return false;}-/**- * Whether the most recently *completed* round settled the turn — a tool-less- * ``finish`` round, the one shape that ends the loop.- *- * Looks at only the LATEST completed round, not "has one ever appeared" —- * a token-truncated round is explicitly non-terminal (the loop keeps- * writing), so once ITS OWN next round completes, that round's marker- * supersedes this one and correctly reopens the trace if fresh tool calls- * are still coming.- *- * ``answer_visible`` is deliberately not consulted: it says whether a round's- * text belongs to the answer, which is true of nearly every round and says- * nothing about whether the turn is over.- */-function lastRoundSettledFinal(events: StreamEvent[]): boolean {- for (let idx = events.length - 1; idx >= 0; idx -= 1) {- const meta = getTraceMeta(events[idx]);- if (meta.trace_kind === "call_status" && meta.call_state === "complete") {- return meta.call_role === "finish";- }- }- return false;-}-function isFinalAnswerPhase(events: StreamEvent[],isStreaming: boolean,hasFinalContent: boolean,): boolean {if (!isStreaming) return true;- if (lastRoundSettledFinal(events)) return true;+ if (hasSettledFinalRound(events)) return true;const mode = detectStreamingMode(events, hasFinalContent, true);if (mode === "responding" || mode === "responded") {// Chat's single loop streams commentary mid-loop, which also reads as@@ -1759,6 +1740,8 @@ export function AssistantActivity({onTraceToggle,traceBounds,hasStoredTrace = false,+ processContent,+ processSummary,}: {events: StreamEvent[];/**@@ -1795,6 +1778,20 @@ export function AssistantActivity({* breaks that circle by letting the header open on the promise of rows.*/hasStoredTrace?: boolean;+ /**+ * The turn's working-out, already laid out by the caller: what it said it+ * was about to do, the steps it took, what each one turned up. Given this,+ * the header folds THAT away rather than a bare stack of trace rows — the+ * whole process becomes one line once the answer lands, and one click+ * brings it back.+ *+ * The chat surface passes it because its process is prose interleaved with+ * rows. Surfaces with nothing but rows pass nothing and keep the old+ * behaviour.+ */+ processContent?: ReactNode;+ /** One line naming what ``processContent`` holds, for the folded header. */+ processSummary?: ReactNode;}) {const shownTraceEvents = traceEvents ?? events;const hasTrace = useMemo(@@ -1813,8 +1810,10 @@ export function AssistantActivity({// rows to hand over once asked. Auto-open still follows the phase only when// there is something to show right now: a settled turn stays collapsed until// the reader asks for it.- const expandable = hasTrace || hasStoredTrace;- const open = expandable && (userOpen ?? (hasTrace && !finalPhase));+ const hasProcess = processContent != null;+ const expandable = hasProcess || hasTrace || hasStoredTrace;+ const open =+ expandable && (userOpen ?? ((hasProcess || hasTrace) && !finalPhase));// Match StreamingStatus's own null-guard — it takes ``expandable`` into// account for exactly this case, so both surfaces appear or neither does.@@ -1833,6 +1832,7 @@ export function AssistantActivity({setUserOpen(next);onTraceToggle?.(next);}}+ summary={processSummary}agentName={agentName}showMark={showMark}className={headerClassName}@@ -1845,13 +1845,15 @@ export function AssistantActivity({}`}><div className="overflow-hidden">- {/* The trace hangs from a faint guide line aligned under the+ {/* The process hangs from a faint guide line aligned under theheader's activity mark, so it reads as "nested below" thestatus (the elbow/tree language used elsewhere). pt-2 = gapbelow the header when open; [&>div]:mb-0 stripsCallTracePanel's own bottom margin so the single gap to thebody comes from this block's outer ``mb-3`` in both states. */}- {hasTrace ? (+ {hasProcess ? (+ <div className="pt-2">{processContent}</div>+ ) : hasTrace ? (<NestedTraceFlowevents={shownTraceEvents}isStreaming={isStreaming}diff --git a/web/features/chat/trace/selectors.ts b/web/features/chat/trace/selectors.tsindex ac20942e1..d01a7cf0e 100644--- a/web/features/chat/trace/selectors.ts+++ b/web/features/chat/trace/selectors.ts@@ -163,6 +163,32 @@ export function groupHasTraceSubstance(events: StreamEvent[]): boolean {});}+/**+ * Has a round completed as the turn's terminal one?+ *+ * The chat loop's rounds all stream text, so "text is flowing" says nothing+ * about whether the turn is winding up. The round's own completion marker+ * does: ``finish`` is emitted only by a round that called no tools, which is+ * the one shape that ends the loop.+ *+ * Reads only the LATEST completed round, not "has one ever appeared" — a+ * token-truncated round is explicitly non-terminal, so once its own next round+ * completes, that marker supersedes this one.+ *+ * ``answer_visible`` is deliberately not consulted: it says whether a round's+ * text belongs to the answer, which is true of nearly every round and says+ * nothing about whether the turn is over.+ */+export function hasSettledFinalRound(events: StreamEvent[]): boolean {+ for (let idx = events.length - 1; idx >= 0; idx -= 1) {+ const meta = getTraceMeta(events[idx]);+ if (meta.trace_kind === "call_status" && meta.call_state === "complete") {+ return meta.call_role === "finish";+ }+ }+ return false;+}+export function selectTraceDisplayItems(traceGroups: TraceItem[],): TraceDisplayItem[] {diff --git a/web/locales/en/app.json b/web/locales/en/app.jsonindex ea72027d8..b0d456fef 100644--- a/web/locales/en/app.json+++ b/web/locales/en/app.json@@ -3690,7 +3690,6 @@"Notes could not be loaded.": "Notes could not be loaded.","Notes could not be copied.": "Notes could not be copied.","Note was not saved.": "Note was not saved.",- "Retry": "Retry","Note saved.": "Note saved.","Note was not deleted.": "Note was not deleted.","Video learning panels": "Video learning panels",@@ -4045,5 +4044,8 @@"The Invidious instance could not verify your account. Check the instance and reconnect.": "The Invidious instance could not verify your account. Check the instance and reconnect.","Your DeepTutor login expired during authorization. Sign in, then start a new Invidious connection.": "Your DeepTutor login expired during authorization. Sign in, then start a new Invidious connection.","The account could not be connected. Please start a new connection.": "The account could not be connected. Please start a new connection.",- "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate."+ "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.",+ "{{count}} tool calls": "{{count}} tool calls",+ "{{count}} notes": "{{count}} notes",+ "Working notes": "Working notes"}diff --git a/web/locales/zh/app.json b/web/locales/zh/app.jsonindex 702df3f39..d39f0e9f0 100644--- a/web/locales/zh/app.json+++ b/web/locales/zh/app.json@@ -3690,7 +3690,6 @@"Notes could not be loaded.": "无法加载笔记。","Notes could not be copied.": "无法复制笔记。","Note was not saved.": "笔记未保存。",- "Retry": "重试","Note saved.": "笔记已保存。","Note was not deleted.": "笔记未删除。","Video learning panels": "视频学习面板",@@ -4045,5 +4044,8 @@"The Invidious instance could not verify your account. Check the instance and reconnect.": "Invidious 实例暂时无法验证账号,请检查实例后重新关联。","Your DeepTutor login expired during authorization. Sign in, then start a new Invidious connection.": "授权期间 DeepTutor 登录已失效,请先登录 DeepTutor,再重新关联 Invidious。","The account could not be connected. Please start a new connection.": "账号关联失败,请重新发起关联。",- "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "请使用 Invidious 账号登录,确认只读授权后会自动返回此页。DeepTutor 与 Invidious 使用各自的登录账号。"+ "Sign in with your Invidious account, then approve read-only access to return here. Your DeepTutor login is separate.": "请使用 Invidious 账号登录,确认只读授权后会自动返回此页。DeepTutor 与 Invidious 使用各自的登录账号。",+ "{{count}} tool calls": "{{count}} 次工具调用",+ "{{count}} notes": "{{count}} 条说明",+ "Working notes": "过程记录"}diff --git a/web/tests/ask-user-segments.test.ts b/web/tests/ask-user-segments.test.tsindex bcef713bf..e9f9dedf4 100644--- a/web/tests/ask-user-segments.test.ts+++ b/web/tests/ask-user-segments.test.ts@@ -322,6 +322,26 @@ test("a posed mastery question is its own segment, not an ask_user card", () =>);});+test("the call a card renders draws no row of its own", () => {+ // The card is that call's presentation. A row for it as well says the same+ // thing twice, and lands below the card it produced — reading as work done+ // after the question rather than as the asking of it.+ const segments = extractMessageSegments([+ event(+ "content",+ { call_id: "r1", call_kind: "agent_loop_round" },+ "First, a question.",+ ),+ event("tool_call", { call_id: "call-1", tool_name: "ask_user" }, "ask_user"),+ askUserCard("call-1"),+ ]);++ assert.deepEqual(+ segments.map((segment) => segment.kind),+ ["text", "ask_user"],+ );+});+test("a mastery card posed on the old ask_user channel still reads as one", () => {// History holds cards posed before mastery questions got their own key.const legacy = event("tool_result", {