Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(studio): refine dark theme, layouts and compile navigation (#5129)
yufeng479af248a864
diff --git a/web-studio/src/components/app-shell.tsx b/web-studio/src/components/app-shell.tsxindex 71030819a..c8681bb82 100644--- a/web-studio/src/components/app-shell.tsx+++ b/web-studio/src/components/app-shell.tsx@@ -21,6 +21,7 @@ import {SparklesIcon,SunIcon,UsersRoundIcon,+ WorkflowIcon,} from 'lucide-react'import { useTranslation } from 'react-i18next'import { useTheme } from 'next-themes'@@ -121,7 +122,7 @@ const NAV_ITEMS: readonly NavItem[] = [},{- icon: SparklesIcon,+ icon: WorkflowIcon,id: 'compile',section: 'workspace',titleKey: 'navigation.compile.title',@@ -196,7 +197,7 @@ const LANGUAGE_OPTIONS = [] as constconst HEADER_ICON_BUTTON_CLASS =- 'relative inline-flex h-10 w-10 items-center justify-center rounded-2xl border border-border/80 bg-muted/60 text-muted-foreground shadow-xs transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2'+ 'relative inline-flex h-8 w-8 items-center justify-center rounded-lg border border-border/80 bg-muted/60 text-muted-foreground shadow-xs transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2'function resolveLanguage(value: string | undefined,@@ -522,17 +523,17 @@ function AppShellInner({ children }: { children: React.ReactNode }) {</Sidebar><SidebarInset className="min-h-0 flex-1 overflow-hidden rounded-none border-0 bg-background shadow-none ring-0 md:m-0 md:ml-0">- <header className="flex h-12 shrink-0 items-center justify-end border-b border-border/70 bg-background px-4 backdrop-blur-md md:px-6">+ <header className="flex h-12 shrink-0 items-center justify-end border-b border-border/70 bg-sidebar px-4 backdrop-blur-md md:px-6"><SidebarTrigger className="mr-auto shrink-0 md:hidden" />- <div className="flex items-center gap-3">+ <div className="flex items-center gap-2"><divaria-label={t('language.label', { ns: 'common' })}- className="relative flex h-10 items-center rounded-2xl border border-border/80 bg-muted/60 p-1 text-xs shadow-xs"+ className="relative flex h-8 items-center rounded-lg border border-border/80 bg-muted/60 p-1 text-xs shadow-xs"role="group"><spanclassName={cn(- 'absolute h-8 min-w-10 rounded-xl bg-background shadow-sm transition-transform duration-200 ease-in-out',+ 'absolute h-6 min-w-8 rounded-md bg-background shadow-sm transition-transform duration-200 ease-in-out',currentLanguage === 'en' && 'translate-x-full',)}/>@@ -545,7 +546,7 @@ function AppShellInner({ children }: { children: React.ReactNode }) {type="button"aria-pressed={isActive}className={cn(- 'relative z-10 h-8 min-w-10 rounded-xl px-2 text-xs font-semibold text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',+ 'relative z-10 h-6 min-w-8 rounded-md px-2 text-xs font-semibold text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',isActive && 'text-foreground',)}onClick={() => {@@ -568,8 +569,8 @@ function AppShellInner({ children }: { children: React.ReactNode }) {setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}>- <MoonIcon className="size-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />- <SunIcon className="absolute size-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />+ <MoonIcon className="size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />+ <SunIcon className="absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" /></button><a@@ -579,7 +580,7 @@ function AppShellInner({ children }: { children: React.ReactNode }) {aria-label={t('footer.github', { ns: 'appShell' })}className={HEADER_ICON_BUTTON_CLASS}>- <GithubIcon className="size-5" />+ <GithubIcon className="size-4" /></a><div className="h-6 w-px bg-border/80" aria-hidden="true" />diff --git a/web-studio/src/components/current-user-menu.tsx b/web-studio/src/components/current-user-menu.tsxindex 229f6430b..c60f64c11 100644--- a/web-studio/src/components/current-user-menu.tsx+++ b/web-studio/src/components/current-user-menu.tsx@@ -108,13 +108,13 @@ export function CurrentUserMenu() {<Popover open={open} onOpenChange={setOpen}><PopoverTriggeraria-label={t('header.currentUser.openMenu', { user: userLabel })}- className="group flex h-10 max-w-52 items-center gap-2 rounded-2xl border border-border/80 bg-muted/60 p-1 pr-2.5 text-left shadow-xs outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"+ className="group flex h-8 max-w-48 items-center gap-2 rounded-lg border border-border/80 bg-muted/60 p-1 pr-2.5 text-left shadow-xs outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2">- <span className="flex size-8 shrink-0 items-center justify-center rounded-xl bg-foreground text-xs font-semibold text-background shadow-sm">+ <span className="flex size-6 shrink-0 items-center justify-center rounded-md bg-foreground text-xs font-semibold text-background shadow-sm">{getUserInitial(userLabel)}</span><span className="hidden min-w-0 flex-1 sm:block">- <span className="block truncate text-xs font-semibold leading-4 text-foreground">+ <span className="block truncate text-xs font-semibold leading-3 text-foreground">{userLabel}</span><span className="block truncate text-[10px] leading-3 text-muted-foreground">diff --git a/web-studio/src/i18n/locales/en/compile.ts b/web-studio/src/i18n/locales/en/compile.tsindex 0f7328172..0f5c2a697 100644--- a/web-studio/src/i18n/locales/en/compile.ts+++ b/web-studio/src/i18n/locales/en/compile.ts@@ -50,6 +50,8 @@ export default {},moreSources: '{{count}} more source directories',+ outputDirectory: 'Output directory',+ viewDetails: 'View details',detailTitle: 'Compile task details',copyTaskId: 'Copy task ID',stages: {@@ -153,7 +155,8 @@ export default {storageFailed: 'Draft could not be saved.',newTasks: 'Refresh to see new tasks',createdAt: 'Created',- task: 'Task / Skill',+ skillColumn: 'Skill',+ taskId: 'Task ID',materials: 'Materials',status: 'Status',invalidTask: 'Task not found or not a compilation.',diff --git a/web-studio/src/i18n/locales/en/vikingbot.ts b/web-studio/src/i18n/locales/en/vikingbot.tsindex 382f75e46..2f3ced878 100644--- a/web-studio/src/i18n/locales/en/vikingbot.ts+++ b/web-studio/src/i18n/locales/en/vikingbot.ts@@ -114,14 +114,17 @@ export default {title: 'VikingBot',conversations: 'Conversations',channels: 'Bots',- intro: 'Talk to VikingBot here, or bring it into your team’s Feishu groups.',+ intro:+ 'Talk to VikingBot here, or connect it to your team’s messaging platform.',newChat: 'New conversation',web: 'Web',feishu: 'Feishu',all: 'All',search: 'Search conversations',empty: 'Start a conversation',- emptyHint: 'Ask a question, explore your resources, or connect Feishu.',+ emptyHint:+ 'Ask a question, explore your resources, or connect a bot to your messaging platform.',+ manageBots: 'Manage bots',enable: 'Enable VikingBot to begin',enableHint:'Ask your administrator to start OpenViking with Bot support and configure a conversation model.',diff --git a/web-studio/src/i18n/locales/en/workspace.ts b/web-studio/src/i18n/locales/en/workspace.tsindex dd9cd9a0c..611a40693 100644--- a/web-studio/src/i18n/locales/en/workspace.ts+++ b/web-studio/src/i18n/locales/en/workspace.ts@@ -209,6 +209,7 @@ const workspace = {},},agentExperiencePage: {+ pageCount: '{{count}} experiences on this page',setup: {expand: 'Expand steps',collapse: 'Collapse',diff --git a/web-studio/src/i18n/locales/zh-CN/compile.ts b/web-studio/src/i18n/locales/zh-CN/compile.tsindex c5b77bd04..f2287f93a 100644--- a/web-studio/src/i18n/locales/zh-CN/compile.ts+++ b/web-studio/src/i18n/locales/zh-CN/compile.ts@@ -43,6 +43,8 @@ export default {argTypes: { string: '文本', number: '数字', boolean: '布尔值', json: 'JSON' },moreSources: '另有 {{count}} 个素材目录',+ outputDirectory: '输出目录',+ viewDetails: '查看详情',detailTitle: '编译任务详情',copyTaskId: '复制任务 ID',stages: {@@ -72,7 +74,7 @@ export default {'已超过安全重试时间。请先查询上次提交或检查任务列表,确认后清空草稿再创建新任务。',targetPlaceholder: 'viking://resources/wiki',removeSource: '移除 {{uri}}',- title: 'Compile',+ title: '编译',description: '使用 Skill 将素材整理为新的内容。',new: '新建编译',back: '返回列表',@@ -140,7 +142,8 @@ export default {storageFailed: '草稿保存失败。',newTasks: '刷新查看新任务',createdAt: '创建时间',- task: '任务 / Skill',+ skillColumn: '技能',+ taskId: '任务 ID',materials: '素材',status: '状态',invalidTask: '任务不存在或不是编译任务。',diff --git a/web-studio/src/i18n/locales/zh-CN/vikingbot.ts b/web-studio/src/i18n/locales/zh-CN/vikingbot.tsindex 0d259d758..531a2a63e 100644--- a/web-studio/src/i18n/locales/zh-CN/vikingbot.ts+++ b/web-studio/src/i18n/locales/zh-CN/vikingbot.ts@@ -105,14 +105,15 @@ export default {title: 'VikingBot',conversations: '对话',channels: '机器人',- intro: '在这里与 VikingBot 对话,也可以将它加入团队的飞书群。',+ intro: '在这里与 VikingBot 对话,也可以将它接入团队使用的消息平台。',newChat: '新建对话',web: '网页',feishu: '飞书',all: '全部',search: '搜索对话',empty: '开始与 VikingBot 对话',- emptyHint: '提出问题、探索资源,或将机器人连接到飞书。',+ emptyHint: '提出问题、探索资源,或将机器人接入你使用的消息平台。',+ manageBots: '管理机器人',enable: '先启用 VikingBot',enableHint: '请管理员以 Bot 模式启动 OpenViking,并配置对话模型。',modelHint: 'VikingBot 默认继承根级 vlm 模型配置。',diff --git a/web-studio/src/i18n/locales/zh-CN/workspace.ts b/web-studio/src/i18n/locales/zh-CN/workspace.tsindex d007e0b13..24db0e1ce 100644--- a/web-studio/src/i18n/locales/zh-CN/workspace.ts+++ b/web-studio/src/i18n/locales/zh-CN/workspace.ts@@ -30,7 +30,7 @@ const workspace = {defaultTitle: 'OpenViking Studio',},navigation: {- compile: { title: 'Compile' },+ compile: { title: '编译' },home: {title: '首页',},@@ -208,6 +208,7 @@ const workspace = {},},agentExperiencePage: {+ pageCount: '本页 {{count}} 条经验',setup: {expand: '展开步骤',collapse: '收起',@@ -493,7 +494,7 @@ const workspace = {unknown: '未知',},types: {- compile: 'Compile',+ compile: '编译',session_commit: '会话提交',add_resource: '资源处理',add_skill: '技能导入',diff --git a/web-studio/src/routes/agent-experience/$experienceUri.tsx b/web-studio/src/routes/agent-experience/$experienceUri.tsxindex a9e7c0776..04f9314bc 100644--- a/web-studio/src/routes/agent-experience/$experienceUri.tsx+++ b/web-studio/src/routes/agent-experience/$experienceUri.tsx@@ -287,29 +287,8 @@ function ExperienceDetailRoute() {</Card><Card size="sm" className="bg-background shadow-none ring-border/70">- <CardHeader>- <div className="flex flex-wrap items-center justify-between gap-3">- <div className="grid min-w-0 gap-1">- <CardTitle className="truncate text-base">- {activeTab === 'impact'- ? t('detail.analysisTitle')- : t('detail.sourceTitle')}- </CardTitle>- <CardDescription>- {activeTab === 'impact'- ? t('detail.analysisDescription')- : t('detail.sourceDescription')}- </CardDescription>- </div>- {activeTab === 'impact' ? (- <TimeRangePicker- onChange={handleTimeRangeChange}- preset={timeRangePreset}- range={timeRange}- />- ) : null}- </div>- <div className="mt-4 flex gap-5 border-b border-border/60">+ <CardHeader className="gap-4">+ <div className="flex gap-5 border-b border-border/60">{DETAIL_TABS.map((tab) => (<buttonkey={tab}@@ -317,15 +296,15 @@ function ExperienceDetailRoute() {aria-pressed={activeTab === tab}className={activeTab === tab- ? 'flex items-center gap-2 border-b-2 border-primary px-1 pb-3 text-sm font-medium text-foreground'- : 'flex items-center gap-2 border-b-2 border-transparent px-1 pb-3 text-sm text-muted-foreground transition-colors hover:text-foreground'+ ? 'flex items-center gap-2 whitespace-nowrap border-b-2 border-primary px-1 pb-3 text-sm font-medium text-foreground'+ : 'flex items-center gap-2 whitespace-nowrap border-b-2 border-transparent px-1 pb-3 text-sm text-muted-foreground transition-colors hover:text-foreground'}onClick={() => setActiveTab(tab)}>{tab === 'impact' ? (- <BarChart3Icon className="size-3" />+ <BarChart3Icon className="size-4" />) : (- <GitBranchIcon className="size-3" />+ <GitBranchIcon className="size-4" />)}{tab === 'impact'? t('detail.tabImpact')@@ -333,6 +312,20 @@ function ExperienceDetailRoute() {</button>))}</div>+ <div className="grid gap-3">+ <CardDescription>+ {activeTab === 'impact'+ ? t('detail.analysisDescription')+ : t('detail.sourceDescription')}+ </CardDescription>+ {activeTab === 'impact' ? (+ <TimeRangePicker+ onChange={handleTimeRangeChange}+ preset={timeRangePreset}+ range={timeRange}+ />+ ) : null}+ </div></CardHeader><CardContent className="grid gap-5 px-5 pb-5">{activeTab === 'impact' ? (diff --git a/web-studio/src/routes/agent-experience/-components/experience-setup-guide.tsx b/web-studio/src/routes/agent-experience/-components/experience-setup-guide.tsxindex 2f413d777..04985262d 100644--- a/web-studio/src/routes/agent-experience/-components/experience-setup-guide.tsx+++ b/web-studio/src/routes/agent-experience/-components/experience-setup-guide.tsx@@ -41,17 +41,17 @@ export function ExperienceSetupGuide() {return (<sectionaria-labelledby="experience-setup-title"- className="rounded-xl border border-primary/25 bg-gradient-to-br from-primary/5 to-background px-4 py-3 sm:px-5"+ className="rounded-lg border border-border/60 bg-muted/10 px-3 py-1.5"><div className="flex flex-wrap items-center justify-between gap-3"><div className="flex items-center gap-2">- <SparklesIcon className="size-5 shrink-0 text-primary" />- <h2 id="experience-setup-title" className="font-semibold">+ <SparklesIcon className="size-4 shrink-0 text-muted-foreground" />+ <h2 id="experience-setup-title" className="text-sm font-medium">{t('setup.title')}</h2></div><Button- variant="outline"+ variant="ghost"size="sm"aria-expanded={expanded}aria-controls="experience-setup-steps"diff --git a/web-studio/src/routes/agent-experience/index.tsx b/web-studio/src/routes/agent-experience/index.tsxindex ceb249628..d7d241c1f 100644--- a/web-studio/src/routes/agent-experience/index.tsx+++ b/web-studio/src/routes/agent-experience/index.tsx@@ -278,11 +278,11 @@ function AgentExperienceRoute() {}return (- <div className="flex w-full min-w-0 flex-col gap-6">+ <div className="flex w-full min-w-0 flex-col gap-5"><header className="flex flex-wrap items-start justify-between gap-4"><div className="grid gap-1.5"><div className="flex items-center gap-2.5">- <h1 className="text-2xl font-semibold tracking-tight sm:text-3xl">+ <h1 className="text-2xl font-semibold tracking-tight">{t('title')}</h1></div>@@ -388,8 +388,8 @@ function AgentExperienceRoute() {size="sm"className="rounded-xl bg-background shadow-none ring-border/70 data-[size=sm]:gap-0 data-[size=sm]:py-0">- <div className="flex flex-wrap items-center justify-end gap-3 border-b border-border/60 px-5 py-4">- <div className="relative w-full sm:max-w-sm">+ <div className="flex flex-wrap items-center justify-between gap-3 border-b border-border/60 px-4 py-3">+ <div className="relative w-full sm:max-w-md"><SearchIcon className="pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground" /><Inputaria-label={t('searchPlaceholder')}@@ -415,6 +415,9 @@ function AgentExperienceRoute() {</button>) : null}</div>+ <span className="text-xs tabular-nums text-muted-foreground">+ {t('pageCount', { count: experiences.length })}+ </span></div>{experiences.length === 0 ? (@@ -427,16 +430,16 @@ function AgentExperienceRoute() {</div></div>) : (- <Table>+ <Table className="table-fixed"><TableHeader>- <TableRow className="bg-muted/20 hover:bg-muted/20">- <TableHead className="h-10 pl-5 text-xs font-normal text-muted-foreground">+ <TableRow className="bg-muted/15 hover:bg-muted/15">+ <TableHead className="h-10 pl-4 text-xs font-normal text-muted-foreground">{t('columnFile')}</TableHead>- <TableHead className="h-10 w-44 text-xs font-normal text-muted-foreground">+ <TableHead className="hidden h-10 w-44 sm:table-cell text-xs font-normal text-muted-foreground">{t('columnUpdated')}</TableHead>- <TableHead className="h-10 w-28 pr-5 text-right text-xs font-normal text-muted-foreground">+ <TableHead className="h-10 w-28 pr-4 text-right text-xs font-normal text-muted-foreground">{t('columnActions')}</TableHead></TableRow>@@ -455,16 +458,17 @@ function AgentExperienceRoute() {className="group cursor-pointer border-border/50 transition-colors hover:bg-muted/30"onClick={() => handleOpenPreview(experience)}>- <TableCell className="max-w-0 py-2.5 pl-5">+ <TableCell className="min-w-0 py-3.5 pl-4"><div className="flex min-w-0 items-center gap-3">- <span className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-border/70 text-muted-foreground transition-colors group-hover:border-primary/30 group-hover:text-primary">+ <span className="flex size-5 shrink-0 items-center justify-center text-muted-foreground/60 transition-colors group-hover:text-foreground"><FileTextIcon className="size-4" /></span><div className="grid min-w-0 gap-1"><div className="flex min-w-0 items-center gap-1.5"><buttontype="button"- className="min-w-0 truncate text-left font-medium underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50"+ title={experience.uri}+ className="min-w-0 truncate text-left text-sm font-medium underline-offset-4 hover:text-primary hover:underline focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50"onClick={(event) => {event.stopPropagation()handleOpenPreview(experience)@@ -484,23 +488,28 @@ function AgentExperienceRoute() {</Badge>) : null}</div>- <span- className="truncate font-mono text-[11px] text-muted-foreground/80"- title={experience.uri}- >- <HighlightedText- keyword={normalizedKeyword}- text={experience.uri}- />- </span>+ {normalizedKeyword &&+ !experience.name+ .toLocaleLowerCase()+ .includes(normalizedKeyword) ? (+ <span+ className="truncate font-mono text-[11px] text-muted-foreground"+ title={experience.uri}+ >+ <HighlightedText+ keyword={normalizedKeyword}+ text={experience.uri}+ />+ </span>+ ) : null}</div></div></TableCell>- <TableCell className="w-44 text-xs text-muted-foreground">+ <TableCell className="hidden w-44 text-xs tabular-nums text-muted-foreground sm:table-cell">{updated ?? '-'}</TableCell><TableCell- className="w-28 pr-5 text-right"+ className="w-28 pr-4 text-right"onClick={(event) => event.stopPropagation()}><Buttondiff --git a/web-studio/src/routes/compile/-components/context-link.test.tsx b/web-studio/src/routes/compile/-components/context-link.test.tsxnew file mode 100644index 000000000..e854e522a--- /dev/null+++ b/web-studio/src/routes/compile/-components/context-link.test.tsx@@ -0,0 +1,161 @@+// @vitest-environment jsdom+import type { ReactNode } from 'react'+import { afterEach, expect, it, vi } from 'vitest'+import {+ act,+ cleanup,+ fireEvent,+ render,+ waitFor,+} from '@testing-library/react'+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'+import { ContextLink, useCompileSkillName } from './context-link'++vi.mock('react-i18next', () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}))++const api = vi.hoisted(() => ({+ fetchCompileSkills: vi.fn(),+ fetchFsStat: vi.fn(),+}))+vi.mock('../-lib/api', () => ({ fetchCompileSkills: api.fetchCompileSkills }))+vi.mock('#/routes/resources/-lib/api', () => ({ fetchFsStat: api.fetchFsStat }))+vi.mock('#/hooks/use-app-connection', () => ({+ useAppConnection: () => ({ identityScopeKey: 'alice' }),+}))+vi.mock('@tanstack/react-router', () => ({+ Link: ({+ to,+ search,+ children,+ }: {+ to: string+ search: Record<string, string>+ children: ReactNode+ }) => <a href={`${to}?${new URLSearchParams(search)}`}>{children}</a>,+}))+const clients: QueryClient[] = []+function mount(children: ReactNode) {+ const client = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ })+ clients.push(client)+ return render(+ <QueryClientProvider client={client}>{children}</QueryClientProvider>,+ )+}+afterEach(() => {+ cleanup()+ clients.splice(0).forEach((client) => client.clear())+ vi.resetAllMocks()+})++it('opens file materials in preview and directory materials in the explorer', async () => {+ api.fetchFsStat.mockImplementation(async (uri: string) => ({+ isDir: uri.endsWith('/folder'),+ }))+ const page = mount(+ <>+ <ContextLink uri="viking://resources/folder/report.md" resolveFile />+ <ContextLink uri="viking://resources/folder" resolveFile />+ </>,+ )+ await waitFor(() => {+ const link = new URL(+ page.getByRole('link', { name: 'report.md' }).getAttribute('href')!,+ 'http://localhost',+ )+ expect(link.pathname).toBe('/playground')+ expect(link.searchParams.get('file')).toBe(+ 'viking://resources/folder/report.md',+ )+ })+ const directory = new URL(+ page.getByRole('link', { name: 'folder' }).getAttribute('href')!,+ 'http://localhost',+ )+ expect(directory.searchParams.get('uri')).toBe('viking://resources/folder')+ expect(directory.searchParams.has('file')).toBe(false)+})++function SkillLink() {+ const name = useCompileSkillName()+ const uri = 'viking://agent/skills/digest/'+ return <ContextLink uri={uri}>{name(uri)}</ContextLink>+}++it('uses the skill display name and keeps its original URI for navigation', async () => {+ api.fetchCompileSkills.mockResolvedValue([+ { uri: 'viking://agent/skills/digest', name: 'Discussion digest' },+ ])+ const page = mount(<SkillLink />)+ const link = await page.findByRole('link', { name: 'Discussion digest' })+ expect(+ new URL(link.getAttribute('href')!, 'http://localhost').searchParams.get(+ 'uri',+ ),+ ).toBe('viking://agent/skills/digest/')+})++it('keeps a readable, usable link when skill metadata is unavailable', async () => {+ api.fetchCompileSkills.mockRejectedValue(new Error('Unavailable'))+ const page = mount(<SkillLink />)+ expect(page.getByRole('link', { name: 'digest' })).toBeTruthy()+})++it('withholds navigation until file metadata resolves', async () => {+ let resolve!: (entry: { isDir: boolean }) => void+ api.fetchFsStat.mockReturnValue(+ new Promise((done) => {+ resolve = done+ }),+ )+ const uri = 'viking://resources/folder/report.md'+ const page = mount(<ContextLink uri={uri} resolveFile />)+ expect(page.queryByRole('link')).toBeNull()+ expect(+ (page.getByRole('button', { name: 'report.md' }) as HTMLButtonElement)+ .disabled,+ ).toBe(true)++ await act(async () => resolve({ isDir: false }))+ const link = await page.findByRole('link', { name: 'report.md' })+ const target = new URL(link.getAttribute('href')!, 'http://localhost')+ expect(target.searchParams.get('uri')).toBe('viking://resources/folder/')+ expect(target.searchParams.get('file')).toBe(uri)+})++it('offers retry after metadata failure without exposing a directory link', async () => {+ let resolve!: (entry: { isDir: boolean }) => void+ api.fetchFsStat+ .mockRejectedValueOnce(new Error('Unavailable'))+ .mockImplementationOnce(+ () =>+ new Promise((done) => {+ resolve = done+ }),+ )+ const uri = 'viking://resources/folder/report.md'+ const page = mount(<ContextLink uri={uri} resolveFile />)+ const retry = await page.findByRole('button', { name: `retry: ${uri}` })+ expect(page.queryByRole('link')).toBeNull()+ fireEvent.click(retry)+ await waitFor(() => expect(api.fetchFsStat).toHaveBeenCalledTimes(2))+ expect(page.queryByRole('link')).toBeNull()+ expect((page.getByRole('button') as HTMLButtonElement).disabled).toBe(true)++ await act(async () => resolve({ isDir: false }))+ const link = await page.findByRole('link', { name: 'report.md' })+ expect(+ new URL(link.getAttribute('href')!, 'http://localhost').searchParams.get(+ 'file',+ ),+ ).toBe(uri)+})++it('keeps known directory links immediately available without requesting metadata', () => {+ const page = mount(<ContextLink uri="viking://resources/output" />)+ expect(page.getByRole('link', { name: 'output' })).toBeTruthy()+ expect(api.fetchFsStat).not.toHaveBeenCalled()+})diff --git a/web-studio/src/routes/compile/-components/context-link.tsx b/web-studio/src/routes/compile/-components/context-link.tsxnew file mode 100644index 000000000..b33688cb5--- /dev/null+++ b/web-studio/src/routes/compile/-components/context-link.tsx@@ -0,0 +1,85 @@+import type { ReactNode } from 'react'+import { Link } from '@tanstack/react-router'+import { useQuery } from '@tanstack/react-query'+import { useTranslation } from 'react-i18next'+import { useAppConnection } from '#/hooks/use-app-connection'+import { fetchFsStat } from '#/routes/resources/-lib/api'+import { parentUri } from '#/lib/viking-uri'+import { cn } from '#/lib/utils'+import { fetchCompileSkills } from '../-lib/api'++export const contextName = (uri: string) =>+ uri.split('/').filter(Boolean).pop() || uri++export function useCompileSkillName() {+ const { identityScopeKey } = useAppConnection()+ const { data } = useQuery({+ queryKey: ['compile-skills', identityScopeKey],+ queryFn: ({ signal }) => fetchCompileSkills(signal),+ staleTime: 30_000,+ })+ return (uri: string) =>+ data?.find(+ (skill) => skill.uri.replace(/\/$/, '') === uri.replace(/\/$/, ''),+ )?.name || contextName(uri)+}++export function ContextLink({+ uri,+ children,+ className,+ resolveFile = false,+}: {+ uri: string+ children?: ReactNode+ className?: string+ resolveFile?: boolean+}) {+ const { identityScopeKey } = useAppConnection()+ const { t } = useTranslation('compile')+ const {+ data: entry,+ isFetching,+ isError,+ refetch,+ } = useQuery({+ queryKey: ['compile-context-stat', identityScopeKey, uri],+ queryFn: () => fetchFsStat(uri, { throwOnError: true }),+ enabled: resolveFile,+ staleTime: 30_000,+ retry: false,+ })+ const linkClassName = cn(+ 'rounded-sm text-foreground/80 transition-colors underline-offset-4 hover:text-primary hover:underline focus-visible:outline-2 focus-visible:outline-ring [overflow-wrap:anywhere]',+ className,+ )+ if (resolveFile && !entry) {+ const canRetry = isError && !isFetching+ return (+ <button+ type="button"+ disabled={!canRetry}+ aria-busy={isFetching}+ aria-label={canRetry ? `${t('retry')}: ${uri}` : undefined}+ title={`${uri}: ${t(canRetry ? 'failedLoad' : 'loading')}`}+ className={cn(linkClassName, 'text-left disabled:opacity-60')}+ onClick={() => void refetch()}+ >+ {children ?? contextName(uri)}+ {canRetry && <span className="text-xs"> {t('retry')}</span>}+ </button>+ )+ }+ return (+ <Link+ to="/playground"+ search={+ entry && !entry.isDir ? { uri: parentUri(uri), file: uri } : { uri }+ }+ title={uri}+ className={linkClassName}+ >+ {children ?? contextName(uri)}+ </Link>+ )+}diff --git a/web-studio/src/routes/compile/index.tsx b/web-studio/src/routes/compile/index.tsxindex b34c27e82..68b5227b6 100644--- a/web-studio/src/routes/compile/index.tsx+++ b/web-studio/src/routes/compile/index.tsx@@ -25,6 +25,7 @@ import {CompileShell,CompileStatus,} from './-components/shared'+import { ContextLink, useCompileSkillName } from './-components/context-link'import { fetchCapabilities, fetchCompileTasks } from './-lib/api'const STATUSES = [@@ -48,6 +49,7 @@ export const Route = createFileRoute('/compile/')({function CompileList() {const { t, i18n } = useTranslation('compile')const { identityScopeKey } = useAppConnection()+ const skillName = useCompileSkillName()const location = useLocation()const search = Route.useSearch(),navigate = useNavigate()@@ -181,86 +183,98 @@ function CompileList() {)}{!!tasks.length && (<div className="overflow-hidden rounded-xl border">- <div className="hidden grid-cols-[minmax(0,2fr)_minmax(0,1.4fr)_minmax(0,1fr)_150px_16px] gap-5 border-b bg-muted/30 px-5 py-3 text-xs font-medium text-muted-foreground lg:grid">- <span>{t('task')}</span>+ <div className="hidden grid-cols-[180px_minmax(0,1fr)_minmax(0,1.2fr)_minmax(0,1.2fr)_100px_110px] gap-5 border-b bg-muted/15 px-5 py-3 text-xs font-medium text-muted-foreground xl:grid">+ <span>{t('taskId')}</span>+ <span>{t('skillColumn')}</span><span>{t('materials')}</span>+ <span>{t('outputDirectory')}</span><span>{t('status')}</span><span>{t('createdAt')}</span>- <span /></div>{tasks.map((task) => {const request = task.meta?.request- const leaf = (uri: string) =>- uri.split('/').filter(Boolean).pop() || uriconst date = task.created_at? new Date(Number(task.created_at) * 1000): nullreturn (- <Link+ <divkey={task.task_id}- to="/compile/tasks/$taskId"- params={{ taskId: task.task_id }}- state={{- compileListOrigin: {- scope: identityScopeKey,- index: location.state.__TSR_index,- search,- },- }}- className="group grid gap-4 border-b bg-card px-5 py-5 transition-colors last:border-b-0 hover:bg-muted/30 focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-[-2px] lg:grid-cols-[minmax(0,2fr)_minmax(0,1.4fr)_minmax(0,1fr)_150px_16px] lg:items-center lg:gap-5"+ className="grid gap-4 border-b bg-card/40 px-5 py-4 transition-colors last:border-b-0 hover:bg-muted/30 xl:grid-cols-[180px_minmax(0,1fr)_minmax(0,1.2fr)_minmax(0,1.2fr)_100px_110px] xl:items-start xl:gap-5"><div className="min-w-0 space-y-2">- <p- className="break-words text-sm font-semibold [overflow-wrap:anywhere]"- title={request?.skill}- >- {request ? leaf(request.skill) : t('title')}+ <p className="text-xs text-muted-foreground xl:hidden">+ {t('taskId')}</p>- <div- className="flex items-start gap-2 text-xs text-muted-foreground"- title={request?.to}+ <Link+ to="/compile/tasks/$taskId"+ params={{ taskId: task.task_id }}+ state={{+ compileListOrigin: {+ scope: identityScopeKey,+ index: location.state.__TSR_index,+ search,+ },+ }}+ aria-label={`${t('detailTitle')}: ${task.task_id}`}+ title={`${t('detailTitle')}: ${task.task_id}`}+ className="group inline-flex min-w-0 items-center gap-1 rounded-sm py-0.5 text-xs font-medium text-foreground transition-colors hover:text-primary focus-visible:outline-2 focus-visible:outline-ring">- <FolderOutput className="mt-0.5 size-3.5 shrink-0" />- <span className="min-w-0 break-words [overflow-wrap:anywhere]">- {request ? leaf(request.to) : '—'}+ <span className="truncate font-mono">+ {task.task_id.length > 22+ ? `${task.task_id.slice(0, 10)}…${task.task_id.slice(-6)}`+ : task.task_id}</span>- </div>+ <ChevronRight className="size-3.5 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5" />+ </Link>+ </div>+ <div className="min-w-0 space-y-2">+ <p className="text-xs text-muted-foreground xl:hidden">+ {t('skillColumn')}+ </p><p- className="font-mono text-[11px] text-muted-foreground/70"- title={task.task_id}+ className="break-words text-sm font-medium [overflow-wrap:anywhere]"+ title={request?.skill}>- {task.task_id.length > 24- ? `${task.task_id.slice(0, 12)}…${task.task_id.slice(-6)}`- : task.task_id}+ {request ? (+ <ContextLink uri={request.skill}>+ {skillName(request.skill)}+ </ContextLink>+ ) : (+ '—'+ )}</p></div><div className="min-w-0 space-y-2">- <p className="text-xs text-muted-foreground lg:hidden">+ <p className="text-xs text-muted-foreground xl:hidden">{t('materials')}</p>{request?.from.length- ? request.from.slice(0, 2).map((uri) => (+ ? request.from.map((uri) => (<divkey={uri}title={uri}- className="flex items-start gap-2 text-xs leading-5 text-muted-foreground"+ className="flex items-start gap-2 text-sm leading-5">- <FolderInput className="mt-0.5 size-3.5 shrink-0" />+ <FolderInput className="mt-0.5 size-3.5 shrink-0 text-muted-foreground/60" /><span className="min-w-0 break-words [overflow-wrap:anywhere]">- {leaf(uri)}+ <ContextLink uri={uri} resolveFile /></span></div>)): '—'}- {request && request.from.length > 2 && (- <p className="text-xs text-muted-foreground">- {t('moreSources', { count: request.from.length - 2 })}- </p>- )}+ </div>+ <div className="min-w-0 space-y-2">+ <p className="text-xs text-muted-foreground xl:hidden">+ {t('outputDirectory')}+ </p>+ <div className="flex items-start gap-2 text-sm leading-5">+ <FolderOutput className="mt-0.5 size-3.5 shrink-0 text-muted-foreground/60" />+ {request ? <ContextLink uri={request.to} /> : '—'}+ </div></div><div className="min-w-0 space-y-2"><CompileStatus status={task.status} />- {task.stage && (+ {task.stage && task.status !== 'completed' && (<pclassName="break-words text-xs text-muted-foreground"title={task.stage}@@ -288,8 +302,7 @@ function CompileList() {'—')}</time>- <ChevronRight className="hidden size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 lg:block" />- </Link>+ </div>)})}</div>diff --git a/web-studio/src/routes/compile/tasks/$taskId.tsx b/web-studio/src/routes/compile/tasks/$taskId.tsxindex 666a95743..f6bb62208 100644--- a/web-studio/src/routes/compile/tasks/$taskId.tsx+++ b/web-studio/src/routes/compile/tasks/$taskId.tsx@@ -19,6 +19,7 @@ import {CompileShell,CompileStatus,} from '../-components/shared'+import { ContextLink, useCompileSkillName } from '../-components/context-link'import { active, cancelCompile, fetchCompileTask } from '../-lib/api'const TABS = ['overview', 'events', 'result'] as const@@ -27,6 +28,7 @@ export const Route = createFileRoute('/compile/tasks/$taskId')({component: CompileDetail,})function CompileDetail() {+ const skillName = useCompileSkillName()const { taskId } = Route.useParams(),{ t, i18n } = useTranslation('compile')const { identityScopeKey, connectionRole } = useAppConnection(),@@ -185,7 +187,9 @@ function CompileDetail() {</dt><dd><p className="mb-2 break-all font-medium">- {request.skill.split('/').filter(Boolean).pop()}+ <ContextLink uri={request.skill}>+ {skillName(request.skill)}+ </ContextLink></p><p className="break-all font-mono text-xs text-muted-foreground">{request.skill}@@ -204,7 +208,7 @@ function CompileDetail() {{request.from.map((uri) => (<div key={uri}><p className="mb-1 break-all font-medium">- {uri.split('/').filter(Boolean).pop()}+ <ContextLink uri={uri} resolveFile /></p><p className="break-all font-mono text-xs leading-5 text-muted-foreground">{uri}@@ -220,7 +224,7 @@ function CompileDetail() {</dt><dd><p className="mb-1 break-all font-medium">- {request.to.split('/').filter(Boolean).pop()}+ <ContextLink uri={request.to} /></p><p className="break-all font-mono text-xs leading-5 text-muted-foreground">{request.to}diff --git a/web-studio/src/routes/vikingbot/-components/channels.tsx b/web-studio/src/routes/vikingbot/-components/channels.tsxindex a08bd1da8..9cf2447d1 100644--- a/web-studio/src/routes/vikingbot/-components/channels.tsx+++ b/web-studio/src/routes/vikingbot/-components/channels.tsx@@ -10,6 +10,7 @@ import {providers,upcomingProviders,} from '../-providers/registry'+import { PlatformIcon } from './platform-icon'import { DeleteConnection } from './delete-connection'import { useState } from 'react'import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'@@ -147,7 +148,10 @@ export function Channels({key={type}className="flex min-h-16 items-center justify-between gap-4 rounded-lg border px-4 py-3">- <h3 className="text-sm font-medium">{t(entry.label)}</h3>+ <div className="flex min-w-0 items-center gap-3">+ <PlatformIcon platform={type} />+ <h3 className="text-sm font-medium">{t(entry.label)}</h3>+ </div><Buttonsize="sm"disabled={!canManage}@@ -167,9 +171,12 @@ export function Channels({key={name}className="flex min-h-16 items-center justify-between gap-4 rounded-lg border px-4 py-3">- <h3 className="text-sm font-medium text-muted-foreground">- {name === 'DingTalk' ? t('dingtalk') : name}- </h3>+ <div className="flex min-w-0 items-center gap-3">+ <PlatformIcon platform={name} />+ <h3 className="text-sm font-medium text-muted-foreground">+ {name === 'DingTalk' ? t('dingtalk') : name}+ </h3>+ </div><span className="rounded-full bg-muted px-3 py-1 text-xs text-muted-foreground">{t('comingSoon')}</span>diff --git a/web-studio/src/routes/vikingbot/-components/platform-icon.tsx b/web-studio/src/routes/vikingbot/-components/platform-icon.tsxnew file mode 100644index 000000000..30fd9dfcd--- /dev/null+++ b/web-studio/src/routes/vikingbot/-components/platform-icon.tsx@@ -0,0 +1,29 @@+import {+ FeatherIcon,+ Gamepad2Icon,+ HashIcon,+ SendIcon,+ ZapIcon,+} from 'lucide-react'+import type { LucideIcon } from 'lucide-react'++const icons: Record<string, LucideIcon> = {+ feishu: FeatherIcon,+ slack: HashIcon,+ dingtalk: ZapIcon,+ discord: Gamepad2Icon,+ telegram: SendIcon,+}++export function PlatformIcon({ platform }: { platform: string }) {+ const Icon = icons[platform.toLowerCase()]+ if (!Icon) return null+ return (+ <span+ className="flex size-9 shrink-0 items-center justify-center rounded-lg bg-muted/50 text-muted-foreground"+ aria-hidden="true"+ >+ <Icon className="size-5" />+ </span>+ )+}diff --git a/web-studio/src/routes/vikingbot/index.tsx b/web-studio/src/routes/vikingbot/index.tsxindex b24cfb9e0..6941d67ed 100644--- a/web-studio/src/routes/vikingbot/index.tsx+++ b/web-studio/src/routes/vikingbot/index.tsx@@ -341,7 +341,7 @@ function VikingBotWorkspace({ scope }: { scope: string }) {{t('emptyHint')}</p><Button variant="outline" onClick={() => setTab('channels')}>- {t('addFeishu')}+ {t('manageBots')}</Button></div>)}diff --git a/web-studio/src/styles.css b/web-studio/src/styles.cssindex a0278b8e1..5c8cfa296 100644--- a/web-studio/src/styles.css+++ b/web-studio/src/styles.css@@ -96,37 +96,37 @@}.dark {- --background: oklch(0.2 0.005 243);- --foreground: oklch(0.985 0 0);- --card: oklch(0.26 0.005 243);- --card-foreground: oklch(0.985 0 0);- --popover: oklch(0.26 0.005 243);- --popover-foreground: oklch(0.985 0 0);- --primary: oklch(0.65 0.15 243);- --primary-foreground: oklch(0.15 0.01 243);- --secondary: oklch(0.3 0.005 243);- --secondary-foreground: oklch(0.985 0 0);- --muted: oklch(0.3 0.005 243);- --muted-foreground: oklch(0.708 0 0);- --accent: oklch(0.3 0.005 243);- --accent-foreground: oklch(0.985 0 0);+ --background: #2b2b2d;+ --foreground: #eeeeef;+ --card: #2f2f31;+ --card-foreground: #eeeeef;+ --popover: #303032;+ --popover-foreground: #eeeeef;+ --primary: #f4f4f5;+ --primary-foreground: #242426;+ --secondary: #363638;+ --secondary-foreground: #eeeeef;+ --muted: #353537;+ --muted-foreground: #ababaf;+ --accent: #3a3a3c;+ --accent-foreground: #f4f4f5;--destructive: oklch(0.704 0.191 22.216);- --border: oklch(1 0 0 / 10%);- --input: oklch(1 0 0 / 15%);- --ring: oklch(0.556 0 0);+ --border: #3e3e40;+ --input: #505053;+ --ring: #929296;--chart-1: oklch(0.65 0.12 210);--chart-2: oklch(0.6 0.13 225);--chart-3: oklch(0.55 0.14 243);--chart-4: oklch(0.5 0.13 260);--chart-5: oklch(0.45 0.11 280);- --sidebar: oklch(0.23 0.005 243);- --sidebar-foreground: oklch(0.985 0 0);- --sidebar-primary: oklch(0.65 0.15 243);- --sidebar-primary-foreground: oklch(0.985 0 0);- --sidebar-accent: oklch(0.3 0.005 243);- --sidebar-accent-foreground: oklch(0.985 0 0);- --sidebar-border: oklch(1 0 0 / 10%);- --sidebar-ring: oklch(0.556 0 0);+ --sidebar: #1e1e20;+ --sidebar-foreground: #dedee0;+ --sidebar-primary: #f4f4f5;+ --sidebar-primary-foreground: #242426;+ --sidebar-accent: #2b2b2d;+ --sidebar-accent-foreground: #f4f4f5;+ --sidebar-border: #333335;+ --sidebar-ring: #929296;--success: oklch(0.7 0.12 180);--success-foreground: oklch(0.15 0.01 180);--warning: oklch(0.75 0.14 75);