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: polish onboarding interventions and add tool result renders (#14506)

Arvin Xu8fab0b014e72
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 80e6503cfe4..b353c17a88a 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -673,14 +673,14 @@
"tokenTag.used": "Used",
"tool.intervention.approvalMode": "Approval Mode",
"tool.intervention.approve": "Approve",
- "tool.intervention.approveAndRemember": "Approve and Remember",
- "tool.intervention.approveOnce": "Approve This Time Only",
"tool.intervention.mode.allowList": "Allow List",
"tool.intervention.mode.allowListDesc": "Only automatically execute approved tools",
"tool.intervention.mode.autoRun": "Auto Approve",
"tool.intervention.mode.autoRunDesc": "Automatically approve all tool executions",
"tool.intervention.mode.manual": "Manual",
"tool.intervention.mode.manualDesc": "Manual approval required for each invocation",
+ "tool.intervention.onboarding.agentIdentity.editHint": "You can edit the name or avatar directly below.",
+ "tool.intervention.onboarding.agentIdentity.namePlaceholder": "Agent name",
"tool.intervention.onboarding.agentIdentity.title": "I'll update my name and avatar",
"tool.intervention.onboarding.agentIdentity.titleAvatarOnly": "I'll update my avatar",
"tool.intervention.onboarding.agentIdentity.titleNameOnly": "I'll update my name",
@@ -690,14 +690,15 @@
"tool.intervention.onboarding.userProfile.fullName": "Full name",
"tool.intervention.onboarding.userProfile.responseLanguage": "Response language",
"tool.intervention.onboarding.userProfile.title": "Confirm your profile update",
+ "tool.intervention.optionApprove": "Approve",
"tool.intervention.pending": "Pending",
"tool.intervention.reject": "Reject",
- "tool.intervention.rejectAndContinue": "Reject and Retry",
"tool.intervention.rejectOnly": "Reject",
- "tool.intervention.rejectReasonPlaceholder": "A reason helps the Agent understand your boundaries and improve future actions",
- "tool.intervention.rejectTitle": "Reject this Skill call",
+ "tool.intervention.rejectReasonPlaceholder": "Tell the agent what you'd like instead",
"tool.intervention.rejectedWithReason": "This Skill call was rejected: {{reason}}",
+ "tool.intervention.rememberSimilar": "Don't ask again for similar actions",
"tool.intervention.scrollToIntervention": "View",
+ "tool.intervention.submit": "Submit",
"tool.intervention.toolAbort": "You canceled this Skill call",
"tool.intervention.toolRejected": "This Skill call was rejected",
"tool.intervention.viewParameters": "View parameters ({{count}})",
@@ -809,7 +810,9 @@
"workflow.toolDisplayName.searchLocalFiles": "Searched files",
"workflow.toolDisplayName.searchSkill": "Searched skills",
"workflow.toolDisplayName.searchUserMemory": "Searched memory",
+ "workflow.toolDisplayName.showAgentMarketplace": "Assembled agent team",
"workflow.toolDisplayName.solve": "Solved equation",
+ "workflow.toolDisplayName.submitAgentPick": "Picked agents",
"workflow.toolDisplayName.updateAgent": "Updated an agent",
"workflow.toolDisplayName.updateDocument": "Updated a document",
"workflow.toolDisplayName.updateIdentityMemory": "Updated memory",
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index baf1ed8aef3..108d12c7baa 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -69,7 +69,7 @@
"builtins.lobe-agent-management.render.installPlugin.plugin": "Plugin",
"builtins.lobe-agent-management.render.installPlugin.success": "Installed successfully",
"builtins.lobe-agent-management.title": "Agent Manager",
- "builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "Open agent marketplace",
+ "builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "Assemble agent team",
"builtins.lobe-agent-marketplace.apiName.submitAgentPick": "Submit agent picks",
"builtins.lobe-agent-marketplace.title": "Agent Marketplace",
"builtins.lobe-claude-code.agent.instruction": "Instruction",
@@ -322,6 +322,11 @@
"builtins.lobe-web-onboarding.inspector.interests_one": "{{count}} interest",
"builtins.lobe-web-onboarding.inspector.interests_other": "{{count}} interests",
"builtins.lobe-web-onboarding.title": "User Onboarding",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.delete": "Delete",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.deleteLines": "Delete lines",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.insertAt": "Insert at line",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.replace": "Replace",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.replaceLines": "Replace lines",
"confirm": "Confirm",
"debug.arguments": "Arguments",
"debug.error": "Error log",
diff --git a/locales/en-US/tool.json b/locales/en-US/tool.json
index 799ede0aa18..a155098d735 100644
--- a/locales/en-US/tool.json
+++ b/locales/en-US/tool.json
@@ -30,9 +30,16 @@
"agentMarketplace.category.personalLife": "Personal Life",
"agentMarketplace.category.productManagement": "Product Management",
"agentMarketplace.category.salesCustomer": "Sales & Customer",
+ "agentMarketplace.inspector.moreCategories_one": "+{{count}}",
+ "agentMarketplace.inspector.moreCategories_other": "+{{count}}",
+ "agentMarketplace.inspector.pickCount_one": "{{count}} agent",
+ "agentMarketplace.inspector.pickCount_other": "{{count}} agents",
"agentMarketplace.picker.empty": "No templates available.",
"agentMarketplace.picker.failedToLoad": "Failed to load templates. Please try again later.",
"agentMarketplace.picker.summary": "{{filtered}} / {{total}} templates available.",
+ "agentMarketplace.render.alreadyInLibraryTag": "Already in library",
+ "agentMarketplace.render.alreadyInLibrary_one": "{{count}} already in library",
+ "agentMarketplace.render.alreadyInLibrary_other": "{{count}} already in library",
"codeInterpreter-legacy.error": "Execution Error",
"codeInterpreter-legacy.executing": "Executing...",
"codeInterpreter-legacy.files": "Files:",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 84cdd665054..64f8186c853 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -673,14 +673,14 @@
"tokenTag.used": "已使用",
"tool.intervention.approvalMode": "审批模式",
"tool.intervention.approve": "批准",
- "tool.intervention.approveAndRemember": "批准并记住",
- "tool.intervention.approveOnce": "仅本次批准",
"tool.intervention.mode.allowList": "白名单",
"tool.intervention.mode.allowListDesc": "仅自动执行已批准的技能",
"tool.intervention.mode.autoRun": "自动批准",
"tool.intervention.mode.autoRunDesc": "自动批准所有技能调用",
"tool.intervention.mode.manual": "手动批准",
"tool.intervention.mode.manualDesc": "每次调用都需要你确认",
+ "tool.intervention.onboarding.agentIdentity.editHint": "你可以直接在下方修改名字或头像",
+ "tool.intervention.onboarding.agentIdentity.namePlaceholder": "助手名字",
"tool.intervention.onboarding.agentIdentity.title": "我将更新自己的名字与头像",
"tool.intervention.onboarding.agentIdentity.titleAvatarOnly": "我将更新自己的头像",
"tool.intervention.onboarding.agentIdentity.titleNameOnly": "我将更新自己的名字",
@@ -690,14 +690,15 @@
"tool.intervention.onboarding.userProfile.fullName": "全名",
"tool.intervention.onboarding.userProfile.responseLanguage": "回复语言",
"tool.intervention.onboarding.userProfile.title": "确认您的资料更新",
+ "tool.intervention.optionApprove": "批准",
"tool.intervention.pending": "等待中",
"tool.intervention.reject": "拒绝",
- "tool.intervention.rejectAndContinue": "拒绝后继续",
"tool.intervention.rejectOnly": "仅拒绝",
- "tool.intervention.rejectReasonPlaceholder": "填写原因可帮助助理理解你的边界,并优化后续行动",
- "tool.intervention.rejectTitle": "拒绝本次技能调用",
+ "tool.intervention.rejectReasonPlaceholder": "告诉 Agent 你希望它怎么做",
"tool.intervention.rejectedWithReason": "本次技能调用已被拒绝:{{reason}}",
+ "tool.intervention.rememberSimilar": "类似操作不再询问",
"tool.intervention.scrollToIntervention": "查看",
+ "tool.intervention.submit": "提交",
"tool.intervention.toolAbort": "你已取消本次技能调用",
"tool.intervention.toolRejected": "本次技能调用已被拒绝",
"tool.intervention.viewParameters": "查看参数 ({{count}})",
@@ -809,7 +810,9 @@
"workflow.toolDisplayName.searchLocalFiles": "搜索了文件",
"workflow.toolDisplayName.searchSkill": "搜索了技能",
"workflow.toolDisplayName.searchUserMemory": "搜索了记忆",
+ "workflow.toolDisplayName.showAgentMarketplace": "组建了 Agent 团队",
"workflow.toolDisplayName.solve": "求解了方程",
+ "workflow.toolDisplayName.submitAgentPick": "选好了助手",
"workflow.toolDisplayName.updateAgent": "更新了助理",
"workflow.toolDisplayName.updateDocument": "更新了文档",
"workflow.toolDisplayName.updateIdentityMemory": "更新了记忆",
diff --git a/locales/zh-CN/onboarding.json b/locales/zh-CN/onboarding.json
index 9415fd49b84..790ab15f18c 100644
--- a/locales/zh-CN/onboarding.json
+++ b/locales/zh-CN/onboarding.json
@@ -29,7 +29,9 @@
"agent.layout.switchMessage": "暂时不想继续?可以切换到 <modeLink><modeText>{{mode}}</modeText></modeLink> 或 <skipLink><skipText>{{skip}}</skipText></skipLink>。",
"agent.modeSwitch.agent": "对话模式",
"agent.modeSwitch.classic": "经典模式",
+ "agent.modeSwitch.collapse": "收起",
"agent.modeSwitch.debug": "调试导出",
+ "agent.modeSwitch.expand": "展开",
"agent.modeSwitch.label": "选择您的入职模式",
"agent.modeSwitch.reset": "重置流程",
"agent.progress": "{{currentStep}}/{{totalSteps}}",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index 4d79bc493ee..9f8614dc907 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -69,7 +69,7 @@
"builtins.lobe-agent-management.render.installPlugin.plugin": "插件",
"builtins.lobe-agent-management.render.installPlugin.success": "安装成功",
"builtins.lobe-agent-management.title": "代理管理器",
- "builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "打开助手市场",
+ "builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "组建 Agent 团队",
"builtins.lobe-agent-marketplace.apiName.submitAgentPick": "提交助手选择",
"builtins.lobe-agent-marketplace.title": "助手市场",
"builtins.lobe-claude-code.agent.instruction": "指令",
@@ -322,6 +322,11 @@
"builtins.lobe-web-onboarding.inspector.interests_one": "{{count}} 个兴趣",
"builtins.lobe-web-onboarding.inspector.interests_other": "{{count}} 个兴趣",
"builtins.lobe-web-onboarding.title": "用户入门",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.delete": "删除",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.deleteLines": "删除行",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.insertAt": "在指定行插入",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.replace": "替换",
+ "builtins.lobe-web-onboarding.updateDocument.hunkMode.replaceLines": "替换行",
"confirm": "确认",
"debug.arguments": "调用参数",
"debug.error": "错误日志",
diff --git a/locales/zh-CN/tool.json b/locales/zh-CN/tool.json
index 9246903699f..3de23cee308 100644
--- a/locales/zh-CN/tool.json
+++ b/locales/zh-CN/tool.json
@@ -30,9 +30,16 @@
"agentMarketplace.category.personalLife": "个人生活",
"agentMarketplace.category.productManagement": "产品管理",
"agentMarketplace.category.salesCustomer": "销售与客户",
+ "agentMarketplace.inspector.moreCategories_one": "+{{count}}",
+ "agentMarketplace.inspector.moreCategories_other": "+{{count}}",
+ "agentMarketplace.inspector.pickCount_one": "{{count}} 个助手",
+ "agentMarketplace.inspector.pickCount_other": "{{count}} 个助手",
"agentMarketplace.picker.empty": "暂无可用模板。",
"agentMarketplace.picker.failedToLoad": "加载模板失败。请稍后再试。",
"agentMarketplace.picker.summary": "{{filtered}} / {{total}} 个模板可用。",
+ "agentMarketplace.render.alreadyInLibraryTag": "已在库中",
+ "agentMarketplace.render.alreadyInLibrary_one": "{{count}} 个已在库中",
+ "agentMarketplace.render.alreadyInLibrary_other": "{{count}} 个已在库中",
"codeInterpreter-legacy.error": "执行出错",
"codeInterpreter-legacy.executing": "正在执行...",
"codeInterpreter-legacy.files": "文件:",
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/ShowAgentMarketplace/index.tsx b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/ShowAgentMarketplace/index.tsx
new file mode 100644
index 00000000000..63079fe2187
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/ShowAgentMarketplace/index.tsx
@@ -0,0 +1,64 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { cx } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { inspectorTextStyles, shinyTextStyles } from '@/styles';
+
+import type { ShowAgentMarketplaceArgs } from '../../../types';
+import { CATEGORY_LABEL_I18N_KEYS } from '../../Intervention/PickAgents/constants';
+import { inspectorChipStyles } from '../_styles';
+
+const HIDDEN_CHIP_THRESHOLD = 3;
+
+export const ShowAgentMarketplaceInspector = memo<
+ BuiltinInspectorProps<ShowAgentMarketplaceArgs, Record<string, unknown>>
+>(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
+ const { t: tPlugin } = useTranslation('plugin');
+ const { t: tTool } = useTranslation('tool');
+ const styles = inspectorChipStyles;
+
+ const categoryHints = args?.categoryHints ?? partialArgs?.categoryHints ?? [];
+
+ if (isArgumentsStreaming && categoryHints.length === 0) {
+ return (
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
+ <span>{tPlugin('builtins.lobe-agent-marketplace.apiName.showAgentMarketplace')}</span>
+ </div>
+ );
+ }
+
+ const visibleHints = categoryHints.slice(0, HIDDEN_CHIP_THRESHOLD);
+ const overflowCount = categoryHints.length - visibleHints.length;
+
+ return (
+ <div
+ style={{ flexWrap: 'wrap', gap: 4 }}
+ className={cx(
+ inspectorTextStyles.root,
+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
+ )}
+ >
+ <span>{tPlugin('builtins.lobe-agent-marketplace.apiName.showAgentMarketplace')}</span>
+ {visibleHints.map((slug) => {
+ const labelKey = CATEGORY_LABEL_I18N_KEYS[slug];
+ return (
+ <span className={styles.chip} key={slug}>
+ {labelKey ? tTool(labelKey) : slug}
+ </span>
+ );
+ })}
+ {overflowCount > 0 && (
+ <span className={styles.meta}>
+ {tTool('agentMarketplace.inspector.moreCategories', { count: overflowCount })}
+ </span>
+ )}
+ </div>
+ );
+});
+
+ShowAgentMarketplaceInspector.displayName = 'ShowAgentMarketplaceInspector';
+
+export default ShowAgentMarketplaceInspector;
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/SubmitAgentPick/index.tsx b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/SubmitAgentPick/index.tsx
new file mode 100644
index 00000000000..827eb47864b
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/SubmitAgentPick/index.tsx
@@ -0,0 +1,50 @@
+'use client';
+
+import type { BuiltinInspectorProps } from '@lobechat/types';
+import { cx } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { inspectorTextStyles, shinyTextStyles } from '@/styles';
+
+import type { SubmitAgentPickArgs } from '../../../types';
+import { inspectorChipStyles } from '../_styles';
+
+export const SubmitAgentPickInspector = memo<
+ BuiltinInspectorProps<SubmitAgentPickArgs, Record<string, unknown>>
+>(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
+ const { t: tPlugin } = useTranslation('plugin');
+ const { t: tTool } = useTranslation('tool');
+ const styles = inspectorChipStyles;
+
+ const ids = args?.selectedTemplateIds ?? partialArgs?.selectedTemplateIds ?? [];
+
+ if (isArgumentsStreaming && ids.length === 0) {
+ return (
+ <div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
+ <span>{tPlugin('builtins.lobe-agent-marketplace.apiName.submitAgentPick')}</span>
+ </div>
+ );
+ }
+
+ return (
+ <div
+ style={{ gap: 4 }}
+ className={cx(
+ inspectorTextStyles.root,
+ (isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
+ )}
+ >
+ <span>{tPlugin('builtins.lobe-agent-marketplace.apiName.submitAgentPick')}</span>
+ {ids.length > 0 && (
+ <span className={styles.meta}>
+ {tTool('agentMarketplace.inspector.pickCount', { count: ids.length })}
+ </span>
+ )}
+ </div>
+ );
+});
+
+SubmitAgentPickInspector.displayName = 'SubmitAgentPickInspector';
+
+export default SubmitAgentPickInspector;
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/_styles.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/_styles.ts
new file mode 100644
index 00000000000..f572668aa3b
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/_styles.ts
@@ -0,0 +1,28 @@
+import { createStaticStyles } from 'antd-style';
+
+export const inspectorChipStyles = createStaticStyles(({ css, cssVar }) => ({
+ chip: css`
+ overflow: hidden;
+ display: inline-flex;
+ flex-shrink: 1;
+ align-items: center;
+
+ min-width: 0;
+ max-width: 200px;
+ padding-block: 2px;
+ padding-inline: 8px;
+ border-radius: 999px;
+
+ font-size: 12px;
+ color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+ meta: css`
+ flex-shrink: 0;
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
+ `,
+}));
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/index.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/index.ts
new file mode 100644
index 00000000000..4a339630e53
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Inspector/index.ts
@@ -0,0 +1,13 @@
+import type { BuiltinInspector } from '@lobechat/types';
+
+import { AgentMarketplaceApiName } from '../../types';
+import { ShowAgentMarketplaceInspector } from './ShowAgentMarketplace';
+import { SubmitAgentPickInspector } from './SubmitAgentPick';
+
+export const AgentMarketplaceInspectors: Record<string, BuiltinInspector> = {
+ [AgentMarketplaceApiName.showAgentMarketplace]: ShowAgentMarketplaceInspector as BuiltinInspector,
+ [AgentMarketplaceApiName.submitAgentPick]: SubmitAgentPickInspector as BuiltinInspector,
+};
+
+export { default as ShowAgentMarketplaceInspector } from './ShowAgentMarketplace';
+export { default as SubmitAgentPickInspector } from './SubmitAgentPick';
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/Skeleton.tsx b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/Skeleton.tsx
index d63ae348537..947e7ac8b85 100644
--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/Skeleton.tsx
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/Skeleton.tsx
@@ -16,8 +16,10 @@ const PickAgentsSkeleton = memo(() => (
<div className={styles.grid}>
{Array.from({ length: CARD_ITEMS }).map((_, i) => (
<div className={styles.skeletonCard} key={i}>
- <div className={styles.skeletonAvatar} />
- <div className={styles.skeletonLine} style={{ width: '60%' }} />
+ <div className={styles.cardHeader}>
+ <div className={styles.skeletonAvatar} />
+ <div className={styles.skeletonLine} style={{ flex: 1 }} />
+ </div>
<div className={styles.skeletonLine} style={{ width: '90%' }} />
<div className={styles.skeletonLine} style={{ width: '75%' }} />
</div>
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/index.tsx b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/index.tsx
index e83392f867b..f140e6df171 100644
--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/index.tsx
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/index.tsx
@@ -203,8 +203,10 @@ const PickAgentsIntervention = memo<BuiltinInterventionProps<ShowAgentMarketplac
onClick={() => toggle(tpl.id)}
onKeyDown={(event) => handleCardKeyDown(event, tpl.id)}
>
- <Avatar avatar={avatar} shape="square" size={36} />
- <div className={styles.cardTitle}>{tpl.title}</div>
+ <div className={styles.cardHeader}>
+ <Avatar avatar={avatar} shape="square" size={36} />
+ <div className={styles.cardTitle}>{tpl.title}</div>
+ </div>
{tpl.description && (
<div className={styles.cardDescription}>{tpl.description}</div>
)}
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/style.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/style.ts
index 6abe307a106..49774233774 100644
--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/style.ts
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Intervention/PickAgents/style.ts
@@ -20,10 +20,10 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
gap: 10px;
padding: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
+ border: 1px solid ${cssVar.colorFillSecondary};
border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorBgContainer};
+ background: ${cssVar.colorBgElevated};
transition:
border-color ${cssVar.motionDurationMid},
@@ -38,6 +38,12 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
outline-offset: 2px;
}
`,
+ cardHeader: css`
+ display: flex;
+ gap: 10px;
+ align-items: center;
+ min-width: 0;
+ `,
cardDescription: css`
overflow: hidden;
display: -webkit-box;
@@ -57,9 +63,16 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
}
`,
cardTitle: css`
+ overflow: hidden;
+ flex: 1;
+
+ min-width: 0;
+
font-size: 14px;
font-weight: 600;
color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
`,
container: css`
display: grid;
@@ -192,10 +205,10 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
gap: 10px;
padding: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
+ border: 1px solid ${cssVar.colorFillSecondary};
border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorBgContainer};
+ background: ${cssVar.colorBgElevated};
`,
skeletonLine: css`
height: 10px;
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Render/SubmitAgentPick/index.tsx b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Render/SubmitAgentPick/index.tsx
new file mode 100644
index 00000000000..2d2663c385b
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Render/SubmitAgentPick/index.tsx
@@ -0,0 +1,138 @@
+'use client';
+
+import type { BuiltinRenderProps } from '@lobechat/types';
+import { Avatar, Flexbox, Text } from '@lobehub/ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { InstallMarketplaceAgentSummary } from '../../../pickResult';
+import type { SubmitAgentPickArgs } from '../../../types';
+
+interface SubmitAgentPickState {
+ installedAgentIds?: string[];
+ selectedAgentIds?: string[];
+ skippedAgentIds?: string[];
+ summaries?: InstallMarketplaceAgentSummary[];
+}
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ card: css`
+ display: flex;
+ gap: 12px;
+ align-items: center;
+
+ padding: 12px;
+ border: 1px solid ${cssVar.colorFillSecondary};
+ border-radius: ${cssVar.borderRadiusLG};
+
+ background: ${cssVar.colorBgElevated};
+ `,
+ cardSkipped: css`
+ opacity: 0.65;
+ `,
+ description: css`
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+
+ font-size: 12px;
+ line-height: 1.5;
+ color: ${cssVar.colorTextSecondary};
+ `,
+ list: css`
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
+ gap: 8px;
+ width: 100%;
+ `,
+ meta: css`
+ flex-shrink: 0;
+ font-size: 12px;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ skippedTag: css`
+ flex-shrink: 0;
+
+ margin-inline-start: 4px;
+ padding-block: 1px;
+ padding-inline: 6px;
+ border-radius: 999px;
+
+ font-size: 11px;
+ color: ${cssVar.colorTextTertiary};
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+ title: css`
+ overflow: hidden;
+ flex: 1;
+
+ min-width: 0;
+
+ font-size: 14px;
+ font-weight: 600;
+ color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ `,
+ titleRow: css`
+ display: flex;
+ gap: 6px;
+ align-items: center;
+ width: 100%;
+ `,
+}));
+
+export type SubmitAgentPickRenderProps = Pick<
+ BuiltinRenderProps<SubmitAgentPickArgs, SubmitAgentPickState>,
+ 'pluginState'
+>;
+
+const SubmitAgentPick = memo<SubmitAgentPickRenderProps>(({ pluginState }) => {
+ const { t } = useTranslation('tool');
+ const summaries = pluginState?.summaries ?? [];
+
+ if (summaries.length === 0) return null;
+
+ const installedCount = summaries.filter((s) => !s.skipped).length;
+ const skippedCount = summaries.length - installedCount;
+
+ return (
+ <Flexbox gap={12}>
+ <Text style={{ fontSize: 13 }} type="secondary">
+ {t('agentMarketplace.inspector.pickCount', { count: installedCount })}
+ {skippedCount > 0 &&
+ ` · ${t('agentMarketplace.render.alreadyInLibrary', { count: skippedCount })}`}
+ </Text>
+ <div className={styles.list}>
+ {summaries.map((summary) => (
+ <div
+ className={cx(styles.card, summary.skipped && styles.cardSkipped)}
+ key={summary.templateId}
+ >
+ <Avatar avatar={summary.avatar || '🤖'} shape="square" size={36} />
+ <Flexbox flex={1} gap={4} style={{ minWidth: 0 }}>
+ <div className={styles.titleRow}>
+ <span className={styles.title}>{summary.title || summary.templateId}</span>
+ {summary.skipped && (
+ <span className={styles.skippedTag}>
+ {t('agentMarketplace.render.alreadyInLibraryTag')}
+ </span>
+ )}
+ </div>
+ {summary.description && (
+ <div className={styles.description}>{summary.description}</div>
+ )}
+ </Flexbox>
+ </div>
+ ))}
+ </div>
+ </Flexbox>
+ );
+});
+
+SubmitAgentPick.displayName = 'SubmitAgentPick';
+
+export default SubmitAgentPick;
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Render/index.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Render/index.ts
new file mode 100644
index 00000000000..fd43d025f79
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/Render/index.ts
@@ -0,0 +1,8 @@
+import { AgentMarketplaceApiName } from '../../types';
+import SubmitAgentPick from './SubmitAgentPick';
+
+export const AgentMarketplaceRenders = {
+ [AgentMarketplaceApiName.submitAgentPick]: SubmitAgentPick,
+};
+
+export { default as SubmitAgentPickRender } from './SubmitAgentPick';
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/index.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/index.ts
index 4512b115e84..84e12d6c3b7 100644
--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/index.ts
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/client/index.ts
@@ -1,3 +1,5 @@
export { AgentMarketplaceManifest } from '../manifest';
export * from '../types';
+export { AgentMarketplaceInspectors } from './Inspector';
export { AgentMarketplaceInterventions } from './Intervention';
+export { AgentMarketplaceRenders } from './Render';
diff --git a/packages/builtin-tool-web-onboarding/src/agentMarketplace/pickResult.ts b/packages/builtin-tool-web-onboarding/src/agentMarketplace/pickResult.ts
index 46f40e54e77..3f1cbef128d 100644
--- a/packages/builtin-tool-web-onboarding/src/agentMarketplace/pickResult.ts
+++ b/packages/builtin-tool-web-onboarding/src/agentMarketplace/pickResult.ts
@@ -6,6 +6,7 @@
*/
export interface InstallMarketplaceAgentSummary {
+ avatar?: string;
category?: string;
description?: string;
installedAgentId?: string;
diff --git a/packages/builtin-tool-web-onboarding/src/client/Intervention/SaveUserQuestion.tsx b/packages/builtin-tool-web-onboarding/src/client/Intervention/SaveUserQuestion.tsx
index 8944aa8b1fc..a01c080dd6a 100644
--- a/packages/builtin-tool-web-onboarding/src/client/Intervention/SaveUserQuestion.tsx
+++ b/packages/builtin-tool-web-onboarding/src/client/Intervention/SaveUserQuestion.tsx
@@ -1,8 +1,9 @@
'use client';
import type { BuiltinInterventionProps, SaveUserQuestionInput } from '@lobechat/types';
-import { Avatar, Flexbox, Text } from '@lobehub/ui';
-import { memo, useMemo } from 'react';
+import { EmojiPicker, Flexbox, Text } from '@lobehub/ui';
+import type { CSSProperties } from 'react';
+import { memo, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
const detailCardStyle = {
@@ -28,50 +29,103 @@ const detailValueStyle = {
padding: '10px 12px',
} as const;
+const nameInputStyle: CSSProperties = {
+ background: 'transparent',
+ border: 'none',
+ color: 'var(--lobe-colorText)',
+ flex: 1,
+ fontFamily: 'inherit',
+ fontSize: 16,
+ fontWeight: 600,
+ minWidth: 0,
+ outline: 'none',
+ padding: 0,
+};
+
+const emojiPickerStyle: CSSProperties = {
+ background: 'var(--lobe-fill-quaternary)',
+ borderRadius: 16,
+ cursor: 'pointer',
+ flex: 'none',
+};
+
interface DetailField {
label: string;
value: string;
}
interface AgentIdentitySectionProps {
- agentEmoji?: string;
- agentName?: string;
+ args: SaveUserQuestionInput;
+ onArgsChange?: BuiltinInterventionProps<SaveUserQuestionInput>['onArgsChange'];
+ registerBeforeApprove?: BuiltinInterventionProps<SaveUserQuestionInput>['registerBeforeApprove'];
}
-const AgentIdentitySection = memo<AgentIdentitySectionProps>(({ agentEmoji, agentName }) => {
- const { t } = useTranslation('chat');
-
- // Manifest routes name-only and emoji-only saves through the same intervention
- // as the both-fields case, so the title must reflect what's actually pending —
- // otherwise an emoji-only approval claims to also rename the agent.
- const titleKey =
- agentName && agentEmoji
- ? 'tool.intervention.onboarding.agentIdentity.title'
- : agentName
- ? 'tool.intervention.onboarding.agentIdentity.titleNameOnly'
- : 'tool.intervention.onboarding.agentIdentity.titleAvatarOnly';
-
- return (
- <Flexbox gap={12}>
- <Text style={{ fontSize: 16, fontWeight: 600 }}>{t(titleKey)}</Text>
+const AgentIdentitySection = memo<AgentIdentitySectionProps>(
+ ({ args, onArgsChange, registerBeforeApprove }) => {
+ const { i18n, t } = useTranslation('chat');
+
+ const [name, setName] = useState(args.agentName ?? '');
+ const [emoji, setEmoji] = useState(args.agentEmoji ?? '');
+
+ // Flush local edits into args before the framework triggers the actual save.
+ useEffect(() => {
+ if (!registerBeforeApprove || !onArgsChange) return;
+ return registerBeforeApprove('agentIdentity', async () => {
+ const trimmedName = name.trim();
+ const trimmedEmoji = emoji.trim();
+ await onArgsChange({
+ ...args,
+ agentEmoji: trimmedEmoji || undefined,
+ agentName: trimmedName || undefined,
+ });
+ });
+ }, [args, emoji, name, onArgsChange, registerBeforeApprove]);
+
+ // Manifest routes name-only and emoji-only saves through the same intervention,
+ // so the title must reflect the *live* edit state — adding a previously-missing
+ // field via the input/picker should flip the wording accordingly, instead of
+ // promising a name change that was never proposed (or vice versa).
+ const titleKey =
+ name && emoji
+ ? 'tool.intervention.onboarding.agentIdentity.title'
+ : name
+ ? 'tool.intervention.onboarding.agentIdentity.titleNameOnly'
+ : 'tool.intervention.onboarding.agentIdentity.titleAvatarOnly';
- <div style={detailCardStyle}>
- <Flexbox horizontal align="center" gap={12}>
- <Avatar
- avatar={agentEmoji || '🤖'}
- size={48}
- style={{
- background: 'var(--lobe-fill-quaternary)',
- borderRadius: 16,
- flex: 'none',
- }}
- />
- <Text style={{ fontSize: 16, fontWeight: 600 }}>{agentName || t('untitledAgent')}</Text>
+ return (
+ <Flexbox gap={12}>
+ <Flexbox gap={4}>
+ <Text style={{ fontSize: 16, fontWeight: 600 }}>{t(titleKey)}</Text>
+ <Text style={{ fontSize: 13 }} type="secondary">
+ {t('tool.intervention.onboarding.agentIdentity.editHint')}
+ </Text>
</Flexbox>
- </div>
- </Flexbox>
- );
-});
+
+ <div style={detailCardStyle}>
+ <Flexbox horizontal align="center" gap={12}>
+ <EmojiPicker
+ defaultAvatar={'🤖'}
+ locale={i18n.language}
+ shape={'square'}
+ size={48}
+ style={emojiPickerStyle}
+ value={emoji}
+ onChange={setEmoji}
+ />
+ <input
+ aria-label={t('tool.intervention.onboarding.agentIdentity.namePlaceholder')}
+ placeholder={t('tool.intervention.onboarding.agentIdentity.namePlaceholder')}
+ style={nameInputStyle}
+ type="text"
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ />
+ </Flexbox>
+ </div>
+ </Flexbox>
+ );
+ },
+);
AgentIdentitySection.displayName = 'AgentIdentitySection';
@@ -138,18 +192,22 @@ const UserProfileSection = memo<UserProfileSectionProps>(({ fullName, responseLa
UserProfileSection.displayName = 'UserProfileSection';
const SaveUserQuestionIntervention = memo<BuiltinInterventionProps<SaveUserQuestionInput>>(
- ({ args }) => {
- const agentName = args.agentName?.trim() || undefined;
- const agentEmoji = args.agentEmoji?.trim() || undefined;
+ ({ args, onArgsChange, registerBeforeApprove }) => {
const fullName = args.fullName?.trim() || undefined;
const responseLanguage = args.responseLanguage?.trim() || undefined;
- const hasAgentIdentity = Boolean(agentName || agentEmoji);
+ const hasAgentIdentity = Boolean(args.agentName || args.agentEmoji);
const hasUserProfile = Boolean(fullName || responseLanguage);
return (
<Flexbox gap={16}>
- {hasAgentIdentity && <AgentIdentitySection agentEmoji={agentEmoji} agentName={agentName} />}
+ {hasAgentIdentity && (
+ <AgentIdentitySection
+ args={args}
+ registerBeforeApprove={registerBeforeApprove}
+ onArgsChange={onArgsChange}
+ />
+ )}
{hasUserProfile && (
<UserProfileSection fullName={fullName} responseLanguage={responseLanguage} />
)}
diff --git a/packages/builtin-tool-web-onboarding/src/client/Render/UpdateDocument/HunkBlock.tsx b/packages/builtin-tool-web-onboarding/src/client/Render/UpdateDocument/HunkBlock.tsx
new file mode 100644
index 00000000000..ba23084674b
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/client/Render/UpdateDocument/HunkBlock.tsx
@@ -0,0 +1,172 @@
+'use client';
+
+import type { MarkdownPatchHunk } from '@lobechat/markdown-patch';
+import { createStaticStyles } from 'antd-style';
+import type { ReactNode } from 'react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ added: css`
+ overflow: auto;
+
+ max-height: 200px;
+ margin: 0;
+ padding-block: 6px;
+ padding-inline: 10px;
+ border-inline-start: 2px solid ${cssVar.colorSuccess};
+ border-radius: 0 6px 6px 0;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ line-height: 1.5;
+ color: ${cssVar.colorText};
+ word-break: break-word;
+ white-space: pre-wrap;
+
+ background: ${cssVar.colorSuccessBg};
+ `,
+ block: css`
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ `,
+ count: css`
+ flex-shrink: 0;
+
+ margin-inline-start: auto;
+
+ font-size: 12px;
+ font-weight: 400;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ label: css`
+ display: flex;
+ gap: 8px;
+ align-items: center;
+
+ font-size: 12px;
+ font-weight: 500;
+ color: ${cssVar.colorTextSecondary};
+ `,
+ lineRange: css`
+ padding-block: 1px;
+ padding-inline: 6px;
+ border-radius: 4px;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 11px;
+ color: ${cssVar.colorTextTertiary};
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+ removed: css`
+ overflow: auto;
+
+ max-height: 200px;
+ margin: 0;
+ padding-block: 6px;
+ padding-inline: 10px;
+ border-inline-start: 2px solid ${cssVar.colorError};
+ border-radius: 0 6px 6px 0;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ line-height: 1.5;
+ color: ${cssVar.colorTextSecondary};
+ word-break: break-word;
+ white-space: pre-wrap;
+
+ background: ${cssVar.colorErrorBg};
+ `,
+}));
+
+interface HunkBlockProps {
+ countLabel?: string;
+ hunk: MarkdownPatchHunk;
+}
+
+interface HunkContent {
+ added?: string;
+ labelKey:
+ | 'builtins.lobe-web-onboarding.updateDocument.hunkMode.delete'
+ | 'builtins.lobe-web-onboarding.updateDocument.hunkMode.deleteLines'
+ | 'builtins.lobe-web-onboarding.updateDocument.hunkMode.insertAt'
+ | 'builtins.lobe-web-onboarding.updateDocument.hunkMode.replace'
+ | 'builtins.lobe-web-onboarding.updateDocument.hunkMode.replaceLines';
+ lineRange?: string;
+ removed?: string;
+}
+
+const resolveHunk = (hunk: MarkdownPatchHunk): HunkContent => {
+ switch (hunk.mode) {
+ case 'delete': {
+ return {
+ labelKey: 'builtins.lobe-web-onboarding.updateDocument.hunkMode.delete',
+ removed: hunk.search,
+ };
+ }
+ case 'deleteLines': {
+ return {
+ labelKey: 'builtins.lobe-web-onboarding.updateDocument.hunkMode.deleteLines',
+ lineRange: `${hunk.startLine}–${hunk.endLine}`,
+ };
+ }
+ case 'insertAt': {
+ return {
+ added: hunk.content,
+ labelKey: 'builtins.lobe-web-onboarding.updateDocument.hunkMode.insertAt',
+ lineRange: `L${hunk.line}`,
+ };
+ }
+ case 'replaceLines': {
+ return {
+ added: hunk.content,
+ labelKey: 'builtins.lobe-web-onboarding.updateDocument.hunkMode.replaceLines',
+ lineRange: `${hunk.startLine}–${hunk.endLine}`,
+ };
+ }
+ default: {
+ // 'replace' or undefined — both shapes are MarkdownPatchReplaceHunk
+ return {
+ added: hunk.replace,
+ labelKey: 'builtins.lobe-web-onboarding.updateDocument.hunkMode.replace',
+ removed: hunk.search,
+ };
+ }
+ }
+};
+
+const HunkBlock = memo<HunkBlockProps>(({ countLabel, hunk }) => {
+ const { t } = useTranslation('plugin');
+ const { added, labelKey, lineRange, removed } = resolveHunk(hunk);
+
+ const blocks: ReactNode[] = [];
+ if (removed)
+ blocks.push(
+ <pre className={styles.removed} key="removed">
+ {removed}
+ </pre>,
+ );
+ if (added)
+ blocks.push(
+ <pre className={styles.added} key="added">
+ {added}
+ </pre>,
+ );
+
+ return (
+ <div className={styles.block}>
+ <div className={styles.label}>
+ <span>{t(labelKey)}</span>
+ {lineRange && <span className={styles.lineRange}>{lineRange}</span>}
+ {countLabel && <span className={styles.count}>{countLabel}</span>}
+ </div>
+ {blocks}
+ </div>
+ );
+});
+
+HunkBlock.displayName = 'HunkBlock';
+
+export default HunkBlock;
diff --git a/packages/builtin-tool-web-onboarding/src/client/Render/UpdateDocument/index.tsx b/packages/builtin-tool-web-onboarding/src/client/Render/UpdateDocument/index.tsx
new file mode 100644
index 00000000000..b618304ba5e
--- /dev/null
+++ b/packages/builtin-tool-web-onboarding/src/client/Render/UpdateDocument/index.tsx
@@ -0,0 +1,42 @@
+'use client';
+
+import type { MarkdownPatchHunk } from '@lobechat/markdown-patch';
+import type { BuiltinRenderProps } from '@lobechat/types';
+import { Flexbox } from '@lobehub/ui';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import type { UpdateDocumentArgs, WebOnboardingDocumentType } from '../../../types';
+import HunkBlock from './HunkBlock';
+
+interface UpdateDocumentState {
+ applied?: number;
+ id?: string;
+ type?: WebOnboardingDocumentType;
+}
+
+export type UpdateDocumentRenderProps = Pick<
+ BuiltinRenderProps<UpdateDocumentArgs, UpdateDocumentState>,
+ 'args'
+>;
+
+const UpdateDocument = memo<UpdateDocumentRenderProps>(({ args }) => {
+ const { t } = useTranslation('plugin');
+ const hunks: MarkdownPatchHunk[] = args?.hunks ?? [];
+
+ if (hunks.length === 0) return null;
+
+ const totalLabel = t('builtins.lobe-web-onboarding.inspector.hunkCount', {
+ count: hunks.length,
+ });
+
+ return (
+ <Flexbox gap={12}>
+ {hunks.map((hunk, i) => (
+ <HunkBlock countLabel={i === 0 ? totalLabel : undefined} hunk={hunk} key={i} />
+ ))}
+ </Flexbox>
+ );
+});
+
+export default UpdateDocument;
diff --git a/packages/builtin-tool-web-onboarding/src/client/Render/index.ts b/packages/builtin-tool-web-onboarding/src/client/Render/index.ts
index 3affedb3a6c..f01214c9810 100644
--- a/packages/builtin-tool-web-onboarding/src/client/Render/index.ts
+++ b/packages/builtin-tool-web-onboarding/src/client/Render/index.ts
@@ -1,8 +1,11 @@
import { WebOnboardingApiName } from '../../types';
+import UpdateDocument from './UpdateDocument';
import WriteDocument from './WriteDocument';
export const WebOnboardingRenders = {
+ [WebOnboardingApiName.updateDocument]: UpdateDocument,
[WebOnboardingApiName.writeDocument]: WriteDocument,
};
+export { default as UpdateDocumentRender } from './UpdateDocument';
export { default as WriteDocumentRender } from './WriteDocument';
diff --git a/packages/builtin-tools/src/inspectors.ts b/packages/builtin-tools/src/inspectors.ts
index d5b836330db..8f3ec5f1386 100644
--- a/packages/builtin-tools/src/inspectors.ts
+++ b/packages/builtin-tools/src/inspectors.ts
@@ -52,6 +52,10 @@ import {
WebBrowsingInspectors,
WebBrowsingManifest,
} from '@lobechat/builtin-tool-web-browsing/client';
+import {
+ AgentMarketplaceInspectors,
+ AgentMarketplaceManifest,
+} from '@lobechat/builtin-tool-web-onboarding/agentMarketplace/client';
import {
WebOnboardingInspectors,
WebOnboardingManifest,
@@ -76,6 +80,10 @@ const BuiltinToolInspectors: Record<string, Record<string, BuiltinInspector>> =
string,
BuiltinInspector
>,
+ [AgentMarketplaceManifest.identifier]: AgentMarketplaceInspectors as Record<
+ string,
+ BuiltinInspector
+ >,
[ClaudeCodeIdentifier]: ClaudeCodeInspectors as Record<string, BuiltinInspector>,
[CloudSandboxIdentifier]: CloudSandboxInspectors as Record<string, BuiltinInspector>,
[GroupAgentBuilderManifest.identifier]: GroupAgentBuilderInspectors as Record<
diff --git a/packages/builtin-tools/src/renders.ts b/packages/builtin-tools/src/renders.ts
index 1cafb669e05..34fa3f144e4 100644
--- a/packages/builtin-tools/src/renders.ts
+++ b/packages/builtin-tools/src/renders.ts
@@ -34,6 +34,10 @@ import {
WebBrowsingManifest,
WebBrowsingRenders,
} from '@lobechat/builtin-tool-web-browsing/client';
+import {
+ AgentMarketplaceManifest,
+ AgentMarketplaceRenders,
+} from '@lobechat/builtin-tool-web-onboarding/agentMarketplace/client';
import {
WebOnboardingManifest,
WebOnboardingRenders,
@@ -59,6 +63,7 @@ const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
[AgentBuilderManifest.identifier]: AgentBuilderRenders as Record<string, BuiltinRender>,
[AgentDocumentsManifest.identifier]: AgentDocumentsRenders as Record<string, BuiltinRender>,
[AgentManagementManifest.identifier]: AgentManagementRenders as Record<string, BuiltinRender>,
+ [AgentMarketplaceManifest.identifier]: AgentMarketplaceRenders as Record<string, BuiltinRender>,
[ClaudeCodeIdentifier]: ClaudeCodeRenders as Record<string, BuiltinRender>,
[CloudSandboxManifest.identifier]: CloudSandboxRenders as Record<string, BuiltinRender>,
[GroupAgentBuilderManifest.identifier]: GroupAgentBuilderRenders as Record<string, BuiltinRender>,
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsx
index dfb4733d4c9..a602757008a 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsx
@@ -1,7 +1,9 @@
-import { Button, DropdownMenu, Flexbox, Popover } from '@lobehub/ui';
-import { Input, Space } from 'antd';
-import { ChevronDown } from 'lucide-react';
-import { memo, useState } from 'react';
+import { Button, Flexbox } from '@lobehub/ui';
+import { Checkbox } from 'antd';
+import { createStaticStyles, cx } from 'antd-style';
+import { CornerDownLeft } from 'lucide-react';
+import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
+import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useUserStore } from '@/store/user';
@@ -23,16 +25,115 @@ interface ApprovalActionsProps {
toolCallId: string;
}
+type Choice = 'approve' | 'reject';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ container: css`
+ width: 100%;
+ `,
+ footer: css`
+ display: flex;
+ justify-content: flex-end;
+ margin-block-start: 12px;
+ `,
+ number: css`
+ flex-shrink: 0;
+ width: 18px;
+ font-variant-numeric: tabular-nums;
+ color: ${cssVar.colorTextTertiary};
+ `,
+ option: css`
+ cursor: pointer;
+
+ display: flex;
+ gap: 8px;
+ align-items: center;
+
+ padding-block: 8px;
+ padding-inline: 12px;
+ border-radius: 8px;
+
+ color: ${cssVar.colorTextSecondary};
+
+ transition:
+ background 120ms,
+ color 120ms;
+
+ &:hover {
+ color: ${cssVar.colorText};
+ background: ${cssVar.colorFillTertiary};
+ }
+ `,
+ optionLabel: css`
+ flex: 1;
+ line-height: 1.4;
+ `,
+ optionList: css`
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ `,
+ optionSelected: css`
+ color: ${cssVar.colorText};
+ background: ${cssVar.colorFillSecondary};
+
+ &:hover {
+ background: ${cssVar.colorFillSecondary};
+ }
+ `,
+ rejectInput: css`
+ flex: 1;
+
+ width: 100%;
+ padding: 0;
+ border: none;
+ border-radius: 0;
+
+ font-family: inherit;
+ font-size: 14px;
+ line-height: 1.4;
+ color: ${cssVar.colorText};
+
+ background: transparent;
+
+ &::placeholder {
+ color: ${cssVar.colorTextSecondary};
+ }
+
+ &:focus,
+ &:focus-visible {
+ outline: none;
+ }
+
+ &:disabled {
+ cursor: pointer;
+ color: ${cssVar.colorTextSecondary};
+ }
+ `,
+ rememberRow: css`
+ margin-block: -2px 4px;
+ padding-block: 4px;
+ padding-inline-start: 42px;
+ `,
+ shortcutHint: css`
+ display: inline-flex;
+ align-items: center;
+ margin-inline-start: 6px;
+ color: ${cssVar.colorTextTertiary};
+ `,
+}));
+
const ApprovalActions = memo<ApprovalActionsProps>(
- ({ approvalMode, messageId, identifier, apiName, onBeforeApprove, assistantGroupId }) => {
- const { t } = useTranslation(['chat', 'common']);
- const [rejectReason, setRejectReason] = useState('');
- const [rejectPopoverOpen, setRejectPopoverOpen] = useState(false);
- const [rejectLoading, setRejectLoading] = useState(false);
- const [approveLoading, setApproveLoading] = useState(false);
-
- // Disable actions while message is still being created (temp ID)
+ ({ approvalMode, apiName, assistantGroupId, identifier, messageId, onBeforeApprove }) => {
+ const { t } = useTranslation('chat');
+ const [choice, setChoice] = useState<Choice>('approve');
+ const [remember, setRemember] = useState(false);
+ const [reason, setReason] = useState('');
+ const [loading, setLoading] = useState(false);
+ const rejectInputRef = useRef<HTMLInputElement>(null);
+
const isMessageCreating = messageId.startsWith('tmp_');
+ const isAllowListMode = approvalMode === 'allow-list';
const [approveToolCall, rejectAndContinueToolCall] = useConversationStore((s) => [
s.approveToolCall,
@@ -40,113 +141,168 @@ const ApprovalActions = memo<ApprovalActionsProps>(
]);
const addToolToAllowList = useUserStore((s) => s.addToolToAllowList);
- const handleApprove = async (remember?: boolean) => {
- setApproveLoading(true);
+ const handleSubmit = useCallback(async () => {
+ if (loading || isMessageCreating) return;
+ setLoading(true);
try {
- if (onBeforeApprove) {
- await onBeforeApprove();
+ if (choice === 'approve') {
+ if (onBeforeApprove) await onBeforeApprove();
+ await approveToolCall(messageId, assistantGroupId ?? '');
+ if (isAllowListMode && remember) {
+ await addToolToAllowList(`${identifier}/${apiName}`);
+ }
+ } else {
+ await rejectAndContinueToolCall(messageId, reason.trim() || undefined);
}
+ } finally {
+ setLoading(false);
+ }
+ }, [
+ addToolToAllowList,
+ apiName,
+ approveToolCall,
+ assistantGroupId,
+ choice,
+ identifier,
+ isAllowListMode,
+ isMessageCreating,
+ loading,
+ messageId,
+ onBeforeApprove,
+ reason,
+ rejectAndContinueToolCall,
+ remember,
+ ]);
- await approveToolCall(messageId, assistantGroupId ?? '');
+ // When choice flips to reject (via click on row, '2', or arrow), pull focus
+ // into the inline input so the user can start typing the reason immediately.
+ useEffect(() => {
+ if (choice === 'reject') {
+ rejectInputRef.current?.focus();
+ }
+ }, [choice]);
- if (remember) {
- const toolKey = `${identifier}/${apiName}`;
- await addToolToAllowList(toolKey);
+ // Window-level keyboard: 1/2/↑/↓ to switch, Enter to submit. Skip while
+ // typing anywhere on the page so we never hijack the main chat composer.
+ // The reject input has its own onKeyDown for Enter / ↑.
+ useEffect(() => {
+ const handler = (e: KeyboardEvent) => {
+ const target = e.target as HTMLElement | null;
+ if (target) {
+ const tag = target.tagName;
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || target.isContentEditable) return;
}
- } finally {
- setApproveLoading(false);
- }
- };
+ if (e.metaKey || e.ctrlKey || e.altKey) return;
+ switch (e.key) {
+ case '1': {
+ e.preventDefault();
+ setChoice('approve');
+ break;
+ }
+ case '2': {
+ e.preventDefault();
+ setChoice('reject');
+ break;
+ }
+ case 'ArrowUp':
+ case 'ArrowDown': {
+ e.preventDefault();
+ setChoice((c) => (c === 'approve' ? 'reject' : 'approve'));
+ break;
+ }
+ case 'Enter': {
+ if (e.shiftKey) return;
+ e.preventDefault();
+ void handleSubmit();
+ break;
+ }
+ // No default
+ }
+ };
+ window.addEventListener('keydown', handler);
+ return () => {
+ window.removeEventListener('keydown', handler);
+ };
+ }, [handleSubmit]);
- const handleReject = async (reason?: string) => {
- setRejectLoading(true);
- await rejectAndContinueToolCall(messageId, reason);
- setRejectLoading(false);
- setRejectPopoverOpen(false);
- setRejectReason('');
+ const handleRejectInputKeyDown = (e: ReactKeyboardEvent<HTMLInputElement>) => {
+ if (e.metaKey || e.ctrlKey || e.altKey) return;
+ if (e.key === 'Enter' && !e.shiftKey) {
+ e.preventDefault();
+ void handleSubmit();
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault();
+ setChoice('approve');
+ rejectInputRef.current?.blur();
+ }
};
return (
- <Flexbox horizontal gap={8}>
- <Popover
- open={rejectPopoverOpen}
- placement="bottomRight"
- trigger="click"
- content={
- <Flexbox gap={12} style={{ width: 400 }}>
- <Flexbox horizontal align={'center'} justify={'space-between'}>
- <div>{t('tool.intervention.rejectTitle')}</div>
-
- <Button
- loading={rejectLoading}
- size="small"
- type="primary"
- onClick={() => handleReject(rejectReason)}
- >
- {t('tool.intervention.rejectAndContinue')}
- </Button>
- </Flexbox>
- <Input.TextArea
- autoFocus
- placeholder={t('tool.intervention.rejectReasonPlaceholder')}
- rows={3}
- value={rejectReason}
- variant={'filled'}
- onChange={(e) => setRejectReason(e.target.value)}
- />
- </Flexbox>
- }
- onOpenChange={(open) => {
- if (rejectLoading) return;
-
- setRejectPopoverOpen(open);
- }}
- >
- <Button color={'default'} disabled={isMessageCreating} size="small" variant={'filled'}>
- {t('tool.intervention.reject')}
- </Button>
- </Popover>
-
- {approvalMode === 'allow-list' ? (
- <Space.Compact>
- <Button
- disabled={isMessageCreating}
- loading={approveLoading}
- size="small"
- type="primary"
- onClick={() => handleApprove(true)}
- >
- {t('tool.intervention.approveAndRemember')}
- </Button>
- <DropdownMenu
- items={[
- {
- disabled: approveLoading || isMessageCreating,
- key: 'once',
- label: t('tool.intervention.approveOnce'),
- onClick: () => handleApprove(false),
- },
- ]}
- >
- <Button
- disabled={approveLoading || isMessageCreating}
- icon={ChevronDown}
- size="small"
- type="primary"
- />
- </DropdownMenu>
- </Space.Compact>
- ) : (
+ <Flexbox className={styles.container}>
+ <div className={styles.optionList} role="radiogroup">
+ <div
+ aria-checked={choice === 'approve'}
+ className={cx(styles.option, choice === 'approve' && styles.optionSelected)}
+ role="radio"
+ onClick={() => setChoice('approve')}
+ >
+ <span className={styles.number}>1.</span>
+ <span className={styles.optionLabel}>{t('tool.intervention.optionApprove')}</span>
+ </div>
+
+ {isAllowListMode && choice === 'approve' && (
+ <div className={styles.rememberRow}>
+ <Checkbox
+ checked={remember}
+ disabled={loading || isMessageCreating}
+ onChange={(e) => setRemember(e.target.checked)}
+ >
+ {t('tool.intervention.rememberSimilar')}
+ </Checkbox>
+ </div>
+ )}
+
+ <div
+ aria-checked={choice === 'reject'}
+ className={cx(styles.option, choice === 'reject' && styles.optionSelected)}
+ role="radio"
+ onClick={() => {
+ setChoice('reject');
+ rejectInputRef.current?.focus();
+ }}
+ >
+ <span className={styles.number}>2.</span>
+ <input
+ aria-label={t('tool.intervention.rejectReasonPlaceholder')}
+ className={styles.rejectInput}
+ disabled={loading || isMessageCreating}
+ placeholder={t('tool.intervention.rejectReasonPlaceholder')}
+ ref={rejectInputRef}
+ type="text"
+ value={reason}
+ onChange={(e) => setReason(e.target.value)}
+ onClick={(e) => e.stopPropagation()}
+ onFocus={() => setChoice('reject')}
+ onKeyDown={handleRejectInputKeyDown}
+ />
+ </div>
+ </div>
+
+ <div className={styles.footer}>
<Button
disabled={isMessageCreating}
- loading={approveLoading}
- size="small"
- type="primary"
- onClick={() => handleApprove()}
+ loading={loading}
+ shape={'round'}
+ size={'middle'}
+ type={'primary'}
+ onClick={handleSubmit}
>
- {t('tool.intervention.approve')}
+ {t('tool.intervention.submit')}
+ <span className={styles.shortcutHint}>
+ <CornerDownLeft size={12} />
+ </span>
</Button>
- )}
+ </div>
</Flexbox>
);
},
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts
index 0a48db7743a..56ace1238c4 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/customInteractionHandlers.ts
@@ -11,6 +11,7 @@ import { installMarketplaceAgents } from './installMarketplaceAgents';
interface SubmitToolInteractionOptions {
createUserMessage?: boolean;
+ pluginState?: Record<string, unknown>;
toolResultContent?: string;
}
@@ -90,6 +91,13 @@ const handleAgentMarketplaceSubmit: CustomInteractionSubmitHandler = async (payl
return {
options: {
createUserMessage: false,
+ pluginState: {
+ installedAgentIds: result.installedAgentIds,
+ requestId: pickBase?.requestId,
+ selectedAgentIds,
+ skippedAgentIds: result.skippedAgentIds,
+ summaries: result.summaries,
+ },
toolResultContent: buildAgentMarketplaceToolResult({
installedAgentIds: result.installedAgentIds,
selectedAgentIds,
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/installMarketplaceAgents.ts b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/installMarketplaceAgents.ts
index 0b31fa5cacb..24a30273fe2 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/installMarketplaceAgents.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/installMarketplaceAgents.ts
@@ -54,6 +54,7 @@ export const installMarketplaceAgents = async (
}
const summaryBase: InstallMarketplaceAgentSummary = {
+ avatar: marketAgent.avatar,
category: marketAgent.category,
description: marketAgent.description || marketAgent.summary,
skipped: false,
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/webOnboarding.test.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/webOnboarding.test.tsx
index a34f52b307b..c578690dd81 100644
--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/webOnboarding.test.tsx
+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/webOnboarding.test.tsx
@@ -1,12 +1,17 @@
/**
* @vitest-environment happy-dom
*/
-import { render, screen } from '@testing-library/react';
+import { fireEvent, render, screen } from '@testing-library/react';
import type { ReactNode } from 'react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
vi.mock('@lobehub/ui', () => ({
Avatar: ({ avatar }: { avatar: string }) => <div>{avatar}</div>,
+ EmojiPicker: ({ onChange, value }: { onChange?: (next: string) => void; value?: string }) => (
+ <button data-testid="emoji-picker" type="button" onClick={() => onChange?.('🪶')}>
+ {value || ''}
+ </button>
+ ),
Flexbox: ({ children }: { children?: ReactNode; [key: string]: unknown }) => (
<div>{children}</div>
),
@@ -17,13 +22,16 @@ vi.mock('@lobehub/ui', () => ({
vi.mock('react-i18next', () => ({
useTranslation: () => ({
+ i18n: { language: 'en-US' },
t: (key: string) =>
(
({
+ 'tool.intervention.onboarding.agentIdentity.editHint':
+ 'Not what you wanted? Click the avatar or name to edit directly.',
+ 'tool.intervention.onboarding.agentIdentity.namePlaceholder': 'Agent name',
'tool.intervention.onboarding.agentIdentity.title': "I'll update my name and avatar",
'tool.intervention.onboarding.agentIdentity.titleAvatarOnly': "I'll update my avatar",
'tool.intervention.onboarding.agentIdentity.titleNameOnly': "I'll update my name",
- 'untitledAgent': 'Untitled Agent',
}) satisfies Record<string, string>
)[key] || key,
}),
@@ -46,7 +54,7 @@ describe('web onboarding intervention registry', () => {
render(<Component args={{ agentEmoji: '🛰️', agentName: 'Atlas' }} messageId="message-1" />);
expect(screen.getByText("I'll update my name and avatar")).toBeInTheDocument();
- expect(screen.getByText('Atlas')).toBeInTheDocument();
+ expect(screen.getByDisplayValue('Atlas')).toBeInTheDocument();
expect(screen.getByText('🛰️')).toBeInTheDocument();
});
@@ -67,4 +75,49 @@ describe('web onboarding intervention registry', () => {
expect(screen.getByText("I'll update my avatar")).toBeInTheDocument();
expect(screen.queryByText("I'll update my name and avatar")).not.toBeInTheDocument();
});
+
+ it('flips title to combined when user types a name into an emoji-only proposal', () => {
+ if (!Component) throw new TypeError('Expected web onboarding intervention to be registered');
+
+ render(<Component args={{ agentEmoji: '🛰️' }} messageId="message-4" />);
+
+ expect(screen.getByText("I'll update my avatar")).toBeInTheDocument();
+ fireEvent.change(screen.getByPlaceholderText('Agent name'), { target: { value: 'Atlas' } });
+ expect(screen.getByText("I'll update my name and avatar")).toBeInTheDocument();
+ });
+
+ it('flushes edited name and emoji to onArgsChange when approve is requested', async () => {
+ if (!Component) throw new TypeError('Expected web onboarding intervention to be registered');
+
+ const onArgsChange = vi.fn();
+ let beforeApproveCallback: (() => Promise<void>) | undefined;
+ const registerBeforeApprove = (_id: string, callback: () => Promise<void>) => {
+ beforeApproveCallback = callback;
+ return () => {
+ beforeApproveCallback = undefined;
+ };
+ };
+
+ render(
+ <Component
+ args={{ agentEmoji: '🛰️', agentName: 'Atlas' }}
+ messageId="message-5"
+ registerBeforeApprove={registerBeforeApprove}
+ onArgsChange={onArgsChange}
+ />,
+ );
+
+ fireEvent.change(screen.getByPlaceholderText('Agent name'), {
+ target: { value: 'Aurora' },
+ });
+ fireEvent.click(screen.getByTestId('emoji-picker'));
+
+ expect(beforeApproveCallback).toBeTypeOf('function');
+ await beforeApproveCallback!();
+
+ expect(onArgsChange).toHaveBeenCalledWith({
+ agentEmoji: '🪶',
+ agentName: 'Aurora',
+ });
+ });
});
diff --git a/src/features/Conversation/Messages/AssistantGroup/constants.ts b/src/features/Conversation/Messages/AssistantGroup/constants.ts
index ad3525e1163..7b612864030 100644
--- a/src/features/Conversation/Messages/AssistantGroup/constants.ts
+++ b/src/features/Conversation/Messages/AssistantGroup/constants.ts
@@ -215,4 +215,8 @@ export const TOOL_API_DISPLAY_NAMES: Record<string, string> = {
// Web onboarding
saveUserQuestion: 'workflow.toolDisplayName.saveUserQuestion',
writeDocument: 'workflow.toolDisplayName.writeDocument',
+
+ // Agent marketplace
+ showAgentMarketplace: 'workflow.toolDisplayName.showAgentMarketplace',
+ submitAgentPick: 'workflow.toolDisplayName.submitAgentPick',
};
diff --git a/src/features/Conversation/store/slices/tool/action.ts b/src/features/Conversation/store/slices/tool/action.ts
index 728fa8d2dec..66d6bc19be7 100644
--- a/src/features/Conversation/store/slices/tool/action.ts
+++ b/src/features/Conversation/store/slices/tool/action.ts
@@ -109,7 +109,11 @@ export class ToolActionImpl {
submitToolInteraction = async (
toolMessageId: string,
response: Record<string, unknown>,
- options?: { createUserMessage?: boolean; toolResultContent?: string },
+ options?: {
+ createUserMessage?: boolean;
+ pluginState?: Record<string, unknown>;
+ toolResultContent?: string;
+ },
): Promise<void> => {
const { context } = this.#get();
const chatStore = useChatStore.getState();
diff --git a/src/features/Onboarding/components/ModeSwitch.tsx b/src/features/Onboarding/components/ModeSwitch.tsx
index 59cc7ec0d21..6bca12b01b3 100644
--- a/src/features/Onboarding/components/ModeSwitch.tsx
+++ b/src/features/Onboarding/components/ModeSwitch.tsx
@@ -1,15 +1,18 @@
'use client';
import { isDesktop } from '@lobechat/const';
-import { Flexbox, Segmented, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Segmented, Text } from '@lobehub/ui';
import { createStaticStyles, cx } from 'antd-style';
+import { ChevronLeft, ChevronRight } from 'lucide-react';
import type { CSSProperties, ReactNode } from 'react';
-import { memo, useMemo } from 'react';
+import { memo, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router-dom';
import { useServerConfigStore } from '@/store/serverConfig';
+const COLLAPSED_STORAGE_KEY = 'LOBE_ONBOARDING_MODE_SWITCH_COLLAPSED';
+
const styles = createStaticStyles(({ css, cssVar }) => ({
anchor: css`
position: fixed;
@@ -41,6 +44,10 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
backdrop-filter: blur(16px) saturate(1.2);
box-shadow: ${cssVar.boxShadowSecondary};
`,
+ pillCollapsed: css`
+ padding-block: 4px;
+ padding-inline: 4px;
+ `,
}));
interface ModeSwitchProps {
@@ -57,6 +64,16 @@ const ModeSwitch = memo<ModeSwitchProps>(({ actions, className, showLabel = fals
const enableAgentOnboarding = useServerConfigStore((s) => s.featureFlags.enableAgentOnboarding);
const serverConfigInit = useServerConfigStore((s) => s.serverConfigInit);
+ const [collapsed, setCollapsed] = useState(() => {
+ if (typeof window === 'undefined') return false;
+ return window.localStorage.getItem(COLLAPSED_STORAGE_KEY) === '1';
+ });
+
+ useEffect(() => {
+ if (typeof window === 'undefined') return;
+ window.localStorage.setItem(COLLAPSED_STORAGE_KEY, collapsed ? '1' : '0');
+ }, [collapsed]);
+
const mode = useMemo(() => {
return location.pathname.startsWith('/onboarding/agent') ? 'agent' : 'classic';
}, [location.pathname]);
@@ -84,20 +101,34 @@ const ModeSwitch = memo<ModeSwitchProps>(({ actions, className, showLabel = fals
if (!segmented && !actions) return null;
+ const collapseToggle = (
+ <ActionIcon
+ icon={collapsed ? ChevronLeft : ChevronRight}
+ size={'small'}
+ title={collapsed ? t('agent.modeSwitch.expand') : t('agent.modeSwitch.collapse')}
+ onClick={() => setCollapsed((v) => !v)}
+ />
+ );
+
return (
<Flexbox
- className={cx(styles.anchor, showLabel && styles.anchorWithLabel, className)}
style={style}
+ className={cx(styles.anchor, showLabel && !collapsed && styles.anchorWithLabel, className)}
>
- {showLabel && segmented && (
+ {showLabel && segmented && !collapsed && (
<Text style={{ paddingInline: 4 }} type={'secondary'}>
{t('agent.modeSwitch.label')}
</Text>
)}
{actions ? (
- <div className={styles.pill}>
- {actions}
- {segmented}
+ <div className={cx(styles.pill, collapsed && styles.pillCollapsed)}>
+ {collapseToggle}
+ {!collapsed && (
+ <>
+ {actions}
+ {segmented}
+ </>
+ )}
</div>
) : (
segmented
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index 07f9f7961e7..41619a23aee 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -727,14 +727,18 @@ export default {
'tokenTag.used': 'Used',
'tool.intervention.approvalMode': 'Approval Mode',
'tool.intervention.approve': 'Approve',
- 'tool.intervention.approveAndRemember': 'Approve and Remember',
- 'tool.intervention.approveOnce': 'Approve This Time Only',
+ 'tool.intervention.optionApprove': 'Approve',
+ 'tool.intervention.rememberSimilar': "Don't ask again for similar actions",
+ 'tool.intervention.submit': 'Submit',
'tool.intervention.mode.allowList': 'Allow List',
'tool.intervention.mode.allowListDesc': 'Only automatically execute approved tools',
'tool.intervention.mode.autoRun': 'Auto Approve',
'tool.intervention.mode.autoRunDesc': 'Automatically approve all tool executions',
'tool.intervention.mode.manual': 'Manual',
'tool.intervention.mode.manualDesc': 'Manual approval required for each invocation',
+ 'tool.intervention.onboarding.agentIdentity.editHint':
+ 'You can edit the name or avatar directly below.',
+ 'tool.intervention.onboarding.agentIdentity.namePlaceholder': 'Agent name',
'tool.intervention.onboarding.agentIdentity.title': "I'll update my name and avatar",
'tool.intervention.onboarding.agentIdentity.titleAvatarOnly': "I'll update my avatar",
'tool.intervention.onboarding.agentIdentity.titleNameOnly': "I'll update my name",
@@ -747,11 +751,8 @@ export default {
'tool.intervention.onboarding.userProfile.responseLanguage': 'Response language',
'tool.intervention.onboarding.userProfile.title': 'Confirm your profile update',
'tool.intervention.reject': 'Reject',
- 'tool.intervention.rejectAndContinue': 'Reject and Retry',
'tool.intervention.rejectOnly': 'Reject',
- 'tool.intervention.rejectReasonPlaceholder':
- 'A reason helps the Agent understand your boundaries and improve future actions',
- 'tool.intervention.rejectTitle': 'Reject this Skill call',
+ 'tool.intervention.rejectReasonPlaceholder': "Tell the agent what you'd like instead",
'tool.intervention.rejectedWithReason': 'This Skill call was rejected: {{reason}}',
'tool.intervention.pending': 'Pending',
'tool.intervention.scrollToIntervention': 'View',
@@ -865,6 +866,8 @@ export default {
'workflow.toolDisplayName.runCommand': 'Ran a command',
'workflow.toolDisplayName.saveUserQuestion': 'Recorded info',
'workflow.toolDisplayName.search': 'Searched the web',
+ 'workflow.toolDisplayName.showAgentMarketplace': 'Assembled agent team',
+ 'workflow.toolDisplayName.submitAgentPick': 'Picked agents',
'workflow.toolDisplayName.searchAgent': 'Searched agents',
'workflow.toolDisplayName.searchKnowledgeBase': 'Searched knowledge base',
'workflow.toolDisplayName.searchLocalFiles': 'Searched files',
diff --git a/src/locales/default/onboarding.ts b/src/locales/default/onboarding.ts
index fbb05d83d4e..8307e0968b0 100644
--- a/src/locales/default/onboarding.ts
+++ b/src/locales/default/onboarding.ts
@@ -13,7 +13,9 @@ export default {
'Not feeling it today? You can switch to <modeLink><modeText>{{mode}}</modeText></modeLink> or <skipLink><skipText>{{skip}}</skipText></skipLink>.',
'agent.modeSwitch.agent': 'Conversational',
'agent.modeSwitch.classic': 'Classic',
+ 'agent.modeSwitch.collapse': 'Collapse',
'agent.modeSwitch.debug': 'Debug Export',
+ 'agent.modeSwitch.expand': 'Expand',
'agent.modeSwitch.label': 'Choose your onboarding mode',
'agent.completionTitle': 'You are almost there',
'agent.completionSubtitle': "Everything's in place - let's get started when you're ready.",
diff --git a/src/locales/default/plugin.ts b/src/locales/default/plugin.ts
index db0b3c4acaa..5d9fa76b492 100644
--- a/src/locales/default/plugin.ts
+++ b/src/locales/default/plugin.ts
@@ -51,7 +51,7 @@ export default {
'builtins.lobe-agent-management.render.installPlugin.plugin': 'Plugin',
'builtins.lobe-agent-management.render.installPlugin.success': 'Installed successfully',
'builtins.lobe-agent-management.title': 'Agent Manager',
- 'builtins.lobe-agent-marketplace.apiName.showAgentMarketplace': 'Open agent marketplace',
+ 'builtins.lobe-agent-marketplace.apiName.showAgentMarketplace': 'Assemble agent team',
'builtins.lobe-agent-marketplace.apiName.submitAgentPick': 'Submit agent picks',
'builtins.lobe-agent-marketplace.title': 'Agent Marketplace',
'builtins.lobe-claude-code.agent.instruction': 'Instruction',
@@ -325,6 +325,11 @@ export default {
'builtins.lobe-web-onboarding.inspector.charCount_other': '{{count}} chars',
'builtins.lobe-web-onboarding.inspector.hunkCount_one': '{{count}} change',
'builtins.lobe-web-onboarding.inspector.hunkCount_other': '{{count}} changes',
+ 'builtins.lobe-web-onboarding.updateDocument.hunkMode.delete': 'Delete',
+ 'builtins.lobe-web-onboarding.updateDocument.hunkMode.deleteLines': 'Delete lines',
+ 'builtins.lobe-web-onboarding.updateDocument.hunkMode.insertAt': 'Insert at line',
+ 'builtins.lobe-web-onboarding.updateDocument.hunkMode.replace': 'Replace',
+ 'builtins.lobe-web-onboarding.updateDocument.hunkMode.replaceLines': 'Replace lines',
'builtins.lobe-web-onboarding.inspector.interests_one': '{{count}} interest',
'builtins.lobe-web-onboarding.inspector.interests_other': '{{count}} interests',
'builtins.lobe-web-onboarding.title': 'User Onboarding',
diff --git a/src/locales/default/tool.ts b/src/locales/default/tool.ts
index de530362482..688ee314730 100644
--- a/src/locales/default/tool.ts
+++ b/src/locales/default/tool.ts
@@ -32,7 +32,14 @@ export default {
'agentMarketplace.category.personalLife': 'Personal Life',
'agentMarketplace.category.productManagement': 'Product Management',
'agentMarketplace.category.salesCustomer': 'Sales & Customer',
+ 'agentMarketplace.inspector.moreCategories_one': '+{{count}}',
+ 'agentMarketplace.inspector.moreCategories_other': '+{{count}}',
+ 'agentMarketplace.inspector.pickCount_one': '{{count}} agent',
+ 'agentMarketplace.inspector.pickCount_other': '{{count}} agents',
'agentMarketplace.picker.empty': 'No templates available.',
+ 'agentMarketplace.render.alreadyInLibraryTag': 'Already in library',
+ 'agentMarketplace.render.alreadyInLibrary_one': '{{count}} already in library',
+ 'agentMarketplace.render.alreadyInLibrary_other': '{{count}} already in library',
'agentMarketplace.picker.failedToLoad': 'Failed to load templates. Please try again later.',
'agentMarketplace.picker.summary': '{{filtered}} / {{total}} templates available.',
'codeInterpreter-legacy.error': 'Execution Error',
diff --git a/src/routes/(main)/agent/features/Conversation/Header/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/index.tsx
index 688566357be..02fb31528b7 100644
--- a/src/routes/(main)/agent/features/Conversation/Header/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/Header/index.tsx
@@ -9,7 +9,6 @@ import NavHeader from '@/features/NavHeader';
import HeaderActions from './HeaderActions';
import ShareButton from './ShareButton';
import Tags from './Tags';
-import ViewSwitcher from './ViewSwitcher';
import WorkingPanelToggle from './WorkingPanelToggle';
const headerStyles = createStaticStyles(({ css }) => ({
@@ -58,7 +57,6 @@ const Header = memo(() => {
gap={4}
style={{ backgroundColor: cssVar.colorBgContainer }}
>
- <ViewSwitcher />
<ShareButton />
<WorkingPanelToggle />
</Flexbox>
diff --git a/src/store/chat/slices/aiChat/actions/conversationControl.ts b/src/store/chat/slices/aiChat/actions/conversationControl.ts
index 7c9f5548ad0..191c232a5e2 100644
--- a/src/store/chat/slices/aiChat/actions/conversationControl.ts
+++ b/src/store/chat/slices/aiChat/actions/conversationControl.ts
@@ -315,7 +315,11 @@ export class ConversationControlActionImpl {
toolMessageId: string,
response: Record<string, unknown>,
context?: ConversationContext,
- options?: { createUserMessage?: boolean; toolResultContent?: string },
+ options?: {
+ createUserMessage?: boolean;
+ pluginState?: Record<string, unknown>;
+ toolResultContent?: string;
+ },
): Promise<void> => {
const { executeClientAgent, startOperation, completeOperation } = this.#get();
@@ -359,6 +363,14 @@ export class ConversationControlActionImpl {
optimisticContext,
);
+ if (options?.pluginState) {
+ await this.#get().optimisticUpdatePluginState(
+ toolMessageId,
+ options.pluginState,
+ optimisticContext,
+ );
+ }
+
const chatKey = messageMapKey({ agentId, topicId, threadId, scope });
// 2a. Tool-result-only path: skip the synthetic user message and resume from the