Skip to content

🀯 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.

πŸ’„ style(claude-code): switch AskUserQuestion question tabs to underline variant (#16619)

Inneibb4bf60dd054
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.tsx
index 02f28292d4d..f4f0c2e11ad 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
@@ -134,6 +134,7 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestio
{!escapeActive && isMulti && (
<Tabs
activeKey={activeTab}
+ variant="square"
items={questions.map((q, idx) => {
const done = isQuestionAnswered(q, picks, custom);
return {
diff --git a/src/features/DevPanel/RenderGallery/fixtures/claude-code.ts b/src/features/DevPanel/RenderGallery/fixtures/claude-code.ts
index 404f9f49fe0..f5175cb73da 100644
--- a/src/features/DevPanel/RenderGallery/fixtures/claude-code.ts
+++ b/src/features/DevPanel/RenderGallery/fixtures/claude-code.ts
@@ -113,6 +113,76 @@ export default defineFixtures({
},
],
fixtures: {
+ askUserQuestion: variants([
+ {
+ args: {
+ questions: [
+ {
+ header: 'Audit level',
+ options: [
+ {
+ description:
+ 'Fastest, offline, full-coverage baseline. Scans structural issues (missing states / branches / patterns) from code alone.',
+ label: 'L1 only (read code)',
+ },
+ {
+ description:
+ 'Also boots the app and screenshots key surfaces to confirm visual hierarchy and rendered states. Medium cost.',
+ label: 'L1 + L2 (screenshots)',
+ },
+ {
+ description:
+ 'Adds a real user journey with performance traces (CLS/LCP). Needs a running environment and login. High cost.',
+ label: 'L1 + L2 + L3',
+ },
+ ],
+ question: 'How deep should this audit round go?',
+ },
+ {
+ header: 'Scope',
+ multiSelect: true,
+ options: [
+ {
+ description: 'The chat conversation pane and message renders.',
+ label: 'Chat surface',
+ },
+ {
+ description: 'Settings pages, providers, and model configuration.',
+ label: 'Settings',
+ },
+ {
+ description: 'Onboarding and first-run flows.',
+ label: 'Onboarding',
+ },
+ ],
+ question: 'Which surfaces should the audit cover?',
+ },
+ ],
+ },
+ label: 'Multi question',
+ },
+ {
+ args: {
+ questions: [
+ {
+ header: 'Approach',
+ options: [
+ {
+ description: 'Ship the minimal fix now and file a follow-up for the refactor.',
+ label: 'Minimal fix',
+ },
+ {
+ description: 'Refactor the module properly before fixing. Slower but cleaner.',
+ label: 'Refactor first',
+ },
+ ],
+ question: 'How should I handle the legacy module?',
+ },
+ ],
+ },
+ label: 'Single question',
+ },
+ ]),
Agent: single({
args: {
prompt:
diff --git a/src/features/DevPanel/RenderGallery/toolSurfaces.tsx b/src/features/DevPanel/RenderGallery/toolSurfaces.tsx
index 89e70f77d61..a2018cde99a 100644
--- a/src/features/DevPanel/RenderGallery/toolSurfaces.tsx
+++ b/src/features/DevPanel/RenderGallery/toolSurfaces.tsx
@@ -1,9 +1,13 @@
'use client';
+import type { UIChatMessage } from '@lobechat/types';
import { Block, Flexbox, Text } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { Component, memo, type ReactNode } from 'react';
+import { Component, memo, type ReactNode, useMemo } from 'react';
+import { type ConversationContext, ConversationProvider } from '@/features/Conversation';
+
+import { DEVTOOLS_AGENT_ID } from './fixtures';
import {
bodyKindForMode,
type DerivedFixtureProps,
@@ -107,6 +111,71 @@ export const ToolInspectorSlot = memo<ToolInspectorSlotProps>(
ToolInspectorSlot.displayName = 'ToolInspectorSlot';
+interface InterventionConversationHostProps {
+ api: ApiEntry;
+ children: ReactNode;
+ derived: DerivedFixtureProps;
+ messageId: string;
+ toolCallId: string;
+}
+
+/**
+ * Intervention components run their form logic against the conversation store
+ * (e.g. draft persistence reads the tool message via `getDbMessageById`), so
+ * the standalone By-API preview must seed a `ConversationProvider` with the
+ * matching assistant β†’ tool message pair β€” without it they crash on mount.
+ */
+const InterventionConversationHost = memo<InterventionConversationHostProps>(
+ ({ api, children, derived, messageId, toolCallId }) => {
+ const context = useMemo<ConversationContext>(
+ () => ({ agentId: DEVTOOLS_AGENT_ID, topicId: `devtools-intervention-${messageId}` }),
+ [messageId],
+ );
+
+ const messages = useMemo<UIChatMessage[]>(() => {
+ const now = Date.now();
+ const assistantId = `${messageId}-assistant`;
+ return [
+ {
+ content: '',
+ createdAt: now,
+ id: assistantId,
+ role: 'assistant',
+ tools: [
+ {
+ apiName: api.apiName,
+ arguments: JSON.stringify(derived.args ?? {}),
+ id: toolCallId,
+ identifier: api.identifier,
+ source: 'builtin',
+ type: 'builtin',
+ },
+ ],
+ updatedAt: now,
+ },
+ {
+ content: '',
+ createdAt: now,
+ id: messageId,
+ parentId: assistantId,
+ pluginIntervention: { status: 'pending' },
+ role: 'tool',
+ tool_call_id: toolCallId,
+ updatedAt: now,
+ },
+ ];
+ }, [api, derived.args, messageId, toolCallId]);
+
+ return (
+ <ConversationProvider hasInitMessages skipFetch context={context} messages={messages}>
+ {children}
+ </ConversationProvider>
+ );
+ },
+);
+
+InterventionConversationHost.displayName = 'InterventionConversationHost';
+
interface ToolBodySlotProps {
api: ApiEntry;
derived: DerivedFixtureProps;
@@ -179,13 +248,20 @@ export const ToolBodySlot = memo<ToolBodySlotProps>(
case 'intervention': {
return api.intervention ? (
<RenderBoundary label={'Intervention'}>
- <api.intervention
- apiName={api.apiName}
- args={derived.args}
- identifier={api.identifier}
- interactionMode={'approval'}
+ <InterventionConversationHost
+ api={api}
+ derived={derived}
messageId={messageId}
- />
+ toolCallId={toolCallId}
+ >
+ <api.intervention
+ apiName={api.apiName}
+ args={derived.args}
+ identifier={api.identifier}
+ interactionMode={'approval'}
+ messageId={messageId}
+ />
+ </InterventionConversationHost>
</RenderBoundary>
) : (
missing('intervention')