Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
refactor(webui): update tools rendering in the web ui (#2072)
DavdGao1f433fd7ff2b
diff --git a/examples/web_ui/frontend/package.json b/examples/web_ui/frontend/package.jsonindex a865f74c1..5b586d704 100644--- a/examples/web_ui/frontend/package.json+++ b/examples/web_ui/frontend/package.json@@ -36,7 +36,7 @@"react-resizable-panels": "^4.11.2","react-router-dom": "^7.15.1","remark-gfm": "^4.0.1",- "shadcn": "^4.7.0",+ "shadcn": "^4.13.0","shadcn-prose": "^1.2.1","sonner": "^2.0.7","tailwind-merge": "^3.6.0",diff --git a/examples/web_ui/frontend/src/components/chat/MessageBubble.tsx b/examples/web_ui/frontend/src/components/chat/MessageBubble.tsxindex 13e07c89f..eb319406b 100644--- a/examples/web_ui/frontend/src/components/chat/MessageBubble.tsx+++ b/examples/web_ui/frontend/src/components/chat/MessageBubble.tsx@@ -4,6 +4,7 @@ import type {Msg,TextBlock,ToolCallBlock,+ ToolResultBlock,} from '@agentscope-ai/agentscope/message';import {ArrowDown,@@ -11,7 +12,7 @@ import {Bot,CalendarClock,CheckCircle,- ChevronDownIcon,+ ChevronRight,CirclePlay,Copy,Loader2,@@ -24,7 +25,8 @@ import remarkGfm from 'remark-gfm';import { ConfirmCard } from './ConfirmCard';import { FileAttachment } from './FileAttachment';-import { renderToolGroup } from './tool-renderers';+import { renderToolCall } from './tool-renderers';+import { countDiffStats, DiffStats, getResultDiff } from './tool-renderers/_shared';import type { TFunction, ToolCallWithResult } from './tool-renderers/types';import { Badge } from '@/components/ui/badge';import { Button } from '@/components/ui/button';@@ -36,73 +38,60 @@ import {import { Item, ItemContent } from '@/components/ui/item.tsx';import { useAudioBlock, useReplayController } from '@/context/AudioContext';import { useTranslation } from '@/i18n/useI18n';+import { cn } from '@/lib/utils';import { formatNumber, formatTime } from '@/utils/common';+/**+ * A run of *consecutive* tool calls (of any name) collapsed into a single+ * container, each call paired to its result. The one aggregated summary/fold+ * renders here; every call inside is dispatched to its dedicated per-tool+ * renderer via `renderToolCall`.+ */interface ToolCallGroupBlock {type: 'tool_call_group';- id: string;- toolName: string;calls: ToolCallWithResult[];}type ExtendedContentBlock = ContentBlock | ToolCallGroupBlock;/**- * Group tool_call blocks of the same name into a single- * `tool_call_group`, with each call paired to its matching- * tool_result by id.+ * Pair every tool_call with its tool_result (by id) and collect *consecutive*+ * tool calls into a single `tool_call_group`, regardless of tool name — so a+ * run like `[Read, Read, Edit, some_mcp_tool]` becomes one collapsible+ * container. Non-tool blocks (text, thinking, data, ...) break the run and+ * pass through unchanged at their original position.*- * Unlike the previous implementation this does NOT require calls of- * the same name to be consecutive. When the agent issues multiple- * concurrent tool calls (e.g. Glob + Grep), the content layout is- * `[call_Glob, call_Grep, result_Glob, result_Grep]` — the old- * "consecutive-same-name" approach would split call and result into- * separate groups. This version collects all calls first (preserving- * encounter order), then matches results, and finally emits groups- * in the order the first call of each tool name appeared,- * interleaved with non-tool blocks at their original positions.+ * Results may arrive after their calls — concurrent tool use lays content out+ * as `[call_A, call_B, result_A, result_B]` — so calls are paired by id in a+ * first pass before the run is assembled.*/function groupToolCalls(content: ContentBlock[]): ExtendedContentBlock[] {- // Pass 1: pair calls ↔ results by id, track non-tool blocks.+ // Pass 1: pair calls ↔ results by id; remember non-tool blocks in order.const callMap = new Map<string, ToolCallWithResult>();- const resultMap = new Map<string, ContentBlock>();+ const orphanResults: ToolResultBlock[] = [];const ordering: Array<{ type: 'tool'; id: string } | { type: 'other'; block: ContentBlock }> =[];for (const block of content) {if (block.type === 'tool_call') {- const entry: ToolCallWithResult = { call: block };- callMap.set(block.id, entry);+ callMap.set(block.id, { call: block });ordering.push({ type: 'tool', id: block.id });} else if (block.type === 'tool_result') {const matching = callMap.get(block.id);- if (matching) {- matching.result = block;- } else {- resultMap.set(block.id, block);- }+ if (matching) matching.result = block;+ else orphanResults.push(block);} else {ordering.push({ type: 'other', block });}}- // Pass 2: walk the ordering, group consecutive same-name calls- // (now that results are already attached).+ // Pass 2: walk the ordering, accumulating consecutive calls into one group.const result: ExtendedContentBlock[] = [];- let currentGroup: ToolCallWithResult[] = [];- let currentToolName: string | null = null;-+ let current: ToolCallWithResult[] = [];const flush = () => {- if (currentGroup.length > 0 && currentToolName) {- result.push({- type: 'tool_call_group',- id: crypto.randomUUID(),- toolName: currentToolName,- calls: currentGroup,- });- currentGroup = [];- currentToolName = null;- }+ if (current.length === 0) return;+ result.push({ type: 'tool_call_group', calls: current });+ current = [];};for (const item of ordering) {@@ -111,37 +100,28 @@ function groupToolCalls(content: ContentBlock[]): ExtendedContentBlock[] {result.push(item.block);} else {const entry = callMap.get(item.id);- if (!entry) continue;- if (currentToolName !== null && currentToolName !== entry.call.name) {- flush();- }- currentToolName = entry.call.name;- currentGroup.push(entry);+ if (entry) current.push(entry);}}flush();- // Orphan results (no matching call) — render as synthetic groups.- for (const [id, block] of resultMap) {- if (block.type === 'tool_result') {- result.push({- type: 'tool_call_group',- id: crypto.randomUUID(),- toolName: block.name,- calls: [- {- call: {- type: 'tool_call',- id,- name: block.name,- input: '',- state: 'finished' as const,- },- result: block,+ // Orphan results (no matching call) — surface each as its own group.+ for (const block of orphanResults) {+ result.push({+ type: 'tool_call_group',+ calls: [+ {+ call: {+ type: 'tool_call',+ id: block.id,+ name: block.name,+ input: '',+ state: 'finished' as const,},- ],- });- }+ result: block,+ },+ ],+ });}return result;@@ -298,11 +278,94 @@ function AudioInlineControl({ block }: { block: DataBlock }) {);}+type OnUserConfirm = (+ toolCallBlock: ToolCallBlock,+ confirm: boolean,+ rules?: ToolCallBlock['suggested_rules'],+) => void;++const MCP_TOOL_PREFIX = 'mcp__';++// Task-management tools are all surfaced under one "updated todos" summary.+const TODO_TOOLS = new Set(['TaskGet', 'TaskUpdate', 'TaskList', 'TaskCreate']);++function renderConfirmCard(askingCall: ToolCallBlock, onUserConfirm?: OnUserConfirm) {+ return (+ <ConfirmCard+ toolCall={askingCall}+ onUserConfirm={(confirm, rules) => {+ if (onUserConfirm) onUserConfirm(askingCall, confirm, rules);+ }}+ />+ );+}+/**- * Render a single content block. Tool call groups are dispatched to- * `renderToolGroup`; the per-group truncation at the first `asking` call- * (and the trailing ConfirmCard) lives here so renderers only see a clean- * list of calls.+ * Bucket a group's calls into per-category counts and total inserted/deleted+ * lines (from Edit/Write result diffs), then build the localized collapsible+ * title. Categories are appended in a fixed order — Bash, Read, Edit/Write,+ * Search (Grep/Glob), Todo, MCP — each omitted when its count is zero. If+ * nothing matches a known category, a generic "called N tools" fallback is used.+ */+function summarizeToolGroup(calls: ToolCallWithResult[], t: TFunction) {+ let nBash = 0;+ let nRead = 0;+ let nEdit = 0;+ let nSearch = 0;+ let nTodo = 0;+ let nMCP = 0;+ let insertions = 0;+ let deletions = 0;++ for (const { call, result } of calls) {+ const name = call.name;+ if (name === 'Bash') {+ nBash += 1;+ } else if (name === 'Read') {+ nRead += 1;+ } else if (name === 'Edit' || name === 'Write') {+ nEdit += 1;+ // Sum the real +/- line changes from the backend-provided diff.+ const diff = result ? getResultDiff(result) : undefined;+ if (diff) {+ const stats = countDiffStats(diff);+ insertions += stats.insertions;+ deletions += stats.deletions;+ }+ } else if (name === 'Grep' || name === 'Glob') {+ nSearch += 1;+ } else if (TODO_TOOLS.has(name)) {+ nTodo += 1;+ } else if (name.startsWith(MCP_TOOL_PREFIX)) {+ nMCP += 1;+ }+ }++ const parts: string[] = [];+ if (nBash > 0) parts.push(t('tool.summary.bash', { count: nBash }));+ if (nRead > 0) parts.push(t('tool.summary.read', { count: nRead }));+ if (nEdit > 0) parts.push(t('tool.summary.edit', { count: nEdit }));+ if (nSearch > 0) parts.push(t('tool.summary.search', { count: nSearch }));+ if (nTodo > 0) parts.push(t('tool.summary.todo', { count: nTodo }));+ if (nMCP > 0) parts.push(t('tool.summary.mcp', { count: nMCP }));++ const joined =+ parts.length > 0+ ? parts.join(t('tool.summary.separator'))+ : t('tool.summary.fallback', { count: calls.length });+ // Sentence-case only the very first letter (each i18n part is lower-cased+ // so commas don't introduce mid-sentence capitals in English; a no-op for+ // scripts without letter case such as Chinese).+ const title = joined.length > 0 ? joined[0].toUpperCase() + joined.slice(1) : joined;++ return { title, insertions, deletions };+}++/**+ * Render a single content block. A `tool_call_group` renders one summary fold+ * whose expanded body dispatches each call to `renderToolCall`. Truncation at+ * the first `asking` call (and the trailing ConfirmCard, kept outside the fold)+ * lives here so renderers only ever see a clean list of calls.*/function renderBlock(block: ExtendedContentBlock,@@ -316,20 +379,42 @@ function renderBlock() {switch (block.type) {case 'tool_call_group': {- const firstAsk = block.calls.findIndex((item) => item.call.state === 'asking');- const visible = firstAsk === -1 ? block.calls : block.calls.slice(0, firstAsk + 1);- const askingCall = firstAsk === -1 ? null : block.calls[firstAsk].call;+ const { title, insertions, deletions } = summarizeToolGroup(block.calls, t);+ // Truncate at (and including) the first `asking` call — nothing runs+ // after it. Its ConfirmCard renders OUTSIDE the Collapsible so+ // collapsing never hides an action the user still needs to take.+ const askIdx = block.calls.findIndex((c) => c.call.state === 'asking');+ const visible = askIdx === -1 ? block.calls : block.calls.slice(0, askIdx + 1);+ const askingCall = askIdx === -1 ? null : block.calls[askIdx].call;++ const allFinished = block.calls.some((c) => !c.result || c.result.state === 'running');return (<div key={index} className="flex flex-col gap-y-4 text-muted-foreground">- {renderToolGroup(block.toolName, visible, t)}- {askingCall && (- <ConfirmCard- toolCall={askingCall}- onUserConfirm={(confirm, rules) => {- if (onUserConfirm) onUserConfirm(askingCall, confirm, rules);- }}- />- )}+ <Collapsible defaultOpen={false}>+ <CollapsibleTrigger asChild>+ <Button+ variant="ghost"+ className="group flex w-full items-center justify-between gap-2 px-0 hover:bg-transparent data-[state=open]:bg-transparent active:!translate-y-0 cursor-pointer"+ >+ <span+ className={cn(+ 'flex min-w-0 items-center gap-2',+ allFinished && 'shimmer',+ )}+ >+ <span className="truncate text-sm">{title}</span>+ <ChevronRight className="size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90" />+ </span>+ {(insertions > 0 || deletions > 0) && (+ <DiffStats insertions={insertions} deletions={deletions} />+ )}+ </Button>+ </CollapsibleTrigger>+ <CollapsibleContent className="flex flex-col gap-y-1 bg-muted p-2 rounded text-sm">+ {visible.map((pair) => renderToolCall(pair, t))}+ </CollapsibleContent>+ </Collapsible>+ {askingCall && renderConfirmCard(askingCall, onUserConfirm)}</div>);}@@ -471,7 +556,7 @@ function renderBlock({hintSublabel}</span>)}- <ChevronDownIcon className="ml-auto group-data-[state=open]:rotate-180" />+ <ChevronRight className="ml-auto group-data-[state=open]:rotate-90" /></Button></CollapsibleTrigger><CollapsibleContent className="p-2.5 pt-0 max-w-full overflow-hidden break-all text-muted-foreground">diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/BashRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/BashRenderer.tsxindex 82b5f3765..b3bc9fee7 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/BashRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/BashRenderer.tsx@@ -1,37 +1,14 @@-import {- defaultGetDisplayName,- defaultRenderCallArgs,- defaultRenderGroup,- defaultRenderResult,-} from './DefaultRenderer';+import { getResultText, parseInput, toolLabelClass } from './_shared';import type { ToolRenderer } from './types';-function parseInput(input: string): Record<string, unknown> {- try {- return JSON.parse(input);- } catch {- return {};- }+function getCommand(input: string): string {+ const { command } = parseInput(input) as { command?: string };+ return command || input;}export const BashRenderer: ToolRenderer = {getDisplayName: () => 'Bash',- renderCallArgs: (call) => {- const { command } = parseInput(call.input) as { command?: string };- return command || call.input;- },-- renderResult: (call, result, t) => {- if (call.state === 'asking' || !result || result.state === 'running') {- return t('common.running');- }- if (result.state === 'interrupted') {- return t('common.interrupted');- }- return undefined;- },-renderConfirmBody: (call) => {const { command, description } = parseInput(call.input) as {command?: string;@@ -45,14 +22,32 @@ export const BashRenderer: ToolRenderer = {);},- renderGroup: (calls, t) =>- defaultRenderGroup(calls, t, {- getDisplayName: (call) =>- BashRenderer.getDisplayName?.(call, t) ?? defaultGetDisplayName(call),- renderCallArgs: (call) =>- BashRenderer.renderCallArgs?.(call, t) ?? defaultRenderCallArgs(call),- renderResult: (call, result) =>- BashRenderer.renderResult?.(call, result, t) ??- defaultRenderResult(call, result, t),- }),+ renderHeader: (pair) => (+ <>+ <span className={toolLabelClass}>Bash</span>+ {/* The command is code, so it keeps a mono font rather than the shared+ argument style; it still brightens on hover like every other row. */}+ <span className="font-mono min-w-0 truncate transition-colors group-hover:text-foreground">+ {getCommand(pair.call.input)}+ </span>+ </>+ ),++ renderBody: (pair) => {+ if (!pair.result) return null;++ const shellRes = getResultText(pair.result);+ return (+ <div className="flex flex-col border bg-background rounded-sm p-2 text-xs">+ <div className="text-muted-foreground">Input</div>+ <pre className="overflow-x-auto p-2 border rounded bg-secondary ">+ {JSON.stringify(parseInput(pair.call.input), null, 2)}+ </pre>+ <div className="text-muted-foreground mt-2">Output</div>+ <pre className="overflow-auto p-2 border rounded bg-secondary max-h-[200px]">+ {shellRes}+ </pre>+ </div>+ );+ },};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/DefaultRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/DefaultRenderer.tsxindex 6b01dba24..07a0d53b4 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/DefaultRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/DefaultRenderer.tsx@@ -1,80 +1,14 @@-import type { ToolCallBlock, ToolResultBlock } from '@agentscope-ai/agentscope/message';-import { ChevronRight } from 'lucide-react';+import type { ToolCallBlock } from '@agentscope-ai/agentscope/message';import * as mime from 'mime-types';import type { ReactNode } from 'react';-import { CornerLine, ToolStateIcon } from './_shared';+import { toolArgClass, toolLabelClass } from './_shared';import type { TFunction, ToolCallWithResult } from './types';-import { Button } from '@/components/ui/button.tsx';-import {- Collapsible,- CollapsibleContent,- CollapsibleTrigger,-} from '@/components/ui/collapsible.tsx';--function processToolInput(input: string): string {- try {- const obj = JSON.parse(input);- const entries = Object.entries(obj).map(([k, v]) => `${k}: "${v}"`);- return entries.join('\n');- } catch {- return input;- }-}export function defaultGetDisplayName(call: ToolCallBlock): string {return call.name;}-export function defaultRenderCallArgs(call: ToolCallBlock): ReactNode {- if (call.input.length <= 2) return null;- return processToolInput(call.input);-}--export function defaultRenderResult(- call: ToolCallBlock,- result: ToolResultBlock,- t: TFunction,- maxLines = 7,-): ReactNode {- if (call.state === 'asking' || !result || result.state === 'running') {- return <span>{t('common.running')} ...</span>;- }- if (result.state === 'interrupted') {- return <span>{t('common.interrupted')}</span>;- }-- let resultStr: string;- if (typeof result.output === 'string') {- resultStr = result.output;- } else {- const parts = result.output.map((b) => {- if (b.type === 'text') return b.text;- const mainType = b.source.media_type.split('/')[0].toUpperCase();- const ext = (mime.extension(b.source.media_type) || 'bin').toLowerCase();- return `[${mainType}.${ext}]`;- });- resultStr = parts.join('\n');- }-- let lines = resultStr.split('\n');- if (lines.length > maxLines) {- const total = lines.length;- lines = lines.slice(0, maxLines);- lines.push(t('tool.moreLines', { count: total - maxLines }));- }-- return (- <div className="flex flex-col flex-1 min-w-0">- {lines.map((line, i) => (- <div key={i} className="truncate">- {line}- </div>- ))}- </div>- );-}-export function defaultRenderConfirmBody(call: ToolCallBlock): ReactNode {return (<div className="w-full max-w-full overflow-hidden text-ellipsis truncate">@@ -84,53 +18,52 @@ export function defaultRenderConfirmBody(call: ToolCallBlock): ReactNode {}/**- * Default group layout: each call is an independent block with a state icon,- * `displayName(args)` header line, and (optionally) a corner-line-prefixed- * result block beneath it. Used by tools without a custom `renderGroup`,- * e.g. arbitrary MCP tools.- *- * `getDisplayName` / `renderCallArgs` / `renderResult` are passed in from- * `index.ts` so this function stays decoupled from the renderer registry.+ * Default trigger line for tools without a custom `renderHeader` (e.g. MCP+ * tools): the generic "Call tool" label followed by the tool name rendered in+ * the shared argument style, so a nameless tool still reads as an action.*/-export function defaultRenderGroup(- calls: ToolCallWithResult[],- _t: TFunction,- resolvers: {- getDisplayName: (call: ToolCallBlock) => string;- renderCallArgs: (call: ToolCallBlock) => ReactNode;- renderResult: (call: ToolCallBlock, result: ToolResultBlock) => ReactNode;- },-): ReactNode {+export function defaultRenderHeader(pair: ToolCallWithResult, t: TFunction): ReactNode {return (<>- {calls.map(({ call, result }) => {- const displayName = resolvers.getDisplayName(call);- const args = resolvers.renderCallArgs(call);- const resultContent = result ? resolvers.renderResult(call, result) : null;- return (- <Collapsible key={call.id} className="flex flex-col w-full max-w-full text-sm">- <CollapsibleTrigger asChild>- <Button- variant={'ghost'}- className="group hover:bg-transparent data-[state=open]:bg-transparent justify-start px-0 gap-2 active:!translate-y-0"- >- <ToolStateIcon states={[result?.state]} />- <strong className="shrink-0 text-primary">{displayName}</strong>- {args && <span className="truncate min-w-0 text-left">{args}</span>}- {resultContent && (- <ChevronRight className="size-3 shrink-0 group-data-[state=open]:rotate-90" />- )}- </Button>- </CollapsibleTrigger>- {resultContent && (- <CollapsibleContent className="flex flex-row gap-x-2 pl-6 max-w-full">- <CornerLine />- {resultContent}- </CollapsibleContent>- )}- </Collapsible>- );- })}+ <span className={toolLabelClass}>{t('tool.callGeneric')}</span>+ <span className={toolArgClass}>{defaultGetDisplayName(pair.call)}</span></>);}++/**+ * Default expandable body: the result output as text. The container caps its+ * height and scrolls, so no line counting / truncation is needed. Returns+ * `null` before the call has any result so the row stays non-expandable.+ */+export function defaultRenderBody(pair: ToolCallWithResult, t: TFunction): ReactNode {+ const { call, result } = pair;+ if (!result) return null;+ if (call.state === 'asking' || result.state === 'running') {+ return <span>{t('common.running')} ...</span>;+ }+ if (result.state === 'interrupted') {+ return <span>{t('common.interrupted')}</span>;+ }++ // TODO: render multimodal outputs+ let text: string;+ if (typeof result.output === 'string') {+ text = result.output;+ } else {+ text = result.output+ .map((b) => {+ if (b.type === 'text') return b.text;+ const mainType = b.source.media_type.split('/')[0].toUpperCase();+ const ext = (mime.extension(b.source.media_type) || 'bin').toLowerCase();+ return `[${mainType}.${ext}]`;+ })+ .join('\n');+ }++ return (+ <pre className="border rounded-sm bg-background p-2 text-xs overflow-auto max-h-[200px] whitespace-pre-wrap">+ {text}+ </pre>+ );+}diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/EditRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/EditRenderer.tsxindex 54286e12b..3c404dce1 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/EditRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/EditRenderer.tsx@@ -1,19 +1,17 @@import unidiff from 'unidiff';-import {- defaultGetDisplayName,- defaultRenderCallArgs,- defaultRenderGroup,- defaultRenderResult,-} from './DefaultRenderer';+import { defaultRenderBody } from './DefaultRenderer';import { DiffPreview } from './DiffPreview';-import type { ToolRenderer } from './types';+import type { ToolCallWithResult, ToolRenderer } from './types';import {countDiffStats,DiffStats,+ FramedFileBody,getFilePath,getResultDiff,parseInput,+ toolArgClass,+ toolLabelClass,tryGetFileName,} from '@/components/chat/tool-renderers/_shared.tsx';@@ -31,78 +29,61 @@ function countLineChanges(return countDiffStats(diffText);}-function renderEditDiff(result: { metadata?: Record<string, unknown> }) {- // The post-execution diff is always produced by the backend Edit tool- // (with absolute line numbers and one hunk per replaced occurrence).- // If it's missing we deliberately render nothing — falling back to a- // client-side diff of ``old_string`` / ``new_string`` would silently- // produce misleading line numbers and miss the other replace_all- // occurrences.- const unifiedDiff = getResultDiff(result);- if (!unifiedDiff) return null;- return <DiffPreview unifiedDiff={unifiedDiff} />;+/**+ * Insert/delete counts for the header badge. Prefer the backend post-execution+ * diff (correct for ``replace_all`` and absolute line numbers); before it+ * arrives, fall back to a per-occurrence client-side estimate of+ * ``old_string`` / ``new_string``.+ */+function headerStats(pair: ToolCallWithResult): { insertions: number; deletions: number } {+ const resultDiff = pair.result ? getResultDiff(pair.result) : undefined;+ if (resultDiff) return countDiffStats(resultDiff);+ const input = parseInput(pair.call.input);+ const oldString = typeof input.old_string === 'string' ? input.old_string : '';+ const newString = typeof input.new_string === 'string' ? input.new_string : '';+ return countLineChanges(oldString, newString);}export const EditRenderer: ToolRenderer = {getDisplayName: (call) => call.name,- renderCallArgs: (call) => {- // While the tool-call JSON is still streaming, ``call.input`` is a- // partial dict and parsing yields the wrong file name / empty- // strings. Return an empty fragment (not ``null``) so the index.ts- // ``?? defaultRenderCallArgs`` fallback doesn't dump the raw JSON.- const fileName = tryGetFileName(call.input);- if (!fileName) return <></>;- const input = parseInput(call.input);- const oldString = typeof input.old_string === 'string' ? input.old_string : '';- const newString = typeof input.new_string === 'string' ? input.new_string : '';- // Use the real per-occurrence insert/delete counts rather than the- // raw line counts of old_string / new_string (which over-count when- // most lines are unchanged context).- const { insertions, deletions } = countLineChanges(oldString, newString);-- return (- <div className="flex items-center gap-2 font-normal">- {fileName}- <DiffStats insertions={insertions} deletions={deletions} />- </div>- );- },-renderConfirmBody: (call) => (<div className="w-full max-w-full overflow-hidden text-ellipsis truncate"><div className="text-secondary-foreground">{getFilePath(call.input)}</div></div>),- renderGroup: (calls, t) =>- defaultRenderGroup(calls, t, {- getDisplayName: (call) =>- EditRenderer.getDisplayName?.(call, t) ?? defaultGetDisplayName(call),- renderCallArgs: (call) => {- // When the backend has provided the post-execution unified diff- // (handles replace_all correctly), prefer its insert/delete- // counts over the per-occurrence client-side estimate.- const enriched = calls.find((c) => c.call.id === call.id);- const resultDiff = enriched?.result- ? getResultDiff(enriched.result as { metadata?: Record<string, unknown> })- : undefined;- if (resultDiff) {- const fileName = tryGetFileName(call.input);- if (!fileName) return null;- const { insertions, deletions } = countDiffStats(resultDiff);- return (- <div className="flex items-center gap-2 font-normal">- {fileName}- <DiffStats insertions={insertions} deletions={deletions} />- </div>- );- }- return EditRenderer.renderCallArgs?.(call, t) ?? defaultRenderCallArgs(call);- },- renderResult: (call, result) =>- (result.state === 'success' ? renderEditDiff(result) : null) ??- EditRenderer.renderResult?.(call, result, t) ??- defaultRenderResult(call, result, t),- }),+ renderHeader: (pair) => {+ // While the tool-call JSON is still streaming, ``call.input`` is a partial+ // dict and the file name / diff can't be trusted yet — show just the label.+ const fileName = tryGetFileName(pair.call.input);+ if (!fileName) return <span className={toolLabelClass}>{pair.call.name}</span>;+ const { insertions, deletions } = headerStats(pair);+ return (+ <>+ <span className={toolLabelClass}>{pair.call.name}</span>+ <span className={toolArgClass}>{fileName}</span>+ <DiffStats insertions={insertions} deletions={deletions} />+ </>+ );+ },++ renderBody: (pair, t) => {+ if (!pair.result) return null;+ if (pair.result.state === 'success') {+ // The backend Edit tool always attaches a unified diff (absolute line+ // numbers, one hunk per replaced occurrence). A client-side diff of+ // old_string/new_string would be misleading, so if it's missing we+ // fall through to the default result body rather than fabricate one.+ const diff = getResultDiff(pair.result);+ if (diff) {+ return (+ <FramedFileBody filePath={getFilePath(pair.call.input)}>+ <DiffPreview unifiedDiff={diff} />+ </FramedFileBody>+ );+ }+ }+ return defaultRenderBody(pair, t);+ },};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/GlobRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/GlobRenderer.tsxindex e8233676e..851abae17 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/GlobRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/GlobRenderer.tsx@@ -1,14 +1,6 @@-import { ToolCallGroupList } from './_shared';+import { getResultText, parseInput, toolArgClass, toolLabelClass } from './_shared';import type { ToolRenderer } from './types';-function parseInput(input: string): Record<string, unknown> {- try {- return JSON.parse(input);- } catch {- return {};- }-}-function getPattern(input: string): string {const { pattern } = parseInput(input) as { pattern?: string };return pattern || input;@@ -17,14 +9,17 @@ function getPattern(input: string): string {export const GlobRenderer: ToolRenderer = {getDisplayName: (_call, t) => t('tool.glob.name'),- renderCallArgs: (call) => getPattern(call.input),-- renderGroup: (calls, t) => (- <ToolCallGroupList- calls={calls}- inline- label={<strong className="truncate text-primary text-sm">{t('tool.glob.name')}</strong>}- renderItem={(item) => getPattern(item.call.input)}- />+ renderHeader: (pair) => (+ <>+ <span className={toolLabelClass}>Glob pattern</span>+ <span className={toolArgClass}>{getPattern(pair.call.input)}</span>+ </>),++ renderBody: (pair) =>+ pair.result ? (+ <pre className="border rounded-sm bg-background p-2 font-mono text-xs overflow-x-auto whitespace-pre">+ {getResultText(pair.result)}+ </pre>+ ) : null,};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/GrepRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/GrepRenderer.tsxindex 656c3ec35..80fb6bb6c 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/GrepRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/GrepRenderer.tsx@@ -1,14 +1,6 @@-import { ToolCallGroupList } from './_shared';+import { getResultText, parseInput, toolArgClass, toolLabelClass } from './_shared';import type { ToolRenderer } from './types';-function parseInput(input: string): Record<string, unknown> {- try {- return JSON.parse(input);- } catch {- return {};- }-}-function getPattern(input: string): string {const { pattern } = parseInput(input) as { pattern?: string };return pattern || input;@@ -17,14 +9,17 @@ function getPattern(input: string): string {export const GrepRenderer: ToolRenderer = {getDisplayName: (_call, t) => t('tool.grep.name'),- renderCallArgs: (call) => getPattern(call.input),-- renderGroup: (calls, t) => (- <ToolCallGroupList- calls={calls}- inline- label={<strong className="truncate text-primary text-sm">{t('tool.grep.name')}</strong>}- renderItem={(item) => getPattern(item.call.input)}- />+ renderHeader: (pair) => (+ <>+ <span className={toolLabelClass}>Grep pattern</span>+ <span className={toolArgClass}>{getPattern(pair.call.input)}</span>+ </>),++ renderBody: (pair) =>+ pair.result ? (+ <pre className="border rounded-sm bg-background p-2 font-mono text-xs overflow-x-auto whitespace-pre">+ {getResultText(pair.result)}+ </pre>+ ) : null,};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/ReadRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/ReadRenderer.tsxindex e74376c07..df6f27ca9 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/ReadRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/ReadRenderer.tsx@@ -1,116 +1,82 @@-/* eslint-disable react-refresh/only-export-components -- renderer constant is co-located with its inline component by design */-import type { ToolResultBlock } from '@agentscope-ai/agentscope/message';-import { ChevronRight } from 'lucide-react';-import { useState } from 'react';+import {+ FramedFileBody,+ getFilePath,+ getFileName,+ getResultText,+ parseInput,+ toolArgClass,+ toolLabelClass,+} from './_shared';+import { DiffPreview } from './DiffPreview';+import type { ToolRenderer } from './types';-import { CornerLine, getFilePath, ToolStateIcon } from './_shared';-import type { TFunction, ToolCallWithResult, ToolRenderer } from './types';-import { Button } from '@/components/ui/button.tsx';-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';-import { formatNumber } from '@/utils/common';--/** Count lines in a tool result's output string, including text content from- * non-text blocks. Returns 0 when the result is missing or empty. */-function countResultLines(result?: ToolResultBlock): number {- if (!result) return 0;- let str: string;- if (typeof result.output === 'string') {- str = result.output;- } else {- str = result.output.map((b) => (b.type === 'text' ? b.text : '')).join('\n');- }- if (!str) return 0;- return str.split('\n').length;-}--/** Collapse consecutive Read calls of the same `file_path` into one bucket so- * the path is shown once, followed by one corner-row per call. Order is- * preserved; a different path or a re-occurrence after another path starts a- * new bucket. */-function groupByConsecutivePath(- calls: ToolCallWithResult[],-): Array<{ path: string; calls: ToolCallWithResult[] }> {- const groups: Array<{ path: string; calls: ToolCallWithResult[] }> = [];- for (const item of calls) {- const path = getFilePath(item.call.input);- const last = groups[groups.length - 1];- if (last && last.path === path) {- last.calls.push(item);- } else {- groups.push({ path, calls: [item] });- }- }- return groups;+/**+ * Split a `cat -n` formatted Read result (`" 12\tcontent"`, produced by the+ * backend Read tool) into `{ num, text }` rows. Lines without a tab (e.g.+ * non-text/binary output) fall back to an empty line number.+ */+function parseNumberedLines(content: string): Array<{ num: string; text: string }> {+ return content.split('\n').map((line) => {+ const tab = line.indexOf('\t');+ if (tab === -1) return { num: '', text: line };+ return { num: line.slice(0, tab).trim(), text: line.slice(tab + 1) };+ });}-function ReadGroup({ calls, t }: { calls: ToolCallWithResult[]; t: TFunction }) {- const [open, setOpen] = useState(false);- const name = t('tool.read.name');-- return (- <Collapsible open={open} onOpenChange={setOpen} className="flex flex-col w-full ">- <CollapsibleTrigger asChild>- <Button- variant={'ghost'}- className="group hover:bg-transparent data-[state=open]:bg-transparent justify-start px-0 gap-2 active:!translate-y-0"- >- <ToolStateIcon states={calls.map((c) => c.result?.state)} />- <span className="flex items-center text-sm truncate gap-1">- <strong className="text-primary">{name}</strong>- {t('tool.read.fileCount', { count: calls.length })}- </span>- <ChevronRight className="size-3 group-data-[state=open]:rotate-90" />- </Button>- </CollapsibleTrigger>- <CollapsibleContent className="pl-6 pt-2 flex flex-col gap-y-2 text-sm">- {groupByConsecutivePath(calls).map((group, gIdx) => (- <div key={gIdx} className="flex flex-col min-w-0">- <div className="truncate">- {/*<strong className="text-primary">{name}</strong>*/}- {/*<span className="text-muted-foreground">({group.path})</span>*/}- <span- className={- 'text-xs !overflow-visible !whitespace-normal !text-clip break-all'- }- >- {group.path}- </span>- </div>- {group.calls.map(({ call, result }) => {- if (!result) return null;- const lines = countResultLines(result);- return (- <div- key={call.id}- className="flex flex-row gap-x-2 items-center pl-2 text-xs"- >- <CornerLine />- <span className="text-muted-foreground">- {t('tool.read.lineCount', {- count: lines,- formatted: formatNumber(lines),- })}- </span>- </div>- );- })}- </div>- ))}- </CollapsibleContent>- </Collapsible>- );+/**+ * Render a Read result through the very same `DiffPreview` that Edit / Write+ * use, by synthesizing a unified diff whose every line is an unchanged context+ * line. Read isn't a diff, but presenting it as an all-context one gives it the+ * identical monospace layout and line-number gutter — just without +/- markers+ * or colouring — so all three file tools look consistent. The starting line+ * number is taken from the first `cat -n` gutter value so partial reads+ * (`offset`) still show absolute line numbers.+ */+function buildContextDiff(content: string): string {+ const rows = parseNumberedLines(content);+ const start = parseInt(rows[0]?.num ?? '', 10) || 1;+ const body = rows.map((row) => ` ${row.text}`).join('\n');+ return `--- a/file\n+++ b/file\n@@ -${start},${rows.length} +${start},${rows.length} @@\n${body}`;}export const ReadRenderer: ToolRenderer = {getDisplayName: (_call, t) => t('tool.read.name'),- renderCallArgs: (call) => getFilePath(call.input),-renderConfirmBody: (call) => (<div className="w-full max-w-full overflow-hidden text-ellipsis truncate"><div className="text-secondary-foreground">{getFilePath(call.input)}</div></div>),- renderGroup: (calls, t) => <ReadGroup calls={calls} t={t} />,+ renderHeader: (pair) => {+ const fileName = getFileName(parseInput(pair.call.input).file_path as string);+ const readContent = getResultText(pair.result);+ const lines = readContent ? readContent.split('\n').length : 0;+ return (+ <>+ <span className={toolLabelClass}>Read</span>+ <span className={toolArgClass}>{fileName}</span>+ {pair.result?.state === 'success' && (+ <span className={toolLabelClass}>{lines} lines</span>+ )}+ </>+ );+ },++ renderBody: (pair) => {+ if (!pair.result) return null;+ const filePath = parseInput(pair.call.input).file_path as string;+ const readContent = getResultText(pair.result);+ return (+ <FramedFileBody filePath={filePath}>+ {pair.result.state === 'error' ? (+ // Errors aren't file content, so show the raw message rather than+ // forcing it through the diff renderer.+ <div className="overflow-x-auto p-2 font-mono text-xs">{readContent}</div>+ ) : (+ <DiffPreview unifiedDiff={buildContextDiff(readContent)} />+ )}+ </FramedFileBody>+ );+ },};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/TaskCreateRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/TaskCreateRenderer.tsxindex e4340b7eb..95376b05c 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/TaskCreateRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/TaskCreateRenderer.tsx@@ -1,91 +1,40 @@-/* eslint-disable react-refresh/only-export-components -- renderer constant is co-located with its inline component by design */-import { useState } from 'react';--import { CornerLine, ToolStateIcon } from './_shared';-import type { TFunction, ToolCallWithResult, ToolRenderer } from './types';-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';--function parseInput(input: string): Record<string, unknown> {- try {- return JSON.parse(input);- } catch {- return {};- }-}+import { getResultText, parseInput, toolArgClass, toolLabelClass } from './_shared';+import type { ToolCallWithResult, ToolRenderer } from './types';/**- * Collapsed: "TaskCreate Created 3 tasks ..."- * Expanded:- * TaskCreate Created 3 tasks- * Research duck facts- * Find five interesting facts about ducks- * Write summary- * Compile the research into a brief summary- * Review code- * Check for bugs and style issues+ * Extract the numeric task id the backend echoes in its result text+ * (`"Task (id=3) created successfully: ..."`), or `null` if absent.*/-function TaskCreateGroup({ calls, t }: { calls: ToolCallWithResult[]; t: TFunction }) {- const [open, setOpen] = useState(false);-- return (- <Collapsible open={open} onOpenChange={setOpen} className="flex flex-col w-full">- <CollapsibleTrigger className="flex flex-row gap-x-2 w-full max-w-full items-center cursor-pointer text-left">- <ToolStateIcon states={calls.map((c) => c.result?.state)} />- <span className="text-sm flex-1 min-w-0 truncate">- <strong className="text-primary">{t('tool.taskCreate.label')}</strong>{' '}- {t('tool.taskCreate.count', { count: calls.length })}- {!open && <span className="text-muted-foreground"> ...</span>}- </span>- </CollapsibleTrigger>- <CollapsibleContent className="pl-6 pt-2 flex flex-col gap-y-2 text-sm">- {calls.map(({ call, result }) => {- const input = parseInput(call.input);- const subject = (input.subject as string) || '(untitled)';- const description = (input.description as string) || '';- // Extract the numeric task id from result text:- // "Task (id=3) created successfully: ..."- const resultText =- typeof result?.output === 'string'- ? result.output- : Array.isArray(result?.output)- ? result.output.map((b) => ('text' in b ? b.text : '')).join('')- : '';- const idMatch = resultText.match(/^Task \(id=(\d+)\)/);- const taskId = idMatch ? idMatch[1] : null;- return (- <div key={call.id} className="flex flex-col min-w-0">- <span className="text-xs break-all font-medium">- {taskId && (- <span className="text-muted-foreground font-mono">- #{taskId}- </span>- )}- {taskId && ' '}- {subject}- </span>- {description && (- <div className="flex flex-row gap-x-2 items-start pl-2 text-xs">- <CornerLine />- <span className="text-muted-foreground break-all">- {description}- </span>- </div>- )}- </div>- );- })}- </CollapsibleContent>- </Collapsible>- );+function getTaskId(pair: ToolCallWithResult): string | null {+ const match = getResultText(pair.result).match(/^Task \(id=(\d+)\)/);+ return match ? match[1] : null;}export const TaskCreateRenderer: ToolRenderer = {getDisplayName: (_call, t) => t('tool.taskCreate.name'),- renderCallArgs: (call) => {- const input = parseInput(call.input);- return (input.subject as string) || '';+ // Trigger line: "Create task #{id} {subject}"+ renderHeader: (pair) => {+ const subject = (parseInput(pair.call.input).subject as string) || '(untitled)';+ const taskId = getTaskId(pair);+ return (+ <>+ <span className={toolLabelClass}>Create task</span>+ <span className={toolArgClass}>+ {taskId && <span className="text-muted-foreground font-mono">#{taskId} </span>}+ {subject}+ </span>+ </>+ );},- renderGroup: (calls, t) => <TaskCreateGroup calls={calls} t={t} />,+ // Expanded body: the task description.+ renderBody: (pair) => {+ const description = (parseInput(pair.call.input).description as string) || '';+ return description ? (+ <div className="border rounded-sm bg-background p-2 text-xs text-muted-foreground break-all">+ {description}+ </div>+ ) : null;+ },};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/WriteRenderer.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/WriteRenderer.tsxindex a5d63b31a..a989aa2fe 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/WriteRenderer.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/WriteRenderer.tsx@@ -1,93 +1,58 @@-import {- defaultGetDisplayName,- defaultRenderCallArgs,- defaultRenderGroup,- defaultRenderResult,-} from './DefaultRenderer';+import { defaultRenderBody } from './DefaultRenderer';import { DiffPreview } from './DiffPreview';import type { ToolRenderer } from './types';import {countDiffStats,DiffStats,+ FramedFileBody,getFilePath,getResultDiff,+ toolArgClass,+ toolLabelClass,tryGetFileName,} from '@/components/chat/tool-renderers/_shared.tsx';export const WriteRenderer: ToolRenderer = {getDisplayName: (call) => call.name,- renderCallArgs: (call) => {- // While the tool-call JSON is still streaming, ``call.input`` is a- // partial dict (e.g. ``{"file_path": "foo", "content": "...``) and- // parsing yields the wrong file name or none at all. Render an empty- // fragment (not ``null``) so the index.ts ``?? defaultRenderCallArgs``- // fallback doesn't kick in and dump the raw JSON string.- const fileName = tryGetFileName(call.input);- if (!fileName) return <></>;- // Pre-execution we only know the new ``content`` (not the previous- // file body), so any ``+N`` count would be misleading on overwrites.- // The post-execution renderGroup override below adds ``+N -M`` once- // ``metadata.diff`` arrives.- return <div className="flex items-center gap-2 font-normal">{fileName}</div>;- },-renderConfirmBody: (call) => (<div className="w-full max-w-full overflow-hidden text-ellipsis truncate"><div className="text-secondary-foreground">{getFilePath(call.input)}</div></div>),- renderResult: (call, result, t) => {- if (result.state === 'success') {- // The backend Write tool always attaches a unified diff in- // ``metadata.diff`` (correctly representing both new-file- // creation against /dev/null and overwrites of existing files- // with absolute line numbers). If it's missing we fall through- // rather than render a misleading client-side diff.- const unifiedDiff = getResultDiff(result as { metadata?: Record<string, unknown> });- if (unifiedDiff) {- return <DiffPreview unifiedDiff={unifiedDiff} />;+ renderHeader: (pair) => {+ const fileName = tryGetFileName(pair.call.input);+ if (!fileName) return <span className={toolLabelClass}>{pair.call.name}</span>;+ // Pre-execution we only know the new ``content`` (not the previous file+ // body), so any ``+N`` count would be misleading on overwrites. Show the+ // real ``+N -M`` only once the backend post-execution diff has arrived.+ const diff = pair.result ? getResultDiff(pair.result) : undefined;+ const stats = diff ? countDiffStats(diff) : null;+ return (+ <>+ <span className={toolLabelClass}>{pair.call.name}</span>+ <span className={toolArgClass}>{fileName}</span>+ {stats && <DiffStats insertions={stats.insertions} deletions={stats.deletions} />}+ </>+ );+ },++ renderBody: (pair, t) => {+ if (!pair.result) return null;+ if (pair.result.state === 'success') {+ // The backend Write tool always attaches a unified diff (new-file+ // creation against /dev/null or an overwrite with absolute line+ // numbers). If it's missing we fall through rather than fabricate one.+ const diff = getResultDiff(pair.result);+ if (diff) {+ return (+ <FramedFileBody filePath={getFilePath(pair.call.input)}>+ <DiffPreview unifiedDiff={diff} />+ </FramedFileBody>+ );}- return undefined;- }- if (call.state === 'asking' || !result || result.state === 'running') {- return t('common.running');}- if (result.state === 'interrupted') {- return t('common.interrupted');- }- return undefined;+ return defaultRenderBody(pair, t);},-- renderGroup: (calls, t) =>- defaultRenderGroup(calls, t, {- getDisplayName: (call) =>- WriteRenderer.getDisplayName?.(call, t) ?? defaultGetDisplayName(call),- renderCallArgs: (call) => {- // Once the backend has produced the post-execution unified- // diff, compute and show the real ``+N -M`` stats — this- // correctly accounts for overwrites of existing files- // (which the pre-execution renderCallArgs cannot know).- const enriched = calls.find((c) => c.call.id === call.id);- const resultDiff = enriched?.result- ? getResultDiff(enriched.result as { metadata?: Record<string, unknown> })- : undefined;- if (resultDiff) {- const fileName = tryGetFileName(call.input);- if (!fileName) return null;- const { insertions, deletions } = countDiffStats(resultDiff);- return (- <div className="flex items-center gap-2 font-normal">- {fileName}- <DiffStats insertions={insertions} deletions={deletions} />- </div>- );- }- return WriteRenderer.renderCallArgs?.(call, t) ?? defaultRenderCallArgs(call);- },- renderResult: (call, result) =>- WriteRenderer.renderResult?.(call, result, t) ??- defaultRenderResult(call, result, t),- }),};diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/_shared.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/_shared.tsxindex 33b6d3a58..e22ea2bdb 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/_shared.tsx+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/_shared.tsx@@ -1,109 +1,112 @@import type { ToolResultBlock } from '@agentscope-ai/agentscope/message';-import { Circle, Minus, Plus } from 'lucide-react';+import { Ban, Check, ChevronRight, LoaderCircle, Minus, Plus, X } from 'lucide-react';import type { ReactNode } from 'react';import type { ToolCallWithResult } from './types';-import lineCornerSvg from '@/assets/images/line-corner.svg';-import lineVerticalSvg from '@/assets/images/line-vertical.svg';+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';+import { Separator } from '@/components/ui/separator';+import { cn } from '@/lib/utils';import { formatNumber } from '@/utils/common.ts';-/**- * Pick the connector image for an item at `index` of `total`:- * corner for the last row, vertical otherwise.- */-function getLineImage(index: number, total: number): string {- return index === total - 1 ? lineCornerSvg : lineVerticalSvg;+export function ToolStateIcon({ state }: { state: ToolResultBlock['state'] | undefined }) {+ if (state === 'success') {+ return <Check className="size-3 text-emerald-600 dark:text-emerald-400 shrink-0" />;+ }+ if (state === 'error') {+ return <X className="size-3 text-red-600 dark:text-red-400 shrink-0" />;+ }+ if (state === 'interrupted' || state === 'denied') {+ return <Ban className="size-3 !h-3 min-h-3 shrink-0" />;+ }++ // running+ return <LoaderCircle className="size-3 shrink-0 animate-spin" />;}/**- * Single tree-line cell. Use inside flex rows where one column is the line- * and the next is the actual content.+ * Flatten a tool result's ``output`` (string or block array) into plain text,+ * keeping only the text blocks. Returns ``''`` when the result is missing.*/-export function TreeLine({- index,- total,- className = 'w-3 h-full',-}: {- index: number;- total: number;- className?: string;-}) {- return (- <div className="flex-shrink-0 h-full items-center">- <img src={getLineImage(index, total)} alt="" className={className} />- </div>- );+export function getResultText(result?: ToolResultBlock): string {+ if (!result) return '';+ if (typeof result.output === 'string') return result.output;+ if (Array.isArray(result.output)) {+ return result.output.map((b) => (b.type === 'text' ? b.text : '')).join('\n');+ }+ return '';}/**- * Single corner-only line, used when only one trailing item exists.+ * Shared class for the *leading label* of a tool-call trigger line — the verb+ * or tool name such as "Read", "Bash", "Grep pattern", or the generic+ * "Call tool". Deliberately not bold (no `<strong>`): every tool's label looks+ * the same and only brightens to the foreground colour on row hover (the row+ * is a `group`).*/-export function CornerLine({ className = 'w-3 h-4' }: { className?: string }) {- return (- <div className="flex-shrink-0">- <img src={lineCornerSvg} alt="" className={className} />- </div>- );-}+export const toolLabelClass = 'shrink-0 transition-colors group-hover:text-foreground';/**- * Aggregated state icon over a list of tool result states. Mirrors the- * pre-refactor priority: running/undefined → pulsing muted; all success →- * green; any error → red; any interrupted → yellow; otherwise muted.+ * Shared class for the *primary argument* of a trigger line — the file name+ * (Read/Edit/Write), search pattern (Grep/Glob), task subject (TaskCreate) or,+ * for tools without a dedicated renderer, the tool name itself. Unifies weight+ * and truncation so the second slot is visually identical across every tool.*/-export function ToolStateIcon({ states }: { states: (ToolResultBlock['state'] | undefined)[] }) {- if (states.includes('running') || states.includes(undefined)) {- return (- <Circle className="size-2.5 text-muted-foreground fill-muted-foreground animate-pulse shrink-0" />- );- }- if (states.every((state) => state === 'success')) {- return <Circle className="size-2.5 text-green-500 fill-green-500 shrink-0" />;- }- if (states.some((state) => state === 'error')) {- return <Circle className="size-2.5 text-red-500 fill-red-500 shrink-0" />;- }- if (states.some((state) => state === 'interrupted')) {- return <Circle className="size-2.5 text-yellow-500 fill-yellow-500 shrink-0" />;- }- return <Circle className="size-2.5 text-muted-foreground fill-muted-foreground shrink-0" />;-}+export const toolArgClass =+ 'font-[450] min-w-0 truncate transition-colors group-hover:text-foreground';/**- * Header + indented item list, used by Read / Glob / Grep group renderers.- * Each item shows only the per-call args (no result), connected by SVG tree- * lines. `inline` lays items horizontally instead of stacked.+ * One collapsible tool-call row — the single shared shell every tool renders+ * through. The trigger line is ``{header} <state-icon> <chevron>``; the+ * chevron only appears on hover and stays visible (rotated down) while open.+ * When ``body`` is provided the row expands to reveal it; without a body the+ * row is a plain, non-expandable line (no chevron, no pointer cursor).+ *+ * ``header`` should be a fragment of inline flex children (the parent supplies+ * ``gap-x-2``); tools never touch the Collapsible / state icon themselves.*/-export function ToolCallGroupList({- calls,- label,- renderItem,- inline,+export function ToolCallRow({+ pair,+ header,+ body,}: {- calls: ToolCallWithResult[];- label: ReactNode;- renderItem: (item: ToolCallWithResult) => ReactNode;- inline?: boolean;+ pair: ToolCallWithResult;+ header: ReactNode;+ body?: ReactNode;}) {- return (- <div className="flex flex-col w-full">- <div className="flex flex-row gap-x-2 w-full max-w-full items-center">- <ToolStateIcon states={calls.map((item) => item.result?.state)} />- {label}- </div>- <div className={`flex ${inline ? 'flex-row' : 'flex-col'} gap-x-2 pl-6 max-w-full`}>- {calls.map((item, index) => (- <div- key={item.call.id}- className="flex flex-row gap-x-2 w-full max-w-full items-stretch"- >- <TreeLine index={index} total={calls.length} />- <div className="truncate flex-1 min-w-0 text-sm">{renderItem(item)}</div>- </div>- ))}- </div>+ const expandable = body != null && body !== false;+ // Shimmer the header text. The shadcn ``shimmer`` util is a text-clip effect,+ // so it has to sit on the elements that *directly* hold the text — the+ // header's own leaf spans — not on a wrapper (a wrapper only makes descendant+ // text transparent). We target the direct span children of this flex row+ // instead of wrapping ``header``, which also keeps their ``gap-x-2`` spacing.+ const row = (+ <div+ className={cn(+ 'group flex flex-row gap-x-2 items-center w-full',+ expandable && 'cursor-pointer',+ !pair.result || pair.result.state === 'running' ? 'shimmer' : '',+ )}+ >+ {header}+ <ToolStateIcon state={pair.result?.state} />+ {expandable && (+ <ChevronRight+ className={+ 'size-3 shrink-0 transition-transform hidden group-hover:flex group-data-[state=open]:flex group-data-[state=open]:rotate-90'+ }+ />+ )}</div>);++ if (!expandable) return row;++ return (+ <Collapsible>+ <CollapsibleTrigger asChild>{row}</CollapsibleTrigger>+ <CollapsibleContent>{body}</CollapsibleContent>+ </Collapsible>+ );}/**@@ -143,7 +146,7 @@ export function getFileName(input: string): string {/*** Like ``getFileName`` but returns ``undefined`` when the input is not yet* a fully parseable JSON object with a non-empty ``file_path`` field. Use- * this in ``renderCallArgs`` so partial JSON streamed during tool-call+ * this in ``renderHeader`` so partial JSON streamed during tool-call* generation doesn't render a garbled file name (e.g. a fragment of the* ``content`` field being mistaken for the path).*/@@ -187,6 +190,21 @@ export function getResultDiff(result: { metadata?: Record<string, unknown> }): sreturn typeof diff === 'string' && diff.length > 0 ? diff : undefined;}+/**+ * Framed body box shared by file-oriented tools (Read / Edit / Write): a+ * bordered card with the file path as a header, a separator, then the tool's+ * own content (numbered source lines for Read, a diff for Edit / Write).+ */+export function FramedFileBody({ filePath, children }: { filePath: string; children: ReactNode }) {+ return (+ <div className="flex flex-col border rounded-sm bg-background">+ <div className="px-2 py-1 whitespace-nowrap overflow-x-auto">{filePath}</div>+ <Separator />+ {children}+ </div>+ );+}+/*** Compact ``+N -M`` badge used in tool call headers for Edit / Write to show* how many lines were inserted and deleted.@@ -194,14 +212,18 @@ export function getResultDiff(result: { metadata?: Record<string, unknown> }): sexport function DiffStats({ insertions, deletions }: { insertions: number; deletions: number }) {return (<div className="flex items-center gap-0.5">- <div className="flex items-center text-emerald-600 dark:text-emerald-400">- <Plus className="size-2.5 stroke-2" />- {formatNumber(insertions)}- </div>- <div className="flex items-center text-red-600 dark:text-red-400">- <Minus className="size-2.5 stroke-2" />- {formatNumber(deletions)}- </div>+ {insertions && (+ <div className="flex items-center text-emerald-600 dark:text-emerald-400">+ <Plus className="size-2.5 stroke-2" />+ {formatNumber(insertions)}+ </div>+ )}+ {deletions && (+ <div className="flex items-center text-red-600 dark:text-red-400">+ <Minus className="size-2.5 stroke-2" />+ {formatNumber(deletions)}+ </div>+ )}</div>);}diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/index.ts b/examples/web_ui/frontend/src/components/chat/tool-renderers/index.tsdeleted file mode 100644index fa0f16479..000000000--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/index.ts+++ /dev/null@@ -1,80 +0,0 @@-import type { ToolCallBlock, ToolResultBlock } from '@agentscope-ai/agentscope/message';-import type { ReactNode } from 'react';--import { BashRenderer } from './BashRenderer';-import {- defaultGetDisplayName,- defaultRenderCallArgs,- defaultRenderConfirmBody,- defaultRenderGroup,- defaultRenderResult,-} from './DefaultRenderer';-import { EditRenderer } from './EditRenderer';-import { GlobRenderer } from './GlobRenderer';-import { GrepRenderer } from './GrepRenderer';-import { ReadRenderer } from './ReadRenderer';-import { TaskCreateRenderer } from './TaskCreateRenderer';-import type { TFunction, ToolCallWithResult, ToolRenderer } from './types';-import { WriteRenderer } from './WriteRenderer';--const renderers: Record<string, ToolRenderer> = {- Bash: BashRenderer,- Read: ReadRenderer,- Write: WriteRenderer,- Edit: EditRenderer,- Glob: GlobRenderer,- Grep: GrepRenderer,- TaskCreate: TaskCreateRenderer,-};--function getRenderer(toolName: string): ToolRenderer {- return renderers[toolName] ?? {};-}--export function getDisplayName(call: ToolCallBlock, t: TFunction): string {- const r = getRenderer(call.name);- return r.getDisplayName?.(call, t) ?? defaultGetDisplayName(call);-}--export function renderCallArgs(call: ToolCallBlock, t: TFunction): ReactNode {- const r = getRenderer(call.name);- return r.renderCallArgs?.(call, t) ?? defaultRenderCallArgs(call);-}--export function renderResult(- call: ToolCallBlock,- result: ToolResultBlock,- t: TFunction,-): ReactNode {- const r = getRenderer(call.name);- return r.renderResult?.(call, result, t) ?? defaultRenderResult(call, result, t);-}--export function renderConfirmBody(call: ToolCallBlock, t: TFunction): ReactNode {- const r = getRenderer(call.name);- return r.renderConfirmBody?.(call, t) ?? defaultRenderConfirmBody(call);-}--/**- * Render a group of consecutive tool calls of the same name.- *- * - If the tool's renderer defines `renderGroup`, delegate to it.- * - Otherwise fall back to `defaultRenderGroup`, wired with this registry's- * resolvers so per-tool `getDisplayName` / `renderCallArgs` / `renderResult`- * still apply.- */-export function renderToolGroup(- toolName: string,- calls: ToolCallWithResult[],- t: TFunction,-): ReactNode {- const r = getRenderer(toolName);- if (r.renderGroup) {- return r.renderGroup(calls, t);- }- return defaultRenderGroup(calls, t, {- getDisplayName: (call) => getDisplayName(call, t),- renderCallArgs: (call) => renderCallArgs(call, t),- renderResult: (call, result) => renderResult(call, result, t),- });-}diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/index.tsx b/examples/web_ui/frontend/src/components/chat/tool-renderers/index.tsxnew file mode 100644index 000000000..a119af8b8--- /dev/null+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/index.tsx@@ -0,0 +1,55 @@+import type { ToolCallBlock } from '@agentscope-ai/agentscope/message';+import type { ReactNode } from 'react';++import { ToolCallRow } from './_shared';+import { BashRenderer } from './BashRenderer';+import {+ defaultGetDisplayName,+ defaultRenderBody,+ defaultRenderConfirmBody,+ defaultRenderHeader,+} from './DefaultRenderer';+import { EditRenderer } from './EditRenderer';+import { GlobRenderer } from './GlobRenderer';+import { GrepRenderer } from './GrepRenderer';+import { ReadRenderer } from './ReadRenderer';+import { TaskCreateRenderer } from './TaskCreateRenderer';+import type { TFunction, ToolCallWithResult, ToolRenderer } from './types';+import { WriteRenderer } from './WriteRenderer';++const renderers: Record<string, ToolRenderer> = {+ Bash: BashRenderer,+ Read: ReadRenderer,+ Write: WriteRenderer,+ Edit: EditRenderer,+ Glob: GlobRenderer,+ Grep: GrepRenderer,+ TaskCreate: TaskCreateRenderer,+};++function getRenderer(toolName: string): ToolRenderer {+ return renderers[toolName] ?? {};+}++export function getDisplayName(call: ToolCallBlock, t: TFunction): string {+ const r = getRenderer(call.name);+ return r.getDisplayName?.(call, t) ?? defaultGetDisplayName(call);+}++export function renderConfirmBody(call: ToolCallBlock, t: TFunction): ReactNode {+ const r = getRenderer(call.name);+ return r.renderConfirmBody?.(call, t) ?? defaultRenderConfirmBody(call);+}++/**+ * Render a single tool call as one collapsible row. The tool's renderer only+ * supplies the trigger-line `header` and the expandable `body`; the shared+ * `ToolCallRow` owns the collapsible shell, state icon and chevron. Falls back+ * to the `Default*` implementations for tools without a dedicated renderer.+ */+export function renderToolCall(pair: ToolCallWithResult, t: TFunction): ReactNode {+ const r = getRenderer(pair.call.name);+ const header = r.renderHeader?.(pair, t) ?? defaultRenderHeader(pair, t);+ const body = r.renderBody?.(pair, t) ?? defaultRenderBody(pair, t);+ return <ToolCallRow key={pair.call.id} pair={pair} header={header} body={body} />;+}diff --git a/examples/web_ui/frontend/src/components/chat/tool-renderers/types.ts b/examples/web_ui/frontend/src/components/chat/tool-renderers/types.tsindex 3fb785334..4498eb3f1 100644--- a/examples/web_ui/frontend/src/components/chat/tool-renderers/types.ts+++ b/examples/web_ui/frontend/src/components/chat/tool-renderers/types.ts@@ -8,16 +8,24 @@ export interface ToolCallWithResult {result?: ToolResultBlock;}+/**+ * A tool renderer only supplies *content*; the shared `ToolCallRow` owns the+ * collapsible shell, state icon, chevron and layout. Two render paths exist:+ *+ * - Inline row (`renderHeader` + `renderBody`): the trigger line and its+ * expandable body. `renderBody` returning `null`/`undefined` makes the row+ * non-expandable.+ * - Confirmation card (`getDisplayName` + `renderConfirmBody`): the title and+ * body shown by `ConfirmCard` while a call awaits user approval.+ *+ * Every method is optional — `index.ts` falls back to the `Default*`+ * implementations when a tool doesn't override one.+ */export interface ToolRenderer {getDisplayName?: (call: ToolCallBlock, t: TFunction) => string;- renderCallArgs?: (call: ToolCallBlock, t: TFunction) => ReactNode;- renderResult?: (call: ToolCallBlock, result: ToolResultBlock, t: TFunction) => ReactNode;renderConfirmBody?: (call: ToolCallBlock, t: TFunction) => ReactNode;- /**- * Render a group of consecutive tool calls of the same name.- * Receives the visible (non-truncated) calls — `MessageBubble` truncates- * at the first `asking` call before invoking, and renders ConfirmCard- * separately.- */- renderGroup?: (calls: ToolCallWithResult[], t: TFunction) => ReactNode;+ /** Trigger-line content, laid out before the state icon / chevron. */+ renderHeader?: (pair: ToolCallWithResult, t: TFunction) => ReactNode;+ /** Expandable body; return `null`/`undefined` for a non-expandable row. */+ renderBody?: (pair: ToolCallWithResult, t: TFunction) => ReactNode;}diff --git a/examples/web_ui/frontend/src/i18n/locales/en.json b/examples/web_ui/frontend/src/i18n/locales/en.jsonindex 0578bd164..3d2914354 100644--- a/examples/web_ui/frontend/src/i18n/locales/en.json+++ b/examples/web_ui/frontend/src/i18n/locales/en.json@@ -50,7 +50,7 @@"home": "Back to home"},"tool": {- "moreLines": "... {{count}} more lines",+ "callGeneric": "Call tool","read": {"name": "Read","fileCount_one": "{{count}} file",@@ -62,13 +62,27 @@"name": "Glob"},"taskCreate": {- "name": "TaskCreate",- "label": "Create",- "count_one": "{{count}} task",- "count_other": "{{count}} tasks"+ "name": "TaskCreate"},"grep": {"name": "Grep"+ },+ "summary": {+ "separator": ", ",+ "bash_one": "ran {{count}} shell command",+ "bash_other": "ran {{count}} shell commands",+ "read_one": "read {{count}} file",+ "read_other": "read {{count}} files",+ "edit_one": "edited {{count}} file",+ "edit_other": "edited {{count}} files",+ "search_one": "searched {{count}} pattern",+ "search_other": "searched {{count}} patterns",+ "todo_one": "updated todos {{count}} item",+ "todo_other": "updated todos {{count}} items",+ "mcp_one": "called {{count}} MCP tool",+ "mcp_other": "called {{count}} MCP tools",+ "fallback_one": "called {{count}} tool",+ "fallback_other": "called {{count}} tools"}},"textInput": {@@ -129,28 +143,49 @@"identity": {"legend": "Agent Identity","description": "Name and instructions that define this agent's behaviour.",- "name": { "label": "Name", "placeholder": "My agent" },- "system-prompt": { "label": "System prompt" }+ "name": {+ "label": "Name",+ "placeholder": "My agent"+ },+ "system-prompt": {+ "label": "System prompt"+ }},"context-config": {"legend": "Context Config","description": "Controls how the context window is managed and compressed.",- "trigger-ratio": { "label": "Trigger ratio" },- "reserve-ratio": { "label": "Reserve ratio" },- "tool-result-limit": { "label": "Tool result limit" },- "compression-prompt": { "label": "Compression prompt" },- "summary-template": { "label": "Summary template" }+ "trigger-ratio": {+ "label": "Trigger ratio"+ },+ "reserve-ratio": {+ "label": "Reserve ratio"+ },+ "tool-result-limit": {+ "label": "Tool result limit"+ },+ "compression-prompt": {+ "label": "Compression prompt"+ },+ "summary-template": {+ "label": "Summary template"+ }},"react-config": {"legend": "ReAct Config","description": "Controls the reasoning and action loop behaviour.",- "max-iters": { "label": "Max iterations" },- "stop-on-reject": { "label": "Stop on reject" }+ "max-iters": {+ "label": "Max iterations"+ },+ "stop-on-reject": {+ "label": "Stop on reject"+ }},"invite-config": {"legend": "Invite Config","description": "Controls whether other agents can borrow this one via AgentInvite.",- "invitable": { "label": "Invitable" },+ "invitable": {+ "label": "Invitable"+ },"invite-description": {"label": "Invite description","placeholder": "Briefly describe this agent's expertise; required when invitable is on."diff --git a/examples/web_ui/frontend/src/i18n/locales/zh.json b/examples/web_ui/frontend/src/i18n/locales/zh.jsonindex 27e8c3922..431c9964d 100644--- a/examples/web_ui/frontend/src/i18n/locales/zh.json+++ b/examples/web_ui/frontend/src/i18n/locales/zh.json@@ -50,7 +50,7 @@"home": "返回首页"},"tool": {- "moreLines": "... 还有 {{count}} 行",+ "callGeneric": "调用工具","read": {"name": "读取","fileCount_one": "{{count}} 个文件",@@ -62,13 +62,27 @@"name": "Glob"},"taskCreate": {- "name": "TaskCreate",- "label": "创建",- "count_one": "{{count}} 个任务",- "count_other": "{{count}} 个任务"+ "name": "TaskCreate"},"grep": {"name": "Grep"+ },+ "summary": {+ "separator": ",",+ "bash_one": "执行 {{count}} 次脚本",+ "bash_other": "执行 {{count}} 次脚本",+ "read_one": "读取 {{count}} 个文件",+ "read_other": "读取 {{count}} 个文件",+ "edit_one": "编辑 {{count}} 个文件",+ "edit_other": "编辑 {{count}} 个文件",+ "search_one": "搜索 {{count}} 个模式",+ "search_other": "搜索 {{count}} 个模式",+ "todo_one": "更新 {{count}} 项待办",+ "todo_other": "更新 {{count}} 项待办",+ "mcp_one": "调用 {{count}} 次 MCP",+ "mcp_other": "调用 {{count}} 次 MCP",+ "fallback_one": "调用 {{count}} 次工具",+ "fallback_other": "调用 {{count}} 次工具"}},"textInput": {@@ -129,28 +143,49 @@"identity": {"legend": "Agent 身份","description": "定义此 Agent 行为的名称和指令。",- "name": { "label": "名称", "placeholder": "我的 Agent" },- "system-prompt": { "label": "系统提示词" }+ "name": {+ "label": "名称",+ "placeholder": "我的 Agent"+ },+ "system-prompt": {+ "label": "系统提示词"+ }},"context-config": {"legend": "上下文配置","description": "控制上下文窗口的管理和压缩方式。",- "trigger-ratio": { "label": "触发比例" },- "reserve-ratio": { "label": "保留比例" },- "tool-result-limit": { "label": "工具结果限制" },- "compression-prompt": { "label": "压缩提示词" },- "summary-template": { "label": "摘要模板" }+ "trigger-ratio": {+ "label": "触发比例"+ },+ "reserve-ratio": {+ "label": "保留比例"+ },+ "tool-result-limit": {+ "label": "工具结果限制"+ },+ "compression-prompt": {+ "label": "压缩提示词"+ },+ "summary-template": {+ "label": "摘要模板"+ }},"react-config": {"legend": "ReAct 配置","description": "控制推理和行动循环的行为。",- "max-iters": { "label": "最大迭代次数" },- "stop-on-reject": { "label": "拒绝时停止" }+ "max-iters": {+ "label": "最大迭代次数"+ },+ "stop-on-reject": {+ "label": "拒绝时停止"+ }},"invite-config": {"legend": "邀请配置","description": "控制此 Agent 是否可被其他 Agent 通过 AgentInvite 邀请。",- "invitable": { "label": "允许被邀请" },+ "invitable": {+ "label": "允许被邀请"+ },"invite-description": {"label": "邀请说明","placeholder": "简要描述此 Agent 的专长;允许被邀请时必填。"diff --git a/examples/web_ui/pnpm-lock.yaml b/examples/web_ui/pnpm-lock.yamlindex ceffa978e..e70e38356 100644--- a/examples/web_ui/pnpm-lock.yaml+++ b/examples/web_ui/pnpm-lock.yaml@@ -133,8 +133,8 @@ importers:specifier: ^4.0.1version: 4.0.1shadcn:- specifier: ^4.7.0+ specifier: ^4.13.0+ version: 4.13.0(@cfworker/[email protected])([email protected])shadcn-prose:specifier: ^1.2.1version: 1.2.1@@ -159,7 +159,7 @@ importers:devDependencies:'@eslint/js':specifier: ^10.0.1- version: 10.0.1([email protected]([email protected]))'@tailwindcss/typography':specifier: ^0.5.19version: 0.5.19([email protected])@@ -180,16 +180,16 @@ importers:eslint:specifier: ^10.3.0- version: 10.3.0([email protected])+ version: 10.3.0([email protected])([email protected])eslint-plugin-import-x:specifier: ^4.16.2- version: 4.16.2(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))+ version: 4.16.2(@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected]))([email protected]([email protected])([email protected]))([email protected])eslint-plugin-react-hooks:specifier: ^7.1.1- version: 7.1.1([email protected]([email protected]))eslint-plugin-react-refresh:specifier: ^0.5.2- version: 0.5.2([email protected]([email protected]))globals:specifier: ^17.6.0version: 17.6.0@@ -198,7 +198,7 @@ importers:version: 6.0.3typescript-eslint:specifier: ^8.59.2+ version: 8.59.3([email protected]([email protected])([email protected]))([email protected])([email protected])vite:specifier: ^8.0.12@@ -609,41 +609,6 @@ packages:cpu: [x64]os: [win32]- '@inquirer/[email protected]':- resolution: {integrity: sha512-doc2sWgJpbFQ64UflSVd17ibMGDuxO1yKgOgLMwavzESnXjFWJqUeG8saYosqKpHp4kWiM5x1nXvEjbpx90gzw==}- engines: {node: '>=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0'}-- '@inquirer/[email protected]':- resolution: {integrity: sha512-wkGPC7yJ5WJk1DJ5SX7fzk+gfj4BM8cf5dDDi71B/551xHrdsZVRJOC0WyikXd0pEsb/9cLniuE4atbsMqmFkw==}- engines: {node: '>=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0'}- peerDependencies:- '@types/node': '>=18'- peerDependenciesMeta:- '@types/node':- optional: true-- '@inquirer/[email protected]':- resolution: {integrity: sha512-a4Q5BXHQAHa9eO202sTaFCHFYVB3x5fauDuThEAdZ9gfn76pSxiKU7wWcEH0N1O0XmQvNfQNU6QXpiRxmYQx+A==}- engines: {node: '>=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0'}- peerDependencies:- '@types/node': '>=18'- peerDependenciesMeta:- '@types/node':- optional: true-- '@inquirer/[email protected]':- resolution: {integrity: sha512-NsSs4kzfm12lNetHwAn3GEuH317IzpwrMCbOuMIVytpjnJ90YYHNwdRgYGuKmVxwuIqSgqk3M5qqQt1cDk0tGQ==}- engines: {node: '>=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0'}-- '@inquirer/[email protected]':- resolution: {integrity: sha512-aetVUNeKNc/VriqXlw1NRSW0zhMBB0W4bNbWRJgzRl/3d0QNDQFfk0GO5SDdtjMZVg6o8ZKEiadd7SCCzoOn5Q==}- engines: {node: '>=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0'}- peerDependencies:- '@types/node': '>=18'- peerDependenciesMeta:- '@types/node':- optional: true-'@jridgewell/[email protected]':resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}@@ -673,10 +638,6 @@ packages:'@cfworker/json-schema':optional: true- '@mswjs/[email protected]':- resolution: {integrity: sha512-VVPPgHyQ6ShqnrmDWuxjmUIsO9gWyOZFmuOfLd9LfBGQJwZfy0gvv9pbHSJuoFNIYC7ZDX9aoFwowjcdSC4E8w==}- engines: {node: '>=18'}-'@napi-rs/[email protected]':resolution: {integrity: sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==}@@ -765,18 +726,6 @@ packages:resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}engines: {node: '>= 8'}- '@open-draft/[email protected]':- resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==}-- '@open-draft/[email protected]':- resolution: {integrity: sha512-XW375UK8/9SqUVNVa6M0yEy8+iTi4QN5VZ7aZuRFQmy76LRwI9wy5F4YIBU6T+eTe2/DNDo8tqu8RHlwLHM6RA==}-- '@open-draft/[email protected]':- resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==}-- '@open-draft/[email protected]':- resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}-'@oxc-project/[email protected]':resolution: {integrity: sha512-ibD2usx9JRu7f5pu2tMKMI4cpA4NgXJQoYRP4pQ7Pxmn1l6k/53qWtQWZayhYy3X4QZkt90Ot+mJEaeXouio6Q==}@@ -1859,12 +1808,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==}- '@types/[email protected]':- resolution: {integrity: sha512-GGmQVGpQWUe5qglJozEjZV/5dyxbOOZ0LHe/lqyWssB88Y4svNfst0uqBVscdDeIKl5Jy5+aPSvy7mI9tYRguw==}-- '@types/[email protected]':- resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==}-'@types/[email protected]':resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==}@@ -2074,10 +2017,6 @@ packages:engines: {node: '>=0.4.0'}hasBin: true- resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==}- engines: {node: '>= 14'}-resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}peerDependencies:@@ -2143,11 +2082,6 @@ packages:resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}engines: {node: 18 || 20 || >=22}- resolution: {integrity: sha512-Asa2krT+XTPZINCS+2QcyS8WTkObE77RwkydwF7h6DmnKqbvlalz93m/dnphUyCa6SWSP51VgtEUf2FN+gelFQ==}- engines: {node: '>=6.0.0'}- hasBin: true-resolution: {integrity: sha512-bA6+tcSLpz2tIEdDXZPpPTIuxBcC4+w6SieaYyfigIa4h8GlFxbA17v22Vx3JUtuZQj9SgOsnbK+aTBzyDyEuw==}engines: {node: '>=6.0.0'}@@ -2202,9 +2136,6 @@ packages:resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==}engines: {node: '>=10'}- resolution: {integrity: sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==}-resolution: {integrity: sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==}@@ -2253,10 +2184,6 @@ packages:resolution: {integrity: sha512-xRwvIOMGrfOAnM1JYtqQImuaNtDEv9v6oIYAs4LIHwTiKee8uwvIi363igssOC0O5U04i4AlENs79LQLu9tEMw==}engines: {node: '>=20'}- resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==}- engines: {node: '>= 12'}-resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}@@ -2373,10 +2300,6 @@ packages:resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}- resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}- engines: {node: '>= 12'}-resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}engines: {node: '>=0.11'}@@ -2711,18 +2634,9 @@ packages:resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}- resolution: {integrity: sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==}-- resolution: {integrity: sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==}-resolution: {integrity: sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ==}- resolution: {integrity: sha512-rLV8JHxTyhVmFYhBJuMujcrHqOT2cnO5Zxj37qROj23CP39GXubJRBUFF0z8KFK77Uc0SukZUf7JZhsVEQ6n8w==}-resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==}@@ -2735,10 +2649,6 @@ packages:picomatch:optional: true- resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}- engines: {node: ^12.20 || >= 14.13}-resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==}engines: {node: '>=18'}@@ -2770,10 +2680,6 @@ packages:resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==}- resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}- engines: {node: '>=12.20.0'}-resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}engines: {node: '>= 0.6'}@@ -2876,10 +2782,6 @@ packages:resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}- resolution: {integrity: sha512-BBvQ/406p+4CZbTpCbVPSxfzrZrbnuWSP1ELYgyS6B+hNeKzgrdB4JczCa5VZUBQrDa9hUngm0KnexY6pJRN5Q==}- engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}-resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}engines: {node: '>=6.0'}@@ -2906,9 +2808,6 @@ packages:resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}- resolution: {integrity: sha512-1TJ6Fih/b8h5TIcv+1+Hw0PDQWJTKDKzFZzcKOiW1wJza3XoAQlkCuXLbymPYB8+ZQyw8mHvdw560e8zVFIWyA==}-resolution: {integrity: sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==}@@ -2929,10 +2828,6 @@ packages:resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}engines: {node: '>= 0.8'}- resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}- engines: {node: '>= 14'}-resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}engines: {node: '>=10.17.0'}@@ -3055,9 +2950,6 @@ packages:resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==}engines: {node: '>=12'}- resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==}-resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}engines: {node: '>=0.12.0'}@@ -3522,20 +3414,6 @@ packages:resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}- resolution: {integrity: sha512-ALe+N10S72cyx94cMcy3Zs4HhXCj35sgeAL4c+WTvKi0zWnbd8/h0lcFqv0mb2P+aSgAdD7p9HzvA0DiUPxsyg==}- engines: {node: '>=18'}- hasBin: true- peerDependencies:- typescript: '>= 4.8.x'- peerDependenciesMeta:- typescript:- optional: true-- resolution: {integrity: sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw==}- engines: {node: ^20.17.0 || >=22.9.0}-resolution: {integrity: sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==}engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}@@ -3587,15 +3465,6 @@ packages:resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==}- resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}- engines: {node: '>=10.5.0'}- deprecated: Use your platform's native DOMException instead-- resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==}- engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}-resolution: {integrity: sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==}@@ -3678,9 +3547,6 @@ packages:resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}engines: {node: '>=18'}- resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==}-resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}engines: {node: '>=10'}@@ -3726,9 +3592,6 @@ packages:resolution: {integrity: sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==}- resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==}-resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==}@@ -3976,9 +3839,6 @@ packages:resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==}engines: {node: '>=18'}- resolution: {integrity: sha512-ILJRqVWBCTlg9r42fFgwVZx1gnFAcQF8mRoMkbgQfIrjEDf9nbBFDFx00oloOa+Q869FUtaYDXZvEfnecQSCoQ==}-resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==}engines: {iojs: '>=1.0.0', node: '>=0.10.0'}@@ -4051,9 +3911,6 @@ packages:resolution: {integrity: sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==}- resolution: {integrity: sha512-kjnC1DXBHcxaOaOXBHBeRtltsDG2nUiUni+jP92M9gYdW12rsmx92UsfpH7o5tDRs7I1ZZPSQJQGv3UaRfCiuw==}-resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}@@ -4061,8 +3918,9 @@ packages:resolution: {integrity: sha512-WKYSb3lZ4/iC7YPrZP8HeO1ywQJE94iuBrTaUmPm0C3tPrM+ymWVmKyuzabCTtAkqWQAPOO7SOB40UcDuzsxyw==}deprecated: 'You can now install this as a shadcn component with: npx kibo-ui add typography'- resolution: {integrity: sha512-70fwnesNrY1GgeD7Kdzn+3SsYeyfibm8immsA5L68+OusoPTvYF01oWExl8/latKpMpvVXcbgdbbE6VFBJQ38w==}+ resolution: {integrity: sha512-5fuJ4jI/GcPeA/iTL4cJivCZuYQGXz/N3bIzyd+Gd/FM6xUCy2MxGG+LaDQuw2cjNy9zGPSFPTEmI048UwPTZA==}+ engines: {node: '>=20.18.1'}hasBin: true@@ -4160,9 +4018,6 @@ packages:resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==}engines: {node: '>=18'}- resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==}-resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}engines: {node: '>=0.6.19'}@@ -4251,10 +4106,6 @@ packages:resolution: {integrity: sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==}engines: {node: ^14.18.0 || >=16.0.0}- resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}- engines: {node: '>=20'}-resolution: {integrity: sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==}@@ -4276,13 +4127,6 @@ packages:resolution: {integrity: sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==}engines: {node: '>=12.0.0'}- resolution: {integrity: sha512-uiHN8PIB1VmWyS98eZYja4xzlYqeFZVjb4OuYlJQnZAuJhMw4PbKQOKgHKhBdJR3FE/t5mUQ1Kd80++B+qhD1Q==}-- resolution: {integrity: sha512-ELrFxuqsDdHUwoh0XxDbxuLD3Wnz49Z57IFvTtvWy1hJdcMZjXLIuonjilCiWHlT2GbE4Wlv1wKVTzDFnXH1aw==}- hasBin: true-resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}engines: {node: '>=8.0'}@@ -4295,10 +4139,6 @@ packages:resolution: {integrity: sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==}hasBin: true- resolution: {integrity: sha512-LktZQb3IeoUWB9lqR5EWTHgW/VTITCXg4D21M+lvybRVdylLrRMnqaIONLVb5mav8vM19m44HIcGq4qASeu2Qw==}- engines: {node: '>=16'}-resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}hasBin: true@@ -4346,10 +4186,6 @@ packages:resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}engines: {node: '>= 0.8.0'}- resolution: {integrity: sha512-8ZiHFm91orbSAe2PSAiSVBVko18pbhbiB3U9GglSzF/zCGkR+rxpHx6sEMCUm4kxY4LjDIUGgCfUMtwfZfjfUA==}- engines: {node: '>=20'}-resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}engines: {node: '>= 0.6'}@@ -4384,6 +4220,10 @@ packages:resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}+ resolution: {integrity: sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA==}+ engines: {node: '>=20.18.1'}+resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==}engines: {node: '>=18'}@@ -4420,9 +4260,6 @@ packages:resolution: {integrity: sha512-bSjt9pjaEBnNiGgc9rUiHGKv5l4/TGzDmYw3RhnkJGtLhbnnA/5qJj7x3dNDCRx/PJxu774LlH8lCOlB4hEfKg==}- resolution: {integrity: sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw==}-resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==}hasBin: true@@ -4546,10 +4383,6 @@ packages:resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==}- resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==}- engines: {node: '>= 8'}-resolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==}@@ -4890,6 +4723,11 @@ snapshots:tslib: 2.8.1optional: true+ dependencies:+ eslint: 10.3.0([email protected])([email protected])+ eslint-visitor-keys: 3.4.3+dependencies:eslint: 10.3.0([email protected])@@ -4897,7 +4735,7 @@ snapshots:'@eslint-community/[email protected]': {}- '@eslint/[email protected]':+ '@eslint/[email protected]([email protected])':dependencies:'@eslint/object-schema': 3.0.5debug: 4.4.3([email protected])@@ -4913,9 +4751,9 @@ snapshots:dependencies:'@types/json-schema': 7.0.15optionalDependencies:- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])'@eslint/[email protected]': {}@@ -5060,33 +4898,6 @@ snapshots:'@img/[email protected]':optional: true- '@inquirer/[email protected]': {}-- '@inquirer/[email protected](@types/[email protected])':- dependencies:- '@inquirer/core': 11.1.10(@types/[email protected])- '@inquirer/type': 4.0.5(@types/[email protected])- optionalDependencies:- '@types/node': 24.12.4-- '@inquirer/[email protected](@types/[email protected])':- dependencies:- '@inquirer/ansi': 2.0.5- '@inquirer/figures': 2.0.5- '@inquirer/type': 4.0.5(@types/[email protected])- cli-width: 4.1.0- fast-wrap-ansi: 0.2.0- mute-stream: 3.0.0- signal-exit: 4.1.0- optionalDependencies:- '@types/node': 24.12.4-- '@inquirer/[email protected]': {}-- '@inquirer/[email protected](@types/[email protected])':- optionalDependencies:- '@types/node': 24.12.4-'@jridgewell/[email protected]':dependencies:'@jridgewell/sourcemap-codec': 1.5.5@@ -5159,15 +4970,6 @@ snapshots:transitivePeerDependencies:- supports-color- '@mswjs/[email protected]':- dependencies:- '@open-draft/deferred-promise': 2.2.0- '@open-draft/logger': 0.3.0- '@open-draft/until': 2.1.0- is-node-process: 1.2.0- outvariant: 1.4.3- strict-event-emitter: 0.5.1-'@napi-rs/[email protected]':dependencies:'@emnapi/core': 1.10.0@@ -5228,17 +5030,6 @@ snapshots:'@nodelib/fs.scandir': 2.1.5fastq: 1.20.1- '@open-draft/[email protected]': {}-- '@open-draft/[email protected]': {}-- '@open-draft/[email protected]':- dependencies:- is-node-process: 1.2.0- outvariant: 1.4.3-- '@open-draft/[email protected]': {}-'@oxc-project/[email protected]': {}'@package-json/[email protected]': {}@@ -6313,27 +6104,21 @@ snapshots:'@types/node': 20.19.41'@types/send': 0.17.6- '@types/[email protected]':- dependencies:- '@types/node': 24.12.4-- '@types/[email protected]': {}-'@types/[email protected]': {}'@types/[email protected]': {}'@types/[email protected]': {}- '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])':+ '@typescript-eslint/[email protected](@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected]))([email protected])([email protected])':dependencies:'@eslint-community/regexpp': 4.12.2+ '@typescript-eslint/parser': 8.59.3([email protected]([email protected])([email protected]))([email protected])([email protected])'@typescript-eslint/scope-manager': 8.59.3+ '@typescript-eslint/type-utils': 8.59.3([email protected]([email protected])([email protected]))([email protected])([email protected])+ '@typescript-eslint/utils': 8.59.3([email protected]([email protected])([email protected]))([email protected])'@typescript-eslint/visitor-keys': 8.59.3- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])ignore: 7.0.5natural-compare: 1.4.0ts-api-utils: 2.5.0([email protected])@@ -6341,14 +6126,14 @@ snapshots:transitivePeerDependencies:- supports-color+ '@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected])([email protected])':dependencies:'@typescript-eslint/scope-manager': 8.59.3'@typescript-eslint/types': 8.59.3'@typescript-eslint/typescript-estree': 8.59.3([email protected])'@typescript-eslint/visitor-keys': 8.59.3debug: 4.4.3([email protected])- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-color@@ -6371,13 +6156,13 @@ snapshots:dependencies:typescript: 6.0.3+ '@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected])([email protected])':dependencies:'@typescript-eslint/types': 8.59.3'@typescript-eslint/typescript-estree': 8.59.3([email protected])+ '@typescript-eslint/utils': 8.59.3([email protected]([email protected])([email protected]))([email protected])debug: 4.4.3([email protected])- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])ts-api-utils: 2.5.0([email protected])typescript: 6.0.3transitivePeerDependencies:@@ -6393,20 +6178,20 @@ snapshots:'@typescript-eslint/visitor-keys': 8.59.3debug: 4.4.3([email protected])minimatch: 10.2.5- semver: 7.8.0+ semver: 7.8.1tinyglobby: 0.2.16ts-api-utils: 2.5.0([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-color+ '@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected])':dependencies:- '@eslint-community/eslint-utils': 4.9.1([email protected]([email protected]))'@typescript-eslint/scope-manager': 8.59.3'@typescript-eslint/types': 8.59.3'@typescript-eslint/typescript-estree': 8.59.3([email protected])- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-color@@ -6502,8 +6287,6 @@ snapshots:- [email protected]: {}-optionalDependencies:ajv: 8.20.0@@ -6563,8 +6346,6 @@ snapshots:- [email protected]: {}-@@ -6610,8 +6391,8 @@ snapshots:dependencies:- baseline-browser-mapping: 2.10.29- caniuse-lite: 1.0.30001792+ baseline-browser-mapping: 2.10.33+ caniuse-lite: 1.0.30001793electron-to-chromium: 1.5.355node-releases: 2.0.44update-browserslist-db: 1.2.3([email protected])@@ -6636,8 +6417,6 @@ snapshots:- [email protected]: {}-@@ -6686,8 +6465,6 @@ snapshots:slice-ansi: 8.0.0string-width: 8.2.1- [email protected]: {}-@@ -6785,8 +6562,6 @@ snapshots:- [email protected]: {}-dependencies:'@babel/runtime': 7.29.2@@ -6916,13 +6691,13 @@ snapshots:optionalDependencies:unrs-resolver: 1.11.1- [email protected](@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected])):+ [email protected](@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected]))([email protected]([email protected])([email protected]))([email protected]):dependencies:'@package-json/types': 0.0.12'@typescript-eslint/types': 8.59.3comment-parser: 1.4.6debug: 4.4.3([email protected])- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])eslint-import-context: 0.1.9([email protected])is-glob: 4.0.3minimatch: 10.2.5@@ -6930,7 +6705,7 @@ snapshots:stable-hash-x: 0.2.0unrs-resolver: 1.11.1optionalDependencies:+ '@typescript-eslint/utils': 8.59.3([email protected]([email protected])([email protected]))([email protected])transitivePeerDependencies:- supports-color@@ -6943,20 +6718,20 @@ snapshots:optionalDependencies:eslint-config-prettier: 10.1.8([email protected]([email protected]))dependencies:'@babel/core': 7.29.0'@babel/parser': 7.29.3- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])hermes-parser: 0.25.1zod: 4.4.3zod-validation-error: 4.0.2([email protected])transitivePeerDependencies:- supports-colordependencies:- eslint: 10.3.0([email protected])+ eslint: 10.3.0([email protected])([email protected])dependencies:@@ -6973,7 +6748,44 @@ snapshots:dependencies:'@eslint-community/eslint-utils': 4.9.1([email protected]([email protected]))'@eslint-community/regexpp': 4.12.2- '@eslint/config-array': 0.23.5+ '@eslint/config-array': 0.23.5([email protected])+ '@eslint/config-helpers': 0.5.5+ '@eslint/core': 1.2.1+ '@eslint/plugin-kit': 0.7.1+ '@humanfs/node': 0.16.8+ '@humanwhocodes/module-importer': 1.0.1+ '@humanwhocodes/retry': 0.4.3+ '@types/estree': 1.0.9+ ajv: 6.15.0+ cross-spawn: 7.0.6+ debug: 4.4.3([email protected])+ escape-string-regexp: 4.0.0+ eslint-scope: 9.1.2+ eslint-visitor-keys: 5.0.1+ espree: 11.2.0+ esquery: 1.7.0+ esutils: 2.0.3+ fast-deep-equal: 3.1.3+ file-entry-cache: 8.0.0+ find-up: 5.0.0+ glob-parent: 6.0.2+ ignore: 5.3.2+ imurmurhash: 0.1.4+ is-glob: 4.0.3+ json-stable-stringify-without-jsonify: 1.0.1+ minimatch: 10.2.5+ natural-compare: 1.4.0+ optionator: 0.9.4+ optionalDependencies:+ jiti: 2.7.0+ transitivePeerDependencies:+ - supports-color++ dependencies:+ '@eslint-community/regexpp': 4.12.2+ '@eslint/config-array': 0.23.5([email protected])'@eslint/config-helpers': 0.5.5'@eslint/core': 1.2.1'@eslint/plugin-kit': 0.7.1@@ -7163,18 +6975,8 @@ snapshots:- [email protected]: {}-- dependencies:- fast-string-truncated-width: 3.0.3-- dependencies:- fast-string-width: 3.0.2-dependencies:reusify: 1.1.0@@ -7183,11 +6985,6 @@ snapshots:optionalDependencies:picomatch: 4.0.4- dependencies:- node-domexception: 1.0.0- web-streams-polyfill: 3.3.3-dependencies:is-unicode-supported: 2.1.0@@ -7235,10 +7032,6 @@ snapshots:- dependencies:- fetch-blob: 3.2.0-@@ -7322,8 +7115,6 @@ snapshots:- [email protected]: {}-dependencies:js-yaml: 3.14.2@@ -7365,11 +7156,6 @@ snapshots:dependencies:'@types/hast': 3.0.4- dependencies:- '@types/set-cookie-parser': 2.4.10- set-cookie-parser: 3.1.0-@@ -7392,13 +7178,6 @@ snapshots:statuses: 2.0.2toidentifier: 1.0.1- dependencies:- agent-base: 7.1.4- debug: 4.4.3([email protected])- transitivePeerDependencies:- - supports-color-@@ -7483,8 +7262,6 @@ snapshots:- [email protected]: {}-@@ -8081,33 +7858,6 @@ snapshots:- dependencies:- '@inquirer/confirm': 6.0.13(@types/[email protected])- '@mswjs/interceptors': 0.41.9- '@open-draft/deferred-promise': 3.0.0- '@types/statuses': 2.0.6- cookie: 1.1.1- graphql: 16.14.0- headers-polyfill: 5.0.1- is-node-process: 1.2.0- outvariant: 1.4.3- path-to-regexp: 6.3.0- picocolors: 1.1.1- rettime: 0.11.11- statuses: 2.0.2- strict-event-emitter: 0.5.1- tough-cookie: 6.0.1- type-fest: 5.6.0- until-async: 3.0.2- yargs: 17.7.2- optionalDependencies:- typescript: 6.0.3- transitivePeerDependencies:- - '@types/node'-- [email protected]: {}-@@ -8152,14 +7902,6 @@ snapshots:lower-case: 2.0.2tslib: 2.8.1- [email protected]: {}-- dependencies:- data-uri-to-buffer: 4.0.1- fetch-blob: 3.2.0- formdata-polyfill: 4.0.10-@@ -8254,8 +7996,6 @@ snapshots:string-width: 7.2.0strip-ansi: 7.2.0- [email protected]: {}-dependencies:yocto-queue: 0.1.0@@ -8299,8 +8039,6 @@ snapshots:- [email protected]: {}-@@ -8609,8 +8347,6 @@ snapshots:onetime: 7.0.0signal-exit: 4.1.0- [email protected]: {}-@@ -8671,8 +8407,7 @@ snapshots:- optional: true+ [email protected]: {}dependencies:@@ -8728,13 +8463,11 @@ snapshots:- [email protected]: {}-dependencies:'@babel/core': 7.29.0'@babel/parser': 7.29.3@@ -8753,10 +8486,7 @@ snapshots:fast-glob: 3.3.3fs-extra: 11.3.5fuzzysort: 3.1.0- https-proxy-agent: 7.0.6kleur: 4.1.5- msw: 2.14.6(@types/[email protected])([email protected])- node-fetch: 3.3.2open: 11.0.0ora: 8.2.0postcss: 8.5.14@@ -8767,12 +8497,12 @@ snapshots:tailwind-merge: 3.6.0ts-morph: 26.0.0tsconfig-paths: 4.2.0+ undici: 7.28.0validate-npm-package-name: 7.0.2zod: 3.25.76zod-to-json-schema: 3.25.2([email protected])transitivePeerDependencies:- '@cfworker/json-schema'- - '@types/node'- babel-plugin-macros- supports-color- typescript@@ -8893,8 +8623,6 @@ snapshots:- [email protected]: {}-@@ -8976,8 +8704,6 @@ snapshots:dependencies:'@pkgr/core': 0.2.9- [email protected]: {}-@@ -8993,12 +8719,6 @@ snapshots:fdir: 6.5.0([email protected])picomatch: 4.0.4- [email protected]: {}-- dependencies:- tldts-core: 7.0.30-dependencies:is-number: 7.0.0@@ -9007,10 +8727,6 @@ snapshots:- dependencies:- tldts: 7.0.30-@@ -9058,10 +8774,6 @@ snapshots:dependencies:prelude-ls: 1.2.1- dependencies:- tagged-tag: 1.0.0-dependencies:media-typer: 0.3.0@@ -9073,13 +8785,13 @@ snapshots:media-typer: 1.1.0mime-types: 3.0.2+ [email protected]([email protected]([email protected])([email protected]))([email protected])([email protected]):dependencies:- '@typescript-eslint/eslint-plugin': 8.59.3(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])+ '@typescript-eslint/eslint-plugin': 8.59.3(@typescript-eslint/[email protected]([email protected]([email protected])([email protected]))([email protected])([email protected]))([email protected]([email protected])([email protected]))([email protected])([email protected])+ '@typescript-eslint/parser': 8.59.3([email protected]([email protected])([email protected]))([email protected])([email protected])'@typescript-eslint/typescript-estree': 8.59.3([email protected])- eslint: 10.3.0([email protected])+ '@typescript-eslint/utils': 8.59.3([email protected]([email protected])([email protected]))([email protected])+ eslint: 10.3.0([email protected])([email protected])typescript: 6.0.3transitivePeerDependencies:- supports-color@@ -9094,6 +8806,8 @@ snapshots:+ [email protected]: {}+@@ -9161,8 +8875,6 @@ snapshots:'@unrs/resolver-binding-win32-ia32-msvc': 1.11.1'@unrs/resolver-binding-win32-x64-msvc': 1.11.1- [email protected]: {}-dependencies:browserslist: 4.28.2@@ -9253,8 +8965,6 @@ snapshots:dependencies:loose-envify: 1.4.0- [email protected]: {}-diff --git a/examples/web_ui/pnpm-workspace.yaml b/examples/web_ui/pnpm-workspace.yamlindex a71fb1f9e..a117085b3 100644--- a/examples/web_ui/pnpm-workspace.yaml+++ b/examples/web_ui/pnpm-workspace.yaml@@ -2,5 +2,10 @@ packages:- frontend- backend+allowBuilds:+ msw: false+ sharp: false+ unrs-resolver: false+ignoredBuiltDependencies:- mswdiff --git a/src/agentscope/agent/_agent.py b/src/agentscope/agent/_agent.pyindex d9c982b0e..b15128a2e 100644--- a/src/agentscope/agent/_agent.py+++ b/src/agentscope/agent/_agent.py@@ -632,16 +632,19 @@ class Agent:)for index in awaiting_tool_calls.values():- # First update the status- assert isinstance(last_msg.content[index], ToolCallBlock)- last_msg.content[index].state = ToolCallState.FINISHED+ call_block = last_msg.content[index]+ assert isinstance(call_block, ToolCallBlock)- # Emit the full tool_result lifecycle (START → DELTA → END)- yield ToolResultStartEvent(- reply_id=self.state.reply_id,- tool_call_id=last_msg.content[index].id,- tool_call_name=last_msg.content[index].name,- )+ # An ALLOWED call was already running, so its START was already+ # emitted — skip it here (checked before flipping to FINISHED).+ if call_block.state != ToolCallState.ALLOWED:+ yield ToolResultStartEvent(+ reply_id=self.state.reply_id,+ tool_call_id=last_msg.content[index].id,+ tool_call_name=last_msg.content[index].name,+ )++ call_block.state = ToolCallState.FINISHEDyield ToolResultTextDeltaEvent(reply_id=self.state.reply_id,tool_call_id=last_msg.content[index].id,diff --git a/src/agentscope/app/_service/_chat.py b/src/agentscope/app/_service/_chat.pyindex 8d93cff31..655c9aecb 100644--- a/src/agentscope/app/_service/_chat.py+++ b/src/agentscope/app/_service/_chat.py@@ -558,17 +558,9 @@ class ChatService:)async for event in agent.reply_stream(inputs=input_msg):- await publish_session_event(- self._message_bus,- session_id,- event.model_dump(mode="json"),- )- await self._project_event(- user_id,- session_record,- agent_record,- event,- )+ # Apply to reply_msg FIRST (sync — never+ # interrupted), so an interrupt in the awaits below+ # can't lose this event.if isinstance(event, ReplyStartEvent):reply_msg = AssistantMsg(id=event.reply_id,@@ -577,6 +569,27 @@ class ChatService:)elif reply_msg is not None:reply_msg.append_event(event)+ try:+ await publish_session_event(+ self._message_bus,+ session_id,+ event.model_dump(mode="json"),+ )+ await self._project_event(+ user_id,+ session_record,+ agent_record,+ event,+ )+ except asyncio.CancelledError:+ # Interrupt landed here, not at ``__anext__``.+ # Re-arm it so it's redelivered into the agent at+ # the next ``__anext__`` (which runs its+ # interruption cleanup) instead of abandoning the+ # generator and dropping that cleanup.+ current = asyncio.current_task()+ if current is not None:+ current.cancel()else:# Case B: continuation (UserConfirmResult@@ -599,19 +612,28 @@ class ChatService:reply_msg.append_event(input_msg)async for event in agent.reply_stream(inputs=input_msg):- await publish_session_event(- self._message_bus,- session_id,- event.model_dump(mode="json"),- )- await self._project_event(- user_id,- session_record,- agent_record,- event,- )+ # Apply to the persisted reply FIRST (synchronous),+ # then publish/project — see Case A above.if reply_msg is not None:reply_msg.append_event(event)+ try:+ await publish_session_event(+ self._message_bus,+ session_id,+ event.model_dump(mode="json"),+ )+ await self._project_event(+ user_id,+ session_record,+ agent_record,+ event,+ )+ except asyncio.CancelledError:+ # See Case A: redirect an interrupt landing here+ # back into the agent via the next ``__anext__``.+ current = asyncio.current_task()+ if current is not None:+ current.cancel()finally:# All persistence in a single coroutine, shielded from