🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(shared-tool-ui): add keyboard shortcuts and select-to-submit to AskUserQuestion (#17903)
YuTengjing3f5f1d30a462
diff --git a/locales/en-US/tool.json b/locales/en-US/tool.jsonindex 4020bdc11d1..929649d0dd7 100644--- a/locales/en-US/tool.json+++ b/locales/en-US/tool.json@@ -46,6 +46,7 @@"askUserQuestion.escape.enter": "Or type directly","askUserQuestion.escape.placeholder": "Type your answer here…","askUserQuestion.multiSelectTag": "(multi-select)",+ "askUserQuestion.recommendedTag": "Recommended","askUserQuestion.skip": "Skip","askUserQuestion.submit": "Submit","claudeCode.askUserQuestion.customOption.placeholder": "Or write your own…",@@ -53,6 +54,7 @@"claudeCode.askUserQuestion.escape.enter": "Or type directly","claudeCode.askUserQuestion.escape.placeholder": "Type your answer here…","claudeCode.askUserQuestion.multiSelectTag": "(multi-select)",+ "claudeCode.askUserQuestion.recommendedTag": "Recommended","claudeCode.askUserQuestion.skip": "Skip","claudeCode.askUserQuestion.submit": "Submit","claudeCode.askUserQuestion.timeExpired": "Time expired — using option 1 of each question.",diff --git a/locales/zh-CN/tool.json b/locales/zh-CN/tool.jsonindex 379490e826c..6920920ef42 100644--- a/locales/zh-CN/tool.json+++ b/locales/zh-CN/tool.json@@ -46,6 +46,7 @@"askUserQuestion.escape.enter": "或直接输入","askUserQuestion.escape.placeholder": "在此输入你的回复…","askUserQuestion.multiSelectTag": "(多选)",+ "askUserQuestion.recommendedTag": "推荐","askUserQuestion.skip": "跳过","askUserQuestion.submit": "提交","claudeCode.askUserQuestion.customOption.placeholder": "或自己输入…",@@ -53,6 +54,7 @@"claudeCode.askUserQuestion.escape.enter": "或直接输入","claudeCode.askUserQuestion.escape.placeholder": "在此输入你的回复…","claudeCode.askUserQuestion.multiSelectTag": "(多选)",+ "claudeCode.askUserQuestion.recommendedTag": "推荐","claudeCode.askUserQuestion.skip": "跳过","claudeCode.askUserQuestion.submit": "提交","claudeCode.askUserQuestion.timeExpired": "已超时——将使用每题的选项 1。",diff --git a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsxindex bfb090d12a5..d50c1656d9c 100644--- a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx+++ b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx@@ -60,6 +60,7 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestioescapeEnter: t('claudeCode.askUserQuestion.escape.enter'),escapePlaceholder: t('claudeCode.askUserQuestion.escape.placeholder'),multiSelectTag: t('claudeCode.askUserQuestion.multiSelectTag'),+ recommendedTag: t('claudeCode.askUserQuestion.recommendedTag'),skip: t('claudeCode.askUserQuestion.skip'),submit: t('claudeCode.askUserQuestion.submit'),timeExpired: t('claudeCode.askUserQuestion.timeExpired'),diff --git a/packages/builtin-tool-claude-code/src/client/Render/AskUserQuestion/index.tsx b/packages/builtin-tool-claude-code/src/client/Render/AskUserQuestion/index.tsxindex f9d5cdc6284..fd809209343 100644--- a/packages/builtin-tool-claude-code/src/client/Render/AskUserQuestion/index.tsx+++ b/packages/builtin-tool-claude-code/src/client/Render/AskUserQuestion/index.tsx@@ -22,7 +22,7 @@ import type { AskUserQuestionArgs } from '../../../types';const AskUserQuestion = memo<BuiltinRenderProps<AskUserQuestionArgs, AskUserQuestionResultState, string>>(({ args, content, pluginError, pluginState }) => {- const { t } = useTranslation('plugin');+ const { t } = useTranslation(['plugin', 'tool']);return (<AskUserQuestionResult@@ -30,8 +30,9 @@ const AskUserQuestion = memo<isError={!!pluginError}questions={normalizeAskUserQuestions(args)}labels={{- noAnswer: t('builtins.lobe-claude-code.askUserQuestion.noAnswer'),- notAnswered: t('builtins.lobe-claude-code.askUserQuestion.notAnswered'),+ noAnswer: t('plugin:builtins.lobe-claude-code.askUserQuestion.noAnswer'),+ notAnswered: t('plugin:builtins.lobe-claude-code.askUserQuestion.notAnswered'),+ recommendedTag: t('tool:claudeCode.askUserQuestion.recommendedTag'),}}/>);diff --git a/packages/builtin-tool-user-interaction/src/client/Intervention/AskUserQuestion/index.tsx b/packages/builtin-tool-user-interaction/src/client/Intervention/AskUserQuestion/index.tsxindex d156c95aeaf..23de128c320 100644--- a/packages/builtin-tool-user-interaction/src/client/Intervention/AskUserQuestion/index.tsx+++ b/packages/builtin-tool-user-interaction/src/client/Intervention/AskUserQuestion/index.tsx@@ -77,6 +77,7 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestioescapeEnter: t('askUserQuestion.escape.enter'),escapePlaceholder: t('askUserQuestion.escape.placeholder'),multiSelectTag: t('askUserQuestion.multiSelectTag'),+ recommendedTag: t('askUserQuestion.recommendedTag'),skip: t('askUserQuestion.skip'),submit: t('askUserQuestion.submit'),timeExpired: '',diff --git a/packages/builtin-tool-user-interaction/src/client/Render/AskUserQuestion/index.tsx b/packages/builtin-tool-user-interaction/src/client/Render/AskUserQuestion/index.tsxindex 09444e47dea..9d53c232f17 100644--- a/packages/builtin-tool-user-interaction/src/client/Render/AskUserQuestion/index.tsx+++ b/packages/builtin-tool-user-interaction/src/client/Render/AskUserQuestion/index.tsx@@ -15,7 +15,7 @@ import type { AskUserQuestionArgs } from '../../../types';export const AskUserQuestionRender = memo<BuiltinRenderProps<AskUserQuestionArgs, AskUserQuestionResultState, string>>(({ args, content, pluginError, pluginState }) => {- const { t } = useTranslation('plugin');+ const { t } = useTranslation(['plugin', 'tool']);return (<AskUserQuestionResult@@ -23,8 +23,9 @@ export const AskUserQuestionRender = memo<isError={!!pluginError}questions={normalizeAskUserQuestions(args)}labels={{- noAnswer: t('builtins.lobe-claude-code.askUserQuestion.noAnswer'),- notAnswered: t('builtins.lobe-claude-code.askUserQuestion.notAnswered'),+ noAnswer: t('plugin:builtins.lobe-claude-code.askUserQuestion.noAnswer'),+ notAnswered: t('plugin:builtins.lobe-claude-code.askUserQuestion.notAnswered'),+ recommendedTag: t('tool:askUserQuestion.recommendedTag'),}}/>);diff --git a/packages/builtin-tool-user-interaction/src/manifest.ts b/packages/builtin-tool-user-interaction/src/manifest.tsindex b5bd1533afc..4645242987b 100644--- a/packages/builtin-tool-user-interaction/src/manifest.ts+++ b/packages/builtin-tool-user-interaction/src/manifest.ts@@ -18,6 +18,8 @@ export const UserInteractionManifest: BuiltinToolManifest = {header: { type: 'string' },multiSelect: { type: 'boolean' },options: {+ description:+ 'Provide 2-4 mutually exclusive choices. To recommend one option, put it first and append the exact marker "(Recommended)" to its label — always in English regardless of the conversation language; the client strips the marker and renders a localized badge.',items: {properties: {description: { type: 'string' },diff --git a/packages/builtin-tool-user-interaction/src/systemRole.ts b/packages/builtin-tool-user-interaction/src/systemRole.tsindex 39033a2b801..673f4e3fd83 100644--- a/packages/builtin-tool-user-interaction/src/systemRole.ts+++ b/packages/builtin-tool-user-interaction/src/systemRole.ts@@ -30,6 +30,7 @@ Recovery and inspection:<best_practices>- Keep questions and options concise; make each option meaningfully distinct.+- To recommend an option, put it first and append the exact marker "(Recommended)" to its label — always in English even when the conversation is in another language. The client strips the marker and shows a localized badge, so never translate it.- Ask the minimum number of questions needed to disambiguate.- Whether to ask in plain text or through this tool is determined by the host agent's instructions.</best_practices>diff --git a/packages/locales/src/default/tool.ts b/packages/locales/src/default/tool.tsindex 7c1ace07c41..498da06ddde 100644--- a/packages/locales/src/default/tool.ts+++ b/packages/locales/src/default/tool.ts@@ -48,6 +48,7 @@ export default {'askUserQuestion.escape.enter': 'Or type directly','askUserQuestion.escape.placeholder': 'Type your answer here…','askUserQuestion.multiSelectTag': '(multi-select)',+ 'askUserQuestion.recommendedTag': 'Recommended','askUserQuestion.skip': 'Skip','askUserQuestion.submit': 'Submit','claudeCode.askUserQuestion.customOption.placeholder': 'Or write your own…',@@ -55,6 +56,7 @@ export default {'claudeCode.askUserQuestion.escape.enter': 'Or type directly','claudeCode.askUserQuestion.escape.placeholder': 'Type your answer here…','claudeCode.askUserQuestion.multiSelectTag': '(multi-select)',+ 'claudeCode.askUserQuestion.recommendedTag': 'Recommended','claudeCode.askUserQuestion.skip': 'Skip','claudeCode.askUserQuestion.submit': 'Submit','claudeCode.askUserQuestion.timeExpired': 'Time expired — using option 1 of each question.',diff --git a/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionResult.tsx b/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionResult.tsxindex fd418be3c5b..756bf290e32 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionResult.tsx+++ b/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionResult.tsx@@ -1,50 +1,25 @@'use client';-import { Flexbox, Icon, Text } from '@lobehub/ui';-import { createStaticStyles, cx } from 'antd-style';-import { Check, PenLine } from 'lucide-react';+import { Flexbox, Text } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';import { memo } from 'react';import type { AskUserQuestionItem } from './types';const styles = createStaticStyles(({ css, cssVar }) => ({+ // Codex-style flat summary: the question keeps the body text color and the+ // answer drops to tertiary — the exchange reads as a quiet process record,+ // not an interactive control. No chips, icons, or borders. Tertiary (not+ // secondary) so the question/answer hierarchy stays legible at a glance.answer: css`font-size: 14px;- font-weight: 500;line-height: 1.5;- color: ${cssVar.colorText};+ color: ${cssVar.colorTextTertiary};overflow-wrap: anywhere;`,- answerContent: css`- min-width: 0;- `,- answerIcon: css`- flex-shrink: 0;- margin-block-start: 3px;- color: ${cssVar.colorTextSecondary};- `,- answerIconSelected: css`- color: ${cssVar.colorSuccess};- `,- answerRow: css`- box-sizing: border-box;- width: fit-content;- max-width: 100%;- padding-block: 8px;- padding-inline: 12px;- border-radius: 8px;-- background: ${cssVar.colorFillTertiary};- `,container: css`padding-block: 8px 4px;`,- description: css`- font-size: 12px;- line-height: 1.5;- color: ${cssVar.colorTextTertiary};- overflow-wrap: anywhere;- `,divider: css`align-self: stretch;height: 1px;@@ -86,12 +61,27 @@ const styles = createStaticStyles(({ css, cssVar }) => ({font-size: 14px;font-weight: 400;line-height: 1.5;- color: ${cssVar.colorTextSecondary};+ color: ${cssVar.colorText};overflow-wrap: anywhere;`,questionContent: css`min-width: 0;`,+ // Mirrors OptionCard's recommended pill so the marker reads the same in the+ // form and in the completed summary.+ recommendedBadge: css`+ flex-shrink: 0;++ padding-block: 1px;+ padding-inline: 8px;+ border-radius: 999px;++ font-size: 11px;+ line-height: 18px;+ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillSecondary};+ `,titleRow: css`display: flex;flex-wrap: wrap;@@ -99,14 +89,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({align-items: baseline;`,unanswered: css`- width: fit-content;- max-width: 100%;- padding-block: 8px;- padding-inline: 12px;- border: 1px dashed ${cssVar.colorBorderSecondary};- border-radius: 8px;-- font-size: 12px;+ font-size: 14px;line-height: 1.5;color: ${cssVar.colorTextQuaternary};`,@@ -115,77 +98,49 @@ const styles = createStaticStyles(({ css, cssVar }) => ({export interface AskUserQuestionResultLabels {noAnswer: string;notAnswered: string;+ /** Badge text for a chosen option carrying the recommended marker. */+ recommendedTag: string;}-interface AnswerLineProps {- description?: string;- icon: typeof Check;- selected?: boolean;- text: string;-}--const AnswerLine = memo<AnswerLineProps>(({ icon, text, description, selected }) => (- <Flexbox horizontal align="flex-start" className={styles.answerRow} gap={12}>- <Icon- className={cx(styles.answerIcon, selected && styles.answerIconSelected)}- icon={icon}- size={14}- />- <Flexbox className={styles.answerContent} flex={1} gap={4}>- <span className={styles.answer}>{text}</span>- {description && <span className={styles.description}>{description}</span>}- </Flexbox>- </Flexbox>-));--AnswerLine.displayName = 'AskUserQuestionResultAnswerLine';-interface QuestionAnswerProps {answer?: string | string[];index?: number;notAnswered: string;question: AskUserQuestionItem;+ recommendedTag: string;}-const QuestionAnswer = memo<QuestionAnswerProps>(({ question, answer, index, notAnswered }) => {- const labels: string[] = Array.isArray(answer) ? answer : answer ? [answer] : [];- const optionByLabel = new Map(question.options.map((option) => [option.label, option]));+const QuestionAnswer = memo<QuestionAnswerProps>(+ ({ question, answer, index, notAnswered, recommendedTag }) => {+ const labels: string[] = Array.isArray(answer) ? answer : answer ? [answer] : [];+ const isRecommended = (label: string) =>+ question.options.some((o) => o.label === label && o.recommended);- return (- <Flexbox align="flex-start" gap={8} horizontal={!!index}>- {!!index && <span className={styles.ordinal}>{`Q${index}`}</span>}- <Flexbox className={styles.questionContent} flex={1} gap={8}>- <div className={index ? styles.titleRow : undefined}>- <span className={styles.question}>{question.question}</span>- {!!index && question.header && <span className={styles.header}>{question.header}</span>}- </div>- {labels.length > 0 ? (- <Flexbox gap={8}>- {labels.map((label) => {- const option = optionByLabel.get(label);-- return (- <AnswerLine- selected- icon={Check}- key={label}- text={label}- description={- option?.description && option.description !== label- ? option.description- : undefined- }- />- );- })}- </Flexbox>- ) : (- <span className={styles.unanswered}>{notAnswered}</span>- )}+ return (+ <Flexbox align="flex-start" gap={8} horizontal={!!index}>+ {!!index && <span className={styles.ordinal}>{`Q${index}`}</span>}+ <Flexbox className={styles.questionContent} flex={1} gap={4}>+ <div className={index ? styles.titleRow : undefined}>+ <span className={styles.question}>{question.question}</span>+ {!!index && question.header && <span className={styles.header}>{question.header}</span>}+ </div>+ {labels.length > 0 ? (+ labels.map((label) => (+ <Flexbox horizontal align="center" gap={8} key={label}>+ <span className={styles.answer}>{label}</span>+ {isRecommended(label) && (+ <span className={styles.recommendedBadge}>{recommendedTag}</span>+ )}+ </Flexbox>+ ))+ ) : (+ <span className={styles.unanswered}>{notAnswered}</span>+ )}+ </Flexbox></Flexbox>- </Flexbox>- );-});+ );+ },+);QuestionAnswer.displayName = 'AskUserQuestionResultQuestionAnswer';@@ -230,7 +185,7 @@ export const AskUserQuestionResult = memo<AskUserQuestionResultProps>(</Flexbox>))}{multiple && <div className={styles.divider} />}- <AnswerLine icon={PenLine} text={freeformText} />+ <span className={styles.answer}>{freeformText}</span>{isError && <Text type="warning">{labels.noAnswer}</Text>}</Flexbox>);@@ -245,6 +200,7 @@ export const AskUserQuestionResult = memo<AskUserQuestionResultProps>(key={`${question.question}-${index}`}notAnswered={labels.notAnswered}question={question}+ recommendedTag={labels.recommendedTag}/>))}{isError && <Text type="warning">{labels.noAnswer}</Text>}diff --git a/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionView.tsx b/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionView.tsxindex fb7c7881b9f..2d1550cc546 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionView.tsx+++ b/packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionView.tsx@@ -3,14 +3,24 @@import { Flexbox, Hotkey, Icon, KeyMapEnum, Text, TextArea } from '@lobehub/ui';import { Button, Tabs } from '@lobehub/ui/base-ui';import { Check, PenLine, Send, X } from 'lucide-react';-import { memo, useEffect, useRef } from 'react';+import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';import { createPortal } from 'react-dom';import { registerPendingHotkeyCard } from '../pendingHotkeys';import { formatRemaining, isQuestionAnswered } from './draft';import QuestionPanel from './QuestionPanel';+import type { AskUserQuestionItem } from './types';import type { AskUserFormApi } from './useAskUserForm';+/**+ * A focused interactive control keeps its native key activation — hijacking+ * Enter/Space away from a tabbed-to button or link would invert the keyboard+ * user's intent.+ */+const INTERACTIVE_SELECTOR =+ 'a,button,select,summary,[role="button"],[role="tab"],[role="option"],[role="menuitem"],' ++ '[role="combobox"],[role="listbox"],[role="radio"],[role="slider"],[role="spinbutton"]';+/*** All display strings the view needs. Kept i18n-free so `shared-tool-ui` stays* app-decoupled — each host builds this from its own namespace (Claude Code@@ -24,6 +34,8 @@ export interface AskUserQuestionLabels {escapeEnter: string;escapePlaceholder: string;multiSelectTag: string;+ /** Badge text for options carrying the "(Recommended)" label marker. */+ recommendedTag: string;skip: string;submit: string;timeExpired: string;@@ -45,9 +57,9 @@ export interface AskUserQuestionViewProps extends AskUserFormApi {* - the active `QuestionPanel` (or the whole-form escape TextArea), and* - a Skip/Submit footer with an optional countdown.*- * All state and handlers arrive via props (from `useAskUserForm`); this- * component holds no state of its own — its only side effect is the- * window-level Enter-to-submit / Esc-to-skip shortcut listener.+ * All form state and handlers arrive via props (from `useAskUserForm`); the+ * only local state is the keyboard cursor. Its one side effect is the+ * window-level shortcut listener (digits / arrows / Space / Enter / Esc).*/export const AskUserQuestionView = memo<AskUserQuestionViewProps>((props) => {const {@@ -78,16 +90,48 @@ export const AskUserQuestionView = memo<AskUserQuestionViewProps>((props) => {const rootRef = useRef<HTMLDivElement>(null);const portalRef = useRef(actionsPortalTarget);- // Page-level keyboard: Enter submits, Esc skips — the card is the pending- // interaction, so the shortcuts work without focusing it first. Backs off- // while the user is typing anywhere outside the card (chat composer- // included; the card's own textareas handle Enter via their onKeyDown while- // Esc keeps skipping there), when the event was already consumed (e.g. an- // overlay closing itself on Esc), or inside open overlays so Esc keeps- // meaning "close this overlay" there.+ // Keyboard cursor over the active question's rows, keyed by question text so+ // each question keeps its own cursor across tab switches with no reset+ // effect. `options.length` is a sentinel for the trailing free-text row.+ // Unset falls back to the picked option (single-select revisit) or row 1 —+ // so Enter alone accepts the first/recommended option, Codex-style.+ const [highlightMap, setHighlightMap] = useState<Record<string, number>>({});+ const highlightedIndex = useMemo(() => {+ if (!activeQuestion) return undefined;+ const stored = highlightMap[activeQuestion.question];+ if (stored != null) return stored;+ if (!activeQuestion.multiSelect) {+ const picked = picks[activeQuestion.question];+ const idx = activeQuestion.options.findIndex((o) => o.label === picked);+ if (idx >= 0) return idx;+ }+ return 0;+ }, [activeQuestion, highlightMap, picks]);++ const setHighlight = useCallback((q: AskUserQuestionItem, idx: number) => {+ setHighlightMap((m) => ({ ...m, [q.question]: idx }));+ }, []);++ // The active panel renders exactly one textarea (the per-question free-text+ // row; the whole-form escape textarea replaces it and disables row+ // navigation), so a DOM query is enough — no ref plumbing through the panel.+ const focusCustomInput = useCallback(() => {+ rootRef.current?.querySelector('textarea')?.focus();+ }, []);++ // Page-level keyboard: 1-9 pick the numbered row, ↑/↓ move the cursor (the+ // row after the last option focuses the free-text box), Space toggles the+ // highlighted row, Enter picks (single-select, unanswered) or submits, Esc+ // skips. The card is the pending interaction, so the shortcuts work without+ // focusing it first. Backs off while the user is typing anywhere outside the+ // card (chat composer included; the card's own textareas handle their keys+ // via onKeyDown while Esc keeps skipping there), when the event was already+ // consumed (e.g. an overlay closing itself on Esc), or inside open overlays+ // so Esc keeps meaning "close this overlay" there.//// Read through a ref so the arbiter registration below stays mount-stable- // while the handler always sees fresh state.+ // while the handler always sees fresh state; the effect re-runs every render+ // instead of tracking a dependency list.const onKeyDownRef = useRef<(event: KeyboardEvent) => void>(() => {});useEffect(() => {portalRef.current = actionsPortalTarget;@@ -97,25 +141,85 @@ export const AskUserQuestionView = memo<AskUserQuestionViewProps>((props) => {if (target) {const tag = target.tagName;if (tag === 'INPUT' || tag === 'TEXTAREA' || target.isContentEditable) {- // Typing inside this card only backs off Enter (handled by the+ // Typing inside this card only backs off non-Esc keys (handled by the// textarea itself) — the advertised Esc-to-skip must keep working.// The IME guard keeps Esc-canceling a CJK composition from skipping.const typingInCard = rootRef.current?.contains(target) ?? false;if (!typingInCard || event.key !== 'Escape' || event.isComposing) return;}if (target.closest('[role="dialog"],[role="alertdialog"],[role="menu"]')) return;+ // A focused interactive control (a select, a radio group, a tabbed-to+ // button…) keeps its native keys — digits/arrows/Space/Enter all+ // yield; only the advertised Esc-to-skip stays. Our own option rows+ // are non-focusable divs, so they never appear as the keydown target.+ if (event.key !== 'Escape' && target.closest(INTERACTIVE_SELECTOR)) return;+ }++ // Held-key auto-repeat must not chain picks across auto-advanced+ // questions (a held digit could answer-and-submit the whole form) or+ // hammer Enter; arrows may repeat for fast row scanning.+ if (event.repeat && event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;++ const q = activeQuestion;+ const rowNavEnabled = !!q && !escapeActive && !submitting && !expired && q.options.length > 0;++ // Digit keys pick the matching numbered row directly; the row after the+ // last option is the "write your own" line, which focuses its textarea.+ if (/^[1-9]$/.test(event.key)) {+ if (!rowNavEnabled) return;+ const idx = Number(event.key) - 1;+ if (idx < q.options.length) {+ event.preventDefault();+ setHighlight(q, idx);+ handleToggle(q, q.options[idx].label);+ } else if (idx === q.options.length) {+ event.preventDefault();+ setHighlight(q, q.options.length);+ focusCustomInput();+ }+ return;}++ if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {+ if (!rowNavEnabled) return;+ event.preventDefault();+ const total = q.options.length + 1; // +1: the free-text row+ const delta = event.key === 'ArrowUp' ? -1 : 1;+ const next = ((highlightedIndex ?? 0) + delta + total) % total;+ setHighlight(q, next);+ if (next === q.options.length) focusCustomInput();+ return;+ }++ if (event.key === ' ') {+ if (!rowNavEnabled || highlightedIndex == null || highlightedIndex >= q.options.length)+ return;+ event.preventDefault();+ handleToggle(q, q.options[highlightedIndex].label);+ return;+ }+if (event.key === 'Enter') {- if (event.shiftKey || isSubmitDisabled) return;- // A focused interactive control (e.g. tabbing to the Skip button, a- // tab, or a link) keeps its native Enter activation — hijacking it- // into submit would invert the keyboard user's intent.+ if (event.shiftKey) return;+ // Single-select with the cursor on a row that isn't the current pick:+ // Enter accepts that row (which may select-to-submit via the form+ // hook) — including when revisiting an already-answered question to+ // change the answer. With the cursor on the picked row, on a+ // custom-text answer, or on a multi-select (Space/digits toggle+ // there), Enter keeps meaning "submit the form".if (- target?.closest(- 'a,button,select,summary,[role="button"],[role="tab"],[role="option"],[role="menuitem"]',- )- )+ rowNavEnabled &&+ !q.multiSelect &&+ highlightedIndex != null &&+ highlightedIndex < q.options.length &&+ !(custom[q.question] ?? '').trim() &&+ picks[q.question] !== q.options[highlightedIndex].label+ ) {+ event.preventDefault();+ handleToggle(q, q.options[highlightedIndex].label);return;+ }+ if (isSubmitDisabled) return;event.preventDefault();handleSubmit();} else if (event.key === 'Escape') {@@ -124,7 +228,7 @@ export const AskUserQuestionView = memo<AskUserQuestionViewProps>((props) => {handleSkip();}};- }, [actionsPortalTarget, handleSubmit, handleSkip, isSubmitDisabled, submitting]);+ });// Registered once per mount: the shared arbiter dispatches each keypress to// exactly one pending card (containment first, then newest registration), so@@ -241,11 +345,19 @@ export const AskUserQuestionView = memo<AskUserQuestionViewProps>((props) => {customPlaceholder={labels.customPlaceholder}customValue={custom[activeQuestion.question] ?? ''}disabled={expired || submitting}+ highlightedIndex={highlightedIndex}multiSelectTag={labels.multiSelectTag}question={activeQuestion}+ recommendedTag={labels.recommendedTag}onCustomChange={handleCustomChange}onPressEnter={isSubmitDisabled ? undefined : handleSubmit}onToggle={handleToggle}+ onCustomNavigate={(direction) =>+ setHighlight(+ activeQuestion,+ direction === 'prev' ? activeQuestion.options.length - 1 : 0,+ )+ }/>))}diff --git a/packages/shared-tool-ui/src/AskUserQuestion/QuestionPanel.tsx b/packages/shared-tool-ui/src/AskUserQuestion/QuestionPanel.tsxindex c10d9855dce..6111a8ae0af 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/QuestionPanel.tsx+++ b/packages/shared-tool-ui/src/AskUserQuestion/QuestionPanel.tsx@@ -46,9 +46,17 @@ interface QuestionPanelProps {/** The free-text "write your own" value for this question. */customValue: string;disabled: boolean;+ /** 0-based keyboard cursor over the option rows (↑/↓ navigation), if any. */+ highlightedIndex?: number;/** Tag shown next to the header when the question is multi-select. */multiSelectTag: string;onCustomChange: (q: AskUserQuestionItem, value: string) => void;+ /**+ * Arrow-key hand-off from the free-text row back into the option list:+ * `prev` fires on ↑ at the very start of the text, `next` on ↓ with the box+ * empty — anywhere else the arrows keep their native caret behavior.+ */+ onCustomNavigate?: (direction: 'next' | 'prev') => void;/*** Submit the whole form from the free-text box on Enter (Shift+Enter still* inserts a newline). Pass `undefined` while submit is unavailable so Enter@@ -57,14 +65,16 @@ interface QuestionPanelProps {onPressEnter?: () => void;onToggle: (q: AskUserQuestionItem, label: string) => void;question: AskUserQuestionItem;+ /** Badge text for options carrying the "(Recommended)" label marker. */+ recommendedTag: string;}/*** A single question: its header/title, the numbered options, and a trailing* free-text box so the user can answer in their own words instead of picking.*- * Presentational and i18n-free — the two visible strings come in as props so- * the panel stays app-decoupled and reusable across surfaces.+ * Presentational and i18n-free — the visible strings come in as props so the+ * panel stays app-decoupled and reusable across surfaces.*/export const QuestionPanel = memo<QuestionPanelProps>(({@@ -73,10 +83,13 @@ export const QuestionPanel = memo<QuestionPanelProps>(customValue,customPlaceholder,disabled,+ highlightedIndex,multiSelectTag,onToggle,onCustomChange,+ onCustomNavigate,onPressEnter,+ recommendedTag,}) => {const isOptionSelected = (label: string): boolean =>question.multiSelect ? Array.isArray(answer) && answer.includes(label) : answer === label;@@ -98,9 +111,11 @@ export const QuestionPanel = memo<QuestionPanelProps>(<OptionCarddescription={opt.description}disabled={disabled}+ highlighted={highlightedIndex === optIdx}index={optIdx + 1}key={opt.label}label={opt.label}+ recommendedText={opt.recommended ? recommendedTag : undefined}selected={isOptionSelected(opt.label)}onToggle={() => onToggle(question, opt.label)}/>@@ -118,9 +133,27 @@ export const QuestionPanel = memo<QuestionPanelProps>(variant="filled"onChange={(e) => onCustomChange(question, e.target.value)}onKeyDown={(e) => {- // The IME guard keeps CJK composition confirms from submitting.- if (e.key !== 'Enter' || e.shiftKey || e.nativeEvent.isComposing) return;+ // The IME guard keeps CJK composition confirms from acting.+ if (e.nativeEvent.isComposing) return;if (e.metaKey || e.ctrlKey || e.altKey) return;+ const el = e.currentTarget;+ if (e.key === 'ArrowUp' && onCustomNavigate) {+ if (el.selectionStart === 0 && el.selectionEnd === 0) {+ e.preventDefault();+ el.blur();+ onCustomNavigate('prev');+ }+ return;+ }+ if (e.key === 'ArrowDown' && onCustomNavigate) {+ if (!el.value) {+ e.preventDefault();+ el.blur();+ onCustomNavigate('next');+ }+ return;+ }+ if (e.key !== 'Enter' || e.shiftKey) return;if (!onPressEnter) return;e.preventDefault();onPressEnter();diff --git a/packages/shared-tool-ui/src/AskUserQuestion/normalize.test.ts b/packages/shared-tool-ui/src/AskUserQuestion/normalize.test.tsindex 25db83055bf..100b811dfa7 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/normalize.test.ts+++ b/packages/shared-tool-ui/src/AskUserQuestion/normalize.test.ts@@ -74,6 +74,38 @@ describe('normalizeAskUserQuestions', () => {expect(normalizeAskUserQuestions({ questions: JSON.stringify(expected) })).toEqual(expected);});+ it('strips the "(Recommended)" label marker into the recommended flag', () => {+ const questions = normalizeAskUserQuestions({+ questions: [+ {+ header: 'Scope',+ options: [+ { label: 'Narrow (Recommended)' },+ { label: 'Full(推荐)' },+ { label: 'recommended (recommended)' },+ { label: 'Plain' },+ ],+ question: 'How broad?',+ },+ ],+ });++ expect(questions[0].options).toEqual([+ { label: 'Narrow', recommended: true },+ { label: 'Full', recommended: true },+ { label: 'recommended', recommended: true },+ { label: 'Plain' },+ ]);+ });++ it('keeps a label that IS the marker instead of collapsing it to empty', () => {+ const questions = normalizeAskUserQuestions({+ questions: [{ options: [{ label: '(Recommended)' }], question: 'Pick' }],+ });++ expect(questions[0].options).toEqual([{ label: '(Recommended)' }]);+ });+it('normalizes malformed options so renderers can map safely', () => {const questions = normalizeAskUserQuestions({questions: [diff --git a/packages/shared-tool-ui/src/AskUserQuestion/normalize.ts b/packages/shared-tool-ui/src/AskUserQuestion/normalize.tsindex 4836f3fd6ab..35beb166274 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/normalize.ts+++ b/packages/shared-tool-ui/src/AskUserQuestion/normalize.ts@@ -12,15 +12,40 @@ const parseJsonString = (value: unknown): unknown => {}};+/**+ * Convention-based recommendation marker (see `AskUserQuestionOption.recommended`).+ * Accepts ASCII/fullwidth parens and the English/Chinese wording models emit.+ * Surrounding whitespace is handled with `trimEnd()` instead of `\s*` in the+ * pattern — the label is model-controlled input, and ambiguous `\s*` around an+ * end anchor makes the scan polynomial (CodeQL js/polynomial-redos).+ */+const RECOMMENDED_SUFFIX = /[((](?:recommended|推荐)[))]$/i;++const stripRecommendedSuffix = (rawLabel: string): string => {+ const trimmed = rawLabel.trimEnd();+ const match = RECOMMENDED_SUFFIX.exec(trimmed);++ return match ? trimmed.slice(0, match.index).trimEnd() : rawLabel;+};+const normalizeOption = (value: unknown): AskUserQuestionOption | undefined => {const option = toRecord(value);- const label = pickString(option?.label);+ const rawLabel = pickString(option?.label);- if (!label) return;+ if (!rawLabel) return;+ const strippedLabel = stripRecommendedSuffix(rawLabel);+ // Only treat the suffix as a marker when something remains — a label that IS+ // "(Recommended)" stays verbatim rather than collapsing to an empty option.+ const recommended = strippedLabel.length > 0 && strippedLabel !== rawLabel;+ const label = recommended ? strippedLabel : rawLabel;const description = pickString(option?.description);- return description ? { description, label } : { label };+ return {+ label,+ ...(description ? { description } : {}),+ ...(recommended ? { recommended } : {}),+ };};const isQuestionOption = (diff --git a/packages/shared-tool-ui/src/AskUserQuestion/types.ts b/packages/shared-tool-ui/src/AskUserQuestion/types.tsindex 3414bed19ef..a0abcf73ad0 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/types.ts+++ b/packages/shared-tool-ui/src/AskUserQuestion/types.ts@@ -5,6 +5,13 @@export interface AskUserQuestionOption {description?: string;label: string;+ /**+ * The tool schema has no recommendation field, so models mark their pick by+ * convention: a "(Recommended)" suffix on the label. `normalizeAskUserQuestions`+ * strips that suffix and raises this flag so the UI renders a badge instead of+ * leaking the marker as plain text.+ */+ recommended?: boolean;}/**diff --git a/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.test.ts b/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.test.tsnew file mode 100644index 00000000000..91feeca6330--- /dev/null+++ b/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.test.ts@@ -0,0 +1,125 @@+/**+ * @vitest-environment happy-dom+ */+import { act, renderHook } from '@testing-library/react';+import { describe, expect, it, vi } from 'vitest';++import type { AskUserQuestionArgs } from './types';+import { useAskUserForm } from './useAskUserForm';++const singleQuestionArgs: AskUserQuestionArgs = {+ questions: [+ {+ header: 'Scope',+ options: [{ label: 'Narrow' }, { label: 'Full' }],+ question: 'How broad?',+ },+ ],+};++const twoQuestionArgs: AskUserQuestionArgs = {+ questions: [+ {+ header: 'Scope',+ options: [{ label: 'Narrow' }, { label: 'Full' }],+ question: 'How broad?',+ },+ {+ header: 'Mode',+ options: [{ label: 'Auto' }, { label: 'Manual' }],+ question: 'Which mode?',+ },+ ],+};++const setup = (args: AskUserQuestionArgs, persistedDraft?: unknown) => {+ const onInteractionAction = vi.fn().mockResolvedValue(undefined);+ const hook = renderHook(() =>+ useAskUserForm({+ args,+ onInteractionAction,+ persistedDraft,+ writeDraft: vi.fn(),+ }),+ );+ return { hook, onInteractionAction };+};++describe('useAskUserForm select-to-submit', () => {+ it('submits immediately when a single-select pick completes the form', () => {+ const { hook, onInteractionAction } = setup(singleQuestionArgs);++ act(() => {+ hook.result.current.handleToggle(singleQuestionArgs.questions[0], 'Full');+ });++ expect(onInteractionAction).toHaveBeenCalledExactlyOnceWith({+ payload: { 'How broad?': 'Full' },+ type: 'submit',+ });+ });++ it('auto-advances instead of submitting while other questions are unanswered', () => {+ const { hook, onInteractionAction } = setup(twoQuestionArgs);++ act(() => {+ hook.result.current.handleToggle(twoQuestionArgs.questions[0], 'Narrow');+ });++ expect(onInteractionAction).not.toHaveBeenCalled();+ expect(hook.result.current.activeTab).toBe('1');++ act(() => {+ hook.result.current.handleToggle(twoQuestionArgs.questions[1], 'Auto');+ });++ expect(onInteractionAction).toHaveBeenCalledExactlyOnceWith({+ payload: { 'How broad?': 'Narrow', 'Which mode?': 'Auto' },+ type: 'submit',+ });+ });++ it('never auto-submits when revisiting an already-answered question', () => {+ // Resumed draft with every question answered — changing a pick must stay a+ // review edit, not a surprise submit.+ const { hook, onInteractionAction } = setup(twoQuestionArgs, {+ picks: { 'How broad?': 'Narrow', 'Which mode?': 'Auto' },+ });++ act(() => {+ hook.result.current.handleToggle(twoQuestionArgs.questions[0], 'Full');+ });++ expect(onInteractionAction).not.toHaveBeenCalled();+ expect(hook.result.current.picks['How broad?']).toBe('Full');+ });++ it('keeps multi-select on explicit submit even when the toggle answers everything', () => {+ const args: AskUserQuestionArgs = {+ questions: [+ {+ header: 'Scope',+ multiSelect: true,+ options: [{ label: 'Narrow' }, { label: 'Full' }],+ question: 'How broad?',+ },+ ],+ };+ const { hook, onInteractionAction } = setup(args);++ act(() => {+ hook.result.current.handleToggle(args.questions[0], 'Narrow');+ });++ expect(onInteractionAction).not.toHaveBeenCalled();++ act(() => {+ hook.result.current.handleSubmit();+ });++ expect(onInteractionAction).toHaveBeenCalledExactlyOnceWith({+ payload: { 'How broad?': ['Narrow'] },+ type: 'submit',+ });+ });+});diff --git a/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.ts b/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.tsindex 0e87cfae3a4..278b49140fd 100644--- a/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.ts+++ b/packages/shared-tool-ui/src/AskUserQuestion/useAskUserForm.ts@@ -89,6 +89,25 @@ export const useAskUserForm = ({}, [countdownEnabled]);const expired = countdownEnabled ? now >= deadline : false;+ /**+ * Submit `payload` exactly as given. Used by the Submit button (with the+ * user's picks/text), the single-select select-to-submit path, and the+ * timeout fallback (option 1 of each unanswered question merged in).+ */+ const submitWith = useCallback(+ async (payload: Record<string, string | string[]>) => {+ if (!onInteractionAction || submitting) return;+ setSubmitting(true);+ try {+ await onInteractionAction({ payload, type: 'submit' });+ } catch (err) {+ console.error('[AskUserQuestion] submit failed:', err);+ setSubmitting(false);+ }+ },+ [onInteractionAction, submitting],+ );+const handleToggle = useCallback((q: AskUserQuestionItem, label: string) => {let nextPicks: Record<string, string | string[]>;@@ -116,16 +135,30 @@ export const useAskUserForm = ({if (nextCustom !== custom) setCustom(nextCustom);writeDraft({ custom: nextCustom, escapeActive, escapeText, picks: nextPicks });- // Single-select auto-advance to the next still-unanswered question, so- // the user sweeps through without re-clicking the tabs.- if (!q.multiSelect && questions.length > 1) {- const next = questions.findIndex(- (qq) => qq.question !== q.question && !isQuestionAnswered(qq, nextPicks, nextCustom),- );- if (next >= 0) setActiveTab(String(next));+ if (!q.multiSelect) {+ // Codex-style select-to-submit: the pick that completes the form sends+ // it right away — no extra Submit press for single-select flows. Gated+ // on the question having been unanswered so revisiting an already+ // answered question only updates the pick and never fires a surprise+ // submit while the user is reviewing.+ const wasUnanswered = !isQuestionAnswered(q, picks, custom);+ const allAnswered = questions.every((qq) => isQuestionAnswered(qq, nextPicks, nextCustom));+ if (wasUnanswered && allAnswered) {+ void submitWith(buildSubmitPayload(questions, nextPicks, nextCustom));+ return;+ }++ // Auto-advance to the next still-unanswered question, so the user+ // sweeps through without re-clicking the tabs.+ if (questions.length > 1) {+ const next = questions.findIndex(+ (qq) => qq.question !== q.question && !isQuestionAnswered(qq, nextPicks, nextCustom),+ );+ if (next >= 0) setActiveTab(String(next));+ }}},- [picks, custom, escapeActive, escapeText, questions, writeDraft],+ [picks, custom, escapeActive, escapeText, questions, submitWith, writeDraft],);const handleCustomChange = useCallback(@@ -148,25 +181,6 @@ export const useAskUserForm = ({[picks, custom, escapeActive, escapeText, writeDraft],);- /**- * Submit `payload` exactly as given. Used by the Submit button (with the- * user's picks/text) and the timeout fallback (option 1 of each unanswered- * question merged in).- */- const submitWith = useCallback(- async (payload: Record<string, string | string[]>) => {- if (!onInteractionAction || submitting) return;- setSubmitting(true);- try {- await onInteractionAction({ payload, type: 'submit' });- } catch (err) {- console.error('[AskUserQuestion] submit failed:', err);- setSubmitting(false);- }- },- [onInteractionAction, submitting],- );-const handleEscapeTextChange = useCallback((value: string) => {setEscapeText(value);diff --git a/packages/shared-tool-ui/src/components/OptionCard.tsx b/packages/shared-tool-ui/src/components/OptionCard.tsxindex 185095a04ae..50d26b8a80e 100644--- a/packages/shared-tool-ui/src/components/OptionCard.tsx+++ b/packages/shared-tool-ui/src/components/OptionCard.tsx@@ -53,6 +53,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillTertiary};`,+ // Keyboard cursor — a ring instead of a fill so it stays legible when+ // stacked on the hover tint or the selected fill.+ optionHighlighted: css`+ box-shadow: inset 0 0 0 1px ${cssVar.colorBorder};+ `,optionLabel: css`font-weight: 500;`,@@ -63,14 +68,31 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFill};}`,+ recommendedBadge: css`+ flex-shrink: 0;++ padding-block: 1px;+ padding-inline: 8px;+ border-radius: 999px;++ font-size: 11px;+ line-height: 18px;+ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillSecondary};+ `,}));export interface OptionCardProps {description?: string;disabled?: boolean;+ /** Keyboard cursor (↑/↓) — independent from `selected`, which is the pick. */+ highlighted?: boolean;index: number;label: string;onToggle: () => void;+ /** Badge text rendered after the label for a model-recommended option. */+ recommendedText?: string;selected: boolean;}@@ -85,21 +107,28 @@ export interface OptionCardProps {* everywhere.*/export const OptionCard = memo<OptionCardProps>(- ({ index, label, description, selected, disabled, onToggle }) => (+ ({ index, label, description, highlighted, recommendedText, selected, disabled, onToggle }) => (<Flexboxhorizontalalign="center"aria-selected={selected}- className={cx(styles.option, selected && styles.optionSelected)}gap={12}role="option"+ className={cx(+ styles.option,+ selected && styles.optionSelected,+ highlighted && styles.optionHighlighted,+ )}onClick={() => {if (!disabled) onToggle();}}><span className={styles.optionIndex}>{index}</span><Flexbox flex={1} gap={2}>- <Text className={styles.optionLabel}>{label}</Text>+ <Flexbox horizontal align="center" gap={8}>+ <Text className={styles.optionLabel}>{label}</Text>+ {recommendedText && <span className={styles.recommendedBadge}>{recommendedText}</span>}+ </Flexbox>{description && <span className={styles.optionDescription}>{description}</span>}</Flexbox>{selected && <Icon className={styles.optionCheck} icon={Check} size={16} />}diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsxindex 637fd9ff3e0..8ca20b7e7c5 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx@@ -1,7 +1,7 @@import { type ToolIntervention } from '@lobechat/types';import { Block, Icon, Tooltip } from '@lobehub/ui';import { cssVar } from 'antd-style';-import { AlertTriangle, Ban, Check, HandIcon, PauseIcon, X } from 'lucide-react';+import { AlertTriangle, Ban, Check, HandIcon, type LucideIcon, PauseIcon, X } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';@@ -16,12 +16,18 @@ interface StatusIndicatorProps {*/isToolExecuting?: boolean;result?: { content: string | null; error?: any; state?: any };+ /**+ * Glyph for the completed state (defaults to a checkmark). Lets tools whose+ * point is not "an action succeeded" keep their own semantic — e.g.+ * askUserQuestion completes as a question mark, not a task tick.+ */+ successIcon?: LucideIcon;/** Successful tool payload that should surface as warning (e.g. activateTools with only notFound). */successVariant?: 'default' | 'warning';}const StatusIndicator = memo<StatusIndicatorProps>(- ({ intervention, isToolExecuting, result, successVariant }) => {+ ({ intervention, isToolExecuting, result, successIcon, successVariant }) => {const { t } = useTranslation('chat');const hasError = !!result?.error;@@ -55,7 +61,7 @@ const StatusIndicator = memo<StatusIndicatorProps>(} else if (hasSuccessResult && !hasError && successVariant === 'warning') {icon = <Icon color={cssVar.colorWarning} icon={AlertTriangle} />;} else if (hasResult || isToolComplete) {- icon = <Icon color={cssVar.colorSuccess} icon={Check} />;+ icon = <Icon color={cssVar.colorSuccess} icon={successIcon ?? Check} />;} else {icon = <NeuralNetworkLoading size={16} />;}diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsxindex b97396ed92f..2d13128318e 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx@@ -4,6 +4,7 @@ import { getBuiltinInspector } from '@lobechat/builtin-tools/inspectors';import type { ToolIntervention } from '@lobechat/types';import { safeParseJSON, safeParsePartialJSON } from '@lobechat/utils';import { Flexbox } from '@lobehub/ui';+import { MessageCircleQuestion } from 'lucide-react';import { memo } from 'react';import SafeBoundary from '@/components/ErrorBoundary';@@ -71,6 +72,11 @@ const Inspectors = memo<InspectorProps>(}}+ // askUserQuestion (Claude Code and the builtin user-interaction tool share+ // the apiName) completes as "a question was asked", not "a task succeeded"+ // — keep the question-mark glyph instead of the generic tick.+ const statusSuccessIcon = apiName === 'askUserQuestion' ? MessageCircleQuestion : undefined;+// Check for custom inspector rendererconst CustomInspector = getBuiltinInspector(identifier, apiName);@@ -83,6 +89,7 @@ const Inspectors = memo<InspectorProps>(intervention={intervention}isToolExecuting={isToolCalling}result={result}+ successIcon={statusSuccessIcon}successVariant={statusSuccessVariant}/><SafeBoundary minHeight={22} resetKeys={[argsStr, result]}>@@ -116,6 +123,7 @@ const Inspectors = memo<InspectorProps>(intervention={intervention}isToolExecuting={isToolCalling}result={result}+ successIcon={statusSuccessIcon}successVariant={statusSuccessVariant}/><ToolTitle