refactor: Clean up JSON structure and improve readability in locale files

This commit is contained in:
Vaayne 2025-09-23 12:23:05 +08:00
parent 87f3628b49
commit 21c436d900
6 changed files with 257 additions and 259 deletions

View File

@ -21,13 +21,18 @@ This file provides guidance to AI coding assistants when working with code in th
## Development Commands
- **Install**: `yarn install`
- **Development**: `yarn dev` - Runs Electron app in development mode
- **Debug**: `yarn debug` - Starts with debugging enabled, use chrome://inspect
- **Build Check**: `yarn build:check` - REQUIRED before commits (lint + test + typecheck), if having i18n sort issues, run `yarn i18n:sync` first to sync template.
- **Test**: `yarn test` - Run all tests (Vitest)
- **Single Test**: `yarn test:main` or `yarn test:renderer`
- **Lint**: `yarn lint` - Fix linting issues and run typecheck
- **Install**: `yarn install` - Install all project dependencies
- **Development**: `yarn dev` - Runs Electron app in development mode with hot reload
- **Debug**: `yarn debug` - Starts with debugging enabled, use `chrome://inspect` to attach debugger
- **Build Check**: `yarn build:check` - **REQUIRED** before commits (lint + test + typecheck)
- If having i18n sort issues, run `yarn i18n:sync` first to sync template
- If having formatting issues, run `yarn format` first
- **Test**: `yarn test` - Run all tests (Vitest) across main and renderer processes
- **Single Test**:
- `yarn test:main` - Run tests for main process only
- `yarn test:renderer` - Run tests for renderer process only
- **Lint**: `yarn lint` - Fix linting issues and run TypeScript type checking
- **Format**: `yarn format` - Auto-format code using Biome
## Project Architecture

View File

@ -69,7 +69,7 @@
"test:e2e": "yarn playwright test",
"test:lint": "oxlint --deny-warnings && eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --cache",
"test:scripts": "vitest scripts",
"lint": "oxlint --fix && eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --cache && yarn typecheck && yarn check:i18n",
"lint": "oxlint --fix && eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --cache && yarn typecheck && yarn check:i18n && yarn format:check",
"format": "biome format --write && biome lint --write",
"format:check": "biome format && biome lint",
"prepare": "git config blame.ignoreRevsFile .git-blame-ignore-revs && husky",

View File

@ -80,102 +80,102 @@
}
},
"settings": {
"advance": {
"maxTurns": {
"description": "Define how many request/response cycles the agent may complete automatically.",
"helper": "Higher values enable longer autonomous runs; lower values keep sessions short.",
"label": "Conversation turn limit"
},
"permissionMode": {
"description": "Control how the agent handles actions that require approval.",
"label": "Permission mode",
"options": {
"acceptEdits": "Accept edits automatically",
"bypassPermissions": "Bypass permission checks",
"default": "Default (ask before continuing)",
"plan": "Planning mode (requires plan approval)"
"advance": {
"maxTurns": {
"description": "Define how many request/response cycles the agent may complete automatically.",
"helper": "Higher values enable longer autonomous runs; lower values keep sessions short.",
"label": "Conversation turn limit"
},
"permissionMode": {
"description": "Control how the agent handles actions that require approval.",
"label": "Permission mode",
"options": {
"acceptEdits": "Accept edits automatically",
"bypassPermissions": "Bypass permission checks",
"default": "Default (ask before continuing)",
"plan": "Planning mode (requires plan approval)"
},
"placeholder": "Choose a permission behavior"
},
"title": "Advanced Settings"
},
"placeholder": "Choose a permission behavior"
},
"title": "Advanced Settings"
},
"essential": "Essential Settings",
"prompt": "Prompt Settings",
"tooling": {
"mcp": {
"description": "Connect MCP servers to unlock additional tools you can approve above.",
"empty": "No MCP servers detected. Add one from the MCP settings page.",
"manageHint": "Need advanced configuration? Visit Settings → MCP Servers.",
"toggle": "Toggle {{name}}"
},
"permissionMode": {
"acceptEdits": {
"behavior": "Pre-approves trusted filesystem tools so edits run immediately.",
"description": "File edits and filesystem operations are automatically approved.",
"title": "Auto-accept file edits"
"essential": "Essential Settings",
"prompt": "Prompt Settings",
"tooling": {
"mcp": {
"description": "Connect MCP servers to unlock additional tools you can approve above.",
"empty": "No MCP servers detected. Add one from the MCP settings page.",
"manageHint": "Need advanced configuration? Visit Settings → MCP Servers.",
"toggle": "Toggle {{name}}"
},
"permissionMode": {
"acceptEdits": {
"behavior": "Pre-approves trusted filesystem tools so edits run immediately.",
"description": "File edits and filesystem operations are automatically approved.",
"title": "Auto-accept file edits"
},
"bypassPermissions": {
"behavior": "Every tool is pre-approved automatically.",
"description": "All permission prompts are skipped — use with caution.",
"title": "Bypass permission checks",
"warning": "Use with caution — all tools will run without asking for approval."
},
"confirmChange": {
"description": "Switching modes updates the automatically approved tools.",
"title": "Change permission mode?"
},
"default": {
"behavior": "Read-only tools are pre-approved automatically.",
"description": "Read-only tools are pre-approved; everything else still needs permission.",
"title": "Default (ask before continuing)"
},
"plan": {
"behavior": "Read-only defaults are pre-approved while execution remains disabled.",
"description": "Shares the default read-only tool set but presents a plan before execution.",
"title": "Planning mode (coming soon)"
}
},
"preapproved": {
"autoBadge": "Added by mode",
"autoDescription": "This tool is auto-approved by the current permission mode.",
"empty": "No tools match your filters.",
"mcpBadge": "MCP tool",
"requiresApproval": "Requires approval when disabled",
"search": "Search tools",
"toggle": "Toggle {{name}}",
"warning": {
"description": "Enable only tools you trust. Mode defaults are highlighted automatically.",
"title": "Pre-approved tools run without manual review."
}
},
"review": {
"autoTools": "Auto: {{count}}",
"customTools": "Custom: {{count}}",
"helper": "Changes save automatically. Adjust the steps above any time to fine-tune permissions.",
"mcp": "MCP: {{count}}",
"mode": "Mode: {{mode}}"
},
"steps": {
"mcp": {
"title": "MCP servers"
},
"permissionMode": {
"title": "Step 1 · Permission mode"
},
"preapproved": {
"title": "Step 2 · Pre-approved tools"
},
"review": {
"title": "Step 3 · Review"
}
},
"tab": "Tooling & permissions"
},
"bypassPermissions": {
"behavior": "Every tool is pre-approved automatically.",
"description": "All permission prompts are skipped — use with caution.",
"title": "Bypass permission checks",
"warning": "Use with caution — all tools will run without asking for approval."
},
"confirmChange": {
"description": "Switching modes updates the automatically approved tools.",
"title": "Change permission mode?"
},
"default": {
"behavior": "Read-only tools are pre-approved automatically.",
"description": "Read-only tools are pre-approved; everything else still needs permission.",
"title": "Default (ask before continuing)"
},
"plan": {
"behavior": "Read-only defaults are pre-approved while execution remains disabled.",
"description": "Shares the default read-only tool set but presents a plan before execution.",
"title": "Planning mode (coming soon)"
}
},
"preapproved": {
"autoBadge": "Added by mode",
"autoDescription": "This tool is auto-approved by the current permission mode.",
"empty": "No tools match your filters.",
"mcpBadge": "MCP tool",
"requiresApproval": "Requires approval when disabled",
"search": "Search tools",
"toggle": "Toggle {{name}}",
"warning": {
"description": "Enable only tools you trust. Mode defaults are highlighted automatically.",
"title": "Pre-approved tools run without manual review."
}
},
"review": {
"autoTools": "Auto: {{count}}",
"customTools": "Custom: {{count}}",
"helper": "Changes save automatically. Adjust the steps above any time to fine-tune permissions.",
"mcp": "MCP: {{count}}",
"mode": "Mode: {{mode}}"
},
"steps": {
"mcp": {
"title": "MCP servers"
},
"permissionMode": {
"title": "Step 1 · Permission mode"
},
"preapproved": {
"title": "Step 2 · Pre-approved tools"
},
"review": {
"title": "Step 3 · Review"
}
},
"tab": "Tooling & permissions"
},
"tools": {
"approved": "approved",
"caution": "Pre-approved tools bypass human review. Enable only trusted tools.",
"description": "Choose which tools can run without manual approval.",
"requiresPermission": "Requires permission when not pre-approved.",
"tools": {
"approved": "approved",
"caution": "Pre-approved tools bypass human review. Enable only trusted tools.",
"description": "Choose which tools can run without manual approval.",
"requiresPermission": "Requires permission when not pre-approved.",
"tab": "Pre-approved tools",
"title": "Pre-approved tools",
"toggle": "{{defaultValue}}"

View File

@ -99,81 +99,81 @@
},
"title": "高级设置"
},
"essential": "基础设置",
"prompt": "提示词设置",
"tooling": {
"mcp": {
"description": "连接 MCP 服务器即可解锁更多可在上方预先授权的工具。",
"empty": "未检测到 MCP 服务器,请前往 MCP 设置页添加。",
"manageHint": "需要更多配置?前往 设置 → MCP 服务器。",
"toggle": "切换 {{name}}"
},
"permissionMode": {
"acceptEdits": {
"behavior": "预先授权受信任的文件系统工具,允许即时执行。",
"description": "文件编辑和文件系统操作将自动通过审批。",
"title": "自动接受文件编辑"
"essential": "基础设置",
"prompt": "提示词设置",
"tooling": {
"mcp": {
"description": "连接 MCP 服务器即可解锁更多可在上方预先授权的工具。",
"empty": "未检测到 MCP 服务器,请前往 MCP 设置页添加。",
"manageHint": "需要更多配置?前往 设置 → MCP 服务器。",
"toggle": "切换 {{name}}"
},
"permissionMode": {
"acceptEdits": {
"behavior": "预先授权受信任的文件系统工具,允许即时执行。",
"description": "文件编辑和文件系统操作将自动通过审批。",
"title": "自动接受文件编辑"
},
"bypassPermissions": {
"behavior": "所有工具都会被自动预先授权。",
"description": "所有权限提示都会被跳过,请谨慎使用。",
"title": "跳过所有权限检查",
"warning": "危险:所有工具都会在无审批情况下执行。"
},
"confirmChange": {
"description": "切换模式会更新自动预先授权的工具。",
"title": "确认切换权限模式?"
},
"default": {
"behavior": "只读工具会自动预先授权。",
"description": "只读工具会自动预先授权,其它操作仍需权限。",
"title": "默认(继续前询问)"
},
"plan": {
"behavior": "默认的只读工具会自动预先授权,但执行仍被禁用。",
"description": "继承默认的只读工具集,并会在执行前先呈现计划。",
"title": "规划模式(即将支持)"
}
},
"preapproved": {
"autoBadge": "模式自动添加",
"autoDescription": "该工具由当前权限模式自动预先授权。",
"empty": "没有符合筛选条件的工具。",
"mcpBadge": "MCP 工具",
"requiresApproval": "禁用时需要人工审批",
"search": "搜索工具",
"toggle": "切换 {{name}}",
"warning": {
"description": "仅启用你信任的工具。模式默认值会自动标注。",
"title": "预先授权的工具将在无人工审核时运行。"
}
},
"review": {
"autoTools": "自动:{{count}}",
"customTools": "自定义:{{count}}",
"helper": "设置会自动保存,可随时返回上方步骤进行调整。",
"mcp": "MCP{{count}}",
"mode": "模式:{{mode}}"
},
"steps": {
"mcp": {
"title": "MCP 服务器"
},
"permissionMode": {
"title": "步骤 1 · 权限模式"
},
"preapproved": {
"title": "步骤 2 · 预先授权工具"
},
"review": {
"title": "步骤 3 · 总览"
}
},
"tab": "工具与权限"
},
"bypassPermissions": {
"behavior": "所有工具都会被自动预先授权。",
"description": "所有权限提示都会被跳过,请谨慎使用。",
"title": "跳过所有权限检查",
"warning": "危险:所有工具都会在无审批情况下执行。"
},
"confirmChange": {
"description": "切换模式会更新自动预先授权的工具。",
"title": "确认切换权限模式?"
},
"default": {
"behavior": "只读工具会自动预先授权。",
"description": "只读工具会自动预先授权,其它操作仍需权限。",
"title": "默认(继续前询问)"
},
"plan": {
"behavior": "默认的只读工具会自动预先授权,但执行仍被禁用。",
"description": "继承默认的只读工具集,并会在执行前先呈现计划。",
"title": "规划模式(即将支持)"
}
},
"preapproved": {
"autoBadge": "模式自动添加",
"autoDescription": "该工具由当前权限模式自动预先授权。",
"empty": "没有符合筛选条件的工具。",
"mcpBadge": "MCP 工具",
"requiresApproval": "禁用时需要人工审批",
"search": "搜索工具",
"toggle": "切换 {{name}}",
"warning": {
"description": "仅启用你信任的工具。模式默认值会自动标注。",
"title": "预先授权的工具将在无人工审核时运行。"
}
},
"review": {
"autoTools": "自动:{{count}}",
"customTools": "自定义:{{count}}",
"helper": "设置会自动保存,可随时返回上方步骤进行调整。",
"mcp": "MCP{{count}}",
"mode": "模式:{{mode}}"
},
"steps": {
"mcp": {
"title": "MCP 服务器"
},
"permissionMode": {
"title": "步骤 1 · 权限模式"
},
"preapproved": {
"title": "步骤 2 · 预先授权工具"
},
"review": {
"title": "步骤 3 · 总览"
}
},
"tab": "工具与权限"
},
"tools": {
"approved": "已授权",
"caution": "预先授权的工具会跳过人工审核,请仅启用可信的工具。",
"tools": {
"approved": "已授权",
"caution": "预先授权的工具会跳过人工审核,请仅启用可信的工具。",
"description": "选择哪些工具可以在无需人工审批的情况下执行。",
"requiresPermission": "未预先授权时需要人工审批。",
"tab": "预先授权工具",

View File

@ -99,81 +99,81 @@
},
"title": "進階設定"
},
"essential": "必要設定",
"prompt": "提示設定",
"tooling": {
"mcp": {
"description": "連線 MCP 伺服器即可解鎖更多可在上方預先授權的工具。",
"empty": "尚未偵測到 MCP 伺服器,請前往 MCP 設定頁新增。",
"manageHint": "需要進階設定?前往 設定 → MCP 伺服器。",
"toggle": "切換 {{name}}"
},
"permissionMode": {
"acceptEdits": {
"behavior": "預先授權受信任的檔案系統工具,允許即時執行。",
"description": "檔案編輯與檔案系統操作會自動通過核准。",
"title": "自動接受檔案編輯"
"essential": "必要設定",
"prompt": "提示設定",
"tooling": {
"mcp": {
"description": "連線 MCP 伺服器即可解鎖更多可在上方預先授權的工具。",
"empty": "尚未偵測到 MCP 伺服器,請前往 MCP 設定頁新增。",
"manageHint": "需要進階設定?前往 設定 → MCP 伺服器。",
"toggle": "切換 {{name}}"
},
"permissionMode": {
"acceptEdits": {
"behavior": "預先授權受信任的檔案系統工具,允許即時執行。",
"description": "檔案編輯與檔案系統操作會自動通過核准。",
"title": "自動接受檔案編輯"
},
"bypassPermissions": {
"behavior": "所有工具都會被自動預先授權。",
"description": "所有權限提示都會被略過,請務必謹慎使用。",
"title": "略過所有權限檢查",
"warning": "警告:所有工具都會在無核准情況下執行。"
},
"confirmChange": {
"description": "切換模式會更新自動預先授權的工具。",
"title": "確認切換權限模式?"
},
"default": {
"behavior": "唯讀工具會自動預先授權。",
"description": "唯讀工具會自動預先授權,其它操作仍需核准。",
"title": "預設(繼續前先詢問)"
},
"plan": {
"behavior": "預設的唯讀工具會自動預先授權,但執行仍被停用。",
"description": "沿用預設的唯讀工具集,並會在執行前先呈現計畫。",
"title": "規劃模式(即將支援)"
}
},
"preapproved": {
"autoBadge": "模式自動添加",
"autoDescription": "此工具由目前的權限模式自動預先授權。",
"empty": "沒有符合篩選條件的工具。",
"mcpBadge": "MCP 工具",
"requiresApproval": "停用時需要人工核准",
"search": "搜尋工具",
"toggle": "切換 {{name}}",
"warning": {
"description": "僅啟用你信任的工具。模式預設值會自動標示。",
"title": "預先授權的工具將在無人工審查下執行。"
}
},
"review": {
"autoTools": "自動:{{count}}",
"customTools": "自訂:{{count}}",
"helper": "設定會自動儲存,可隨時回到上方步驟調整。",
"mcp": "MCP{{count}}",
"mode": "模式:{{mode}}"
},
"steps": {
"mcp": {
"title": "MCP 伺服器"
},
"permissionMode": {
"title": "步驟 1 · 權限模式"
},
"preapproved": {
"title": "步驟 2 · 預先授權工具"
},
"review": {
"title": "步驟 3 · 檢視"
}
},
"tab": "工具與權限"
},
"bypassPermissions": {
"behavior": "所有工具都會被自動預先授權。",
"description": "所有權限提示都會被略過,請務必謹慎使用。",
"title": "略過所有權限檢查",
"warning": "警告:所有工具都會在無核准情況下執行。"
},
"confirmChange": {
"description": "切換模式會更新自動預先授權的工具。",
"title": "確認切換權限模式?"
},
"default": {
"behavior": "唯讀工具會自動預先授權。",
"description": "唯讀工具會自動預先授權,其它操作仍需核准。",
"title": "預設(繼續前先詢問)"
},
"plan": {
"behavior": "預設的唯讀工具會自動預先授權,但執行仍被停用。",
"description": "沿用預設的唯讀工具集,並會在執行前先呈現計畫。",
"title": "規劃模式(即將支援)"
}
},
"preapproved": {
"autoBadge": "模式自動添加",
"autoDescription": "此工具由目前的權限模式自動預先授權。",
"empty": "沒有符合篩選條件的工具。",
"mcpBadge": "MCP 工具",
"requiresApproval": "停用時需要人工核准",
"search": "搜尋工具",
"toggle": "切換 {{name}}",
"warning": {
"description": "僅啟用你信任的工具。模式預設值會自動標示。",
"title": "預先授權的工具將在無人工審查下執行。"
}
},
"review": {
"autoTools": "自動:{{count}}",
"customTools": "自訂:{{count}}",
"helper": "設定會自動儲存,可隨時回到上方步驟調整。",
"mcp": "MCP{{count}}",
"mode": "模式:{{mode}}"
},
"steps": {
"mcp": {
"title": "MCP 伺服器"
},
"permissionMode": {
"title": "步驟 1 · 權限模式"
},
"preapproved": {
"title": "步驟 2 · 預先授權工具"
},
"review": {
"title": "步驟 3 · 檢視"
}
},
"tab": "工具與權限"
},
"tools": {
"approved": "已授權",
"caution": "預先授權的工具會略過人工審查,請僅啟用可信任的工具。",
"tools": {
"approved": "已授權",
"caution": "預先授權的工具會略過人工審查,請僅啟用可信任的工具。",
"description": "選擇哪些工具可在無需人工核准的情況下執行。",
"requiresPermission": "未預先授權時需要人工核准。",
"tab": "預先授權工具",

View File

@ -1,10 +1,5 @@
import { Input, Tooltip } from '@heroui/react'
import {
AgentConfiguration,
AgentConfigurationSchema,
GetAgentResponse,
UpdateAgentForm
} from '@renderer/types'
import { AgentConfiguration, AgentConfigurationSchema, GetAgentResponse, UpdateAgentForm } from '@renderer/types'
import { Info } from 'lucide-react'
import { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -83,9 +78,7 @@ export const AgentAdvanceSettings: React.FC<AgentAdvanceSettingsProps> = ({ agen
}}
aria-label={t('agent.settings.advance.maxTurns.label')}
/>
<span className="text-foreground-500 text-xs">
{t('agent.settings.advance.maxTurns.helper')}
</span>
<span className="text-foreground-500 text-xs">{t('agent.settings.advance.maxTurns.helper')}</span>
</div>
</SettingsItem>
</SettingsContainer>