feat(toolbox): introduce toolbox feature with skills, MCP, and browser connection management

- Added new toolbox section to manage skills, external tools, and browser connections.
- Implemented routing and access control for toolbox items.
- Created corresponding icons and localization for toolbox features.
- Updated various components to integrate toolbox functionality, including menu and settings.
- Added tests for toolbox access and functionality.

This commit enhances the user experience by providing a dedicated area for managing tools related to agent capabilities.
main
wizardchen 2026-09-23 15:52:23 +08:00 committed by lyingbug
parent 02734d7499
commit fd016df98c
28 changed files with 854 additions and 147 deletions

View File

@ -0,0 +1,6 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.25 5.75V4.25C7.25 3.7 7.7 3.25 8.25 3.25H11.75C12.3 3.25 12.75 3.7 12.75 4.25V5.75" stroke="#07C05F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.75 5.75H15.25C16.35 5.75 17.25 6.65 17.25 7.75V14.75C17.25 15.85 16.35 16.75 15.25 16.75H4.75C3.65 16.75 2.75 15.85 2.75 14.75V7.75C2.75 6.65 3.65 5.75 4.75 5.75Z" stroke="#07C05F" stroke-width="1.5" stroke-linejoin="round"/>
<path d="M2.75 10.75H8.25M11.75 10.75H17.25" stroke="#07C05F" stroke-width="1.5" stroke-linecap="round"/>
<rect x="8.25" y="9.25" width="3.5" height="3" rx="0.75" stroke="#07C05F" stroke-width="1.5" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 755 B

View File

@ -0,0 +1,6 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.25 5.75V4.25C7.25 3.7 7.7 3.25 8.25 3.25H11.75C12.3 3.25 12.75 3.7 12.75 4.25V5.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.75 5.75H15.25C16.35 5.75 17.25 6.65 17.25 7.75V14.75C17.25 15.85 16.35 16.75 15.25 16.75H4.75C3.65 16.75 2.75 15.85 2.75 14.75V7.75C2.75 6.65 3.65 5.75 4.75 5.75Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
<path d="M2.75 10.75H8.25M11.75 10.75H17.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
<rect x="8.25" y="9.25" width="3.5" height="3" rx="0.75" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 775 B

View File

@ -14,7 +14,7 @@ test('composer browser button is disabled and opens settings when the extension
assert.match(button, /active: settingsStore\.isLocalBrowserEnabled && browserConnection\.online/)
assert.match(button, /:aria-disabled="browserConnection\.knownOffline"/)
assert.match(inputField, /if \(browserConnection\.knownOffline\) \{\s*openBrowserConnectionSettings\(\)/)
assert.match(inputField, /uiStore\.openSettings\('browserconnection'\)/)
assert.match(inputField, /router\.push\(toolboxLocation\('browserconnection'\)\)/)
assert.match(inputField, /browserConnection\.watchStatus\(\)/)
assert.match(inputField, /\$t\('localBrowser\.reconnectHint'\)|\$t\(browserSourceUnavailableHint\)/)
})

View File

@ -52,6 +52,7 @@ import {
} from '@/utils/agent-readiness';
import { formatLocalizedList } from '@/utils/format-list';
import { SKILL_ICON, type MentionItem, type MentionItemType, type MentionRequestItem } from '@/types/mention';
import { toolboxLocation } from '@/config/toolbox';
import { supportedLevels, levelLabelKey, levelFromLegacy, clampLevel, type ReasoningLevel } from '@/utils/reasoningEffort';
const route = useRoute();
@ -870,7 +871,7 @@ const browserSourceUnavailableHint = computed(() => {
});
const openBrowserConnectionSettings = () => {
uiStore.openSettings('browserconnection');
void router.push(toolboxLocation('browserconnection'));
};
const toggleBrowserSource = () => {

View File

@ -92,10 +92,6 @@
<t-icon name="control-platform" class="menu-icon" />
<span>{{ $t('settings.modelManagement') }}</span>
</div>
<div v-if="canManageSkills" class="menu-item" @click="handleQuickNav('skills')">
<t-icon :name="SKILL_ICON" class="menu-icon" />
<span>{{ $t('settings.skills.title') }}</span>
</div>
<div class="menu-divider"></div>
<div class="menu-item" @click="handleSettings">
<t-icon name="setting" class="menu-icon" />
@ -219,8 +215,6 @@ import { useRoleLabel, useHomeTenant } from '@/composables/useRoleLabel'
import { getRootZoom, rectToCssPx, cssViewportSize } from '@/utils/zoom'
import { openNewUserGuide } from '@/config/contextualGuides'
import { SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE } from '@/config/settingsAccess'
import { SKILL_ICON } from '@/types/mention'
const { t } = useI18n()
const router = useRouter()
@ -261,12 +255,6 @@ const canManageModels = computed(() =>
authStore.isSystemAdmin ||
authStore.hasRole(SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE.models),
)
const canManageSkills = computed(() =>
authStore.canAccessAllTenants ||
authStore.isSystemAdmin ||
authStore.hasRole(SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE.skills),
)
const menuRef = ref<HTMLElement>()
const tenantMenuItemRef = ref<HTMLElement>()
const menuVisible = ref(false)

View File

@ -8,14 +8,21 @@ import knowledgeIcon from '@/assets/img/zhishiku.svg'
import agentIcon from '@/assets/img/agent.svg'
import artifactIcon from '@/assets/img/artifact.svg'
import organizationIcon from '@/assets/img/organization.svg'
import toolboxIcon from '@/assets/img/toolbox.svg'
const props = withDefaults(defineProps<{
type: 'knowledge' | 'agent' | 'artifact' | 'organization'
type: 'knowledge' | 'agent' | 'artifact' | 'organization' | 'toolbox'
size?: number
}>(), { size: 20 })
// Reuse the navigation assets while inheriting the surrounding theme color.
const icons = { knowledge: knowledgeIcon, agent: agentIcon, artifact: artifactIcon, organization: organizationIcon }
const icons = {
knowledge: knowledgeIcon,
agent: agentIcon,
artifact: artifactIcon,
organization: organizationIcon,
toolbox: toolboxIcon,
}
const iconStyle = computed(() => ({
width: `${props.size}px`,
height: `${props.size}px`,

View File

@ -87,7 +87,7 @@
<div class="menu_item-box">
<div class="menu_icon">
<img class="icon"
:src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'agent' ? agentIcon : item.icon == 'artifact' ? artifactIcon : item.icon == 'organization' ? organizationIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'setting' ? settingIcon : prefixIcon)"
:src="getImgSrc(item.icon == 'zhishiku' ? knowledgeIcon : item.icon == 'agent' ? agentIcon : item.icon == 'artifact' ? artifactIcon : item.icon == 'toolbox' ? toolboxIcon : item.icon == 'organization' ? organizationIcon : item.icon == 'logout' ? logoutIcon : item.icon == 'setting' ? settingIcon : prefixIcon)"
alt="">
</div>
<template v-if="!uiStore.sidebarCollapsed">
@ -96,6 +96,13 @@
class="menu-pending-badge"
:title="t('organization.settings.pendingJoinRequestsBadge')">{{
orgStore.totalPendingJoinRequestCount }}</span>
<span v-if="item.path === 'toolbox' && toolboxPreview.length" class="menu-toolbox-stack"
:title="toolboxPreview.map((tool) => t(tool.title)).join(' · ')">
<span v-for="tool in toolboxPreview" :key="tool.key" class="menu-toolbox-stack__item">
<BrowserIcon v-if="tool.key === 'browserconnection'" width="12" height="12" />
<t-icon v-else :name="tool.icon" size="12px" />
</span>
</span>
</template>
</div>
</div>
@ -255,6 +262,8 @@ import { useMenuStore } from '@/stores/menu';
import { useSessionActivityStore } from '@/stores/sessionActivity';
import { useAuthStore } from '@/stores/auth';
import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities';
import { TOOLBOX_ITEMS, canAccessToolboxSection } from '@/config/toolbox';
import BrowserIcon from '@/components/icons/BrowserIcon.vue';
import { useOrganizationStore } from '@/stores/organization';
import { useUIStore } from '@/stores/ui';
import { useCommandPaletteStore } from '@/stores/commandPalette';
@ -298,6 +307,12 @@ const { entries: sessionActivityEntries } = storeToRefs(sessionActivity);
let sessionActivityTimer: ReturnType<typeof setInterval> | undefined;
const authStore = useAuthStore();
const deploymentCapabilities = useDeploymentCapabilitiesStore();
const toolboxPreview = computed(() => TOOLBOX_ITEMS.filter((item) => canAccessToolboxSection(item.key, {
currentTenantRole: authStore.currentTenantRole,
canAccessAllTenants: authStore.canAccessAllTenants,
hasRole: (role) => authStore.hasRole(role),
isSupported: (capability) => deploymentCapabilities.isSupported(capability),
})));
const orgStore = useOrganizationStore();
const uiStore = useUIStore();
const commandPaletteStore = useCommandPaletteStore();
@ -415,6 +430,8 @@ const isMenuItemActive = (itemPath: string): boolean => {
currentRoute === 'knowledgeBaseSettings';
case 'agents':
return currentRoute === 'agentList';
case 'toolbox':
return currentRoute === 'toolbox';
case 'artifacts':
return currentRoute === 'artifactLibrary';
case 'organizations':
@ -445,7 +462,7 @@ const getIconActiveState = (itemPath: string) => {
};
// 分离上下两部分菜单(使用 visibleMenuArr 以便 lite 模式过滤 logout)
const TOP_MENU_PATHS = new Set(['creatChat', 'knowledge-bases', 'artifacts', 'agents', 'organizations']);
const TOP_MENU_PATHS = new Set(['creatChat', 'knowledge-bases', 'artifacts', 'agents', 'toolbox', 'organizations']);
const topMenuItems = computed<MenuItem[]>(() => {
return (visibleMenuArr.value as unknown as MenuItem[]).filter((item: MenuItem) => TOP_MENU_PATHS.has(item.path));
@ -1087,6 +1104,7 @@ let logoutIcon = ref('logout.svg');
let settingIcon = ref('setting.svg');
let agentIcon = ref('agent.svg');
let artifactIcon = ref('artifact.svg');
let toolboxIcon = ref('toolbox.svg');
let organizationIcon = ref('organization.svg');
let pathPrefix = ref(route.name)
const getIcon = (path: string) => {
@ -1107,6 +1125,8 @@ const getIcon = (path: string) => {
// 产物图标:只在产物页面显示绿色
artifactIcon.value = artifactsActiveState ? 'artifact-green.svg' : 'artifact.svg';
toolboxIcon.value = route.name === 'toolbox' ? 'toolbox-green.svg' : 'toolbox.svg';
// 组织图标:只在组织页面显示绿色
organizationIcon.value = organizationsActiveState ? 'organization-green.svg' : 'organization.svg';
@ -1259,7 +1279,7 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
.menu_item {
justify-content: center;
padding: 9px 0;
padding: 7px 0;
.menu_item-box {
justify-content: center;
@ -1425,10 +1445,10 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
display: flex;
align-items: center;
justify-content: space-between;
height: 38px;
padding: 8px 10px 8px var(--sidebar-inset-x);
height: 34px;
padding: 6px 10px 6px var(--sidebar-inset-x);
box-sizing: border-box;
margin-bottom: 2px;
margin-bottom: 1px;
border-radius: var(--app-radius-xs);
transition: background-color var(--app-motion-base) ease;
@ -1797,6 +1817,68 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
}
}
.menu-toolbox-stack {
display: inline-flex;
align-items: center;
flex-shrink: 0;
margin-left: auto;
}
.menu-toolbox-stack__item {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
box-sizing: border-box;
border: 1px solid var(--td-component-stroke);
border-radius: 50%;
background: var(--td-bg-color-container);
color: var(--td-text-color-secondary);
rotate: var(--stack-rotate, 0deg);
animation: menu-toolbox-stack-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
transition:
margin 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
rotate 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
translate 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
color 200ms ease,
box-shadow 200ms ease;
& + & {
margin-left: -6px;
}
&:nth-child(1) { z-index: 3; --stack-rotate: -10deg; }
&:nth-child(2) { z-index: 2; animation-delay: 60ms; transition-delay: 40ms; }
&:nth-child(3) { z-index: 1; --stack-rotate: 10deg; animation-delay: 120ms; transition-delay: 80ms; }
}
@keyframes menu-toolbox-stack-in {
from {
opacity: 0;
scale: 0.4;
}
}
.menu_item:hover .menu-toolbox-stack__item {
color: var(--td-text-color-primary);
rotate: 0deg;
translate: 0 -1px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.menu_item:hover .menu-toolbox-stack__item + .menu-toolbox-stack__item {
margin-left: 3px;
}
@media (prefers-reduced-motion: reduce) {
.menu-toolbox-stack__item {
animation: none;
transition: color 200ms ease;
}
}
.menu-pending-badge {
min-width: 18px;
height: 18px;

View File

@ -62,10 +62,16 @@ export function useModalShell(options: ModalShellOptions) {
return serialize(options.snapshot()) !== cleanSnapshot
}
const requestClose = () => {
// Template handlers pass the DOM event as the first argument, so only call
// afterClose when it really is a callback.
const requestClose = (afterClose?: unknown) => {
if (!options.visible() || confirming) return
if (!isDirty()) {
const close = () => {
options.close()
if (typeof afterClose === 'function') afterClose()
}
if (!isDirty()) {
close()
return
}
confirming = true
@ -78,7 +84,7 @@ export function useModalShell(options: ModalShellOptions) {
onConfirm: () => {
confirming = false
dialog.destroy()
options.close()
close()
},
onClose: () => {
confirming = false

View File

@ -17,7 +17,8 @@ test('management shortcuts are stricter than read-only settings pages', () => {
test('the skill catalog is admin-only like the sandbox it installs into', () => {
assert.equal(SETTINGS_SECTION_MIN_ROLE.skills, 'admin')
assert.equal(SETTINGS_SECTION_MIN_ROLE.skills, SETTINGS_SECTION_MIN_ROLE.sandbox)
assert.equal(SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE.skills, 'admin')
// Skills live in the sidebar toolbox, so the avatar menu has no shortcut.
assert.equal(Object.prototype.hasOwnProperty.call(SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE, 'skills'), false)
})
test('personal skill environment variables are visible to every member', () => {

View File

@ -41,7 +41,6 @@ export const SETTINGS_SECTION_MIN_ROLE: Record<string, SettingsRoleKey> = {
export const SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE = {
members: 'owner',
models: 'admin',
skills: 'admin',
} as const satisfies Record<string, SettingsRoleKey>
export const SYSTEM_ADMIN_SETTINGS_SECTIONS = new Set([

View File

@ -0,0 +1,100 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { readFileSync } from 'node:fs'
import { computed, ref } from 'vue'
import { runInNewContext } from 'node:vm'
import ts from 'typescript'
import { TOOLBOX_ITEMS, canAccessToolboxSection, isToolboxSection, toolboxLocation } from './toolbox'
import zhCN from '../i18n/locales/zh-CN'
const roles = ['viewer', 'contributor', 'admin', 'owner']
const access = (role: string | null, unsupported: string[] = [], superuser = false) => ({
currentTenantRole: role,
canAccessAllTenants: superuser,
hasRole: (min: string) => roles.indexOf(role || '') >= roles.indexOf(min),
isSupported: (capability?: string) => !capability || !unsupported.includes(capability),
})
test('toolbox contains only the agreed tools; infrastructure and secrets stay in settings', () => {
assert.deepEqual(TOOLBOX_ITEMS.map((item) => item.key), ['skills', 'mcp', 'browserconnection'])
const lookup = (key: string) => key.split('.').reduce<any>((node, part) => node?.[part], zhCN)
for (const item of TOOLBOX_ITEMS) {
for (const key of [item.title, item.description, 'help' in item ? item.help : undefined,
'action' in item ? item.action : undefined]) {
if (key) assert.equal(typeof lookup(key), 'string', key)
}
}
for (const key of ['sandbox', 'websearch', 'envvars', 'integration-api', undefined, 'unknown']) {
assert.equal(isToolboxSection(key), false)
}
})
test('toolbox preserves role and deployment gates, including workspace switches', () => {
for (const role of ['viewer', 'contributor']) {
assert.equal(canAccessToolboxSection('skills', access(role)), false)
assert.equal(canAccessToolboxSection('mcp', access(role)), false)
assert.equal(canAccessToolboxSection('browserconnection', access(role)), true)
}
assert.equal(canAccessToolboxSection('skills', access('admin')), true)
assert.equal(canAccessToolboxSection('skills', access('owner', ['settings.sandbox'])), false)
assert.equal(canAccessToolboxSection('mcp', access('owner', ['settings.mcp'])), false)
assert.equal(canAccessToolboxSection('mcp', access(null)), false)
assert.equal(canAccessToolboxSection('mcp', access(null, [], true)), true)
assert.equal(canAccessToolboxSection('mcp', access(null, ['settings.mcp'], true)), false)
const role = ref('admin')
const allowed = computed(() => canAccessToolboxSection('skills', access(role.value)))
assert.equal(allowed.value, true)
role.value = 'viewer'
assert.equal(allowed.value, false)
})
test('skill shortcut retains its target sandbox without leaking it to other tools', () => {
assert.deepEqual(toolboxLocation('skills', 'sandbox-123'), {
path: '/platform/toolbox/skills', query: { sandboxId: 'sandbox-123' },
})
assert.deepEqual(toolboxLocation('browserconnection', 'sandbox-123'), {
path: '/platform/toolbox/browserconnection', query: {},
})
assert.deepEqual(toolboxLocation(), { path: '/platform/toolbox', query: {} })
})
const settings = readFileSync(new URL('../views/settings/Settings.vue', import.meta.url), 'utf8')
const script = settings.match(/<script setup lang="ts">([\s\S]*?)<\/script>/)![1]!
const ast = ts.createSourceFile('Settings.ts', script, ts.ScriptTarget.Latest, true)
function declaration(name: string) {
const node = ast.statements.find((s) => ts.isVariableStatement(s)
&& s.declarationList.declarations.some((d) => ts.isIdentifier(d.name) && d.name.text === name))
assert.ok(node, `${name} exists`)
return ts.transpileModule(node.getText(ast), { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText
}
test('legacy shortcuts close settings and route to the selected tool and sandbox', () => {
const calls: unknown[] = []
const redirect = runInNewContext(`${declaration('redirectToToolbox')}\nredirectToToolbox`, {
isToolboxSection, toolboxLocation,
uiStore: { closeSettings: () => calls.push('close') },
router: { push: (location: unknown) => calls.push(location) },
})
assert.equal(redirect('skills', 'sandbox-123'), true)
assert.deepEqual(calls, ['close', toolboxLocation('skills', 'sandbox-123')])
calls.length = 0
assert.equal(redirect('sandbox'), false)
assert.deepEqual(calls, [])
assert.match(script, /redirectToToolbox\(normalizedSection, uiStore.settingsInitialSubSection\)/)
assert.match(script, /redirectToToolbox\(normalizedSection, subsection\)/)
})
test('settings no longer render moved panels, and old bookmarks reach toolbox', () => {
for (const component of ['SkillSettings', 'McpSettings', 'BrowserConnectionSettings']) {
assert.equal(settings.includes(`<${component}`), false)
}
for (const item of TOOLBOX_ITEMS) {
assert.equal(settings.includes(`{ key: '${item.key}',`), false)
}
const router = readFileSync(new URL('../router/index.ts', import.meta.url), 'utf8')
assert.match(router, /to\.path === '\/platform\/settings' && isToolboxSection\(to\.query\.section\)/)
assert.match(router, /toolboxLocation\(to\.query\.section/)
const page = readFileSync(new URL('../views/toolbox/Toolbox.vue', import.meta.url), 'utf8')
assert.match(page, /if \(!selectedItem\.value && fallback\) void router\.replace\(toolboxLocation\(fallback\.key\)\)/)
assert.match(page, /:key="sandboxId"\s+:initial-sandbox-id="sandboxId"/)
})

View File

@ -0,0 +1,54 @@
import { SETTINGS_SECTION_MIN_ROLE, type SettingsRoleKey } from './settingsAccess'
import { SETTINGS_SECTION_CAPABILITY, type DeploymentCapabilityKey } from './deploymentCapabilities'
import { SKILL_ICON } from '../types/mention'
export const TOOLBOX_ITEMS = [
{
key: 'skills',
icon: SKILL_ICON,
title: 'settings.skills.title',
description: 'settings.skills.description',
help: 'settings.skills.helpTooltip',
action: 'settings.skills.addSkill',
},
{
key: 'mcp',
icon: 'tools',
title: 'settings.mcpService',
description: 'mcpSettings.description',
action: 'mcpSettings.addService',
},
{
key: 'browserconnection',
title: 'localBrowser.settingsTitle',
description: 'localBrowser.settingsDescription',
},
] as const
export type ToolboxSection = typeof TOOLBOX_ITEMS[number]['key']
export function isToolboxSection(section: unknown): section is ToolboxSection {
return TOOLBOX_ITEMS.some((item) => item.key === section)
}
export function toolboxLocation(section?: ToolboxSection, sandboxId?: string) {
return {
path: section ? `/platform/toolbox/${section}` : '/platform/toolbox',
query: section === 'skills' && sandboxId ? { sandboxId } : {},
}
}
/** Use the same role and deployment gates as the original settings panels. */
export function canAccessToolboxSection(
section: ToolboxSection,
access: {
currentTenantRole: string | null | undefined
canAccessAllTenants: boolean
hasRole: (role: SettingsRoleKey) => boolean
isSupported: (capability?: DeploymentCapabilityKey) => boolean
},
): boolean {
if (!access.currentTenantRole && !access.canAccessAllTenants) return false
return (access.canAccessAllTenants || access.hasRole(SETTINGS_SECTION_MIN_ROLE[section] ?? 'viewer'))
&& access.isSupported(SETTINGS_SECTION_CAPABILITY[section])
}

View File

@ -1,4 +1,9 @@
export default {
toolbox: {
"title": "Toolbox",
"description": "Manage skills, external tools, and browser connections for your agents.",
"unavailable": "No tools are available in the current workspace."
},
localBrowser: {
pipOpen: "Pop out preview",
pipReturn: "Return to conversation",
@ -65,7 +70,7 @@ export default {
"settingsTitle": "Browser connection",
"settingsDescription": "Pair BrowserSkill with your local Chrome to operate real web pages from conversations.",
"openSettings": "Open browser settings",
"settingsHint": "Connect BrowserSkill in personal settings to use your local browser here.",
"settingsHint": "Connect BrowserSkill in Toolbox to use your local browser here.",
"unavailable": "Local browsing is not enabled on this server. Contact your administrator.",
"source": "Browser source",
@ -91,11 +96,12 @@ export default {
"revoke": "Revoke device access",
"revokeConfirm": "You will need to pair again before using the local browser.",
"failed": "Operation failed. Please retry.",
"productDescription": "Run browser tasks in your Chrome",
"productDescription": "An open-source Chrome extension that lets agents open pages, read content, and take actions in your browser.",
"offline": "Offline",
"notPaired": "Not paired",
"lastSeen": "Last connected",
"readyHint": "Ready. Return to the conversation and describe your browser task.",
"capabilitiesTitle": "Your agent can",
"reconnectHint": "Authorization is saved. Keep Chrome and BrowserSkill open to reconnect automatically.",
"replaceDevice": "Change browser",
"installExtension": "Install BrowserSkill",
@ -5331,6 +5337,7 @@ export default {
},
mcpServiceDialog: {
addTitle: 'Add MCP Service',
addDesc: 'Connect an external MCP service so agents can call its tools.',
editTitle: 'Edit MCP Service',
basicSection: 'Basic',
connectionSection: 'Connection',

View File

@ -1,4 +1,9 @@
export default {
toolbox: {
"title": "ツールボックス",
"description": "エージェントのスキル、外部ツール、ブラウザー接続を管理します。",
"unavailable": "現在のワークスペースで利用できるツールはありません。"
},
resourceSort: {
title: '並び替え',
updatedTime: '更新日時',
@ -80,7 +85,7 @@ export default {
"settingsTitle": "ブラウザー接続",
"settingsDescription": "BrowserSkill で手元の Chrome を接続すると、会話から実際のウェブページを操作できます。",
"openSettings": "接続設定を開く",
"settingsHint": "個人設定で BrowserSkill を接続すると、ここでローカルブラウザーを利用できます。",
"settingsHint": "ツールボックスで BrowserSkill を接続すると、ここでローカルブラウザーを利用できます。",
"unavailable": "サーバーでローカルブラウザーが有効になっていません。管理者に連絡してください。",
"source": "ブラウザーの接続先",
@ -106,11 +111,12 @@ export default {
"revoke": "デバイスの認証を取り消す",
"revokeConfirm": "取り消すと、ローカルブラウザーを使うには再度ペアリングが必要です。",
"failed": "操作に失敗しました。再試行してください。",
"productDescription": "Chrome でブラウザータスクを実行",
"productDescription": "エージェントがブラウザーでページを開き、内容を読み取り、操作できるオープンソースの Chrome 拡張機能です。",
"offline": "オフライン",
"notPaired": "未ペアリング",
"lastSeen": "最終接続",
"readyHint": "準備完了。会話に戻り、ブラウザーで行うタスクを伝えてください。",
"capabilitiesTitle": "エージェントができること",
"reconnectHint": "認証は保存されています。Chrome と拡張機能を開くと自動的に再接続します。",
"replaceDevice": "ブラウザーを変更",
"installExtension": "BrowserSkill をインストール",
@ -5331,6 +5337,7 @@ export default {
},
mcpServiceDialog: {
addTitle: 'MCPサービスを追加',
addDesc: '外部の MCP サービスを接続すると、エージェントがそのツールを呼び出せます。',
editTitle: 'MCPサービスを編集',
basicSection: '基本',
connectionSection: '接続',

View File

@ -1,4 +1,9 @@
export default {
toolbox: {
"title": "도구함",
"description": "에이전트의 스킬, 외부 도구 및 브라우저 연결을 관리합니다.",
"unavailable": "현재 워크스페이스에서 사용할 수 있는 도구가 없습니다."
},
localBrowser: {
pipOpen: "미리보기 팝업 열기",
pipReturn: "대화 내 미리보기로 돌아가기",
@ -65,7 +70,7 @@ export default {
"settingsTitle": "브라우저 연결",
"settingsDescription": "BrowserSkill로 내 Chrome을 연결하면 대화에서 실제 웹페이지를 조작할 수 있습니다.",
"openSettings": "연결 설정 열기",
"settingsHint": "개인 설정에서 BrowserSkill을 연결하면 로컬 브라우저를 사용할 수 있습니다.",
"settingsHint": "도구함에서 BrowserSkill을 연결하면 로컬 브라우저를 사용할 수 있습니다.",
"unavailable": "서버에서 로컬 브라우저가 활성화되지 않았습니다. 관리자에게 문의하세요.",
"source": "브라우저 연결 대상",
@ -91,11 +96,12 @@ export default {
"revoke": "기기 인증 취소",
"revokeConfirm": "취소하면 다시 연결해야 로컬 브라우저를 사용할 수 있습니다.",
"failed": "작업에 실패했습니다. 다시 시도하세요.",
"productDescription": "내 Chrome에서 브라우저 작업 실행",
"productDescription": "에이전트가 브라우저에서 페이지를 열고 내용을 읽고 작업을 수행할 수 있게 해 주는 오픈소스 Chrome 확장 프로그램입니다.",
"offline": "오프라인",
"notPaired": "연결 설정 필요",
"lastSeen": "최근 연결",
"readyHint": "준비되었습니다. 대화로 돌아가 브라우저 작업을 요청하세요.",
"capabilitiesTitle": "에이전트가 할 수 있는 작업",
"reconnectHint": "인증이 저장되어 있습니다. Chrome과 확장 프로그램을 열면 자동으로 다시 연결됩니다.",
"replaceDevice": "브라우저 변경",
"installExtension": "BrowserSkill 설치",
@ -2249,6 +2255,7 @@ export default {
},
mcpServiceDialog: {
addTitle: 'MCP 서비스 추가',
addDesc: '외부 MCP 서비스를 연결하면 에이전트가 해당 도구를 호출할 수 있습니다.',
editTitle: 'MCP 서비스 편집',
basicSection: '기본',
connectionSection: '연결',

View File

@ -1,4 +1,9 @@
export default {
toolbox: {
"title": "Инструменты",
"description": "Управляйте навыками, внешними инструментами и подключением браузера для агентов.",
"unavailable": "В текущем рабочем пространстве нет доступных инструментов."
},
localBrowser: {
pipOpen: "Открыть плавающее окно",
pipReturn: "Вернуть предпросмотр в чат",
@ -65,7 +70,7 @@ export default {
"settingsTitle": "Подключение браузера",
"settingsDescription": "Подключите локальный Chrome через BrowserSkill, чтобы управлять реальными страницами из диалогов.",
"openSettings": "Открыть настройки",
"settingsHint": "Подключите BrowserSkill в личных настройках, чтобы использовать локальный браузер.",
"settingsHint": "Подключите BrowserSkill в разделе «Инструменты», чтобы использовать локальный браузер.",
"unavailable": "Локальный браузер не включён на сервере. Обратитесь к администратору.",
"source": "Источник браузера",
@ -91,11 +96,12 @@ export default {
"revoke": "Отозвать доступ устройства",
"revokeConfirm": "После отзыва потребуется повторное подключение, чтобы снова использовать локальный браузер.",
"failed": "Операция не удалась. Повторите попытку.",
"productDescription": "Задачи браузера в вашем Chrome",
"productDescription": "Расширение Chrome с открытым исходным кодом: агент открывает страницы, читает их и выполняет действия в вашем браузере.",
"offline": "Не в сети",
"notPaired": "Не подключён",
"lastSeen": "Последнее подключение",
"readyHint": "Готово. Вернитесь в диалог и опишите задачу для браузера.",
"capabilitiesTitle": "Агент может",
"reconnectHint": "Авторизация сохранена. Откройте Chrome и BrowserSkill для автоматического подключения.",
"replaceDevice": "Сменить браузер",
"installExtension": "Установите BrowserSkill",
@ -2249,6 +2255,7 @@ export default {
},
mcpServiceDialog: {
addTitle: 'Добавить сервис MCP',
addDesc: 'Подключите внешний сервис MCP, чтобы агенты могли вызывать его инструменты.',
editTitle: 'Редактировать сервис MCP',
basicSection: 'Основное',
connectionSection: 'Подключение',

View File

@ -1,4 +1,9 @@
export default {
toolbox: {
"title": "工具箱",
"description": "管理智能体可用的技能、外部工具和浏览器连接。",
"unavailable": "当前空间暂无可用的工具。"
},
localBrowser: {
pipOpen: "弹出悬浮窗",
pipReturn: "返回对话小窗",
@ -65,7 +70,7 @@ export default {
"settingsTitle": "浏览器连接",
"settingsDescription": "通过 BrowserSkill 连接本机 Chrome,配对后即可在对话中操作真实网页。",
"openSettings": "前往浏览器连接",
"settingsHint": "在个人设置中连接 BrowserSkill,即可在对话里使用本机浏览器。",
"settingsHint": "在工具箱中连接 BrowserSkill,即可在对话里使用本机浏览器。",
"unavailable": "服务端尚未启用本机浏览器,请联系管理员。",
"source": "浏览器来源",
@ -91,11 +96,12 @@ export default {
"revoke": "撤销设备授权",
"revokeConfirm": "撤销后需要重新配对,才能继续使用本机浏览器。",
"failed": "操作失败,请重试",
"productDescription": "在你的 Chrome 中执行浏览器任务",
"productDescription": "开源的 Chrome 扩展,让智能体在你的浏览器里打开网页、读取内容并完成操作。",
"offline": "离线",
"notPaired": "未配对",
"lastSeen": "最近连接",
"readyHint": "已准备就绪。回到对话,直接描述需要浏览器完成的任务。",
"capabilitiesTitle": "智能体可以",
"reconnectHint": "保留授权,等待扩展自动重连。请确认 Chrome 和 BrowserSkill 扩展已开启。",
"replaceDevice": "更换浏览器",
"installExtension": "安装 BrowserSkill 扩展",
@ -2251,6 +2257,7 @@ export default {
},
mcpServiceDialog: {
addTitle: '添加 MCP 服务',
addDesc: '连接外部 MCP 服务,智能体即可调用其中的工具。',
editTitle: '编辑 MCP 服务',
basicSection: '基本信息',
connectionSection: '连接配置',

View File

@ -7,6 +7,7 @@ import type { DeploymentCapabilityKey } from '@/config/deploymentCapabilities'
import { MessagePlugin } from 'tdesign-vue-next'
import i18n from '@/i18n'
import { normalizeSettingsSection } from '@/config/settingsRoute'
import { isToolboxSection, toolboxLocation } from '@/config/toolbox'
/** Lite /桌面 WebView 硬刷新时可能只打开 `/`,用 session 记住上次页面以便恢复 */
const LITE_LAST_PATH_KEY = 'weknora_lite_last_path'
@ -139,6 +140,12 @@ const router = createRouter({
component: () => import("../views/artifacts/ArtifactLibrary.vue"),
meta: { requiresInit: true, requiresAuth: true, requiredCapability: 'settings.sandbox' }
},
{
path: "toolbox/:section?",
name: "toolbox",
component: () => import("../views/toolbox/Toolbox.vue"),
meta: { requiresInit: true, requiresAuth: true }
},
{
path: "agents",
name: "agentList",
@ -322,6 +329,13 @@ router.beforeEach(async (to, from, next) => {
return
}
// Preserve bookmarks for tools that have moved out of Settings.
if (to.path === '/platform/settings' && isToolboxSection(to.query.section)) {
next({ ...toolboxLocation(to.query.section,
typeof to.query.sandboxId === 'string' ? to.query.sandboxId : undefined), replace: true })
return
}
// Lite:硬刷新后若落在默认首页,恢复本次会话中最后访问的 /platform 子路径
if (!liteDeepLinkRestoreDone) {
liteDeepLinkRestoreDone = true

View File

@ -34,6 +34,7 @@ export const useMenuStore = defineStore('menuStore', () => {
// Artifacts only exist where skills run in a sandbox.
{ title: '', titleKey: 'menu.artifacts', icon: 'artifact', path: 'artifacts', requiredCapability: 'settings.sandbox' },
{ title: '', titleKey: 'menu.agents', icon: 'agent', path: 'agents', requiredCapability: 'agents' },
{ title: '', titleKey: 'toolbox.title', icon: 'toolbox', path: 'toolbox' },
{ title: '', titleKey: 'menu.organizations', icon: 'organization', path: 'organizations', requiredCapability: 'organizations' },
{ title: '', titleKey: 'menu.settings', icon: 'setting', path: 'settings' },
{ title: '', titleKey: 'menu.logout', icon: 'logout', path: 'logout' }

View File

@ -1879,6 +1879,7 @@ import { SKILL_ICON } from '@/types/mention';
import { listEmbedChannels } from '@/api/embed';
import { getRootZoom, rectToCssPx } from '@/utils/zoom';
import { integrationSectionKey } from '@/config/settingsRoute';
import { toolboxLocation } from '@/config/toolbox';
import {
evaluateToolRequirement,
deriveKbFilterFromTools,
@ -2225,7 +2226,9 @@ function autoBindSoleSandbox() {
function openSkillSettings() {
const configId = formData.value.config.sandbox_config_id || ''
uiStore.openSettings('skills', configId || undefined)
modalShell.requestClose(() => {
void router.push(toolboxLocation('skills', configId || undefined))
})
}
const showSkillProgress = ref(false)

View File

@ -35,12 +35,13 @@ test('human handoff expands, stays reachable on narrow screens, focuses the brow
if (id === '\0/fixture-entry.js') return `
import {createApp} from 'vue'; import {createPinia} from 'pinia';
import {createI18n} from 'vue-i18n'; import TDesign from 'tdesign-vue-next';
import {createRouter, createMemoryHistory} from 'vue-router';
import 'tdesign-vue-next/es/style/index.css';
import Preview from '/src/views/chat/components/BrowserTaskPreview.vue';
import zh from '/src/i18n/locales/zh-CN.ts';
window.fixtureActions=[];
window.fixtureStatus={enabled:true,selected:true,connected:true,task_id:'fixture',needs_help:false};
createApp(Preview,{sessionId:'fixture'}).use(createPinia()).use(TDesign).use(createI18n({legacy:false,locale:'zh-CN',messages:{'zh-CN':zh}})).mount('#app');`
createApp(Preview,{sessionId:'fixture'}).use(createPinia()).use(createRouter({history:createMemoryHistory(),routes:[{path:'/:p(.*)*',component:{render:()=>null}}]})).use(TDesign).use(createI18n({legacy:false,locale:'zh-CN',messages:{'zh-CN':zh}})).mount('#app');`
},
}], resolve: {alias: {'@': root+'/src'}}, server: {host:'127.0.0.1',port:0},
})

View File

@ -56,13 +56,14 @@
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { get, post } from '@/utils/request'
import { useUIStore } from '@/stores/ui'
import { useRouter } from 'vue-router'
import { toolboxLocation } from '@/config/toolbox'
import { browserActionLabel, browserPageAddress } from '@/utils/browserToolDisplay'
import BrowserIcon from '@/components/icons/BrowserIcon.vue'
import { useFloatingPreviewDrag } from '@/composables/useFloatingPreviewDrag'
import { useDocumentPictureInPicture } from '@/composables/useDocumentPictureInPicture'
const props = defineProps<{ sessionId: string }>()
const { t } = useI18n(), uiStore = useUIStore()
const { t } = useI18n(), router = useRouter()
const status = ref({ enabled: false, selected: false, connected: false, paused: false, idle: false, needs_help: false, help_prompt: '', task_id: '', action: '', action_elapsed_ms: 0, page_url: '', last_error: '', stopping: false })
const busy = ref(false), error = ref(''), preview = ref(''), previewStale = ref(false)
const pageAddress = computed(() => browserPageAddress(status.value.page_url))
@ -98,7 +99,7 @@ async function togglePictureInPicture() {
function openBrowserSettings() {
closePiP()
window.focus()
uiStore.openSettings('browserconnection')
void router.push(toolboxLocation('browserconnection'))
}
let lastFrame = 0

View File

@ -10,7 +10,7 @@
:row-col="[{ width: '100%', height: '132px', type: 'rect' }]" />
<p v-else-if="loaded && !status.enabled" class="empty-hint">{{ t('localBrowser.unavailable') }}</p>
<template v-else-if="loaded">
<div v-else-if="loaded" class="browser-layout">
<article class="connection-card">
<div class="product-row">
<img class="product-logo" :src="browserLogo" width="44" height="44" alt="BrowserSkill" />
@ -19,22 +19,34 @@
<div class="product-name">
<strong>BrowserSkill</strong>
<span v-if="status.connected && status.extension_version" class="product-version">v{{ status.extension_version }}</span>
<a class="product-link" href="https://github.com/Tencent/BrowserSkill" target="_blank"
rel="noopener noreferrer" aria-label="BrowserSkill">
<t-icon name="jump" size="14px" />
</a>
</div>
<span class="status-pill" :class="{ online: status.connected, idle: !status.connected && status.device }">
<i />{{ t(status.connected ? 'localBrowser.connected' : status.device ? 'localBrowser.offline' : 'localBrowser.notPaired') }}
</span>
</div>
<p v-if="status.device" class="product-desc">{{ status.device.label }}</p>
<p class="product-desc">
{{ t('localBrowser.productDescription') }}
<a class="product-link" href="https://github.com/Tencent/BrowserSkill" target="_blank"
rel="noopener noreferrer">GitHub<t-icon name="jump" size="12px" /></a>
</p>
</div>
</div>
<template v-if="status.device">
<div class="capabilities">
<p v-if="!status.connected" class="capabilities-hint">
<t-icon name="time" size="14px" />{{ t('localBrowser.reconnectHint') }}
</p>
<span class="capabilities-title">{{ t('localBrowser.capabilitiesTitle') }}</span>
<ul class="capabilities-grid">
<li v-for="item in capabilities" :key="item.label">
<t-icon :name="item.icon" size="16px" />{{ t(item.label) }}
</li>
</ul>
</div>
<div class="device-block">
<div class="device-meta">
<span>{{ status.device.label }}</span>
<span>{{ t('localBrowser.lastSeen') }} {{ formatDate(status.device.last_seen_at) }}</span>
</div>
<div class="device-actions">
@ -50,7 +62,6 @@
</t-popconfirm>
</div>
</div>
<p v-if="!status.connected" class="device-hint">{{ t('localBrowser.reconnectHint') }}</p>
</template>
<ol v-else class="setup-steps">
@ -101,10 +112,12 @@
</div>
</article>
<BrowserSearchPreferences />
<div class="browser-side">
<BrowserSearchPreferences />
</div>
<details class="usage">
<summary>{{ t('localBrowser.usageTitle') }}<t-icon name="chevron-down" size="16px" /></summary>
<section class="usage">
<h3>{{ t('localBrowser.usageTitle') }}</h3>
<ol>
<li>
<span class="usage-index">1</span>
@ -135,8 +148,8 @@
</div>
</li>
</ol>
</details>
</template>
</section>
</div>
</div>
</template>
<script setup lang="ts">
@ -156,6 +169,14 @@ const endpoint = '/api/v1/me/browser'
const controller = new AbortController()
let revision = 0
let alive = true, timer: ReturnType<typeof setTimeout> | undefined, expiry: ReturnType<typeof setTimeout> | undefined, pairExpires = 0
const capabilities = [
{ icon: 'link', label: 'localBrowser.openPage' },
{ icon: 'file-search', label: 'localBrowser.readPage' },
{ icon: 'cursor', label: 'localBrowser.clickPage' },
{ icon: 'edit-1', label: 'localBrowser.fillPage' },
{ icon: 'screenshot', label: 'localBrowser.captureScreenshot' },
{ icon: 'layers', label: 'localBrowser.listTabs' },
]
const formatDate = (value: string) => new Date(value).toLocaleString(locale.value, { dateStyle: 'short', timeStyle: 'short' })
function clearPairing() { pairing.value = ''; copied.value = false; copyFallback.value = false; clearTimeout(expiry) }
async function refresh() {
@ -216,6 +237,40 @@ onBeforeUnmount(() => { alive = false; controller.abort(); clearTimeout(timer);
.browser-settings {
width: 100%;
container: browser-settings / inline-size;
}
// Stacked in the settings dialog; side by side once a full page gives it room.
@container browser-settings (min-width: 960px) {
.browser-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
column-gap: 20px;
}
.connection-card {
display: flex;
flex-direction: column;
> .capabilities {
flex: 1;
}
}
.browser-side {
border-radius: 16px;
padding: 24px;
background: color-mix(in srgb, var(--td-bg-color-secondarycontainer) 65%, var(--td-bg-color-container));
> .browser-search-preferences {
margin-top: 0;
}
}
.usage {
grid-column: 1 / -1;
padding: 0 4px;
}
}
.section-header {
@ -271,13 +326,15 @@ onBeforeUnmount(() => { alive = false; controller.abort(); clearTimeout(timer);
.product-link {
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--td-text-color-placeholder);
line-height: 1;
gap: 2px;
margin-left: 6px;
color: var(--td-brand-color);
text-decoration: none;
white-space: nowrap;
&:hover,
&:focus-visible {
color: var(--td-text-color-primary);
text-decoration: underline;
}
}
@ -358,11 +415,60 @@ onBeforeUnmount(() => { alive = false; controller.abort(); clearTimeout(timer);
}
}
.device-hint {
margin: 8px 0 0;
.capabilities {
margin-top: 18px;
}
.capabilities-hint {
display: flex;
align-items: flex-start;
gap: 6px;
margin: 0 0 14px;
color: var(--td-text-color-secondary);
font-size: var(--app-text-md);
line-height: 1.55;
.t-icon {
flex-shrink: 0;
margin-top: 3px;
color: var(--td-warning-color);
}
}
.capabilities-title {
display: block;
margin-bottom: 10px;
color: var(--td-text-color-secondary);
font-size: var(--app-text-sm);
}
.capabilities-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 8px;
margin: 0;
padding: 0;
list-style: none;
li {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
padding: 8px 10px;
border-radius: 8px;
background: var(--td-bg-color-container);
color: var(--td-text-color-primary);
font-size: var(--app-text-md);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.t-icon {
flex-shrink: 0;
color: var(--td-brand-color);
}
}
}
.device-actions {
@ -556,27 +662,15 @@ onBeforeUnmount(() => { alive = false; controller.abort(); clearTimeout(timer);
}
.usage {
margin-top: 24px;
padding-top: 20px;
border-top: 1px solid var(--td-component-stroke);
margin-top: 32px;
summary {
display: flex;
align-items: center;
justify-content: space-between;
list-style: none;
cursor: pointer;
font-size: var(--app-text-md);
font-weight: 500;
color: var(--td-text-color-secondary);
&::-webkit-details-marker { display: none; }
&:hover { color: var(--td-text-color-primary); }
&:focus-visible { outline: 2px solid var(--td-brand-color); outline-offset: 4px; }
h3 {
margin: 0 0 16px;
font-size: var(--app-text-lg);
font-weight: 600;
color: var(--td-text-color-primary);
}
&[open] summary { margin-bottom: 20px; }
&[open] summary :deep(.t-icon) { transform: rotate(180deg); }
ol {
list-style: none;
margin: 0;

View File

@ -123,6 +123,7 @@ import McpServiceDialog from './components/McpServiceDialog.vue'
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
import { useAuthStore } from '@/stores/auth'
const emit = defineEmits<{ count: [value: number] }>()
const { t } = useI18n()
const authStore = useAuthStore()
const confirmDelete = useConfirmDelete()
@ -141,6 +142,7 @@ const loadServices = async () => {
loading.value = true
try {
services.value = await listMCPServices()
emit('count', services.value.length)
} catch (error) {
MessagePlugin.error(t('mcpSettings.toasts.loadFailed'))
console.error('Failed to load MCP services:', error)
@ -237,6 +239,8 @@ const getTransportTypeLabel = (transportType: string) => {
onMounted(() => {
loadServices()
})
defineExpose({ openAdd: handleAdd })
</script>
<style scoped lang="less">

View File

@ -37,7 +37,6 @@
<path d="M5.5 10h4M5.5 12.5h2.5" stroke="currentColor" stroke-width="1.2"
stroke-linecap="round" />
</svg>
<BrowserIcon v-else-if="item.key === 'browserconnection'" class="nav-icon" width="17" height="17" />
<span v-else-if="item.emoji" class="nav-icon nav-icon-emoji">{{ item.emoji }}</span>
<t-icon v-else :name="item.icon" class="nav-icon" />
<span class="nav-label">{{ item.label }}</span>
@ -139,11 +138,6 @@
<SandboxSettings />
</div>
<!-- 技能目录:登记后可装到多份沙箱,智能体只从当前沙箱的就绪集合选用 -->
<div v-if="currentSection === 'skills'" class="section">
<SkillSettings :initial-sandbox-id="currentSubSection" />
</div>
<!-- 系统信息 -->
<div v-if="currentSection === 'system'" class="section">
<SystemInfo />
@ -173,8 +167,6 @@
<UserProfile />
</div>
<div v-if="currentSection === 'browserconnection'" class="section"><BrowserConnectionSettings /></div>
<!-- 空间信息 -->
<div v-if="currentSection === 'tenant'" class="section">
<TenantInfo />
@ -189,11 +181,6 @@
<div v-if="isIntegrationSection(currentSection)" class="section">
<IntegrationSettingsSection :tab="integrationTabFromSection(currentSection)" />
</div>
<!-- MCP 服务 -->
<div v-if="currentSection === 'mcp'" class="section">
<McpSettings />
</div>
</template>
</div>
</SettingsModalShell>
@ -214,11 +201,8 @@ import SystemInfo from './SystemInfo.vue'
import TenantInfo from './TenantInfo.vue'
import UserProfile from './UserProfile.vue'
import GeneralSettings from './GeneralSettings.vue'
import BrowserConnectionSettings from './BrowserConnectionSettings.vue'
import BrowserIcon from '@/components/icons/BrowserIcon.vue'
import ModelSettings from './ModelSettings.vue'
import OllamaSettings from './OllamaSettings.vue'
import McpSettings from './McpSettings.vue'
import WebSearchSettings from './WebSearchSettings.vue'
import ChatHistorySettings from './ChatHistorySettings.vue'
import MemorySettings from './MemorySettings.vue'
@ -228,7 +212,6 @@ import VectorStoreSettings from './VectorStoreSettings.vue'
import ParserEngineSettings from './ParserEngineSettings.vue'
import StorageBackendSettings from './StorageBackendSettings.vue'
import SandboxSettings from './SandboxSettings.vue'
import SkillSettings from './SkillSettings.vue'
import WeKnoraCloudSettings from './WeKnoraCloudSettings.vue'
import TenantMembers from './TenantMembers.vue'
import SystemSettings from '@/views/system/SystemSettings.vue'
@ -246,7 +229,7 @@ import {
SYSTEM_ADMIN_SETTINGS_SECTIONS,
} from '@/config/settingsAccess'
import { SETTINGS_SECTION_CAPABILITY } from '@/config/deploymentCapabilities'
import { SKILL_ICON } from '@/types/mention'
import { isToolboxSection, toolboxLocation } from '@/config/toolbox'
import {
buildSettingsRouteQuery,
integrationSectionKey,
@ -360,15 +343,12 @@ const navItems = computed(() => {
{ key: 'parser', icon: 'file-search', label: t('settings.parserEngine') },
{ key: 'storage', icon: 'cloud', label: t('settings.storageEngine') },
{ key: 'sandbox', icon: 'code', label: t('settings.sandbox.title') },
{ key: 'skills', icon: SKILL_ICON, label: t('settings.skills.title') },
{ key: 'mcp', icon: 'tools', label: t('settings.mcpService') },
{ key: 'system', icon: 'info-circle', label: t('settings.versionInfo') },
{ key: 'system-global', icon: 'server', label: t('settings.system') },
{ key: 'runtime-queues', icon: 'queue', label: t('settings.taskQueue') },
{ key: 'platform-api-keys', icon: 'secured', label: t('platformApiKeys.title') },
{ key: 'system-audit-log', icon: 'history', label: t('system.globalSettings.audit.tabLabel') },
{ key: 'userprofile', icon: 'user', label: t('userProfile.title') },
{ key: 'browserconnection', icon: 'laptop', label: t('localBrowser.settingsTitle') },
{ key: 'mymemory', icon: 'bookmark', label: t('memorySettings.title') },
{ key: 'envvars', icon: 'key', label: t('envVarSettings.title') },
{ key: 'tenant', icon: 'user-circle', label: t('settings.tenantInfo') },
@ -395,7 +375,7 @@ const navGroups = computed<NavGroup[]>(() => {
{
key: 'account',
label: t('settings.navGroups.account'),
items: pickItems(['general', 'userprofile', 'browserconnection', 'mymemory', 'envvars']),
items: pickItems(['general', 'userprofile', 'mymemory', 'envvars']),
},
{
key: 'workspace',
@ -420,9 +400,7 @@ const navGroups = computed<NavGroup[]>(() => {
'parser',
'storage',
'sandbox',
'skills',
'websearch',
'mcp',
]),
},
{
@ -496,10 +474,20 @@ const handleClose = () => {
}
}
// Existing in-product shortcuts can still call openSettings; moved tools
// always navigate to the toolbox, with the requested sandbox selection intact.
const redirectToToolbox = (section: string, subSection?: string | null) => {
if (!isToolboxSection(section)) return false
uiStore.closeSettings()
void router.push(toolboxLocation(section, subSection || undefined))
return true
}
// 监听初始导航设置
watch(() => uiStore.settingsInitialSection, (section) => {
if (section && visible.value) {
const normalizedSection = normalizeSettingsSection(section)
if (redirectToToolbox(normalizedSection, uiStore.settingsInitialSubSection)) return
if (deploymentCapabilities.loaded && !isSectionSupported(normalizedSection)) {
MessagePlugin.warning(t('settings.capabilityUnavailable'))
currentSection.value = navItems.value[0]?.key || 'general'
@ -522,22 +510,12 @@ watch(() => uiStore.settingsInitialSection, (section) => {
}
}, 300)
}
} else if (normalizedSection === 'skills') {
// Sandbox config id from the agent editor / sandbox cards. Skills has
// no nav children, so this is the only way to preselect the target image.
currentSubSection.value = uiStore.settingsInitialSubSection || ''
} else {
currentSubSection.value = ''
}
}
}, { immediate: true })
watch(() => uiStore.settingsInitialSubSection, (sub) => {
if (uiStore.settingsInitialSection === 'skills' && visible.value) {
currentSubSection.value = sub || ''
}
})
watch(
() => [visible.value, route.path, route.query.section, deploymentCapabilities.loaded] as const,
([isVisible, path, section, capabilitiesLoaded]) => {
@ -559,9 +537,7 @@ watch(
return
}
currentSection.value = normalizedSection
currentSubSection.value = normalizedSection === 'skills'
? (uiStore.settingsInitialSubSection || '')
: ''
currentSubSection.value = ''
syncSettingsRoute(normalizedSection)
},
{ immediate: true },
@ -589,6 +565,7 @@ const handleSettingsNav = (e: CustomEvent) => {
const { section, subsection } = e.detail
if (section) {
const normalizedSection = normalizeSettingsSection(section)
if (redirectToToolbox(normalizedSection, subsection)) return
if (deploymentCapabilities.loaded && !isSectionSupported(normalizedSection)) {
MessagePlugin.warning(t('settings.capabilityUnavailable'))
currentSection.value = navItems.value[0]?.key || 'general'

View File

@ -370,6 +370,7 @@ import {
const props = defineProps<{
initialSandboxId?: string
}>()
const emit = defineEmits<{ count: [value: number] }>()
const { t } = useI18n()
const uiStore = useUIStore()
@ -1171,6 +1172,7 @@ async function loadCatalog(silent = false) {
try {
const res = await listSkillCatalog()
catalog.value = res?.data || []
emit('count', catalog.value.length)
} catch (e: any) {
if (!silent) MessagePlugin.error(e?.message || t('settings.skills.loadFailed'))
} finally {
@ -1242,6 +1244,8 @@ watch(busyPickTargets, (targets) => {
}, { immediate: true })
onMounted(load)
defineExpose({ openAdd })
onUnmounted(() => {
stopPoll()
stopInstallProgress()

View File

@ -2,7 +2,8 @@
<SettingDrawer
:visible="dialogVisible"
:title="mode === 'add' ? t('mcpServiceDialog.addTitle') : t('mcpServiceDialog.editTitle')"
:class="`mcp-drawer mcp-drawer--${formData.transport_type}`"
class="mcp-drawer"
icon="tools"
:confirm-loading="submitting"
:confirm-disabled="metadataBusy || generatingUsage || (step === 1 && !toolsSynced)"
:confirm-text="t(step === 0 ? 'mcpMetadata.saveNext' : 'common.save')"
@ -14,25 +15,18 @@
@confirm="step === 0 ? handleNext() : handleSubmit()"
@cancel="handleClose"
>
<!--
Header icon — 抽屉通过 transport 类型区分连接配置:
transport_type 决定图标和容器配色。SSE 绿、HTTP-Streamable 蓝。
非 scoped 块 .mcp-drawer--{transport} 注入背景与文字色,currentColor
让 t-icon 跟着染色。
-->
<template #headerIcon>
<t-icon :name="transportIcon" />
</template>
<!-- 副标题:transport 类型名 + 启用状态 mini chip -->
<!-- 副标题:编辑时显示已保存服务的 transport 与启用状态;新建时还没有状态可展示 -->
<template #subtitle>
<span>{{ transportLabel }}</span>
<span
class="subtitle-tag"
:class="formData.enabled ? 'subtitle-tag--ok' : 'subtitle-tag--muted'"
>
{{ formData.enabled ? t('mcpSettings.enabled', '已启用') : t('mcpSettings.disabled', '已禁用') }}
</span>
<template v-if="mode === 'edit'">
<span>{{ transportLabel }}</span>
<span
class="subtitle-tag"
:class="formData.enabled ? 'subtitle-tag--ok' : 'subtitle-tag--muted'"
>
{{ formData.enabled ? t('mcpSettings.enabled', '已启用') : t('mcpSettings.disabled', '已禁用') }}
</span>
</template>
<template v-else>{{ t('mcpServiceDialog.addDesc') }}</template>
</template>
<template #header-extra>
@ -703,10 +697,6 @@ async function handleRevokeOAuth() {
// Header icon name + transport label, mirrored from McpSettings list cards
// so the list-card → drawer hand-off stays visually continuous.
const transportIcon = computed(() => {
return formData.value.transport_type === 'http-streamable' ? 'link' : 'cast'
})
const transportLabel = computed(() => {
return formData.value.transport_type === 'http-streamable' ? 'HTTP Streamable' : 'SSE'
})
@ -1417,13 +1407,4 @@ const handleClose = () => {
.setting-drawer__section-title { margin: 0; }
&:last-child { border-bottom: 0; padding-bottom: 0; }
}
.mcp-drawer--sse .setting-drawer__header-icon {
background: rgba(17, 128, 83, 0.12);
color: #118053;
}
.mcp-drawer--http-streamable .setting-drawer__header-icon {
background: rgba(0, 82, 217, 0.1);
color: #0052D9;
}
</style>

View File

@ -0,0 +1,342 @@
<template>
<main class="toolbox-page">
<header class="toolbox-header" style="--wails-draggable: drag">
<div class="toolbox-title-row" style="--wails-draggable: drag">
<h2 style="--wails-draggable: drag">
<ResourceIcon type="toolbox" :size="24" />
{{ t('toolbox.title') }}
</h2>
<t-button v-if="selectedItem && 'action' in selectedItem" variant="text" theme="default" size="small"
class="toolbox-action" style="--wails-draggable: no-drag" @click="panel?.openAdd?.()">
<template #icon><t-icon :name="selectedItem.icon" size="16px" /></template>
{{ t(selectedItem.action) }}
</t-button>
</div>
<p class="toolbox-subtitle" style="--wails-draggable: drag">
{{ t(selectedItem?.description ?? 'toolbox.description') }}
<t-tooltip v-if="selectedItem && 'help' in selectedItem" :content="t(selectedItem.help)" placement="bottom"
overlay-class-name="skill-settings__help-tooltip">
<t-icon name="help-circle" class="toolbox-help" :aria-label="t(selectedItem.help)" />
</t-tooltip>
</p>
</header>
<template v-if="visibleItems.length">
<div class="toolbox-tabs" role="tablist" :aria-label="t('toolbox.title')">
<button v-for="item in visibleItems" :key="item.key" type="button" role="tab" class="toolbox-tab"
:aria-selected="selectedItem?.key === item.key" @click="select(item.key)">
<BrowserIcon v-if="item.key === 'browserconnection'" width="18" height="18" />
<t-icon v-else :name="item.icon" size="18px" />
<span>{{ t(item.title) }}</span>
<span v-if="item.key === 'browserconnection' && browserStatus" class="toolbox-tab-status"
:class="`is-${browserStatus}`">
<i aria-hidden="true" />{{ t(`localBrowser.${browserStatus}`) }}
</span>
<span v-else-if="item.key !== 'browserconnection' && counts[item.key] !== undefined"
class="toolbox-tab-count">{{ counts[item.key] }}</span>
</button>
</div>
<section v-if="selectedItem" class="toolbox-main" role="tabpanel">
<div class="toolbox-panel">
<SkillSettings v-if="selectedItem.key === 'skills'" ref="panel" :key="sandboxId"
:initial-sandbox-id="sandboxId" @count="counts.skills = $event" />
<McpSettings v-else-if="selectedItem.key === 'mcp'" ref="panel" @count="counts.mcp = $event" />
<BrowserConnectionSettings v-else-if="selectedItem.key === 'browserconnection'" />
</div>
</section>
</template>
<EmptyState v-else icon="tools" :title="t('toolbox.unavailable')" />
</main>
</template>
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { useAuthStore } from '@/stores/auth'
import { useBrowserConnectionStore } from '@/stores/browserConnection'
import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities'
import { listSkillCatalog } from '@/api/skill'
import { listMCPServices } from '@/api/mcp-service'
import {
TOOLBOX_ITEMS,
canAccessToolboxSection,
toolboxLocation,
type ToolboxSection,
} from '@/config/toolbox'
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
import BrowserIcon from '@/components/icons/BrowserIcon.vue'
import EmptyState from '@/components/EmptyState.vue'
import SkillSettings from '@/views/settings/SkillSettings.vue'
import McpSettings from '@/views/settings/McpSettings.vue'
import BrowserConnectionSettings from '@/views/settings/BrowserConnectionSettings.vue'
const route = useRoute()
const router = useRouter()
const { t } = useI18n()
const authStore = useAuthStore()
const browserConnection = useBrowserConnectionStore()
const capabilities = useDeploymentCapabilitiesStore()
const panel = ref<{ openAdd?: () => void } | null>(null)
const counts = reactive<Partial<Record<ToolboxSection, number>>>({})
const requestedSection = computed(() => typeof route.params.section === 'string' ? route.params.section : '')
const sandboxId = computed(() => typeof route.query.sandboxId === 'string' ? route.query.sandboxId : '')
const visibleItems = computed(() => TOOLBOX_ITEMS.filter((item) => canAccessToolboxSection(item.key, {
currentTenantRole: authStore.currentTenantRole,
canAccessAllTenants: authStore.canAccessAllTenants,
hasRole: (role) => authStore.hasRole(role),
isSupported: (capability) => capabilities.isSupported(capability),
})))
const selectedItem = computed(() => visibleItems.value.find((item) => item.key === requestedSection.value))
const browserStatus = computed(() => {
if (!browserConnection.loaded || !browserConnection.enabled) return ''
if (browserConnection.connected) return 'connected'
return browserConnection.device ? 'offline' : 'notPaired'
})
const select = (section: ToolboxSection) => {
if (section === requestedSection.value) return
void router.replace(toolboxLocation(section))
}
// The bare /toolbox URL, and tools lost to a role or workspace switch, land on
// the first tool the user can still open.
watch([selectedItem, visibleItems], () => {
const fallback = visibleItems.value[0]
if (!selectedItem.value && fallback) void router.replace(toolboxLocation(fallback.key))
}, { immediate: true })
// Tab badges for tools that are not open; the open panel keeps its own badge current.
const summaries: Record<ToolboxSection, () => Promise<void>> = {
skills: async () => { counts.skills = (await listSkillCatalog())?.data?.length ?? 0 },
mcp: async () => { counts.mcp = (await listMCPServices()).length },
browserconnection: async () => { if (!browserConnection.loaded) await browserConnection.refresh() },
}
watch(() => visibleItems.value.map((item) => item.key), (keys, previous = []) => {
for (const key of keys) {
if (!previous.includes(key)) summaries[key]().catch(() => {})
}
}, { immediate: true })
</script>
<style scoped lang="less">
.toolbox-page {
flex: 1;
min-width: 0;
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
margin: 0 16px 0 0;
padding: 20px 28px 0;
color: var(--td-text-color-primary);
}
.toolbox-header {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 12px;
flex-shrink: 0;
h2 {
display: flex;
align-items: center;
gap: 8px;
margin: 0;
font-family: var(--app-font-family);
font-size: var(--app-text-4xl);
font-weight: 600;
line-height: 32px;
}
}
.toolbox-title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--app-space-4);
}
.toolbox-action.t-button {
flex-shrink: 0;
min-height: 32px;
padding: 0 12px;
gap: 6px;
border: 1px solid var(--td-component-stroke);
border-radius: var(--app-radius-sm);
background: var(--td-bg-color-container);
color: var(--td-text-color-primary);
transition: background var(--app-motion-base);
&:hover:not(:disabled) {
border-color: var(--td-component-stroke);
background: var(--td-bg-color-container-hover);
}
&:focus-visible {
outline: 2px solid var(--td-brand-color);
outline-offset: 2px;
}
:deep(.t-icon) {
color: var(--td-brand-color);
}
}
.toolbox-subtitle {
display: flex;
align-items: center;
gap: 6px;
margin: 0;
color: var(--td-text-color-secondary);
font-size: var(--app-text-base);
line-height: 20px;
}
.toolbox-help {
flex-shrink: 0;
color: var(--td-text-color-placeholder);
font-size: var(--app-text-md);
cursor: help;
&:hover {
color: var(--td-text-color-secondary);
}
}
.toolbox-tabs {
flex-shrink: 0;
display: flex;
gap: 32px;
overflow-x: auto;
border-bottom: 1px solid var(--td-component-stroke);
scrollbar-width: none;
}
.toolbox-tab {
position: relative;
flex-shrink: 0;
display: inline-flex;
align-items: center;
gap: 8px;
height: 48px;
padding: 0 2px;
border: 0;
background: transparent;
color: var(--td-text-color-secondary);
font: inherit;
font-size: var(--app-text-lg);
font-weight: 500;
cursor: pointer;
transition: color var(--app-motion-fast) ease;
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: -1px;
height: 2px;
border-radius: 2px;
background: transparent;
transition: background var(--app-motion-fast) ease;
}
&:hover {
color: var(--td-text-color-primary);
}
&[aria-selected='true'] {
color: var(--td-text-color-primary);
> .t-icon, > svg {
color: var(--td-brand-color);
}
&::after {
background: var(--td-brand-color);
}
.toolbox-tab-count {
background: var(--td-brand-color-light);
color: var(--td-brand-color);
}
}
&:focus-visible {
outline: 2px solid var(--td-brand-color);
outline-offset: -2px;
border-radius: var(--app-radius-sm);
}
}
.toolbox-tab-count {
min-width: 20px;
height: 20px;
box-sizing: border-box;
padding: 0 6px;
border-radius: 10px;
background: var(--td-bg-color-secondarycontainer);
color: var(--td-text-color-secondary);
font-size: var(--app-text-xs);
font-weight: 500;
line-height: 20px;
text-align: center;
font-variant-numeric: tabular-nums;
}
.toolbox-tab-status {
display: inline-flex;
align-items: center;
gap: 5px;
color: var(--td-text-color-placeholder);
font-size: var(--app-text-xs);
font-weight: 400;
i {
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
&.is-connected {
color: var(--td-success-color);
}
&.is-offline {
color: var(--td-warning-color);
}
}
.toolbox-main {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
padding: var(--app-space-5) 0 var(--app-space-8);
}
.toolbox-panel {
// Panels are shared with the settings dialog; here the tab and page header
// already carry their title and description.
> :deep(* > .section-header) {
display: none;
}
}
@media (max-width: 768px) {
.toolbox-page {
margin: 0;
padding: 16px 16px 0;
}
.toolbox-tabs {
gap: 20px;
}
}
</style>