Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

refactor(studio): rename Playground to Filesystem (#5681)

z1gon771db59f884b
diff --git a/docs/en/context-compilation/01-overview.md b/docs/en/context-compilation/01-overview.md
index aaa256b0d..9782a11b6 100644
--- a/docs/en/context-compilation/01-overview.md
+++ b/docs/en/context-compilation/01-overview.md
@@ -30,7 +30,7 @@ The command returns a `cmp_...` task ID immediately. Use `ov task status <id>` t
## Use Web Studio
-Studio provides a Compile list at `/compile`, a form at `/compile/new`, and task details at `/compile/tasks/<task_id>`. Select and preview a Skill, browse source directories, submit multiple sources, inspect or cancel a task, and open its output directory. Playground's terminal also supports `compile` and `task`; it can hand parameters to the form.
+Studio provides a Compile list at `/compile`, a form at `/compile/new`, and task details at `/compile/tasks/<task_id>`. Select and preview a Skill, browse source directories, submit multiple sources, inspect or cancel a task, and open its output directory. The Filesystem terminal also supports `compile` and `task`; it can hand parameters to the form.
Task-list cursors are signed with a process-local key and bound to the caller and filters. Restarting the service invalidates old cursors; refresh the list to start again. A cursor from one replica is not portable to another. Pagination scans stored task records rather than using an index, so read cost grows with retained history.
diff --git a/docs/zh/context-compilation/01-overview.md b/docs/zh/context-compilation/01-overview.md
index 39f6ea743..8161ff2b1 100644
--- a/docs/zh/context-compilation/01-overview.md
+++ b/docs/zh/context-compilation/01-overview.md
@@ -30,7 +30,7 @@ ov compile \
## 使用 Web Studio
-Studio 提供 `/compile` 列表、`/compile/new` 新建表单和 `/compile/tasks/<task_id>` 任务详情页。可以选择并预览 Skill、浏览来源目录、提交多个来源、查看或取消任务,以及打开产物目录。Playground 终端也支持 `compile` 和 `task`,并可将参数带入表单。
+Studio 提供 `/compile` 列表、`/compile/new` 新建表单和 `/compile/tasks/<task_id>` 任务详情页。可以选择并预览 Skill、浏览来源目录、提交多个来源、查看或取消任务,以及打开产物目录。文件系统终端也支持 `compile` 和 `task`,并可将参数带入表单。
任务列表游标使用进程内密钥签名,并绑定调用者和筛选条件。服务重启后旧游标失效,刷新列表即可重新开始。一个副本签发的游标不能直接用于另一个副本。分页扫描已存储的任务记录,不依赖索引,读取成本仍随保留的历史数量增长。
diff --git a/web-studio/README.md b/web-studio/README.md
index df2560a54..75df1825e 100644
--- a/web-studio/README.md
+++ b/web-studio/README.md
@@ -87,6 +87,12 @@ VITE_OV_BASE_URL=http://127.0.0.1:1933 npm run dev
The connection dialog can still override the server URL, API key, account ID, and user ID at runtime.
+### Filesystem Page
+
+Open `/filesystem` to browse and preview context, run terminal commands, or use the Agent panel. When Studio is served under `/studio`, the URL is `/studio/filesystem`.
+
+The former `/playground` route redirects to `/filesystem`, preserving the selected file, directory, panel, session, and URL fragment. Existing browser-stored layout and history remain available.
+
## Connection and Auth
Application code should use the adapter under `src/lib/ov-client` instead of importing from `src/gen/ov-client` directly. The adapter centralizes base URL handling, auth headers, telemetry defaults, and error normalization.
diff --git a/web-studio/README_CN.md b/web-studio/README_CN.md
index d82c3af4a..8270223c3 100644
--- a/web-studio/README_CN.md
+++ b/web-studio/README_CN.md
@@ -87,6 +87,12 @@ VITE_OV_BASE_URL=http://127.0.0.1:1933 npm run dev
连接弹窗仍可以在运行时覆盖 server URL、API key、account ID 和 user ID。
+### 文件系统页面
+
+打开 `/filesystem` 可浏览和预览上下文、运行终端命令或使用 Agent 面板。Studio 部署在 `/studio` 下时,页面地址为 `/studio/filesystem`。
+
+原 `/playground` 地址会重定向至 `/filesystem`,并保留选中的文件、目录、面板、会话和 URL 片段。浏览器中已有的布局和历史记录仍可使用。
+
## 连接与鉴权
业务代码应使用 `src/lib/ov-client` 下的适配层,而不是直接从 `src/gen/ov-client` 导入。适配层集中处理 base URL、鉴权头、telemetry 默认值和错误归一化。
diff --git a/web-studio/src/components/app-shell.tsx b/web-studio/src/components/app-shell.tsx
index 90dab39fd..30d4b8d6f 100644
--- a/web-studio/src/components/app-shell.tsx
+++ b/web-studio/src/components/app-shell.tsx
@@ -94,10 +94,10 @@ const NAV_ITEMS: readonly NavItem[] = [
},
{
icon: PanelsTopLeftIcon,
- id: 'playground',
+ id: 'filesystem',
section: 'workspace',
- titleKey: 'navigation.playground.title',
- to: '/playground',
+ titleKey: 'navigation.filesystem.title',
+ to: '/filesystem',
},
{
icon: BotIcon,
diff --git a/web-studio/src/hooks/use-app-connection.tsx b/web-studio/src/hooks/use-app-connection.tsx
index 40b1c9356..4304d50c3 100644
--- a/web-studio/src/hooks/use-app-connection.tsx
+++ b/web-studio/src/hooks/use-app-connection.tsx
@@ -740,11 +740,11 @@ export function AppConnectionProvider({
throw createConnectionError('credentialMismatch')
}
- if (pathname === '/playground') {
+ if (pathname === '/filesystem') {
await navigate({
replace: true,
search: { upload: false },
- to: '/playground',
+ to: '/filesystem',
})
}
commitConnection({
diff --git a/web-studio/src/i18n/locales/en/activity.ts b/web-studio/src/i18n/locales/en/activity.ts
index 32cc1efa7..a7ce0d136 100644
--- a/web-studio/src/i18n/locales/en/activity.ts
+++ b/web-studio/src/i18n/locales/en/activity.ts
@@ -138,11 +138,11 @@ const activity = {
'Sign in to OpenViking Studio (Connection & Identity) or paste an API key below to verify.',
},
},
- playground: {
+ filesystem: {
copyUri: 'Copy current URI',
copied: 'URI copied',
copyFailed: 'Copy failed',
- resizeContext: 'Resize context tree width',
+ resizeContext: 'Resize filesystem width',
resizeAction: 'Resize Terminal and Agent width',
readFailed: 'Failed to read {{uri}}',
tabs: {
@@ -156,11 +156,11 @@ const activity = {
addResource: {
title: 'Add resource',
description:
- 'After it finishes, the context tree on the left refreshes and the Terminal on the right can locate the new resource.',
+ 'After it finishes, the filesystem on the left refreshes and the Terminal on the right can locate the new resource.',
submitted: 'Resource add task submitted',
},
explorer: {
- title: 'Context tree',
+ title: 'Filesystem',
addResource: 'Add resource',
abstractLevel: 'L0',
collapseDirectory: 'Collapse {{name}}',
@@ -179,7 +179,7 @@ const activity = {
agent: {
history: 'Session history',
newSession: 'New session',
- creating: 'Creating Playground session...',
+ creating: 'Creating Filesystem session...',
detectingBot: 'Detecting bot mode...',
createFailed: 'Failed to create session: {{error}}',
retry: 'Retry',
@@ -190,8 +190,8 @@ const activity = {
loadingSessions: 'Loading sessions...',
noSessions: 'No session history yet',
createTimeout:
- 'Creating the Playground session timed out. Check your connection settings and try again.',
- newSessionTitle: 'New Playground session',
+ 'Creating the Filesystem session timed out. Check your connection settings and try again.',
+ newSessionTitle: 'New Filesystem session',
botPrompt: {
title: 'Please enable bot mode',
description:
@@ -216,7 +216,7 @@ const activity = {
historyDescription: 'Review commands run in this browser.',
clearHistory: 'Clear command history',
noHistory: 'No command history',
- welcomeTitle: 'Terminal connected to the context tree',
+ welcomeTitle: 'Terminal connected to the filesystem',
welcomeBody:
'Run /status, /ls, /search, /read, /add-resource. /search is global by default; add --scope . to use the current directory, or --scope viking://resources/... to limit it to a directory.',
scopeLabel: 'cwd: {{uri}}',
diff --git a/web-studio/src/i18n/locales/en/resources.ts b/web-studio/src/i18n/locales/en/resources.ts
index a4f97e970..ae5e3c794 100644
--- a/web-studio/src/i18n/locales/en/resources.ts
+++ b/web-studio/src/i18n/locales/en/resources.ts
@@ -37,7 +37,7 @@ const resources = {
description: 'Failed to load audited request logs from the server.',
title: 'Request failed',
},
- eyebrow: 'Playground telemetry',
+ eyebrow: 'Server API telemetry',
filters: {
all: 'All logs',
apiTypePlaceholder: 'API type',
@@ -547,7 +547,7 @@ const resources = {
detail: {
score: 'Score',
level: 'Level',
- openPlayground: 'Open in Playground',
+ openFilesystem: 'Open in Filesystem',
uri: 'URI',
summary: 'Summary',
noSummary: 'No summary available',
diff --git a/web-studio/src/i18n/locales/en/workspace.ts b/web-studio/src/i18n/locales/en/workspace.ts
index 9eb30451d..12e8c613f 100644
--- a/web-studio/src/i18n/locales/en/workspace.ts
+++ b/web-studio/src/i18n/locales/en/workspace.ts
@@ -64,8 +64,8 @@ const workspace = {
sessions: {
title: 'Sessions',
},
- playground: {
- title: 'Playground',
+ filesystem: {
+ title: 'Filesystem',
},
},
sidebar: {
@@ -287,7 +287,7 @@ const workspace = {
detail: {
back: 'Back',
copyUri: 'Copy URI',
- openPlayground: 'Open in Workbench',
+ openFilesystem: 'Open in Filesystem',
copied: 'Copied',
copyFailed: 'Copy failed',
contentTitle: 'Experience content',
@@ -359,7 +359,7 @@ const workspace = {
'Could not connect to the OpenViking service. Check the server URL and connection status.',
connectionSettings: 'Open connection settings',
detail: 'Details',
- openPlayground: 'Open in Playground',
+ openFilesystem: 'Open in Filesystem',
viewDetail: 'View {{name}} details',
detailLoading: 'Loading skill details...',
detailLoadFailed: 'Could not load skill details',
@@ -1030,14 +1030,14 @@ const workspace = {
keyGuide: {
control: {
primary:
- 'Your User API Key already enables the Playground and data access. Regular users do not need a control credential.',
+ 'Your User API Key already enables the Filesystem and data access. Regular users do not need a control credential.',
secondary:
'To switch Accounts or manage users, request a Root Key from the deployment admin or an Admin Key from the current Account admin. The Root Key is stored at server.root_api_key in the server-side ov.conf.',
title: 'Need to manage Accounts or users?',
},
data: {
primary:
- 'The Root/Admin API Key is mainly for management. The Playground and tenant data APIs require a User API Key bound to a user identity.',
+ 'The Root/Admin API Key is mainly for management. The Filesystem and tenant data APIs require a User API Key bound to a user identity.',
secondary:
'Select or create a user in Users & Permissions, or regenerate its key, then use it as the User API Key.',
title: 'A User API Key is still required',
@@ -1066,7 +1066,7 @@ const workspace = {
primary: 'This server is configured with {{mode}} authentication.',
title: 'Unsupported authentication mode',
},
- userHint: 'Used by the Playground and tenant data APIs.',
+ userHint: 'Used by the Filesystem and tenant data APIs.',
},
connectionPage: {
description:
@@ -1178,9 +1178,9 @@ const workspace = {
description:
'Review users and credentials for selected accounts, then add users or rotate keys from the web UI.',
memberListDescription:
- '"Switch identity" uses that user for data pages such as Playground and Retrieval without changing the active Root/Admin management credential.',
+ '"Switch identity" uses that user for data pages such as Filesystem and Retrieval without changing the active Root/Admin management credential.',
memberListDescriptionRoot:
- 'You can change member roles here. "Switch identity" only changes the user used by data pages such as Playground and Retrieval; it does not change the active Root management credential.',
+ 'You can change member roles here. "Switch identity" only changes the user used by data pages such as Filesystem and Retrieval; it does not change the active Root management credential.',
memberListTitle: 'Workspace members',
cannotRemoveCurrentIdentity: 'The active identity cannot be deleted.',
cannotRemoveLastManager:
diff --git a/web-studio/src/i18n/locales/zh-CN/activity.ts b/web-studio/src/i18n/locales/zh-CN/activity.ts
index 52ad13460..20c170a25 100644
--- a/web-studio/src/i18n/locales/zh-CN/activity.ts
+++ b/web-studio/src/i18n/locales/zh-CN/activity.ts
@@ -131,11 +131,11 @@ const activity = {
'请先在“连接设置”中配置 OpenViking Studio 身份凭证,或在下方临时粘贴 API 密钥完成验证。',
},
},
- playground: {
+ filesystem: {
copyUri: '复制当前 URI',
copied: '已复制 URI',
copyFailed: '复制失败',
- resizeContext: '调整上下文树宽度',
+ resizeContext: '调整文件系统宽度',
resizeAction: '调整终端和 Agent 面板宽度',
readFailed: '无法读取 {{uri}}',
tabs: {
@@ -148,11 +148,11 @@ const activity = {
},
addResource: {
title: '添加资源',
- description: '添加完成后左侧上下文树会刷新,右侧终端可继续定位新资源。',
+ description: '添加完成后左侧文件系统会刷新,右侧终端可继续定位新资源。',
submitted: '资源添加任务已提交',
},
explorer: {
- title: '上下文树',
+ title: '文件系统',
addResource: '添加资源',
abstractLevel: 'L0',
collapseDirectory: '收起 {{name}}',
@@ -161,7 +161,7 @@ const activity = {
loading: '加载中',
overviewLevel: 'L1',
search: '搜索上下文',
- refresh: '刷新上下文树',
+ refresh: '刷新文件系统',
namespaces: {
agent: 'Agent 的能力、工具和经验',
user: '用户个性化记忆',
@@ -171,18 +171,18 @@ const activity = {
agent: {
history: '历史会话',
newSession: '新建会话',
- creating: '正在创建工作台会话...',
+ creating: '正在创建文件系统会话...',
detectingBot: '正在检查 VikingBot 是否可用...',
createFailed: '创建会话失败:{{error}}',
retry: '重试',
botDisabledFooter: '启用 VikingBot 后即可与 Agent 对话',
historyTitle: 'Agent 会话历史',
historyDescription:
- '工作台与 VikingBot 共用对话记录,也包含当前浏览器保存的旧 Agent 会话。',
+ '文件系统与 VikingBot 共用对话记录,也包含当前浏览器保存的旧 Agent 会话。',
loadingSessions: '正在加载会话...',
noSessions: '暂无历史会话',
- createTimeout: '创建工作台会话超时,请检查连接设置后重试。',
- newSessionTitle: '新建工作台会话',
+ createTimeout: '创建文件系统会话超时,请检查连接设置后重试。',
+ newSessionTitle: '新建文件系统会话',
botPrompt: {
title: '请启用 VikingBot',
description:
@@ -207,7 +207,7 @@ const activity = {
historyDescription: '查看当前浏览器中执行过的命令。',
clearHistory: '清空命令历史',
noHistory: '暂无命令历史',
- welcomeTitle: '终端已连接上下文树',
+ welcomeTitle: '终端已连接文件系统',
welcomeBody:
'可执行 /status、/ls、/search、/read、/add-resource。/search 默认全局检索,可通过 --scope . 使用当前目录,或通过 --scope viking://resources/... 指定目录。',
scopeLabel: '目录:{{uri}}',
diff --git a/web-studio/src/i18n/locales/zh-CN/resources.ts b/web-studio/src/i18n/locales/zh-CN/resources.ts
index 236f3a4c9..cacaa90ca 100644
--- a/web-studio/src/i18n/locales/zh-CN/resources.ts
+++ b/web-studio/src/i18n/locales/zh-CN/resources.ts
@@ -35,7 +35,7 @@ const resources = {
description: '无法从服务端加载审计请求日志。',
title: '请求失败',
},
- eyebrow: '工作台请求记录',
+ eyebrow: '服务端 API 请求记录',
filters: {
all: '所有日志',
apiTypePlaceholder: 'API 类型',
@@ -526,7 +526,7 @@ const resources = {
detail: {
score: '相关度',
level: '层级',
- openPlayground: '在工作台中打开',
+ openFilesystem: '在文件系统中打开',
uri: 'URI',
summary: '摘要',
noSummary: '暂无可展示的摘要',
diff --git a/web-studio/src/i18n/locales/zh-CN/workspace.ts b/web-studio/src/i18n/locales/zh-CN/workspace.ts
index 343e2c3cb..05bcb9643 100644
--- a/web-studio/src/i18n/locales/zh-CN/workspace.ts
+++ b/web-studio/src/i18n/locales/zh-CN/workspace.ts
@@ -64,8 +64,8 @@ const workspace = {
sessions: {
title: '会话',
},
- playground: {
- title: '工作台',
+ filesystem: {
+ title: '文件系统',
},
},
sidebar: {
@@ -283,7 +283,7 @@ const workspace = {
detail: {
back: '返回',
copyUri: '复制 URI',
- openPlayground: '在工作台中打开',
+ openFilesystem: '在文件系统中打开',
copied: '已复制',
copyFailed: '复制失败',
contentTitle: '经验内容',
@@ -349,7 +349,7 @@ const workspace = {
networkError: '无法连接 OpenViking 服务,请检查服务地址和连接状态。',
connectionSettings: '打开连接设置',
detail: '详情',
- openPlayground: '在工作台中打开',
+ openFilesystem: '在文件系统中打开',
viewDetail: '查看 {{name}} 详情',
detailLoading: '正在加载技能详情...',
detailLoadFailed: '技能详情加载失败',
@@ -985,14 +985,14 @@ const workspace = {
keyGuide: {
control: {
primary:
- '当前用户 API 密钥已可用于工作台和数据访问,普通用户无需配置控制凭证。',
+ '当前用户 API 密钥已可用于文件系统和数据访问,普通用户无需配置控制凭证。',
secondary:
'如需切换账号或管理用户,请向部署管理员索取 Root API 密钥,或向当前账号管理员索取管理员 API 密钥。Root API 密钥位于服务端 ov.conf 的 server.root_api_key。',
title: '需要管理账号或用户?',
},
data: {
primary:
- 'Root 或管理员 API 密钥主要用于管理操作;工作台和租户数据 API 需要绑定用户身份的用户 API 密钥。',
+ 'Root 或管理员 API 密钥主要用于管理操作;文件系统和租户数据 API 需要绑定用户身份的用户 API 密钥。',
secondary:
'请在“用户与权限”中选择或创建用户,或者重新生成用户密钥,然后将其用作用户 API 密钥。',
title: '还缺少用户 API 密钥',
@@ -1020,7 +1020,7 @@ const workspace = {
primary: '该服务器配置了 {{mode}} 认证。',
title: '不支持的认证模式',
},
- userHint: '供工作台和租户数据 API 使用。',
+ userHint: '供文件系统和租户数据 API 使用。',
},
connectionPage: {
description: '配置 OpenViking 服务连接、控制面凭证和当前数据访问凭证。',
@@ -1127,9 +1127,9 @@ const workspace = {
currentAccountDescription: '管理当前账号的用户和访问凭证。',
description: '查看选中账号下的用户和凭证,并在网页端新增用户或轮换密钥。',
memberListDescription:
- '“切换身份”会将该用户设为工作台、检索等数据页面的访问身份,不会改变当前 Root 或管理员凭证。',
+ '“切换身份”会将该用户设为文件系统、检索等数据页面的访问身份,不会改变当前 Root 或管理员凭证。',
memberListDescriptionRoot:
- '可直接修改成员角色。“切换身份”只会改变工作台、检索等数据页面的访问身份,不会改变当前 Root 管理凭证。',
+ '可直接修改成员角色。“切换身份”只会改变文件系统、检索等数据页面的访问身份,不会改变当前 Root 管理凭证。',
memberListTitle: '空间成员',
cannotRemoveCurrentIdentity: '不能删除当前正在使用的身份。',
cannotRemoveLastManager: '不能删除空间内最后一个管理员。',
diff --git a/web-studio/src/lib/sessions/use-default-conversation-titles.test.tsx b/web-studio/src/lib/sessions/use-default-conversation-titles.test.tsx
index 62100d668..17ea71641 100644
--- a/web-studio/src/lib/sessions/use-default-conversation-titles.test.tsx
+++ b/web-studio/src/lib/sessions/use-default-conversation-titles.test.tsx
@@ -8,7 +8,12 @@ const mocks = vi.hoisted(() => ({ fetch: vi.fn(), save: vi.fn() }))
vi.mock('./api', () => ({ fetchSessionFirstTitle: mocks.fetch }))
vi.mock('./use-session-titles', () => ({
useSessionTitles: () => ({
- getTitle: (id: string) => (id === 'custom' ? 'My title' : id),
+ getTitle: (id: string) =>
+ id === 'custom'
+ ? 'My title'
+ : id === 'filesystem-draft'
+ ? '新建文件系统会话'
+ : id,
setTitle: mocks.save,
}),
}))
@@ -20,7 +25,12 @@ it('backfills the first user text without fetching or replacing a custom title',
mocks.fetch.mockResolvedValue('First question')
const client = new QueryClient()
renderHook(
- () => useDefaultConversationTitles('account', ['missing', 'custom']),
+ () =>
+ useDefaultConversationTitles('account', [
+ 'missing',
+ 'filesystem-draft',
+ 'custom',
+ ]),
{
wrapper: ({ children }) => (
<QueryClientProvider client={client}>{children}</QueryClientProvider>
@@ -30,5 +40,13 @@ it('backfills the first user text without fetching or replacing a custom title',
await waitFor(() =>
expect(mocks.save).toHaveBeenCalledWith('missing', 'First question'),
)
- expect(mocks.fetch).toHaveBeenCalledExactlyOnceWith('missing')
+ await waitFor(() =>
+ expect(mocks.save).toHaveBeenCalledWith(
+ 'filesystem-draft',
+ 'First question',
+ ),
+ )
+ expect(mocks.fetch).toHaveBeenCalledWith('missing')
+ expect(mocks.fetch).toHaveBeenCalledWith('filesystem-draft')
+ expect(mocks.fetch).toHaveBeenCalledTimes(2)
})
diff --git a/web-studio/src/lib/sessions/use-default-conversation-titles.ts b/web-studio/src/lib/sessions/use-default-conversation-titles.ts
index a8813224a..4484935c2 100644
--- a/web-studio/src/lib/sessions/use-default-conversation-titles.ts
+++ b/web-studio/src/lib/sessions/use-default-conversation-titles.ts
@@ -6,6 +6,7 @@ import { useSessionTitles } from './use-session-titles'
const PLACEHOLDERS = new Set([
'新建对话',
'新建工作台会话',
+ '新建文件系统会话',
'New conversation',
'New session',
])
diff --git a/web-studio/src/lib/sessions/vikingbot-sessions.ts b/web-studio/src/lib/sessions/vikingbot-sessions.ts
index fd1794e47..f9f900647 100644
--- a/web-studio/src/lib/sessions/vikingbot-sessions.ts
+++ b/web-studio/src/lib/sessions/vikingbot-sessions.ts
@@ -1,7 +1,7 @@
import { createRandomUuid } from '#/lib/browser-crypto'
// Persist ownership in the session ID: the generic session API has no source field.
-// Legacy IDs are accepted only from the identity-scoped Playground Agent history.
+// Legacy IDs are accepted only from the identity-scoped Filesystem Agent history.
const WEB_SESSION_PREFIX = 'vikingbot-web-'
const WEB_SESSION_PATTERN =
/^vikingbot-web-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
@@ -12,10 +12,10 @@ export function createVikingBotWebSessionId() {
export function isVikingBotWebSession(
session: { session_id: string },
- legacyPlaygroundIds: readonly string[] = [],
+ legacyFilesystemIds: readonly string[] = [],
) {
return (
WEB_SESSION_PATTERN.test(session.session_id) ||
- legacyPlaygroundIds.includes(session.session_id)
+ legacyFilesystemIds.includes(session.session_id)
)
}
diff --git a/web-studio/src/lib/viking-uri.ts b/web-studio/src/lib/viking-uri.ts
index c043653d9..49bed53cd 100644
--- a/web-studio/src/lib/viking-uri.ts
+++ b/web-studio/src/lib/viking-uri.ts
@@ -76,7 +76,7 @@ export function joinUri(baseUri: string, child: string): string {
/**
* Matches `viking://` URIs inside arbitrary text. Stops at whitespace, quotes,
* brackets and the punctuation that commonly trails a URI in prose. Shared so
- * the sessions view and the playground extract URIs identically.
+ * the sessions view and the filesystem extract URIs identically.
*/
export const VIKING_URI_RE = /viking:\/\/[^\s,,。;;'"`<>()\]}\\]+/g
diff --git a/web-studio/src/routeTree.gen.ts b/web-studio/src/routeTree.gen.ts
index d26d418db..916db1891 100644
--- a/web-studio/src/routeTree.gen.ts
+++ b/web-studio/src/routeTree.gen.ts
@@ -9,6 +9,7 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
+import { Route as PlaygroundRouteImport } from './routes/playground'
import { Route as WatchesRouteRouteImport } from './routes/watches/route'
import { Route as VikingbotRouteRouteImport } from './routes/vikingbot/route'
import { Route as UsersRouteRouteImport } from './routes/users/route'
@@ -18,10 +19,10 @@ import { Route as SettingsRouteRouteImport } from './routes/settings/route'
import { Route as SessionsRouteRouteImport } from './routes/sessions/route'
import { Route as RetrievalRouteRouteImport } from './routes/retrieval/route'
import { Route as RequestLogsRouteRouteImport } from './routes/request-logs/route'
-import { Route as PlaygroundRouteRouteImport } from './routes/playground/route'
import { Route as PermissionsRouteRouteImport } from './routes/permissions/route'
import { Route as MonitoringRouteRouteImport } from './routes/monitoring/route'
import { Route as HomeRouteRouteImport } from './routes/home/route'
+import { Route as FilesystemRouteRouteImport } from './routes/filesystem/route'
import { Route as AgentExperienceRouteRouteImport } from './routes/agent-experience/route'
import { Route as IndexRouteImport } from './routes/index'
import { Route as VikingbotIndexRouteImport } from './routes/vikingbot/index'
@@ -38,6 +39,11 @@ import { Route as CompileNewRouteImport } from './routes/compile/new'
import { Route as AgentExperienceExperienceUriRouteImport } from './routes/agent-experience/$experienceUri'
import { Route as CompileTasksTaskIdRouteImport } from './routes/compile/tasks/$taskId'
+const PlaygroundRoute = PlaygroundRouteImport.update({
+ id: '/playground',
+ path: '/playground',
+ getParentRoute: () => rootRouteImport,
+} as any)
const WatchesRouteRoute = WatchesRouteRouteImport.update({
id: '/watches',
path: '/watches',
@@ -83,11 +89,6 @@ const RequestLogsRouteRoute = RequestLogsRouteRouteImport.update({
path: '/request-logs',
getParentRoute: () => rootRouteImport,
} as any)
-const PlaygroundRouteRoute = PlaygroundRouteRouteImport.update({
- id: '/playground',
- path: '/playground',
- getParentRoute: () => rootRouteImport,
-} as any)
const PermissionsRouteRoute = PermissionsRouteRouteImport.update({
id: '/permissions',
path: '/permissions',
@@ -103,6 +104,11 @@ const HomeRouteRoute = HomeRouteRouteImport.update({
path: '/home',
getParentRoute: () => rootRouteImport,
} as any)
+const FilesystemRouteRoute = FilesystemRouteRouteImport.update({
+ id: '/filesystem',
+ path: '/filesystem',
+ getParentRoute: () => rootRouteImport,
+} as any)
const AgentExperienceRouteRoute = AgentExperienceRouteRouteImport.update({
id: '/agent-experience',
path: '/agent-experience',
@@ -183,10 +189,10 @@ const CompileTasksTaskIdRoute = CompileTasksTaskIdRouteImport.update({
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
'/agent-experience': typeof AgentExperienceRouteRouteWithChildren
+ '/filesystem': typeof FilesystemRouteRoute
'/home': typeof HomeRouteRoute
'/monitoring': typeof MonitoringRouteRoute
'/permissions': typeof PermissionsRouteRoute
- '/playground': typeof PlaygroundRouteRoute
'/request-logs': typeof RequestLogsRouteRoute
'/retrieval': typeof RetrievalRouteRoute
'/sessions': typeof SessionsRouteRouteWithChildren
@@ -196,6 +202,7 @@ export interface FileRoutesByFullPath {
'/users': typeof UsersRouteRouteWithChildren
'/vikingbot': typeof VikingbotRouteRouteWithChildren
'/watches': typeof WatchesRouteRoute
+ '/playground': typeof PlaygroundRoute
'/agent-experience/$experienceUri': typeof AgentExperienceExperienceUriRoute
'/compile/new': typeof CompileNewRoute
'/oauth/consent': typeof OauthConsentRoute
@@ -212,16 +219,17 @@ export interface FileRoutesByFullPath {
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
+ '/filesystem': typeof FilesystemRouteRoute
'/home': typeof HomeRouteRoute
'/monitoring': typeof MonitoringRouteRoute
'/permissions': typeof PermissionsRouteRoute
- '/playground': typeof PlaygroundRouteRoute
'/request-logs': typeof RequestLogsRouteRoute
'/retrieval': typeof RetrievalRouteRoute
'/settings': typeof SettingsRouteRoute
'/skills': typeof SkillsRouteRoute
'/tasks': typeof TasksRouteRoute
'/watches': typeof WatchesRouteRoute
+ '/playground': typeof PlaygroundRoute
'/agent-experience/$experienceUri': typeof AgentExperienceExperienceUriRoute
'/compile/new': typeof CompileNewRoute
'/oauth/consent': typeof OauthConsentRoute
@@ -240,10 +248,10 @@ export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
'/agent-experience': typeof AgentExperienceRouteRouteWithChildren
+ '/filesystem': typeof FilesystemRouteRoute
'/home': typeof HomeRouteRoute
'/monitoring': typeof MonitoringRouteRoute
'/permissions': typeof PermissionsRouteRoute
- '/playground': typeof PlaygroundRouteRoute
'/request-logs': typeof RequestLogsRouteRoute
'/retrieval': typeof RetrievalRouteRoute
'/sessions': typeof SessionsRouteRouteWithChildren
@@ -253,6 +261,7 @@ export interface FileRoutesById {
'/users': typeof UsersRouteRouteWithChildren
'/vikingbot': typeof VikingbotRouteRouteWithChildren
'/watches': typeof WatchesRouteRoute
+ '/playground': typeof PlaygroundRoute
'/agent-experience/$experienceUri': typeof AgentExperienceExperienceUriRoute
'/compile/new': typeof CompileNewRoute
'/oauth/consent': typeof OauthConsentRoute
@@ -272,10 +281,10 @@ export interface FileRouteTypes {
fullPaths:
| '/'
| '/agent-experience'
+ | '/filesystem'
| '/home'
| '/monitoring'
| '/permissions'
- | '/playground'
| '/request-logs'
| '/retrieval'
| '/sessions'
@@ -285,6 +294,7 @@ export interface FileRouteTypes {
| '/users'
| '/vikingbot'
| '/watches'
+ | '/playground'
| '/agent-experience/$experienceUri'
| '/compile/new'
| '/oauth/consent'
@@ -301,16 +311,17 @@ export interface FileRouteTypes {
fileRoutesByTo: FileRoutesByTo
to:
| '/'
+ | '/filesystem'
| '/home'
| '/monitoring'
| '/permissions'
- | '/playground'
| '/request-logs'
| '/retrieval'
| '/settings'
| '/skills'
| '/tasks'
| '/watches'
+ | '/playground'
| '/agent-experience/$experienceUri'
| '/compile/new'
| '/oauth/consent'
@@ -328,10 +339,10 @@ export interface FileRouteTypes {
| '__root__'
| '/'
| '/agent-experience'
+ | '/filesystem'
| '/home'
| '/monitoring'
| '/permissions'
- | '/playground'
| '/request-logs'
| '/retrieval'
| '/sessions'
@@ -341,6 +352,7 @@ export interface FileRouteTypes {
| '/users'
| '/vikingbot'
| '/watches'
+ | '/playground'
| '/agent-experience/$experienceUri'
| '/compile/new'
| '/oauth/consent'
@@ -359,10 +371,10 @@ export interface FileRouteTypes {
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
AgentExperienceRouteRoute: typeof AgentExperienceRouteRouteWithChildren
+ FilesystemRouteRoute: typeof FilesystemRouteRoute
HomeRouteRoute: typeof HomeRouteRoute
MonitoringRouteRoute: typeof MonitoringRouteRoute
PermissionsRouteRoute: typeof PermissionsRouteRoute
- PlaygroundRouteRoute: typeof PlaygroundRouteRoute
RequestLogsRouteRoute: typeof RequestLogsRouteRoute
RetrievalRouteRoute: typeof RetrievalRouteRoute
SessionsRouteRoute: typeof SessionsRouteRouteWithChildren
@@ -372,6 +384,7 @@ export interface RootRouteChildren {
UsersRouteRoute: typeof UsersRouteRouteWithChildren
VikingbotRouteRoute: typeof VikingbotRouteRouteWithChildren
WatchesRouteRoute: typeof WatchesRouteRoute
+ PlaygroundRoute: typeof PlaygroundRoute
CompileNewRoute: typeof CompileNewRoute
OauthConsentRoute: typeof OauthConsentRoute
OauthVerifyRoute: typeof OauthVerifyRoute
@@ -381,6 +394,13 @@ export interface RootRouteChildren {
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
+ '/playground': {
+ id: '/playground'
+ path: '/playground'
+ fullPath: '/playground'
+ preLoaderRoute: typeof PlaygroundRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/watches': {
id: '/watches'
path: '/watches'
@@ -444,13 +464,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof RequestLogsRouteRouteImport
parentRoute: typeof rootRouteImport
}
- '/playground': {
- id: '/playground'
- path: '/playground'
- fullPath: '/playground'
- preLoaderRoute: typeof PlaygroundRouteRouteImport
- parentRoute: typeof rootRouteImport
- }
'/permissions': {
id: '/permissions'
path: '/permissions'
@@ -472,6 +485,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof HomeRouteRouteImport
parentRoute: typeof rootRouteImport
}
+ '/filesystem': {
+ id: '/filesystem'
+ path: '/filesystem'
+ fullPath: '/filesystem'
+ preLoaderRoute: typeof FilesystemRouteRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/agent-experience': {
id: '/agent-experience'
path: '/agent-experience'
@@ -638,10 +658,10 @@ const VikingbotRouteRouteWithChildren = VikingbotRouteRoute._addFileChildren(
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
AgentExperienceRouteRoute: AgentExperienceRouteRouteWithChildren,
+ FilesystemRouteRoute: FilesystemRouteRoute,
HomeRouteRoute: HomeRouteRoute,
MonitoringRouteRoute: MonitoringRouteRoute,
PermissionsRouteRoute: PermissionsRouteRoute,
- PlaygroundRouteRoute: PlaygroundRouteRoute,
RequestLogsRouteRoute: RequestLogsRouteRoute,
RetrievalRouteRoute: RetrievalRouteRoute,
SessionsRouteRoute: SessionsRouteRouteWithChildren,
@@ -651,6 +671,7 @@ const rootRouteChildren: RootRouteChildren = {
UsersRouteRoute: UsersRouteRouteWithChildren,
VikingbotRouteRoute: VikingbotRouteRouteWithChildren,
WatchesRouteRoute: WatchesRouteRoute,
+ PlaygroundRoute: PlaygroundRoute,
CompileNewRoute: CompileNewRoute,
OauthConsentRoute: OauthConsentRoute,
OauthVerifyRoute: OauthVerifyRoute,
diff --git a/web-studio/src/routes/-playground.test.tsx b/web-studio/src/routes/-playground.test.tsx
new file mode 100644
index 000000000..8a2891c40
--- /dev/null
+++ b/web-studio/src/routes/-playground.test.tsx
@@ -0,0 +1,54 @@
+// @vitest-environment jsdom
+
+import { createMemoryHistory, createRouter } from '@tanstack/react-router'
+import { expect, it } from 'vitest'
+
+import { routeTree } from '#/routeTree.gen'
+
+it.each(
+ ['', '/studio'].flatMap((basepath) =>
+ ['/playground', '/playground/'].map((path) => ({
+ basepath,
+ bookmark: `${basepath}${path}`,
+ })),
+ ),
+)(
+ 'redirects old $bookmark bookmarks without losing their selection',
+ async ({ basepath, bookmark }) => {
+ const router = createRouter({
+ routeTree,
+ basepath,
+ history: createMemoryHistory({
+ initialEntries: [
+ `${bookmark}?file=viking%3A%2F%2Fresources%2Fguide.md&uri=viking%3A%2F%2Fresources%2F&panel=agent&session=session-123&upload=true#L10`,
+ ],
+ }),
+ })
+
+ await router.load()
+
+ await expect.poll(() => router.state.location.pathname).toBe('/filesystem')
+ expect(router.history.location.pathname).toBe(`${basepath}/filesystem`)
+ expect(router.state.location.search).toEqual({
+ file: 'viking://resources/guide.md',
+ uri: 'viking://resources/',
+ panel: 'agent',
+ session: 'session-123',
+ upload: true,
+ })
+ expect(router.state.location.hash).toBe('L10')
+ expect(router.history.length).toBe(1)
+ },
+)
+
+it.each(['', '/studio'])('matches the canonical route under %s', (basepath) => {
+ const path = `${basepath}/filesystem`
+ const router = createRouter({
+ routeTree,
+ basepath,
+ history: createMemoryHistory({ initialEntries: [path] }),
+ })
+ expect(
+ router.matchRoutes(router.state.location.pathname).at(-1)?.routeId,
+ ).toBe('/filesystem')
+})
diff --git a/web-studio/src/routes/agent-experience/$experienceUri.tsx b/web-studio/src/routes/agent-experience/$experienceUri.tsx
index 04f9314bc..0f6a4416e 100644
--- a/web-studio/src/routes/agent-experience/$experienceUri.tsx
+++ b/web-studio/src/routes/agent-experience/$experienceUri.tsx
@@ -208,12 +208,12 @@ function ExperienceDetailRoute() {
rel="noreferrer noopener"
search={{ file: experienceUri }}
target="_blank"
- to="/playground"
+ to="/filesystem"
/>
}
nativeButton={false}
- aria-label={t('detail.openPlayground')}
- title={t('detail.openPlayground')}
+ aria-label={t('detail.openFilesystem')}
+ title={t('detail.openFilesystem')}
size="icon-xs"
variant="ghost"
>
diff --git a/web-studio/src/routes/compile/-components/context-link.test.tsx b/web-studio/src/routes/compile/-components/context-link.test.tsx
index e854e522a..e16ef1e96 100644
--- a/web-studio/src/routes/compile/-components/context-link.test.tsx
+++ b/web-studio/src/routes/compile/-components/context-link.test.tsx
@@ -66,7 +66,7 @@ it('opens file materials in preview and directory materials in the explorer', as
page.getByRole('link', { name: 'report.md' }).getAttribute('href')!,
'http://localhost',
)
- expect(link.pathname).toBe('/playground')
+ expect(link.pathname).toBe('/filesystem')
expect(link.searchParams.get('file')).toBe(
'viking://resources/folder/report.md',
)
diff --git a/web-studio/src/routes/compile/-components/context-link.tsx b/web-studio/src/routes/compile/-components/context-link.tsx
index b33688cb5..5f7808058 100644
--- a/web-studio/src/routes/compile/-components/context-link.tsx
+++ b/web-studio/src/routes/compile/-components/context-link.tsx
@@ -72,7 +72,7 @@ export function ContextLink({
}
return (
<Link
- to="/playground"
+ to="/filesystem"
search={
entry && !entry.isDir ? { uri: parentUri(uri), file: uri } : { uri }
}
diff --git a/web-studio/src/routes/compile/tasks/$taskId.tsx b/web-studio/src/routes/compile/tasks/$taskId.tsx
index f6bb62208..a149ec3ac 100644
--- a/web-studio/src/routes/compile/tasks/$taskId.tsx
+++ b/web-studio/src/routes/compile/tasks/$taskId.tsx
@@ -256,7 +256,7 @@ function CompileDetail() {
<div className="space-y-5">
{request && (
<Link
- to="/playground"
+ to="/filesystem"
search={{ uri: request.to }}
className="inline-flex rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground"
>
diff --git a/web-studio/src/routes/playground/-components/agent-panel-initialization.test.tsx b/web-studio/src/routes/filesystem/-components/agent-panel-initialization.test.tsx
similarity index 100%
rename from web-studio/src/routes/playground/-components/agent-panel-initialization.test.tsx
rename to web-studio/src/routes/filesystem/-components/agent-panel-initialization.test.tsx
diff --git a/web-studio/src/routes/playground/-components/agent-panel-submission.test.tsx b/web-studio/src/routes/filesystem/-components/agent-panel-submission.test.tsx
similarity index 98%
rename from web-studio/src/routes/playground/-components/agent-panel-submission.test.tsx
rename to web-studio/src/routes/filesystem/-components/agent-panel-submission.test.tsx
index 839bdac77..dff15cd4a 100644
--- a/web-studio/src/routes/playground/-components/agent-panel-submission.test.tsx
+++ b/web-studio/src/routes/filesystem/-components/agent-panel-submission.test.tsx
@@ -2,7 +2,7 @@
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
import { AgentPanel } from './agent-panel'
-import { registerPlaygroundAgentSessionId } from '../-lib/utils'
+import { registerFilesystemAgentSessionId } from '../-lib/utils'
const m = vi.hoisted(() => ({
create: vi.fn(),
@@ -72,7 +72,7 @@ function setup() {
reject = rej
}),
)
- registerPlaygroundAgentSessionId('B', 'test')
+ registerFilesystemAgentSessionId('B', 'test')
const toolbar = document.createElement('div')
document.body.append(toolbar)
const url = vi.fn()
diff --git a/web-studio/src/routes/playground/-components/agent-panel.test.tsx b/web-studio/src/routes/filesystem/-components/agent-panel.test.tsx
similarity index 100%
rename from web-studio/src/routes/playground/-components/agent-panel.test.tsx
rename to web-studio/src/routes/filesystem/-components/agent-panel.test.tsx
diff --git a/web-studio/src/routes/playground/-components/agent-panel.tsx b/web-studio/src/routes/filesystem/-components/agent-panel.tsx
similarity index 95%
rename from web-studio/src/routes/playground/-components/agent-panel.tsx
rename to web-studio/src/routes/filesystem/-components/agent-panel.tsx
index b2a02509d..731b8ecb9 100644
--- a/web-studio/src/routes/playground/-components/agent-panel.tsx
+++ b/web-studio/src/routes/filesystem/-components/agent-panel.tsx
@@ -40,8 +40,8 @@ import { MessageList } from '#/routes/sessions/-components/message-list'
import type { ResourceOpenHandler } from '../-lib/types'
import {
getErrorMessage,
- readPlaygroundAgentSessionIds,
- registerPlaygroundAgentSessionId,
+ readFilesystemAgentSessionIds,
+ registerFilesystemAgentSessionId,
} from '../-lib/utils'
export function AgentPanel({
@@ -55,7 +55,7 @@ export function AgentPanel({
onSessionChange: (sessionId: string) => void
toolbarContainer: HTMLDivElement | null
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const { identityScopeKey } = useAppConnection()
const [sessionId, setSessionId] = useState(
initialSessionId ?? createVikingBotWebSessionId(),
@@ -78,13 +78,13 @@ export function AgentPanel({
const { data: sessions, isLoading: isLoadingSessions } =
useSessionListByRecency()
const { getTitle, removeTitle } = useSessionTitles(identityScopeKey)
- const [playgroundSessionIds, setPlaygroundSessionIds] = useState<string[]>(
- () => readPlaygroundAgentSessionIds(identityScopeKey),
+ const [filesystemSessionIds, setFilesystemSessionIds] = useState<string[]>(
+ () => readFilesystemAgentSessionIds(identityScopeKey),
)
useDefaultConversationTitles(
identityScopeKey,
sessions
- .filter((session) => isVikingBotWebSession(session, playgroundSessionIds))
+ .filter((session) => isVikingBotWebSession(session, filesystemSessionIds))
.map((session) => session.session_id),
)
const { data: historyMessages } = useSessionMessages(historySessionId)
@@ -118,8 +118,8 @@ export function AgentPanel({
creationStartedRef.current = false
setSessionError(null)
setIsCreatingSession(false)
- setPlaygroundSessionIds(
- registerPlaygroundAgentSessionId(nextSessionId, identityScopeKey),
+ setFilesystemSessionIds(
+ registerFilesystemAgentSessionId(nextSessionId, identityScopeKey),
)
setHistorySessionId(nextSessionId)
setPersistedSessionId(nextSessionId)
@@ -133,8 +133,8 @@ export function AgentPanel({
// Only publish IDs that exist on the server; drafts must not survive in the URL.
useEffect(() => {
if (persistedSessionId) {
- setPlaygroundSessionIds(
- registerPlaygroundAgentSessionId(persistedSessionId, identityScopeKey),
+ setFilesystemSessionIds(
+ registerFilesystemAgentSessionId(persistedSessionId, identityScopeKey),
)
}
}, [identityScopeKey, persistedSessionId])
@@ -186,9 +186,9 @@ export function AgentPanel({
sessionTitle === sessionId ? t('agent.newSessionTitle') : sessionTitle
const reversedSessions = useMemo(() => {
return sessions.filter((session) =>
- isVikingBotWebSession(session, playgroundSessionIds),
+ isVikingBotWebSession(session, filesystemSessionIds),
)
- }, [sessions, playgroundSessionIds])
+ }, [sessions, filesystemSessionIds])
return (
<>
@@ -326,7 +326,7 @@ export function AgentPanel({
title={title}
onDeleted={() => {
removeTitle(session.session_id)
- setPlaygroundSessionIds((ids) =>
+ setFilesystemSessionIds((ids) =>
ids.filter((id) => id !== session.session_id),
)
if (session.session_id === sessionId) {
@@ -433,7 +433,7 @@ export function BotModePrompt({
detail: string
onRetry: () => void
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
return (
<div className="flex h-full items-center justify-center">
<div className="grid max-w-md gap-4 rounded-xl border border-primary/25 bg-primary/5 p-5 text-sm">
@@ -476,7 +476,7 @@ export function AgentEmptyState({
}: {
onSend: (message: string) => void
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const prompts = t('agent.empty.prompts', {
returnObjects: true,
}) as string[]
diff --git a/web-studio/src/routes/playground/-components/context-explorer.test.tsx b/web-studio/src/routes/filesystem/-components/context-explorer.test.tsx
similarity index 97%
rename from web-studio/src/routes/playground/-components/context-explorer.test.tsx
rename to web-studio/src/routes/filesystem/-components/context-explorer.test.tsx
index e65cb18c0..6954c033a 100644
--- a/web-studio/src/routes/playground/-components/context-explorer.test.tsx
+++ b/web-studio/src/routes/filesystem/-components/context-explorer.test.tsx
@@ -19,7 +19,7 @@ vi.mock('#/routes/resources/-hooks/viking-fm', () => ({
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string, options?: { name?: string }) => {
- if (key === 'explorer.title') return 'Context tree'
+ if (key === 'explorer.title') return 'Filesystem'
if (key === 'explorer.expandDirectory') {
return `Expand ${options?.name}`
}
@@ -111,7 +111,7 @@ describe('ContextTree keyboard semantics', () => {
selectedFileUri: file.uri,
})
- const rootList = screen.getByRole('list', { name: 'Context tree' })
+ const rootList = screen.getByRole('list', { name: 'Filesystem' })
const disclosure = screen.getByRole('button', {
name: 'Collapse resources',
})
diff --git a/web-studio/src/routes/playground/-components/context-explorer.tsx b/web-studio/src/routes/filesystem/-components/context-explorer.tsx
similarity index 98%
rename from web-studio/src/routes/playground/-components/context-explorer.tsx
rename to web-studio/src/routes/filesystem/-components/context-explorer.tsx
index 474f9f616..2ce1ed883 100644
--- a/web-studio/src/routes/playground/-components/context-explorer.tsx
+++ b/web-studio/src/routes/filesystem/-components/context-explorer.tsx
@@ -49,7 +49,7 @@ export function ContextExplorerHeader({
onOpenSearch: () => void
onRefresh: () => void
}) {
- const { t } = useTranslation(['playground', 'resources'])
+ const { t } = useTranslation(['filesystem', 'resources'])
const showProcessingTasks = hasTasks || isRefreshingTasks
return (
@@ -151,7 +151,7 @@ export function ContextTree({
onSelectFile: (entry: VikingFsEntry) => void
selectedFileUri?: string | null
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const rootQuery = useVikingFsList(ROOT_URI, {
output: 'agent',
showAllHidden: true,
@@ -223,7 +223,7 @@ export function ContextTree({
)
}
-export function PlaygroundResizeHandle({
+export function FilesystemResizeHandle({
active,
label,
onPointerDown,
@@ -265,7 +265,7 @@ export function ContextTreeNode({
onSelectFile: (entry: VikingFsEntry) => void
selectedFileUri?: string | null
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const isOpen = expandedKeys.has(entry.uri)
const isFileSelected = !entry.isDir && selectedFileUri === entry.uri
const isDirSelected =
diff --git a/web-studio/src/routes/playground/-components/resource-ref-list.tsx b/web-studio/src/routes/filesystem/-components/resource-ref-list.tsx
similarity index 100%
rename from web-studio/src/routes/playground/-components/resource-ref-list.tsx
rename to web-studio/src/routes/filesystem/-components/resource-ref-list.tsx
diff --git a/web-studio/src/routes/playground/-components/terminal-panel.test.tsx b/web-studio/src/routes/filesystem/-components/terminal-panel.test.tsx
similarity index 100%
rename from web-studio/src/routes/playground/-components/terminal-panel.test.tsx
rename to web-studio/src/routes/filesystem/-components/terminal-panel.test.tsx
diff --git a/web-studio/src/routes/playground/-components/terminal-panel.tsx b/web-studio/src/routes/filesystem/-components/terminal-panel.tsx
similarity index 99%
rename from web-studio/src/routes/playground/-components/terminal-panel.tsx
rename to web-studio/src/routes/filesystem/-components/terminal-panel.tsx
index 818dfb3b7..3310224b5 100644
--- a/web-studio/src/routes/playground/-components/terminal-panel.tsx
+++ b/web-studio/src/routes/filesystem/-components/terminal-panel.tsx
@@ -82,7 +82,7 @@ import {
entryToRef,
getErrorMessage,
readStoredJsonArray,
- registerPlaygroundAgentSessionId,
+ registerFilesystemAgentSessionId,
removeStoredValue,
searchResultToRefs,
visibleContextEntries,
@@ -467,7 +467,7 @@ export function TerminalPanel({
sessionId?: string
toolbarContainer: HTMLDivElement | null
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const { connectionRole, identityScopeKey } = useAppConnection()
const commandHistoryStorageKey = createIdentityStorageKey(
TERMINAL_COMMAND_HISTORY_STORAGE_KEY,
@@ -1124,7 +1124,7 @@ export function TerminalPanel({
case 'create': {
const requestedId = positional.shift()
const result = await createSession(requestedId)
- registerPlaygroundAgentSessionId(
+ registerFilesystemAgentSessionId(
result.session_id,
identityScopeKey,
)
@@ -1145,7 +1145,7 @@ export function TerminalPanel({
case 'switch': {
const id = positional.shift()
if (!id) throw new Error(t('terminal.sessionUsage'))
- registerPlaygroundAgentSessionId(id, identityScopeKey)
+ registerFilesystemAgentSessionId(id, identityScopeKey)
onSessionChange(id)
append({
body: t('terminal.sessionSwitchedBody', { id }),
@@ -1916,7 +1916,7 @@ export function TerminalHistoryItem({
onOpenResource: ResourceOpenHandler
openingUri: string | null
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const Icon =
entry.kind === 'command'
? TerminalIcon
diff --git a/web-studio/src/routes/playground/-lib/constants.ts b/web-studio/src/routes/filesystem/-lib/constants.ts
similarity index 88%
rename from web-studio/src/routes/playground/-lib/constants.ts
rename to web-studio/src/routes/filesystem/-lib/constants.ts
index 5388d151e..a0d833119 100644
--- a/web-studio/src/routes/playground/-lib/constants.ts
+++ b/web-studio/src/routes/filesystem/-lib/constants.ts
@@ -1,27 +1,29 @@
import type { TerminalCommandSuggestion } from './types'
export const ROOT_URI = 'viking://'
-export const PLAYGROUND_LEFT_WIDTH_STORAGE_KEY =
+
+// Keep legacy storage keys so the page rename preserves saved layout and sessions.
+export const FILESYSTEM_LEFT_WIDTH_STORAGE_KEY =
'openviking.playground.leftWidth'
-export const PLAYGROUND_RIGHT_WIDTH_STORAGE_KEY =
+export const FILESYSTEM_RIGHT_WIDTH_STORAGE_KEY =
'openviking.playground.rightWidth'
-export const PLAYGROUND_RIGHT_COLLAPSED_STORAGE_KEY =
+export const FILESYSTEM_RIGHT_COLLAPSED_STORAGE_KEY =
'openviking.playground.rightCollapsed'
-export const PLAYGROUND_AGENT_SESSIONS_STORAGE_KEY =
+export const FILESYSTEM_AGENT_SESSIONS_STORAGE_KEY =
'openviking.playground.agentSessions'
-export const PLAYGROUND_EXPANDED_URIS_STORAGE_KEY =
+export const FILESYSTEM_EXPANDED_URIS_STORAGE_KEY =
'openviking.playground.expandedUris'
-export const PLAYGROUND_LEFT_WIDTH = {
+export const FILESYSTEM_LEFT_WIDTH = {
default: 330,
max: 620,
min: 240,
}
-export const PLAYGROUND_RIGHT_WIDTH = {
+export const FILESYSTEM_RIGHT_WIDTH = {
default: 430,
max: 680,
min: 320,
}
-export const PLAYGROUND_MAIN_MIN_WIDTH = 420
+export const FILESYSTEM_MAIN_MIN_WIDTH = 420
export const TERMINAL_COMMANDS: TerminalCommandSuggestion[] = [
{
diff --git a/web-studio/src/routes/playground/-lib/types.ts b/web-studio/src/routes/filesystem/-lib/types.ts
similarity index 87%
rename from web-studio/src/routes/playground/-lib/types.ts
rename to web-studio/src/routes/filesystem/-lib/types.ts
index 8a98e510b..f144b9eda 100644
--- a/web-studio/src/routes/playground/-lib/types.ts
+++ b/web-studio/src/routes/filesystem/-lib/types.ts
@@ -1,9 +1,9 @@
-export type PlaygroundPanel = 'agent' | 'terminal'
+export type FilesystemPanel = 'agent' | 'terminal'
-export type PlaygroundSearch = {
+export type FilesystemSearch = {
uri?: string
file?: string
- panel?: PlaygroundPanel
+ panel?: FilesystemPanel
session?: string
upload?: boolean
}
@@ -49,7 +49,7 @@ export type TerminalCommandSuggestion = {
command: string
examples?: string[]
group: TerminalCommandGroup
- /** i18n subkey under `playground.terminal.commands`. */
+ /** i18n subkey under `filesystem.terminal.commands`. */
key: string
insertText: string
parameters?: TerminalCommandParameterKey[]
diff --git a/web-studio/src/routes/filesystem/-lib/utils.test.ts b/web-studio/src/routes/filesystem/-lib/utils.test.ts
new file mode 100644
index 000000000..1aa55edc5
--- /dev/null
+++ b/web-studio/src/routes/filesystem/-lib/utils.test.ts
@@ -0,0 +1,80 @@
+// @vitest-environment jsdom
+
+import { beforeEach, describe, expect, it } from 'vitest'
+
+import {
+ createIdentityStorageKey,
+ readFilesystemAgentSessionIds,
+ readFilesystemExpandedUris,
+ registerFilesystemAgentSessionId,
+ writeFilesystemExpandedUris,
+} from './utils'
+
+beforeEach(() => {
+ localStorage.clear()
+})
+
+describe('createIdentityStorageKey', () => {
+ it('isolates persisted Filesystem state by identity scope', () => {
+ const baseKey = 'openviking.playground.terminalEntryHistory'
+
+ expect(createIdentityStorageKey(baseKey, 'account-a\u0000alice')).not.toBe(
+ createIdentityStorageKey(baseKey, 'account-b\u0000bob'),
+ )
+ })
+
+ it('keeps the storage key browser-safe', () => {
+ const key = createIdentityStorageKey(
+ 'openviking.playground.agentSessions',
+ 'http://localhost:1933\u0000api_key\u0000account-a\u0000alice',
+ )
+
+ expect(key).not.toContain('\u0000')
+ })
+})
+
+describe('Filesystem expanded directory persistence', () => {
+ it('restores normalized expanded URIs for the same identity', () => {
+ const legacyKey = createIdentityStorageKey(
+ 'openviking.playground.expandedUris',
+ 'account-a\u0000alice',
+ )
+ localStorage.setItem(legacyKey, JSON.stringify(['viking://resources/old']))
+ expect(readFilesystemExpandedUris('account-a\u0000alice')).toEqual([
+ 'viking://resources/old/',
+ ])
+
+ writeFilesystemExpandedUris('account-a\u0000alice', [
+ 'viking://user/default',
+ 'viking://resources/',
+ ])
+
+ expect(readFilesystemExpandedUris('account-a\u0000alice')).toEqual([
+ 'viking://user/default/',
+ 'viking://resources/',
+ ])
+ expect(readFilesystemExpandedUris('account-a\u0000bob')).toEqual([])
+ expect(JSON.parse(localStorage.getItem(legacyKey)!)).toEqual([
+ 'viking://user/default',
+ 'viking://resources/',
+ ])
+ })
+})
+
+it('preserves legacy Agent history without sharing it across identities', () => {
+ const legacyKey = createIdentityStorageKey(
+ 'openviking.playground.agentSessions',
+ 'account-a\u0000alice',
+ )
+ localStorage.setItem(legacyKey, JSON.stringify(['existing-session']))
+
+ expect(readFilesystemAgentSessionIds('account-a\u0000alice')).toEqual([
+ 'existing-session',
+ ])
+ registerFilesystemAgentSessionId('new-session', 'account-a\u0000alice')
+ expect(JSON.parse(localStorage.getItem(legacyKey)!)).toEqual([
+ 'new-session',
+ 'existing-session',
+ ])
+ expect(readFilesystemAgentSessionIds('account-a\u0000bob')).toEqual([])
+})
diff --git a/web-studio/src/routes/playground/-lib/utils.ts b/web-studio/src/routes/filesystem/-lib/utils.ts
similarity index 92%
rename from web-studio/src/routes/playground/-lib/utils.ts
rename to web-studio/src/routes/filesystem/-lib/utils.ts
index cf1d97232..e6069c12d 100644
--- a/web-studio/src/routes/playground/-lib/utils.ts
+++ b/web-studio/src/routes/filesystem/-lib/utils.ts
@@ -11,8 +11,8 @@ import { cleanVikingUri } from '#/lib/viking-uri'
import {
ROOT_URI,
- PLAYGROUND_AGENT_SESSIONS_STORAGE_KEY,
- PLAYGROUND_EXPANDED_URIS_STORAGE_KEY,
+ FILESYSTEM_AGENT_SESSIONS_STORAGE_KEY,
+ FILESYSTEM_EXPANDED_URIS_STORAGE_KEY,
} from './constants'
import type { ResourceRef } from './types'
@@ -109,12 +109,12 @@ export function createIdentityStorageKey(
return `${key}.${encodeURIComponent(identityScopeKey)}`
}
-export function readPlaygroundAgentSessionIds(
+export function readFilesystemAgentSessionIds(
identityScopeKey: string,
): string[] {
return readStoredJsonArray(
createIdentityStorageKey(
- PLAYGROUND_AGENT_SESSIONS_STORAGE_KEY,
+ FILESYSTEM_AGENT_SESSIONS_STORAGE_KEY,
identityScopeKey,
),
(sessionId) =>
@@ -124,24 +124,24 @@ export function readPlaygroundAgentSessionIds(
)
}
-export function registerPlaygroundAgentSessionId(
+export function registerFilesystemAgentSessionId(
sessionId: string,
identityScopeKey: string,
): string[] {
const trimmed = sessionId.trim()
if (typeof window === 'undefined') return trimmed ? [trimmed] : []
- if (!trimmed) return readPlaygroundAgentSessionIds(identityScopeKey)
+ if (!trimmed) return readFilesystemAgentSessionIds(identityScopeKey)
const next = [
trimmed,
- ...readPlaygroundAgentSessionIds(identityScopeKey).filter(
+ ...readFilesystemAgentSessionIds(identityScopeKey).filter(
(item) => item !== trimmed,
),
].slice(0, 50)
writeStoredJson(
createIdentityStorageKey(
- PLAYGROUND_AGENT_SESSIONS_STORAGE_KEY,
+ FILESYSTEM_AGENT_SESSIONS_STORAGE_KEY,
identityScopeKey,
),
next,
@@ -150,10 +150,10 @@ export function registerPlaygroundAgentSessionId(
return next
}
-export function readPlaygroundExpandedUris(identityScopeKey: string): string[] {
+export function readFilesystemExpandedUris(identityScopeKey: string): string[] {
return readStoredJsonArray(
createIdentityStorageKey(
- PLAYGROUND_EXPANDED_URIS_STORAGE_KEY,
+ FILESYSTEM_EXPANDED_URIS_STORAGE_KEY,
identityScopeKey,
),
(uri) =>
@@ -164,13 +164,13 @@ export function readPlaygroundExpandedUris(identityScopeKey: string): string[] {
)
}
-export function writePlaygroundExpandedUris(
+export function writeFilesystemExpandedUris(
identityScopeKey: string,
uris: Iterable<string>,
): void {
writeStoredJson(
createIdentityStorageKey(
- PLAYGROUND_EXPANDED_URIS_STORAGE_KEY,
+ FILESYSTEM_EXPANDED_URIS_STORAGE_KEY,
identityScopeKey,
),
[...uris],
@@ -223,7 +223,7 @@ export function isDirectoryLevelFile(uri: string): boolean {
return name === '_abstract.md' || name === '_overview.md'
}
-export function normalizePlaygroundResourceUri(uri: string): string {
+export function normalizeFilesystemResourceUri(uri: string): string {
const normalized = uri.endsWith('/')
? normalizeDirUri(uri)
: normalizeFileUri(uri)
diff --git a/web-studio/src/routes/playground/route.test.tsx b/web-studio/src/routes/filesystem/route.test.tsx
similarity index 92%
rename from web-studio/src/routes/playground/route.test.tsx
rename to web-studio/src/routes/filesystem/route.test.tsx
index 3215e0a7e..63d25dbf7 100644
--- a/web-studio/src/routes/playground/route.test.tsx
+++ b/web-studio/src/routes/filesystem/route.test.tsx
@@ -29,7 +29,7 @@ vi.mock('@tanstack/react-router', async (importOriginal) => {
...actual,
createFileRoute: () => (options: Record<string, unknown>) => ({
...options,
- fullPath: '/playground',
+ fullPath: '/filesystem',
options,
useSearch: () => mocks.search,
}),
@@ -77,7 +77,7 @@ vi.mock('./-components/context-explorer', () => ({
),
ContextTree: () => null,
PanelTab: () => null,
- PlaygroundResizeHandle: () => null,
+ FilesystemResizeHandle: () => null,
}))
vi.mock('./-components/agent-panel', () => ({ AgentPanel: () => null }))
@@ -86,16 +86,16 @@ vi.mock('#/routes/resources/-components/find-palette', () => ({
FindPalette: () => null,
}))
-const PlaygroundRoute = Route.options.component as ComponentType & {
+const FilesystemRoute = Route.options.component as ComponentType & {
preload?: () => Promise<void>
}
const firstFile = 'viking://user/default/memories/first.md'
const secondFile = 'viking://user/default/memories/second.md'
const parentDirectory = 'viking://user/default/memories/'
-describe('playground context tree refresh', () => {
+describe('filesystem context tree refresh', () => {
beforeAll(async () => {
- await PlaygroundRoute.preload?.()
+ await FilesystemRoute.preload?.()
})
afterEach(cleanup)
@@ -109,7 +109,7 @@ describe('playground context tree refresh', () => {
it('clears a deleted selected file from the preview and URL search', async () => {
mocks.fetchFsStat.mockRejectedValue({ statusCode: 404 })
- render(<PlaygroundRoute />)
+ render(<FilesystemRoute />)
await userEvent.click(
await screen.findByRole('button', { name: mocks.refreshLabel }),
@@ -135,7 +135,7 @@ describe('playground context tree refresh', () => {
rejectStat = reject
}),
)
- const { rerender } = render(<PlaygroundRoute />)
+ const { rerender } = render(<FilesystemRoute />)
await userEvent.click(
await screen.findByRole('button', { name: mocks.refreshLabel }),
@@ -145,7 +145,7 @@ describe('playground context tree refresh', () => {
})
mocks.search = { file: secondFile, uri: parentDirectory }
- rerender(<PlaygroundRoute />)
+ rerender(<FilesystemRoute />)
await waitFor(() => {
expect(screen.getByTestId('preview').textContent).toBe(secondFile)
})
diff --git a/web-studio/src/routes/playground/route.tsx b/web-studio/src/routes/filesystem/route.tsx
similarity index 89%
rename from web-studio/src/routes/playground/route.tsx
rename to web-studio/src/routes/filesystem/route.tsx
index 3f13746c8..3e8ec9b24 100644
--- a/web-studio/src/routes/playground/route.tsx
+++ b/web-studio/src/routes/filesystem/route.tsx
@@ -48,21 +48,21 @@ import {
ContextExplorerHeader,
ContextTree,
PanelTab,
- PlaygroundResizeHandle,
+ FilesystemResizeHandle,
} from './-components/context-explorer'
import { TerminalPanel } from './-components/terminal-panel'
import {
ROOT_URI,
- PLAYGROUND_LEFT_WIDTH,
- PLAYGROUND_LEFT_WIDTH_STORAGE_KEY,
- PLAYGROUND_MAIN_MIN_WIDTH,
- PLAYGROUND_RIGHT_COLLAPSED_STORAGE_KEY,
- PLAYGROUND_RIGHT_WIDTH,
- PLAYGROUND_RIGHT_WIDTH_STORAGE_KEY,
+ FILESYSTEM_LEFT_WIDTH,
+ FILESYSTEM_LEFT_WIDTH_STORAGE_KEY,
+ FILESYSTEM_MAIN_MIN_WIDTH,
+ FILESYSTEM_RIGHT_COLLAPSED_STORAGE_KEY,
+ FILESYSTEM_RIGHT_WIDTH,
+ FILESYSTEM_RIGHT_WIDTH_STORAGE_KEY,
} from './-lib/constants'
import type {
- PlaygroundPanel,
- PlaygroundSearch,
+ FilesystemPanel,
+ FilesystemSearch,
ResourceOpenHandler,
} from './-lib/types'
import {
@@ -73,15 +73,15 @@ import {
getAncestorUris,
isDirectoryLevelFile,
mergeExpanded,
- normalizePlaygroundResourceUri,
- readPlaygroundExpandedUris,
+ normalizeFilesystemResourceUri,
+ readFilesystemExpandedUris,
readStoredNumber,
visibleContextEntries,
- writePlaygroundExpandedUris,
+ writeFilesystemExpandedUris,
} from './-lib/utils'
-export const Route = createFileRoute('/playground')({
- validateSearch: (search: Record<string, unknown>): PlaygroundSearch => ({
+export const Route = createFileRoute('/filesystem')({
+ validateSearch: (search: Record<string, unknown>): FilesystemSearch => ({
file: typeof search.file === 'string' ? search.file : undefined,
panel:
search.panel === 'agent' || search.panel === 'terminal'
@@ -91,19 +91,19 @@ export const Route = createFileRoute('/playground')({
upload: search.upload === true || search.upload === 'true',
uri: typeof search.uri === 'string' ? search.uri : undefined,
}),
- component: PlaygroundRoute,
+ component: FilesystemRoute,
})
-function PlaygroundRoute() {
+function FilesystemRoute() {
return (
<ResourceUploadProvider>
- <PlaygroundWorkbench />
+ <FilesystemWorkbench />
</ResourceUploadProvider>
)
}
-function PlaygroundWorkbench() {
- const { t } = useTranslation(['playground', 'resources'])
+function FilesystemWorkbench() {
+ const { t } = useTranslation(['filesystem', 'resources'])
const { identityScopeKey } = useAppConnection()
const search = Route.useSearch()
const navigate = useNavigate({ from: Route.fullPath })
@@ -125,15 +125,15 @@ function PlaygroundWorkbench() {
selectedFileRef.current = selectedFile
const [expandedKeys, setExpandedKeys] = useState<Set<string>>(() =>
mergeExpanded(
- new Set(readPlaygroundExpandedUris(identityScopeKey)),
+ new Set(readFilesystemExpandedUris(identityScopeKey)),
getAncestorUris(initialCurrentUri),
),
)
- const [activePanel, setActivePanel] = useState<PlaygroundPanel>(
+ const [activePanel, setActivePanel] = useState<FilesystemPanel>(
search.panel ?? 'agent',
)
const [actionPanelOpen, setActionPanelOpen] = useState(false)
- const isCompactLayout = useIsCompactPlaygroundLayout()
+ const isCompactLayout = useIsCompactFilesystemLayout()
const [uploadDialogOpen, setUploadDialogOpen] = useState(
() => search.upload ?? false,
)
@@ -143,18 +143,18 @@ function PlaygroundWorkbench() {
const layoutRef = useRef<HTMLDivElement>(null)
const [leftWidth, setLeftWidth] = useState(() =>
readStoredNumber(
- PLAYGROUND_LEFT_WIDTH_STORAGE_KEY,
- PLAYGROUND_LEFT_WIDTH.default,
- PLAYGROUND_LEFT_WIDTH.min,
- PLAYGROUND_LEFT_WIDTH.max,
+ FILESYSTEM_LEFT_WIDTH_STORAGE_KEY,
+ FILESYSTEM_LEFT_WIDTH.default,
+ FILESYSTEM_LEFT_WIDTH.min,
+ FILESYSTEM_LEFT_WIDTH.max,
),
)
const [rightWidth, setRightWidth] = useState(() =>
readStoredNumber(
- PLAYGROUND_RIGHT_WIDTH_STORAGE_KEY,
- PLAYGROUND_RIGHT_WIDTH.default,
- PLAYGROUND_RIGHT_WIDTH.min,
- PLAYGROUND_RIGHT_WIDTH.max,
+ FILESYSTEM_RIGHT_WIDTH_STORAGE_KEY,
+ FILESYSTEM_RIGHT_WIDTH.default,
+ FILESYSTEM_RIGHT_WIDTH.min,
+ FILESYSTEM_RIGHT_WIDTH.max,
),
)
const [resizingPane, setResizingPane] = useState<'context' | 'action' | null>(
@@ -163,14 +163,14 @@ function PlaygroundWorkbench() {
const [rightCollapsed, setRightCollapsed] = useState(
() =>
typeof window !== 'undefined' &&
- window.localStorage.getItem(PLAYGROUND_RIGHT_COLLAPSED_STORAGE_KEY) ===
+ window.localStorage.getItem(FILESYSTEM_RIGHT_COLLAPSED_STORAGE_KEY) ===
'1',
)
const toggleRightCollapsed = useCallback(
() =>
setRightCollapsed((collapsed) => {
window.localStorage.setItem(
- PLAYGROUND_RIGHT_COLLAPSED_STORAGE_KEY,
+ FILESYSTEM_RIGHT_COLLAPSED_STORAGE_KEY,
collapsed ? '0' : '1',
)
return !collapsed
@@ -201,7 +201,7 @@ function PlaygroundWorkbench() {
const syncSearch = useCallback(
(next: {
file?: string
- panel?: PlaygroundPanel
+ panel?: FilesystemPanel
session?: string
upload?: boolean
uri?: string
@@ -222,7 +222,7 @@ function PlaygroundWorkbench() {
useEffect(() => {
setExpandedKeys(
mergeExpanded(
- new Set(readPlaygroundExpandedUris(identityScopeKey)),
+ new Set(readFilesystemExpandedUris(identityScopeKey)),
getAncestorUris(initialCurrentUri),
),
)
@@ -244,7 +244,7 @@ function PlaygroundWorkbench() {
const handleExpandedKeysChange = useCallback(
(next: Set<string>) => {
setExpandedKeys(next)
- writePlaygroundExpandedUris(identityScopeKey, next)
+ writeFilesystemExpandedUris(identityScopeKey, next)
},
[identityScopeKey],
)
@@ -277,7 +277,7 @@ function PlaygroundWorkbench() {
if (!cleaned) return
setOpeningUri(cleaned)
- const targetUri = normalizePlaygroundResourceUri(cleaned)
+ const targetUri = normalizeFilesystemResourceUri(cleaned)
try {
const stat = await fetchFsStat(targetUri, { throwOnError: true })
const isDir = stat.isDir || targetUri.endsWith('/')
@@ -365,7 +365,7 @@ function PlaygroundWorkbench() {
)
const handlePanelChange = useCallback(
- (panel: PlaygroundPanel) => {
+ (panel: FilesystemPanel) => {
setActivePanel(panel)
syncSearch({ panel })
},
@@ -373,7 +373,7 @@ function PlaygroundWorkbench() {
)
const handleOpenActionPanel = useCallback(
- (panel: PlaygroundPanel) => {
+ (panel: FilesystemPanel) => {
handlePanelChange(panel)
setActionPanelOpen(true)
},
@@ -450,8 +450,8 @@ function PlaygroundWorkbench() {
const layoutStyle = useMemo(
() =>
({
- '--playground-left-width': `${leftWidth}px`,
- '--playground-right-width': `${rightWidth}px`,
+ '--filesystem-left-width': `${leftWidth}px`,
+ '--filesystem-right-width': `${rightWidth}px`,
}) as CSSProperties,
[leftWidth, rightWidth],
)
@@ -474,20 +474,20 @@ function PlaygroundWorkbench() {
) => {
if (!layoutRect) {
return side === 'left'
- ? PLAYGROUND_LEFT_WIDTH.max
- : PLAYGROUND_RIGHT_WIDTH.max
+ ? FILESYSTEM_LEFT_WIDTH.max
+ : FILESYSTEM_RIGHT_WIDTH.max
}
const hardMax =
side === 'left'
- ? PLAYGROUND_LEFT_WIDTH.max
- : PLAYGROUND_RIGHT_WIDTH.max
+ ? FILESYSTEM_LEFT_WIDTH.max
+ : FILESYSTEM_RIGHT_WIDTH.max
const availableMax =
- layoutRect.width - currentOppositeWidth - PLAYGROUND_MAIN_MIN_WIDTH
+ layoutRect.width - currentOppositeWidth - FILESYSTEM_MAIN_MIN_WIDTH
return Math.max(
side === 'left'
- ? PLAYGROUND_LEFT_WIDTH.min
- : PLAYGROUND_RIGHT_WIDTH.min,
+ ? FILESYSTEM_LEFT_WIDTH.min
+ : FILESYSTEM_RIGHT_WIDTH.min,
Math.min(hardMax, availableMax),
)
}
@@ -497,12 +497,12 @@ function PlaygroundWorkbench() {
if (pane === 'context') {
const nextWidth = clampNumber(
startLeftWidth + deltaX,
- PLAYGROUND_LEFT_WIDTH.min,
+ FILESYSTEM_LEFT_WIDTH.min,
getMaxWidth('left', rightWidthRef.current),
)
setLeftWidth(nextWidth)
window.localStorage.setItem(
- PLAYGROUND_LEFT_WIDTH_STORAGE_KEY,
+ FILESYSTEM_LEFT_WIDTH_STORAGE_KEY,
String(nextWidth),
)
return
@@ -510,12 +510,12 @@ function PlaygroundWorkbench() {
const nextWidth = clampNumber(
startRightWidth - deltaX,
- PLAYGROUND_RIGHT_WIDTH.min,
+ FILESYSTEM_RIGHT_WIDTH.min,
getMaxWidth('right', leftWidthRef.current),
)
setRightWidth(nextWidth)
window.localStorage.setItem(
- PLAYGROUND_RIGHT_WIDTH_STORAGE_KEY,
+ FILESYSTEM_RIGHT_WIDTH_STORAGE_KEY,
String(nextWidth),
)
}
@@ -556,7 +556,7 @@ function PlaygroundWorkbench() {
className="flex min-h-0 flex-1 flex-col bg-background lg:flex-row"
style={layoutStyle}
>
- <aside className="flex min-h-[180px] min-w-0 shrink-0 basis-[36%] flex-col border-b bg-muted/20 lg:min-h-0 lg:w-[var(--playground-left-width)] lg:min-w-[var(--playground-left-width)] lg:basis-auto lg:border-b-0">
+ <aside className="flex min-h-[180px] min-w-0 shrink-0 basis-[36%] flex-col border-b bg-muted/20 lg:min-h-0 lg:w-[var(--filesystem-left-width)] lg:min-w-[var(--filesystem-left-width)] lg:basis-auto lg:border-b-0">
<ContextExplorerHeader
activeTaskCount={activeTaskCount}
hasActiveTasks={hasActiveTasks}
@@ -581,7 +581,7 @@ function PlaygroundWorkbench() {
/>
</div>
</aside>
- <PlaygroundResizeHandle
+ <FilesystemResizeHandle
active={resizingPane === 'context'}
label={t('resizeContext')}
onPointerDown={(event) => handleResizeStart('context', event)}
@@ -661,7 +661,7 @@ function PlaygroundWorkbench() {
</div>
</main>
{!rightCollapsed ? (
- <PlaygroundResizeHandle
+ <FilesystemResizeHandle
active={resizingPane === 'action'}
label={t('resizeAction')}
onPointerDown={(event) => handleResizeStart('action', event)}
@@ -669,8 +669,8 @@ function PlaygroundWorkbench() {
) : null}
{!isCompactLayout && !rightCollapsed ? (
- <aside className="hidden min-h-0 min-w-0 flex-col bg-muted/15 lg:flex lg:w-[var(--playground-right-width)] lg:min-w-[var(--playground-right-width)]">
- <PlaygroundActionPanel
+ <aside className="hidden min-h-0 min-w-0 flex-col bg-muted/15 lg:flex lg:w-[var(--filesystem-right-width)] lg:min-w-[var(--filesystem-right-width)]">
+ <FilesystemActionPanel
activePanel={activePanel}
currentUri={currentUri}
entries={entries}
@@ -689,7 +689,7 @@ function PlaygroundWorkbench() {
</div>
{isCompactLayout ? (
- <PlaygroundMobileActionScreen
+ <FilesystemMobileActionScreen
activePanel={activePanel}
currentUri={currentUri}
entries={entries}
@@ -744,7 +744,7 @@ function PlaygroundWorkbench() {
)
}
-function useIsCompactPlaygroundLayout() {
+function useIsCompactFilesystemLayout() {
const [isCompact, setIsCompact] = useState(() =>
typeof window !== 'undefined' && typeof window.matchMedia === 'function'
? window.matchMedia('(max-width: 1023px)').matches
@@ -765,7 +765,7 @@ function useIsCompactPlaygroundLayout() {
return isCompact
}
-function PlaygroundActionPanel({
+function FilesystemActionPanel({
activePanel,
currentUri,
entries,
@@ -777,25 +777,25 @@ function PlaygroundActionPanel({
openingUri,
sessionId,
}: {
- activePanel: PlaygroundPanel
+ activePanel: FilesystemPanel
currentUri: string
entries: VikingFsEntry[]
onCollapse: () => void
onOpenAddResource: () => void
onOpenResource: ResourceOpenHandler
- onPanelChange: (panel: PlaygroundPanel) => void
+ onPanelChange: (panel: FilesystemPanel) => void
onSessionChange: (sessionId: string) => void
openingUri: string | null
sessionId?: string
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
const [toolbarContainer, setToolbarContainer] =
useState<HTMLDivElement | null>(null)
return (
<div className="flex h-full min-h-0 flex-col">
<div className="flex h-14 shrink-0 items-center gap-2 border-b px-3">
- <PlaygroundActionTabs
+ <FilesystemActionTabs
activePanel={activePanel}
onPanelChange={onPanelChange}
/>
@@ -816,7 +816,7 @@ function PlaygroundActionPanel({
</Button>
</div>
- <PlaygroundActionContent
+ <FilesystemActionContent
activePanel={activePanel}
currentUri={currentUri}
entries={entries}
@@ -831,7 +831,7 @@ function PlaygroundActionPanel({
)
}
-function PlaygroundMobileActionScreen({
+function FilesystemMobileActionScreen({
activePanel,
currentUri,
entries,
@@ -844,19 +844,19 @@ function PlaygroundMobileActionScreen({
openingUri,
sessionId,
}: {
- activePanel: PlaygroundPanel
+ activePanel: FilesystemPanel
currentUri: string
entries: VikingFsEntry[]
onClose: () => void
onOpenAddResource: () => void
onOpenResource: ResourceOpenHandler
- onPanelChange: (panel: PlaygroundPanel) => void
+ onPanelChange: (panel: FilesystemPanel) => void
onSessionChange: (sessionId: string) => void
open: boolean
openingUri: string | null
sessionId?: string
}) {
- const { t } = useTranslation(['playground', 'resources'])
+ const { t } = useTranslation(['filesystem', 'resources'])
const [toolbarContainer, setToolbarContainer] =
useState<HTMLDivElement | null>(null)
@@ -877,7 +877,7 @@ function PlaygroundMobileActionScreen({
>
<ArrowLeftIcon className="size-4" />
</Button>
- <PlaygroundActionTabs
+ <FilesystemActionTabs
activePanel={activePanel}
onPanelChange={onPanelChange}
/>
@@ -887,7 +887,7 @@ function PlaygroundMobileActionScreen({
/>
</div>
<div className="min-h-0 flex-1">
- <PlaygroundActionContent
+ <FilesystemActionContent
activePanel={activePanel}
currentUri={currentUri}
entries={entries}
@@ -903,14 +903,14 @@ function PlaygroundMobileActionScreen({
)
}
-function PlaygroundActionTabs({
+function FilesystemActionTabs({
activePanel,
onPanelChange,
}: {
- activePanel: PlaygroundPanel
- onPanelChange: (panel: PlaygroundPanel) => void
+ activePanel: FilesystemPanel
+ onPanelChange: (panel: FilesystemPanel) => void
}) {
- const { t } = useTranslation('playground')
+ const { t } = useTranslation('filesystem')
return (
<div className="inline-flex rounded-lg border bg-background p-1">
@@ -930,7 +930,7 @@ function PlaygroundActionTabs({
)
}
-function PlaygroundActionContent({
+function FilesystemActionContent({
activePanel,
currentUri,
entries,
@@ -941,7 +941,7 @@ function PlaygroundActionContent({
sessionId,
toolbarContainer,
}: {
- activePanel: PlaygroundPanel
+ activePanel: FilesystemPanel
currentUri: string
entries: VikingFsEntry[]
onOpenAddResource: () => void
diff --git a/web-studio/src/routes/playground.tsx b/web-studio/src/routes/playground.tsx
new file mode 100644
index 000000000..7c8a38a5a
--- /dev/null
+++ b/web-studio/src/routes/playground.tsx
@@ -0,0 +1,13 @@
+import { createFileRoute, redirect } from '@tanstack/react-router'
+
+// Preserve existing bookmarks without retaining a second copy of the page.
+export const Route = createFileRoute('/playground')({
+ beforeLoad: () => {
+ throw redirect({
+ to: '/filesystem',
+ search: true,
+ hash: true,
+ replace: true,
+ })
+ },
+})
diff --git a/web-studio/src/routes/playground/-lib/utils.test.ts b/web-studio/src/routes/playground/-lib/utils.test.ts
deleted file mode 100644
index 3596a8cb9..000000000
--- a/web-studio/src/routes/playground/-lib/utils.test.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-// @vitest-environment jsdom
-
-import { beforeEach, describe, expect, it } from 'vitest'
-
-import {
- createIdentityStorageKey,
- readPlaygroundExpandedUris,
- writePlaygroundExpandedUris,
-} from './utils'
-
-beforeEach(() => {
- localStorage.clear()
-})
-
-describe('createIdentityStorageKey', () => {
- it('isolates persisted Playground state by identity scope', () => {
- const baseKey = 'openviking.playground.terminalEntryHistory'
-
- expect(createIdentityStorageKey(baseKey, 'account-a\u0000alice')).not.toBe(
- createIdentityStorageKey(baseKey, 'account-b\u0000bob'),
- )
- })
-
- it('keeps the storage key browser-safe', () => {
- const key = createIdentityStorageKey(
- 'openviking.playground.agentSessions',
- 'http://localhost:1933\u0000api_key\u0000account-a\u0000alice',
- )
-
- expect(key).not.toContain('\u0000')
- })
-})
-
-describe('Playground expanded directory persistence', () => {
- it('restores normalized expanded URIs for the same identity', () => {
- writePlaygroundExpandedUris('account-a\u0000alice', [
- 'viking://user/default',
- 'viking://resources/',
- ])
-
- expect(readPlaygroundExpandedUris('account-a\u0000alice')).toEqual([
- 'viking://user/default/',
- 'viking://resources/',
- ])
- expect(readPlaygroundExpandedUris('account-a\u0000bob')).toEqual([])
- })
-})
diff --git a/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.test.tsx b/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.test.tsx
index 4ecd4db82..e9b873b2a 100644
--- a/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.test.tsx
+++ b/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.test.tsx
@@ -1,9 +1,18 @@
// @vitest-environment jsdom
import { cleanup, render, screen } from '@testing-library/react'
+import {
+ createMemoryHistory,
+ createRootRoute,
+ createRouter,
+ RouterProvider,
+} from '@tanstack/react-router'
+import { createInstance } from 'i18next'
import type { TFunction } from 'i18next'
+import { I18nextProvider, initReactI18next } from 'react-i18next'
import { afterEach, describe, expect, it, vi } from 'vitest'
+import { resources } from '#/i18n/resources'
import { RetrievalDetailSheet } from './retrieval-detail-sheet'
const t = ((key: string) => key) as TFunction<'retrieval'>
@@ -31,4 +40,52 @@ describe('RetrievalDetailSheet', () => {
expect(screen.getByText('Result summary')).toBeDefined()
expect(screen.queryByText('detail.content')).toBeNull()
})
+
+ it.each([
+ ['en', 'Open in Filesystem'],
+ ['zh-CN', '在文件系统中打开'],
+ ])(
+ 'links to the selected file with its translated label in %s',
+ async (lng, label) => {
+ const i18n = createInstance()
+ await i18n.use(initReactI18next).init({ lng, resources })
+ const uri = 'viking://resources/guide.md'
+ const router = createRouter({
+ basepath: '/studio',
+ history: createMemoryHistory({ initialEntries: ['/studio/'] }),
+ routeTree: createRootRoute({
+ component: () => (
+ <RetrievalDetailSheet
+ detail={{
+ contextType: 'resource',
+ score: 0.8,
+ uri,
+ item: {
+ abstract: 'Guide summary',
+ category: '',
+ context_type: 'resource',
+ level: 2,
+ match_reason: '',
+ score: 0.8,
+ uri,
+ },
+ }}
+ onClose={vi.fn()}
+ t={i18n.getFixedT(lng, 'retrieval')}
+ />
+ ),
+ }),
+ })
+ render(
+ <I18nextProvider i18n={i18n}>
+ <RouterProvider router={router} />
+ </I18nextProvider>,
+ )
+ const link = (await screen.findByText(label)).closest('a')
+ const url = new URL(link!.getAttribute('href')!, 'http://localhost')
+ expect(url.pathname).toBe('/studio/filesystem')
+ expect(url.searchParams.get('file')).toBe(uri)
+ expect(url.searchParams.get('uri')).toBe('viking://resources/')
+ },
+ )
})
diff --git a/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.tsx b/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.tsx
index e284305ea..c9d160928 100644
--- a/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.tsx
+++ b/web-studio/src/routes/retrieval/-components/retrieval-detail-sheet.tsx
@@ -114,13 +114,13 @@ export function RetrievalDetailSheet({
rel="noreferrer noopener"
search={resourceSearch}
target="_blank"
- to="/playground"
+ to="/filesystem"
/>
}
size="sm"
variant="outline"
>
- {t('detail.openPlayground')}
+ {t('detail.openFilesystem')}
<ExternalLink className="size-3.5" />
</Button>
) : null}
diff --git a/web-studio/src/routes/retrieval/route.tsx b/web-studio/src/routes/retrieval/route.tsx
index 3921f1572..525977234 100644
--- a/web-studio/src/routes/retrieval/route.tsx
+++ b/web-studio/src/routes/retrieval/route.tsx
@@ -144,7 +144,7 @@ function RetrievalPage() {
)
const handleUploadClick = useCallback(() => {
- void navigate({ to: '/playground', search: { upload: true } })
+ void navigate({ to: '/filesystem', search: { upload: true } })
}, [navigate])
useEffect(() => {
diff --git a/web-studio/src/routes/sessions/-components/message-list.tsx b/web-studio/src/routes/sessions/-components/message-list.tsx
index 364b965ff..3b2b1a92d 100644
--- a/web-studio/src/routes/sessions/-components/message-list.tsx
+++ b/web-studio/src/routes/sessions/-components/message-list.tsx
@@ -64,7 +64,7 @@ function getToolResultsById(parts: MessagePart[]): Map<string, ToolResultPart> {
)
}
-function stripPlaygroundContextSuffix(text: string): string {
+function stripLegacyContextSuffix(text: string): string {
return text
.replace(/\n\n当前选中的上下文资源:\s*viking:\/\/[\s\S]*$/u, '')
.replace(
@@ -204,7 +204,7 @@ const UserMessage = memo(function UserMessage({
compact?: boolean
}) {
const { t } = useTranslation('sessions')
- const text = stripPlaygroundContextSuffix(getTextFromParts(message))
+ const text = stripLegacyContextSuffix(getTextFromParts(message))
return (
<div
diff --git a/web-studio/src/routes/skills/route.tsx b/web-studio/src/routes/skills/route.tsx
index 46b4ac1bf..2d9e58574 100644
--- a/web-studio/src/routes/skills/route.tsx
+++ b/web-studio/src/routes/skills/route.tsx
@@ -392,14 +392,14 @@ function SkillsRoute() {
rel="noreferrer noopener"
search={{ uri: selectedSkill.uri }}
target="_blank"
- to="/playground"
+ to="/filesystem"
/>
}
nativeButton={false}
size="xs"
variant="outline"
>
- {t('openPlayground')}
+ {t('openFilesystem')}
<ExternalLinkIcon />
</Button>
) : null}
diff --git a/web-studio/src/routes/vikingbot/-web-sessions.test.ts b/web-studio/src/routes/vikingbot/-web-sessions.test.ts
index 576ac5c49..b97b01289 100644
--- a/web-studio/src/routes/vikingbot/-web-sessions.test.ts
+++ b/web-studio/src/routes/vikingbot/-web-sessions.test.ts
@@ -28,7 +28,7 @@ describe('VikingBot web session ownership', () => {
})
})
-it('includes only explicitly registered legacy playground sessions', () => {
+it('includes only explicitly registered legacy Filesystem sessions', () => {
const legacy = 'f5216b16-cd10-4e9a-b542-a29576f2260c'
expect(isVikingBotWebSession({ session_id: legacy }, [legacy])).toBe(true)
expect(isVikingBotWebSession({ session_id: legacy }, [])).toBe(false)
diff --git a/web-studio/src/routes/vikingbot/index.tsx b/web-studio/src/routes/vikingbot/index.tsx
index 6941d67ed..c38fb83e7 100644
--- a/web-studio/src/routes/vikingbot/index.tsx
+++ b/web-studio/src/routes/vikingbot/index.tsx
@@ -1,6 +1,6 @@
import { useDefaultConversationTitles } from '#/lib/sessions/use-default-conversation-titles'
import { ConversationRow } from './-components/conversation-row'
-import { readPlaygroundAgentSessionIds } from '#/routes/playground/-lib/utils'
+import { readFilesystemAgentSessionIds } from '#/routes/filesystem/-lib/utils'
import { useState } from 'react'
import { createFileRoute } from '@tanstack/react-router'
import { useQueries, useQuery } from '@tanstack/react-query'
@@ -77,7 +77,7 @@ function VikingBotWorkspace({ scope }: { scope: string }) {
scope,
sessions.data
.filter((session) =>
- isVikingBotWebSession(session, readPlaygroundAgentSessionIds(scope)),
+ isVikingBotWebSession(session, readFilesystemAgentSessionIds(scope)),
)
.map((session) => session.session_id),
)
@@ -92,7 +92,7 @@ function VikingBotWorkspace({ scope }: { scope: string }) {
const rows = [
...sessions.data
.filter((session) =>
- isVikingBotWebSession(session, readPlaygroundAgentSessionIds(scope)),
+ isVikingBotWebSession(session, readFilesystemAgentSessionIds(scope)),
)
.map((session) => ({
id: session.session_id,
diff --git a/web-studio/src/styles.css b/web-studio/src/styles.css
index 7977c9d70..d97b9b6c1 100644
--- a/web-studio/src/styles.css
+++ b/web-studio/src/styles.css
@@ -215,12 +215,12 @@
hide internal scrollbars — iOS/Atlas pattern is overlay scroll only
on active gesture, not a persistent track. */
@media (max-width: 767px) {
- .web-playground-resource-fs ::-webkit-scrollbar {
+ .web-filesystem-resource-fs ::-webkit-scrollbar {
width: 0;
height: 0;
background: transparent;
}
- .web-playground-resource-fs * {
+ .web-filesystem-resource-fs * {
scrollbar-width: none;
}
}
@@ -232,7 +232,7 @@
page-level scrollbar, and the inner panes already overlay-scroll on
gesture. */
@media (display-mode: standalone) {
- body:has(.web-playground-resource-fs)
+ body:has(.web-filesystem-resource-fs)
[data-slot='scroll-area-scrollbar'][data-orientation='vertical'] {
display: none;
}