Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

ui(sandbox): redesign personal sandbox secrets settings

wizardchen83d661af5585
diff --git a/client/env_var.go b/client/env_var.go
index 426168e92..df9eb3be3 100644
--- a/client/env_var.go
+++ b/client/env_var.go
@@ -32,9 +32,10 @@ type EnvVarView struct {
// SkillEnvGroup is one skill's declared credentials.
type SkillEnvGroup struct {
- SkillID string `json:"skill_id"`
- SkillName string `json:"skill_name"`
- Vars []EnvVarView `json:"vars"`
+ SkillID string `json:"skill_id"`
+ SkillName string `json:"skill_name"`
+ Description string `json:"description,omitempty"`
+ Vars []EnvVarView `json:"vars"`
}
// ConfigEnvGroup is one sandbox config: the caller's own config-wide variables
@@ -42,6 +43,7 @@ type SkillEnvGroup struct {
type ConfigEnvGroup struct {
SandboxConfigID string `json:"sandbox_config_id"`
SandboxConfigName string `json:"sandbox_config_name"`
+ Description string `json:"description,omitempty"`
Vars []EnvVarView `json:"vars"`
Skills []SkillEnvGroup `json:"skills"`
}
diff --git a/config/builtin_agents.yaml b/config/builtin_agents.yaml
index 98887162a..015087dec 100644
--- a/config/builtin_agents.yaml
+++ b/config/builtin_agents.yaml
@@ -242,10 +242,10 @@ builtin_agents:
description: "Internal agent that installs an uploaded skill and its dependencies into the sandbox image"
zh-CN:
name: "技能安装器"
- description: "把上传的技能及其依赖装进沙盒镜像的内部智能体"
+ description: "把上传的技能及其依赖装进沙箱镜像的内部智能体"
zh-TW:
name: "技能安裝器"
- description: "把上傳的技能及其相依套件裝進沙盒鏡像的內部智能體"
+ description: "把上傳的技能及其相依套件裝進沙箱鏡像的內部智能體"
ja-JP:
name: "スキルインストーラー"
description: "アップロードされたスキルとその依存関係をサンドボックスイメージにインストールする内部エージェント"
diff --git a/config/prompt_templates/agent_system_prompt.yaml b/config/prompt_templates/agent_system_prompt.yaml
index 68331c21c..dc7af4ad9 100644
--- a/config/prompt_templates/agent_system_prompt.yaml
+++ b/config/prompt_templates/agent_system_prompt.yaml
@@ -494,7 +494,7 @@ templates:
i18n:
zh-CN:
name: "技能安装系统提示词"
- description: "用于把上传的技能及其依赖装进沙盒镜像的系统提示词"
+ description: "用于把上传的技能及其依赖装进沙箱镜像的系统提示词"
en-US:
name: "Skill Installer System Prompt"
description: "System prompt for installing an uploaded skill and its dependencies into the sandbox image"
diff --git a/docs/api/skill.md b/docs/api/skill.md
index 948c383e1..b02684535 100644
--- a/docs/api/skill.md
+++ b/docs/api/skill.md
@@ -224,6 +224,7 @@ curl --location 'http://localhost:8080/api/v1/me/env-vars' \
{
"sandbox_config_id": "cfg-1",
"sandbox_config_name": "默认沙箱",
+ "description": "日常对话用的沙箱",
"vars": [
{ "name": "HTTP_PROXY", "source": "user", "updated_at": "2026-08-27T10:00:00Z" }
],
@@ -231,6 +232,7 @@ curl --location 'http://localhost:8080/api/v1/me/env-vars' \
{
"skill_id": "sk-1",
"skill_name": "web-search",
+ "description": "通过 Tavily 检索网页",
"vars": [
{ "name": "TAVILY_API_KEY", "description": "Tavily 搜索密钥", "required": true, "source": "workspace" },
{ "name": "REGION", "source": "unset" }
diff --git a/docs/docs.go b/docs/docs.go
index 378dda235..799153fed 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -13333,7 +13333,7 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
- "description": "返回指定沙盒配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。",
+ "description": "返回指定沙箱配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。",
"consumes": [
"application/json"
],
@@ -13343,7 +13343,7 @@ const docTemplate = `{
"tags": [
"Skills"
],
- "summary": "获取当前沙盒配置上可执行的 Skills",
+ "summary": "获取当前沙箱配置上可执行的 Skills",
"parameters": [
{
"type": "string",
diff --git a/docs/swagger.json b/docs/swagger.json
index afe34a478..90c634165 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -13326,7 +13326,7 @@
"ApiKeyAuth": []
}
],
- "description": "返回指定沙盒配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。",
+ "description": "返回指定沙箱配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。",
"consumes": [
"application/json"
],
@@ -13336,7 +13336,7 @@
"tags": [
"Skills"
],
- "summary": "获取当前沙盒配置上可执行的 Skills",
+ "summary": "获取当前沙箱配置上可执行的 Skills",
"parameters": [
{
"type": "string",
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index c76997ec2..af472bbd2 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -14813,7 +14813,7 @@ paths:
get:
consumes:
- application/json
- description: 返回指定沙盒配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。
+ description: 返回指定沙箱配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。
parameters:
- description: Sandbox config ID
in: query
@@ -14830,7 +14830,7 @@ paths:
security:
- Bearer: []
- ApiKeyAuth: []
- summary: 获取当前沙盒配置上可执行的 Skills
+ summary: 获取当前沙箱配置上可执行的 Skills
tags:
- Skills
/storage-backends:
diff --git a/frontend/src/api/agent/index.ts b/frontend/src/api/agent/index.ts
index 18f243c16..09cc126f6 100644
--- a/frontend/src/api/agent/index.ts
+++ b/frontend/src/api/agent/index.ts
@@ -65,8 +65,8 @@ export interface CustomAgentConfig {
skills_selection_mode?: 'all' | 'selected' | 'none';
selected_skills?: string[]; // 选择的Skill名称列表
- // ===== 沙盒设置 =====
- // 该智能体的技能脚本运行在哪个沙盒配置上;为空表示不启用沙盒执行。
+ // ===== 沙箱设置 =====
+ // 该智能体的技能脚本运行在哪个沙箱配置上;为空表示不启用沙箱执行。
// 指向逻辑配置而非某个具体版本,凭据轮换时无需重新指派每个智能体。
sandbox_config_id?: string;
diff --git a/frontend/src/api/env-vars.ts b/frontend/src/api/env-vars.ts
index 5dc64c287..a46d8abe8 100644
--- a/frontend/src/api/env-vars.ts
+++ b/frontend/src/api/env-vars.ts
@@ -26,6 +26,8 @@ export interface EnvVarView {
export interface SkillEnvGroup {
skill_id: string
skill_name: string
+ /** SKILL.md one-liner; not the instruction body. */
+ description?: string
vars: EnvVarView[]
}
@@ -36,6 +38,7 @@ export interface SkillEnvGroup {
export interface ConfigEnvGroup {
sandbox_config_id: string
sandbox_config_name: string
+ description?: string
vars: EnvVarView[]
skills: SkillEnvGroup[]
}
diff --git a/frontend/src/api/skill/index.ts b/frontend/src/api/skill/index.ts
index 80c8c2b54..e08421d93 100644
--- a/frontend/src/api/skill/index.ts
+++ b/frontend/src/api/skill/index.ts
@@ -6,7 +6,7 @@ export interface SkillInfo {
description: string;
}
-// 获取当前沙盒配置上可执行的 Skills;未传 sandboxConfigId 或
+// 获取当前沙箱配置上可执行的 Skills;未传 sandboxConfigId 或
// skills_available 为 false 时,前端应隐藏/禁用 Skills 配置
export function listSkills(sandboxConfigId?: string) {
return get<{ data: SkillInfo[]; skills_available?: boolean }>('/api/v1/skills', {
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 72e893fb6..903aeae27 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -1366,7 +1366,7 @@ export default {
toggleHide: 'Hide environment variables',
none: 'This skill declared no environment variables.',
workspaceTitle: 'Workspace-wide values',
- workspaceHint: 'Every member who has not set their own value uses the value here. Members set their own under Settings, Environment variables.',
+ workspaceHint: 'Every member who has not set their own value uses the value here. Members set their own under Settings → Sandbox secrets.',
required: 'Required',
isSet: 'Set',
notSet: 'Not set',
@@ -1834,24 +1834,36 @@ export default {
}
},
envVarSettings: {
- title: 'Environment variables',
- description: 'Values you enter here belong to you alone. A sandbox variable is passed to every skill script and shell command you run on that sandbox; a skill credential is passed only when that skill runs. Nothing is displayed again once saved.',
+ title: 'Sandbox secrets',
+ description: 'Personal keys for skills and sandboxes, not WeKnora system or deployment settings.',
+ helpAria: 'About sandbox secrets',
+ introPersonalTitle: 'Yours only',
+ introPersonalBody: 'Injected into your own chats and runs. Other members cannot see them, and theirs will not replace yours.',
+ introRuntimeTitle: 'Passed in when something runs',
+ introRuntimeBody: 'Injected when a skill runs, or when a command runs in that sandbox. You can also supply them in the conversation. Saved values are never shown again.',
loading: 'Loading…',
- loadFailed: 'Could not load the environment variables.',
+ loadFailed: 'Could not load sandbox secrets.',
retry: 'Try again',
noConfigTitle: 'No sandbox configured',
- noConfigDescription: 'This workspace has no sandbox backend yet, so there is nothing to set variables for.',
- sandboxTitle: 'Sandbox variables',
- sandboxHint: 'Passed to everything you run on this sandbox, whether or not a skill is involved.',
- sandboxEmpty: 'You have no variables on this sandbox.',
- skillTitle: 'Skill credentials',
- skillHint: 'What each skill declared it needs. Passed only when that skill runs.',
+ noConfigDescription: 'This workspace has no sandbox backend yet, so there is nothing to set keys for.',
+ sandboxTitle: 'Always passed in a chosen sandbox',
+ sandboxHint: 'Passed only to commands you run in that sandbox. Most people never need this; you can also supply values in the conversation.',
+ sandboxEmpty: 'Nothing added yet.',
+ sandboxPick: 'Which sandbox',
+ skillTitle: 'Keys a skill needs',
+ skillHint: 'Each skill declares what it needs. Save them here ahead of time, or supply them in the conversation. Workspace admins can also fill in shared values on the skill card.',
+ skillEmptyTitle: 'No skill has asked for keys yet',
+ skillEmptyDesc: 'After you install a skill that declares credentials, the fields to fill in will show up here.',
+ skillOnSandbox: 'Sandbox: {name}',
+ skillNeedsCount: '{count} not saved here',
+ skillReady: 'Saved on this page',
requiredTag: 'Required',
statusUnset: 'Not set',
statusWorkspace: 'Using the workspace value',
statusUser: 'Set by you',
- blocking: 'Required but not set, so this skill cannot run.',
- addRow: 'Add a variable',
+ setValue: 'Set',
+ replaceValue: 'Replace',
+ addRow: 'Add',
namePlaceholder: 'VARIABLE_NAME',
nameRule: 'Upper-case letters, digits and underscores, starting with a letter or an underscore.',
nameInvalid: 'That name cannot be used. Names the sandbox reserves, such as PATH or anything starting with WEKNORA_, are not accepted.',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 74ed2e526..f65773c0a 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -4782,24 +4782,36 @@ export default {
}
},
envVarSettings: {
- title: '환경 변수',
- description: '여기에 입력한 값은 나에게만 속합니다. 샌드박스 변수는 해당 샌드박스에서 실행하는 모든 스킬 스크립트와 명령에 전달되고, 스킬 자격 증명은 그 스킬이 실행될 때만 전달됩니다. 저장한 뒤에는 다시 표시되지 않습니다.',
+ title: '샌드박스 키',
+ description: '스킬과 샌드박스에 쓰는 개인 키이며, WeKnora 시스템이나 배포 설정이 아닙니다.',
+ helpAria: '샌드박스 키 설명',
+ introPersonalTitle: '나만의 값',
+ introPersonalBody: '내 대화와 실행에만 주입됩니다. 다른 구성원은 볼 수 없고, 그들의 값이 내 값을 대체하지도 않습니다.',
+ introRuntimeTitle: '실행할 때만 전달',
+ introRuntimeBody: '스킬이 실행되거나 해당 샌드박스에서 명령을 실행할 때 주입됩니다. 대화에서 바로 제공할 수도 있습니다. 저장한 뒤에는 다시 표시되지 않습니다.',
loading: '불러오는 중…',
- loadFailed: '환경 변수를 불러오지 못했습니다.',
+ loadFailed: '샌드박스 키를 불러오지 못했습니다.',
retry: '다시 시도',
noConfigTitle: '샌드박스가 없습니다',
- noConfigDescription: '이 워크스페이스에는 아직 샌드박스 백엔드가 없어 설정할 변수가 없습니다.',
- sandboxTitle: '샌드박스 변수',
- sandboxHint: '스킬과 무관하게 이 샌드박스에서 실행하는 모든 것에 전달됩니다.',
- sandboxEmpty: '이 샌드박스에 등록한 변수가 없습니다.',
- skillTitle: '스킬 자격 증명',
- skillHint: '각 스킬이 필요하다고 선언한 변수입니다. 그 스킬이 실행될 때만 전달됩니다.',
+ noConfigDescription: '이 워크스페이스에는 아직 샌드박스 백엔드가 없어 설정할 키가 없습니다.',
+ sandboxTitle: '선택한 샌드박스에서 항상 전달되는 값',
+ sandboxHint: '그 샌드박스에서 실행하는 명령에만 전달됩니다. 대부분은 필요 없고, 대화에서 바로 제공할 수도 있습니다.',
+ sandboxEmpty: '아직 추가한 값이 없습니다.',
+ sandboxPick: '어느 샌드박스에 쓸지',
+ skillTitle: '스킬이 필요한 키',
+ skillHint: '각 스킬이 필요하다고 선언한 값입니다. 여기에 미리 저장하거나 대화에서 바로 제공할 수 있습니다. 워크스페이스 관리자는 스킬 카드에서 공용 값을 넣을 수도 있습니다.',
+ skillEmptyTitle: '아직 키가 필요한 스킬이 없습니다',
+ skillEmptyDesc: '자격 증명을 선언하는 스킬을 설치하면 여기에 입력란이 나타납니다.',
+ skillOnSandbox: '샌드박스: {name}',
+ skillNeedsCount: '여기에 저장되지 않음 {count}개',
+ skillReady: '이 페이지에 저장됨',
requiredTag: '필수',
statusUnset: '설정되지 않음',
statusWorkspace: '워크스페이스 공용 값 사용 중',
statusUser: '내가 설정함',
- blocking: '필수인데 설정되지 않아 이 스킬을 실행할 수 없습니다.',
- addRow: '변수 추가',
+ setValue: '설정',
+ replaceValue: '변경',
+ addRow: '추가',
namePlaceholder: 'VARIABLE_NAME',
nameRule: '대문자, 숫자, 밑줄만 사용하며 문자 또는 밑줄로 시작해야 합니다.',
nameInvalid: '이 이름은 사용할 수 없습니다. PATH처럼 샌드박스가 예약한 이름이나 WEKNORA_로 시작하는 이름은 허용되지 않습니다.',
@@ -5261,7 +5273,7 @@ export default {
toggleHide: '환경 변수 접기',
none: '이 스킬은 환경 변수를 선언하지 않았습니다.',
workspaceTitle: '워크스페이스 공용 값',
- workspaceHint: '자기 값을 설정하지 않은 모든 구성원이 여기의 값을 사용합니다. 구성원은 설정의 환경 변수에서 자기 값을 설정할 수 있습니다.',
+ workspaceHint: '자기 값을 설정하지 않은 모든 구성원이 여기의 값을 사용합니다. 구성원은 설정의 「샌드박스 키」에서 자기 값을 설정할 수 있습니다.',
required: '필수',
isSet: '설정됨',
notSet: '설정되지 않음',
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 100d165b6..804c5e5b5 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -4782,24 +4782,36 @@ export default {
}
},
envVarSettings: {
- title: 'Переменные окружения',
- description: 'Введённые здесь значения принадлежат только вам. Переменная песочницы передаётся во все скрипты навыков и команды, которые вы запускаете в этой песочнице; учётные данные навыка — только при запуске этого навыка. После сохранения значение больше не отображается.',
+ title: 'Ключи песочницы',
+ description: 'Личные ключи для навыков и песочниц, а не системные или деплой-настройки WeKnora.',
+ helpAria: 'Справка по ключам песочницы',
+ introPersonalTitle: 'Только ваши',
+ introPersonalBody: 'Подставляются только в ваши диалоги и запуски. Другие участники их не видят, и их значения не заменяют ваши.',
+ introRuntimeTitle: 'Передаются в момент запуска',
+ introRuntimeBody: 'Подставляются, когда навык выполняется или когда команда идёт в этой песочнице. Их также можно передать прямо в разговоре. Сохранённые значения больше не показываются.',
loading: 'Загрузка…',
- loadFailed: 'Не удалось загрузить переменные окружения.',
+ loadFailed: 'Не удалось загрузить ключи песочницы.',
retry: 'Повторить',
noConfigTitle: 'Песочница не настроена',
- noConfigDescription: 'В этом рабочем пространстве пока нет песочницы, поэтому задавать переменные не для чего.',
- sandboxTitle: 'Переменные песочницы',
- sandboxHint: 'Передаются во всё, что вы запускаете в этой песочнице, независимо от навыков.',
- sandboxEmpty: 'У вас нет переменных в этой песочнице.',
- skillTitle: 'Учётные данные навыков',
- skillHint: 'То, что каждый навык объявил необходимым. Передаётся только при запуске этого навыка.',
+ noConfigDescription: 'В этом рабочем пространстве пока нет песочницы, поэтому задавать ключи не для чего.',
+ sandboxTitle: 'Всегда передаются в выбранной песочнице',
+ sandboxHint: 'Передаются только командам в этой песочнице. Обычно не нужны; значения можно также дать в разговоре.',
+ sandboxEmpty: 'Пока ничего не добавлено.',
+ sandboxPick: 'В какой песочнице',
+ skillTitle: 'Ключи, которые нужны навыку',
+ skillHint: 'Каждый навык объявляет, что ему нужно. Можно сохранить заранее здесь или передать в разговоре. Администратор рабочего пространства может также задать общие значения на карточке навыка.',
+ skillEmptyTitle: 'Пока ни один навык не запросил ключи',
+ skillEmptyDesc: 'После установки навыка, который объявляет учётные данные, поля для заполнения появятся здесь.',
+ skillOnSandbox: 'Песочница: {name}',
+ skillNeedsCount: 'Не сохранено здесь: {count}',
+ skillReady: 'Сохранено на этой странице',
requiredTag: 'Обязательно',
statusUnset: 'Не задано',
statusWorkspace: 'Используется значение рабочего пространства',
statusUser: 'Задано вами',
- blocking: 'Обязательная переменная не задана, поэтому навык не может работать.',
- addRow: 'Добавить переменную',
+ setValue: 'Задать',
+ replaceValue: 'Заменить',
+ addRow: 'Добавить',
namePlaceholder: 'VARIABLE_NAME',
nameRule: 'Только заглавные латинские буквы, цифры и подчёркивания; первым символом должна быть буква или подчёркивание.',
nameInvalid: 'Это имя использовать нельзя. Имена, зарезервированные песочницей, например PATH или начинающиеся с WEKNORA_, не принимаются.',
@@ -5261,7 +5273,7 @@ export default {
toggleHide: 'Скрыть переменные окружения',
none: 'Этот навык не объявил переменных окружения.',
workspaceTitle: 'Значения для всего рабочего пространства',
- workspaceHint: 'Каждый участник, не задавший своё значение, использует значение отсюда. Своё значение участник задаёт в настройках, раздел «Переменные окружения».',
+ workspaceHint: 'Каждый участник, не задавший своё значение, использует значение отсюда. Своё значение участник задаёт в настройках, раздел «Ключи песочницы».',
required: 'Обязательно',
isSet: 'Задано',
notSet: 'Не задано',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 90d071e48..b6ae506f0 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -4784,24 +4784,36 @@ export default {
}
},
envVarSettings: {
- title: '环境变量',
- description: '这里填的值只属于你自己。沙盒变量会带给你在该沙盒上运行的所有技能脚本和命令;技能凭据只在该技能运行时带上。保存之后都不会再显示出来。',
+ title: '沙箱密钥',
+ description: '给技能和沙箱用的个人密钥,不是 WeKnora 的系统或部署配置。',
+ helpAria: '沙箱密钥说明',
+ introPersonalTitle: '只属于你',
+ introPersonalBody: '只注入到你自己的对话和执行里,空间里的其他人看不到,也不会改成他们的值。',
+ introRuntimeTitle: '用的时候才带上',
+ introRuntimeBody: '技能运行或在沙箱里执行命令时才会注入;对话里也可以当场提供。保存后不再显示明文。',
loading: '加载中…',
- loadFailed: '环境变量加载失败。',
+ loadFailed: '沙箱密钥加载失败。',
retry: '重试',
- noConfigTitle: '还没有沙盒',
- noConfigDescription: '这个空间还没有配置沙盒后端,暂时没有可设置的变量。',
- sandboxTitle: '沙盒变量',
- sandboxHint: '你在这个沙盒上运行的任何东西都会带上,不限于技能。',
- sandboxEmpty: '你在这个沙盒上还没有变量。',
- skillTitle: '技能凭据',
- skillHint: '各技能声明自己需要的变量,只在该技能运行时带上。',
+ noConfigTitle: '还没有沙箱',
+ noConfigDescription: '这个空间还没有配置沙箱后端,暂时没有可设置的密钥。',
+ sandboxTitle: '某个沙箱里始终带上的值',
+ sandboxHint: '只带给你在那个沙箱里跑的命令。多数情况用不到;需要时再加,对话里也可以当场提供。',
+ sandboxEmpty: '还没有添加过。',
+ sandboxPick: '用在哪个沙箱',
+ skillTitle: '技能要用的密钥',
+ skillHint: '技能声明需要的值。可以预先保存在这里,也可以在对话里当场提供。空间管理员还可以在技能卡上填空间共用值。',
+ skillEmptyTitle: '还没有技能需要密钥',
+ skillEmptyDesc: '安装会声明凭据的技能后,要填的项会出现在这里。',
+ skillOnSandbox: '用于沙箱「{name}」',
+ skillNeedsCount: '{count} 项未在此保存',
+ skillReady: '此页已保存',
requiredTag: '必填',
statusUnset: '未设置',
statusWorkspace: '正在使用空间共用值',
statusUser: '你已设置',
- blocking: '必填但未设置,该技能无法运行。',
- addRow: '添加变量',
+ setValue: '设置',
+ replaceValue: '更换',
+ addRow: '添加',
namePlaceholder: 'VARIABLE_NAME',
nameRule: '只能用大写字母、数字和下划线,且以字母或下划线开头。',
nameInvalid: '这个名字不能用。沙箱保留的名字(例如 PATH,或以 WEKNORA_ 开头的名字)不接受。',
@@ -4815,7 +4827,7 @@ export default {
saveSuccess: '已保存。值已存好,之后不会再显示。',
saveFailed: '保存失败。',
delete: '删除',
- deleteConfirm: '删除 {name}?之后在这个沙盒上运行的东西都不会再带上它。',
+ deleteConfirm: '删除 {name}?之后在这个沙箱上运行的东西都不会再带上它。',
deleteSuccess: '变量已删除。',
clear: '清除我的值',
clearConfirm: '清除你为 {name} 设置的值?之后会重新使用空间共用值(如果有)。',
@@ -5263,7 +5275,7 @@ export default {
toggleHide: '收起环境变量',
none: '这个技能没有声明环境变量。',
workspaceTitle: '空间共用值',
- workspaceHint: '所有没有填写自己值的成员都会用这里的值。成员可以在「设置 - 环境变量」里填自己的值。',
+ workspaceHint: '所有没有填写自己值的成员都会用这里的值。成员可以在「设置 → 沙箱密钥」里填自己的值。',
required: '必填',
isSet: '已设置',
notSet: '未设置',
diff --git a/frontend/src/utils/sandboxArtifactRefs.ts b/frontend/src/utils/sandboxArtifactRefs.ts
index 62a2fb36b..62a0b5cb5 100644
--- a/frontend/src/utils/sandboxArtifactRefs.ts
+++ b/frontend/src/utils/sandboxArtifactRefs.ts
@@ -1,7 +1,7 @@
/**
- * 把回答正文里对「沙盒生成文件」的引用,接到 artifact 下载链路上。
+ * 把回答正文里对「沙箱生成文件」的引用,接到 artifact 下载链路上。
*
- * 模型会用 Markdown 图片语法引用它在沙盒里生成的文件(提示词规定写成
+ * 模型会用 Markdown 图片语法引用它在沙箱里生成的文件(提示词规定写成
* `![说明](sandbox:文件名)`),服务端在落库前把它改写成该文件的稳定句柄
* `resource://<handle>` —— 与知识库图片、聊天附件同一种引用形式。两种写法
* 都指向同一份 `Message.Artifacts`:
@@ -77,7 +77,7 @@ function parseArtifactRef(href: string): ArtifactRef | null {
}
/**
- * 该链接目标是否可能是沙盒产物引用。
+ * 该链接目标是否可能是沙箱产物引用。
*
* 句柄形式与知识库图片同形,因此这里为真只说明「值得交给产物解析试一次」,
* 不代表本消息真有这个文件。
@@ -286,7 +286,7 @@ function renderImage(
/**
* 渲染一个 Markdown 图片/链接目标。
*
- * 返回 null 表示这不是沙盒产物引用,调用方应回落到默认渲染(普通图片、
+ * 返回 null 表示这不是沙箱产物引用,调用方应回落到默认渲染(普通图片、
* `resource://` 受保护图片、外链等一律不受影响)。
*/
export function renderArtifactReference(args: {
diff --git a/frontend/src/views/agent/AgentEditorModal.vue b/frontend/src/views/agent/AgentEditorModal.vue
index cab8dd12d..52e1108a2 100644
--- a/frontend/src/views/agent/AgentEditorModal.vue
+++ b/frontend/src/views/agent/AgentEditorModal.vue
@@ -1940,7 +1940,7 @@ const showMcpServiceSelect = computed(() =>
);
const webSearchProviderList = ref<WebSearchProviderEntity[]>([]);
const skillOptions = ref<{ name: string; description: string }[]>([]);
-// 是否允许启用 Skills(当前沙盒配置上有可执行技能时为 true;未选配置前为 false)
+// 是否允许启用 Skills(当前沙箱配置上有可执行技能时为 true;未选配置前为 false)
const skillsAvailable = ref(false);
const hasSandboxSelected = computed(() => !!formData.value.config.sandbox_config_id);
diff --git a/frontend/src/views/settings/EnvVarSettings.vue b/frontend/src/views/settings/EnvVarSettings.vue
index ebdd6d4d7..c5ae02808 100644
--- a/frontend/src/views/settings/EnvVarSettings.vue
+++ b/frontend/src/views/settings/EnvVarSettings.vue
@@ -1,7 +1,26 @@
<template>
<div class="env-settings">
<div class="section-header">
- <h2>{{ t('envVarSettings.title') }}</h2>
+ <div class="section-header__titlewrap">
+ <h2>{{ t('envVarSettings.title') }}</h2>
+ <t-popup placement="bottom-start" trigger="hover" :overlay-inner-style="{ maxWidth: '380px' }">
+ <button type="button" class="hint-trigger" :aria-label="t('envVarSettings.helpAria')">
+ <t-icon name="help-circle" size="16px" />
+ </button>
+ <template #content>
+ <div class="hint-popover">
+ <div class="hint-popover__block">
+ <p class="hint-popover__title">{{ t('envVarSettings.introPersonalTitle') }}</p>
+ <p class="hint-popover__text">{{ t('envVarSettings.introPersonalBody') }}</p>
+ </div>
+ <div class="hint-popover__block">
+ <p class="hint-popover__title">{{ t('envVarSettings.introRuntimeTitle') }}</p>
+ <p class="hint-popover__text">{{ t('envVarSettings.introRuntimeBody') }}</p>
+ </div>
+ </div>
+ </template>
+ </t-popup>
+ </div>
<p class="section-description">{{ t('envVarSettings.description') }}</p>
</div>
@@ -19,191 +38,353 @@
<p class="env-empty__desc">{{ t('envVarSettings.noConfigDescription') }}</p>
</div>
- <div v-else class="env-groups">
- <section v-for="group in groups" :key="group.sandbox_config_id" class="env-group">
- <h3 class="env-group__title">{{ configLabel(group) }}</h3>
-
- <!-- Config-wide variables: the member-side counterpart of the admin's
- sandbox env_vars, injected into every execution on this config. -->
- <div class="env-block">
- <div class="env-block__head">
- <div>
- <h4 class="env-block__title">{{ t('envVarSettings.sandboxTitle') }}</h4>
- <p class="env-block__hint">{{ t('envVarSettings.sandboxHint') }}</p>
- </div>
- <t-button variant="text" size="small" @click="addRow(group.sandbox_config_id)">
- <template #icon><t-icon name="add" /></template>
- {{ t('envVarSettings.addRow') }}
- </t-button>
- </div>
+ <template v-else>
+ <section class="env-section">
+ <header class="env-section__head">
+ <h3>{{ t('envVarSettings.skillTitle') }}</h3>
+ <p>{{ t('envVarSettings.skillHint') }}</p>
+ </header>
- <ul v-if="group.vars?.length" class="env-rows">
- <li v-for="entry in group.vars" :key="entry.name" class="env-row">
- <code class="env-row__name">{{ entry.name }}</code>
- <t-input
- v-model="drafts[sandboxKey(group.sandbox_config_id, entry.name)]"
- type="password"
- autocomplete="off"
- :aria-label="entry.name"
- :placeholder="t('envVarSettings.storedPlaceholder')"
- class="env-row__value"
- />
- <t-button
- theme="primary"
- size="small"
- :loading="busyKey === sandboxKey(group.sandbox_config_id, entry.name)"
- @click="saveSandbox(group, entry.name)"
- >
- {{ t('envVarSettings.save') }}
- </t-button>
- <t-popconfirm
- theme="warning"
- :content="t('envVarSettings.deleteConfirm', { name: entry.name })"
- :confirm-btn="{ content: t('envVarSettings.delete'), theme: 'danger' }"
- :cancel-btn="{ content: t('common.cancel') }"
- @confirm="deleteSandbox(group.sandbox_config_id, entry.name)"
- >
- <t-button
- theme="danger"
- variant="text"
- size="small"
- :loading="busyKey === sandboxKey(group.sandbox_config_id, entry.name)"
- >
- {{ t('envVarSettings.delete') }}
- </t-button>
- </t-popconfirm>
- <p v-if="entry.updated_at" class="env-row__meta">
- {{ t('envVarSettings.updatedAt', { time: formatTime(entry.updated_at) }) }}
- </p>
- </li>
- </ul>
- <p v-else-if="!newRows[group.sandbox_config_id]?.length" class="env-block__empty">
- {{ t('envVarSettings.sandboxEmpty') }}
- </p>
-
- <div v-if="newRows[group.sandbox_config_id]?.length" class="env-new-rows">
- <div
- v-for="(row, index) in newRows[group.sandbox_config_id]"
- :key="index"
- class="env-new-row"
- >
- <t-input
- v-model="row.name"
- autocomplete="off"
- :placeholder="t('envVarSettings.namePlaceholder')"
- :status="row.name && !isValidEnvName(row.name) ? 'error' : undefined"
- class="env-new-row__name"
- />
- <t-input
- v-model="row.value"
- type="password"
- autocomplete="off"
- :placeholder="t('envVarSettings.valuePlaceholder')"
- class="env-new-row__value"
- />
- <t-button
- theme="primary"
- size="small"
- :loading="busyKey === sandboxKey(group.sandbox_config_id, row.name)"
- @click="saveNewRow(group, index)"
- >
- {{ t('envVarSettings.save') }}
- </t-button>
- <t-button
- variant="text"
- shape="square"
- size="small"
- :aria-label="t('common.delete')"
- @click="removeRow(group.sandbox_config_id, index)"
- >
- <t-icon name="close" />
- </t-button>
- </div>
- <p class="env-block__rule">{{ t('envVarSettings.nameRule') }}</p>
- </div>
+ <div v-if="skillCards.length === 0" class="env-empty env-empty--soft">
+ <p class="env-empty__title">{{ t('envVarSettings.skillEmptyTitle') }}</p>
+ <p class="env-empty__desc">{{ t('envVarSettings.skillEmptyDesc') }}</p>
</div>
- <!-- Skill credentials: only what a skill declared, injected when a tool
- names that skill. -->
- <div v-if="group.skills?.length" class="env-block">
- <h4 class="env-block__title">{{ t('envVarSettings.skillTitle') }}</h4>
- <p class="env-block__hint">{{ t('envVarSettings.skillHint') }}</p>
-
- <div v-for="skill in group.skills" :key="skill.skill_id" class="env-skill">
- <h5 class="env-skill__title">{{ skill.skill_name || skill.skill_id }}</h5>
- <ul class="env-rows">
+ <div v-else class="env-skill-list">
+ <article v-for="card in skillCards" :key="`${card.sandbox_config_id}:${card.skill.skill_id}`" class="env-skill-card">
+ <header class="env-skill-card__head">
+ <div class="env-skill-card__identity">
+ <div class="env-skill-card__title">
+ <t-icon :name="SKILL_ICON" size="16px" class="env-group__icon" />
+ <h4>{{ card.skill.skill_name || card.skill.skill_id }}</h4>
+ <span
+ v-if="multipleSandboxes"
+ class="env-skill-card__sandbox"
+ :title="t('envVarSettings.skillOnSandbox', { name: card.sandbox_config_name })"
+ >
+ {{ card.sandbox_config_name }}
+ </span>
+ </div>
+ <p v-if="card.skill.description" class="env-group__desc" :title="card.skill.description">
+ {{ card.skill.description }}
+ </p>
+ </div>
+ <span
+ class="env-skill-card__status"
+ :class="blockingVarCount(card.skill.vars) ? 'is-needs' : 'is-ready'"
+ >
+ {{
+ blockingVarCount(card.skill.vars)
+ ? t('envVarSettings.skillNeedsCount', { count: blockingVarCount(card.skill.vars) })
+ : t('envVarSettings.skillReady')
+ }}
+ </span>
+ </header>
+
+ <ul class="env-secret-rows">
<li
- v-for="entry in skill.vars"
+ v-for="entry in card.skill.vars"
:key="entry.name"
- class="env-row env-row--declared"
- :class="{ 'env-row--blocking': statusOf(entry).blocking }"
+ class="env-kv"
+ :class="{ 'is-editing': isEditing(skillKey(card.skill.skill_id, entry.name)) }"
>
- <div class="env-row__head">
- <code class="env-row__name">{{ entry.name }}</code>
- <span v-if="entry.required" class="env-tag env-tag--required">
- {{ t('envVarSettings.requiredTag') }}
- </span>
- <span class="env-tag" :class="`env-tag--${statusOf(entry).key}`">
- {{ t(STATUS_LABEL[statusOf(entry).key]) }}
- </span>
+ <div class="env-kv__head">
+ <div class="env-kv__key">
+ <div class="env-secret__meta">
+ <code>{{ entry.name }}</code>
+ <span v-if="entry.required" class="env-tag env-tag--required">
+ {{ t('envVarSettings.requiredTag') }}
+ </span>
+ <span v-if="statusOf(entry).key === 'workspace'" class="env-tag env-tag--workspace">
+ {{ t(STATUS_LABEL.workspace) }}
+ </span>
+ </div>
+ <p v-if="entry.description" class="env-secret__desc" :title="entry.description">
+ {{ entry.description }}
+ </p>
+ <p v-if="entry.updated_at" class="env-secret__when">
+ {{ t('envVarSettings.updatedAt', { time: formatTime(entry.updated_at) }) }}
+ </p>
+ </div>
+ <div v-if="!isEditing(skillKey(card.skill.skill_id, entry.name))" class="env-kv__actions">
+ <t-button
+ variant="text"
+ theme="primary"
+ size="small"
+ shape="square"
+ :title="
+ statusOf(entry).key === 'unset'
+ ? t('envVarSettings.setValue')
+ : t('envVarSettings.replaceValue')
+ "
+ :aria-label="
+ statusOf(entry).key === 'unset'
+ ? t('envVarSettings.setValue')
+ : t('envVarSettings.replaceValue')
+ "
+ @click="startEdit(skillKey(card.skill.skill_id, entry.name))"
+ >
+ <template #icon><t-icon name="key" /></template>
+ </t-button>
+ <t-popconfirm
+ v-if="statusOf(entry).key === 'user'"
+ theme="warning"
+ :content="t('envVarSettings.clearConfirm', { name: entry.name })"
+ :confirm-btn="{ content: t('envVarSettings.clear'), theme: 'danger' }"
+ :cancel-btn="{ content: t('common.cancel') }"
+ @confirm="deleteSkill(card.skill.skill_id, entry.name)"
+ >
+ <t-button
+ theme="danger"
+ variant="text"
+ size="small"
+ shape="square"
+ :title="t('envVarSettings.clear')"
+ :aria-label="t('envVarSettings.clear')"
+ :loading="busyKey === skillKey(card.skill.skill_id, entry.name)"
+ >
+ <template #icon><t-icon name="delete" /></template>
+ </t-button>
+ </t-popconfirm>
+ </div>
</div>
-
- <p v-if="entry.description" class="env-row__desc">{{ entry.description }}</p>
-
- <p v-if="statusOf(entry).blocking" class="env-row__blocking">
- <t-icon name="error-circle-filled" />
- <span>{{ t('envVarSettings.blocking') }}</span>
- </p>
-
- <p v-if="entry.updated_at" class="env-row__meta">
- {{ t('envVarSettings.updatedAt', { time: formatTime(entry.updated_at) }) }}
- </p>
-
- <div class="env-row__editor">
+ <div v-if="isEditing(skillKey(card.skill.skill_id, entry.name))" class="env-kv__editor">
<t-input
- v-model="drafts[skillKey(skill.skill_id, entry.name)]"
+ ref="editorInput"
+ :value="drafts[skillKey(card.skill.skill_id, entry.name)] ?? ''"
type="password"
- autocomplete="off"
+ autocomplete="new-password"
+ :name="`wk-me-${card.skill.skill_id}-${entry.name.length}`"
+ spellcheck="false"
+ data-lpignore="true"
+ data-1p-ignore="true"
+ data-bwignore="true"
:aria-label="entry.name"
- :placeholder="t('envVarSettings.valuePlaceholder')"
+ :placeholder="
+ statusOf(entry).key === 'unset'
+ ? t('envVarSettings.valuePlaceholder')
+ : t('envVarSettings.storedPlaceholder')
+ "
+ @update:value="(v: string) => setDraft(skillKey(card.skill.skill_id, entry.name), v)"
+ @enter="saveSkill(card.skill, entry)"
/>
<t-button
+ variant="text"
theme="primary"
size="small"
- :loading="busyKey === skillKey(skill.skill_id, entry.name)"
- @click="saveSkill(skill, entry)"
+ shape="square"
+ :title="t('envVarSettings.save')"
+ :aria-label="t('envVarSettings.save')"
+ :loading="busyKey === skillKey(card.skill.skill_id, entry.name)"
+ @click="saveSkill(card.skill, entry)"
>
- {{ t('envVarSettings.save') }}
+ <template #icon><t-icon name="check" /></template>
</t-button>
- <t-popconfirm
- v-if="statusOf(entry).key === 'user'"
- theme="warning"
- :content="t('envVarSettings.clearConfirm', { name: entry.name })"
- :confirm-btn="{ content: t('envVarSettings.clear'), theme: 'danger' }"
- :cancel-btn="{ content: t('common.cancel') }"
- @confirm="deleteSkill(skill.skill_id, entry.name)"
+ <t-button
+ variant="text"
+ size="small"
+ shape="square"
+ :title="t('common.cancel')"
+ :aria-label="t('common.cancel')"
+ @click="cancelEdit(skillKey(card.skill.skill_id, entry.name))"
+ >
+ <template #icon><t-icon name="close" /></template>
+ </t-button>
+ </div>
+ </li>
+ </ul>
+ </article>
+ </div>
+ </section>
+
+ <section class="env-section env-section--aside">
+ <header class="env-section__head env-section__head--row">
+ <div>
+ <h3>{{ t('envVarSettings.sandboxTitle') }}</h3>
+ <p>{{ t('envVarSettings.sandboxHint') }}</p>
+ </div>
+ <t-button
+ v-if="!addingSandbox"
+ variant="text"
+ size="small"
+ shape="square"
+ :title="t('envVarSettings.addRow')"
+ :aria-label="t('envVarSettings.addRow')"
+ @click="startAddSandbox"
+ >
+ <template #icon><t-icon name="add" /></template>
+ </t-button>
+ </header>
+
+ <div v-if="addingSandbox" class="env-composer">
+ <t-select
+ v-if="multipleSandboxes"
+ v-model="sandboxDraft.configId"
+ :options="sandboxOptions"
+ :placeholder="t('envVarSettings.sandboxPick')"
+ class="env-composer__sandbox"
+ />
+ <div class="env-new-row">
+ <t-input
+ v-model="sandboxDraft.name"
+ autocomplete="off"
+ :placeholder="t('envVarSettings.namePlaceholder')"
+ :status="sandboxDraft.name && !isValidEnvName(sandboxDraft.name) ? 'error' : undefined"
+ class="env-new-row__name"
+ />
+ <t-input
+ :value="sandboxDraft.value"
+ type="password"
+ autocomplete="new-password"
+ :placeholder="t('envVarSettings.valuePlaceholder')"
+ class="env-new-row__value"
+ @update:value="(v: string) => { sandboxDraft.value = v }"
+ />
+ <t-button
+ variant="text"
+ theme="primary"
+ size="small"
+ shape="square"
+ :title="t('envVarSettings.save')"
+ :aria-label="t('envVarSettings.save')"
+ :loading="busyKey === 'sandbox-new'"
+ @click="saveNewSandboxRow"
+ >
+ <template #icon><t-icon name="check" /></template>
+ </t-button>
+ <t-button
+ variant="text"
+ shape="square"
+ size="small"
+ :title="t('common.cancel')"
+ :aria-label="t('common.cancel')"
+ @click="cancelAddSandbox"
+ >
+ <template #icon><t-icon name="close" /></template>
+ </t-button>
+ </div>
+ <p class="env-sandbox-card__empty">{{ t('envVarSettings.nameRule') }}</p>
+ </div>
+
+ <div v-if="sandboxCards.length" class="env-sandbox-list">
+ <article v-for="group in sandboxCards" :key="group.sandbox_config_id" class="env-sandbox-card">
+ <div class="env-skill-card__title">
+ <svg class="env-group__icon" width="16" height="16" viewBox="0 0 18 18" fill="none" aria-hidden="true">
+ <rect x="2.5" y="3" width="13" height="12" rx="2" stroke="currentColor" stroke-width="1.2" fill="none" />
+ <path d="M2.5 6.5h13" stroke="currentColor" stroke-width="1.2" />
+ <path d="M5.5 10h4M5.5 12.5h2.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" />
+ </svg>
+ <h4>{{ configLabel(group) }}</h4>
+ </div>
+ <p v-if="group.description" class="env-group__desc" :title="group.description">
+ {{ group.description }}
+ </p>
+ <ul class="env-sandbox-rows">
+ <li
+ v-for="entry in group.vars"
+ :key="entry.name"
+ class="env-kv"
+ :class="{ 'is-editing': isEditing(sandboxKey(group.sandbox_config_id, entry.name)) }"
+ >
+ <div class="env-kv__head">
+ <div class="env-kv__key">
+ <code>{{ entry.name }}</code>
+ <p v-if="entry.updated_at" class="env-secret__when">
+ {{ t('envVarSettings.updatedAt', { time: formatTime(entry.updated_at) }) }}
+ </p>
+ </div>
+ <div
+ v-if="!isEditing(sandboxKey(group.sandbox_config_id, entry.name))"
+ class="env-kv__actions"
>
<t-button
- theme="danger"
variant="text"
+ theme="primary"
size="small"
- :loading="busyKey === skillKey(skill.skill_id, entry.name)"
+ shape="square"
+ :title="t('envVarSettings.replaceValue')"
+ :aria-label="t('envVarSettings.replaceValue')"
+ @click="startEdit(sandboxKey(group.sandbox_config_id, entry.name))"
>
- {{ t('envVarSettings.clear') }}
+ <template #icon><t-icon name="key" /></template>
</t-button>
- </t-popconfirm>
+ <t-popconfirm
+ theme="warning"
+ :content="t('envVarSettings.deleteConfirm', { name: entry.name })"
+ :confirm-btn="{ content: t('envVarSettings.delete'), theme: 'danger' }"
+ :cancel-btn="{ content: t('common.cancel') }"
+ @confirm="deleteSandbox(group.sandbox_config_id, entry.name)"
+ >
+ <t-button
+ theme="danger"
+ variant="text"
+ size="small"
+ shape="square"
+ :title="t('envVarSettings.delete')"
+ :aria-label="t('envVarSettings.delete')"
+ :loading="busyKey === sandboxKey(group.sandbox_config_id, entry.name)"
+ >
+ <template #icon><t-icon name="delete" /></template>
+ </t-button>
+ </t-popconfirm>
+ </div>
+ </div>
+ <div
+ v-if="isEditing(sandboxKey(group.sandbox_config_id, entry.name))"
+ class="env-kv__editor"
+ >
+ <t-input
+ ref="editorInput"
+ :value="drafts[sandboxKey(group.sandbox_config_id, entry.name)] ?? ''"
+ type="password"
+ autocomplete="new-password"
+ :name="`wk-sb-${group.sandbox_config_id.slice(0, 8)}`"
+ spellcheck="false"
+ data-lpignore="true"
+ data-1p-ignore="true"
+ data-bwignore="true"
+ :aria-label="entry.name"
+ :placeholder="t('envVarSettings.storedPlaceholder')"
+ @update:value="(v: string) => setDraft(sandboxKey(group.sandbox_config_id, entry.name), v)"
+ @enter="saveSandbox(group, entry.name)"
+ />
+ <t-button
+ variant="text"
+ theme="primary"
+ size="small"
+ shape="square"
+ :title="t('envVarSettings.save')"
+ :aria-label="t('envVarSettings.save')"
+ :loading="busyKey === sandboxKey(group.sandbox_config_id, entry.name)"
+ @click="saveSandbox(group, entry.name)"
+ >
+ <template #icon><t-icon name="check" /></template>
+ </t-button>
+ <t-button
+ variant="text"
+ size="small"
+ shape="square"
+ :title="t('common.cancel')"
+ :aria-label="t('common.cancel')"
+ @click="cancelEdit(sandboxKey(group.sandbox_config_id, entry.name))"
+ >
+ <template #icon><t-icon name="close" /></template>
+ </t-button>
</div>
</li>
</ul>
- </div>
+ </article>
</div>
+ <p v-else-if="!addingSandbox" class="env-sandbox-card__empty">
+ {{ t('envVarSettings.sandboxEmpty') }}
+ </p>
</section>
- </div>
+ </template>
</div>
</template>
<script setup lang="ts">
-import { onMounted, reactive, ref } from 'vue'
+import { computed, nextTick, onMounted, reactive, ref } from 'vue'
import { MessagePlugin } from 'tdesign-vue-next'
import { useI18n } from 'vue-i18n'
import {
@@ -217,13 +398,17 @@ import {
type EnvVarView,
type SkillEnvGroup,
} from '@/api/env-vars'
+import { SKILL_ICON } from '@/types/mention'
import {
MAX_ENV_VALUE_BYTES,
MAX_USER_ENV_VARS_PER_SCOPE,
+ blockingVarCount,
canAddEnvVar,
configLabel,
isValidEnvName,
isValidEnvValueLength,
+ sandboxGroupsWithVars,
+ skillSecretCards,
sortedConfigGroups,
statusOf,
} from './envVarState'
@@ -240,10 +425,23 @@ const loading = ref(true)
const loadError = ref('')
const groups = ref<ConfigEnvGroup[]>([])
+const skillCards = computed(() => skillSecretCards(groups.value))
+const sandboxCards = computed(() => sandboxGroupsWithVars(groups.value))
+const multipleSandboxes = computed(() => groups.value.length > 1)
+const sandboxOptions = computed(() =>
+ groups.value.map((group) => ({
+ label: configLabel(group),
+ value: group.sandbox_config_id,
+ })),
+)
+
// Drafts are keyed by scope and name rather than held on the row, so a reload
// cannot silently discard what is half-typed elsewhere on the page.
const drafts = reactive<Record<string, string>>({})
-const newRows = reactive<Record<string, Array<{ name: string; value: string }>>>({})
+const editingKey = ref('')
+const editorInput = ref<{ focus?: () => void } | null>(null)
+const addingSandbox = ref(false)
+const sandboxDraft = reactive({ configId: '', name: '', value: '' })
const busyKey = ref('')
function skillKey(skillId: string, name: string): string {
@@ -254,6 +452,25 @@ function sandboxKey(configId: string, name: string): string {
return `sandbox:${configId}:${name}`
}
+function setDraft(key: string, value: string) {
+ drafts[key] = value ?? ''
+}
+
+function isEditing(key: string) {
+ return editingKey.value === key
+}
+
+async function startEdit(key: string) {
+ editingKey.value = key
+ await nextTick()
+ editorInput.value?.focus?.()
+}
+
+function cancelEdit(key: string) {
+ if (editingKey.value === key) editingKey.value = ''
+ delete drafts[key]
+}
+
function formatTime(value: string): string {
const date = new Date(value)
if (Number.isNaN(date.getTime())) return value
@@ -294,6 +511,7 @@ async function submit(key: string, action: () => Promise<unknown>, successMessag
// Write-only by design: the value is stored and never echoed, so leaving it
// in the input would keep a secret in the DOM for no benefit.
delete drafts[key]
+ if (editingKey.value === key) editingKey.value = ''
MessagePlugin.success(successMessage)
await load()
} catch (e: any) {
@@ -341,19 +559,27 @@ async function deleteSandbox(configId: string, name: string) {
)
}
-function addRow(configId: string) {
- if (!newRows[configId]) newRows[configId] = []
- newRows[configId].push({ name: '', value: '' })
+function startAddSandbox() {
+ addingSandbox.value = true
+ sandboxDraft.configId = groups.value[0]?.sandbox_config_id || ''
+ sandboxDraft.name = ''
+ sandboxDraft.value = ''
}
-function removeRow(configId: string, index: number) {
- newRows[configId]?.splice(index, 1)
+function cancelAddSandbox() {
+ addingSandbox.value = false
+ sandboxDraft.configId = ''
+ sandboxDraft.name = ''
+ sandboxDraft.value = ''
}
-async function saveNewRow(group: ConfigEnvGroup, index: number) {
- const row = newRows[group.sandbox_config_id]?.[index]
- if (!row) return
- const name = row.name.trim()
+async function saveNewSandboxRow() {
+ const group = groups.value.find((item) => item.sandbox_config_id === sandboxDraft.configId)
+ if (!group) {
+ MessagePlugin.warning(t('envVarSettings.sandboxPick'))
+ return
+ }
+ const name = sandboxDraft.name.trim()
if (!isValidEnvName(name)) {
MessagePlugin.error(t('envVarSettings.nameInvalid'))
return
@@ -362,16 +588,15 @@ async function saveNewRow(group: ConfigEnvGroup, index: number) {
MessagePlugin.error(t('envVarSettings.nameDuplicate'))
return
}
- if (rejectBadValue(row.value)) return
+ if (rejectBadValue(sandboxDraft.value)) return
if (!canAddEnvVar(group.vars || [], name)) {
MessagePlugin.error(t('envVarSettings.tooManyValues', { max: MAX_USER_ENV_VARS_PER_SCOPE }))
return
}
- const key = sandboxKey(group.sandbox_config_id, name)
- busyKey.value = key
+ busyKey.value = 'sandbox-new'
try {
- await setMySandboxEnv(group.sandbox_config_id, name, row.value)
- removeRow(group.sandbox_config_id, index)
+ await setMySandboxEnv(group.sandbox_config_id, name, sandboxDraft.value)
+ cancelAddSandbox()
MessagePlugin.success(t('envVarSettings.saveSuccess'))
await load()
} catch (e: any) {
@@ -398,17 +623,62 @@ onMounted(() => {
font-size: 20px;
font-weight: 600;
color: var(--td-text-color-primary);
- margin: 0 0 8px 0;
+ margin: 0;
}
.section-description {
font-size: 14px;
color: var(--td-text-color-secondary);
- margin: 0;
+ margin: 8px 0 0;
line-height: 1.6;
}
}
+.section-header__titlewrap {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+
+.hint-trigger {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ padding: 2px;
+ border: none;
+ border-radius: 4px;
+ background: transparent;
+ color: var(--td-text-color-placeholder);
+ cursor: help;
+ line-height: 1;
+
+ &:hover,
+ &:focus-visible {
+ color: var(--td-brand-color);
+ }
+}
+
+.hint-popover {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ max-width: 340px;
+}
+
+.hint-popover__title {
+ margin: 0;
+ color: var(--td-text-color-primary);
+ font-size: 13px;
+ font-weight: 600;
+}
+
+.hint-popover__text {
+ margin: 4px 0 0;
+ color: var(--td-text-color-secondary);
+ font-size: 12px;
+ line-height: 1.55;
+}
+
.env-state {
display: flex;
align-items: center;
@@ -425,11 +695,15 @@ onMounted(() => {
.env-empty {
background: var(--td-bg-color-secondarycontainer);
- border-radius: 8px;
+ border-radius: 10px;
padding: 24px;
text-align: center;
}
+.env-empty--soft {
+ padding: 16px;
+}
+
.env-empty__title {
font-size: 14px;
font-weight: 500;
@@ -443,115 +717,195 @@ onMounted(() => {
margin: 0;
}
-.env-groups {
+.env-section__head {
+ margin-bottom: 12px;
+
+ h3 {
+ margin: 0;
+ font-size: 15px;
+ font-weight: 600;
+ color: var(--td-text-color-primary);
+ }
+
+ p {
+ margin: 4px 0 0;
+ font-size: 13px;
+ line-height: 1.55;
+ color: var(--td-text-color-secondary);
+ }
+}
+
+.env-section__head--row {
display: flex;
- flex-direction: column;
- gap: 20px;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 12px;
}
-.env-group {
- border: 1px solid var(--td-component-stroke);
- border-radius: 8px;
- padding: 16px;
- background: var(--td-bg-color-container);
+.env-composer {
+ margin-bottom: 12px;
+ padding: 12px 14px;
+ border: 1px dashed var(--td-component-stroke);
+ border-radius: 10px;
+ background: var(--td-bg-color-secondarycontainer);
}
-.env-group__title {
- font-size: 15px;
- font-weight: 600;
- color: var(--td-text-color-primary);
- margin: 0 0 12px 0;
+.env-composer__sandbox {
+ width: 100%;
+ max-width: 280px;
+ margin-bottom: 8px;
}
-.env-block + .env-block {
- margin-top: 16px;
- padding-top: 12px;
+.env-section--aside {
+ margin-top: 32px;
+ padding-top: 24px;
border-top: 1px solid var(--td-component-stroke);
}
-.env-block__head {
+.env-skill-list,
+.env-sandbox-list {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+}
+
+.env-skill-card,
+.env-sandbox-card {
+ border: 1px solid var(--td-component-stroke);
+ border-radius: 10px;
+ padding: 14px 16px;
+ background: var(--td-bg-color-container);
+}
+
+.env-skill-card__head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
-.env-block__title {
- font-size: 13px;
+.env-skill-card__identity h4,
+.env-sandbox-card h4 {
+ margin: 0;
+ font-size: 14px;
font-weight: 600;
color: var(--td-text-color-primary);
- margin: 0;
}
-.env-block__hint {
- margin: 2px 0 0;
+.env-skill-card__title {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex-wrap: wrap;
+}
+
+.env-group__icon {
+ flex-shrink: 0;
+ color: var(--td-text-color-secondary);
+}
+
+.env-group__desc {
+ margin: 6px 0 0;
font-size: 12px;
- line-height: 1.5;
+ line-height: 1.55;
color: var(--td-text-color-secondary);
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
}
-.env-block__empty,
-.env-block__rule {
- margin: 8px 0 0;
+.env-skill-card__sandbox {
font-size: 12px;
- line-height: 1.5;
+ font-weight: 400;
color: var(--td-text-color-placeholder);
}
-.env-rows {
- margin: 10px 0 0;
+.env-skill-card__status {
+ flex-shrink: 0;
+ font-size: 12px;
+ line-height: 20px;
+ padding: 0 8px;
+ border-radius: 10px;
+ background: var(--td-success-color-light);
+ color: var(--td-success-color);
+
+ &.is-needs {
+ background: var(--td-bg-color-secondarycontainer);
+ color: var(--td-text-color-secondary);
+ }
+}
+
+.env-secret-rows,
+.env-sandbox-rows {
+ margin: 12px 0 0;
padding: 0;
list-style: none;
display: flex;
flex-direction: column;
- gap: 10px;
+ gap: 0;
}
-.env-row {
- display: flex;
- align-items: center;
- gap: 8px;
- flex-wrap: wrap;
+.env-kv {
+ padding: 10px 0;
}
-.env-row--declared {
- display: block;
- border: 1px solid var(--td-component-stroke);
- border-radius: 6px;
- padding: 12px;
+.env-kv + .env-kv {
+ border-top: 1px solid var(--td-component-stroke);
}
-// A required variable nobody has filled in stops the skill from running, so it
-// reads as an error rather than as one more grey "not set" row.
-.env-row--blocking {
- border-color: var(--td-error-color);
- background: var(--td-error-color-light);
+.env-kv__head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 12px;
}
-.env-row__head {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 8px;
+.env-kv__key {
+ min-width: 0;
+ flex: 1;
+
+ code {
+ font-family: var(--td-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
+ font-size: 13px;
+ color: var(--td-text-color-primary);
+ overflow-wrap: anywhere;
+ }
}
-.env-row__name {
- font-family: var(--td-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
- font-size: 13px;
- color: var(--td-text-color-primary);
- overflow-wrap: anywhere;
- flex: 0 0 30%;
+.env-kv__actions {
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+ margin: -4px -4px 0 0;
}
-.env-row--declared .env-row__name {
- flex: initial;
+.env-kv__editor {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ margin-top: 8px;
}
-.env-row__value {
+.env-kv__editor :deep(.t-input__wrap) {
flex: 1;
min-width: 0;
}
+.env-secret__meta {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 6px;
+
+ code {
+ font-family: var(--td-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
+ font-size: 13px;
+ color: var(--td-text-color-primary);
+ overflow-wrap: anywhere;
+ }
+}
+
.env-tag {
font-size: 12px;
line-height: 18px;
@@ -576,71 +930,56 @@ onMounted(() => {
color: var(--td-brand-color);
}
-.env-row__desc,
-.env-row__meta {
- margin: 6px 0 0;
+.env-secret__desc,
+.env-secret__when {
+ margin: 4px 0 0;
font-size: 12px;
line-height: 1.5;
color: var(--td-text-color-secondary);
}
-.env-row__meta {
- color: var(--td-text-color-placeholder);
- flex-basis: 100%;
+.env-secret__desc {
+ display: -webkit-box;
+ -webkit-line-clamp: 1;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
}
-.env-row__blocking {
- display: flex;
- align-items: center;
- gap: 6px;
- margin: 6px 0 0;
- font-size: 12px;
- line-height: 1.5;
- color: var(--td-error-color);
+.env-secret__when {
+ color: var(--td-text-color-placeholder);
}
-.env-row__editor {
+.env-new-row {
display: flex;
align-items: center;
gap: 8px;
- margin-top: 10px;
}
-.env-row__editor :deep(.t-input__wrap) {
+.env-new-row__value {
flex: 1;
min-width: 0;
}
-.env-skill {
- margin-top: 12px;
-}
-
-.env-skill__title {
- font-size: 13px;
- font-weight: 600;
- color: var(--td-text-color-primary);
- margin: 0;
-}
-
-.env-new-rows {
- margin-top: 10px;
- display: flex;
- flex-direction: column;
- gap: 8px;
-}
-
-.env-new-row {
- display: flex;
- align-items: center;
- gap: 8px;
+.env-sandbox-card__empty {
+ margin: 8px 0 0;
+ font-size: 12px;
+ line-height: 1.5;
+ color: var(--td-text-color-placeholder);
}
.env-new-row__name {
- flex: 0 0 30%;
+ flex: 0 0 34%;
}
-.env-new-row__value {
- flex: 1;
- min-width: 0;
+@media (max-width: 720px) {
+ .env-kv__head {
+ flex-wrap: wrap;
+ }
+
+ .env-new-row,
+ .env-new-row__name {
+ flex-wrap: wrap;
+ flex-basis: 100%;
+ }
}
</style>
diff --git a/frontend/src/views/settings/Settings.vue b/frontend/src/views/settings/Settings.vue
index 75242713a..ec0cef25b 100644
--- a/frontend/src/views/settings/Settings.vue
+++ b/frontend/src/views/settings/Settings.vue
@@ -133,7 +133,7 @@
<MemorySettings />
</div>
- <!-- 技能凭据(成员自己的技能环境变量) -->
+ <!-- 沙箱密钥(成员自己的技能 / 沙箱密钥) -->
<div v-if="currentSection === 'envvars'" class="section">
<EnvVarSettings />
</div>
@@ -379,7 +379,7 @@ const navItems = computed(() => {
{ key: 'system-audit-log', icon: 'history', label: t('system.globalSettings.audit.tabLabel') },
{ key: 'userprofile', icon: 'user', label: t('userProfile.title') },
{ key: 'mymemory', icon: 'bookmark', label: t('memorySettings.title') },
- { key: 'envvars', icon: 'lock-on', label: t('envVarSettings.title') },
+ { key: 'envvars', icon: 'key', label: t('envVarSettings.title') },
{ key: 'tenant', icon: 'user-circle', label: t('settings.tenantInfo') },
{ key: 'members', icon: 'usergroup', label: t('tenantMember.title') },
...integrationItems,
diff --git a/frontend/src/views/settings/envVarState.test.ts b/frontend/src/views/settings/envVarState.test.ts
index d814fb81d..c95f59ac4 100644
--- a/frontend/src/views/settings/envVarState.test.ts
+++ b/frontend/src/views/settings/envVarState.test.ts
@@ -8,6 +8,7 @@ import {
RESERVED_ENV_NAMES,
addSkillEnvSaveInFlight,
adminSkillEnvClearPayload,
+ blockingVarCount,
canAddEnvVar,
canClearAdminSkillEnv,
clearSkillEnvSaveInFlight,
@@ -18,6 +19,8 @@ import {
isValidEnvName,
isValidEnvValueLength,
skillHasDeclaredEnvs,
+ skillSecretCards,
+ sandboxGroupsWithVars,
sortedConfigGroups,
statusOf,
} from './envVarState'
@@ -239,3 +242,40 @@ test('skill env save completion removes exactly its own in-flight entry', () =>
assert.equal(isSkillEnvSaveInFlight(remaining, 'cfg-a', 'skill-s'), false)
assert.equal(isSkillEnvSaveInFlight(remaining, 'cfg-b', 'skill-t'), true)
})
+
+test('sandboxGroupsWithVars keeps only configs that already have stored values', () => {
+ const populated = sandboxGroupsWithVars([
+ config('c1', 'cube-TEST'),
+ config('c2', 'Docker-Test', [envVar({ name: 'PROXY', source: 'user' })]),
+ config('c3', 'Empty', []),
+ ])
+
+ assert.equal(populated.length, 1)
+ assert.equal(populated[0].sandbox_config_id, 'c2')
+})
+
+test('blockingVarCount counts only required names with no value at all', () => {
+ assert.equal(blockingVarCount(undefined), 0)
+ assert.equal(
+ blockingVarCount([
+ envVar({ name: 'A', required: true, source: 'unset' }),
+ envVar({ name: 'B', required: true, source: 'user' }),
+ envVar({ name: 'C', required: false, source: 'unset' }),
+ ]),
+ 1,
+ )
+})
+
+test('skillSecretCards lifts declared skills out of config groups and skips empty ones', () => {
+ const cards = skillSecretCards([
+ config('c2', 'Docker-Test', [], [
+ skill('weknora', 'weknora', [envVar({ name: 'WEKNORA_API_KEY', required: true })]),
+ ]),
+ config('c1', 'cube-TEST'),
+ config('c3', 'Other', [], [skill('empty', 'empty', [])]),
+ ])
+
+ assert.equal(cards.length, 1)
+ assert.equal(cards[0].skill.skill_id, 'weknora')
+ assert.equal(cards[0].sandbox_config_name, 'Docker-Test')
+})
diff --git a/frontend/src/views/settings/envVarState.ts b/frontend/src/views/settings/envVarState.ts
index f1e517a69..04072c70f 100644
--- a/frontend/src/views/settings/envVarState.ts
+++ b/frontend/src/views/settings/envVarState.ts
@@ -1,4 +1,4 @@
-import type { ConfigEnvGroup, EnvVarSource, EnvVarView } from '@/api/env-vars'
+import type { ConfigEnvGroup, EnvVarSource, EnvVarView, SkillEnvGroup } from '@/api/env-vars'
/**
* Pure state helpers for the environment variable UIs.
@@ -165,3 +165,47 @@ export function sortedConfigGroups(groups: ConfigEnvGroup[]): ConfigEnvGroup[] {
return a.sandbox_config_id.localeCompare(b.sandbox_config_id)
})
}
+
+/**
+ * Sandbox-wide extras the member already stored. Empty configs stay off the
+ * settings page — listing every backend as a blank card is noise.
+ */
+export function sandboxGroupsWithVars(groups: ConfigEnvGroup[]): ConfigEnvGroup[] {
+ return groups.filter((group) => (group.vars?.length ?? 0) > 0)
+}
+
+/** How many required declarations still have no user or workspace value. */
+export function blockingVarCount(vars: EnvVarView[] | undefined): number {
+ return (vars || []).filter((entry) => statusOf(entry).blocking).length
+}
+
+/**
+ * One skill's credentials, lifted out of the config group it was installed on.
+ * The settings page leads with these; sandbox-wide extras stay secondary.
+ */
+export interface SkillSecretCard {
+ sandbox_config_id: string
+ sandbox_config_name: string
+ skill: SkillEnvGroup
+}
+
+export function skillSecretCards(groups: ConfigEnvGroup[]): SkillSecretCard[] {
+ const cards: SkillSecretCard[] = []
+ for (const group of groups) {
+ for (const skill of group.skills || []) {
+ if (!skill.vars?.length) continue
+ cards.push({
+ sandbox_config_id: group.sandbox_config_id,
+ sandbox_config_name: configLabel(group),
+ skill,
+ })
+ }
+ }
+ return cards.sort((a, b) => {
+ const bySkill = (a.skill.skill_name || a.skill.skill_id).localeCompare(
+ b.skill.skill_name || b.skill.skill_id,
+ )
+ if (bySkill !== 0) return bySkill
+ return a.sandbox_config_name.localeCompare(b.sandbox_config_name)
+ })
+}
diff --git a/internal/agent/skills/env_resolver.go b/internal/agent/skills/env_resolver.go
index 5418dfe38..9782e9162 100644
--- a/internal/agent/skills/env_resolver.go
+++ b/internal/agent/skills/env_resolver.go
@@ -42,7 +42,7 @@ func (e *MissingSkillEnvError) Error() string {
"skill %q needs the environment variable(s) %s, which nobody has set yet. "+
"Ask the user for them, then run the skill through shell_exec with "+
"skill_name=%q and the values in env — they are stored for that user "+
- "afterwards. They can also be set under Settings → Environment variables.",
+ "afterwards. They can also be set under Settings → Sandbox secrets.",
e.SkillName, strings.Join(e.Names, ", "), e.SkillName,
)
}
diff --git a/internal/agent/skills/env_resolver_test.go b/internal/agent/skills/env_resolver_test.go
index 6cc2b11fc..e837cb5c7 100644
--- a/internal/agent/skills/env_resolver_test.go
+++ b/internal/agent/skills/env_resolver_test.go
@@ -48,7 +48,7 @@ func TestMissingSkillEnvErrorMessageNamesSkillVarsAndWhereToSetThem(t *testing.T
require.Contains(t, msg, "web-search")
require.Contains(t, msg, "TAVILY_API_KEY")
require.Contains(t, msg, "SERP_TOKEN")
- require.Contains(t, msg, "Environment variables")
+ require.Contains(t, msg, "Sandbox secrets")
var typed *MissingSkillEnvError
require.True(t, errors.As(err, &typed))
diff --git a/internal/agent/tools/shell_exec.go b/internal/agent/tools/shell_exec.go
index 8ea7c2ac8..bbcb99553 100644
--- a/internal/agent/tools/shell_exec.go
+++ b/internal/agent/tools/shell_exec.go
@@ -432,7 +432,7 @@ func (t *ShellExecTool) Execute(ctx context.Context, args json.RawMessage) (*typ
Error: fmt.Sprintf(
"skill %q needs the environment variable(s) %s, which nobody has set yet. "+
"Ask the user for them and pass them in this call's env, "+
- "or have them set the values under Settings → Environment variables.",
+ "or have them set the values under Settings → Sandbox secrets.",
input.SkillName, strings.Join(missing, ", ")),
}, nil
}
diff --git a/internal/application/service/user_env.go b/internal/application/service/user_env.go
index 80cdc477b..27a021f7d 100644
--- a/internal/application/service/user_env.go
+++ b/internal/application/service/user_env.go
@@ -36,12 +36,14 @@ type EnvVarView struct {
}
// SkillEnvGroup is one skill's declared credentials. It carries the skill's
-// identity and nothing else about it — not the instructions, not the bundle,
-// not the install state, all of which are Admin+ disclosure.
+// identity (name and the SKILL.md one-liner) and nothing else about it — not
+// the instructions, not the bundle, not the install state, all of which are
+// Admin+ disclosure.
type SkillEnvGroup struct {
- SkillID string `json:"skill_id"`
- SkillName string `json:"skill_name"`
- Vars []EnvVarView `json:"vars"`
+ SkillID string `json:"skill_id"`
+ SkillName string `json:"skill_name"`
+ Description string `json:"description,omitempty"`
+ Vars []EnvVarView `json:"vars"`
}
// ConfigEnvGroup is one sandbox config: the caller's own config-wide variables
@@ -49,6 +51,7 @@ type SkillEnvGroup struct {
type ConfigEnvGroup struct {
SandboxConfigID string `json:"sandbox_config_id"`
SandboxConfigName string `json:"sandbox_config_name"`
+ Description string `json:"description,omitempty"`
Vars []EnvVarView `json:"vars"`
Skills []SkillEnvGroup `json:"skills"`
}
@@ -145,14 +148,16 @@ func (s *UserEnvService) ListMine(ctx context.Context) ([]ConfigEnvGroup, error)
group := ConfigEnvGroup{
SandboxConfigID: cfg.ID,
SandboxConfigName: cfg.Name,
+ Description: cfg.Description,
Vars: configWideViews(mineBySkill[""]),
Skills: make([]SkillEnvGroup, 0, len(skillsByConfig[cfg.ID])),
}
for _, row := range skillsByConfig[cfg.ID] {
group.Skills = append(group.Skills, SkillEnvGroup{
- SkillID: row.ID,
- SkillName: row.Name,
- Vars: declaredViews(row.Envs, mineBySkill[row.ID]),
+ SkillID: row.ID,
+ SkillName: row.Name,
+ Description: row.Description,
+ Vars: declaredViews(row.Envs, mineBySkill[row.ID]),
})
}
// The repository orders skills by creation; sorting by name is what
diff --git a/internal/application/service/user_env_test.go b/internal/application/service/user_env_test.go
index d430aaa20..a2e943143 100644
--- a/internal/application/service/user_env_test.go
+++ b/internal/application/service/user_env_test.go
@@ -86,7 +86,8 @@ func newUserEnvFixture(t *testing.T) (*UserEnvService, *installSkillRepo) {
for _, skill := range []*types.TenantSkillEntity{
{
ID: "sk-ready", TenantID: userEnvTenantID, SandboxConfigID: "cfg-1",
- Name: "pdf-tools", Enabled: true, Status: types.SkillStatusReady,
+ Name: "pdf-tools", Description: "Extracts text from PDFs",
+ Enabled: true, Status: types.SkillStatusReady,
Envs: types.SkillEnvVars{
{Name: "API_TOKEN", Description: "workspace token", Required: true, Value: "admin-secret"},
{Name: "USER_TOKEN", Description: "your own token", Required: true},
@@ -116,7 +117,7 @@ func newUserEnvFixture(t *testing.T) (*UserEnvService, *installSkillRepo) {
require.NoError(t, repo.CreateSkill(ctx, skill))
}
configs := &userEnvConfigRepo{rows: []*types.TenantSandboxConfigEntity{
- {ID: "cfg-1", TenantID: userEnvTenantID, Name: "Production"},
+ {ID: "cfg-1", TenantID: userEnvTenantID, Name: "Production", Description: "Prod cluster"},
{ID: "cfg-2", TenantID: userEnvTenantID, Name: "Staging"},
{ID: "cfg-9", TenantID: 8, Name: "Theirs"},
}}
@@ -165,6 +166,7 @@ func TestListMineReportsTheThreeSourceStates(t *testing.T) {
require.NoError(t, err)
skill := skillByID(t, configByID(t, groups, "cfg-1"), "sk-ready")
require.Equal(t, "pdf-tools", skill.SkillName)
+ require.Equal(t, "Extracts text from PDFs", skill.Description)
workspace := viewByName(t, skill.Vars, "API_TOKEN")
require.Equal(t, EnvSourceWorkspace, workspace.Source)
@@ -188,7 +190,9 @@ func TestListMineListsEveryConfigWithItsName(t *testing.T) {
require.NoError(t, err)
require.Len(t, groups, 2)
require.Equal(t, "Production", groups[0].SandboxConfigName)
+ require.Equal(t, "Prod cluster", groups[0].Description)
require.Equal(t, "Staging", groups[1].SandboxConfigName)
+ require.Empty(t, groups[1].Description)
require.Empty(t, configByID(t, groups, "cfg-2").Skills)
}
diff --git a/internal/handler/skill_handler.go b/internal/handler/skill_handler.go
index d27735500..221cd6ffa 100644
--- a/internal/handler/skill_handler.go
+++ b/internal/handler/skill_handler.go
@@ -34,8 +34,8 @@ type SkillInfoResponse struct {
}
// ListSkills godoc
-// @Summary 获取当前沙盒配置上可执行的 Skills
-// @Description 返回指定沙盒配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。
+// @Summary 获取当前沙箱配置上可执行的 Skills
+// @Description 返回指定沙箱配置镜像内、智能体实际能调用的已安装技能(ready 且启用)。不传 sandbox_config_id 时列表为空。
// @Tags Skills
// @Accept json
// @Produce json