Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

379 KB
Raw Blame
/**
 * UI copy (bilingual): this file holds the Chinese dictionary `zh` and the runtime
 * active dictionary `S`; the English dictionary lives in strings-en.ts (constrained
 * to the same shape by the `Strings` type). Locale preference is resolved by
 * state/locale.tsx, which calls `setActiveStrings` to switch and remounts the whole
 * tree keyed by locale, so `S.x` reads in components always reflect the current
 * language (module-level constants do not update on switch — keep reads inside components).
 * Keep domain terms capitalized in English — Workspace, Token, Task, Session, Trace. zh names the
 * Project SURFACE 「项目」 the way it names the Agent surface「智能体」: the switcher, the create /
 * settings dialogs and every label that points at one. The English dictionary keeps "Project".
 * "agent" is a common noun: lowercase mid-sentence, capitalized only at the start of a
 * label/sentence or in a proper name (Agent State, AgentHub). zh names the SURFACE
 * 「智能体」 — the nav entry, the grouping option, the panel — and keeps "Agent" as-is
 * inside running prose, where it is the term of art rather than the thing being pointed at.
 */
import type { PeakWindows } from "../features/models/model-grouping";

export const zh = {
  appName: "Adelie",

  nav: {
    chat: "对话",
    newChat: "新建对话",
    agents: "智能体",
    models: "模型库",
    machines: "机器管理",
    plugins: "插件市场",
    usage: "成本中心",
    traces: "轨迹观测",
    benchmark: "评估中心",
    // Collapsed-rail tooltips (product-specified wording; new chat reuses chat.newSessionMenu, the other pages reuse the page names above).
    lastConversation: "最近一次对话",
    // The rail avatar's tooltip says what the control does; who is signed in stays in its accessible name.
    userSettings: "用户设置",
    collapseSidebar: "收起侧栏",
    expandSidebar: "展开侧栏",
    collapseGroup: "折叠",
    expandGroup: "展开",
    pinGroup: "置顶分组",
    unpinGroup: "取消置顶",
    /** A nav entry's pin toggle: a pinned entry stays visible when the collapsible area folds. */
    pinEntry: "常驻",
    unpinEntry: "取消常驻",
    /** Company mode's page entries (S.nav.org.<key>, the COMPANY_NAV_KEYS manifest), and the mode switch's option names. */
    org: {
      overview: "概览",
      chart: "组织图",
      calendar: "日历",
      tickets: "工单",
      finance: "财务",
      handbook: "手册",
    },
  },

  /** Machines page: the server's own ssh hosts, and installing this build on one. */
  machines: {
    pageTitle: "机器管理",
    /** Tooltip on the version in the header: what this server would install. */
    imageVersion: (version: string) => `本服务端版本:${version}`,
    noImage:
      "本服务端没有可推送的安装镜像。打包安装或 tarball 安装自带镜像;源码检出则在第一次热推后获得。",
    empty: "~/.ssh/config 中没有可添加的主机。",
    /** The picker: an ssh config can declare hundreds of hosts, so the panel is a fuzzy search over aliases. */
    search: "搜索主机…",
    noMatch: "没有匹配的主机。",
    /** The tag on this server's own row. */
    localTitle: "本服务端",
    noneInUse: "还没有在用的机器。",
    sshHint:
      "能加的机器,是本服务端账户用密钥就能 ssh 上去的主机(在这里的终端里 `ssh <别名>` 能直接进)。请配置 ssh 的人把它写进 ~/.ssh/config。",
    now: "刚刚",
    /** The chevron row at the foot of the picker's list: the matches it has not shown yet. */
    allHosts: (count: number) => `ssh 配置中另有 ${count} 台`,
    expand: "展开",
    fewer: "收起",
    /** The form that appends a host block to this server's ~/.ssh/config. */
    host: {
      addTitle: "新建 ssh 主机",
      /** The one-word verbs on the buttons; the titles above say what they do in full. */
      newVerb: "新建",
      configureVerb: "配置",
      add: "写入 ssh 配置",
      alias: "别名(Host)",
      aliasHint: "一个词,之后 `ssh <别名>` 和这里都用它称呼这台机器。",
      hostName: "地址(HostName)",
      hostNameHint: "IP 或域名。",
      user: "用户(User)",
      userHint: "留空则用本服务端账户的用户名。",
      port: "端口(Port)",
      portHint: "留空为 22。",
      identityFile: "密钥文件(IdentityFile)",
      identityFileHint: "留空则用 ssh 的默认密钥。",
      oneWord: "必须是一个词:不能有空格或 #。",
      portRange: "1 到 65535 之间的整数。",
      exists: "ssh 配置里已有这个别名。",
      added: (alias: string) => `已写入 ${alias}。现在可以从「添加机器…」里启用它。`,
      /** Configuring a host this app wrote: the same form, the alias fixed. */
      configure: "配置 ssh 主机",
      editTitle: "配置 ssh 主机",
      saved: (alias: string) => `已更新 ${alias} 的 ssh 配置。`,
      foreign: "这一段不是由 Adelie 写入的,可能带有这里不认识的选项;请直接编辑 ~/.ssh/config。",
    },
    /** The verbs. */
    add: "添加机器…",
    addSelected: (count: number) => `启用这 ${count} 台`,
    use: "启用",
    stopUsing: "停用",
    /** One tap brings every machine behind this build forward (and reconnects it). */
    updateAll: (count: number) => `全部更新(${count})`,
    /** The floating bar over a selection. */
    selectedCount: (count: number) => `已选 ${count} 台`,
    pickAll: "全选",
    pickNone: "清空",
    /** The one word in a row's State column, keyed by the row's reading; `serving` is this server's. */
    state: {
      serving: "服务中",
      queued: "排队中",
      working: "处理中",
      ready: "已连接",
      failed: "失败",
      installedOnly: "已安装",
      behind: "待更新",
      notConnected: "未连接",
      unreachable: "连不上",
      stopped: "未运行",
      linkedStopped: "已连接,未在提供服务",
      unknown: "未检查",
    },
    /** The stepper's steps, in pipeline order, as the caption under a working row. */
    phase: {
      check: "检查对端…",
      install: "安装程序…",
      handover: "交接构建…",
      restart: "重启服务…",
      connect: "建立连接…",
      sync: "下发模型配置…",
    },
    stepOf: (step: number, total: number) => `第 ${step}/${total} 步`,
    queued: "排队中,等前面的机器处理完。",
    working: "处理中…",
    failedAt: (step: string) => `失败于「${step}」。`,
    /** The forced install a failed job may offer. */
    replaceProgram: "强制安装",
    replaceProgramWhy:
      "无论那台机器上现在是什么,都把这个构建的程序装上去并重启它的服务——正在用它的人会被打断。",
    /** Refusals answered by machine id when a batch is queued. */
    refusedSelf: (alias: string) => `${alias} 就是本服务端所在的机器,无需添加。`,
    refusedUnknown: (alias: string) => `${alias} 不在本服务端的 ssh 配置里。`,
    /** The detail pane. */
    details: "详情",
    detailInstalled: "已安装",
    detailSince: "安装于",
    /** This server's own card says what build it runs and since when, not what was installed. */
    detailVersion: "版本",
    detailStarted: "启动于",
    detailServer: "对端服务",
    detailChecked: "上次检查",
    detailMachineId: "机器 ID",
    detailRoot: "服务端根目录",
    serverUpOn: (port: number) => `运行中,端口 ${port}`,
    /** The progress log's own heading, so the block is not an unlabelled wall of text. */
    output: "输出",
    agentsUnreachable: "那台机器尚未连接——请在「机器管理」页面使用它",
    adminOnly: "只有管理员可以管理机器。",
  },

  /** Keyboard shortcuts: the registry's command and group labels (lib/shortcuts/registry.ts). */
  shortcuts: {
    commands: {
      "palette.toggle": "命令面板",
      "sessions.search": "搜索会话",
      "chat.new": "新建对话",
      "sidebar.toggle": "显示或隐藏侧栏",
      "dock.toggleRight": "显示或隐藏右侧栏",
      "dock.toggleBottom": "显示或隐藏下侧栏",
      "terminal.toggle": "显示或隐藏终端",
      "terminal.new": "新建终端",
      "terminal.close": "关闭当前终端",
      "editor.save": "保存",
    },
    groups: {
      general: "通用",
      panels: "面板",
      terminal: "终端",
      editor: "编辑器",
    },
    /** Where a focus-scoped command wins, for the shadowed-conflict hint. */
    scopes: {
      terminal: "终端",
      editor: "编辑器",
    },
    unbound: "未设置",
    /** The recorder button's tooltip. */
    rebind: "更改快捷键",
    record: "按下新的快捷键…",
    recordHint: "Esc 取消 · Backspace 清除",
    needsModifier: "需要配合 Ctrl 或 Alt(macOS 为 ⌘ 或 ⌃),Shift 只能与它们一起使用;或使用 F 键",
    resetRow: "恢复默认",
    resetAll: "全部恢复默认",
    resetAllBody: (n: number): string => `将 ${n} 条快捷键恢复为默认值?`,
    conflictSame: (other: string): string => `与「${other}」使用同一个快捷键,只有排在前面的生效`,
    conflictShadowed: (other: string, surface: string): string =>
      `在${surface}里会被「${other}」抢先`,
    browserReserved: "浏览器保留了这个组合,只在桌面应用里生效",
    browserCommon: "浏览器本身也用这个组合,在浏览器里会取代它的那个功能",
    desktopMenuReserved: "会覆盖桌面应用菜单里使用同一组合的快捷键",
    /** A write the account refused: the row still shows the new chord, so the sentence says what the account holds. */
    saveRefused: (reason: string): string =>
      `快捷键没能保存到账号;这一改动只在这个浏览器里生效,重新加载后会退回账号上原来的快捷键:${reason}`,
    /**
     * A read the account refused: the rows below are the browser mirror, not the account's copy, and a
     * write would replace the account's whole document with it — so the sentence names both costs.
     */
    loadRefused: (reason: string): string =>
      `没能从账号读取快捷键;下面这一份来自这个浏览器(可能属于上一个账号,也可能只是默认值),改动会整份写回账号、盖掉账号上原来的按键。重新加载这一页会再读一次:${reason}`,
  },

  /** Server-side terminal (the in-app dock and the standalone /terminal page). */
  terminal: {
    title: "终端",
    newShell: "新建终端",
    /** Tab strip ×: kills the shell itself (server-side), unlike closing the dock. */
    killShell: "关闭此终端",
    /** Pane body when creating/attaching a shell failed (the server message follows). */
    createFailed: "终端创建失败",
    /** A create that 404s: the server predates the terminal API (or the shell attached to an older one). */
    noTerminalApi:
      "该服务端没有终端接口:运行中的 runtime 早于该功能。热更新只替换平台与前端,终端接口属于 runtime,需更新 runtime 本身(重启无效)",
    /** Codex-style handoff: opens /terminal?id=… in a new window, the dock lets go. */
    detach: "在新窗口打开",
    status: {
      connecting: "连接中",
      ready: "已连接",
      /** The pty is fine; this page's socket dropped and is being reattached. */
      reconnecting: "重连中",
      exited: "已退出",
      error: "连接错误",
    },
    /** Suffix shown after `status.exited`; `code` is the shell's numeric exit code. */
    exitedWithCode: (code: string): string => `退出码 ${code}`,
    /**
     * The touch key bar (terminal-keybar.tsx), shown only under `(pointer: coarse)`: the
     * keys a phone's soft keyboard has none of. Cap faces are the key names themselves
     * (Esc / Tab / Ctrl / Alt / ^C) and stay untranslated, as on a physical keyboard; these
     * are their accessible names.
     */
    touchKeys: {
      label: "终端快捷键",
      esc: "Esc 键",
      tab: "Tab 键",
      /** Sticky: tap to arm, the next character composes with it. */
      ctrl: "Ctrl 键(点一下,下一个字符生效)",
      alt: "Alt 键(点一下,下一个字符生效)",
      up: "上方向键",
      down: "下方向键",
      left: "左方向键",
      right: "右方向键",
      interrupt: "中断(Ctrl+C)",
      /** Arms the touch selection mode; a finger then drags a selection out. */
      select: "选择文本(打开后在终端上拖动)",
      /** Shown only while the terminal has a selection. */
      copy: "复制选区",
      paste: "粘贴",
      hideKeyboard: "收起键盘",
      showKeyboard: "调出键盘",
    },
  },

  /** The dock surfaces (right / bottom) every side element renders in as a tab. */
  dock: {
    /** The dock header's "+" menu: panels and shells this dock can take a tab for. */
    addTab: "添加面板",
    /** A panel tab's × (its content closes; terminal tabs use terminal.killShell instead). */
    closeTab: "关闭面板",
    /** The dock header's ×: the dock hides, its tabs stay for the next open. */
    hideDock: "收起侧边栏",
    moveToRight: "移到右侧",
    moveToBottom: "移到下方",
    /** Boundary drag handle between a dock and the chat content (double-click resets). */
    resize: "调整面板大小",
    /** The toolbar's two pull-open buttons (aria-expanded carries the open state). */
    rightDock: "右侧栏",
    bottomDock: "下侧栏",
    /** A session-bound panel's body on the draft page, where no Session exists yet. */
    draftEmpty: "发送第一条消息后可用",
    /** Terminal tab ×: ends the shell for real, so it asks first. `name` is the tab label. */
    killConfirmTitle: "关闭此终端?",
    killConfirmBody: (name: string): string => `将结束 Shell「${name}」的进程,无法恢复。`,
    /**
     * The floating launcher on the chat body's right edge while the right dock is hidden.
     * `launcherCaption` is printed under the ball at rest — the same words as the ball's
     * accessible name — gives way to `launcherOpen` while the ball itself is pointed at, and
     * to the pointed-at entry's name while the fan is open.
     */
    launcher: "快捷方式",
    launcherCaption: "快捷方式",
    /** Replaces `launcherCaption` while the pointer or focus is on the ball and no entry is: what the next click does, so the pair swaps with the fan's state. */
    launcherOpen: "打开",
    launcherClose: "关闭",
    /** Appended to the launcher's accessible name while its amber dot shows. */
    launcherPending: "子智能体有待审批",
    /** The fan of entries the launcher opens (its accessible group name). */
    launcherPanels: "快捷方式",
    /** The fan's last entry: puts the launcher away until Appearance settings bring it back. */
    launcherHide: "隐藏悬浮球",
    launcherHiddenToast: "悬浮球已隐藏,可在 设置 › 外观 中重新开启",
    /** The dock header's fullscreen toggle while the dock is at its usual size. */
    fullscreen: "全屏",
    /** The same toggle while the dock is fullscreen: it leaves in place. */
    exitFullscreen: "退出全屏",
    /** A tab whose panel has no definition registered (a plugin's panel before it loads). */
    panelUnavailable: "此面板暂不可用",
  },

  /** The built-in browser (desktop app only): its dock panel, toolbar and dialogs. */
  builtinBrowser: {
    /** The dock tab's name, also in the dock's menus and the launcher. */
    panelTitle: "浏览器",
    /** The browser's own tab strip (its accessible name). */
    tabs: "标签页",
    newTab: "新建标签页",
    closeTab: "关闭标签页",
    /** A tab with no title yet — a blank new tab. */
    untitled: "新标签页",
    back: "后退",
    forward: "前进",
    reload: "重新加载",
    stop: "停止加载",
    /** The address bar's accessible name, and its placeholder. */
    address: "地址栏",
    addressPlaceholder: "搜索或输入网址",
    /** The history suggestions under the address bar (their accessible name). */
    suggestions: "历史记录",
    /** The toolbar's overflow menu. */
    more: "更多",
    importAction: "从浏览器导入…",
    clearDataAction: "清除浏览数据…",
    /** Opens the homepage dialog. */
    setHomepageAction: "设置主页…",
    openExternal: "在系统浏览器中打开",
    devTools: "开发者工具",
    /** The toolbar's button to the homepage, beside reload; shown only while one is set. */
    home: "主页",
    /** The toolbar's mark while an agent drives the browser; `action` is one of `actions`. */
    agentBusy: (action: string): string => `智能体正在使用浏览器:${action}`,
    /** A busy tab's tooltip in the strip, after its title. */
    agentBusyTab: "智能体正在使用此标签页",
    actions: {
      navigate: "打开网页",
      scan: "读取页面",
      exec: "运行脚本",
      click: "点击页面",
      type: "输入文字",
      screenshot: "截取屏幕",
      cdp: "发送调试命令",
    },
    /** The panel where the browser cannot run; the title, then why. */
    unavailableTitle: "内置浏览器不可用",
    unavailableDesktop: "内置浏览器只能在 Adelie 桌面应用中使用。",
    unavailableShell: "当前桌面应用版本过旧,请更新后使用内置浏览器。",
    unavailableWindow: "没有可以显示浏览器的应用窗口。",
    openFailed: (reason: string): string => `无法打开标签页:${reason}`,
    /** The import dialog: copies sign-ins and history from a browser installed on this computer. */
    importTitle: "从浏览器导入",
    importIntro: "把系统浏览器里的登录状态和历史记录复制到内置浏览器,原浏览器中的数据不会改变。",
    importLoading: "正在查找浏览器…",
    importNone: "这台电脑上没有找到可以导入的浏览器。",
    importSourcesFailed: (reason: string): string => `无法读取浏览器列表:${reason}`,
    importSource: "导入来源",
    importWhat: "导入内容",
    importCookies: "Cookie 与登录状态",
    importHistory: "历史记录",
    importDomains: "仅限这些网站",
    importDomainsHint: "用逗号分隔,例如 amazon.com, github.com;留空则导入全部网站",
    importDomainsPlaceholder: "amazon.com, github.com",
    importKeychainNote: "Mac 可能会请求钥匙串访问权限。",
    importRun: "导入",
    importRunning: "正在导入…",
    importDone: "完成",
    importCookiesResult: (c: {
      found: number;
      imported: number;
      skipped: number;
      failed: number;
    }): string =>
      `Cookie:已导入 ${c.imported} / ${c.found}` +
      (c.skipped > 0 ? `,跳过 ${c.skipped}` : "") +
      (c.failed > 0 ? `,失败 ${c.failed}` : ""),
    importHistoryResult: (h: { found: number; imported: number }): string =>
      `历史记录:已导入 ${h.imported} / ${h.found} 条`,
    importFailed: (reason: string): string => `导入失败:${reason}`,
    /** The clear-browsing-data confirmation. */
    clearTitle: "清除浏览数据",
    clearBody: "选择要从内置浏览器中删除的数据,此操作无法撤销。",
    clearCookies: "Cookie 与登录状态",
    clearCache: "缓存的图片和文件",
    clearStorage: "网站存储的数据",
    clearHistory: "历史记录",
    clearConfirm: "清除",
    clearDone: "已清除浏览数据",
    clearFailed: (reason: string): string => `清除失败:${reason}`,
    /** The homepage dialog: the page new tabs and the Home button open. */
    homepageTitle: "设置主页",
    homepageIntro: "新建标签页和主页按钮会打开这个页面。",
    homepageAddress: "网址",
    homepagePlaceholder: "example.com",
    /** The address field's hint: what an empty field means, else the page the entry opens. */
    homepageHintEmpty: "留空表示不设主页,新建标签页为空白页。",
    homepageHintOpens: (url: string): string => `将打开 ${url}`,
    /** Fills the field with the page on screen. */
    homepageUseCurrent: "使用当前页面",
    /** Empties the field; saving it then removes the homepage. */
    homepageClear: "清除",
    homepageFailed: (reason: string): string => `无法保存主页:${reason}`,
    /** A tab whose page crashed: the panel's notice in its place, with Reload as the action. */
    crashedTitle: "此页面已崩溃",
    /** The notice's body when the page ran out of memory (the system took its memory back). */
    crashedOutOfMemory: "它耗尽了内存。请先关闭不再需要的标签页,再重新加载。",
    crashedBody: "重新加载即可再试一次。",
    /** A crashed tab's tooltip line in the strip, after its title, and its mark's accessible name. */
    crashedTab: "页面已崩溃",
    /**
     * The browser's load, when the server warns about it: the toolbar's mark (its tooltip and
     * accessible name) and the one toast per warning. Sentences joined in the order given here.
     */
    load: {
      memory: (size: string, tabs: number): string =>
        `浏览器正在使用 ${size} 内存(${tabs} 个标签页)。`,
      lowSystemMemory: (percent: number): string => `这台电脑的可用内存不足(剩余 ${percent}%)。`,
      manyTabs: (tabs: number): string => `已打开 ${tabs} 个标签页。`,
      advice: "请关闭不再需要的标签页。",
      /** The sentences above, as one warning. */
      join: (sentences: string[]): string => sentences.join(""),
      /** A heavy tab's tooltip line in the strip, after its title, and its mark's accessible name. */
      heavyTab: (size: string): string => `占用 ${size} 内存`,
    },
  },

  /** The Trace dock panel (the current conversation's Trace files). */
  tracePanel: {
    empty: "暂无轨迹",
    emptyHint: "该会话还没有产生 Trace 文件",
    loadFailed: "轨迹加载失败",
    /**
     * The Transport view (features/traces/sse-frame-list.tsx): the SSE frames this browser
     * actually received. `transportHint` says what turning it on does; the frame's own names
     * (`open` / `ping` / `server_event` / `silence` …) are the protocol's words and stay as they
     * are.
     */
    transport: "传输",
    transportOn: "记录中",
    transportOff: "已关闭",
    transportHint:
      "已关闭:打开后重新记录本浏览器收到的实时帧(只留在本页内存,最多 300 条)—— 实时流停了时,用它看是数据没送到,还是服务端没写。",
    transportCount: (n: number) => `最近 ${n} 帧,新的在上`,
    transportEmpty: "还没有收到帧",
    transportClear: "清空",
    transportChannel: "用户级",
    transportSilence: (gap: string) => `静默 ${gap}`,
  },

  settings: {
    language: "语言",
    languageInfo: "界面语言,可跟随浏览器设置。",
    /** Sidebar user-menu row opening the Settings dialog, and that dialog's title. */
    title: "设置",
    /** The account menu's footer line: the credit MiSans's licence requires of software that ships the font. */
    creditsTitle: "版权信息",
    creditsThemes: "用于",
    creditsNoTheme: "没有主题默认使用",
    creditsLicense: "许可",
    creditsSource: "来源",
    /** The npm package a face arrives through, under the type's own project link. */
    creditsPackaged: "打包来源",
    creditsLicenseText: "许可全文",
    /**
     * The theme half of the credits page: what the app ships, and what the library it reads from
     * offers. Static words — the page cannot depend on the library being reachable.
     */
    creditsThemeLibrary: "主题",
    creditsThemeLibraryInfo:
      "应用自带三套主题(通用、白领、极客),随 Adelie 一起提供。外观页「主题库」里的四套——赛博朋克、手绘涂鸦、陶光、拟物化——由 lmliheng 维护,按需取用。七套都是 Apache-2.0,与 Adelie 同一个许可;一份主题只含颜色与尺寸这类取值,不含代码。",
    /** Settings › Server › Agent API: the admin's switch over every Agent's public API, and the question before it goes off. */
    agentApiTitle: "Agent API",
    agentApiToggle: "允许 Agent API",
    agentApiHint: "关闭后所有 Agent 的 API 请求均被拒绝;各 Agent 的开关、审批模式与密钥保留。",
    agentApiOffTitle: "关闭 Agent API?",
    agentApiOffConfirm:
      "这台服务器上所有 Agent 的 API 会立即拒绝请求,调用它们的外部程序都会失败,直到重新开启。各 Agent 的开关、审批模式与密钥保留。",
    agentApiOff: "关闭",
    /** Rail headings: the viewer's own preferences vs. the whole server's. */
    groupPersonal: "个人",
    groupServer: "服务器",
    /** Personal pages of the settings dialog. */
    profile: "个人资料",
    generalTitle: "通用",
    appearanceTitle: "外观",
    shortcutsTitle: "快捷键",
    /** The Shortcuts page's "?": what follows the platform, where bindings live, and the browser's own claims. */
    shortcutsInfo:
      "快捷键随平台:macOS 用 ⌘,其余平台用 Ctrl。改动即刻生效,本浏览器的其他标签页同步跟随;本账号的其他浏览器与桌面应用在下次加载时取得。按账号并按平台分别保存,Mac 与 Windows 各有一套。浏览器自身保留的组合(如 Ctrl+W / ⌘W)在浏览器标签页里收不到,只在桌面应用里生效;浏览器本身也用的组合(如打印的 Ctrl+P / ⌘P)在浏览器标签页里会取代它的那个功能。两者都在列表中标出。",
    accountTitle: "账户",
    /** Trace import: the two pickers' accessible names, the pick-a-file action, and its outcomes. */
    importTrace: "导入 Trace",
    importTraceInfo:
      "上传从其他部署导出的 .jsonl 轨迹文件,它会成为所选 Agent 的一个会话;也可以上传对话的 Trace 面板里「导出整个会话」得到的 .json 包,那会把一个长会话的全部分片一起带过来。目的地的两个部分都在这里选择:导入接口按 Agent 划分——轨迹文件自带的 session_meta 无法指认本机的 Agent,其中的 agent_state 路径属于导出它的那台机器——而项目需要明确指定,因为本对话框不显示当前是哪一个,也因此可以导入到当前打开之外的项目。导出在对话的 Trace 面板中进行。",
    importTraceProject: "导入到项目",
    importTraceAgent: "导入到 Agent",
    importTracePick: "选择文件",
    importTraceRunning: "导入中…",
    importTraceDone: (target: string) => `轨迹已导入到 ${target}`,
    importTraceTooLarge: "文件超过 14MB 上限。",
    importTraceBundleTooLarge: "整会话包超过 48MB 上限。",
    /** Admin-only sub-page (server-global); its explanation is disclosed at the pane heading. */
    proxyTitle: "代理选项",
    proxyInfo:
      "服务器全局设置,保存后立即生效,无需重启。回环地址始终直连。" +
      "「连通性测速」向下方列出的地址各发一次不带凭据的 GET,量的是本服务器出站这一跳:" +
      "对方回了 HTTP 响应即算连通,401、403 同样算——它们说明域名解析、TCP 连接与 TLS 握手都已走通;" +
      "连不通指的是传输本身失败。测的是已保存的设置——只有保存才会重建出站 dispatcher," +
      "所以测速排在「保存」下方,改过地址要先保存再测。结果先到先出,各自到达即显示。",
    /** The two switches: the server's own outbound traffic / agent command subprocess environments. */
    proxyForApp: "应用程序使用代理",
    proxyForAgent: "Agent 环境使用代理",
    /** The shared explicit proxy address (empty = follow the proxy environment variables). */
    proxyAddress: "代理地址",
    proxyAddressPlaceholder: "留空 = 跟随系统代理",
    /** Reachability test: the block's heading, and its button at rest and while probing. */
    proxyProbe: "连通性测速",
    proxyProbeRun: "测速",
    proxyProbeRunning: "测速中…",
    /** A provider answered: the latency IS the result, so this is the only visible text. */
    proxyProbeLatency: (ms: number): string => `${ms} ms`,
    /** The same verdict in words, read out beside the number — a bare figure does not say "reachable". */
    proxyProbeReachableState: "已连通",
    /** Listed but not yet measured: an absence, not a verdict. */
    proxyProbeIdle: "未测试",
    /** A provider did not answer: the transport fault, each naming the state in words. */
    proxyProbeFailure: {
      timeout: "连接超时",
      dns: "域名解析失败",
      refused: "连接被拒绝",
      tls: "TLS 握手失败",
      network: "无法连接",
    },
    /** Admin-only sub-page (server-global): the options loaded plugins declare. */
    pluginsTitle: "插件",
    /** An enum option this machine cannot honour, listed greyed out. */
    pluginOptionUnavailable: (title: string, reason: string) => `${title}(不支持:${reason})`,
    /** A switch one of whose positions this machine cannot honour, under the switch. */
    pluginPositionUnavailable: (position: string, reason: string) =>
      `本机不支持${position}:${reason}`,
    pluginPositionOn: "开启",
    pluginPositionOff: "关闭",
    pluginsInfo:
      "各已装载插件在其包里声明的选项,表单按插件自己的 schema 生成。与插件本身一样是服务器全局的;保存后立即送达插件,无需重启。没有声明选项的插件不会出现在这里。",
    /** A secret field with a stored value: submitting it empty keeps the stored one. */
    pluginSecretKeepHint: "留空保持已保存的值不变",
    pluginSecretClear: "清除已存值",
    /** The Plugins settings page's machine picker: each server keeps its own plugin settings. */
    pluginConfigMachine: "机器",
    /** A plugin group's action: it runs once on the picked machine, and only the plugin knows what it does. */
    pluginActionTitle: "执行插件操作",
    pluginActionRun: "执行",
    /** `machine` is the picked machine's name, null for this server. */
    pluginActionConfirm: (action: string, machine: string | null): string =>
      `在${machine === null ? "本机" : ` ${machine} `}上执行「${action}」?它会立即在那台机器上运行,具体做什么由插件决定。`,
    /** Under a number field whose box does not parse; the save is not sent. */
    pluginFieldNotNumber: "必须是数字",
    /**
     * Admin-only sub-page (server-global): the data root's storage ledger, and the human-reviewed
     * cleanup that reads it — a report on one side, a bill and its approval on the other.
     */
    storageTitle: "存储台账",
    /**
     * The one line at the top of that page's own body: what the page is, and the promise it keeps
     * now that it can also move something. Deliberately visible rather than folded into the
     * heading's "?" — it is what keeps the figures and the buttons below from reading as an offer
     * to free space automatically.
     */
    storageReportOnly:
      "默认是一个字节都不动:清理模式关着的时候,本页只测量并列出磁盘上的内容。" +
      "开启之后,「重新扫描」写出一份账单,只有你勾选的条目才会被移入回收站——在那里可以恢复。" +
      "没有任何操作会自动运行,唯一的删除是回收站里的「彻底删除」。",
    /** The page's "?" at the pane heading: what is measured, and what a candidate is (and is not). */
    storageInfo:
      "测量的是本机的数据根目录,一次遍历得出:每个字节按来源归入一个类别,各类别互不重叠,合计即根目录本身的大小。" +
      "「候选」是条目命中的规则——空目录、无引用、会话已删除、静默超期、超出预算——它是一条关于出处的判断,不是一次操作," +
      "而且「仍被引用」要等到真正执行时才重新计算。多数阈值默认关闭,所以候选少并不代表磁盘上没有冗余;" +
      "「无法读取的路径」列出这次没读到的位置,报告因此不会显得比实际更完整。",
    /** The report's own header: the root, when it was measured, the total, and the volume's numbers. */
    storageRoot: "数据根目录",
    storageMeasuredAt: "测量时间",
    storageTotal: "合计",
    storageDiskFree: "磁盘剩余 / 总容量",
    /** `disk` is null when the volume's own numbers could not be read. */
    storageDiskUnknown: "未读到磁盘容量",
    /** The page's only action: measure again (a walk of the whole root, so it is not free). */
    storageRescan: "重新测量",
    storageRescanning: "测量中…",
    storageLoading: "正在测量…",
    storageFailed: "无法取得存储报告。",
    /** The class table and its columns. */
    storageClassesTitle: "按类别",
    storageColClass: "类别",
    storageColBytes: "占用",
    storageColFiles: "文件",
    storageColEntries: "条目",
    storageColCandidateEntries: "候选条目",
    storageColCandidateBytes: "候选占用",
    /** Class ids in the reader's words; the ids themselves stay protected / tmp_workspaces / … */
    storageClassNames: {
      protected: "用户资产",
      tmp_workspaces: "临时工作区",
      session_drafts: "会话草稿",
      traces: "轨迹",
      shared_env: "工具环境",
      trash: "回收站",
      database: "数据库",
      other: "其他",
    },
    /**
     * What removing one entry of a class would cost, under its name in the class table. `protected`
     * is never reported as a candidate, so its line says that rather than inventing a price.
     */
    storageClassCost: {
      protected:
        "你自己的数据:智能体状态、项目配置、你指定的 WorkSpace、密钥库、插件、评估集与快照。它从不成为候选,本页也不会动它。",
      tmp_workspaces:
        "工具在临时目录里建的 WorkSpace:清掉会连里面的文件一起消失,正在用它运行的任务会被打断。",
      session_drafts:
        "会话草稿:清掉之后,旧消息里附上的图片不再能预览,重新打开那条消息也恢复不了。",
      traces: "轨迹:清掉之后,历史回放与成本页失去重建来源,那些会话的往返与用量再也算不出来。",
      shared_env: "为智能体建的工具环境:清掉之后,下次用到它要重新装一遍。",
      trash: "回收站里的东西:清空它就再也找不回来了。",
      database: "服务器自己的数据库(账号、会话索引、设置)。清掉它等于丢掉这些状态。",
      other: "没有归入其他类别的文件:清掉它连内容一起消失,而且没人能说出丢的是什么。",
    },
    /** The candidate list: its heading, its empty state, and its columns. */
    storageCandidatesTitle: "候选条目",
    storageCandidatesEmpty: "这次测量没有找到候选条目。",
    storageCandidatesEmptyHint:
      "这不代表磁盘上没有冗余:多数规则默认关闭,只有确实命中规则的条目才会列在这里。",
    storageColPath: "路径",
    storageColLastModified: "最近修改",
    /** A candidate whose newest mtime could not be read. */
    storageNeverModified: "读不到",
    /** Dated on purpose: the value is what the scan saw, and a cleanup recomputes it before acting. */
    storageColReferenced: "扫描时仍被引用",
    storageReferencedYes: "是",
    storageReferencedNo: "否",
    storageColRules: "命中的规则",
    /** A candidate the server recorded no rule for — shown rather than left blank. */
    storageRulesNone: "未记录规则",
    /** Rule ids in the reader's words; the ids themselves stay empty / orphan / idle / budget / unreferenced. */
    storageRuleNames: {
      empty: "空目录",
      unreferenced: "无引用",
      orphan: "会话已删除",
      idle: "静默超期",
      budget: "超出预算",
    },
    /** Duplicate-looking tool environments. Report only — merging them is a person's call. */
    storageEnvGroupsTitle: "疑似重复的工具环境",
    storageEnvGroupsHint:
      "仅供查看:同一个工具可能装了不止一份。合并需要人来决定——两份看起来一样的未必是同一个版本——本页不会动它们。",
    storageEnvGroupKindName: "同名",
    storageEnvGroupKindStructure: "结构相似",
    /** How many environments the group holds. */
    storageEnvGroupMembers: (count: number): string => `${count} 份`,
    /** Paths nobody could read: the report says what it does not know. */
    storageUnreadableTitle: "无法读取的路径",
    storageUnreadableHint:
      "这些位置在测量时没有读到,其中的内容没有进入上面的统计,所以上面的数字是下限。",
    /**
     * The cleanup mode: the switch a person turns on, and what each position means. Each sentence
     * names what the OTHER position cannot do, because that difference is the whole page.
     */
    storageModeTitle: "清理模式",
    storageModeLabel: "允许人工审核后的清理",
    storageModeOn:
      "已开启:可以扫描出一份账单、把勾选的条目移入回收站,也可以把回收站里的内容恢复回去。" +
      "删除只发生在「彻底删除」这一步,而且要你自己按下按钮。",
    storageModeOff:
      "已关闭:本页只测量并列出磁盘上的内容,扫描、固定、移动和清空都不会发生,没有任何东西会被挪动。" +
      "这是默认状态,也不会自己改变。",
    /** The mode's settings could not be read: the page then behaves as if it were off. */
    storageModeFailed: "无法读取清理模式设置,因此按「已关闭」处理。",
    /** The hint on every write control the mode gates, so a disabled button says why. */
    storageModeRequired: "需要先开启清理模式",
    /**
     * A mode switch the server refused, drawn under the sentence that describes the switch: which
     * way it was asked to move (the switch itself never moved), and the reason as the server gave it.
     */
    storageModeRefused: (enabled: boolean, reason: string): string =>
      `${enabled ? "开启" : "关闭"}清理模式被拒:${reason}`,
    /** The bill's own state, one sentence each: the difference decides whether a selection may run. */
    storagePlanStateText: {
      usable: "尚未执行,且仍在有效期内:勾选的条目可以被移动。",
      applied: "已经执行过一次。一份账单只对一次执行有效,要再清理请重新扫描。",
      expired: "已超过有效期。请重新扫描,让账单描述的是现在的磁盘。",
    },
    /** The scan that writes a bill; the ledger's own button beside it only measures again. */
    storageScan: "重新扫描",
    storageScanning: "扫描中…",
    storageScanHint:
      "「重新扫描」会遍历数据根目录并写出一份账单,列出的条目是这次扫描的候选。" +
      "账单本身不移动任何东西:移动只发生在你勾选条目并按下「执行清理」之后。",
    storageScanEmpty: "这次扫描没有找到候选条目,因此这份账单里没有可以移动的东西。",
    storageScanFailed: "扫描失败,没有可以审阅的账单。",
    /** The bill's own header. */
    storageBillTitle: "账单",
    storageBillId: "账单编号",
    storageBillCreatedAt: "生成时间",
    storageBillExpiresAt: "有效期至",
    storageBillTotal: "账单合计",
    storageBillEntries: (count: number): string => `${count} 个条目`,
    storageBillHint:
      "账单是扫描那一刻的快照。执行之前服务器会按现在的情况复核一遍,对不上的条目会被拒绝,而不是照旧被移动。",
    /** Before any scan has produced one: the page says what to press rather than leaving a void. */
    storageBillNone: "还没有可审阅的账单。",
    /** The bill's own columns: the box, the rule that put the row there, and what may be done with it. */
    storageColSelect: "选中",
    storageColExecutable: "能否移动",
    storageColPin: "固定",
    /** The review: one group per class, and the boxes that decide what may move. */
    storageBillClassesTitle: "按类别审阅",
    storageBillGroupTotals: (entries: number, bytes: string): string =>
      `${entries} 个条目 · ${bytes}`,
    storageSelectClass: "全选本类",
    storageUnselectClass: "取消本类",
    storageSelectClassNothing: "本类没有可移动的条目",
    /** Whether this version may act on a row at all; the rest are on the bill to be read. */
    storageExecutable: {
      yes: "可以移动",
      no: "仅供查看",
    },
    /** The selection: nothing is ticked until a person ticks it, and the page says so. */
    storageSelectionNone: "尚未勾选任何条目——默认是一个字节都不动。",
    storageSelectionSummary: (entries: number, bytes: string): string =>
      `已勾选 ${entries} 个条目,合计 ${bytes}`,
    /** The pins: what a person decided to keep, and what a bill therefore leaves out. */
    storagePinsTitle: (count: number): string => `已固定 ${count} 条路径`,
    storagePinsEmpty: "还没有固定任何路径。",
    storagePinsHint: "固定的路径不会再出现在之后的任何账单里,直到你取消固定。",
    storageExcludedTitle: (count: number): string => `这份账单排除了 ${count} 条已固定路径`,
    storagePin: "固定",
    storageUnpin: "取消固定",
    /**
     * A pin the server refused, drawn under that row's own button in its words: pinning and
     * unpinning are two different asks, and the path says which row it is about.
     */
    storagePinRefused: (path: string, reason: string): string => `固定「${path}」被拒:${reason}`,
    storageUnpinRefused: (path: string, reason: string): string =>
      `取消固定「${path}」被拒:${reason}`,
    /** The one action that moves something, and what it does when it does it. */
    storageApply: "执行清理",
    storageApplying: "清理中…",
    storageApplyHint: "只移动勾选的条目,而且是移入回收站:可以再恢复,这不是删除。",
    storageApplyResult: (moved: number, bytes: string): string =>
      `已移动 ${moved} 个条目,回收 ${bytes}`,
    storageApplyNothingMoved: "没有条目被移动。",
    storageApplyTrashId: (id: string): string => `回收站条目:${id}`,
    storageApplyFailedTitle: "未能移动的条目",
    storageApplyFailedLine: (path: string, reason: string): string => `${path}:${reason}`,
    /** The trash: what a move put aside, and the two things a person may do with it. */
    storageTrashTitle: "回收站",
    storageTrashHint: (days: number): string =>
      `移入的条目至少保留 ${days} 天。保留期内没有任何东西会自动删除——删除永远需要你按下按钮。`,
    storageTrashEmpty: "回收站是空的。",
    storageColTrashId: "回收站条目",
    storageColTrashCreated: "移入时间",
    storageColTrashItems: "条目",
    storageColTrashState: "状态",
    storageColTrashActions: "操作",
    storageTrashStateNames: {
      fresh: "保留中",
      expired: "已过保留期",
    },
    storageTrashRestore: "恢复",
    storageTrashRestoring: "恢复中…",
    storageTrashPurge: "彻底删除",
    storageTrashPurgeExpired: "彻底删除已过保留期的",
    storageTrashPurgeWarning:
      "「彻底删除」是本页唯一的删除操作:回收站里的内容会就此消失,无法恢复。",
    storageTrashPurgedNothing: "没有可删除的内容。",
    storageTrashPurged: (count: number, bytes: string): string =>
      `已彻底删除 ${count} 项,共 ${bytes}`,
    storageTrashRestored: (restored: number, skipped: number): string =>
      `已恢复 ${restored} 个条目,跳过 ${skipped} 个`,
    storageTrashRestoreRemaining: {
      yes: "回收站条目里还有内容,这次没有全部恢复。",
      no: "回收站条目已经空了,随之被移除。",
    },
    storageTrashSkippedLine: (path: string, reason: string): string => `${path}:${reason}`,
    /**
     * A trash write the server refused, drawn under the button that asked: which action, the entry
     * it was for where there is one, and the reason as the server gave it. The words name the same
     * action the button does, so the line still reads right under the batch button.
     */
    storageTrashRefusedRestore: (id: string, reason: string): string =>
      `恢复「${id}」被拒:${reason}`,
    storageTrashRefusedPurge: (id: string, reason: string): string =>
      `彻底删除「${id}」被拒:${reason}`,
    storageTrashRefusedExpired: (reason: string): string =>
      `彻底删除已过保留期的条目被拒:${reason}`,
    uploadLimitsTitle: "上传限制",
    /** Its two number fields, both in whole MB. */
    attachmentMaxMb: "单个附件上限(MB)",
    attachmentTotalMb: "单条消息附件合计上限(MB)",
    /** Accepted range for each field: read while typing, so it stays under the field. */
    attachmentMaxMbHint: (min: number, max: number): string => `取值 ${min}–${max} MB`,
    attachmentTotalMbHint: (min: number, max: number): string =>
      `取值 ${min}–${max} MB,且不得低于单个附件上限`,
    /** What these two numbers do NOT govern — disclosed at the pane heading. */
    uploadLimitsInfo: (count: number, imageMb: number): string =>
      `一条消息最多 ${count} 个附件;对话内嵌图片另有 ${imageMb}MB 上限,不随此设置变化——` +
      `图片会进入对话与轨迹,每次翻阅历史与恢复会话都要重新付出它的体积。`,
    speechTitle: "语音输入",
    /** Disclosed at the pane heading: where the audio goes, and where the key lives. */
    speechInfo:
      "录音在浏览器里完成,识别在服务器上做:录音交给下列服务商转成文字,服务商密钥只留在这台服务器上," +
      "不随页面下发。配好之后,聊天输入框的麦克风按钮就能用。两家用同一套协议、同一个模型,只有站点不同。",
    speechBaseUrl: "服务地址",
    speechBaseUrlHint:
      "服务商的站点地址:词元跳动填 https://tokendance.space,阿里百炼填 https://dashscope.aliyuncs.com",
    speechModel: "识别模型",
    speechModelHint: "服务商那边的模型 ID,例如 qwen-audio-3.1-asr-flash-streaming",
    speechApiKey: "API 密钥",
    speechApiKeyHint: "留空表示沿用已保存的密钥",
    /** The two states of the stored key, shown beside the key field. */
    speechKeyStored: "已保存密钥",
    speechKeyMissing: "尚未保存密钥,语音输入暂不可用",
    /**
     * The connectivity check: one whole task against the site, so an operator learns before
     * recording that the key, the site or the model is wrong. It checks what is on screen rather
     * than what is stored — saving a key just to find out whether it works is the wrong order —
     * and both sentences name the endpoint, because the one thing invisible in the fields is
     * which of the two paths a site address resolves to.
     */
    speechTest: "测试连通性",
    speechTestRunning: "正在测试…",
    speechTestOk: (endpoint: string): string => `连通正常,用的是 ${endpoint}`,
    /** Followed by the service's own sentence, untranslated. */
    speechTestFailed: (endpoint: string): string => `连不通,用的是 ${endpoint}:`,
    /** The fold holding the fields a settings group marks advanced. */
    pluginAdvanced: "高级选项",
    /** A table cell its row does not let change, beside the lock mark. */
    pluginCellLocked: "已锁定:此行保持这个取值",
    pluginCellOn: "开",
    pluginCellOff: "关",
    /** A table row's drag handle: what it moves, and how. */
    pluginTableMove: (row: string) => `移动 ${row}`,
    pluginTableMoveHint: "拖动,或按上下方向键",
    /** The add button under an extensible table that names none of its own. */
    pluginTableAdd: "添加一行",
    /** After the chosen row's name (the sandbox's default preset): the row choice's title. */
    pluginTableChosenMarker: (title: string) => `(${title})`,
    /** A table row's "…" button: its accessible name and tooltip. */
    pluginTableRowMenu: (row: string) => `更多操作:${row}`,
    pluginTableRowMenuHint: "更多操作",
    /** The row menu's items: make the row the chosen one, and delete a row an administrator added. */
    pluginTableChoose: "设为默认",
    pluginTableChosen: "已是默认",
    pluginTableDelete: "删除",
    pluginTableDeleteChosen: "请先把其他行设为默认",
    /** One line of a row's "?" that lists its values: a choice column's value, and what it does. */
    pluginTableRowValue: (column: string, value: string, does: string | undefined) =>
      does === undefined ? `${column}:${value}` : `${column}:${value}。${does}`,
    /** Asked when the Sandbox switch is turned on and the machine has no sandbox backend. */
    sandboxBackendPrompt: {
      title: "安装沙盒后端",
      body: (machine: string, pkgs: readonly string[]) =>
        `${machine} 没有适用于其操作系统的沙盒后端,新会话暂时无法进入沙盒。是否安装 ${pkgs.join(" 和 ")}?` +
        (pkgs.length > 1 ? "两者都可用时,使用封禁范围更大的那个。" : ""),
      cost: "安装会重新装载服务器的插件,所有项目中正在进行的 Agent 运行都会停止。无论是否安装,开关都保持打开。",
      install: "安装",
      installing: "正在安装…",
      later: "暂不",
      dontAsk: "此机器不再询问",
      noProject: "请先打开一个项目:后端会安装到当前项目。",
      /** The run stopped on a request that never answered — the reason, not a package's own. */
      installStopped: (reason: string) => `安装请求失败:${reason}`,
      /**
       * What the prompt keeps after a run that left packages behind: the reasons it has (a package
       * that would not load, a request that failed), then the ones still missing — they are what
       * the Install button behind this sentence retries.
       */
      installRefused: (reasons: readonly string[], missing: readonly string[]) =>
        `${reasons.length > 0 ? `${reasons.join(";")}。` : ""}` +
        `还没装上:${missing.join("、")}。可以再点一次「安装」。`,
    },
    theme: "主题",
    themeInfo: "应用的整体风格:布局、线条、字体与动效随之改变,内容与其他设置不受影响。",
    /** Display names of the three themes; the ids stay github / modern / geek. */
    themeNames: { github: "通用", modern: "白领", geek: "极客" },
    /**
     * The row under the theme picker: the folder the server reads, with the "?" beside it saying
     * which path and what a file looks like.
     */
    importedThemesHelp: "主题目录",
    importedThemesHint:
      "把主题的 .json 文件放进这个目录,点「重新读取」它就会出现在上面的主题列表里;格式见仓库里的 examples/themes/warm-paper.json。管理员也可以直接导入,不用走到目录里。",
    importedThemesReadAgain: "重新读取",
    /** The admin's entry beside "read again": the same install, without walking to the folder. */
    themeImport: "导入主题…",
    themeImportTitle: "导入主题",
    /** The dialog's source switch: the two ways a theme file reaches the server. */
    themeImportSourceFile: "本地文件",
    themeImportSourceUrl: "地址",
    themeImportFileDesc:
      "选一个主题的 .json 文件(格式见 examples/themes/warm-paper.json)。文件里的主题名就是它的身份:同名再来一次会先问一句覆盖。",
    themeImportPickFile: "选择 .json 文件",
    themeImportPicked: (file: string) => `已选择 ${file}`,
    themeImportUrlDesc:
      "填一个主题 .json 的地址,由服务端取回来——本机或内网地址会被拒绝,取回的内容按同一套读法校验。",
    themeImportUrlLabel: "主题文件地址",
    themeImportUrlPlaceholder: "https://example.com/theme.json",
    themeImportUploadAction: "上传并导入",
    themeImportDownloadAction: "下载并导入",
    themeImportBusy: "正在导入…",
    themeImportDone: (name: string) => `已导入主题 ${name}`,
    /** The 409 both imports answer with, when a file already provides this theme's id. */
    themeImportOverwriteTitle: "覆盖已导入的主题",
    themeImportOverwriteBody:
      "这个文件里的主题名已经有一套主题占了(同一个主题名)。覆盖会用这个文件替换它现在的文件,不可恢复。确认继续?",
    themeImportOverwriteAction: "覆盖导入",
    themeImportTooLarge: "这个文件超过了 256 KB 的上限。",
    themeImportInvalid: (reason: string) => `这个文件读不出一个主题:${reason}`,
    themeImportBlockedUrl: "这个地址指向本机或内网,服务端不会去取。",
    themeImportDownloadFailed: "取不回来:地址、网络或对方的状态码有问题。",
    themeImportBadUrl: "地址要是一个 http:// 或 https:// 开头的网址。",
    /** The theme library: a remote catalogue this installation can import from. */
    themeRegistry: "主题库",
    themeRegistryInfo:
      "远端的一份主题目录,服务端读进来,适合的主题点一下就装到本机。默认是 npm 上 @lmliheng/adelie-themes 的主题包,也可以用 ADELIE_THEME_REGISTRY 换成自建镜像。",
    themeRegistryReadAgain: "刷新",
    themeRegistryLoading: "正在读取主题库…",
    themeRegistryEmpty: "主题库里暂时没有主题。",
    themeRegistryFailed: "这次没读到主题库,稍后再试。",
    themeRegistryInvalid: (reason: string) => `主题库目录读不出来:${reason}`,
    themeRegistryUnusable: "主题库地址不是 http(s) 地址,检查 ADELIE_THEME_REGISTRY。",
    themeRegistryImport: "导入",
    themeRegistryReimport: "重新导入",
    themeRegistryInstalled: "已安装",
    themeRegistryImported: (name: string) => `已从主题库导入 ${name}`,
    themeRegistryGone: "主题库里已经没有这个主题了,刷新一下再看。",
    themeRegistryMismatch: "主题库把这一条指错了文件:装下来的主题不是它写的那个名字。",
    themeRegistryBy: (author: string) => `作者 ${author}`,
    importedThemesFailed: "这次没读到导入的主题列表,稍后再试。",
    importedThemesNoFile: (id: string) =>
      `现在选的「${id}」没有对应的主题文件,页面先用默认主题画。`,
    importedThemesMore: (count: number) => `等 ${count} 个`,
    importedThemeUnknown: (count: number, names: string) =>
      `${count} 个名字这边不认识(${names}),这些设置不会生效。`,
    importedThemeMissing: (count: number, names: string) =>
      `${count} 个令牌这个主题没写(${names}),它们沿用「通用」主题的值。`,
    /** The same two facts as one line each, so a half-filled theme is not a wall of names. */
    importedThemeUnknownShort: (count: number) => `${count} 个令牌名不认识`,
    importedThemeMissingShort: (count: number) => `${count} 个令牌沿用默认值`,
    importedThemeDetails: "看是哪些",
    /** The picker's two groups, and the tag on a card a file brought. */
    themeBuiltin: "内置主题",
    themeImportedGroup: "导入主题",
    importedThemeRejected: (file: string, reason: string) => `${file}:${reason}`,
    colorMode: "明暗",
    colorModeInfo: "应用的明暗外观。",
    themeLight: "浅色",
    themeDark: "深色",
    followSystem: "跟随系统",
    terminalTheme: "终端主题",
    terminalThemeInfo: "终端面板的配色,默认跟随应用主题。",
    followAppTheme: "跟随主题",
    langZh: "中文",
    langEn: "English",
    fontSize: "字号",
    fontSizeInfo: "界面整体字号。",
    textSizeNames: { xs: "特小", s: "小", m: "中", l: "大", xl: "特大" },
    fonts: "字体",
    fontsInfo: "英文与中文各自的字体,默认随主题;代码与等宽文字始终使用主题的等宽字体。",
    fontLatin: "英文",
    fontCjk: "中文",
    fontFollowTheme: "随主题",
    fontSystem: "系统字体",
    accent: "强调色",
    accentInfo:
      "界面强调色。每个主题有自己的一组强调色,换主题后不在新主题里的颜色会暂时按「随主题」显示。",
    launcher: "快捷方式悬浮球",
    launcherInfo:
      "在对话正文右缘浮动的圆形按钮,展开后是工作台各块面板与终端的快捷方式;这里关掉后它就不再出现,展开里的「隐藏悬浮球」同样会关掉它。",
    toolAliases: "工具短名",
    toolAliasesInfo:
      "对话里的工具卡片用短名称呼内置工具,read_file 显示为「读取」。其余工具(含 MCP 工具)与轨迹观测始终是工具原本的名字;悬停短名也能看到它。",
    notifications: "任务完成通知",
    notificationsInfo:
      "Task 在窗口失焦或隐藏时结束,弹一条系统通知,点击即回到该 Session。打开这个开关会当场向系统申请通知权限——系统只问这一次,被拒之后不再询问,只能到系统的通知设置里改回来。",
    notificationsDenied: "系统已拒绝本应用的通知权限。请先在系统的通知设置中允许,再打开这个开关。",
    notificationsDismissed:
      "权限提示被关闭、没有给出答复,通知因此保持关闭。再次打开这个开关可以重新申请。",
    notificationsUnsupported: "当前浏览器不支持系统通知。",
    /** Desktop shell only: the system-tray icon. Absent in a browser. */
    trayIcon: "托盘图标",
    trayIconInfo:
      "桌面应用运行期间在系统托盘(Windows 通知区、macOS 菜单栏、Linux 托盘)常驻一个图标,点击即可回到窗口,右键可开新会话或退出。默认开启;关掉后图标立即消失,无需重启,此时关闭窗口不再收进托盘:macOS 应用留在 Dock,Windows 与 Linux 关窗即退出。",
    /**
     * Desktop shell only (Windows): the sign-in entry. The row is drawn only for a shell that
     * answers `supported`, and its value is what Windows itself holds — see the switch's note.
     */
    startAtLogin: "开机自启动",
    startAtLoginInfo:
      "登录 Windows 后自动启动 Adelie,开机那一次只在托盘待命、不弹窗,点托盘图标就能打开窗口。默认关闭;这条登记写在当前用户的启动项里(HKCU 的 Run 键),不需要管理员权限,不上系统服务。你在「任务管理器 › 启动应用」里禁用它,这里也会如实显示成关闭;卸载时会一并删掉。",
    /** Desktop shell only: the companion window at /pet. */
    showPet: "桌面宠物",
    showPetInfo:
      "桌面右下角常驻一只小企鹅:定时任务触发、有工具调用等你批准、公司预算告警时它会冒个气泡,点它可以看模型余额和客户端更新,也能在那里隐藏它。默认关闭;打开或关掉都立即生效,不会碰你正在用的窗口。",
    currencyInfo: "价格显示币种;存储始终为美元。",
    changePasswordInfo: "更改当前账号的登录密码。",
    /** Personal company-mode switch (general page) and the admin master switch (its own server page). */
    companyModeTitle: "公司模式",
    companyModePersonal: "公司模式",
    companyModePersonalInfo:
      "关闭只隐藏本人的模式切换,组织照常运转;管理员的总开关在「服务器」分组。",
    companyModeServer: "启用公司模式",
    companyModeServerInfo:
      "服务器总开关,缺省关闭,需由管理员在此打开。关闭即停用组织调度器与全部组织路由,并隐藏所有人的模式切换;磁盘上的组织不受影响,重新打开后不会补发错过的触发。内测功能:可能有不稳定的现象,遇到问题请反馈。",
    accentNames: {
      neutral: "随主题",
      blue: "蓝",
      green: "绿",
      violet: "紫",
      rose: "红",
      amber: "橙",
      ocean: "海蓝",
      clay: "陶土",
      plum: "梅紫",
      honey: "蜂蜜",
      slate: "石板灰",
      phosphor: "荧光绿",
      cyan: "青",
      magenta: "品红",
      gold: "金",
      cobalt: "钴蓝",
      orange: "橙红",
    } as Record<string, string>,
  },

  commandPalette: {
    title: "命令面板",
    placeholder: "输入以筛选命令…",
    noResults: "没有匹配的命令",
    /** Footer of the palette; `toggle` is the formatted palette.toggle chord, null while unbound. */
    hint: (toggle: string | null): string =>
      toggle === null ? "↑↓ 选择 · Enter 执行" : `${toggle} 切换 · ↑↓ 选择 · Enter 执行`,
    harnessHistory: "Harness 历史",
  },
  modelPicker: {
    /** Accessible name of the dialog's provider-group rail. */
    groups: "模型分组",
    /** Footer toggle while models without a key are listed: turns the listing back off. */
    hideModelsWithoutKey: "隐藏未配置 key 的模型",
    /**
     * Footer keyboard legend; `mod` is "⌥" on macOS and "Alt+" elsewhere. Only the two moves a
     * list does not suggest by itself — ↑↓, Enter and Esc go without saying, and the footer
     * shares its line with the key-less toggle.
     */
    hint: (mod: string): string => `←→ 切换分组与列表 · ${mod}1–9 跳到分组`,
  },
  workflows: {
    tabsLabel: "聊天与工作流",
    chatTab: "聊天",
    brokenMark: "当前文件加载失败",
    reload: "重新加载",
    reloading: "加载中…",
    history: "历史",
    loadError: "加载失败",
    loadingHistory: "加载历史…",
    /** The full-page route while it is still finding out which page it should show. */
    loadingPage: "正在打开页面…",
    noHistory: "还没有记录过版本。",
    current: "当前",
    restore: "恢复",
    remove: "移除",
    fillApp: "占满应用",
    /** `palette` is the formatted palette.toggle chord, null while unbound. */
    fillAppHint: (palette: string | null): string =>
      palette === null
        ? "让这个页面占满整个应用;打开命令面板可退出"
        : `让这个页面占满整个应用;${palette} 打开命令面板可退出`,
    exitFullPage: "退出全页模式(回到聊天)",
    exitHint: (palette: string | null): string =>
      palette === null ? "打开命令面板可回到聊天。" : `按 ${palette} 打开命令面板可回到聊天。`,
    noSuchPage: "这个 workflow 不存在或没有页面。",
    removeConfirm: "删除这个工作流及其全部已记录版本?",
    removeYes: "确认移除",
    removing: "移除中…",
    removeNo: "取消",
    fileCount: (n: number) => `${n} 个文件`,
  },
  harnessHistory: {
    title: "Harness 历史",
    pageDesc:
      "这台服务器通过热更新提交过的每个 harness 版本,最新在前,以及每次推送在模块树与接口上改了什么。",
    loading: "加载中…",
    empty: "还没有向这台服务器推送过 harness。",
    current: "当前",
    noProvenance: "(未记录来源)",
    pushedAt: "提交时间",
    bundles: "Bundle",
    table: "接口表",
    tableCounts: (nodes: number, interfaces: number, types: number) =>
      `${nodes} 个节点 · ${interfaces} 个接口 · ${types} 个类型`,
    noTable: "这次推送没有携带接口表。",
    noTableShort: "无表",
    changesSince: (previous: string) => `相对 ${previous} 的变化`,
    changesFirst: "变化(首个记录的表)",
    noChanges: "接口与树没有变化。",
    nodes: (n: number) => `节点(${n})`,
    interfaces: (n: number) => `接口(${n})`,
    typesSummary: (added: number, removed: number, changed: number) =>
      `数据类型:新增 ${added},移除 ${removed},变化 ${changed}`,
    change: { added: "新增", removed: "移除", changed: "变化" },
    rollback: "回滚到这个版本",
    rollbackConfirm: "把这个版本推回去并立即切换?",
    rollbackYes: "回滚",
    rollbackPushing: "推送中……到达后服务器会切换。",
    rollbackTimeout: "服务器没有及时报告切换;请查看历史。",
    notKept: "这个版本的产物没有保留,无法推回。",
    viewChanges: "变化",
    viewTree: "模块树",
    kind: { group: "组", module: "模块", component: "组件" },
    expand: "展开",
    collapse: "收起",
    extensionSlot: "+ 扩展模块",
    ownProvision: "自身",
    pickNode: "选一个节点,查看它需要和提供什么。",
    requires: "requires",
    provides: "provides",
    contributes: "contributes",
    children: "children",
    exports: "exports",
    methods: "方法",
    fields: "字段",
    slots: "槽位",
  },
  /**
   * The software-update flow (lib/update-flow.ts): the one modal for both the server release
   * and the desktop client, the account-menu row, the version-line badge, and the toasts for
   * outcomes that land while the modal is closed. Null version = the backend named none.
   */
  update: {
    /** Version-line date label (owner-specified wording); `date` is formatMonthDay output. */
    lastUpdated: (date: string) => `最近更新日期 ${date}`,
    /**
     * The version line's trailing half when the check knows a newer release: its number, so the
     * line itself answers "我落后了没有". The superscript badge beside it says an update exists
     * but carries the version only in its tooltip, which left a reader two releases behind
     * unable to see how far behind they were.
     */
    latestRelease: (v: string) => `最新版本 v${v}`,
    /** The version line's superscript (owner-specified wording), a button into the modal; the other two follow the flow. */
    newVersionBadge: "有新版本可用",
    badgeDownloading: "正在下载更新",
    badgeReady: "重启以更新",
    /** A release offered: the row's label and the avatar badges' sentence. */
    newVersion: (v: string) => `新版本 v${v} 可用`,
    /** A release downloaded / installed and waiting for the restart: the row's label and the badges' sentence. */
    restartToUpdate: (v: string | null) => (v !== null ? `重启以更新到 v${v}` : "重启以完成更新"),
    /** The combined wording for an anchor covering several update trails at once. */
    updatesAvailable: "有可用更新",
    // —— the account-menu row ——
    checkNow: "检查更新",
    checking: "检查中…",
    rowDownloading: (v: string | null, percent: number | null) =>
      `正在下载${v !== null ? ` v${v}` : "更新"}${percent !== null ? ` ${percent}%` : "…"}`,
    rowRestarting: "正在重启…",
    rowUnsupported: "无法在线更新",
    // —— the modal ——
    title: "软件更新",
    currentVersion: (v: string) => `当前版本 v${v}`,
    checkingBody: "正在检查更新…",
    upToDate: "已是最新版本",
    checkFailed: "检查更新失败,请稍后重试",
    checkDisabled: "更新检查已关闭(ADELIE_UPDATE_CHECK=off)",
    releaseNotes: "更新说明",
    openReleases: "打开 Releases 页面",
    /** What "download and update" does, per backend. */
    availableBodyRelease:
      "将下载最新版本并安装到服务器上的安装目录(数据目录不受影响)。下载期间可以关闭本窗口,安装完成后重启服务即可生效。",
    availableBodyClient:
      "将下载新版本。下载期间可以关闭本窗口继续使用,下载完成后重启应用即可完成更新。",
    /** Shown to non-admins in place of the body above (they can read the notes but cannot run the update). */
    adminOnly: "只有管理员可以在这里执行更新。",
    downloadAndInstall: "下载并更新",
    later: "稍后",
    background: "放到后台",
    downloading: (v: string | null) => (v !== null ? `正在下载 v${v}…` : "正在下载更新…"),
    /** The progress bar's accessible name. */
    downloadProgress: "下载进度",
    /** The server job's stages, shown under the bar while it carries no percentage. */
    phaseResolving: "正在获取版本信息…",
    phaseDownloading: "正在下载安装包…",
    phaseInstalling: "正在校验并安装…",
    ready: (v: string | null) => (v !== null ? `v${v} 已就绪` : "更新已就绪"),
    readyBodyRelease: "重启服务即可运行新版本,正在运行的任务会被打断;服务回来后页面会自动刷新。",
    /** Mirrors the shell's native restart prompt: the interruption warning must not disappear on the web path. */
    readyBodyClient: "Adelie 将重启以完成更新,正在运行的任务会被打断。",
    /** Nothing supervises the server process (not started through penguin web / penguin server), so the restart is the user's. */
    readyBodyManual:
      "新版本已安装。当前服务不是由 penguin web 或 penguin server 托管,无法从这里重启:请在终端重新运行 penguin web(或 penguin server)。",
    restartNow: "重启并更新",
    restarting: "正在重启…",
    restartingBodyRelease: "服务回来后页面会自动刷新。",
    restartingBodyClient: "应用即将重启。",
    failed: "更新失败",
    retry: "重试",
    /**
     * The escape hatch on a download that could not reach GitHub (lib/update-troubleshoot.ts):
     * some hosts cannot get to GitHub at all, and no retry from that host changes it. The button
     * opens a new chat with the prompt below; the hint says what it costs before it is pressed,
     * because the model call is the user's own.
     */
    troubleshootAction: "让 Adelie 排查并下载",
    troubleshootHint:
      "需要先在「模型」页配好一个模型:这次排查由它完成,并按用量产生调用开销。点开会新建一个对话并写好排查步骤,是否发送由你决定。",
    /** The prompt's first line; `version` is the release the run was fetching (null when the backend named none). */
    troubleshootPromptLead: (version: string | null) =>
      "自动更新 Adelie 失败:下载 GitHub 上的安装包时没能连上。请排查这台主机的网络,并尽量把新版本装好。\n" +
      `目标版本:${
        version !== null
          ? `v${version}`
          : "不确定,请先查 https://github.com/lmliheng/Adelie/releases/latest 再看"
      }`,
    /** The failed run's own text, quoted into the prompt under this label. */
    troubleshootPromptClip: (output: string) => `失败输出:\n${output}`,
    /** The fixed instruction tail: what to diagnose, where the assets live, and what not to touch. */
    troubleshootPromptTail: (version: string | null) =>
      [
        "请按顺序做完,并如实报告每一步的结果:",
        "1. 先定位断在哪一步:用 curl 查本机到 GitHub 的连通性(https://api.github.com/repos/lmliheng/Adelie/releases/latest 和 https://github.com),看 DNS、代理、TLS 分别成不成,把命令与原始输出列出来。",
        "2. 换一条能走通的通路把资产取回来:",
        `   https://github.com/lmliheng/Adelie/releases/download/${
          version !== null ? `v${version}` : "<版本 tag>"
        }/`,
        "   下有 install.sh、各平台安装包(形如 penguin-linux-x64.tar.gz)与各自的 .sha256,直连不通时可借道可用镜像(给 github.com 加镜像前缀),下载到临时目录。",
        "3. 校验安装包的 sha256 与 .sha256 文件一致后,用下载下来的 install.sh 装到现有安装目录(默认 ~/.adelie,或 PENGUIN_INSTALL_DIR 指向的目录),装完用 penguin --version 确认。",
        "4. 数据目录 ~/.adelie/data 不要动:安装器只替换 bin/lib/web/node。",
        "5. 结论写清楚:哪里不通、走了哪条通路、装成了哪个版本;没成功就说明卡在哪一步、还差什么。",
      ].join("\n"),
    /** Why this install cannot update itself. */
    unsupportedDev: "开发运行不支持自更新",
    unsupportedNonAppImage: "Linux 上只有 AppImage 版本支持自更新——包安装请通过包管理器更新",
    unsupportedNotViaCli: "当前服务不是通过 penguin web 或 penguin server 启动的,无法从这里更新",
    unsupportedCli: "当前安装方式不支持在线更新",
    // —— toasts: outcomes that land while the modal is closed ——
    foundNew: (v: string) => `发现新版本 v${v},打开更新入口即可下载`,
    foundNewUnnamed: "发现新版本,打开更新入口即可下载",
    readyToast: (v: string | null) =>
      v !== null ? `v${v} 已就绪,可重启更新` : "更新已就绪,可重启更新",
    failedToast: "更新失败,打开更新入口查看详情",
    unsupportedToast: "当前安装方式不支持在线更新",
    /** The shell's own updater failure text — a failed download or signature check, not only a failed lookup. */
    clientUpdateFailed: (detail: string) => `客户端更新失败:${detail}`,
    /** A download / restart request failed before the backend could act; `detail` is apiErrorText output. */
    requestFailed: (detail: string) => `无法执行更新操作:${detail}`,
    restartTimedOut: "服务迟迟没有回来,请查看终端里 penguin web 的输出后手动刷新页面",
  },

  /**
   * The four DISMISSIBLE badge trails (Agents / Skill library / model library / cost center),
   * the controls that clear them and the control that acts on all of one at once. The tooltip
   * sentences below are what each dot says; the page notice restates the same count in its own
   * `changes*` wording, since a block that can act needs to say what it would act on.
   */
  todo: {
    pluginUpdates: (n: number) => `${n} 个插件有更新`,
    presetUpdates: (n: number) => `${n} 个预置模型可同步`,
    unexpectedErrors: (n: number) => `${n} 条未预期错误`,
    /** Combined anchor whose trails are not all updates — an unexpected error is not one. */
    pending: "有待处理事项",
    /** Clears an update the user has decided not to take now (a later one raises the badge again). */
    dismiss: "忽略",
    /** The cost center's wording: nothing is being updated there, the errors are simply read. */
    markRead: "标记为已读",

    // —— The page notice's own line and its bulk action (the UI package's TodoNotice) ——

    /** The notice line where the trail can separate genuinely new things from upgradable ones (Models only). */
    changesWithAdded: (added: number, updated: number): string =>
      `检测到变更:${added} 个新增,${updated} 个可升级`,
    /** The same line where the trail has only one honest count — no padded zero (Agents, Plugins). */
    changesUpgradable: (updated: number): string => `检测到变更:${updated} 个可升级`,
    /** Updates every object the notice counts, behind the page's own confirmation. */
    updateNow: "现在升级",
    /** Heading of the confirmation's list of exactly what the batch would write to. */
    willTouch: "将影响以下对象:",
    /** Bulk kernel update confirmation; the body reuses agent.kernelUpdateConfirmBody verbatim. */
    agentsConfirmTitle: (n: number): string => `更新 ${n} 个 Agent 的内核`,
    /** Bulk plugin update confirmation. Same warning as the per-plugin confirm, with no single subject. */
    pluginsConfirmTitle: (n: number): string => `更新 ${n} 个插件`,
    pluginsConfirmBody:
      "更新会把库内当前副本重装到各 Agent,覆盖其已安装的技能与钩子文件——本地改动会丢失,如有需要请先导出备份。",
    /** Bulk preset sync confirmation; the body reuses models.syncCatalogHint verbatim. */
    modelsConfirmTitle: (n: number): string => `同步 ${n} 个预置模型`,
    /** Every target of the batch was written. Counted in Agents: both pages that use this
     * send one request per Agent, and the partial-failure line below names Agents too. */
    bulkDone: (ok: number): string => `已更新 ${ok} 个 Agent`,
    /** Some targets were written and some were not — the failed ones are named, never just counted. */
    bulkPartial: (ok: number, failed: string): string =>
      `已更新 ${ok} 个 Agent;以下未成功:${failed}`,
    /** Separator between named targets in the two strings above. */
    listSeparator: "、",
  },

  /** Task-completion notifications (window unfocused; opt-in, see lib/notification-pref). */
  notify: {
    taskCompleteTitle: "任务完成",
    /** `session` is the Session title (defaultSessionTitle when unnamed). */
    taskCompleteBody: (session: string): string => `「${session}」已完成,点击查看`,
  },

  /**
   * The desktop pet (its own window at /pet; the desktop app only). Its bubble and the panel
   * behind the penguin are the whole surface, and they answer the three questions a person asks
   * while they are looking at the desktop rather than at the app: did anything need me, how much
   * model credit is left, and is there a new build.
   */
  pet: {
    /** The penguin's tooltip and accessible name: what a click opens. */
    open: "点我:余额、新版本和通知",
    /** The panel's footer action, which writes the same preference the Appearance switch does. */
    hide: "隐藏桌宠",
    refresh: "刷新",
    balance: "模型余额",
    /** No balance is pinned to the account (see features/models/balance.ts). */
    balanceMissing: "还没固定余额:在「模型」页点分组余额旁的图钉固定一个。",
    /** The balance route is the shell's server's; a plain browser tab cannot read it. */
    balanceUnavailable: "余额只在桌面应用里能读。",
    update: "客户端更新",
    updateChecking: "正在检查新版本…",
    updateIdle: "还没检查过新版本。",
    /** `version` is the installed shell version. */
    updateUpToDate: (version: string): string => `已是最新(${version})`,
    /** `version` is the newer release. */
    updateAvailable: (version: string): string => `有新版本 ${version}`,
    updateDownloading: (percent: number): string => `正在下载新版本 ${percent}%`,
    updateDownloaded: (version: string): string => `新版本 ${version} 已就绪,重启即可安装`,
    updateUnsupported: "这个安装形式由系统或开发流程管更新。",
    updateError: (message: string): string => `检查新版本失败:${message}`,
    updateUnavailable: "客户端更新只在桌面应用里能读。",
    download: "下载新版本",
    install: "重启安装",
    check: "检查新版本",
    notices: "通知",
    noNotices: "暂时没有新通知。",
    /** `name` is the schedule's name. */
    scheduleFired: (name: string): string => `定时任务「${name}」已触发`,
    /** `count` is how many tool calls are waiting for a person (see session_approvals). */
    approvalsWaiting: (count: number): string => `有 ${count} 个工具调用在等你批准`,
    budgetWarned: "有员工的花费接近预算上限了",
    budgetPaused: "有员工因预算被暂停了",
  },

  common: {
    save: "保存",
    cancel: "取消",
    close: "关闭",
    create: "创建",
    delete: "删除",
    edit: "编辑",
    settings: "设置",
    confirm: "确认",
    /** Sole button of a dialog that only informs: it has nothing to confirm or cancel, so the label acknowledges rather than agrees (and does not repeat the header X's "close"). */
    gotIt: "知道了",
    loading: "加载中…",
    saved: "已保存",
    saving: "保存中…",
    /** Clicking save with nothing changed: an info toast instead of a silent no-op. */
    noChangesToSave: "当前没有需要保存的修改",
    /** Confirm-before-save dialog shared by the settings forms (writes go to server-side config files). */
    confirmSaveTitle: "保存修改",
    confirmSaveBody: "确定保存这些修改吗?修改将写入服务器上的配置文件。",
    none: "(无)",
    retry: "重试",
    unknownError: "请求失败,请稍后重试",
    /**
     * Lead-in for a write the server refused, in the card that asked for it: the reason is the
     * server's own sentence, so the card needs to say what that sentence is about. «被拒绝» is the
     * library's own word for a refused write (the dialogs keep themselves open on one).
     */
    refused: (reason: string) => `操作被拒绝:${reason}`,
    requiredField: "此项必填",
    /** A menu row that copies what it acts on (the conversation's selection menu); the confirmation is `copied`. */
    copy: "复制",
    copied: "已复制",
    /** Accessible name of the circled "?" that discloses a section or field explanation. */
    moreInfo: "说明",
    /** The same, named for what it explains — so the trigger never repeats the heading it sits in. */
    moreInfoAbout: (subject: string) => `说明:${subject}`,
    /** The toast stack's name as a live region (the shared UI package's `Toaster`). */
    notifications: "通知",
    /** Read after a toast's text: pressing the toast dismisses it. */
    dismiss: "关闭",
    /** A pager's two steps, as their names and tooltips (the shared UI package's `Pager`). */
    previousPage: "上一页",
    nextPage: "下一页",
    /** The shared UI package's `Lightbox`: stepping through one batch of pictures. */
    previousImage: "上一张图片",
    nextImage: "下一张图片",
    name: "名称",
    username: "用户名",
    role: "角色",
    actions: "操作",
    created: "创建时间",
    cost: "成本",
    time: "时间",
  },

  /**
   * The id field every create dialog with a semantic id wears (features/semantic-id): a Project's,
   * an Agent's, a Benchmark's, an organization's and a channel's.
   */
  semanticId: {
    /**
     * The id field's generate button — its label says who proposes the id, its tooltip says
     * what the proposal is derived from — and the clause the hint appends for it. The clause
     * carries its own leading separator: what joins two clauses is punctuation, and
     * punctuation belongs to the language.
     */
    generateIdLabel: "用 AI 生成",
    generateId: "从名称生成 ID",
    idGenerateHint: ";也可以从显示名生成",
    /** What the field says about the id a proposal just filled in (see id-suggest-notice.ts). */
    idSuggest: {
      /** Under an id transliterated from the name: quiet, because nothing went wrong. */
      fromName: "按名称转写生成",
      /** Under a placeholder id: it names nothing, so it says why and asks for a real name. */
      placeholder: (reason: string): string =>
        `模型没有给出可用的 ID(${reason}),已填入占位 ID,请改成有含义的英文名`,
      /** Why the proposal fell through, keyed by the server's reason code. */
      reasons: {
        no_free_model: "这个 Project 里没有可用的免费(0 定价)模型",
        model_failed: "免费模型的调用都失败了",
        unusable_answer: "模型回答不可用",
        no_ascii: "名称里没有可转写的英文",
      },
      /** A reason a newer server named and this build does not know. */
      reasonUnknown: "原因未知",
    },
  },

  auth: {
    usernameHint: "2~32 位:小写字母开头,仅小写字母、数字与下划线",
    password: "密码",
    passwordHint: "至少 8 个字符",
    showPassword: "显示密码",
    hidePassword: "隐藏密码",
    login: "登录",
    logout: "登出",
    /** The sign-out confirmation: dialog name and body. */
    logoutConfirmTitle: "登出?",
    logoutConfirmBody: "将退出当前账号并回到登录页;进行中的对话会在服务端继续运行。",
    admin: "管理员",
    defaultAdminNote:
      "首次使用请打开服务端启动输出中的首次登录链接,认领内置管理员 admin 并设置密码。这里没有可输入的初始密码",
    /** Login footer line 2: the offline rescue for a forgotten admin password (other users ask the admin instead). */
    forgotAdminNote:
      "忘记管理员密码时,停止服务后执行 penguin server reset-admin-password;再次启动时会打印新的首次登录链接,打开它即可设置新密码",
    /** Dialog raised over the login form when the server refused a sign-in link (spent, expired, or never valid). */
    claimFailedTitle: "登录链接已失效",
    /** Desktop deployment: the shell mints a fresh link every time it starts, so restarting it is the way back in. */
    claimFailedDesktop:
      "这个一次性登录链接已被使用或已失效。重启 Adelie 桌面应用即可生成新的登录链接并自动登录;也可以在下方用账号密码登录。",
    /** Everywhere else: nobody at this browser can mint a link, so the way in is the form below or whoever runs the server. */
    claimFailedServer:
      "首次登录链接在服务端设置密码后即失效,重启服务端也会换发新的链接。请在下方用账号密码登录,或向管理员索取新的登录链接。",
  },

  /**
   * The Profile page of Settings, and the avatar/nickname it writes. Visible in every
   * session, the desktop shell's own window included: a profile needs no password to change.
   */
  profile: {
    /** Avatar row: its label, and the two actions beside the preview. */
    avatar: "头像",
    /** Disclosed by the "?" beside that label: when a picked image takes effect. */
    avatarInfo:
      "选择图片后立即生效,无需另行保存;旁边的昵称是输入的文本,因此保留了自己的保存按钮。",
    changeAvatar: "更换头像",
    /**
     * Shared label of the two buttons that put a field back to what an account with nothing set
     * shows: the letter tile for the avatar, the username for the nickname. Neither deletes
     * anything the app cannot draw again, which is why it does not say "remove".
     */
    restoreDefault: "恢复默认",
    /** The same, named for what it restores: two of these sit on one page. */
    restoreDefaultOf: (subject: string) => `恢复默认:${subject}`,
    /** The picked image could not be brought under the size limit even as JPEG. */
    avatarTooLarge: "图片过大,请换一张尺寸更小的图片。",
    /** The picked file could not be decoded as an image at all. */
    avatarUnreadable: "无法读取这张图片,请换一个文件。",
    /** Nickname row: the field, and the shape rule that stays on screen while typing. */
    displayName: "昵称",
    displayNameHint: "1–32 个字符,留空即清除",
    displayNamePlaceholder: "留空则显示用户名",
  },

  account: {
    changePassword: "修改密码",
    oldPassword: "当前密码",
    oldPasswordHint: "当前账号登录所用的密码——先校验它,新密码才会生效",
    newPassword: "新密码",
    confirmPassword: "确认新密码",
    passwordMismatch: "两次输入的新密码不一致",
    initialPasswordBanner: "当前账号正在使用初始密码,建议尽快修改",
    changeNow: "去修改",
    /**
     * The user-level vault dialog (the account menu's 用户密钥 row): this account's own
     * key-value table, stored outside every Project. The copy explains what the table is and,
     * just as important, that it reaches no agent on its own — assigning is a separate step
     * taken in the agent's own settings.
     */
    userVault: {
      title: "用户密钥",
      desc: "你自己的全局密钥(存于数据根的 users 目录)。它们不属于任何项目,可以一条条添加,也可以整段 JSON 导入。写在这里不会自动进入任何智能体——在「智能体设置 › 密钥保险柜」里把它「分配」给某个智能体,分配是一次性拷贝。",
      add: "添加",
      addTitle: "添加全局密钥",
      import: "导入 JSON",
      importTitle: "导入 JSON",
      importHint:
        '粘贴整段 JSON 对象,例如 {"OPENAI_API_KEY": "sk-…"}。导入会合并进现有密钥:同名覆盖,其余保留;某一条不合法时整次导入不生效,并指出是哪一条。',
      importPlaceholder: '{\n  "OPENAI_API_KEY": "sk-…",\n  "GITHUB_TOKEN": "ghp_…"\n}',
      importSubmit: "导入",
      jsonLabel: "JSON 对象",
      empty: "还没有全局密钥",
      remove: "删除",
      deleteTitle: "删除全局密钥",
      deleteConfirm: (key: string): string => `确认删除全局密钥「${key}」?值不可恢复。`,
      overwriteTitle: "覆盖已有全局密钥",
      overwriteConfirm: (key: string): string => `「${key}」已存在,保存将覆盖原值且不可恢复。`,
    },
    /**
     * The account menu's live block: which conversations are running at this very moment. The
     * rows sit above the account's own rows (they change without anyone pressing anything), and
     * the empty line matters — "nothing is running" is an answer, not a gap.
     */
    running: {
      title: "正在运行",
      empty: "没有正在运行的会话",
      untitled: "未命名会话",
    },
    /**
     * The account menu's run record: usage by day, each day split by Session. The copy names
     * what a row shows, because the dialog is reached from a menu of pages and has no other
     * introduction.
     */
    sessionLog: {
      row: "会话运行记录",
      title: "会话运行记录",
      desc: "最近几天的用量:每天合计一行,展开能看到每个会话花了多少 Token、多少钱、多少次请求。",
      today: "今天",
      yesterday: "昨天",
      range: (days: number): string => `最近 ${days} 天`,
      tokens: "Token",
      cost: "费用",
      requests: "请求",
      sessions: (n: number): string => `${n} 个会话`,
      emptyDay: "这一天没有用量记录",
      empty: "最近还没有用量记录",
      loadFailed: (reason: string): string => `读取失败:${reason}`,
      unknownSession: "已删除的会话",
      unpriced: "未计价",
    },
  },

  /**
   * The sidebar's feedback entry and the dialog behind it. The words are the user's own — the
   * dialog promises only where they go, which is the operator's queue, so a note left here is
   * read and acted on rather than merely archived.
   *
   * `board` is the OTHER door, always offered: the product's public board (lib/feedback-board.ts).
   * Its name carries what it is — a board, out in the open — so the row needs no line of its own
   * explaining it.
   */
  feedback: {
    title: "用户反馈",
    board: "反馈社区",
    intro: "写下你想要的改动、遇到的问题,或者任何一句话。它会被直接收进这台机器的反馈队列。",
    titleLabel: "一句话标题",
    titlePlaceholder: "例如:侧栏的字太小",
    detailLabel: "详细说明",
    detailPlaceholder: "方便的话说清在哪一步、期望是什么——一段话就够。",
    submit: "提交",
    submitted: "已提交,谢谢",
    submittedWithId: (id: string): string => `已提交(${id}),谢谢`,
    titleRequired: "标题不能为空",
    sendFailed: "提交失败,请稍后再试",
    /** Shown when the server has nowhere to send to — names the switch, so the operator can act on it. */
    notConfigured: "这台机器还没配反馈后端(ADELIE_FEEDBACK_URL),所以这里暂时收不了。",
  },

  admin: {
    users: "用户管理",
    roleAdmin: "管理员",
    roleUser: "用户",
    createUser: "新增用户",
    /** The three read-only columns the user table gained: when the account last signed in, which conversation it touched last, and what its Projects have cost. */
    lastLogin: "最近登录",
    /** Never signed in: the account exists (an admin created it) but has not been used. */
    lastLoginNever: "从未登录",
    lastSession: "最近一次会话",
    /** The session column's tooltip: whose Sessions are counted and which one wins. */
    lastSessionHint:
      "该用户名下全部项目里最近活跃的一次会话(含子会话与已归档的),标题还没生成时只显示时间。",
    totalCost: "累计开销",
    /** The cost column's tooltip: what the figure counts, and what an "≥" in front of it means. */
    costHint:
      "该用户名下全部项目的历史用量,按当前价格折算。带 ≥ 表示其中有用量所在模型没有价格,这是下限。",
    initialPassword: "初始密码",
    initialPasswordFlag: "初始密码",
    defaultProjectNote: (id: string): string => `将自动创建默认项目:${id}`,
    resetPassword: "重置密码",
    resetPasswordTitle: (u: string): string => `重置 ${u} 的密码`,
    resetPasswordNote: "重置后该用户的登录会话全部失效,需用新密码重新登录",
    deleteUserTitle: (u: string): string => `删除用户 ${u}`,
    deleteUserConfirm: (u: string): string =>
      `将删除用户 ${u} 及其名下全部项目(含数据目录),不可恢复。`,
  },

  project: {
    switcher: "项目",
    create: "新建项目",
    createTitle: "新建项目",
    id: "项目 ID",
    idHint: "2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",
    idPrefixHint: "id 固定以「用户名-」为前缀,后接小写字母、数字或下划线;创建后不可修改",
    displayName: "显示名",
    /** Create dialog only: leaving the name empty falls back to the id. In Project settings the saved name cannot be blanked. */
    displayNameHint: "留空则使用项目 ID 作为名称",
    settings: "项目设置",
    settingsTitle: "项目设置",
    members: "成员",
    addMember: "添加成员",
    removeMember: "移除",
    /**
     * A member write this page was refused (member-write-refusal.ts), drawn above the table that
     * asked: the account it was about, and the fact that the list below is still the old one.
     */
    memberAddRefused: (userId: string, reason: string): string =>
      `没能把「${userId}」加进成员,名单没有变化:${reason}`,
    memberRemoveRefused: (userId: string, reason: string): string =>
      `没能把「${userId}」移出成员,名单没有变化:${reason}`,
    /** New-conversation defaults section (Project settings): prefills each new conversation's agent / working directory / approval mode / thinking level / default model. */
    chatDefaultsTitle: "新对话默认值",
    chatDefaultsHint: "新建对话时预填的默认值:Agent、工作目录、审批模式、思考等级与默认模型。",
    chatDefaultsAgent: "Agent",
    chatDefaultsNotSet: "未设置",
    chatDefaultsApprovalNotSet: "未设置(默认全部放行)",
    chatDefaultsThinkingNotSet: "未设置(跟随智能体配置)",
    /** The model default shares its source with the Models page (the same default_model); this is just another entry point. */
    chatDefaultsModelHint: "与模型页的默认模型同步",
    /**
     * A Save this section was refused (chat-defaults-save-refusal.ts), drawn under the controls
     * that asked: one Save writes the block AND the default model, so the sentence has to say
     * which half the Project now holds.
     */
    chatDefaultsRefused: (reason: string): string =>
      `没能保存新对话默认值,项目里仍是原来的值:${reason}`,
    chatDefaultsModelRefused: (reason: string): string =>
      `没能改默认模型,项目里仍是原来的模型:${reason}`,
    chatDefaultsModelRefusedAfterSave: (reason: string): string =>
      `新对话默认值已保存,但默认模型没能改(项目里仍是原来的模型):${reason}`,
    /** Settings dialog tab rail. */
    settingsTabGeneral: "通用",
    settingsTabMembers: "成员",
    settingsTabDefaults: "默认值",
    settingsTabSecurity: "安全策略",
    projectIdLabel: "项目 ID",
    deleteProjectDesc: "项目目录将被递归删除,不可恢复。",
    /** Security-policy page (Project settings): disclosed by the "?" beside the tab heading. */
    commandPolicyInfo:
      "命令文本经空白与引号归一化后逐条匹配已启用规则的正则表达式,命中即拒绝执行,不受审批模式影响。这是防事故的护栏:运行期才拼出的命令不在覆盖范围内。",
    commandPolicyEnable: "启用策略",
    commandPolicyEnableDesc: "关闭后所有规则都不再拦截。",
    commandPolicyRules: "规则",
    commandPolicyRestore: "恢复默认",
    commandPolicyAddRule: "添加规则",
    commandPolicyEditRule: "编辑",
    commandPolicyApplyRule: "确定",
    commandPolicyEmpty: "没有规则。",
    commandPolicyOn: "已启用",
    commandPolicyOff: "已停用",
    commandPolicyRuleName: "名称",
    commandPolicyRulePattern: "正则表达式",
    commandPolicyRuleDesc: "描述",
    commandPolicyInvalidPattern: "正则表达式无效",
    /**
     * The route's ceiling on the rule list (command-policy-rule-limit.ts), shown on the count row
     * once the buffered list reaches it: the Add button next to it goes inert at the same moment.
     */
    commandPolicyRuleLimit: (limit: number): string =>
      `已达 ${limit} 条规则的上限,删除一条后才能再加。`,
    /**
     * A Save this page was refused (command-policy-save-refusal.ts), drawn above the Save button
     * that asked: one Save writes the switch and the whole rule list, so the sentence has to say
     * which policy the engine is still running — the controls above show the buffered draft, not
     * the one in force.
     */
    commandPolicyRefused: (reason: string): string =>
      `没能保存命令策略,项目里仍是上一次保存的那一份:${reason}`,
    commandPolicyRefusedStillOn: (reason: string): string =>
      `没能保存命令策略,命令拦截仍处于启用状态(规则也还是上一次保存的):${reason}`,
    commandPolicyRefusedStillOff: (reason: string): string =>
      `没能保存命令策略,命令拦截仍处于停用状态(规则也还是上一次保存的):${reason}`,
    deleteProject: "删除项目",
    deleteConfirm: "确认删除该项目?项目目录将被递归删除,不可恢复。",
    deleteDefaultForbidden: "default_project 与 CLI 共用,不允许在 Web 端删除",
    deleteLastForbidden: "这是当前账号最后一个项目,删除后将无项目可用;请先创建新的项目",
    noCredentialTitle: "尚未配置模型 credential",
    noCredentialBody: "当前项目的默认模型尚未配置 API key,发起对话前请先前往模型页配置。",
    goToModels: "前往模型页",
    later: "稍后再说",
  },

  /** The "Create with AI" kit (features/ai-create): the pair of create buttons, the prompt panel and the bridge into a new conversation with the Project's default agent. */
  aiCreate: {
    withAi: "用 AI 创建",
    manual: "手动创建",
    editInChat: "在新对话中编辑",
    copyPrompt: "复制提示词",
    examplesTitle: "试试这些示例",
    fullPrompt: "完整提示词",
    /** Who does the work, and where: the panel's lead line. */
    byAgent: (name: string): string => `将由「${name}」在新对话中完成`,
    chooseAgent: "执行的智能体",
    placeholder: "描述你想要什么,越具体越好",
    /** Accessible name of the prompt box (it has no visible label). */
    promptLabel: "提示词",
    noAgent: "当前项目还没有智能体",
  },

  agent: {
    /**
     * Toast after a save on this page: when the change reaches a Session. Core assembles the
     * Agent State into each model context, so a running conversation sees it only after its
     * next compaction; a new conversation starts with it.
     */
    savedTakesEffect: "已保存。新对话立即生效;进行中的对话在下一次压缩后生效。",
    /** Save feedback when the change touched compaction settings only: the engine re-reads them at every compaction checkpoint, so a running conversation does not have to reach one first. */
    savedTakesEffectNow: "已保存,立即生效(包括进行中的对话)。",
    /**
     * A feature's enable switch that the server refused (feature-switch-refusal.ts), drawn under
     * the card that holds it: which way the switch was asked to move — it never moved, the
     * position on screen is the server's — and the reason, as the server gave it.
     */
    switchOnRefused: (noun: string, reason: string): string => `开启${noun}的开关被拒:${reason}`,
    switchOffRefused: (noun: string, reason: string): string => `关闭${noun}的开关被拒:${reason}`,
    /**
     * A placeholder the server refused to write into the prompt template
     * (placeholder-insert-refusal.ts), drawn under the strip that asked: which placeholder — four
     * sections share this sentence — and the reason, as the server gave it. The second verb is for
     * a legacy template, whose button migrates the old hardcoded section instead of inserting.
     */
    placeholderInsertRefused: (token: string, reason: string): string =>
      `插入 ${token} 占位符被拒:${reason}`,
    placeholderMigrateRefused: (token: string, reason: string): string =>
      `迁移为 ${token} 占位符被拒:${reason}`,
    /** Appended to an action's own toast (skill install / uninstall) — same timing statement. */
    takesEffectSuffix: ";新对话立即生效,进行中的对话在下一次压缩后生效",
    listTitle: "Agents",
    searchPlaceholder: "搜索 Agent:id / 名称 / 描述",
    searchEmpty: "没有匹配的 Agent",
    create: "创建 Agent",
    createTitle: "创建 Agent",
    id: "Agent id",
    idHint: "2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",
    /** The id field's generation clause: the create dialog's name field is labelled Name, not display name. */
    idGenerateHint: ";也可以从名称生成",
    nameHint: "留空则使用 Agent id 作为名称",
    description: "描述",
    /** Create dialog's skill picker: the library skills installed into the new Agent. */
    createPlugins: "插件",
    createPluginsPlaceholder: "未选择插件",
    createPluginsPicked: (n: number): string => `已选 ${n} 个插件`,
    createPluginsHint: "创建时安装到该 Agent(技能与钩子包),之后可在其「技能」「钩子」标签页增删",
    createPluginsEmpty: "插件库暂无可安装的插件",
    /** The directory-skills picker's trigger (the field's own label is createDirSkills). */
    createSkillsPlaceholder: "未选择技能",
    createSkillsPicked: (n: number): string => `已选 ${n} 个技能`,
    createDirSkills: "从项目目录导入技能",
    createDirSkillsPick: "未选择目录",
    createDirSkillsHint: "选择一个项目目录,读取其 .agents/skills 与 .claude/skills 下的技能",
    createDirSkillsEmpty: "该目录下没有可安装的技能",
    createDirSkillsFound: (n: number): string => `该目录下找到 ${n} 个技能`,
    createDirSkillsClear: "不从目录导入",
    /** Create dialog's optional snapshot seed: the new Agent starts from an exported package. */
    createSnapshot: "从快照初始化",
    createSnapshotPick: "选择快照包",
    createSnapshotHint:
      "选择导出的 Agent State 快照包(.tar.gz),新 Agent 以包内状态创建;名称与描述留空则沿用包内值",
    createSnapshotSkillsOff: "快照包自带技能与钩子,与插件选择互斥",
    createSnapshotClear: "移除已选快照包",
    /**
     * The "Create with AI" dialog, a separate surface from the create form above: its title, the
     * lead line, the prompt box's placeholder, the clickable examples and the fixed instruction
     * tail joined after the draft (composeAiPrompt). The tail follows the agent-initialization
     * skill's contract — a new agent under the current Project, only the skills it needs, no
     * other agent touched, the id reported at the end.
     */
    aiCreateTitle: "用 AI 创建 Agent",
    aiCreateIntro:
      "描述这个智能体要做什么、面向谁、产出什么;执行的智能体会用 agent-initialization 技能在当前项目里创建它。",
    aiCreatePlaceholder: "例如:创建一个帮我把会议录音整理成待办清单的智能体…",
    aiExamples: [
      {
        key: "jotting",
        label: "随记智能体",
        description: "零碎想法整理成一套 Markdown 文件体系",
        prompt:
          "创建一个随记智能体:我会不断向它发送零碎的想法和只言片语,它要在工作区里把这些内容整理成一套 Markdown 文件体系(按主题建文件、维护一个索引文件、合并重复内容、保留时间线),每次收到内容后回复归档到了哪个文件。",
      },
      {
        key: "finance",
        label: "金融 Copilot",
        description: "财报、行情与新闻的基本面与估值分析",
        prompt:
          "创建一个金融 Copilot 智能体:能读取我提供的财报、行情数据与新闻链接,做基本面与估值分析,用表格与要点输出结论,标注不确定性与数据来源,不给出直接的买卖建议。",
      },
      {
        key: "rag",
        label: "文档 RAG 智能体",
        description: "先给 docs/ 建索引,回答时引用出处",
        prompt:
          "创建一个文档问答智能体:我会把资料放进工作区的 docs/ 目录,它要先建立索引(按文件与章节写摘要),回答问题时引用具体文件与段落,没有依据时明确说不知道。",
      },
      {
        key: "research",
        label: "深度研究报告智能体",
        description: "提纲、多轮检索与交叉验证,产出带引用的报告",
        prompt:
          "创建一个深度研究报告智能体:给定一个课题,它要先制定研究提纲,多轮检索与阅读资料并交叉验证事实,最后在工作区生成一份带目录、引用与附录的 Markdown 报告。",
      },
      {
        key: "report-writer",
        label: "报告写作智能体",
        description: "零散材料整理成结构化报告;id 为 report-writer",
        prompt:
          "创建一个报告写作智能体,agent id 用 report-writer:擅长把零散材料整理成结构化的商业或技术报告(摘要、背景、分析、结论与建议),产出 Markdown 文件,并附一份写作检查清单。",
      },
    ],
    aiCreateTail: [
      "请使用 agent-initialization 技能,在当前项目中按上面的描述新建一个智能体:",
      "- 上面给了 agent id 就用它,否则取一个简短的语义 id(小写字母开头,可含数字、下划线或连字符);目标目录已存在时停下来告诉我,不要覆盖。",
      "- 以 default_agent 的 system_config.yaml 为底,设置它的 name、description 与 version,把角色与行为规则写进它的 agent_state/AGENTS.md。",
      "- 只从插件库(default_agent 已安装的技能目录)复制它真正需要的技能,不要多装。",
      "- 不要改动其他智能体;完成后按技能要求做校验。",
      "最后告诉我:新智能体的 id、安装了哪些技能,以及怎样开始和它对话(Agents 页该智能体卡片上的「新建对话」)。",
    ].join("\n"),
    /** The list's call to action while the Project has no agent beyond the built-in default. */
    firstAgentTitle: "还没有自己的智能体",
    firstAgentDesc: "描述你想要的智能体,让 AI 帮你创建;也可以手动配置。",
    sessionCount: (n: number): string => `${n} 个 Session`,
    toolCount: (n: number): string => `${n} 个工具`,
    vaultKeyCount: (n: number): string => `${n} 个密钥`,
    scheduleCount: (n: number): string => `${n} 个定时任务`,
    memoryCount: (n: number): string => `${n} 条记忆`,
    updatedAt: "最后修改",
    activity: (days: number): string => `近 ${days} 天 Session 活跃度`,
    settings: "Agent 设置",
    backToList: "返回 Agents",
    tabOverview: "概览",
    tabPrompt: "系统提示词",
    tabMemory: "记忆",
    tabRuntime: "运行参数",
    tabTools: "工具",
    tabSkills: "技能",
    tabHooks: "钩子",
    tabVault: "密钥保险柜",
    tabSchedules: "定时任务",
    tabApi: "API",
    stateDir: "State 路径",
    copyStateDir: "复制 State 路径",
    agentsMd: "AGENTS.md",
    systemPrompt: "system_prompt 模板",
    placeholdersTitle: "可用占位符(点击插入)",
    insertPlaceholder: "插入到 system_prompt 光标处",
    /** Order must match the default system prompt (core default-config.ts DEFAULT_SYSTEM_PROMPT). Inner tokens ({{VAULT_KEYS}} 等) live in each feature tab's promptPlaceholders instead. */
    placeholders: [
      ["{{AGENTS_MD}}", "注入 AGENTS.md 内容"],
      ["{{VAULT}}", "注入保险柜区块(vault.prompt,含键名清单);开关关闭时为空"],
      ["{{SKILLS}}", "注入技能区块(skills.prompt,含已安装技能元数据);开关关闭时为空"],
      [
        "{{MEMORY}}",
        "注入记忆区块:memory.prompt 加 memory.workspace_prompt(仅持久工作区);关闭记忆时为空",
      ],
      ["{{SCHEDULES}}", "注入定时任务区块(schedules.prompt,含任务名清单);开关关闭时为空"],
      ["{{PLATFORM}}", "运行平台"],
      ["{{OS_VERSION}}", "操作系统版本"],
      ["{{SHELL}}", "命令执行使用的 Shell"],
      ["{{DATE}}", "当前日期"],
      [
        "{{PROJECT_DIR}}",
        "Adelie 应用数据根目录(存放全部 Agent 数据与项目级数据;不是本次任务的工作目录)",
      ],
      ["{{AGENT_ID}}", "当前 Agent id"],
      ["{{CWD}}", "Workspace 绝对路径"],
      ["{{PROVIDER}}", "模型 provider 分组"],
      ["{{MODEL_ID}}", "上游模型 id"],
      ["{{SESSION_ID}}", "当前 Session id"],
    ] as ReadonlyArray<readonly [string, string]>,
    maxTurns: "max_turns(单 Task 最大轮次,-1 不限制)",
    maxTokens: "model.max_tokens",
    thinkingLevel: "model.thinking_level",
    /** Selectable tiers exclude `none` (many models cannot disable thinking); a stored `none` still displays — see `thinkingLevelNoneKept`. */
    thinkingLevelOptions: [
      ["", "不提交覆盖值,沿用当前生效的配置。"],
      ["low", "开启较低强度的扩展推理。"],
      ["medium", "开启中等强度的扩展推理(新建 Agent 的缺省档位)。"],
      ["high", "开启较高强度的扩展推理,响应更慢。"],
      ["xhigh", "在 high 之上再进一步的扩展推理,部分模型上效果与 high 相同。"],
      ["max", "开启最高强度的扩展推理,最慢,部分模型上效果与 xhigh 相同。"],
    ] as ReadonlyArray<readonly [string, string]>,
    /** Row description shown only while the stored config is `none`: displayed as-is, never rewritten, and no longer offered as a choice. */
    thinkingLevelNoneKept: "已存的历史档位:新选择不再提供关闭档(多数模型不支持关闭思考)。",
    timeoutMs: "model.timeoutMs",
    timeoutMsHint: "等待上游下一个事件的空闲上限,毫秒;不是整次请求的总时长上限",
    compaction: "上下文压缩(compaction)",
    maxContextLength: "max_context_length",
    maxContextLengthHint: "触发压缩的上下文阈值",
    maxSessionTurns: "max_session_turns",
    maxSessionTurnsHint: "触发压缩的轮数阈值",
    compactionMode: "mode(压缩方式)",
    compactionModeOptions: [
      ["", "不提交覆盖值,沿用当前生效的配置。"],
      ["summarize", "先让模型为旧上下文生成摘要,再从摘要续接新的上下文窗口(缺省)。"],
      ["discard", "不生成摘要,直接丢弃旧上下文,下一轮从新窗口重新开始。"],
    ] as ReadonlyArray<readonly [string, string]>,
    compactionPrompt: "prompt(摘要提示词)",
    maxTurnsInvalid: "max_turns 必须 > 0 或为 -1",
    timeoutInvalid: "timeoutMs 必须 > 0 或为 -1",
    toolFieldInvalid: (name: string, field: string) => `${name}: ${field} 必须是 > 0 的整数或 -1`,
    toolPermission: "permission",
    permissionReadLabel: "Read-only",
    permissionReadDescription: "仅读取。审批模式为 read-only 时自动放行,无需确认。",
    permissionReadWriteLabel: "Read & write",
    permissionReadWriteDescription: "可修改。审批模式为 read-only 时需人工确认。",
    toolTimeout: "timeoutMs",
    toolMaxOutput: "maxOutputLength",
    toolCallDescription: "call_description",
    callDescriptionHint:
      "call_description:开启(缺省)时该工具的 schema 保留可选的 description 参数——模型为每次调用写一句说明,运行期间展示给用户;关闭则装配时从 schema 滤除该参数。仅参数中定义了 description 属性的工具可切换。",
    mcpServers: "MCP Server",
    mcpDesc:
      "连接外部 MCP Server:其工具以 mcp__<name>__<tool> 并入本 Agent 的工具列表。此区块的改动即时保存。",
    mcpEmpty: "尚未配置 MCP Server",
    mcpEnabled: "enabled",
    mcpEnableHint: "启用:下次对话起重新连接这个 Server",
    mcpDisableHint: "停用:配置保留,但不再连接,它的工具从工具列表里消失",
    mcpAdd: "添加 MCP Server",
    mcpEditTitle: "编辑 MCP Server",
    mcpRemove: "删除",
    mcpName: "name",
    mcpNameHint: "工具名前缀:mcp__<name>__<tool>;限字母、数字、_ 和 -",
    mcpTransport: "transport",
    mcpTransportStdio: "本地进程:启动 command 后经 stdin/stdout 通信",
    mcpTransportHttp: "Streamable HTTP:当前规范的远程 transport",
    mcpTransportSse: "旧版 HTTP+SSE:仅为未迁移的服务保留",
    mcpTarget: "command / url",
    mcpCommand: "command",
    mcpArgs: "args",
    mcpArgsHint: "每行一个参数",
    mcpEnv: "env",
    mcpEnvHint: "每行一条 KEY=value;Agent vault 不注入 MCP Server 进程",
    mcpCwd: "cwd",
    mcpCwdHint: "留空则使用本次 Session 的 Workspace",
    mcpUrl: "url",
    mcpHeaders: "headers",
    mcpHeadersHint: "每行一条 Header-Name: value(如 Authorization 等认证头)",
    mcpPermission: "permission",
    mcpPermissionAuto: "auto",
    mcpPermissionAutoLabel: "Auto(readOnlyHint)",
    mcpPermissionAutoDescription:
      "每个工具按自己的 readOnlyHint 注解取值:声明了就是只读,否则为读写。",
    mcpPermissionReadDescription:
      "该 Server 的全部工具一律视为只读,无论其自身声明。审批模式为 read-only 时自动放行。",
    mcpPermissionReadWriteDescription:
      "该 Server 的全部工具一律视为读写,无论其自身声明。审批模式为 read-only 时需人工确认。",
    mcpPermissionHint:
      "只有 read-only 审批模式会读这个等级,allow-all / deny-all / always-ask 一律不看。它不限制 Server 本身能做什么——把并非只读的 Server 标为只读,只是撤掉了 read-only 模式本会索要的那次确认。",
    mcpConnectTimeout: "connectTimeoutMs",
    mcpBudgetsHint:
      "留空使用默认值:connectTimeoutMs 是连接与工具发现预算(默认 10000);timeoutMs / maxOutputLength 作用于该 Server 的全部工具。",
    mcpNameInvalid: "限字母、数字、_ 和 -,且以字母或数字开头",
    mcpUrlInvalid: "必须是合法的 http(s) URL",
    mcpLineInvalid: (line: number): string => `第 ${line} 行格式无效`,
    mcpNumberInvalid: "必须是 > 0 的整数",
    mcpDuplicateName: "同名 Server 已存在",
    mcpTest: "测试连接",
    mcpTesting: "测试中…",
    mcpTestOk: (toolCount: number, latencyMs?: number): string => {
      const timing = latencyMs !== undefined ? `(${(latencyMs / 1000).toFixed(1)}s)` : "";
      return toolCount === 0
        ? `连接成功,但该 Server 未暴露任何工具${timing}`
        : `连接成功,发现 ${toolCount} 个工具${timing}`;
    },
    mcpTestFail: (detail: string): string => `连接失败:${detail}`,
    mcpTestAllConfirm: (n: number): string =>
      `将逐一连接已配置的 ${n} 个 MCP Server 并做工具发现(真实连接,不保存任何改动),结果显示在各行上。`,
    mcpTestAllStart: "开始测试",
    mcpTestPending: "测试中…",
    mcpTestBadge: (toolCount: number, latencyMs?: number): string =>
      `${toolCount} 个工具${latencyMs !== undefined ? ` · ${(latencyMs / 1000).toFixed(1)}s` : ""}`,
    mcpTestBadgeFail: "连接失败",
    mcpDeleteTitle: "删除 MCP Server",
    mcpDeleteConfirm: (name: string): string =>
      `确认删除 MCP Server「${name}」?其工具自下次 Session 起不再可用。`,
    defaultValue: "(缺省)",
    /** Reset link next to the runtime dropdowns: rewinds the local pick back to "not overridden" (the menus offer no inherit row). */
    /** An Agent whose state directory is on a machine: what this server cannot act on, and where it can be. */
    livesOnMachine: (machine: string) => `该 Agent 在 ${machine} 上,请到那台机器上管理`,
    deleteAgent: "删除 Agent",
    builtinUndeletable: "内置 Agent 不可被删除",
    deleteConfirm: (name: string): string =>
      `确认删除 Agent「${name}」?其目录(含全部 Trace)将被递归删除,不可恢复。`,
    /**
     * The delete's progress card: its title while the Agent's files are removed in the
     * background, once they are all gone, and when some could not be removed.
     */
    deletingAgent: (name: string): string => `正在删除 Agent「${name}」`,
    deletedAgent: (name: string): string => `已删除 Agent「${name}」`,
    deleteIncomplete: (name: string): string => `Agent「${name}」有文件未能删除`,
    /** The card's line: while the folder is walked, while it is removed, and at the end (files and folders alike). */
    deleteCounting: (found: number): string =>
      `正在统计,已找到 ${found.toLocaleString("zh-CN")} 项`,
    deleteRemoving: (removed: number, total: number): string =>
      `已删除 ${removed.toLocaleString("zh-CN")} / ${total.toLocaleString("zh-CN")} 项`,
    deleteRemoved: (total: number): string => `共删除 ${total.toLocaleString("zh-CN")} 项`,
    /** A removal that stopped short: the operating system's reason, and when the rest goes. */
    deleteRetryOnRestart: (error: string): string =>
      `${error}。其余文件会在服务端下次启动时再删除。`,
    /** Agent State section: the State version with the snapshot transfer actions, plus the copyable State path. */
    stateTitle: "Agent State",
    stateVersion: "Agent State 版本",
    transferDesc: "导出当前 Agent State 快照包(tar.gz);导入整目录覆盖,并以包内版本为准。",
    exportSnapshot: "导出快照",
    importSnapshot: "导入快照",
    importing: "导入中…",
    importDone: (v: number): string => `导入完成,Agent State 版本 v${v}`,
    importConflictTitle: "版本冲突",
    importConflictBody: "快照包版本不高于当前版本,导入将覆盖现有 Agent State。确认继续?",
    resetConfigTitle: "还原为默认配置",
    resetConfigAction: "还原为默认配置",
    resetConfigConfirmBody:
      "此操作会用当前默认值覆盖该 Agent 的现有配置:自定义系统提示词、工具列表、模型/压缩参数与 MCP Server 全部被替换,仅保留名称与描述。与 Skill 更新一样不可撤销,确认继续?",
    resetConfigDone: "配置已还原为当前默认值",
    /** Kernel section: which defaults generation the config is based on (dates; unrelated to the optimization counter shown as stateVersion), with the update / restore actions. */
    kernelTitle: "内核",
    kernelLegacy: "早于内核版本机制",
    kernelOutdatedHint: "内核有更新",
    /** The Agents-list card's dark-red capsule on an outdated Agent — a control, not a label: it opens the settings overview where the update runs. */
    kernelUpdateNeeded: "内核需要更新",
    kernelUpToDate: "已是最新",
    kernelUpdateTitle: "更新内核",
    /** Inline labels around the outdated line's two generation values (the values themselves render dark and semibold). */
    kernelCurrent: "当前",
    kernelLatest: "最新",
    kernelUpdateAction: "更新内核",
    kernelUpdateConfirmBody:
      "将把未自定义的设置页更新为当前内置默认值;改动过的设置页整页保持不变,并在结果中列出。名称、描述、版本号与 MCP Server 不受影响。确认继续?",
    kernelUpdateDone: (version: string, advanced: number): string =>
      advanced > 0
        ? `内核已更新至 ${version},${advanced} 个设置页跟进新默认`
        : `内核已更新至 ${version},设置页均已是当前默认或保持自定义`,
    kernelUpdateKeptIntro: "以下设置页因自定义被整体保留:",
    kernelListSeparator: "、",
    /** The API tab: this server's switch for the Agent's public API, its approval mode, keys and examples. */
    apiEnable: "开启 API 访问",
    apiEnableHint:
      "外部程序可通过 URL、密钥与 Agent ID 与此 Agent 对话;对话归入侧栏的「后台会话」。",
    apiOwnerOnly: "只有 Project 所有者可以更改这些设置。",
    apiAdminOff:
      "管理员已在服务器设置中关闭 Agent API:所有 API 请求都会被拒绝,这里的设置与密钥保留。",
    /**
     * A refused flip of the switch above: it never moved, so external programs are still refused —
     * and the switch itself is the retry.
     */
    apiEnableRefused: (reason: string): string =>
      `API 访问没有打开,外部程序仍然无法调用:${reason}`,
    apiApprovalMode: "API 会话的审批模式",
    apiApprovalModeHint:
      "应用于之后新建的 API 会话;需要确认时,确认请求会发给调用方,也可在 Web App 中回答。",
    /** A refused change: the select fell back to the stored mode, so the sentence names the one asked for. */
    apiApprovalModeRefused: (mode: string, reason: string): string =>
      `审批方式没有改成「${mode}」:${reason}`,
    apiConnection: "连接",
    apiBaseUrl: "Base URL",
    apiAgentId: "Agent ID",
    /** A copy button beside a connection value, named for what it copies. */
    apiCopy: (what: string): string => `复制 ${what}`,
    apiKeys: "密钥",
    apiKeysEmpty: "还没有密钥。",
    apiNewKey: "新建密钥",
    apiKeyName: "密钥名称",
    apiKeyCreated: "创建",
    apiKeyLastUsed: "最近使用",
    apiKeyNever: "从未",
    apiKeyShownOnce: "此密钥只显示一次,请立即复制。",
    apiCopySecret: "复制密钥",
    apiKeyDone: "完成",
    apiDeleteKey: "删除密钥",
    apiDeleteKeyBody: (name: string): string =>
      `删除密钥「${name}」?使用它的程序会立即被拒绝,此操作不可撤销。`,
    apiOpen: "允许无密钥访问",
    apiOpenHint: "任何能访问此地址的程序都能与该 Agent 对话;仅建议本机使用。",
    /**
     * A refused keyless-off: the switch never moved, so the exposure the reader just tried to close
     * is still open — and that half is what they have to act on.
     */
    apiKeylessOffRefused: (reason: string): string =>
      `无密钥访问没有关掉,任何能访问此地址的程序仍然无需密钥就能调用:${reason}`,
    apiExamples: "示例",
    /** Turning the Agent's API off asks first: every program using it is refused from then on. */
    apiOpenTitle: "允许无密钥访问?",
    apiOpenBody:
      "开启后,任何能访问此服务器地址的程序都无需密钥即可与该 Agent 对话,用的是本 Project 的模型与凭据,工具按 API 会话的审批模式执行。仅建议在只监听本机的服务器上开启。",
    apiOpenConfirm: "仍然开启",
    apiOffTitle: "关闭 API 访问?",
    apiOffBody: "外部程序会立即无法与此 Agent 对话。审批模式与密钥保留,重新开启后照常可用。",
    apiOff: "关闭",
    /** The Agents list's plug mark on an Agent whose API is on. */
    apiOn: "已开启 API 访问",
    /** The tab's Try it: one real API run on the owner's sign-in, shown as a program receives it. */
    apiTry: "试一试",
    apiTryHint:
      "以你的登录身份走程序用的同一条运行路由,收到的就是程序会收到的事件流;开出的会话归入侧栏的「后台会话」。",
    apiTryExample: "现在几点了?",
    apiTryRun: "运行",
    apiTryStop: "停止",
    /** The input's placeholder once a run has named its Session: the next run continues it. */
    apiTryFollowUp: "继续这个会话…",
    apiTryNewSession: "新会话",
    /** The output's two views: the stream with fragments merged, and its `data:` lines as received. */
    apiTryRendered: "渲染",
    apiTryRaw: "原始",
    apiTryCopyRaw: "复制原始行",
    /** The output before the first run. */
    apiTryEmpty: "运行后,事件流显示在这里。",
    apiTryStatus: "状态",
    apiTryRequests: "Request",
    apiTryTokens: "Token(输出 / 合计)",
    apiTryCacheRead: "缓存读",
    apiTryCacheWrite: "缓存写",
    apiTryElapsed: "用时",
    apiTryStreamBroken: "事件流在 run.done 之前结束。",
  },

  models: {
    title: "模型配置",
    addCustom: "添加自定义模型",
    addToGroup: "添加模型",
    editTitle: "模型配置",
    addTitle: "新增模型(OpenAI 协议)",
    addProtocolHint: "新增模型走 OpenAI Chat Completions 兼容协议,base URL 填其兼容端点",
    /** Add-dialog note for a group that pins one protocol on every entry (fed the client type): the protocol is not a choice here, and the endpoint is the user's own. */
    addProtocolHintPinned: (protocol: string): string =>
      `本分组的模型固定使用 ${protocol} 协议,base URL 填你自己的服务地址`,
    /** The same note for a gateway group that pins a protocol: the endpoint is the gateway's, already filled in. */
    addProtocolHintPinnedGateway: (protocol: string): string =>
      `本分组的模型固定使用 ${protocol} 协议,base URL 已预填网关端点`,
    autoRouteNone: "该模型 ID 无法按当前厂商协议识别;若使用 OpenAI 兼容接口,可转为自定义模型。",
    useCustomGroup: "转为自定义模型",
    /** Warning on a hand-added vendor-group row whose model id AgentHub cannot route (such a row can no longer be created, only inherited). */
    vendorRowUnroutable: "该模型 ID 无法路由,运行时会失败:厂商分组只承载内置模型。",
    /** The way out offered beside that warning: opens the config dialog with the row already in the custom group. */
    moveToCustomGroup: "移到自定义分组",
    /**
     * Warning on a built-in row saved before the catalog pinned the protocol its id needs:
     * re-merging the catalog repairs it, and a move would be the wrong advice. It never
     * quotes the sync button's own label — a member sees this sentence with no button beside
     * it, and the owner who does have one reads the label right there.
     */
    vendorRowStalePin:
      "该内置模型的条目早于目录为它钉下的协议,当前无法路由;重新同步内置目录即可补回。",
    /** Connectivity test on a hand-added row: replaces the upstream "is not supported" sentence, which names client types the user has no way to act on. */
    testNotRoutable:
      "连通失败:该模型 ID 无法路由。厂商分组只承载内置模型;把它移到自定义分组,并选择或检测其接口协议。",
    /** Connectivity test on a built-in row missing its pin: the same split the card makes, so the two never give opposite advice. */
    testStalePin:
      "连通失败:该内置模型的条目早于目录为它钉下的协议,当前无法路由。重新同步内置目录即可补回该协议,它不属于自定义分组。",
    addGroup: "新增分组",
    addGroupTitle: "新增分组",
    addGroupDesc:
      "自建分组与 Custom 同语义。「导入模型」按端点检测或手选协议后,一键导入其全部模型;「仅新增分组」建组后逐个添加。分组由模型条目承载,保存首个模型后即出现。",
    groupModeCreate: "仅新增分组",
    groupModeImport: "导入模型",
    groupImportAll: "批量导入模型",
    groupImportNeedUrl: "请先填写有效的 base URL(http/https)",
    groupImportKeyHint: "该端点的 API key(URL 不是厂商官方地址时必填)",
    groupImportListing: "正在获取模型列表…",
    groupImportSaving: (n: number): string => `正在导入 ${n} 个模型…`,
    groupImportUnsupported: "该协议不支持列出模型,请手动添加",
    groupImportFailed: "获取模型列表失败",
    groupImportEmpty: "该端点没有可导入的模型",
    groupImported: (added: number, skipped: number): string =>
      skipped > 0 ? `已导入 ${added} 个模型,跳过 ${skipped} 个条目` : `已导入 ${added} 个模型`,
    /**
     * A refused import save, drawn in the dialog that asked (group-import-refusal.ts): the group is
     * not there and neither is anything from the listing — the table is one write, so it is all or
     * nothing, and the reader has to know which of the two they are looking at before retrying.
     */
    groupImportRefused: (name: string, reason: string): string =>
      `分组「${name}」没有建成,导入的模型一个都没写进表:${reason}`,
    groupNameLabel: "分组名",
    groupNameHint: "小写字母 / 数字开头,可含 - 与 _",
    groupNameInvalid: "分组名只能用小写字母、数字、- 与 _(首字符为字母或数字),长度不超过 32",
    groupNameExists: "该分组名已被内置分组或既有条目占用",
    groupEmptyHint: "该分组暂无模型,点「添加模型」创建",
    deleteGroup: "删除分组",
    deleteGroupTitle: "删除分组",
    deleteGroupConfirm: (label: string, n: number): string =>
      `确定删除分组「${label}」?组内 ${n} 个模型及其 API key 配置将一并移除。`,
    groupDeleted: (n: number): string => `已删除分组(${n} 个模型)`,
    searchPlaceholder: "搜索模型:id / 名称 / 厂商",
    noSearchResults: "没有匹配的模型",
    syncCatalog: "同步预置",
    syncCatalogHint:
      "用内置目录更新预置模型:新增缺失条目,并按目录刷新已有条目的上下文、定价、协议与视觉标志;base URL、API key 与输出上限一律不覆盖,本地新增模型保持不变",
    syncDone: (added: number, updated: number) => `预置模型已同步:新增 ${added}、更新 ${updated}`,
    syncUpToDate: "预置模型已是最新",
    /**
     * The header's "Create with AI" entry: the dialog's title and lead, the prompt box's
     * placeholder, the examples and the fixed instruction tail. The tail
     * follows the penguin-config skill — one `penguin config model add` per model with
     * `--provider` mandatory, the config file never touched by hand, `penguin config model list`
     * at the end — and carries the Project id and the data root, which the CLI would otherwise
     * take from its own defaults (the harness strips `ADELIE_HOME` from a command's
     * environment, so the CLI's default root is not the one the server runs on).
     */
    aiAddTitle: "让 AI 添加模型分组",
    aiAddIntro:
      "把模型列表页的链接或服务信息交给智能体,它会用 penguin config 命令把这些模型加为一个分组。能直接列出模型的 OpenAI 兼容端点,用「新增分组 → 导入模型」更快。",
    aiAddPlaceholder: "粘贴模型列表页的 URL,或描述要接入的服务(网关地址、鉴权方式、模型 id)…",
    aiAddExamples: [
      {
        key: "openrouter",
        label: "OpenRouter 热门模型",
        description: "读取模型列表页,加为一个自建分组",
        prompt:
          "把 https://openrouter.ai/models 上的热门模型加为一个自建分组(先问我要 API key)。",
      },
      {
        key: "vllm",
        label: "自建 vLLM 服务",
        description: "OpenAI 兼容端点加指定的模型 id",
        prompt:
          "接入我自建的 vLLM 服务 http://10.0.0.5:8000/v1,模型 id 为 qwen3-32b,加为一个 vllm 分组。",
      },
      {
        key: "ollama",
        label: "本机 Ollama",
        description: "把本机已有的模型加为一组",
        prompt: "把本机 Ollama(http://localhost:11434)上已有的模型加为一个 ollama 分组。",
      },
      {
        key: "deepseek",
        label: "DeepSeek 官方模型",
        description: "加进 deepseek 分组并设为默认",
        prompt: "把 DeepSeek 官方的 deepseek-v4-pro 加进 deepseek 分组并设为默认模型。",
      },
    ],
    aiAddTail: (projectId: string): string =>
      [
        "请使用 penguin-config 技能完成上面的配置:",
        "- 下面每条命令都要带 `--root <数据根目录>`,即环境信息中 App Data Dir 的上级目录。命令的环境里没有这个值,不带 `--root` 会配置到另一个数据根目录,本项目什么也拿不到。",
        `- 每个模型执行一次 \`penguin config model add --provider <分组名> --model-id <上游模型 id> --project-id ${projectId} --root <数据根目录> [--base-url <端点>] [--client-type openai] [--api-key <key>] [--context-window <n>] [--price-cache-read <n> --price-cache-write <n> --price-output <n>]\`:\`--provider\` 必填,\`--model-id\` 用网关自己的模型 id;OpenAI 兼容端点加 \`--client-type openai --base-url <端点>\`。`,
        "- 来源是网页时先抓取页面:优先加我点名的模型,没有点名就选最常用的,最多 10 个左右。",
        "- 需要 API key 而我没给时只问我一次;我不提供就把 key 留空,并告诉我到模型库页补填。",
        "- 不要读取或改动 .project_config.toml,配置只经 penguin 命令。",
        `- 最后运行 \`penguin config model list --project-id ${projectId} --root <数据根目录>\` 把结果列给我。`,
      ].join("\n"),
    platformSync: "同步",
    homepage: "模型主页",
    speedTest: "测速",
    /** The same icon button while its group's run is going: stops after the probe in flight. */
    speedTestStop: "停止测速",
    speedTestTitle: "分组测速",
    speedTestConfirm: (n: number): string =>
      `将对该分组的 ${n} 个模型逐个发起一次真实请求,测量首 token 延迟(TTFT)与输出速率(TPS),会消耗少量 API 额度。是否继续?`,
    speedTestStart: "开始测速",
    speedPending: "测速中…",
    speedFailed: "测速失败",
    ttftTitle: "首 token 延迟(TTFT)",
    tpsTitle: "输出速率(TPS)",
    modelCount: (n: number): string => `${n} 个模型`,
    modelId: "模型 ID",
    modelIdHint: "上游 API 使用的模型 id,如 gpt-5.5",
    displayName: "模型名称",
    displayNameHint: "留空则展示模型 ID",
    providerGroup: "分组",
    contextWindow: "上下文窗口",
    /** Unit suffix shown inside the right edge of the context-window / max-output-length inputs. */
    tokenUnit: "Token",
    contextWindowHint: "留空表示未知",
    maxTokens: "最大输出长度",
    /** Placeholders cannot scroll, so this must fit the half-width box; the full guidance is the input's title tooltip (the owner prefers no visible hint line — saves vertical space). */
    maxTokensHint: "留空沿用 Agent 设置",
    maxTokensTitle:
      "按模型限制单次请求的最大输出 Token 数;留空沿用 Agent 设置,小上下文模型建议调低",
    maxTokensInvalid: "必须为正整数",
    clientTypeLocked: (t: string): string => `协议:${t}(沿用原配置,不可修改)`,
    /** Protocol selector (custom / user-defined groups): AgentHub's generic protocol clients. Protocol names are proper nouns, identical in both locales. */
    protocol: "接口协议",
    protocolNames: {
      "openai-responses": "OpenAI Responses",
      "ant-messages": "Anthropic Messages",
      "openai-chat": "OpenAI Chat Completions",
    } as Record<string, string | undefined>,
    /** Hover title on the in-field protocol picker (the base URL field's right-edge suffix). */
    protocolTriggerTitle: (name: string): string => `接口协议:${name}。点击可更换。`,
    /** Suffix placeholder while no protocol is selected — 不显示任何协议名,避免看起来已选好。 */
    protocolUnset: "选择协议",
    /** Detect button at the base URL field's top-right. */
    detectProtocol: "检测协议",
    /** Hover title on the detect button. */
    detectProtocolHint: "探测 base URL,采用它实际提供的协议",
    detecting: "检测中…",
    /** Success toast;协议本身随后显示在 base URL 输入框的后缀处。 */
    detectedProtocol: (name: string): string => `检测到 ${name} 协议,已应用`,
    /** Success toast when the probe answered on a tidied-up base URL, which the field now holds. */
    detectedProtocolAndUrl: (protocol: string, url: string): string =>
      `已检测为 ${protocol},base URL 已整理为 ${url}`,
    /** The ONE failure toast: 所有失败情形共用,只讲用户能动手改的两件事。 */
    detectFailedBody: "无法检测接口协议,请检查 API Key 与 base URL。",
    /** 保存时检测无结果:按兼容协议继续保存。 */
    detectFellBack: "未检测到协议,已按 OpenAI Chat Completions 保存",
    /** Add-dialog note for custom / user-defined groups (protocol selectable): replaces the fixed-OpenAI wording. */
    addProtocolHintDetect:
      "可在 base URL 输入框右端的后缀处手动选择接口协议(OpenAI Responses / Anthropic Messages / OpenAI Chat Completions),也可点“检测协议”探测端点;未选协议时保存会先自动检测",
    addTitleCustom: "新增模型",
    /** Switch label only — the dialog carries no explanation text for it (per owner). */
    vision: "支持视觉",
    /** Detect action beside the vision switch. */
    detectVision: "检测",
    detectingVision: "测试中…",
    detectVisionHint: "发送一张极小的测试图片,判断该模型是否接受图片输入(会消耗 API Key 额度)",
    detectVisionNeedsId: "请先填写模型 id,再进行检测。",
    detectVisionOk: "该模型接受图片输入,已开启视觉",
    detectVisionNo: "该模型不接受图片输入,视觉保持关闭",
    /** 视觉探测一次没得出结论时,画在视觉开关下面的那一行;先讲清探的是视觉,再带出服务端给的句子(协议探测那句不适用)。 */
    detectVisionFailed: (detail: string): string => `视觉检测失败:${detail}`,
    /** Shown only while the vision switch is OFF: images are then read via the configured vision proxy model (read_file hands them to it). */
    visionOffProxyHint: "使用视觉代理模型读图",
    /** Switch label for the per-model fast mode (the provider's premium faster serving tier); the switch is only rendered for models whose AgentHub client can carry the parameter. */
    fastMode: "快速模式",
    /** Shown while the fast-mode switch is ON (and as the label's hover title): what it buys, and that the recorded prices do not follow the premium rate. */
    fastModeHint: "输出更快,按厂商的溢价档位计费;成本中心仍按条目记录的标准单价统计",
    /** Amber line under an ON switch on a model whose client rejects the parameter (a hand-edited config or a renamed id): the switch stays visible only so it can be turned off. */
    fastModeUnsupported: "该模型不支持快速模式,请关闭,否则请求会失败",
    /** Accessible name of the warning dialog raised when the fast-mode switch is turned ON. */
    fastModeConfirmTitle: "开启快速模式",
    /** Body of that warning: premium billing, and that the recorded prices do not follow it. */
    fastModeConfirmBody:
      "快速模式按厂商的溢价价目计费(MiniMax 为标准价的 1.5 倍,OpenAI 与 Anthropic 另有溢价价目表)。条目记录的按 Token 单价不会随之调整,成本中心会低估这部分用量。",
    /** Extra paragraph shown only for Anthropic-protocol models: fast mode there is a gated research preview. */
    fastModeConfirmPreview:
      "Anthropic 的快速模式目前是限量的 research preview:在你的组织获得授权之前,请求会返回 429 限流错误。",
    /** Badge on a model row whose fast mode is on: a standing premium-billing choice should be visible without opening the dialog. */
    fastModeBadge: "快速",
    visionBadge: "视觉",
    /** Light-yellow badge on zero-cost models (all three price buckets 0, e.g. the :free variants and openrouter/free). */
    freeBadge: "免费",
    /** Badge on a row the seller is currently discounting: the rate off its list price. */
    discountBadge: (pct: number): string => `省 ${pct}%`,
    discountTitle: (pct: number): string => `促销价:已在牌价基础上打 ${pct}% 折扣`,
    /**
     * Same badge as a flat promotion; only the explanation differs, because this rate comes and
     * goes with the clock. `peak` is the row's own schedule (see peakWindows), so each seller's
     * peak hours are the ones named.
     */
    offPeakTitle: (pct: number, peak: PeakWindows): string => {
      const day = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
      const days = peak.everyDay
        ? "每天"
        : peak.days
            .map(([from, to]) => (from === to ? day[from - 1] : `${day[from - 1]}至${day[to - 1]}`))
            .join("、");
      const hours = peak.hours.map(([from, to]) => `${from}:00–${to}:00`).join("、");
      return `空闲时段价:比牌价低 ${pct}%。高峰时段按牌价计费——北京时间${days} ${hours}`;
    },
    visionModelBadge: "视觉代理",
    /** Card's right-edge figure: what this model has spent over its whole life. The unit stays English and is abbreviated the way the rest of the page abbreviates it — `tok/s`, `/M tok`. */
    usedTokens: (v: string) => `${v} toks`,
    usedTokensTitle: "该模型累计消耗的 Token(不限时间范围)",
    setVisionModel: "设为视觉代理模型",
    visionModelHint: "供不支持图片的模型在 read_file 读图时代读",
    priceUnitShort: "/M tok",
    testConnection: "测试连通性",
    testing: "测试中…",
    testOk: (ms: number): string => `连通正常(${ms} ms)`,
    testFailed: (msg: string): string => `连通失败:${msg}`,
    priceCacheRead: "缓存命中价格",
    priceCacheWrite: "缓存未命中价格",
    priceOutput: "输出价格",
    /** Line under the model dialog's price fields on a row with a running promotion: the fields hold the list price, and changing it cancels the promotion. */
    promotionPriceHint: (pct: number): string =>
      `此处为牌价,当前促销在此基础上省 ${pct}%;修改价格会取消促销`,
    currency: "币种",
    currencyUsd: "美元 $",
    currencyCny: "人民币 ¥",
    apiKey: "API key",
    apiKeyKeepHint: "留空保留现有 key",
    apiKeyEnvHint: (envKey: string): string => `留空则使用环境变量 ${envKey}`,
    keyConfigured: "已配置 key",
    clearApiKey: "清除已存 API key",
    baseUrl: "自定义 base URL",
    baseUrlHint: "留空使用厂商默认地址",
    /** Hover title for the base URL field: explains the in-field suffix (the protocol path the client appends to the base URL); for custom groups that suffix is also the protocol picker. */
    baseUrlSuffixTitle: "客户端会在 base URL 后追加字段右侧的协议路径",
    /**
     * Note under a built-in model's read-only base URL / price fields (and their hover title):
     * both belong to the built-in catalog, which ships and maintains them, so this dialog does
     * not let the user rewrite them — with the way out named, since the wish behind such an
     * edit (my own endpoint) is legitimate and has a supported route.
     */
    officialLockedHint:
      "官方内置模型:接入地址与三档价格由内置目录固定,不能在此修改;要用自己的接入点,先把这一行「移到自定义分组」",
    baseUrlRequired: "必须填写 base URL",
    contextWindowDefaultHint: (n: number): string => `留空按 ${n} 计`,
    confirmDeleteTitle: "删除模型",
    confirmDelete: (name: string): string =>
      `确定删除「${name}」?该模型的配置与 API key 将一并移除。`,
    groupApiKey: "填写密钥",
    groupApiKeyTitle: (label: string): string => `为「${label}」统一配置 API key`,
    groupApiKeyHint: (n: number): string => `将写入该分组下全部 ${n} 个模型;留空不改动。`,
    getApiKey: "前往密钥管理",
    /**
     * Copying one of the account's own global secrets onto a group as its API key (the group
     * header's action beside 填写密钥). The value never comes back from the server, so the person
     * picks an ENTRY and the server performs the copy — the copy wording matches the Agent vault's
     * own assign dialog, because it is the same kind of operation.
     */
    assignUserKey: "从用户密钥分配",
    assignUserKeyTitle: (label: string): string => `给「${label}」分配一条全局密钥`,
    assignUserKeyHint: (n: number): string =>
      `选一条你的全局密钥,拷贝给该分组下全部 ${n} 个模型作为 API key;之后全局那条改了,要重新分配才会同步。`,
    assignUserKeyEmpty:
      "你的用户密钥里还没有条目——先在左下角账号菜单 ›「用户密钥」里添加,再回到这里分配。",
    assignUserKeyMissing: "这个分组里没有模型,没有可写入的对象",
    getModelIds: "获取模型 id",
    groupKeyApplied: (n: number): string => `已为 ${n} 个模型配置 API key`,
    // 供应商授权取 key(模型分组头部动作):整个 PKCE 流程都在服务端跑,前端只拿到一个
    // 不透明的 flow id 和状态。
    oauthKey: "连接",
    /** The same button once the group holds a key: the flow again, for a fresh key or another account. */
    reconnect: "重新连接",
    /** The small status beside it: whether the group holds a stored key, however that key got there. */
    connectedStatus: "连接成功",
    notConnectedStatus: "未连接",
    /**
     * A group's account balance in its header (and pinned beside the user name): the tooltip
     * names the group, the vendor's own figures and the time of the reading. `amounts` and
     * `time` are already formatted.
     */
    balanceTitle: (label: string, amounts: string, time: string): string =>
      `${label} 余额 ${amounts},查询于 ${time}`,
    balanceRefreshHint: "点击同步",
    /** Added to the tooltip when the vendor says the account cannot make requests (DeepSeek's is_available). */
    balanceUnavailable: "账户当前不可用,余额可能不足",
    /** The tooltip of the muted dash shown when no balance could be read, by the server's code. */
    balanceErrors: {
      no_key: "该分组没有可用的 API key,无法查询余额",
      upstream_failed: "服务商没有返回余额,可点击重试",
      unsupported: "该分组不支持查询余额",
    } as Record<string, string | undefined>,
    /** Appended when the vendor answered with an HTTP error. */
    balanceStatus: (status: number): string => `(服务商返回 HTTP ${status})`,
    /** Pin toggle before a balance: keeps it beside the user name in the sidebar, one at a time. */
    pinBalance: "常驻到用户名旁",
    unpinBalance: "取消常驻",
    oauthTitle: (label: string): string => `从「${label}」授权新建 API key`,
    oauthIntro: (label: string, n: number): string =>
      `将在你的 ${label} 账户下新建一个 API key,并写入该分组下全部 ${n} 个模型,覆盖它们当前的 key。`,
    oauthAuthorize: "打开授权页",
    oauthWaiting: "等待在新标签页中完成授权…",
    /**
     * The dialog's own report once the key has landed. It says the provider as well as the
     * count, because the user is reading it after a trip to another tab and may not remember
     * which authorization they just finished.
     */
    oauthAppliedBody: (provider: string, n: number): string =>
      `已完成授权:${provider} 的 API key 已配置到 ${n} 个模型上,可以直接使用了。`,
    oauthManualSwitch: "授权页跳不回来?改为手动填写授权码",
    oauthCallbackSwitch: "改回自动跳转",
    oauthManualHint: "先打开授权页,再把页面上显示的一次性授权码粘贴到这里。",
    oauthCodeLabel: "授权码",
    oauthSubmitCode: "提交授权码",
    oauthTimedOut: "没有等到授权结果。可以改为手动填写授权码,或重新开始。",
    oauthRetry: "重新开始",
    oauthErrors: {
      invalid_request: "授权请求被拒绝,请重新开始。",
      code_rejected: "该授权已失效:可能已过期或被用过,请重新开始。",
      upstream_failed: "供应商没有返回可用的 key,请重新开始。",
      unreachable: "连不上供应商,请检查网络后重新开始。",
      apply_failed: "key 已创建但未能保存。请重新授权,并到供应商控制台删掉那个没用上的 key。",
    },
    platformKeyIntro: (n: number): string =>
      `授权后会自动获取一个 Penguin Go API key,并写入该分组下全部 ${n} 个预置模型,覆盖它们当前的 key。`,
    platformKeyAppliedBody: (n: number): string =>
      `已完成授权:Penguin Go API key 已配置到 ${n} 个模型上,可以直接使用了。`,
    platformKeyStarting: "正在创建授权请求…",
    platformKeyApplying: "授权已完成,正在写入模型组…",
    platformKeyErrors: {
      unreachable: "无法连接 Penguin Go,请检查网络后重新开始。",
      upstream_failed: "Penguin Go 未能完成授权,请重新开始。",
      invalid_key: "Penguin Go 未返回可用的 API key,请重新开始。",
      expired: "授权已过期,请重新开始。",
      locked: "授权已锁定,请重新开始。",
      already_delivered: "该授权结果已经交付,请重新开始。",
      apply_failed: "API key 已取得,但未能写入模型组。可以直接重试,无需再次授权。",
    },
    // 魔搭走的是授权中转层:harness 不直接与魔搭对话,中转层拿着 client secret 换回
    // api-inference token。access token 会写入模型表;refresh token 只保存在服务端 DB。
    modelScopeKeyIntro: (n: number): string =>
      `授权后会自动获取一个魔搭 API token,并写入该分组下全部 ${n} 个预置模型,覆盖它们当前的 key;后续请求会在服务端静默续期,连续续期失败时会提示你重新授权。`,
    modelScopeKeyAppliedBody: (n: number): string =>
      `已完成授权:魔搭 API token 已配置到 ${n} 个模型上,可以直接使用了。`,
    modelScopeKeyErrors: {
      unreachable: "无法连接授权中转层,请检查网络后重新开始。",
      upstream_failed: "中转层未能完成授权,请重新开始。",
      invalid_key: "中转层未返回可用的 API token,请重新开始。",
      expired: "授权已过期,请重新开始。",
      locked: "授权已锁定,请重新开始。",
      already_delivered: "该授权结果已经交付,请重新开始。",
      apply_failed: "API token 已取得,但未能写入模型组。可以直接重试,无需再次授权。",
    },
    // Providers with separate domestic / international endpoints: note on the default
    // endpoint used when left blank via env var (the other side's key needs an explicit
    // base URL). Written to match AgentHub's actual behavior; rendered wherever the env fallback hint appears.
    providerEnvNotes: {
      zhipu:
        "缺省端点为 Z.AI 国际版(api.z.ai);智谱开放平台(bigmodel.cn)的 key 需填 base URL https://open.bigmodel.cn/api/paas/v4",
      moonshot:
        "缺省端点为国内版(api.moonshot.cn);platform.kimi.com(国际)的 key 需填 base URL https://api.moonshot.ai/v1",
    } as Record<string, string | undefined>,
    confirmVisionModelTitle: "设为视觉代理模型",
    confirmVisionModel: (name: string): string =>
      `确定把「${name}」设为视觉代理模型?不支持图片的模型用 read_file 读图时将由它代读。`,
    confirmSaveTitle: "保存模型配置",
    confirmSave: (name: string): string => `确定保存对「${name}」的配置修改?`,
    confirmDefaultTitle: "设为默认模型",
    confirmDefault: (name: string): string =>
      `确定把「${name}」设为默认模型?新建的 Session 将默认使用它。`,
    default: "默认",
    setDefault: "设为默认模型",
    remove: "删除模型",
    readOnlyHint: "member 只读;模型与 credential 修改仅 owner 可执行",
    empty: "尚未配置任何模型",
    noKey: "未配置 key",
    /**
     * Model dialog credential slot: sits where a stored key shows its created-at line. It
     * names no variable — the slot next to it already shows that variable's value masked,
     * which is what identifies the key to the reader.
     */
    readFromEnv: "读取自环境变量",
    /** Model picker's footer toggle: lists the models hidden by the configured-key filter. */
    showModelsWithoutKey: (n: number): string => `显示未配置 key 的模型(${n} 个)`,
    modelIdExists: "该模型 id 已存在",
    pricingAllOrNone: "三项价格需一并填写",
    pricingInvalid: "必须为数字",
    contextWindowInvalid: "必须为数字",
  },

  memory: {
    desc: "跨 Session 的长期记忆(存于 agent_state/memory/):agent 会在对话中自行记下值得保留的信息,你也可以直接让它记住某件事。用户记忆对本 Agent 的所有会话生效,工作区记忆按工作区隔离;记忆修改在对话中由 agent 完成。关闭开关只停止使用记忆,不删除任何文件。",
    enable: "启用记忆",
    /** What a refused flip of this switch names (feature-switch-refusal.ts): the switch, not the label. */
    switchNoun: "记忆",
    userScope: "用户记忆",
    templateMissing: "提示词模板中没有 {{MEMORY}} 占位符,记忆不会进入上下文。",
    insertPlaceholder: "插入 {{MEMORY}} 占位符",
    /** What a refused insert names (placeholder-insert-refusal.ts): the token its button also carries. */
    placeholderToken: "{{MEMORY}}",
    insertPlaceholderDone: "已插入",
    promptSection: "记忆提示词",
    promptSectionHint:
      "注入模板 {{MEMORY}} 占位符的内容。主提示词每个会话都注入;工作区附加段仅在持久工作区的会话中追加。",
    promptLabel: "主提示词",
    workspacePromptLabel: "工作区附加段",
    /**
     * Memory-prompt placeholder reference; a chip inserts into whichever field was focused
     * last. The two indexes plus the workspace directory — the user directory stays a literal
     * pattern in the prompt, resolvable from the Environment section.
     */
    promptPlaceholders: [
      [
        "{{USER_MEMORY_INDEX}}",
        "用户记忆索引 MEMORY.md 的内容(最多注入 200 行、总计 25000 字符)",
      ],
      [
        "{{WORKSPACE_MEMORY_INDEX}}",
        "当前工作区记忆索引的内容(最多注入 200 行、总计 25000 字符);仅在工作区附加段生效",
      ],
      ["{{WORKSPACE_MEMORY_DIR}}", "当前工作区记忆目录的绝对路径;仅在工作区附加段生效"],
    ],
    insertToken: "插入到光标处",
    itemCount: (n: number): string => `${n} 条`,
    emptyScope: "这个工作区还没有记忆——agent 会在会话中自行记下值得保留的信息",
    emptyUserScope: "还没有用户记忆——在对话里说「记住……」即可让 agent 保存",
    add: "添加",
    /** Accessible name for the group header's add entry, which drops its visible label on a narrow row. */
    addScopeLabel: (scope: string): string => `向${scope}添加`,
    addTitle: "添加记忆",
    addWhy: "记忆整理由 agent 在对话中完成:填写内容后打开新对话,由 agent 整理保存。",
    addContentLabel: "要记住的内容或来源",
    addContentPlaceholder: "粘贴要记住的内容,或文件路径 / 链接",
    /** Prefilled draft for the add-via-chat flow, per scope kind; the required content follows on the next line. */
    addPromptLead: {
      user: "请把下面的内容整理成记忆,存入用户记忆:",
      workspace: "请把下面的内容整理成记忆,存入这个工作区的记忆:",
    },
    view: "查看",
    edit: "编辑",
    editTitle: "编辑记忆",
    editWhy:
      "内容修改由 agent 在对话中完成:确认引导语后打开新对话,agent 会同步更新记忆文件与 MEMORY.md 索引。",
    editRequirementLabel: "修改要求",
    editRequirementPlaceholder: "描述要怎么改,跳转后可在对话中补充",
    editPromptLabel: "引导语预览",
    editCopyPrompt: "复制 Prompt",
    editOpenChat: "打开新对话",
    delete: "删除",
    deleteTitle: "删除这条记忆?",
    deleteConfirm: (name: string): string =>
      `将删除「${name}」并移除 MEMORY.md 中对应的索引行。此操作不可恢复。`,
    deleteDone: "已删除",
    /** Prefilled draft for the edit-via-chat flow; the user completes the trailing requirement line before sending. */
    editPromptLead: (title: string): string => `请帮我更新一条记忆:${title}`,
    editPromptTail: "修改要求:",
    exportScope: "导出",
    exportScopeHint: "将该组全部记忆下载为一份 JSON 文档",
    exportScopeLabel: (scope: string): string => `导出${scope}`,
    /**
     * An export the download refused (memory-group-refusal.ts), drawn in the group that asked.
     * Says the export only reads, because that is the one moment a reader wonders whether the
     * attempt touched the memories; the reason goes last, as in every other refusal sentence.
     */
    exportRefused: (scope: string, reason: string): string =>
      `记忆组「${scope}」没有导出成文档,导出只是读取,记忆一条都没有被改动:${reason}`,
    /**
     * A picked file the import never got to read (memory-group-refusal.ts), drawn in the group
     * whose import control picked it. Says the file never got read, because that is what stopped
     * it: no request left the page, so nothing in the group moved.
     */
    importRefused: (scope: string, reason: string): string =>
      `记忆组「${scope}」没有导入,这个文件没有读成,记忆一条都没有被改动:${reason}`,
    /**
     * A memory that did not open (memory-file-refusal.ts), drawn in the row whose eye button asked.
     * Says the attempt only read, because a panel that fails to appear is exactly the moment a
     * reader wonders whether the memory survived it; the reason goes last, as in every refusal.
     */
    viewRefused: (title: string, reason: string): string =>
      `记忆「${title}」没有打开,打开只是读取,记忆一条都没有被改动:${reason}`,
    importScope: "导入",
    importScopeHint: "从导出的 JSON 文档恢复记忆到该组",
    importScopeLabel: (scope: string): string => `导入到${scope}`,
    importTitle: "导入记忆",
    importWhy:
      "读取从本 agent 或其他 agent 导出的一组记忆:一个 JSON 文件,含这组记忆与它的 MEMORY.md 索引。",
    importFile: (name: string, count: number): string => `${name} —— ${count} 条记忆`,
    importModeLabel: "当这一组里已有同名记忆时",
    importModeSkip: "保留现有的这条",
    importModeSkipHint: "只添加这一组还没有的记忆,不会丢失任何现有内容。",
    importModeOverwrite: "改用文件里的版本",
    importModeOverwriteHint: "文件中没有的记忆保持不变。",
    importModeReplace: "整组替换",
    importModeReplaceHint: "文件中没有的记忆将被删除。",
    importAction: "导入",
    importInvalidFile: "这个文件不是记忆导出文件。",
    importEmptyFile: "这个文件里没有记忆。",
    importConfirmTitle: "确认导入",
    importWillOverwrite: (names: string[]): string =>
      `将覆盖 ${names.length} 条记忆:${names.join("、")}`,
    importWillRemove: (names: string[]): string =>
      `将删除 ${names.length} 条记忆:${names.join("、")}`,
    importWillReplaceIndex: "这一组的 MEMORY.md 索引将被替换。",
    importIrreversible: "此操作不可恢复。",
    importDone: (added: number, overwritten: number, removed: number): string =>
      `已导入:新增 ${added} 条,覆盖 ${overwritten} 条,删除 ${removed} 条`,
    importNothingNew: "没有可导入的内容——文件里的记忆这一组都已经有了",
  },

  vault: {
    desc: "本 Agent 专属的环境变量(存于 agent_state/.vault.toml):键值对注入其 shell 命令(exec_command)的子进程环境;键名会告知模型,值不进入模型上下文。子 Agent 使用各自的保险柜,不继承。保存后自下一个任务起生效(进行中的任务不受影响)。",
    key: "键名",
    value: "值",
    valueMasked: "值(掩码)",
    add: "添加",
    addTitle: "添加环境变量",
    remove: "删除",
    deleteTitle: "删除环境变量",
    deleteConfirm: (key: string): string => `确认删除环境变量「${key}」?值不可恢复。`,
    overwriteTitle: "覆盖已有环境变量",
    overwriteConfirm: (key: string): string => `「${key}」已存在,保存将覆盖原值且不可恢复。`,
    empty: "尚未配置任何环境变量",
    readOnlyHint: "member 只读;Vault 修改仅 owner 可执行",
    keyHint: "字母、数字与下划线,不能以数字开头",
    keyInvalid: "键名不合法:仅字母、数字与下划线,且不能以数字开头",
    valueRequired: "值不能为空",
    /**
     * The tab's "add with AI" entry: the dialog's title and lead (an honest warning — a value
     * typed into the prompt reaches the provider, the Trace and the agent's own command line),
     * the prompt box's placeholder, the examples and the fixed instruction tail. The examples obey
     * that lead: the key-names-only ask comes first and none of them puts a secret in the prompt,
     * both pinned by create-with-ai-surfaces.test.ts. The tail is fed the target agent and Project
     * because the prompt goes to the Project's default agent, which is not necessarily the agent
     * whose vault this is; it names the data root for the same reason the models tail does.
     */
    aiAddTitle: "让 AI 添加密钥",
    aiAddIntro:
      "写进提示词的密钥值会发给模型服务商、写入对话记录(Trace),还会出现在智能体执行的命令里。更稳妥的做法是让 AI 只创建键名并告诉你用途,值在保险柜里手动填写。",
    aiAddPlaceholder: "让它检查这个智能体需要哪些 API key,或说明要建哪些键名…",
    aiAddExamples: [
      {
        key: "audit",
        label: "盘点这个智能体需要的 key",
        description: "先建键名,值稍后手动填",
        prompt:
          "检查这个智能体已安装的技能需要哪些 API key,先把键名建好,并逐个告诉我用途和申请地址——值我自己在保险柜里填。",
      },
      {
        key: "rotate",
        label: "重置一个过期 token",
        description: "把值清成占位符,新值手动填",
        prompt:
          "GH_TOKEN 已经过期,把它重置为占位值,并告诉我去哪里申请新的——新 token 我自己在保险柜里填。",
      },
      {
        key: "endpoint",
        label: "接入一个内部服务",
        description: "地址直接写入,token 留给你填",
        prompt:
          "这个智能体要访问我们内部的 Gitea(https://git.example.com)。把 GITEA_BASE_URL 设为该地址,GITEA_TOKEN 先用占位值创建,并告诉我去哪里签发 token。",
      },
    ],
    aiAddTail: (agentId: string, projectId: string): string =>
      [
        `请使用 penguin-config 技能,把上面的密钥写进智能体 ${agentId} 的保险柜(项目 ${projectId}):`,
        "- 下面每条命令都要带 `--root <数据根目录>`,即环境信息中 App Data Dir 的上级目录。命令的环境里没有这个值,不带 `--root` 会写到另一个数据根目录,这个智能体的保险柜仍然是空的。",
        `- 每个密钥执行一次 \`penguin config vault set --key <键名> --value <值> --agent-id ${agentId} --project-id ${projectId} --root <数据根目录>\`;只需创建键名时,值先填占位符 TODO,并告诉我该键的用途与申请地址。`,
        "- 不要在回复里复述任何值,不要读取 .vault.toml。",
        `- 最后运行 \`penguin config vault list --agent-id ${agentId} --project-id ${projectId} --root <数据根目录>\` 列出键名。`,
      ].join("\n"),
    /**
     * Assigning the account's own global secrets into this Agent (the user-level vault dialog
     * lives in the account menu). The copy says what the operation IS — a one-off copy into this
     * Agent's own vault, not a link to the global entry — because that is the one thing a user
     * cannot see from the table that results.
     */
    assign: {
      open: "从用户密钥分配",
      title: "分配用户密钥",
      hint: "把你的全局密钥拷贝进本智能体;之后全局密钥改了,要重新分配才会同步。",
      empty: "你的用户密钥里还没有条目——先在左下角账号菜单 ›「用户密钥」里添加。",
      selected: (n: number): string => `已选 ${n} 条`,
      all: "全选",
      confirm: "分配",
      done: (n: number): string => `已分配 ${n} 条到本智能体`,
      overwritten: "同名密钥会覆盖本智能体原有的值",
    },
    /** Prompt-injection controls (toggle card / template alert / prompt editor), mirroring the memory tab's set. */
    injection: {
      enable: "启用密钥保险柜",
      switchNoun: "密钥保险柜",
      templateMissing: "提示词模板中没有 {{VAULT}} 占位符,保险柜小节不会进入上下文。",
      legacyTemplate:
        "模板仍是旧版硬编码的 # Vault 段落:一键迁移会将该段落原位替换为 {{VAULT}} 占位符,措辞不变,此后可在下方编辑。",
      insertPlaceholder: "插入 {{VAULT}} 占位符",
      /** What a refused insert names (placeholder-insert-refusal.ts): the token its button also carries. */
      placeholderToken: "{{VAULT}}",
      migrate: "迁移为 {{VAULT}} 占位符",
      promptSection: "保险柜提示词",
      promptSectionHint: "注入模板 {{VAULT}} 占位符的内容;开关关闭或模板无占位符时不注入。",
      promptLabel: "提示词",
      promptPlaceholders: [
        ["{{VAULT_KEYS}}", "保险柜键名列表(每键一行「- KEY」,仅键名,值永不注入;无键时为空)"],
      ] as ReadonlyArray<readonly [string, string]>,
    },
  },

  schedule: {
    desc: "定时任务(agent_state/schedule/*.toml):到点自动向目标 Session 发送 prompt;文件亦可手工编辑,Web 端修改后即时生效。",
    readOnlyHint: "member 只读;定时任务修改仅 owner 可执行",
    colStatus: "状态",
    colPeriod: "周期",
    colTarget: "目标",
    colFireTimes: "下次 / 最近触发",
    colQueued: "排队",
    statusNames: {
      active: "生效",
      disabled: "停用",
      expired: "已过期",
      done: "已完成",
      missed: "已错过",
      invalid: "无效",
    } as Record<string, string>,
    queued: "排队中",
    once: "一次性",
    newSession: "新建会话",
    invalidFiles: "解析失败的文件(已跳过调度)",
    empty: "尚未配置定时任务",
    enable: "启用",
    disable: "停用",
    addTitle: "新建定时任务",
    editTitle: (name: string): string => `编辑定时任务「${name}」`,
    nameHint: "即文件名(不含 .toml),创建后不可改",
    prompt: "Prompt",
    enabled: "启用",
    startAt: "开始时间",
    endAt: "结束时间",
    period: "周期",
    periodPlaceholder: "30m / 12h / 7d,留空为一次性",
    target: "目标",
    targetNew: "每次新建会话",
    targetSession: "绑定 Session",
    sessionId: "Session",
    /** Bind-Session picker (searchable dropdown): trigger placeholder, search box, and empty states. */
    chooseSession: "选择要绑定的 Session",
    sessionSearch: "搜索标题或 Session id…",
    sessionNoMatch: "无匹配的 Session",
    sessionEmpty: "该 Agent 暂无 Session",
    workspace: "Workspace",
    model: "Model",
    modelDefault: "项目默认",
    deleteTitle: "删除定时任务",
    deleteConfirm: (name: string): string => `确认删除定时任务「${name}」?`,
    /** Toasts after a write. A schedule fires on its own clock, so none of them mentions when a conversation picks the change up: there is nothing to pick up. */
    toastSaved: "已保存定时任务",
    toastEnabled: "已启用定时任务",
    toastDisabled: "已停用定时任务",
    /** The form's target line when it is pinned to one Session (the chat dock panel). */
    targetThisSession: "本对话",
    /** The chat dock's scheduled-tasks panel (features/schedules/schedule-panel.tsx): the current Session's tasks. */
    panelTitle: "定时任务",
    panelSubtitle: "让智能体按计划替你执行任务、发送提醒或监控更新",
    panelSearchPlaceholder: "搜索定时任务",
    filterAll: "全部",
    filterActive: "生效中",
    filterPaused: "已暂停",
    panelEmpty: "这段对话还没有定时任务",
    panelNoMatch: "没有匹配的定时任务",
    /** The panel's body on the draft page, where no Session exists yet. */
    panelDraftEmpty: "发送第一条消息后即可为这段对话安排定时任务",
    /**
     * The scheduled-tasks page (features/schedules/schedules-page.tsx): every Agent's tasks in
     * the Project, grouped by the Agent that owns each file. Reached from the account menu, so
     * `pageTitle` is also the row's wording there.
     */
    pageTitle: "定时任务",
    pageDesc: "本项目所有 Agent 的定时任务,可在此统一启停、编辑与删除。",
    pageEmpty: "本项目还没有定时任务",
    /** The page's scope switch: this Project's editable list, or the read-only overview over every Project. */
    scopeProject: "本项目",
    scopeAll: "全部项目",
    /** The header description while the overview is on screen (it is read-only, and says so). */
    allScopeDesc:
      "跨项目只读总览:每个项目一段,点「打开」切到那个项目;新建与修改请切回「本项目」。",
    allScopeEmpty: "还没有任何项目的定时任务",
    /** The jump on a Project's heading in the overview. */
    openProject: "打开",
    openProjectHint: "切到该项目,在那里新建或修改定时任务",
    openProjectHere: "这就是当前项目,切回本项目视图",
    pageGroupCount: (n: number): string => `${n} 个任务`,
    /** Accessible name of a row's overflow menu (edit / delete). */
    rowActions: "更多操作",
    /** The human schedule line under a task's name (schedule-describe.ts). */
    human: {
      everyDay: (time: string): string => `每天 ${time}`,
      /** `weekday` is the locale's short weekday name (周一 / Monday). */
      everyWeek: (weekday: string, time: string): string => `每${weekday} ${time}`,
      everyDays: (n: number, time: string): string => `每 ${n} 天 ${time}`,
      everyHours: (n: number): string => (n === 1 ? "每小时" : `每 ${n} 小时`),
      everyMinutes: (n: number): string => `每 ${n} 分钟`,
      /** A one-off task and when it fires. */
      once: (when: string): string => `一次性 · ${when}`,
      next: (when: string): string => `下次 ${when}`,
      today: (time: string): string => `今天 ${time}`,
      tomorrow: (time: string): string => `明天 ${time}`,
      /** `monthDay` is formatMonthDay's output (9月3日 / Sep 3). */
      onDate: (monthDay: string, time: string): string => `${monthDay} ${time}`,
      onDateWithYear: (year: number, monthDay: string, time: string): string =>
        `${year} 年 ${monthDay} ${time}`,
    },
    /** The "Create with AI" surfaces: the dock panel prefills this conversation's composer, the settings tab a new conversation's. */
    aiCreateTitle: "用 AI 创建定时任务",
    aiCreateInSessionDesc: "描述要安排的事,智能体会在这段对话里创建它,并确认设定的时间。",
    aiCreateDesc: "描述要安排的事,智能体会在新对话里为该 Agent 创建它,并确认设定的时间。",
    /** The in-Session dialog's lead line (replaces the kit's "in a new conversation" wording). */
    byAgentInSession: (name: string): string => `将由「${name}」在本对话中完成`,
    /** The in-Session dialog's one exit (the kit's aiCreate.editInChat opens a NEW conversation; this one fills the composer already on screen). */
    editInSession: "在本对话中编辑",
    /** Instruction tail appended to the in-Session dialog's draft (composeAiPrompt); the model binds the task to this Session. */
    aiCreateInSessionTail:
      "请把上面的请求创建为绑定到本对话的定时任务:在 agent_state/schedule/ 下写一个 TOML 文件,`session_id` 取本对话的 Session ID(见 Environment 段),文件名取有意义的英文名,设置 `start_at`;需要重复执行时写 `period`,请求有自然终点时写 `end_at`。创建后用一行确认你设定的时间安排。",
    /**
     * Instruction tail of the settings tab's dialog: the task is created for one agent, in a
     * new Session unless the user names one. The CLI form spells every flag, `--agent-id`
     * above all: the prompt runs in a conversation with the Project's default agent, so the
     * server injects THAT agent into ADELIE_AGENT_ID, and an `add` without the flag writes
     * the task into the wrong agent's schedule directory. The TOML keys are named only in
     * the file branch, so they are never read as flags of the command beside them.
     */
    aiCreateTail: (agentId: string): string =>
      `请为 Agent「${agentId}」创建这个定时任务。可以执行 \`penguin schedule add <名称> --agent-id ${agentId} --prompt "<请求内容>" --start-at <未来的 ISO 8601 时刻,带 --period 时也可用 now>\`,需要重复执行时加 \`--period <30m | 12h | 7d>\`,请求有自然终点时加 \`--end-at <ISO 8601>\`——不写 \`--agent-id\` 时任务会落到运行本对话的那个 Agent 上,而不是它;也可以直接在该 Agent 的 agent_state/schedule/ 下写 TOML 文件,文件名取有意义的英文名,用 \`start_at\`、\`period\`、\`end_at\` 这几个键。除非用户指定了 Session,否则采用每次新建 Session 的模式。创建后用一行确认你设定的时间安排。`,
    /** The suggestion rows (name / schedule hint / one-line description) and the prompt each prefills — one phrased for this conversation, one for an agent as a whole. */
    suggestionsTitle: "建议",
    suggestions: {
      dailyBrief: {
        name: "每日简报",
        hint: "每个工作日 08:00",
        description: "汇总昨天的进展与今天的待办",
        prompt: "每个工作日早上 8 点给我一份简报:昨天这段对话里的进展与今天的待办",
        agentPrompt: "每个工作日早上 8 点生成一份简报:昨天的进展与今天的待办",
      },
      weeklyReview: {
        name: "每周回顾",
        hint: "每周五 16:00",
        description: "把本周的工作整理成一份状态更新",
        prompt: "每周五 16:00 把本周的工作整理成一份状态更新",
        agentPrompt: "每周五 16:00 把本周的工作整理成一份状态更新",
      },
      followUp: {
        name: "跟进提醒",
        hint: "一次性",
        description: "到点提醒你跟进某件事",
        prompt: "明天 10:00 提醒我跟进 X",
        agentPrompt: "明天 10:00 提醒我跟进 X",
      },
      monitor: {
        name: "监控更新",
        hint: "每 6 小时",
        description: "定期检查一个页面或数据源的变化",
        prompt: "每 6 小时检查 <url> 是否有更新并告诉我变化",
        agentPrompt: "每 6 小时检查 <url> 是否有更新,有变化时告诉我",
      },
    },
    /** Prompt-injection controls (toggle card / template alert / prompt editor), mirroring the memory tab's set. */
    injection: {
      enable: "启用定时任务",
      switchNoun: "定时任务",
      templateMissing: "提示词模板中没有 {{SCHEDULES}} 占位符,定时任务小节不会进入上下文。",
      insertPlaceholder: "插入 {{SCHEDULES}} 占位符",
      /** What a refused insert names (placeholder-insert-refusal.ts): the token its button also carries. */
      placeholderToken: "{{SCHEDULES}}",
      promptSection: "定时任务提示词",
      promptSectionHint:
        "注入模板 {{SCHEDULES}} 占位符的内容,教模型用文件工具管理定时任务;开关关闭或模板无占位符时不注入。",
      promptLabel: "提示词",
      promptPlaceholders: [
        ["{{SCHEDULE_LIST}}", "现有任务名列表(每任务一行「- 名称」;无任务时注入空清单说明)"],
      ] as ReadonlyArray<readonly [string, string]>,
    },
  },

  /** Plugin library page (features/plugins/plugins-page.tsx): one card per library plugin, installed on Agents as a whole. */
  plugins: {
    installedTitle: "已安装的插件",
    installedDesc:
      "当前项目要求的插件,以及其中哪些正在被本进程运行。服务器能自行重组时,改动无需重启即可生效;重组会中止所有项目正在进行的 Agent 运行。",
    installedEmpty: "还没有安装任何插件。",
    stateActive: "运行中",
    builtin: "内置",
    builtinHint: "随本次构建自带:安装它不需要下载,但仍需你点安装才会加载。",
    installedRestart: "待重启",
    stateFailed: "加载失败",
    replacesLabel: "替换",
    restartPending: "有已列出但未运行的插件,且本服务器无法免重启应用:重启服务器后加载。",
    uninstall: "移除",
    install: "安装",
    installing: "安装中…",
    /** The Project-level install: the plugin is listed, and running unless the row says otherwise. */
    deploymentInstalledToast: (name: string) => `已安装 ${name}`,
    /** Listed, but the process could not load it: the reason, not a success. */
    deploymentFailedToast: (name: string, reason: string) => `${name} 加载失败:${reason}`,
    applyConfirmInstall: (name: string) => `安装 ${name}?`,
    applyConfirmRemove: (name: string) => `移除 ${name}?`,
    applyConfirmBody: "所有项目中正在进行的 Agent 运行都会被中止。",
    pageTitle: "插件",
    /** The header's machine picker: which machine's plugins the page shows and edits. */
    viewMachine: "机器",
    allMachines: "所有机器",
    thisServer: "本机",
    /** A row listed for some machines only, by alias. */
    onlyOn: (names: string) => `仅在 ${names}`,
    /** An all-machines row listed only for other machines. */
    notHere: "本机不运行",
    /** A row the Project lists for a machine that has not reported it running yet. */
    notSynced: "尚未同步到该机器",
    /** Remove is unavailable in a machine's view for a plugin the shared table lists. */
    sharedCannotRemove: "已对所有机器启用:请在「所有机器」视图中移除。",
    machineUnreadable: (name: string, reason: string) => `无法读取 ${name} 运行的插件:${reason}`,
    /**
     * The same line about this server, whose plugins the page draws when no machine is picked:
     * the picker's label cannot be glued into the machine phrasing — it is a bare
     * "This server" and would read as if it were a machine's name.
     */
    thisServerUnreadable: (reason: string) => `无法读取本机的插件:${reason}`,
    /**
     * The read again after an install (pluginConfigStale): the cards stay on screen with what the
     * machine answered before it, so the line says what is being shown rather than that nothing
     * could be read — "may still be" because a later read of the notices can land on its own.
     */
    machineStale: (name: string, reason: string) =>
      `安装之后没能重新读取 ${name} 上的插件状态(卡片上的状态可能仍是安装前的):${reason}`,
    /** The same line about this server, whose label would read as a machine's name (see above). */
    thisServerStale: (reason: string) =>
      `安装之后没能重新读取本机的插件状态(卡片上的状态可能仍是安装前的):${reason}`,
    /** Header icon button opening the Settings dialog on its Plugins page (admin only). */
    openSettings: "插件设置",
    pageDesc:
      "所有插件在一个列表里。插件库里的随本次构建自带(技能和/或钩子包——快捷调用,或安装到 Agent);当前项目要求的模块插件在服务端运行,市场里其余的可以为它安装。",
    /** The list's header: the library's plugins the Agent the page works with holds, plus the module plugins this Project lists. */
    installedSection: (n: number): string => `已安装的插件 (${n})`,
    /** The second list: the library's plugins that Agent does not hold, and registry entries this Project does not ask for yet. */
    availableSection: (n: number): string => `可安装 (${n})`,
    notInstalled: "未安装",
    /** The market shelf's per-Agent state tag on a library plugin's card (marketState): about the Agent the page is working with, not the deployment. */
    marketState: { installed: "已安装", updatable: "可更新", available: "未安装" },
    /** Tooltip of that tag, naming the Agent it is about (the page always has one selected when the tag is drawn). */
    marketStateHint: (agent: string) =>
      `以当前选中的 Agent(${agent})为准:未安装可以一键装到它,可更新表示它装的副本落后于本次构建的版本。`,
    /** The shelf's one-click install button, naming the Agent it installs to. */
    marketInstall: (agent: string) => `安装到 ${agent}`,
    /** The shelf's one-click update button, on a copy the server lists as behind the library. */
    marketUpdate: (agent: string) => `更新 ${agent} 上的副本`,
    /** The filter column beside the lists, and the empty result. */
    filterCategories: "分类",
    filterKind: "包含",
    filterState: "状态",
    filterClear: "清除筛选",
    kindLabel: { skills: "技能", hooks: "钩子", modules: "模块" },
    stateLabel: {
      installed: "已安装",
      available: "可安装",
      running: "运行中",
      restart: "待重启",
      failed: "加载失败",
    },
    noMatch: "没有匹配的插件。",
    /** The description of a shipped package the registry has no entry for. */
    shippedNoEntry: "随本次构建自带;市场里还没有它的条目。",
    /** The plugin detail Modal's link to the plugin package's own market page (its registry entry). */
    detailMarketLink: "查看市场条目",
    /** The "built in" tag on a library plugin: it ships with the build and needs no download. */
    libraryBuiltinHint: "随本次构建自带;安装到 Agent 即可在那里使用。",
    /**
     * The verb on a PUBLISHED plugin's row: the entry is on the shelf because its package was
     * published to npm, not because this build carries it, so the row's one step is to fetch it
     * into the plugin library — the npm import an operator would otherwise type into the
     * download dialog themselves. Reuses the dialog's copy for everything after that (the
     * success toast, the overwrite question).
     */
    addToLibrary: "装入插件库",
    /**
     * Why that verb did not land, drawn in the row itself (library-add-refusal.ts): the write
     * changes nothing on a refusal, so the row and its button are the retry.
     */
    libraryAddRefused: (reason: string): string => `装入插件库失败:${reason}`,
    /** Plugin count in the group header (small text to the right of the category name). */
    pluginCount: (n: number): string => `${n} 个插件`,
    /** Search box of the create dialog's plugin picker. */
    searchPlaceholder: "搜索插件",
    /** Usage count in the card metadata (shows "unused" instead of a bare 0). */
    /** Section labels of the plugin detail Modal. */
    detailSkills: "技能",
    detailHooks: "钩子",
    usedByAgents: (n: number): string => (n === 0 ? "未被使用" : `${n} 个 Agent 在用`),
    /** Title on a disabled quick-start button: it pre-selects one of the plugin's skills on the currently selected Agent, so the plugin has to be installed there first. */
    quickInvokeNeedsInstall: "先在当前 Agent 安装该插件后才能快捷调用",
    /**
     * Why an install onto one Agent did not land, drawn under the button or the row that sent it
     * (install-refusal.ts): a refusal leaves the plugin where it was, so that control and its
     * button are the retry — and the Agent is named because the manage-installs Modal has one row
     * per Agent while the card follows the page's selection.
     */
    installRefused: (plugin: string, agent: string, reason: string) =>
      `未能将 ${plugin} 安装到 ${agent}:${reason}`,
    /** Top toast shown on successful install / uninstall. */
    installedToast: (plugin: string, agent: string): string => `已将 ${plugin} 安装到 ${agent}`,
    uninstalledToast: (plugin: string, agent: string): string => `已从 ${agent} 卸载 ${plugin}`,
    updateOutdated: (n: number): string => `有新版本:更新 ${n} 个 Agent 的安装`,
    updateConfirmTitle: (name: string): string => `更新 ${name}`,
    updateConfirmWarning: (name: string): string =>
      `更新 ${name} 会把库内当前副本重装到各 Agent,覆盖其已安装的技能与钩子文件——本地改动会丢失,如有需要请先导出备份。`,
    updatedToast: (plugin: string, n: number): string =>
      `已将 ${plugin} 更新到最新版(${n} 个 Agent)`,
    /** Uninstall confirmation: removing the installed copy deletes its files (local edits included). */
    uninstallConfirmTitle: (name: string): string => `卸载 ${name}`,
    uninstallConfirmBody: (plugin: string, agent: string): string =>
      `确定从 ${agent} 卸载 ${plugin} 吗?其已安装的技能与钩子文件(含本地改动)将被删除。`,
    /** Import actions in the page header (admin only — the plugin directory belongs to the server, not to a Project). */
    importUpload: "上传插件",
    importDownload: "远程下载",
    /** Busy states: the upload one replaces the file-picker label, the download one its dialog's confirm button. */
    importUploading: "上传中…",
    importDownloading: "下载中…",
    /** Client-side refusal of a picked zip over the decoded-archive cap; the file is dropped unread, so the server's own 413 never has to be earned. */
    importTooLarge: (mb: number): string => `插件包不能超过 ${mb} MB,请压缩后重试`,
    /** The link at the foot of both import dialogs that opens the rules; see rulesTitle. */
    rulesLink: "导入与编写规则",
    /** The dialog those rules now live in, where they used to be printed under the dialogs. */
    rulesTitle: "插件导入与编写规则",
    /**
     * The import rules, shown as one numbered block at the foot of BOTH dialogs: they are the
     * shape a plugin has to arrive in, not the property of one source, and a reader who opened
     * the wrong dialog should still learn them. Ordered, because the name is decided by a
     * precedence the reader has to walk (typed → the source's own name → the archive's own
     * layout), and that order is the trap a repository URL sets: it carries the repository's name.
     */
    importRulesTitle: "插件导入规则",
    importRules: [
      "来源是本地 zip,或一个地址/npm 包——zip 直链、GitHub 仓库地址(取默认分支)、仓库内目录地址(…/tree/<分支>/<子目录>)、npm 包名(@scope/名称、@scope/名称@1.2.3、npm:@scope/名称;不写版本就取 latest)。",
      "压缩包必须是含 plugin.json 的 zip,或 npm 的 tgz(从 registry 取对应版本的 tarball 并校验其校验和);插件根取归档里最浅一层含 plugin.json 的目录,同一层出现多个则拒绝。",
      "插件名依次取:你填的名字 → 来源自带的名字(目录地址取末段目录名、仓库地址取仓库名、压缩包链接取文件名、npm 包取去掉 scope 的包名)→ 插件根的目录名;只能用字母、数字、下划线和中划线。所以从仓库地址导入会装成仓库名。",
      "上传的 zip 不超过 14 MB,远程归档不超过 32 MB,npm 的 tgz 解压后不超过 64 MB;解包后只统计插件根之下:200 个文件、单文件 5 MB、合计 20 MB。",
      "内置插件占用的名字不能导入(换个名字);同名用户插件会先问一次是否覆盖,覆盖即替换其全部文件。",
    ],
    /**
     * The other half, under it: what a plugin has to BE, rather than what the import does with
     * it. Written here rather than in any one plugin repository for the reason the rules exist
     * at all — a plugin outlives the repository it was published in, and the two rules that keep
     * being broken (account details and credentials inside the plugin) are broken by whoever is
     * writing one, who is looking at this surface and not at that repository's README.
     */
    authoringRulesTitle: "插件编写规则",
    authoringRules: [
      "一个插件一个目录,目录名即插件名;插件之间不共享文件,要复用就复制一份。",
      "目录里要有 plugin.json(描述、版本)和 skills/<技能名>/SKILL.md;给别人时打成 zip,顶层目录名就是插件名。",
      "不要把账号信息写进插件——AppID、密钥、邮箱、手机号都属于使用者:从记忆或环境变量里读,脚本一律做成参数,不要写死默认值。",
      "不提交密钥:私钥、token、cookie 都不进插件目录。",
    ],
    /**
     * Local upload dialog: what the archive has to be, the picker that is its source field, the
     * file it will send, and the confirm. The dialog's title reuses importUpload.
     */
    uploadDesc:
      "zip 压缩包,需带有 plugin.json:放在压缩包根目录,或放在其中任意一层目录里(取最浅一层含 plugin.json 的目录作为插件根)。",
    uploadPickFile: "选择 zip 文件",
    uploadPicked: (file: string): string => `已选择 ${file}`,
    uploadAction: "上传并导入",
    /** Success toast of both imports; the library list and the directory line are re-read with it, which is how the new plugin appears. */
    importDoneToast: (name: string): string => `已导入插件 ${name}`,
    /** Overwrite confirmation both imports raise on the 409 plugin_exists they answer with (the confirm resends the same request with overwrite: true). */
    importOverwriteTitle: "覆盖同名用户插件",
    importOverwriteBody: (name: string): string =>
      `用户插件「${name}」已存在,覆盖导入会替换其全部文件(含本地改动),不可恢复。确认继续?`,
    importOverwriteAction: "覆盖导入",
    /**
     * The name field both import dialogs carry. The label stays bare on purpose — the app's
     * marker rule is that a field with no red "*" is the optional one, and never that a label
     * says so (test/required-mark.test.ts) — while the hint says what leaving it empty does and
     * names the ONE case that needs a value: plugin.json at the very root of the zip, where there
     * is no directory to take a name from and the server refuses the request rather than guessing
     * one.
     */
    pluginNameLabel: "插件名称",
    pluginNameHint:
      "留空时,取压缩包内含 plugin.json 的那层目录名作为插件名;仅当 plugin.json 就放在 zip 根目录、没有目录可供取名时才需要填写(此时留空会被服务端拒绝,不会自动取名)。",
    pluginNamePlaceholder: "my-plugin",
    /** Sits under the field, and holds the submit back, while the typed name breaks the rule the server applies to the directory a plugin is installed into. */
    pluginNameInvalid: "只能用字母、数字、下划线和中划线(^[A-Za-z0-9_-]+$)。",
    /** Remote download dialog. */
    downloadTitle: "从地址或 npm 下载插件",
    downloadUrlLabel: "插件地址或 npm 包名",
    downloadUrlHint:
      "zip/tgz 直链,GitHub 仓库地址(https://github.com/<owner>/<repo>,取默认分支)与仓库内目录地址(…/tree/<ref>/<subdir>),或 npm 包(@scope/name、@scope/[email protected]、npm:@scope/name;不写版本则取 latest)",
    downloadUrlPlaceholder:
      "@scope/name、https://github.com/<owner>/<repo> 或 https://…/plugin.zip",
    downloadDesc:
      "压缩包需带有 plugin.json;GitHub 仓库或目录地址会自动选取最浅一层含 plugin.json 的目录作为插件根;npm 包由服务端向 registry 取该版本的 tarball,并核对它公布的校验和。",
    downloadAction: "下载并导入",
    /** "User" badge on a card whose plugin comes from the user plugin directory rather than the build. */
    userBadge: "用户",
    userBadgeHint: "来自用户插件目录:可导出备份,由管理员导入或删除",
    /** Card actions of a user plugin (a built-in plugin keeps today's actions only). */
    exportPlugin: "导出插件",
    /**
     * An export the download refused (plugin-export-refusal.ts), drawn under the row that asked.
     * Says the export only reads, because that is the one moment a reader wonders whether the
     * attempt touched the plugin; the reason goes last, as in every other refusal sentence.
     */
    exportRefused: (plugin: string, reason: string): string =>
      `插件 ${plugin} 没有导出成 zip,导出只是读取,它的文件没有被改动:${reason}`,
    deletePluginAction: "删除插件",
    deleteConfirmTitle: (name: string): string => `删除 ${name}`,
    deleteConfirmBody: (name: string): string =>
      `确定删除用户插件 ${name} 吗?其目录会从磁盘删除,不可恢复。`,
    deletedToast: (name: string): string => `已删除插件 ${name}`,
    /** User plugin directory line under the title (path + copy button + count). */
    dirLabel: "用户插件目录",
    dirPathCopy: "复制目录路径",
    dirCount: (n: number): string => `${n} 个用户插件`,
    /** Count line at zero: worded rather than "0 个用户插件", which reads like a fault. */
    dirEmpty: "目录中还没有用户插件",
    /** The directory read failed: the line says so in words, since there is no path to show. */
    dirUnavailable: "无法读取用户插件目录",
    /** Appended to the page's "?" for a non-admin, who sees no import or delete action. */
    adminOnly: "只有管理员可以导入或删除插件。",
    /** Import and delete failures, keyed by the code the route answers with (pluginImportErrorText falls back to the server's own message for anything not named here). */
    importErrors: {
      plugin_exists: "已存在同名用户插件。",
      plugin_builtin: "内置插件不能被覆盖或删除(导入同名插件请另起一个名字)。",
      unsupported_url: "该地址不受支持:请填 zip/tgz 直链、GitHub 仓库/目录地址,或 npm 包名。",
      blocked_url: "该地址被拒绝(内网或其他不允许的地址)。",
      download_failed: "下载失败,请确认该地址可以访问。",
      npm_package_not_found: "npm 上没有这个包。",
      npm_version_not_found: "npm 上没有这个版本;请填确切版本号或 dist-tag(如 latest)。",
      npm_registry_failed: "读取 npm 失败,请稍后重试。",
      integrity_failed: "下载到的压缩包与 registry 公布的校验和不一致,已拒绝导入。",
      invalid_plugin: "压缩包里没有合法的 plugin.json。",
      plugin_too_large: "插件包超过了服务端的大小上限。",
    },
  },

  /** Agent settings "Hooks" tab (features/agents/hooks-tab.tsx): the hook packages installed on one Agent — the list with its enable switch, the import modal (chat import / zip upload) and the export. The hook-point chips carry the bare point name (`stop`, `user_prompt`) and need no string. */
  hooks: {
    agentTabDesc:
      "该 Agent 已安装的钩子包(agent_state/hooks/):harness 在循环的钩子点运行的脚本,例如每个 Task 结束后。卸载会删除整个钩子包目录。",
    agentTabEmpty: "尚未安装任何钩子包",
    /** Members see the switch state but cannot flip it (appended to the tab description). */
    readOnlyHint: "启用钩子的开关仅项目所有者可用。",
    /** The agents page's hook-count stat (hover title / accessible name). */
    hookCount: (n: number): string => `${n} 个钩子包`,
    exportHook: "打包导出",
    /**
     * An export the download refused (hook-export-refusal.ts), drawn under the row that asked.
     * Says the package is still installed because a failed export is when a reader wonders whether
     * the files were touched; the reason goes last, as in every other refusal sentence.
     */
    exportRefused: (hook: string, reason: string): string =>
      `钩子包 ${hook} 没有导出成 zip,它仍然装在这个 Agent 上:${reason}`,
    importHook: "导入钩子",
    importChatTitle: "推荐:让 Agent 在对话中导入",
    importChatWhy:
      "Agent 会通读来源、逐个审查脚本,再把钩子包安装到该 Agent 上,比直接上传更可靠。",
    importSourceLabel: "钩子来源",
    importSourceHint:
      "支持 URL / GitHub 仓库 / 本地路径 / 一段描述,或其他工具的钩子配置(如 Claude Code settings.json 的 hooks 块)",
    importSourcePlaceholder: "https://…、/path/to/hooks,或「写一个 stop 钩子:每次任务结束后…」",
    /** Preview placeholder shown in the generated prompt before a source is entered. */
    importSourceToken: "<来源>",
    importPromptLabel: "发送给 Agent 的 Prompt(预览)",
    /** Lead sentence for a URL / repo / path source; free text (a description, a pasted hooks config) is used verbatim as the lead instead. Composed with importPromptTail by buildHookImportPrompt (features/agents/hook-import.ts). */
    importPromptLead: (s: string): string => `把 ${s} 导入为钩子包。`,
    importCopyPrompt: "复制 Prompt",
    importOpenChat: "打开新对话",
    importUploadTitle: "上传钩子包 zip",
    importUploadDesc:
      "zip 根目录为 hooks.json 与脚本,或仅含一个内含它们的顶层目录。导入即生效:只要该 Agent 启用了钩子,其脚本就会在本机的钩子点运行,请只导入可信的包。",
    importUploadAction: "选择 zip 文件",
    importUploading: "上传中…",
    importDoneToast: "钩子包已安装",
    importOverwriteTitle: "覆盖已安装钩子包",
    importOverwriteBody: (name: string): string =>
      `钩子包「${name}」已存在,覆盖安装将替换其全部文件(含本地改动),不可恢复。确认继续?`,
    importOverwriteAction: "覆盖安装",
    /** The fixed tail joined after the lead (features/agents/hook-import.ts): the review step, the package format, the script contract and the install target, named by Project and Agent id. */
    importPromptTail: (projectId: string, agentId: string): string =>
      [
        "先完整阅读来源,逐个审查脚本有没有恶意行为(外传数据、改动来源之外的文件、执行来路不明的命令等),确认安全后再继续。",
        '然后产出一个 Adelie 钩子包:一份 hooks.json(name、description、description_zh、version(格式 YYYY.MM.DD.N),以及各钩子点的命令列表 stop / pre_tool_use / user_prompt,每项为 { "command": "<脚本相对路径>", "timeout": <秒> })加上纯 Node 的 .mjs 脚本(只用内置模块)。用不到的钩子点可以省略或写成 [];user_prompt 的条目可以另加 "trigger": "prompt"(缺省:用户每次提交 Prompt 时运行)或 "host"(只在宿主按包名启动该包的流程时运行)。',
        '脚本契约:stdin 收到一份 JSON——stop 点为 { "hook": "stop", "session_id", "trace_path" }(trace_path 是 Session 正在写入的 Trace 文件,无 Trace 时缺省),pre_tool_use 点另有 tool_name、tool_call_id、arguments(原始参数 JSON 串),user_prompt 点带 trace_path、scratchpad_dir 与 prompt(用户的消息文本);stdout 为空即无意见,否则一份 JSON 回答——stop 点 { "decision": "continue" | "stop", "input", "reason", "output", "subagent"? },pre_tool_use 点 { "decision": "allow" | "deny", "reason", "output" },user_prompt 点 { "context" },它在每条 Prompt 中紧随用户消息发出;退出码非零、stdout 不是 JSON 或超时都按失败记录、不采纳。',
        `把它安装到项目「${projectId}」中 Agent「${agentId}」的 agent_state/hooks/<name>/ 目录(目录名即包名,须匹配 ^[A-Za-z0-9_-]+$),最后向我说明它做什么、在哪个钩子点触发。`,
      ].join("\n"),
    uninstallConfirmTitle: (name: string): string => `卸载 ${name}`,
    uninstallConfirmBody: (name: string, agent: string): string =>
      `确定从 ${agent} 卸载钩子包 ${name} 吗?其全部脚本(含本地改动)将被删除。`,
    uninstalledToast: (name: string, agent: string): string => `已从 ${agent} 卸载钩子包 ${name}`,
    /** The Agent-level switch card at the top of the tab (usePromptInjection); hooks have no prompt half. */
    injection: {
      enable: "启用钩子",
      switchNoun: "钩子",
      enableHint:
        "开启后,该 Agent 新建的 Session 会在钩子点运行全部已安装的钩子包;关闭后新建的 Session 不运行任何钩子,已安装的包仍保留在磁盘上。进行中的 Task 保持开始时的设置,直到其上下文被压缩。",
      savedToast: "已保存,自下一轮对话起生效",
    },
  },

  pluginRegistry: {
    pageTitle: "插件市场",
    empty: "暂无插件",
    /** Card metadata: the entry's package specifier doubles as the install string. */
    specifierHint: "包名,即项目插件列表里写的那串",
    back: "返回插件市场",
    readme: "说明文档",
    noReadme: "该插件暂无说明文档。",
    notFound: "找不到这个插件。",
    repository: "源码仓库",
    homepage: "主页",
    authors: "作者",
    license: "许可证",
    copySpecifier: "复制包名",
    installHint:
      "安装分两类:技能/钩子类插件装到 Agent(插件市场页一键安装);服务端插件由当前项目要求,在它那一行点「安装」。",
  },

  skills: {
    quickInvoke: "快捷调用",
    /** Pre-filled body for quick invoke (per UI language; English is `use the <name> skill`). */
    quickInvokeText: (name: string): string => `使用 ${name} 技能`,
    /** Bulk controls of the multi-select skill panel; both act on the rows the search box currently leaves visible. */
    selectAll: "全选",
    selectNone: "全不选",
    selectedCount: (n: number): string => `已选 ${n} 个`,
    manageInstall: "管理安装",
    manageInstallTitle: (name: string): string => `管理安装:${name}`,
    install: "安装",
    installed: "已安装",
    uninstall: "卸载",
    /** Skill count in the group header (small text to the right of the group name). */
    skillCount: (n: number): string => `${n} 个技能`,
    /** The plugin library's per-Agent update button, and the confirm buttons of every update dialog. */
    updateAction: "更新",
    /** Settings Skills tab: toast after uninstalling one skill. */
    uninstalledToast: (skill: string, agent: string): string => `已从 ${agent} 卸载 ${skill}`,
    /** Uninstall confirmation: removing the installed copy deletes its files (local edits included). */
    uninstallConfirmTitle: (name: string): string => `卸载 ${name}`,
    uninstallConfirmBody: (skill: string, agent: string): string =>
      `确定从 ${agent} 卸载 ${skill} 吗?已安装的技能文件(含本地改动)将被删除。`,
    /** Agent settings "Skills" tab (installed list + import modal). */
    agentTabDesc:
      "该 Agent 已安装的技能(agent_state/skills/,文件即事实来源):元数据注入系统提示词,正文由模型按需读取;卸载会删除整个技能目录。",
    agentTabEmpty: "尚未安装任何技能",
    exportSkill: "打包导出",
    /**
     * An export the download refused (skill-export-refusal.ts), drawn under the row that asked:
     * the file was not saved and the installed copy was not touched, which is what the second
     * half says; the reason goes last, as in every other refusal sentence.
     */
    exportRefused: (skill: string, reason: string): string =>
      `技能 ${skill} 没有导出成 zip,它仍然装在这个 Agent 上:${reason}`,
    importSkill: "导入技能",
    importChatTitle: "推荐:让 Agent 在对话中安装",
    importChatWhy: "Agent 能完整阅读、审查并按需调整技能内容,比直接上传更可靠。",
    importSourceLabel: "技能来源",
    importSourceHint: "支持网页 / GitHub 仓库或目录 / 本地路径 / 其他生态的安装命令",
    importSourcePlaceholder: "https://…、git 仓库、/path/to/skill 或 npx skills add <name>",
    /** Preview placeholder shown in the generated prompt before a source is entered. */
    importSourceToken: "<来源>",
    importPromptLabel: "发送给 Agent 的 Prompt(预览)",
    /** Per-source lead sentence of the generated install prompt; composed with importPromptTail by buildImportPrompt (features/agents/skill-import-source.ts). */
    importPromptLead: {
      webUrl: (s: string): string => `请阅读这个网页,并把其中的 Skill 安装到你的技能目录:${s}。`,
      repoUrl: (s: string): string =>
        `请获取这个仓库或目录(git clone 或直接抓取),定位其中含 SKILL.md 的技能目录,并安装到你的技能目录:${s}。`,
      localPath: (s: string): string =>
        `请直接读取这个本地路径下的技能文件,并安装到你的技能目录:${s}。`,
      command: (s: string): string =>
        `这是一条其他生态的技能/插件安装命令,请不要直接执行:先解读它会安装什么,从对应的仓库或注册表获取相同内容,再安装到你的技能目录:${s}。`,
      reference: (s: string): string =>
        `请根据这个技能/插件引用找到其来源(仓库、插件市场或文档页),并把对应的 Skill 安装到你的技能目录:${s}。`,
    },
    /** Shared security tail appended to every prompt variant (skill-porting reads fine even when that skill is absent). */
    importPromptTail:
      "安装前请完整阅读全部内容,确认安全、无恶意指令后再写入,并向我说明它的用途。如果你安装了 skill-porting 技能,请先阅读并按其流程处理。",
    importCopyPrompt: "复制 Prompt",
    importOpenChat: "打开新对话",
    importUploadTitle: "上传技能 zip 包",
    importUploadDesc: "zip 根目录为 SKILL.md,或仅含一个内含 SKILL.md 的顶层目录。",
    importUploadAction: "选择 zip 文件",
    importUploading: "上传中…",
    importDoneToast: "技能已安装",
    importOverwriteTitle: "覆盖已安装技能",
    importOverwriteBody: (name: string): string =>
      `技能「${name}」已存在,覆盖安装将替换其全部文件(含本地改动),不可恢复。确认继续?`,
    importOverwriteAction: "覆盖安装",
    /** Prompt-injection controls (toggle card / template alert / prompt editor), mirroring the memory tab's set. */
    injection: {
      enable: "启用技能",
      switchNoun: "技能",
      templateMissing: "提示词模板中没有 {{SKILLS}} 占位符,技能小节不会进入上下文。",
      legacyTemplate:
        "模板仍是旧版硬编码的 # Skills 段落:一键迁移会将该段落原位替换为 {{SKILLS}} 占位符,措辞不变,此后可在下方编辑。",
      insertPlaceholder: "插入 {{SKILLS}} 占位符",
      /** What a refused insert names (placeholder-insert-refusal.ts): the token its button also carries. */
      placeholderToken: "{{SKILLS}}",
      migrate: "迁移为 {{SKILLS}} 占位符",
      promptSection: "技能提示词",
      promptSectionHint: "注入模板 {{SKILLS}} 占位符的内容;开关关闭或模板无占位符时不注入。",
      promptLabel: "提示词",
      promptPlaceholders: [
        ["{{SKILL_METADATA}}", "已安装技能的元数据行(每技能一行「- 名称 — 描述」;无技能时为空)"],
      ] as ReadonlyArray<readonly [string, string]>,
    },
  },

  chat: {
    newSessionMenu: "新建对话",
    chooseAgent: "选择 Agent",
    chooseModel: "选择模型",
    thinkingLevel: "思考等级",
    /** Tier names for every surface that DISPLAYS an already-chosen level — the composer picker's trigger and tooltip, the mid-chat switch dialog and its toasts, the Project chat-defaults control and its read-only row. Chinese only, no wire value (per maintainer request): once the tier is picked, the English spelling is noise on a control this narrow, and it reads badly inside the 「…」 of the switch prose. `none` exists purely to display a stored legacy value — it is never offered as a choice (many models cannot disable thinking). */
    thinkingLevelNames: {
      none: "无",
      low: "低",
      medium: "中",
      high: "高",
      xhigh: "极高",
      max: "最高",
    } as Readonly<Record<string, string>>,
    /** Dropdown-row variant of the name above: choosing is where the wire value earns its place, so a menu row annotates the Chinese name with the value the pick will send. Only the composer's own dropdown uses it — a native `<select>` renders the picked option's text on the collapsed control too, which would put the annotation straight back onto a trigger. */
    thinkingLevelMenuName: (name: string, level: string): string => `${name} (${level})`,
    /** Mid-chat switch guard (issue #310): confirm before a level change that costs prompt-cache hits over the existing history. Title is the dialog's accessible name only. */
    thinkingSwitchTitle: "切换思考等级",
    thinkingSwitchBody: (to: string): string =>
      `将思考等级切换为「${to}」?会话中途切换会降低提示词缓存命中率、增加成本,先压缩上下文再切换更省。`,
    /** Shown under the body when the session isn't idle — compaction can only start on an idle session. */
    thinkingSwitchBusyHint: "会话正在运行,压缩要等空闲后才能开始。",
    /** Primary (recommended) choice: compact first, then apply the switch. */
    thinkingSwitchCompactFirst: "压缩后切换",
    thinkingSwitchConfirm: "仍要切换",
    /** Toast when the compaction starts: the switch is applied once it ends. */
    thinkingSwitchCompacting: "正在压缩上下文,压缩结束后切换思考等级。",
    thinkingSwitchApplied: (to: string): string => `上下文已压缩,思考等级已切换为「${to}」。`,
    /** Compaction ended without completing — the switch still applies, so say both. */
    thinkingSwitchCompactFailed: "压缩未成功完成,思考等级已照常切换。",
    /** In-conversation model switch (the session toolbar's model picker). Title is the confirm dialog's accessible name only. Unlike the thinking level there is no separate "switch anyway" button: a switch always compacts on the current model first, and a failed compaction keeps it — the opt-in box below is the one exception, and only where a compaction really runs. */
    modelSwitchInSessionTitle: "切换模型",
    modelSwitchInSessionConfirm: "压缩并切换",
    /** Confirm label when the transcript is empty: nothing to compact, so it only switches. */
    modelSwitchInSessionDirectConfirm: "切换",
    modelSwitchInSessionBody: (from: string, to: string): string =>
      `将先用当前模型「${from}」压缩上下文,成功后以「${to}」继续本对话;压缩失败则保持「${from}」。`,
    /**
     * Body while the escape hatch below is ticked: the plain body promises that a failed
     * compaction keeps the current model, which a ticked box contradicts — so the sentence
     * follows the box rather than leaving two promises in one dialog.
     */
    modelSwitchInSessionBodyDiscard: (from: string, to: string): string =>
      `将先用当前模型「${from}」压缩上下文,成功后以「${to}」继续本对话;压缩失败则放弃摘要,直接以「${to}」继续。`,
    /**
     * The escape hatch, offered only where a compaction really runs: the model to leave is the
     * one that has to summarize, so a model whose every request fails (no quota left, a rejected
     * credential) can never summarize itself and the switch would fail forever.
     */
    modelSwitchInSessionDiscardFails: "压缩失败就直接切换(放弃摘要)",
    modelSwitchInSessionDiscardFailsHint:
      "当前模型若压不动这段对话(额度用尽、凭据失效),仍然切到上面的模型。代价是摘要丢失:对话正文还在,但新模型接不到它的工作记忆。",
    /** Body when the transcript is empty: there is no context to compact, so the switch is immediate. */
    modelSwitchInSessionDirectBody: (to: string): string =>
      `当前上下文没有内容,将直接切换到「${to}」。`,
    /** Body when the transcript ends in a completed compaction or a model switch with nothing since: the switch runs no compaction and continues from what that context opened with (a summary, or nothing). */
    modelSwitchInSessionCompactedBody: (to: string): string =>
      `上下文刚压缩或切换过、此后没有新的对话,不会再次压缩:本对话将直接以「${to}」继续。`,
    /** Toast once the server accepted a compacting switch: the row in the conversation carries it from here. */
    modelSwitchInSessionStarted: (from: string, to: string): string =>
      `正在用「${from}」压缩上下文,完成后切换到「${to}」。`,
    /** Toast once the server accepted a switch that compacts nothing (the context was just compacted or switched): the model-change marker in the conversation carries it from here. */
    modelSwitchInSessionSwitching: (to: string): string => `正在切换到「${to}」。`,
    /** Toast when the switch completed inside the request (the Session had never run). */
    modelSwitchInSessionApplied: (to: string): string => `已切换到「${to}」。`,
    workspaceHere: "本机",
    /** Why a listed machine cannot be picked — shown ON its row, where the question is asked. */
    workspaceMachineWhy: {
      "no-identity": "待识别",
    },
    workspaceAuto: "临时工作区",
    /** The finder's no-folder button; `workspaceTempRule` is its tooltip while the folder it would get is unknown. */
    workspaceClear: "从临时工作区开始",
    workspaceTempRule: "在 Agent 目录的 workspaces/ 下新建一个空目录",
    workspaceDirInvalid: "目录不存在或无法访问,已回退",
    /** The Workspace finder: the modal the Workspace pickers open (workspace-finder.tsx). */
    finder: {
      choose: "选择",
      back: "后退",
      forward: "前进",
      /** Toolbar: the parent folder. */
      up: "上一级",
      refresh: "刷新",
      /** The address bar turned into a text field: its accessible name and placeholder. */
      address: "路径",
      addressPlaceholder: "输入绝对路径,或以 ~ 开头",
      /** What clicking the address bar does (also ⌘⇧G / Ctrl+Shift+G). */
      editPath: "编辑路径",
      filter: "筛选",
      showSidebar: "显示侧边栏",
      hideSidebar: "隐藏侧边栏",
      quickAccess: "常用",
      /** Windows only: the section listing the drives. */
      thisPc: "此电脑",
      /** The same section on a Mac (its volumes) or a Linux machine (the root and the mounted devices). */
      locations: "位置",
      /** A Windows drive with no label of its own, by its type, as Explorer names it; the letter follows. */
      drives: {
        drive: "本地磁盘",
        removable: "U 盘",
        network: "网络驱动器",
        optical: "CD 驱动器",
      },
      /** A Linux machine's root directory, as its file managers name it. */
      fileSystem: "文件系统",
      /** The caret before the path that lists the machine's drives or volumes: its accessible name and hint. */
      switchLocation: "切换位置",
      recent: "最近使用",
      machines: "机器",
      places: {
        desktop: "桌面",
        documents: "文档",
        downloads: "下载",
        pictures: "图片",
      },
      /** Finder's own name for Documents, used when the browsed machine is a Mac. */
      documentsMac: "文稿",
      addToQuickAccess: "添加到常用",
      removeFromQuickAccess: "从常用中移除",
      /** The + beside the Quick access heading. */
      addCurrentToQuickAccess: "将当前文件夹添加到常用",
      /** Accessible name of a Quick access row's remove button. */
      removeNamed: (name: string): string => `从常用中移除「${name}」`,
      open: "打开",
      /** Accessible name of the enter button at the end of a folder row. */
      openFolder: (name: string): string => `打开「${name}」`,
      /** The toolbar button and the context-menu row that make a folder in the folder on screen. */
      newFolder: "新建文件夹",
      /** The name box's placeholder while a new folder is being made. */
      newFolderName: "文件夹名称",
      /** The name box's accessible name and tooltip: Enter makes it, Escape cancels. */
      newFolderHint: "输入名称后按 Enter 创建,按 Esc 取消",
      /** The context-menu row that removes one folder on this server. */
      deleteFolder: "删除文件夹",
      /** Names the delete confirmation for assistive tech (the card itself has no title bar). */
      deleteFolderTitle: "删除文件夹",
      /**
       * The delete confirmation: what goes, and the rule the server enforces — only an empty
       * folder can be removed, and there is no undo (nothing is moved to a trash).
       */
      deleteFolderConfirm: (name: string): string =>
        `删除文件夹「${name}」?只能删除空文件夹,里面还有内容时服务端会拒绝,且删除不可恢复。`,
      /** The toast after one was removed. */
      folderDeleted: (name: string): string => `已删除文件夹「${name}」`,
      chooseThis: "选择此文件夹",
      chooseCurrent: "选择当前文件夹",
      copyPath: "复制路径",
      /** Accessible name of the breadcrumb trail. */
      path: "当前路径",
      columnName: "名称",
      columnModified: "修改日期",
      /** Tooltip on a file row: files are listed for context but cannot be picked. */
      fileNotSelectable: "只能选择文件夹",
      empty: "此文件夹为空",
      noMatch: (q: string): string => `没有名称包含「${q}」的项目`,
      deniedTitle: "无法读取此文件夹",
      denied: "运行服务的账户没有读取此文件夹的权限。",
      /**
       * macOS privacy protection refused the folder and this page cannot ask for it (a browser
       * tab, or another machine's listing): the process that reads it has to be allowed.
       */
      deniedMacServer:
        "macOS 阻止了对此文件夹的访问。运行服务的进程需要被放行:从终端启动的服务归该终端所有,请在「系统设置 → 隐私与安全性 → 文件与文件夹」里放行该终端(或给它完全磁盘访问权限)后重试。",
      /** The desktop app can ask: before it has (see allowAccess). */
      deniedMacAsk:
        "macOS 阻止了对此文件夹的访问。点「允许访问」向 macOS 申请,macOS 询问时选择允许。",
      /** Asked, and the folder is still refused: a packaged app. */
      deniedMacRefused:
        "系统没有放行。若「文件与文件夹」里没有 Adelie,请在「完全磁盘访问权限」里用 + 添加它,然后再试。",
      /** Asked, and the folder is still refused: a development instance, whose reads macOS charges to its terminal. */
      deniedMacRefusedDev:
        "这是未打包的开发实例:macOS 把它的文件访问算在启动它的终端名下。请在「文件与文件夹」里放行该终端(或给它完全磁盘访问权限),再试。",
      /** Has the desktop app read the folder in its own name, which is what makes macOS ask. */
      allowAccess: "允许访问",
      /** The same button while the app's read waits for the user to answer macOS. */
      allowAccessWaiting: "等待 macOS 询问…",
      /** Opens System Settings at the Privacy & Security pane the box names. */
      openSystemSettings: "打开系统设置",
      loadFailed: "无法打开此文件夹",
    },
    /** Grouping toggle of the sidebar conversation list (workspace grouping is the default) and the workspace groups. */
    groupByWorkspace: "按工作区分组",
    groupByAgent: "按智能体分组",
    groupByTime: "按时间分组",
    /** Time-mode bucket names (last day / last month / older), by last activity. */
    timeGroups: {
      day: "近一天",
      month: "近一月",
      earlier: "更早",
    },
    /** Session-list section header controls: search / list settings / mode-dependent create (具体新建的对象按分组方式决定). */
    searchSessions: "搜索会话",
    searchSessionsPlaceholder: "搜索会话…",
    searchClear: "清除搜索",
    /** Zero hits: the filter only sees already-loaded conversations, so the copy says so rather than claiming none exist. */
    searchNoMatches: "已加载的会话中无匹配",
    listSettings: "列表选项",
    groupModeSection: "分组方式",
    sortModeSection: "排序方式",
    sortManual: "手动排序",
    sortRecent: "最近更新",
    newWorkspaceEntity: "新建工作区",
    /** A Workspace group's overflow (… right of the header "+"): browse its files and remove the group from the sidebar (every Workspace); a registry-backed group also renames its alias. */
    workspaceMenu: "工作区选项",
    renameWorkspace: "重命名工作区",
    renameWorkspaceLabel: "名称",
    renameWorkspaceHint: "留空则使用目录名",
    deleteWorkspace: "删除工作区",
    /** A Workspace group's "more" menu: the dock's Files panel on that directory. */
    browseWorkspaceFiles: "打开文件浏览",
    deleteWorkspaceConfirm: (name: string) =>
      `确定移除「${name}」?不删任何东西:磁盘目录和已有会话都原样留着,只是这个工作区分组连同它的会话行先不在侧边栏显示;重新用「新建工作区」选到这个目录即可恢复。`,
    tempWorkspaces: "临时工作区",
    /** A name that only means something on another machine, written with the ssh alias that reaches it. */
    onMachine: (name: string, machine: string) => `${name} [SSH: ${machine}]`,
    /** The same mark on its own, for a row that is attributed to a machine rather than named after one. */
    machineTag: (machine: string) => `[SSH: ${machine}]`,
    newSessionInWorkspace: "在此工作区新建对话",
    draftSubtitle: "最擅长 AI 开发任务的自进化 Agent",
    /** The draft's first message did not go out: nothing was written, the text is still in the card. */
    draftSendRefused: (reason: string) => `没能发出这条消息:${reason}`,
    /**
     * A picked thinking level was refused: the control still reads the level it read before, so the
     * sentence says the pick did not take. `agent` is set where the write goes through to the
     * Agent's settings (the draft's picker), which is a wider change than this one conversation.
     */
    thinkingLevelRefused: (reason: string, forAgent?: boolean) =>
      forAgent
        ? `没能切换思考等级(同时是 Agent 的默认档,没有改动):${reason}`
        : `没能切换思考等级:${reason}`,
    /**
     * A picked permission preset (or approval mode) was refused: the button re-reads the Session and
     * therefore shows the old level again, so the sentence says the pick did not take and that the
     * Session kept what it had — the route writes nothing at all when it refuses.
     */
    permissionRefused: (reason: string) => `没能切换权限(会话仍是原来的权限):${reason}`,
    /** Second tooltip line on a shortcut row: the click fills the composer, it does not send. */
    shortcutFillHint: "点击填入输入框,可修改后自行发送",
    /** The draft screen's saved-prompt folder: prompts the user wrote and saved, stored per user on the server. */
    shortcuts: {
      folder: "我的快捷指令",
      new: "新建快捷指令",
      /**
       * Tooltip on the new-shortcut row. Unconditional, and worded to hold either way: the
       * editor opens on whatever the composer holds, which is a blank draft when it holds
       * nothing — saving what was just typed is the path this folder exists to shorten.
       */
      newFromComposer: "以输入框中的内容作为起点",
      createTitle: "新建快捷指令",
      editTitle: "编辑快捷指令",
      titleLabel: "名称",
      titleHint: (max: number) => `最多 ${max} 个字符`,
      promptLabel: "提示词",
      promptHint: (max: number) => `最多 ${max} 个字符`,
      /** Semantics behind the prompt field's "?": what the saved text does when clicked. */
      promptInfo:
        "点击这条快捷指令时,这段文字会原样填入输入框,不会自动发送;需要的 Skill 仍在输入框里自行勾选。",
      titleTooLong: (max: number) => `名称最多 ${max} 个字符`,
      promptTooLong: (max: number) => `提示词最多 ${max} 个字符`,
      deleteTitle: "删除快捷指令",
      deleteConfirm: (title: string) => `确定删除「${title}」?该快捷指令会从你的所有设备上消失。`,
    },
    sessionList: "Session",
    /** The Session list's heading, named for how the list is grouped. */
    sessionListByMode: { workspace: "工作区", agent: "智能体", time: "最近" },
    defaultSessionTitle: "新对话",
    agent: "Agent",
    model: "Model",
    workspace: "Workspace",
    approvalMode: "审批模式",
    /** The composer's permission button: one colored shield for the level, a menu of Fs / Network / More. */
    permission: {
      label: "权限",
      levels: {
        all: "完全访问",
        partial: "部分权限",
        "read-only": "只读",
        off: "关闭",
      } as Record<string, string>,
      fs: "文件系统",
      fsModes: {
        "read-only": "只读",
        "workspace-write": "仅工作区可写",
        "danger-full-access": "完全访问",
      } as Record<string, string>,
      network: "网络",
      networkModes: {
        open: "完全访问",
        local: "本地网络(仅 localhost)",
        none: "无网络",
      } as Record<string, string>,
      unsupported: "不支持",
      localUnsupported: "本机的沙盒后端不支持只允许 localhost",
      notInstalled: "未安装",
      noBackend:
        "本服务器没有安装沙盒后端,命令无法被封禁。管理员可在插件页启用适用于本平台的后端(更多…)。",
      noNetworkUnsupported: (backends?: string) =>
        `本机的沙盒只封禁文件${backends !== undefined ? `(${backends} 不隔离网络)` : ""},无法断开网络`,
      maskUnsupported: (backends?: string) =>
        `本会话要对命令隐藏屏蔽路径,但本机没有能屏蔽路径的沙盒后端${backends !== undefined ? `(${backends} 不能屏蔽路径)` : ""},每条命令都会被拒绝。管理员可在「更多…」里的沙盒卡片清空屏蔽路径。`,
      notAvailable: "不可用",
      adminOnly: "仅管理员",
      aboveCeiling: "超出了本服务器的沙盒上限:只有管理员可以给会话这么大的权限。",
      backendUnavailable: (name: string, reason: string) =>
        `沙盒后端 ${name} 已启用但未在用:${reason}。管理员可在「更多…」里的沙盒卡片处理。`,
      more: "更多…",
      approval: "审批",
      custom: "自定义",
      advancedActive: "高级设置生效中",
      advancedHint: "本会话另有屏蔽路径或只读的临时目录,来自沙盒卡片;选择预设会保留它们。",
      blocks: "封住",
      allows: "放开",
      nothing: "无",
      enforceable: "本机可以实施。",
      needsNoBackend: "不需要沙盒后端。",
      effects: {
        "write-outside-workspace": "写工作区之外",
        "write-anywhere": "写任何文件",
        network: "全部网络",
        "network-beyond-localhost": "本机 localhost 之外的网络",
        "unasked-calls": "不经询问的工具调用(每次调用先问)",
        "unasked-writes": "不经询问的写入(可能写入的调用先问)",
        "every-call": "每一次工具调用(全部拒绝)",
        "files-everywhere": "读写任何文件",
        "files-in-workspace": "写工作区之内",
        "read-files": "读取文件",
        "network-open": "完整网络",
        localhost: "本机 localhost",
        "calls-unasked": "所有工具调用,不经询问",
        "reads-unasked": "只读调用,不经询问",
      } as Record<string, string>,
    },
    /** Short description (the trigger button shows only the description, not the mode id). */
    approvalModeNames: {
      "allow-all": "全部放行",
      "deny-all": "全部拒绝",
      "read-only": "放行只读",
      "always-ask": "总是询问",
    } as Record<string, string>,
    approvalModes: {
      "allow-all": "全部放行(allow-all)",
      "deny-all": "全部拒绝(deny-all)",
      "read-only": "放行只读(read-only)",
      "always-ask": "总是询问(always-ask)",
    } as Record<string, string>,
    statusRunning: "运行中",
    statusCompacting: "压缩中",
    /** Settled Session that finished since the user last opened it (the unread dot; a Session already read shows no glyph, so it needs no label). */
    statusCompletedUnread: "运行完毕,未读",
    /** The background-task mark on a session row and the chat header's count: background processes plus background subagents still running. */
    backgroundTasks: (n: number) => `${n} 个后台任务`,
    /** The session row's alarm clock: at least one enabled scheduled task is bound to this conversation (a paused one draws no mark). */
    sessionScheduled: "有待触发的定时任务",
    /** The tool row's marker for the ONE call whose work went to the background — launched with `run_in_background`, or moved there by the user — rather than for a count. Bracketed, like the row's other outcome markers. */
    backgroundCall: "[后台任务]",
    /** The tool row's inline text action, shown while the call is executing (also its accessible name). */
    sendToBackground: "转入后台执行",
    /** Its tooltip: what the click does to the call and to the conversation. */
    sendToBackgroundHint: "把这次调用转入后台执行,对话继续进行;它结束时会以后台任务通知送回。",
    pendingApprovals: (n: number) => `${n} 个待审批`,
    jumpToLatest: "回到最新消息",
    /** Top-of-stream affordance while the previous history window is being fetched (scroll-up backfill). */
    loadingEarlier: "正在加载更早的对话…",
    /** Top-of-stream affordance after a backfill failure: click to retry fetching the previous window. */
    loadEarlierRetry: "更早的对话加载失败,点击重试",
    /** Top-of-stream marker once the loaded history reaches the very beginning (shown only after a backfill happened). */
    historyBeginning: "已是对话开头",
    /** Conversation minimap (tick rail over the stream's left gutter): rail aria-label. */
    outlineTitle: "对话索引",
    /** Tick accessible name: turn number + the question (or the no-text placeholder). */
    outlineTickLabel: (n: number, question: string) => `第 ${n} 轮:${question}`,
    /** Entry label when the prompt had no text body (image / attachment-only message). */
    outlineNoText: "(图片或附件)",
    /** Answer-preview placeholder while the latest turn is still running with no reply text yet. */
    outlineAnswering: "回答生成中…",
    inputPlaceholder: "输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",
    inputPlaceholderShort: "输入消息…",
    /** Placeholder while a Task is running (mid-run steering): the message is delivered between turns with the next request. */
    steerPlaceholder: "给运行中的 Agent 留言,随下一轮对话送达",
    steerPlaceholderShort: "给运行中的 Agent 留言…",
    steerSend: "发送给运行中的 Agent",
    /** Queued hint shown after a successful steer, until the steering message appears in the stream. */
    steerQueuedIndicator: "插话已排队,将随下一轮送达",
    /** Same hint, with the queued message's content (from the server's undelivered-steering mirror; survives reloads). */
    steerQueuedItem: (content: string) => `插话已排队,将随下一轮送达:${content}`,
    /** Label of the [user_steering] chip (a mid-run user message delivered between turns). */
    userSteering: "用户插话",
    /** Mid-run send-mode setting: steer (delivered mid-run) vs follow-up (queued until the run ends). */
    steerModeLabel: "运行中发送方式",
    steerModeSteer: "插话",
    steerModeSteerHint: "立即插话:随下一轮对话送达运行中的 Agent",
    steerModeFollowUp: "排队",
    steerModeFollowUpHint: "排队跟进:本轮结束后自动作为新消息发送",
    followUpPlaceholder: "排队为下一条消息,本轮结束后自动发送",
    followUpPlaceholderShort: "排队为下一条消息…",
    followUpSend: "排队为下一条消息",
    /** Server-side queued follow-up count (auto-sent once the current run finishes). */
    followUpQueuedChip: (n: number) => `${n} 条跟进消息已排队,本轮结束后自动发送`,
    /** One queued follow-up's hint line, with its content (per-entry variant of followUpQueuedChip). */
    followUpQueuedItem: (content: string) => `跟进消息已排队,本轮结束后自动发送:${content}`,
    /** Accessible name of the recall control on a queued steering / follow-up line — it is icon-only (a curved-back arrow), so this is what names it for screen readers (#287). */
    recallQueued: "撤回",
    /** Its tooltip: what the icon does, spelled out. */
    recallQueuedTitle: "撤回到输入框,编辑后重新发送",
    send: "发送",
    stop: "停止",
    compact: "压缩上下文",
    approve: "允许",
    deny: "拒绝",
    decisionAllow: "已批准",
    decisionDeny: "已拒绝",
    decisionManual: "手动",
    decisionAuto: "自动",
    decisionPolicy: "策略",
    thinking: "思考",
    subagent: "子会话",
    subagentRunning: "运行中",
    /**
     * Abort banner (user interruptions only). The cause localizes from `errorCode`;
     * `errorMessage` (raw, untranslatable) rides verbatim. A legacy Trace without a code
     * renders its English `reason` prose as-is.
     */
    aborted: (item?: { errorCode?: string; errorMessage?: string; reason?: string }) => {
      const cause =
        item?.errorCode === "user_abort"
          ? "用户中断"
          : item?.errorCode === "backoff_interrupted"
            ? "重试等待中被中断"
            : item?.errorCode === "compaction_interrupted"
              ? "压缩过程中被中断"
              : (item?.errorCode ?? item?.reason ?? "");
      const text = cause ? `${cause}${item?.errorMessage ? `:${item.errorMessage}` : ""}` : "";
      return `[已中断]${text ? `:${text}` : ""}`;
    },
    /**
     * Reconnect hint line; `secondsLeft` (waiting state only) switches to the live-countdown
     * wording. `retryable` is the live status; the finer spellings only appear when
     * replaying Traces written before the stop-reason convergence.
     */
    reconnect: (
      status: "retryable" | "failed" | "timeout" | "malformed",
      state: "waiting" | "retried" | "gaveUp",
      attempt: number,
      secondsLeft?: number,
      errorMessage?: string,
      errorCode?: string,
    ) => {
      // The live protocol carries the classified cause on error_code; the legacy status
      // spellings (failed/timeout/malformed) say the same thing for pre-convergence Traces.
      const kind = errorCode ?? status;
      const cause =
        kind === "timeout"
          ? "连接超时或网络中断"
          : kind === "malformed"
            ? "响应不完整或无法解析"
            : kind === "network"
              ? "网络或服务暂时不可用"
              : kind === "failed"
                ? "模型服务返回错误"
                : "请求失败";
      const action =
        state === "gaveUp"
          ? `第 ${attempt} 次尝试后放弃${errorMessage ? `:${errorMessage}` : ""}`
          : state === "retried"
            ? `已发起第 ${attempt} 次重试`
            : secondsLeft !== undefined
              ? `第 ${attempt} 次重试,${secondsLeft} 秒后发起…`
              : `正在发起第 ${attempt} 次重试…`;
      return `[重试] ${cause},${action}`;
    },
    /** Run-ending LLM failure banner (request_end status fatal); the provider's error text rides verbatim. */
    llmError: (errorMessage?: string) =>
      `[错误]:模型请求错误${errorMessage ? `:${errorMessage}` : ""}`,
    /** "Retry now" on the reconnect countdown (skips the remaining backoff wait). */
    reconnectRetryNow: "立即重试",
    /** "Give up" on the reconnect countdown (the ordinary session abort). */
    reconnectGiveUp: "放弃",
    imageAlt: "用户上传的图片",
    toolImageAlt: "工具输出的图片",
    /** Accessible name of a video the person sent (a `<video>` has no `alt`; this is its label). */
    videoLabel: "用户上传的视频",
    imagesAsPathHint:
      "当前模型不支持直接查看图片:发送时图片将保存到会话临时目录,以文件路径转交(模型经 read_file 查看)",
    videosAsPathHint:
      "当前模型不支持直接观看视频:发送时视频将保存到会话临时目录,以文件路径转交(模型经 read_file 查看)",
    infoPanel: "Session 信息",
    sessionStats: "统计",
    /** Info-dropdown Session id row: the id itself is a click-to-copy button. */
    sessionIdLabel: "Session id",
    copySessionId: "复制 Session ID",
    /** Info-dropdown list of background processes the conversation started, and its per-row actions (Stop on running rows, Remove on exited ones). */
    processList: "会话进程",
    processStop: "停止",
    processExited: "已退出",
    processRemove: "移除",
    /** Remove button tooltip: removal also drops the output captured from that process. */
    processRemoveHint: "移除该条目——该进程已捕获的输出也会一并丢弃",
    /** The list heading's text action: removes every exited entry at once; its hint says the captured output goes too. */
    processClearExited: "清除已退出",
    processClearExitedHint: "清除所有已退出的进程——它们已捕获的输出也会一并丢弃",
    statTokens: "Token 累计",
    /** Info-dropdown stats list: the tokens bullet's label and its cache-hit-rate parenthetical (rate = cacheRead ÷ all input, e.g. "68%"). */
    statTotalTokens: "总 Token",
    statCacheHit: (pct: string) => `缓存命中率 ${pct}`,
    statElapsed: "用时",
    /**
     * The elapsed time's two measured components, shown in parentheses after it. They may
     * overlap (a background tool runs while the model decodes) and may leave a remainder
     * (approval waits, harness overhead), so this reads as two measurements, never as a split.
     */
    statElapsedSplit: (apiMs: string, toolMs: string): string => `API ${apiMs},工具 ${toolMs}`,
    statInput: "输入 tokens",
    statCached: "已缓存",
    statOutput: "输出 tokens",
    statTps: "输出 TPS",
    /** Copied-stats-line parenthesis wrappers around the cached amount (fullwidth for zh typography). */
    statParenOpen: "(",
    statParenClose: ")",
    noSessions: "还没有 Session",
    /** The routed conversation is on a machine with no connection held: not gone, just out of reach from here. */
    sessionOnOfflineMachine: (machine: string) => `这个对话在 ${machine} 上,当前没有连接。`,
    sessionOnOfflineMachineUnknown: "这个对话在某台机器上,当前没有连接。",
    sessionOfflineHint: "连接恢复后会自动打开。",
    /**
     * The stalled-stream strip above the composer (features/chat/stream-stalled-banner.tsx):
     * the live stream is not delivering, so the page refetches the conversation on a timer.
     * It names what the page is doing, not which layer failed — the reader's question is
     * whether the conversation still works.
     */
    streamStalled: "实时连接已断开,正在定时刷新",
    emptyStream: "发送一条消息开始对话",
    historyLoadFailed: "历史消息加载失败",
    statsLabel: "统计信息",
    removeImage: "移除图片",
    removeVideo: "移除视频",
    openAgents: "智能体面板",
    workspacePanel: "文件浏览",
    /** File summary card at the end of a message (Codex-style): title, inline preview action, and collapsed row. */
    filesInMessage: (n: number) => `${n} 个文件`,
    imagesInMessage: (n: number) => `${n} 张图片`,
    videosInMessage: (n: number) => `${n} 个视频`,
    openPreview: "点击预览",
    showMoreFiles: (n: number) => `显示其余 ${n} 个文件`,
    showLess: "收起",
    /**
     * What a conversation can do with a picture a reply points at, once the picture is open in the
     * lightbox: the two buttons' words, and the instruction each one carries. The instruction is
     * the message itself — the App has no image endpoint of its own, so an action is a sentence to
     * the Agent rather than a request the browser makes (see lib/image-actions.ts). `path` is the
     * picture as the reply named it, relative to the Workspace, and the Skill is named so the turn
     * does not depend on the model reaching for it by itself.
     */
    imageAction: {
      layers: "拆图层",
      redraw: "照这张改一版",
      layersPrompt: (path: string) =>
        `用 seedream 技能把工作区里的 \`${path}\` 拆成图层(--layers),底图和每层透明 PNG 都写回工作区。`,
      redrawPrompt: (path: string) =>
        `用 seedream 技能,以工作区里的 \`${path}\` 作为参考图改一版:`,
    },
    /** Memory-change card below the file summary and the Memory side panel: titles, scope/op tooltips, collapsed row. */
    memoryChangesTitle: (n: number) => `${n} 条记忆更新`,
    memoryScopeWorkspace: (key: string) => `工作区记忆(${key})`,
    memoryOpWrite: "写入",
    memoryOpEdit: "编辑",
    memoryViewTitle: "记忆",
    memoryChangedMark: "本次对话已更改",
    memoryContentUnavailable: "无法加载内容(文件可能已被移动或删除)",
    memoryRowOpen: "查看内容",
    /** The memory-change card header's text action: opens the Memory panel on its list (a visible label rather than a second brain glyph beside the card's own). */
    memoryOpenList: "打开记忆列表",
    memoryBack: "返回列表",
    memoryEmptyAll: "还没有任何记忆——在对话里说「记住……」即可让 agent 保存",
    /** Visible label on the Memory panel's header link (not a tooltip-only glyph): says what the click does and where it lands. */
    openAgentMemory: "在 Agent 设置中管理",
    memoryShowMore: (n: number) => `显示其余 ${n} 条`,
    /** Sidebar group pagination (#139): the pager's step buttons and the "2/5" readout's accessible name. */
    prevGroupPage: "上一页分组",
    nextGroupPage: "下一页分组",
    groupPagePosition: (page: number, total: number) => `第 ${page} 页,共 ${total} 页`,
    contextUsage: "上下文占用",
    contextUnknown: "上下文占用:压缩后待下次请求回报",
    /** Context ring -> composition panel: the trigger's accessible name, the six part labels, the tool ranking, and the panel's empty / failed states. */
    contextComposition: "上下文构成",
    contextPartSystemPrompt: "系统提示词",
    contextPartToolDefs: "工具定义",
    contextPartUserMessages: "用户消息",
    contextPartAssistantMessages: "模型消息",
    contextPartToolRequests: "工具请求",
    contextPartToolResults: "工具结果",
    contextTopTools: "工具用量 Top 5",
    /** Under the bar: the model window the bar is scaled to. */
    contextWindowIs: (n: string): string => `最大上下文 ${n}`,
    contextTopToolsHint: "按每个工具的调用与结果所占上下文排序(工具定义计入「工具定义」一项)",
    contextTopFiles: "文件用量 Top 5",
    contextTopFilesHint:
      "按每个文件经 read_file / edit_file / write_file 的调用与结果所占上下文排序(悬停显示完整路径)",
    /** The ranking switch: the group's accessible name, its two buttons, and the Files view's empty state. */
    contextRankLabel: "切换排行",
    contextRankTools: "工具",
    contextRankFiles: "文件",
    contextNoFileTraffic: "本轮上下文没有文件读写",
    contextUnknownHint: "刚压缩过,占用待下次请求回报,届时才能给出构成",
    contextBreakdownEmpty: "当前上下文还没有可统计的内容",
    contextBreakdownFailed: "读取上下文构成失败",
    /** The dashed cutter on the panel's bar: its accessible name, and its tooltip naming the threshold it stands on. */
    contextThresholdCutter: "压缩阈值",
    contextThresholdHover: (n: string): string => `压缩阈值 ${n}(拖动可调整)`,
    /** Tooltip of the hatched stretch of the bar past the cutter: room the model has, unusable before compaction fires. */
    contextBeyondThreshold: "压缩阈值之上的空间:压缩会先触发,这部分暂时用不到",
    /** Confirmation for a dragged (or arrowed) threshold: dialog name, body (agent name + the threshold being replaced), the editable field and its rejection, the note when the model window will cut the typed value down, and the toast on success. */
    contextThresholdTitle: "修改压缩阈值",
    contextThresholdBody: (agentName: string, old: string): string =>
      `把 ${agentName} 的压缩阈值从 ${old} 改为下面的值?立即生效,包括正在进行的对话。`,
    contextThresholdField: "压缩阈值(token)",
    contextThresholdInvalid: "必须是大于 0 的整数",
    contextThresholdCapped: (n: string): string => `超出模型窗口,实际生效的阈值是 ${n}`,
    contextThresholdSaved: (n: string): string => `压缩阈值已改为 ${n},立即生效`,
    /** Refused write, drawn inside the confirmation that asked: n = the threshold that was asked for, reason = the server's words (or ours). */
    contextThresholdRefused: (n: string, reason: string): string =>
      `压缩阈值没有改成 ${n},Agent 上仍然是原来的值:${reason}`,
    /** Composer notice: the model's window is below the Agent's configured compaction threshold; n = window, m = threshold. */
    contextWindowUnderThreshold: (n: string, m: string): string =>
      `当前模型的上下文窗口 ${n} 小于本 Agent 的压缩阈值 ${m},压缩实际会在窗口边缘触发。拖动上下文面板里的虚线或在 Agent 设置中把阈值调到窗口以下,立即生效。`,
    contextWindowUnderThresholdAction: "打开 Agent 设置",
    contextWindowUnderThresholdDismiss: "忽略",
    slashHint: "输入 / 使用命令",
    /** `/agent` handoff: command description, picker title, search box, no-match hint, and the staged target's description and remove button. */
    switchAgent: "交给其他 Agent,发送时开启新会话",
    switchAgentTitle: "选择 Agent",
    agentSearchPlaceholder: "搜索 Agent:id / 名称",
    agentsNoMatch: "没有匹配的 Agent",
    handoffTargetTitle: (agent: string) => `发送后交接给 ${agent}`,
    handoffRemove: "移除交接目标",
    /** Skill multi-select dropdown (input toolbar): button text, search box, empty state, and no-match hint. */
    skillsSelect: "技能",
    skillRemove: "移除技能",
    skillsSearchPlaceholder: "搜索技能",
    skillsNoMatch: "没有匹配的技能",
    skillsEmptyHint: "暂无已装技能,去技能库添加",
    /** Auto-generated invocation text when skills are selected and the body is empty (wrapped in [use_skills] before sending). */
    skillsAutoMessage: (names: string[]): string => `使用 ${names.join("、")} 技能`,
    handoffFrom: (agent: string) => `由 ${agent} 的对话交接而来`,
    handoffBack: (title?: string) => (title ? `回到原对话:${title}` : "回到原对话"),
    /** `/model` handoff: command description, picker title, the staged target's description and remove button, the origin banner, and the empty-body auto message. Every surface says that it opens a NEW conversation and leaves this one as it is — switching inside this conversation is the toolbar's model picker (`modelSwitchInSession*`). */
    switchModel: "换模型开新会话:发送时用所选模型新开一个会话延续本对话,本会话保持不变",
    switchModelTitle: "换模型开新会话",
    modelSwitchTargetTitle: (model: string) =>
      `发送后用 ${model} 新开一个会话延续本对话,本会话保持不变`,
    modelSwitchRemove: "移除换模型目标",
    /** Why Send is disabled with a model switch staged: the fork branches off a Trace this Session is still writing. */
    modelSwitchBusyHint: "本轮结束后才能换模型开新会话:新会话要从当前会话的记录接续",
    modelSwitchFrom: (prevModel?: string) =>
      prevModel
        ? `换模型新开的会话(原模型 ${prevModel}),延续原会话`
        : "换模型新开的会话,延续原会话",
    /** First message body auto-sent when `/model` is staged and the composer is empty (same convention as skillsAutoMessage). */
    modelSwitchAutoMessage: "换用新模型继续这段对话",
    scheduledFrom: (name: string) => `由定时任务「${name}」触发`,
    /** `[org_trigger]` banner: what the organization scheduler sent this desk or ticket session, folded into one line. */
    orgTriggerFrom: (org: string): string => `由组织「${org}」触发`,
    orgTriggerKinds: {
      init: "初始化",
      event: "日程",
      mention: "频道 @",
      ticket_notice: "工单通知",
      ticket_work: "工单任务",
    } as Record<string, string>,
    orgTriggerBudget: (budget: string): string => `预算 ${budget}`,
    /** One-line notice of a `[background_task_done]` harness message (run_in_background completion): the collapsed row's whole label. */
    backgroundDone: (
      kind: "command" | "subagent",
      status: "completed" | "failed" | "stopped",
    ): string => {
      const what = kind === "command" ? "后台命令" : "后台任务";
      if (status === "stopped") return `${what}已停止`;
      return status === "completed" ? `${what}完成` : `${what}失败`;
    },
    emptyGreeting: "开始一段新对话",
    /** Unified step-row titles (same header idiom as workRunning/workDone). */
    mcpConnectTitle: "MCP 连接",
    mcpServerList: (servers: string[]): string => servers.join("、"),
    /** One-line result detail: tool count, plus the NAMES of failed servers (reasons live in the expanded server groups). */
    mcpConnectResult: (toolCount: number, failed: string[]): string => {
      const parts: string[] = [];
      if (toolCount > 0 || failed.length === 0) parts.push(`发现 ${toolCount} 个工具`);
      if (failed.length > 0) parts.push(`不可用:${failed.join("、")}`);
      return parts.join(";");
    },
    /** Per-server group row meta inside the expanded connect row. */
    mcpToolsCount: (n: number): string => `${n} 个工具`,
    mcpServerFailed: "连接失败",
    mcpConnectAborted: "已中断,下次发送时重新连接",
    /** The bare mode word — the Trace view's round badge, the failed row's title, and the stem of the two state titles below — so a `discard` is never announced as compaction: it clears the context rather than compacting it. */
    compactionTitle: (mode: string): string => (mode === "discard" ? "清空" : "压缩"),
    /** The row's title doubles as its status, the work-group header's idiom (`workRunning` / `workDone`): 压缩中 / 清空中 while the step runs, 压缩完毕 / 清空完毕 once it settles. With mode and state both in the title nothing is left for a detail line on either side — a `summarize` shows its summary in its own expandable body — so only `compactionFailed` keeps the detail slot, carrying the one thing a title cannot. */
    compactionRunning: (mode: string): string => (mode === "discard" ? "清空中" : "压缩中"),
    compactionDone: (mode: string): string => (mode === "discard" ? "清空完毕" : "压缩完毕"),
    /** The summarize row's second body section (the first reuses `thinking`): the summary the compaction request wrote. */
    compactionResult: "压缩结果",
    /** The marker between two contexts on different models (an in-session model switch), naming both by model id. */
    modelChanged: (from: string, to: string): string => `模型已切换 · ${from} → ${to}`,
    compactionFailed: (status: string, errorMessage?: string): string => {
      if (status === "aborted") return "已中断,保留当前上下文";
      const detail = errorMessage !== undefined ? `(${errorMessage})` : "";
      // retryable = 本次放弃、下次触发自动重试;fatal = 需先修复模型配置或凭据。旧 Trace 两者都拼作 "failed"。
      if (status === "retryable") return `失败${detail},保留当前上下文,下次触发时重试`;
      if (status === "fatal") return `失败${detail},保留当前上下文,需修复模型配置后重试`;
      return `失败${detail},保留当前上下文`;
    },
    unknownTool: "(未知工具)",
    /**
     * Short display names for the built-in tools, keyed by the name the model calls them
     * by. The tool-call card shows these while the Appearance switch is on; a tool absent
     * from this table (MCP tools, names only older Traces carry) renders as itself.
     */
    toolAliases: {
      read_file: "读取",
      write_file: "写入",
      edit_file: "编辑",
      exec_command: "执行命令",
      input_command: "跟进命令",
      run_subagent: "子智能体",
      input_subagent: "交流",
    } as Record<string, string>,
    workRunning: "运行中",
    workDone: "运行完毕",
    workGroupSteps: (n: number) => `${n} 步`,
    approvalWaiting: "待审批",
    copyCode: "复制代码",
    copyReply: "复制回复",
    /** The reply again, with the Markdown taken out — for pasting where `##` and `**` would show. */
    copyReplyPlain: "复制纯文本",
    forkSession: "从这里分叉对话",
    forkSessionConfirmBody: "将把这段对话(截至这条回复)复制为一个新对话,原对话保持不变。",
    forkSessionConfirmAction: "分叉",
    forkSessionFailed: "无法定位这条回复,请刷新后重试。",
    copyMessage: "复制消息",
    deleteSession: "删除对话",
    renameSession: "重命名对话",
    renameSessionLabel: "标题",
    deleteSessionConfirm: (title: string) =>
      `确定删除「${title}」?该对话的消息与 Trace 将被移除,且不可恢复。`,
    /** Parked draft conversations (unsent new chats living in the sidebar list — see draft-sessions.ts). */
    draftGroup: "草稿",
    draftUntitled: "(无标题草稿)",
    deleteDraft: "删除草稿",
    deleteDraftConfirm: (title: string) => `确定删除草稿「${title}」?未发送的内容将被丢弃。`,
    archiveSession: "归档",
    unarchiveSession: "取消归档",
    /**
     * Batch processing on the conversation list: the header control beside 搜索会话 turns every
     * row into a picker, the bar above the list acts on the ticked ones, and leaving the mode
     * drops the ticks. (Same shape as the requirement box's batch bar.)
     */
    batchSelect: "批量处理",
    batchSelectRow: (title: string) => `选中「${title}」`,
    batchCount: (n: number) => `已选 ${n} 条`,
    batchArchive: "批量归档",
    batchUnarchive: "批量取消归档",
    batchDelete: "批量删除",
    batchClear: "取消选择",
    batchArchiveDone: (n: number) => `已归档 ${n} 个对话`,
    batchUnarchiveDone: (n: number) => `已取消归档 ${n} 个对话`,
    /**
     * 批量归档 / 批量取消归档被拒(全部或一部分):几个没改成,然后是服务端自己说的话。归档与取消归档没有
     * 确认卡片,因此这句话留在它们的按钮所在的那条栏目里 —— 留下来的勾选就是重试的对象。
     */
    batchArchiveRefused: (n: number, reason: string) => `还有 ${n} 个对话没有归档:${reason}`,
    batchUnarchiveRefused: (n: number, reason: string) => `还有 ${n} 个对话没有取消归档:${reason}`,
    batchDeleteTitle: "删除选中的对话",
    batchDeleteConfirm: (n: number) =>
      `确定删除选中的 ${n} 个对话?其消息与 Trace 将被移除,且不可恢复。`,
    /**
     * A batch delete the server refused (wholly or in part): how many of the ticked conversations
     * did not go, then the server's words. The rest of the batch did land and has already left the
     * list, so the card counts only what a retry would still act on.
     */
    batchDeleteRefused: (n: number, reason: string) => `还有 ${n} 个对话没有删除:${reason}`,
    /** Per-row ellipsis overflow menu (pin / rename / archive / delete live inside it) and the row-level pin. */
    pinSession: "置顶",
    unpinSession: "取消置顶",
    pinnedSession: "已置顶",
    /** The hover ellipsis button that opens the row's full context menu. */
    moreActions: "更多",
    /** Sidebar group "reveal/load next page" row (display cap + server paging). */
    loadMore: "更多",
    /** Per-group reveal row: n = conversations THIS group still hides (one click reveals/loads one page more). */
    expandRestSessions: (n: number) => `展开其余 ${n} 个对话`,
    /** Time mode's whole-list paging row: its buckets span every Agent, so one row below them fetches the next page rather than each bucket claiming to. */
    loadMoreSessions: "加载更多会话",
    /** Collapsed sidebar folders inside a group (lazy-loaded); the count is the group's exact server share. */
    folderGroups: {
      background: (n: number) => `后台会话(${n})`,
      archived: (n: number) => `已归档(${n})`,
    },
    /** A Background row's source mark: the program that opened the Session, as its tooltip and hidden text. */
    sessionSource: {
      api: "API",
      schedule: "定时任务",
      subagent: "子智能体",
      cli: "CLI",
    },
    /**
     * Tooltip of a folder-only group's header — a group with no active conversation of its
     * own, only rows inside its folders (it renders collapsed and sorts last). `n` is what
     * those folders hold, which is also the count the dimmed header shows; the Workspace path
     * follows where the header has one, since this sentence replaces the tooltip that carried it.
     */
    folderOnlyGroup: (n: number, path?: string) =>
      `仅有折叠任务:${n} 个会话${path ? `(${path})` : ""}`,
    skillsBanner: (names: string[]): string => `使用技能:${names.join("、")}`,
    /** Attached-file notice above a user message (file names only; the paths stay in the Trace). */
    attachedFilesBanner: (names: string[]): string => `附加文件:${names.join("、")}`,
    /** Composer "+" extension menu (image upload, video upload, file attachment, goal mode) and the goal chip. */
    plusMenu: "更多输入方式",
    uploadImage: "上传图片",
    uploadImageDesc: "为本条消息附加图片",
    uploadVideo: "上传视频",
    uploadVideoDesc: "为本条消息附加视频",
    uploadFile: "上传文件",
    uploadFileDesc: "文件存入会话临时目录,模型按路径读取",
    /**
     * The composer's microphone, beside the "+": `dictate` starts a recording, `dictateStop`
     * ends it and transcribes. The two in-flight labels say which half is running — a recording
     * nobody has ended and a recording being transcribed look alike otherwise, and only one of
     * them needs the user to do something.
     */
    dictate: "语音输入",
    dictateStop: "结束录音并识别",
    dictating: "正在录音",
    transcribing: "正在识别…",
    /** A recording that came back as nothing, said where the draft is rather than as a toast. */
    dictateHeardNothing: "没有听清,请再说一次。",
    /**
     * The microphone could not be asked for at all. The browser exposes one only on an origin it
     * calls secure, and an http address that is not localhost is not one — so this is not a
     * permission the user can go and grant, and the line says so rather than sending them off to
     * look for a prompt that will never appear. `dictateInsecureHelp` is the way out, on hover.
     */
    dictateInsecure:
      "这个地址(http 的非本机地址)拿不到麦克风:浏览器只在 https 或 localhost 下才给。",
    dictateInsecureHelp:
      "浏览器把 http 的非本机地址当作「不安全上下文」,在那里 navigator.mediaDevices 根本不存在——" +
      "不是你没授权,是它连权限框都不会弹。三条出路:① 用桌面版 Adelie,它跑在 localhost 上;" +
      "② 让 Adelie 走 https;③ 临时把这个地址加进 " +
      "chrome://flags/#unsafely-treat-insecure-origin-as-secure,重启浏览器后生效。",
    /** This browser has no capture support at all. */
    dictateUnsupported: "这个浏览器不支持网页录音,换一个浏览器再试。",
    /** Denied earlier: undoing that is a click in the address bar, not in this page. */
    dictateDenied: "浏览器里的麦克风权限是「拒绝」:点地址栏左边的图标改成「允许」,再点一次。",
    /** No capture device on this machine. */
    dictateNoDevice: "没有找到可用的麦克风设备。",
    /** A device exists but another program is holding it. */
    dictateBusy: "麦克风被别的程序占着,关掉那个程序再试。",
    /** The catch-all: a refusal this product has no name for, said without blaming the user. */
    dictateUnavailable: "无法使用麦克风,请再试一次。",
    removeFile: "移除文件",
    /**
     * Toast for a picked file rejected before reading. The limit is admin-settable and differs
     * between file attachments and inline images, so it is passed in rather than written here.
     */
    attachmentTooLarge: (name: string, limitMb: number): string =>
      `${name} 超过 ${limitMb}MB 上限,未添加。`,
    /** Overlay covering the chat area while files are dragged over it (drag-and-drop upload). */
    dropFilesTitle: "松开以添加附件",
    dropFilesDesc: "图片、视频与文件将添加到输入框",
    /** Toast when non-image, non-video files are dropped in goal mode (the objective carries images and videos only). */
    dropFilesGoalHint: "目标模式仅支持附加图片与视频,文件未添加。",
    /** A paste too long for the text box, attached as a text file instead. */
    longPasteAttached: (name: string): string => `粘贴的文本较长,已作为附件 ${name} 添加。`,
    goalMode: "目标模式",
    goalModeDesc: "循环运行直至目标完成",
    goalBudgetLabel: "Token 预算",
    goalBudgetUnlimited: "预算不限",
    goalBudgetValue: (value: string): string => `预算 ${value}`,
    goalBudgetPlaceholder: "例如 500k",
    goalBudgetHint: "支持 k/m 后缀;留空表示预算不限",
    goalBudgetInvalid: "无效预算:应为正数,可带 k/m 后缀(500k、2m)",
    goalBudgetSave: "保存预算",
    goalRemove: "退出目标模式",
    /** Label of the collapsed card a harness-injected user message renders as (a stop hook's continue, a goal round's protocol, a user_prompt hook's expansion). */
    harnessInjected: "由 harness 注入",
    goalProgress: (rounds: number, tokens: string): string => `第 ${rounds} 轮 · tokens ${tokens}`,
    goalStatus: {
      active: "进行中",
      complete: "已完成",
      blocked: "受阻",
      budget_limited: "预算耗尽",
      aborted: "已中断",
    } as Record<string, string>,
    /**
     * The conversation's menu for a web link: a secondary click on it, or Shift+F10 / the Menu
     * key while it has focus. The built-in browser's row shows only in the desktop app with the
     * browser available; the external row names the system browser there, a new tab elsewhere.
     */
    linkMenu: {
      openInBuiltinBrowser: "在内置浏览器中打开",
      openExternal: "在系统浏览器中打开",
      openInNewTab: "在新标签页中打开",
      copyLink: "复制链接地址",
    },
  },

  /** Feishu-channel strings of the messaging binding editor (channel-neutral ones live under `messaging`). */
  feishu: {
    /** The what-binding-does FAQ fold's body (this channel's flavor). */
    intro:
      "绑定后,发给飞书机器人的消息会进入本对话,AI 的回复会以纯文本发回飞书。需要一个开通了机器人能力、订阅了接收消息事件(长连接方式)的飞书自建应用。",
    appId: "App ID",
    appSecret: "App Secret",
    /** Shown while a saved secret exists: submitting an empty field keeps it. */
    appSecretKeepHint: "留空保持已保存的 App Secret 不变",
    /** The stored-secret row's clear checkbox (the models-page clear idiom). */
    clearSecret: "清除已存 App Secret",
    baseDomain: "API 域名",
    baseDomainHint: "飞书为 https://open.feishu.cn,Lark 为 https://open.larksuite.com",
    invalidDomain: "域名需为 http(s):// 地址",
    /** Why "send test message" is disabled before the bot has ever been messaged. */
    testMessageNoChat: "先在飞书中给机器人发一条消息,机器人才知道要发到哪个会话",
    /** The setup FAQ fold's steps. */
    setupSteps: [
      "在飞书开发者后台创建一个企业自建应用",
      "为应用开通机器人能力",
      "订阅「接收消息」事件,事件订阅方式选择「长连接」",
      "在「凭证与基础信息」页取得 App ID 与 App Secret,填入上方表单",
      "发布应用版本并通过审核,然后在飞书中给机器人发一条消息",
    ],
  },

  /** Telegram-channel strings of the messaging binding editor (channel-neutral ones live under `messaging`). */
  telegram: {
    /** The what-binding-does FAQ fold's body (this channel's flavor). */
    intro:
      "绑定后,发给 Telegram 机器人的消息会进入本对话,AI 的回复会以纯文本发回 Telegram。用 @BotFather 创建机器人并粘贴其 Bot Token 即可,无需公网地址。",
    botToken: "Bot Token",
    /** Shown while a saved token exists: submitting an empty field keeps it. */
    botTokenKeepHint: "留空保持已保存的 Bot Token 不变",
    /** The stored-token row's clear checkbox (the models-page clear idiom). */
    clearToken: "清除已存 Bot Token",
    /**
     * The Bot Token field's corner link. Telegram has no developer console — the token is
     * issued by @BotFather inside the app — so this channel names the destination instead
     * of borrowing the shared "open developer console" label.
     */
    openBotFather: "打开 @BotFather",
    invalidToken: "Bot Token 形如「数字:密钥」,由 @BotFather 签发",
    /** Why "send test message" is disabled before the bot has ever been messaged. */
    testMessageNoChat: "先在 Telegram 中给机器人发一条消息,机器人才知道要发到哪个会话",
    /** The setup FAQ fold's steps. */
    setupSteps: [
      "在 Telegram 中打开 @BotFather,发送 /newbot 创建机器人",
      "按提示取名后,复制 @BotFather 返回的 Bot Token,填入上方表单",
      "在 Telegram 中找到这个机器人,给它发一条消息",
    ],
  },

  /** QQ-channel strings of the messaging binding editor (channel-neutral ones live under `messaging`). */
  qq: {
    /** The what-binding-does FAQ fold's body (this channel's flavor). */
    intro:
      "绑定后,在 QQ 中发给机器人的消息会进入本对话,AI 的回复会发回 QQ。需要在 QQ 开放平台创建一个机器人,事件订阅方式选择 WebSocket,无需公网地址。",
    appId: "App ID",
    appSecret: "App Secret",
    /** Shown while a saved secret exists: submitting an empty field keeps it. */
    appSecretKeepHint: "留空保持已保存的 App Secret 不变",
    /** The stored-secret row's clear checkbox (the models-page clear idiom). */
    clearSecret: "清除已存 App Secret",
    /** Why "send test message" is disabled before the bot has ever been messaged. */
    testMessageNoChat: "先在 QQ 中给机器人发一条消息,机器人才知道要发到哪个会话",
    /**
     * The rule that shapes this whole channel, stated where it is first needed rather than
     * left for the user to infer from a reply that never arrives.
     */
    repliesOnly:
      "QQ 只允许机器人回复你刚发出的消息,不允许主动发消息。因此:在网页端发起的对话不会同步到 QQ;距离你上一条 QQ 消息过去几分钟后,回复也发不出去。想继续对话,在 QQ 里再发一条消息即可。",
    /** The passive-reply budget, in the terms a user experiences it. */
    replyBudget:
      "同一条 QQ 消息最多能收到 4 条回复(群聊 5 条)。一次运行产生的消息更多时,最后一条会把余下内容合并发出——内容不会丢失,只是合并成一条。",
    /** Scan-to-connect: the button, and the states it moves through. */
    scanStart: "扫码连接",
    scanStarting: "生成二维码…",
    /** In the setup fold: what scanning saves the user, in one line. */
    scanHint: "也可以扫码连接:用 QQ 扫码授权,无需手动填写 App ID 与 App Secret。",
    scanQrLabel: "QQ 机器人授权二维码",
    scanWaiting: "等待在 QQ 中扫码…",
    scanSteps: "用手机 QQ 扫描二维码,在打开的页面里选择要授权的机器人并确认。",
    /** Shown only after a code has actually lapsed and been replaced. */
    scanRefreshed: "上一个二维码已过期,这是新的。",
    /** Why the secret is safe to obtain this way — the question a careful user will ask. */
    scanPrivacy: "凭据由服务端直接接收并保存,解密密钥不会进入浏览器。",
    scanDone: (appId: string): string => `已保存机器人 ${appId} 的凭据,可以启用连接了`,
    scanFailed: (reason: string): string => `扫码连接失败:${reason}`,
    /** Shown when replacing lapsed codes stopped being worth another round trip. */
    scanExpiredRepeatedly: "二维码多次在扫描前就已过期。请稍后重新发起扫码。",
    /** Why the scan button is gated while this channel holds the connection. */
    scanDisableFirst: "先停用连接,再重新扫码绑定",
    /** Separates the scan path from the manual one; the fields below are the fallback, not the default. */
    scanOrManual: "或手动填写",
    /** The setup FAQ fold's steps. */
    setupSteps: [
      "在 QQ 开放平台注册开发者,创建一个机器人",
      "在「开发设置」页取得 App ID 与 App Secret,填入上方表单",
      "在「开发配置」中把事件订阅方式设为 WebSocket,无需填写回调地址",
      "在沙箱配置中把自己的 QQ 号或测试群加入白名单",
      "在 QQ 中找到这个机器人,给它发一条消息",
    ],
  },

  /** WeChat-channel strings of the messaging binding editor (channel-neutral ones live under `messaging`). */
  wechat: {
    /** The what-binding-does FAQ fold's body (this channel's flavor). */
    intro:
      "绑定后,在微信中发给机器人的消息会进入本对话,AI 的回复会发回微信。用微信扫码授权即可完成绑定,无需公网地址,也无需在任何后台申请凭据。",
    /** The stored-token row's clear checkbox (the models-page clear idiom). */
    clearToken: "清除已存 Bot Token",
    /** Why this channel's form has no credential fields at all. */
    scanOnly: "微信机器人的凭据只能通过扫码授权获得,没有可手动填写的 App ID 或密钥。",
    /** Why "send test message" is disabled before the bot has ever been messaged. */
    testMessageNoChat: "先在微信中给机器人发一条消息,机器人才知道要发到哪个会话",
    /**
     * The channel's shape, stated below its controls rather than left in a collapsed fold:
     * a user who binds it and then writes in a group sees nothing arrive.
     */
    directOnly: "这个渠道只支持与机器人的单聊,收不到群聊消息。",
    /** What travels, and the one inbound kind that does not. */
    media:
      "文字、图片和文件都能双向传输。语音消息按微信自带的语音转文字结果进入对话,微信没能转写的语音则无法处理。",
    /** Scan-to-connect: the button, and the states it moves through. */
    scanStart: "扫码连接",
    /** The same control once a binding exists: scanning again replaces the stored credential. */
    scanRescan: "重新扫码",
    scanStarting: "生成二维码…",
    scanQrLabel: "微信机器人授权二维码",
    scanWaiting: "等待在微信中扫码…",
    scanSteps: "用手机微信扫描二维码,然后在手机上确认授权。",
    /** Scanned but not yet confirmed: the phone is waiting, not this panel. */
    scanScanned: "已扫码,请在手机上确认授权。",
    /** Shown only after a code has actually lapsed and been replaced. */
    scanRefreshed: "上一个二维码已过期,这是新的。",
    /** Why the credential is safe to obtain this way — the question a careful user will ask. */
    scanPrivacy: "凭据由服务端直接接收并保存,不会经过浏览器。",
    scanDone: (botId: string): string => `已保存机器人 ${botId} 的凭据,可以启用连接了`,
    scanFailed: (reason: string): string => `扫码连接失败:${reason}`,
    /** Shown when replacing lapsed codes stopped being worth another round trip. */
    scanExpiredRepeatedly: "二维码多次在扫描前就已过期。请稍后重新发起扫码。",
    /** The platform stopped accepting pairing codes for this scan. */
    scanBlocked: "配对码输入错误次数过多,本次扫码已作废。请稍后重新发起扫码。",
    /** Not a failure: the bot is already bound here, so no new credential was issued. */
    scanAlreadyBound:
      "这个机器人已经被绑定——可能在本服务,也可能在别处,因此没有签发新的凭据。如果该由本会话持有它,请先在正在使用它的地方解绑,再重新扫码。",
    /** Why the scan button is gated while this channel holds the connection. */
    scanDisableFirst: "先停用连接,再重新扫码绑定",
    /** The pairing-code step: WeChat shows digits on the phone that must be typed here. */
    verifyPrompt: "手机上显示了一组数字,输入它以继续连接:",
    verifyLabel: "配对码",
    verifySubmit: "确认",
    verifySubmitting: "提交中…",
    /** The setup FAQ fold's steps. */
    setupSteps: [
      "点击上方的「扫码连接」,生成授权二维码",
      "用手机微信扫描这个二维码",
      "如果手机上显示了一组数字,把它输入到面板中",
      "在手机上确认授权,凭据会自动保存",
      "在微信中找到这个机器人,给它发一条消息",
    ],
  },

  /**
   * Session ↔ messaging-bot binding: the dock panel, the row action + dialog, and the
   * channel-neutral editor strings (per-channel fields live under `feishu` / `telegram` /
   * `qq`).
   */
  messaging: {
    panelTitle: "远程控制",
    /** Session-row context-menu action. */
    bindAction: "远程控制",
    dialogTitle: "远程控制",
    /** The channel selector (always live: each channel's config is saved independently). */
    channelLabel: "渠道",
    channelName: {
      feishu: "飞书",
      telegram: "Telegram",
      qq: "QQ",
      wechat: "微信",
    },
    /**
     * Shared link labels: the tutorial (in the setup FAQ fold) and, at the credential field's
     * corner, the developer console — the latter only for the channels that have one. A
     * channel whose credential is issued elsewhere names that destination itself (Telegram's
     * `telegram.openBotFather`).
     */
    tutorial: "前往教程",
    console: "前往开发者后台",
    /** The connection toggle (flips immediately, using the stored credentials). */
    enabled: "启用连接",
    /** The toggle's own tooltip: the switch IS the bind/unbind control, which a label reading "enable" does not say. */
    bindByEnableHint: "启用即把该机器人绑定到本对话,停用即解除绑定;凭证在两种状态下都保留。",
    /** Why the toggle is gated while the form has unsaved edits. */
    saveBeforeEnable: "先保存凭证,再启用连接",
    test: "测试连接",
    testing: "测试中…",
    testOk: (ms: number): string => `连接成功(${ms}ms)`,
    /** Success feedback naming the account the credentials sign in as (Telegram: the bot's @username). */
    testOkAs: (account: string, ms: number): string => `连接成功,机器人为 ${account}(${ms}ms)`,
    testFail: (reason: string): string => `连接失败:${reason}`,
    /** Second line on a successful Telegram test whose bot still has Group Privacy on; the remedies live in the troubleshooting fold, which outlasts a toast. */
    testPrivacyOn:
      "该机器人的 Group Privacy 处于开启状态:在它不担任管理员的群里,它收不到普通消息。修复办法见下方「常见问题」。",
    sendTestMessage: "发送测试消息",
    sendingTestMessage: "发送中…",
    testMessageSent: "测试消息已发送",
    /**
     * A test message the platform did not take, drawn under the button that sent it
     * (messaging-test-message-refusal.ts): nothing else on the card changes, so once the
     * six-second notification is gone this line is the only account of the press.
     */
    testMessageRefused: (reason: string): string => `测试消息没有发出去:${reason}`,
    /**
     * The one case where "it did not go out" would be a claim the client cannot make: the request
     * never came back with an answer, so the server may have delivered it with only the reply lost.
     */
    testMessageUnconfirmed: (reason: string): string =>
      `没能确认测试消息是否已送达:${reason}(对方可能已经收到,先到聊天里看一眼)`,
    /**
     * A save the server refused, drawn at the end of the card, above Save (messaging-save-refusal.ts):
     * the form still holds what was typed and still reads as unsaved, so this line is the only
     * thing that says the write did not land once the six-second notification is gone.
     */
    saveRefused: (reason: string): string => `保存失败:${reason}`,
    statusLabel: "连接状态",
    status: {
      disconnected: "未连接",
      connecting: "连接中",
      connected: "已连接",
      error: "连接错误",
    },
    /** Why the enable switch is gated while the OTHER channel holds the connection. */
    otherEnabledHint: (other: string): string => `同一会话只能启用一个渠道:先停用${other}连接`,
    /**
     * Why the enable switch is gated while the selected channel has no stored credential — one
     * per channel, because what is missing differs: a scan, typed fields, or either.
     */
    credentialMissingHint: {
      feishu: "先填写 App ID 与 App Secret 并保存,再启用连接",
      telegram: "先填写 Bot Token 并保存,再启用连接",
      qq: "先扫码,或填写 App ID 与 App Secret 并保存,再启用连接",
      wechat: "先扫码绑定微信,再启用连接",
    },
    /** Why the clear checkbox is gated while the channel's connection is enabled. */
    disableBeforeClearHint: "先停用连接,才能清除凭证",
    /** The saved delivery option: render a reply's Markdown in the channel's own markup. */
    renderMarkdown: "渲染 Markdown",
    /**
     * Its disclosure, beside the label. One per channel, because what a channel can show is
     * the whole of what the reader needs to know here — a shared sentence would have to say
     * "depending on the channel", which answers nothing.
     */
    renderMarkdownHelpFeishu:
      "开启后,回复中的 Markdown 以排版形式到达,而不是显示为 `**字符**`。飞书以卡片渲染:标题、粗体、斜体、删除线、行内代码与代码块、列表、引用、分割线、链接和表格都支持。超过五行的表格改以代码块发送,任何一行都不会被隐藏。若飞书拒绝该卡片,回复会改以纯文本发出,不会丢失。",
    renderMarkdownHelpTelegram:
      "开启后,回复中的 Markdown 以排版形式到达,而不是显示为 `**字符**`。Telegram 支持粗体、斜体、删除线、链接、行内代码与代码块;它没有标题、列表和表格,因此标题渲染为一行粗体,列表符号作为文本的一部分保留,表格改以代码块发送。若 Telegram 拒绝该排版,回复会改以纯文本发出,不会丢失。",
    renderMarkdownHelpQQ:
      "开启后,回复中的 Markdown 以排版形式到达,而不是显示为 `**字符**`。QQ 支持标题、粗体、斜体、删除线、列表、引用、分割线和链接;它没有代码格式,也没有表格,因此代码块按普通文本行到达,表格按其行到达。若 QQ 拒绝该排版,回复会改以纯文本发出——这会多占用 QQ 对每条消息只允许的少数几条回复中的一条。",
    renderMarkdownHelpWeChat:
      "开启后,回复中的 Markdown 以排版形式到达,而不是显示为 `**字符**`。微信自己就读 Markdown,四个渠道里它支持得最全:标题、粗体、删除线、列表、引用、分割线、链接、行内代码、代码块和表格都能渲染。它不支持的部分会被去掉标记只留文字——五级以下的标题、中文两侧的斜体星号,以及行内图片(改为链接)。",
    /** The saved delivery option: one message per non-blank line of a reply. */
    linePerMessage: "每行一条消息",
    /** Its disclosure, beside the label: what the option does to a reply, and its two edges. */
    linePerMessageHelp:
      "回复的每个非空行各发一条消息,写成多句台词的回复就按台词逐条到达。超出每条回复的消息上限时,余下的行合并为最后一条,内容不会丢失。",
    /** The saved delivery option: hold a run's working notes, send its last reply only. */
    finalReplyOnly: "只发送最终回复",
    /** Its disclosure, beside the label: what the option changes, and what it costs. */
    finalReplyOnlyHelp:
      "只发送一次运行中助手最后说的那段话,在运行结束时发出;工具调用之间的过程记录留在网页端。代价是长时间运行期间聊天里一片安静。审批提醒不属于回复,仍会立即到达。",
    /**
     * Appended to the option's explanation on QQ only. Not a nuance of the same trade but a
     * different outcome — silence on the other two channels, lost output here — which the
     * channel-neutral sentence above would leave the user to discover from an empty chat.
     */
    finalReplyOnlyQQWarning:
      "QQ 只能回复入站消息,锚点约五分钟失效:开启后,运行超过五分钟就一条也发不出。",
    /** Enabled-row indicator's tooltip / sr text (the small per-channel glyph on the session row). */
    enabledIndicator: {
      feishu: "飞书连接已启用",
      telegram: "Telegram 连接已启用",
      qq: "QQ 连接已启用",
      wechat: "微信连接已启用",
    },
    /**
     * Delivery observability under the toggle: has anything arrived, and did the last one get
     * through. Both readings belong to the LIVE CONNECTION and start over on a re-enable or a
     * credential save, so the empty case names that scope instead of reading as "never".
     * Each failure line carries its own time: nothing clears it on a later success, and a
     * title= is unreachable on touch.
     */
    inboundLastAt: (when: string) => `最近收到消息:${when}`,
    inboundNone: "本次连接建立以来还没有收到过消息",
    deliveryFailedInbound: (when: string, detail: string) =>
      `${when} 收到过一条消息,但任务没有开始:${detail}`,
    deliveryFailedSend: (when: string, detail: string) =>
      `任务已完成,但回复于 ${when} 发送失败:${detail}`,
    /** A connection failure the connection has since recovered from (lastError is gone by then). */
    lastConnectionError: (when: string, detail: string) => `连接曾于 ${when} 中断:${detail}`,
    /** The collapsed FAQ folds below the save area. */
    faqSetupTitle: "如何创建机器人",
    faqWhatTitle: "绑定后会发生什么",
    /** The channel-neutral half of that fold: how the same bot moves between conversations. */
    faqWhatBinding:
      "同一个机器人可以同时保存在多个对话里,但同一时刻只能有一个对话启用它的连接。要换一个对话使用,先在原对话停用连接,再在这里启用——凭证不必删除。",
    faqTroubleTitle: "常见问题",
    /** Troubleshooting entries (bot must be messaged once; connection errors point at credentials; one poller per Telegram token; Telegram Group Privacy withholds group messages from a non-admin bot; QQ answers only a message just sent). */
    troubleNoChat: "「发送测试消息」不可用?机器人要先收到过一条消息,才知道要发到哪个会话。",
    troubleConnError:
      "连接状态显示错误?检查凭证是否正确;飞书还需确认 API 域名与事件订阅方式(长连接)。",
    troubleOnePoller:
      "Telegram 提示已有其他程序在轮询?一个 Bot Token 同一时刻只能被一个程序使用——关闭正在占用它的另一个 Adelie 服务端或机器人脚本,或为该会话单独建一个机器人。手动执行的 getUpdates(例如用 curl 查看 Telegram 那边积压了什么)同样算作「另一个程序」:跑它之前先在这里停用连接。而且手动查看也可能把它们丢掉——任何带 offset 的调用都会确认它之前的全部更新,应用自己的下一次连接也会清空积压——所以复测请重新发一条新消息,而不是指望刚才看到的那几条。",
    troubleGroupPrivacy:
      "在 Telegram 群里发消息,机器人毫无反应?Telegram 的 Group Privacy 默认开启,此时不担任该群管理员的机器人只能收到明确指向它的命令(如 /start@your_bot)和对它自己消息的回复,普通群消息根本不会送达,连接本身也没有任何异常。把机器人设为该群的管理员即可单独解决,管理员始终收到全部消息。也可以到 @BotFather 用 /setprivacy 关闭 Group Privacy,然后把机器人移出该群再重新拉入——已在的群不会自动生效。",
    /** WeChat has no group inbound at all — the answer to "I @-ed it in a group and nothing happened". */
    troubleWeChatDirect: "微信渠道只接收单聊消息:在群里 @机器人不会有任何反应,请直接私聊它。",
    /** The QQ-only failure a user will otherwise read as "the bot is broken". */
    troubleQQPassive:
      "QQ 里收不到回复?QQ 只允许机器人回复你刚发出的消息:在网页端发起的对话不会同步过去,距离你上一条 QQ 消息过去几分钟后也发不出。在 QQ 里再发一条消息即可继续。",
    troubleNoGroupInbound:
      "在群里发消息,面板却一直显示「本次连接建立以来还没有收到过消息」?这一行只能作为你读到它之后再发的那条消息的证据:它只覆盖当前这条连接,停用再启用连接、或者再保存一次凭证,都会开启一条新连接并把它清零。所以先重新发一条。如果这一行仍然显示没有收到过,那就是 Telegram 没有把它投递过来,本机再怎么查也无济于事:确认机器人确实还在这个群里;如果刚在 @BotFather 关掉 Group Privacy,必须把机器人移出该群再重新拉入,已有的群不会自动生效;并确认没有别的程序(包括你自己手动跑的 getUpdates,见上一条)在用同一个 Token 轮询。另外,Telegram 频道(channel)的贴文不受支持——本连接只处理群聊与私聊。",
  },

  /** Subagents side panel: call-graph of the latest Task + the selected child conversation. */
  subagentPanel: {
    topologyLabel: "调用关系",
    mainSessionNote: "主会话请在对话区查看",
    empty: "本次任务尚未派生子智能体",
    nodeRunning: "运行中",
    nodeDone: "已完成",
    /** Identity-strip jump: opens the selected subagent's own Session in the chat area. */
    openAsSession: "跳转到该会话",
    /** The child's session record no longer exists and could not be revived. */
    subagentGone: "该子会话已不存在,无法恢复",
    /**
     * A message the panel could not deliver to the child (subagent-send-refusal.ts), drawn above
     * the composer that still holds the text: the action, then the server's own words.
     */
    sendRefused: (reason: string) => `消息没有送到子会话:${reason}`,
  },

  files: {
    title: "文件",
    upload: "上传",
    download: "下载",
    /** Desktop shell's own window only: opens the previewed file's directory in the OS file manager. */
    revealInFolder: "在文件夹中显示",
    /** Row / preview context menu: the two entries both kinds carry, then the kind-specific one. */
    copyPath: "复制相对路径",
    addToChat: "添加到对话",
    addSelectionToChat: "将选中内容添加到对话",
    uploadHere: "上传到此文件夹",
    openInNewTab: "新页面打开",
    previewNotIsolatedHint:
      "当前访问地址无法提供独立预览源,页面将以沙箱模式打开:localStorage、Cookie 与第三方 embed 不可用。经 127.0.0.1 或 localhost 访问,或配置 ADELIE_PREVIEW_ORIGIN 即可解除。",
    refresh: "刷新",
    /** The Workspace root, as the breadcrumbs and the drop overlay name it. "." is what a
     *  shell calls the working directory, so it needs no translation. */
    root: ".",
    empty: "空目录",
    previewUnsupported: "该类型不支持预览,请下载查看",
    /** A legacy .doc is a binary format nothing here can read; the way out is a resave. */
    previewDocLegacy: "旧版 .doc 无法预览,用 Word 另存为 .docx 后即可预览",
    /** The server could not read this .docx (damaged, or not really a Word file). */
    previewDocxFailed: "这个 Word 文件无法解析,请下载查看",
    /** The pane paints PDFs itself (features/chat/pdf-preview.tsx); these are its two states. */
    pdfLoading: "正在打开 PDF…",
    pdfFailed: "PDF 读取失败,可下载后用阅读器查看",
    uploadedCount: (n: number): string => `已上传 ${n} 个文件`,
    uploading: (done: number, total: number): string => `正在上传 ${done}/${total}…`,
    /** Oversize picks are named and skipped before anything is read. */
    uploadTooLarge: (names: string, mb: number): string =>
      `超过 ${mb}MB 上传上限,已跳过:${names}`,
    /** A dropped folder is not a file the upload endpoint can take; it is named and skipped. */
    folderDropSkipped: (names: string): string => `不支持上传文件夹,已跳过:${names}`,
    /**
     * Above the listing after an upload the server refused: nothing landed, so the files are still
     * only where they were picked from, and Save is not the retry — picking them again is.
     */
    uploadRefused: (dir: string, reason: string): string => `上传到 ${dir} 失败:${reason}`,
    /** The same refusal when part of the batch landed: the rest has to be picked again by name. */
    uploadRefusedPartial: (dir: string, names: string, reason: string): string =>
      `上传到 ${dir} 时,${names} 没有上传:${reason}`,
    /** Upload-overwrite confirmation: same-name files in the target directory will be replaced. */
    overwriteTitle: "覆盖同名文件",
    overwriteConfirm: (n: number): string => `目标目录已存在以下 ${n} 个同名文件,上传将覆盖:`,
    loadFailed: "加载失败",
    previewTruncated: "内容过大,预览已截断,请下载查看完整文件",
    htmlRendered: "预览",
    htmlSource: "源码",
    backToList: "返回列表",
    /** The tree pane: its accessible name and the toolbar toggle's two states. */
    treeLabel: "文件树",
    showTree: "显示文件树",
    hideTree: "隐藏文件树",
    /** The divider between the tree and the preview: drag, or nudge with the arrow keys. */
    treeWidth: "调整文件树宽度",
    /** The search box above the tree; it reaches only as far as the lazy tree has been loaded. */
    searchPlaceholder: "搜索文件",
    searchClear: "清除搜索",
    searchNoMatch: "Workspace 中没有匹配项",
    /** The walk is server-side and covers the whole Workspace, so it is not instant on a large one. */
    searching: "搜索中…",
    /** The server stopped at its cap: what is listed is the shallowest matches, not all of them. */
    searchTruncated: (n: number): string => `匹配项过多,仅显示最靠前的 ${n} 条`,
    selectFile: "选择一个文件以预览",
    /** Drop overlay label; `dir` is the directory the files will land in (the root's display name for the root). */
    dropToUpload: (dir: string): string => `松开即上传到 ${dir}`,
    /** In-place text editing. */
    editorLabel: (name: string): string => `编辑 ${name}`,
    /** Soft-wrap toggle, shared by the source view and the editor: off means long lines scroll sideways. */
    wrapLines: "自动换行",
    unsaved: "有未保存的修改",
    saveConfirmTitle: "保存文件",
    saveConfirm: (name: string): string => `保存对 ${name} 的修改?Workspace 中的该文件将被覆盖。`,
    editTooLarge: (kb: number): string => `文件超过 ${kb}KB,无法在此编辑,请下载后编辑`,
    saveTooLarge: (mb: number): string => `内容超过 ${mb}MB 写入上限,未保存`,
    /** Under the header after a refused save: the server's reason, and that Save is the retry. */
    saveRefused: (reason: string): string => `保存失败:${reason}`,
    /** The same refusal while the editor holds text the file does not: nothing typed was lost. */
    saveRefusedDraftKept: (reason: string): string =>
      `保存失败:${reason}(编辑器里的改动没有写进文件)`,
    discardTitle: "放弃未保存的修改",
    discardBody: (name: string): string => `${name} 有未保存的修改,放弃这些修改?`,
    discard: "放弃",
    unsavedRestored: (name: string): string => `已恢复 ${name} 的未保存修改`,
    /** The editor's ×: back to the preview (asking first when there are unsaved changes). */
    stopEditing: "退出编辑",
    /** The file was rewritten (by the Agent, most likely) while the editor was open on it. */
    changedOnDisk: "磁盘上已变更",
    changedOnDiskHint: "该文件在你打开之后已被重写,保存会用你的版本覆盖它。",
    /** Rename and move are one action: both write the file to a new Workspace-relative path. */
    /** The composer chip's remove button, for whatever the Files panel staged there. */
    removeReference: "移除引用",
    renameTitle: "重命名 / 移动",
    renameLabel: "新的路径",
    renameHint: "相对 Workspace 根目录;路径中不存在的目录会自动创建",
    renameConfirm: "移动",
    /** A move or a New landed on a name that is taken: nothing was written. */
    targetExists: (path: string): string => `${path} 已存在,未做改动。`,
    renamed: (name: string): string => `已移动到 ${name}`,
    deleteTitle: "删除文件",
    deleteBody: (name: string): string => `删除 ${name}?该文件不会进入回收站。`,
    deleted: (name: string): string => `已删除 ${name}`,
    /** Both actions read the file's current version first; until it lands there is nothing to refuse an overwrite with. */
    actionVersionReading: "正在读取该文件的当前版本…",
    actionVersionFailed: "读不到该文件的当前版本,因此不执行此操作。",
    /** The version precondition refused it: the Agent wrote the file while the question was on screen. */
    changedBeforeAction: (name: string): string =>
      `${name} 在你决定期间被改写(多半是 Agent 在本轮写入的),因此未做任何改动。已按它现在的版本重新读取,可以直接重试。`,
    conflictTitle: "文件在磁盘上已变更",
    conflictBody: (name: string): string =>
      `${name} 在你打开之后被重写(多半是 Agent 本轮写的),本次没有保存任何内容。可以用你的版本覆盖它,也可以继续编辑、先把需要的内容取出来——两种选择都会保留你的文本。`,
    overwriteAnyway: "仍然覆盖",
    /** The tree header's New menu, a folder's menu and the blank space under the tree. */
    newMenu: "新建",
    newTextFile: "新建文本文件",
    newFolder: "新建文件夹",
    newFileName: "文件名",
    newFolderName: "文件夹名",
    /** Formatting, kept on screen while typing: where the entry goes, and what a `/` does. */
    createHint: (dir: string): string => `建在 ${dir} 下;名称里的 / 会同时建出中间的文件夹`,
    createConfirm: "创建",
    created: (name: string): string => `已创建 ${name}`,
    /** The new-chat draft's Files panel and its toggle, while the Workspace is a temporary one. */
    draftTemporary: "临时工作区在发送第一条消息时才创建。选一个文件夹,即可浏览其中的文件。",
  },

  usage: {
    title: "成本与统计",
    today: "今日",
    last7d: "近 7 天",
    total: "累计",
    tokens: "Token",
    requests: "Requests",
    from: "起始日期",
    to: "结束日期",
    colCacheRead: "缓存命中",
    colCacheWrite: "缓存未命中",
    colOutput: "输出",
    uncostedNote: "* 只计入配置了价格的模型成本",
    filterAllAgents: "全部 Agent",
    filterAllModels: "全部模型",
    rangeLabel: "日期范围",
    rangeHour: "最近一小时",
    rangeDay: "最近一天",
    range7d: "近 7 天",
    range30d: "近 30 天",
    range90d: "近 90 天",
    rangeCustom: "自定义",
    chartRequestsByAgent: "各 Agent 请求与成功率",
    chartRequestsByModel: "各模型请求与成功率",
    legendSuccessRate: "成功率",
    chartTokenTrend: "Token 变化",
    chartCostTrend: "成本变化",
    legendOther: (n: number): string => `其他 ${n} 项`,
    bucketTotal: "合计",
    legendHitRate: "缓存命中率",
    empty: "暂无用量记录",
    errors: "异常",
    errorsTotal: "总数",
    errorsUnexpected: "未预期",
    errorsExpected: "预期内",
    errorsTopCode: "最常见",
    errorsColCode: "来源 · 错误码",
    errorsColKind: "类型",
    errorsColMessage: "消息",
    errorsEmpty: "暂无异常",
    /** The table's category control: both categories, and the empty state once one is chosen. */
    errorsFilterAll: "全部",
    errorsEmptyKind: "该类型下暂无异常",
    /** Time cell tooltip on a row that folds several of a day's records: when the first one was. */
    errorsFirstAt: (time: string): string => `首次出现于 ${time}`,
    /** Each row's copy action: the whole record — when, source · code, type, count and the full message — as one paste-able block. */
    errorsCopy: "复制这条异常",
    /** Detail-table pager: newer/older step back through pages of the same filtered set; it counts rows, not records. */
    errorsNewer: "较新",
    errorsOlder: "更早",
    errorsPageOf: (page: number, pages: number, rows: number) =>
      `第 ${page} / ${pages} 页 · 共 ${rows} 行`,
    /** Clearing the table: the action, and the confirm that must name exactly what goes. */
    errorsClear: "清空",
    errorsClearTitle: "清空错误记录",
    /** The range half of the confirm: a quick preset by the name the picker gives it, a custom range by its two dates — each one adverbial the sentence below slots in. */
    errorsClearRangePreset: (preset: "1h" | "1d" | "7d" | "30d" | "90d"): string =>
      ({
        "1h": "最近一小时内",
        "1d": "最近一天内",
        "7d": "近 7 天内",
        "30d": "近 30 天内",
        "90d": "近 90 天内",
      })[preset],
    errorsClearRangeCustom: (from: string, to: string): string => `在 ${from} 至 ${to} 区间内`,
    errorsClearScope: (count: number, range: string): string =>
      `将删除本项目 ${range}的 ${count} 条错误记录,其余时间段的记录保留。`,
    errorsClearScopeAgent: (count: number, range: string, agentId: string): string =>
      `将删除本项目中 Agent「${agentId}」${range}的 ${count} 条错误记录,其他 Agent 与其余时间段的记录保留。`,
    /** The same sentence with the table's own category filter on: the other category is kept too. */
    errorsClearScopeKind: (count: number, range: string, kind: string): string =>
      `将删除本项目 ${range}的 ${count} 条「${kind}」错误记录,另一类与其余时间段的记录保留。`,
    errorsClearScopeKindAgent: (
      count: number,
      range: string,
      kind: string,
      agentId: string,
    ): string =>
      `将删除本项目中 Agent「${agentId}」${range}的 ${count} 条「${kind}」错误记录,另一类、其他 Agent 与其余时间段的记录保留。`,
    errorsClearIrreversible: "此操作不可恢复。",
    errorsClearDone: (count: number): string => `已删除 ${count} 条错误记录`,
    /**
     * Ignoring: the fourth view of the table, the row action that silences a class, and the rule
     * list that says what is being held back. The records are never deleted — which is why this
     * action takes no confirmation where clearing does, and why the notice below says so outright.
     */
    errorsIgnored: "已忽略",
    errorsEmptyIgnored: "暂无被忽略的异常",
    errorsIgnoreAction: "忽略这类异常",
    /** The dialog's confirm button: the action's own verb. */
    errorsIgnore: "忽略",
    errorsIgnoreFragment: "只忽略消息包含以下内容的记录",
    errorsIgnoreFragmentHint: "留空则忽略这一来源与错误码下的全部记录。",
    errorsIgnoreRules: "忽略规则",
    errorsIgnoreRuleNone: "还没有忽略规则。",
    /** A rule narrowed to a message fragment says so; a whole-class rule says nothing extra. */
    errorsIgnoreRuleFragment: (fragment: string): string => `消息含「${fragment}」`,
    errorsIgnoreRuleHidden: (count: number): string => `已隐藏 ${count} 条`,
    errorsIgnoreRuleHiddenNone: "尚未隐藏任何记录",
    errorsIgnoreRuleLast: (time: string): string => `最近一条 ${time}`,
    errorsUnignore: "取消忽略",
    errorsIgnoreNotice: "被忽略的记录仍在库里,只是不再出现在其他视图里。",
    errorsUnignoreDone: (label: string): string => `已恢复 ${label} 的异常`,
    /** After ignoring: which class went, and how many records the range on screen just lost. */
    errorsIgnoreDone: (label: string, count: number): string =>
      `已忽略 ${label} · 本次隐藏 ${count} 条记录`,
    errorsIgnoreUndo: "撤销",
    /** The clear sentence on the ignored view: what goes is that view's own table, and nothing else is touched. */
    errorsClearScopeIgnored: (count: number, range: string): string =>
      `将删除本项目 ${range}的 ${count} 条已忽略的错误记录,未被忽略的记录与其余时间段的记录保留。`,
    errorsClearScopeIgnoredAgent: (count: number, range: string, agentId: string): string =>
      `将删除本项目中 Agent「${agentId}」${range}的 ${count} 条已忽略的错误记录,未被忽略的记录、其他 Agent 与其余时间段的记录保留。`,
    /** Shown in the clear confirmation when the range holds ignored records: the sentence above never counts them. */
    errorsClearKeepsIgnored: (count: number): string => `另有 ${count} 条已忽略的记录不在此列。`,
  },

  /** The Trace panel's own view of a Trace file (trace-file-view / timeline-chart); the standalone browsing page these once also served is gone. */
  traces: {
    timeline: "执行时间线",
    laneLLM: "模型",
    kindThinking: "思考",
    kindModelReply: "模型回复",
    kindToolGen: "工具调用生成",
    legendToolExec: "工具调用执行",
    legendOther: "其他",
    toolParams: "参数 Schema",
    /** Spoken form of the red "*" in the schema table, where no control carries `aria-required`. */
    requiredParam: "必填",
    legendApprovalWait: "审批等待",
    task: (n: number) => `第 ${n} 轮`,
    globalSummary: "全局统计",
    tasksLabel: "轮次",
    messages: "消息",
    /** The control above the drawn round cards: how many earlier rounds are not drawn yet; a click draws the next page of them. */
    earlierRounds: (n: number) => `更早的 ${n} 轮`,
    /** Spoken by an open round's placeholder while its messages are being read. */
    roundLoading: "正在读取本轮消息",
    zoom: "缩放",
    zoomReset: "双击复位缩放",
    zoomOut: "缩小",
    zoomIn: "放大",
    linkHint:
      "鼠标移到时间线段或消息行即可联动高亮,点击时间线段跳转到对应消息;图例可高亮同类;拖动下方滑块平移/缩放",
    filesTitle: "Trace 文件",
    toolCalls: "工具调用",
    taskInput: "本轮输入 tokens",
    taskOutput: "本轮输出 tokens",
    cacheHit: "命中缓存",
    hitRate: "命中率",
    avgToolCalls: "每轮平均工具调用",
    /** The round-card badge reuses `chat.compactionTitle`, which names the mode (压缩 / 清空) and is the stem of the conversation row's state titles (压缩中 / 压缩完毕), so the Trace view and the conversation cannot drift apart; there is deliberately no Trace-local copy of that word. */
    inProgress: "进行中",
    systemPrompt: "系统提示词",
    toolDefs: (n: number) => `工具定义(${n})`,
    exportFile: "导出",
    /** Whole-Session export: every compaction shard in one file, for import on another install. */
    exportSession: "导出整个会话",
    exportSessionHint: "把这个会话的全部分片打包成一个文件,可在另一台 Adelie 导入",
  },

  benchmark: {
    title: "评估中心",
    /** The three step cards under the title: each says where on this page to do that step. */
    guideFlow: [
      {
        title: "出题",
        text: "点右上角「用 AI 创建」,让 AI 为某个智能体出一套题并取得基线分;也可以「手动创建」自己写题。",
      },
      {
        title: "评估",
        text: "选一个 Benchmark,点「使用」→「评估」,选好被测智能体后在新对话中发送,即得到一条带标签的分数。",
      },
      {
        title: "优化",
        text: "选一个 Benchmark,点「使用」→「优化」,设定目标分数后在新对话中发送;分数严格提升才保留新版本。",
      },
    ],
    /** The first step card's text for a Project member: no Create manually, which is the owner's. */
    guideCreateMember: "点右上角「用 AI 创建」,让 AI 为某个智能体出一套题并取得基线分。",
    searchPlaceholder: "搜索标题、描述或被测智能体",
    noMatches: "没有匹配的 Benchmark",
    /** The chip shown when the address filters the list to one Agent's Benchmarks. */
    filterByAgent: (agentId: string): string => `只看评测过 ${agentId} 的 Benchmark`,
    clearFilter: "显示全部",
    emptyTitle: "还没有 Benchmark",
    emptyDescription:
      "先让 AI 为一个智能体出题并取得基线分;之后这里会显示分数曲线与逐题明细,并可一键发起优化。",
    caseCount: (n: number): string => `${n} 题`,
    runsPerCase: (n: number): string => `每题 ${n} 次运行`,
    notEvaluated: "尚未评测",
    /** A draft Benchmark: the agent is still writing its cases, so card and page are masked. */
    building: "构建中",
    buildingHint: "智能体还在出题与校准难度,构建完成后即可使用",
    buildingDetail: "构建完成后,这里会显示题目、分数曲线与评估明细。",
    /** A Benchmark whose calibration never finished: unusable, so the card and page are masked. */
    creationFailed: "创建失败",
    creationFailedHint: "题目难度未能校准完成,请删除后重新创建",
    creationFailedDetail:
      "这套题的难度校准没有完成,无法评估或优化;请删除这个 Benchmark,然后重新创建。",
    /** The two lines above for a Project member: no delete step, since deleting is the owner's. */
    creationFailedHintMember: "题目难度未能校准完成",
    creationFailedDetailMember: "这套题的难度校准没有完成,无法评估或优化。",
    /** The avatars on a card: which Agents this Benchmark has scored so far. */
    testedAgents: "被测过的智能体",
    lastEvaluated: (when: string): string => `最近评估 ${when}`,
    /** Accessible name of the row sparkline. */
    sparklineLabel: (n: number): string => `${n} 次评估的分数走势`,
    latestScoreLabel: "最新分数",
    /** The change column when there is nothing earlier to compare against. */
    firstEvaluation: "首次评估",
    /** Card and Benchmark-page action: opens the Use dialog. */
    use: "使用",
    /** The Use dialog's two tabs. */
    evaluate: "评估",
    optimize: "优化",
    view: "查看",
    copyPath: "复制目录路径",
    deleteBenchmark: "删除 Benchmark",
    deleteConfirm: (title: string): string =>
      `确定删除「${title}」吗?它的全部题目与评估记录都会被删除,无法恢复。`,
    deleted: "Benchmark 已删除",
    backToList: "返回列表",
    /** The Benchmark's own page when the id in the address resolves to nothing. */
    notFound: "找不到这个 Benchmark",
    notFoundHint: "它可能已被删除,或者链接里的 id 不对。",
    /** Score-only chart title. */
    trendTitle: (metric: string): string => `${metric}随时间变化`,
    cases: "题目",
    viewCase: "查看详情",
    taskMaterials: "任务材料",
    rubric: "评分标准",
    agentHidden: "被测 Agent 不可见",
    caseFileUnavailable: "案例文件暂时无法读取",
    evaluations: "评估明细",
    noEvaluations: "暂无评估记录",
    noEvaluationsHint: "取得基线分后,这里会出现分数曲线与评估明细。",
    /** Evaluation notes (scoreboard's summary: score source and notes on this round's changes). */
    summaryLabel: "评估说明",
    /** Chart legend: evaluation records missing the tested Agent or the model (gray series). */
    unlabeled: "未标注",
    agentColumn: "被测 Agent",
    colVersion: "版本",
    colModel: "模型 ID",
    colThinkingLevel: "推理强度",
    colScore: "分数",
    colDuration: "耗时",
    colCase: "题目",
    colRun: "运行",
    colSession: "Session",
    // The evaluation detail dialog, and the Ask AI dialog both detail dialogs open.
    askAi: "问 AI",
    evaluationDetailTitle: (time: string): string => `评估 · ${time}`,
    askEvaluationTitle: "问 AI:这次评估",
    askEvaluationDescription:
      "这次评估的总分、逐题结果与逐次运行的 Session id 会一起交给智能体,它读过记分板与相关 Trace 后作答;提示词可以改。",
    askEvaluationDefault: "解释这次评估的结果。",
    /** The default question leads the examples (it is what the box opens with), so a reader who tried another can bring it back. Keep `explain.prompt` equal to askEvaluationDefault. */
    askEvaluationExamples: {
      explain: {
        label: "解释这次评估的结果",
        prompt: "解释这次评估的结果。",
      },
      whyLow: {
        label: "为什么这次分数低?",
        prompt: "为什么这次评估的分数偏低?请结合逐题分数与运行记录说明主要失分在哪里。",
      },
      weakest: {
        label: "哪些题最弱、该改什么?",
        prompt: "哪几道题分数最低?分别是什么原因,被测智能体改哪一处才有机会提上去?",
      },
      againstPrevious: {
        label: "与上一次评估相比变化在哪?",
        prompt: "与这个系列上一次评估相比,哪些题涨了、哪些题掉了?这些变化最可能来自什么?",
      },
    },
    /** The evaluation dialog's Ask AI tail: this evaluation's facts, and what to read before answering. */
    askEvaluationTail: (p: {
      benchmarkId: string;
      time: string;
      label: string;
      version: number;
      provider: string;
      modelId: string;
      thinkingLevel: string;
      score: string;
      cost: string;
      duration: string;
      summaryTitle: string;
      summary: string;
      cases: { id: string; score: string; cost: string; duration: string; sessionIds: string[] }[];
    }): string =>
      "请解释下面这次 Benchmark 评估的结果。只做阅读与分析:不要修改这套 Benchmark,也不要修改被测智能体。\n\n" +
      `- benchmark_id:\`${p.benchmarkId}\`(项目的 \`benchmarks/${p.benchmarkId}/\`,记分板为 \`benchmarks/${p.benchmarkId}/scoreboard.yaml\`)\n` +
      `- 评估时间:${p.time}\n` +
      `- 系列标签:${p.label}\n` +
      `- 被测版本:v${p.version}\n` +
      `- 评测 Runtime:provider \`${p.provider}\` / model_id \`${p.modelId}\` / thinking_level \`${p.thinkingLevel}\`\n` +
      `- 总分 ${p.score};成本 ${p.cost};耗时 ${p.duration}\n` +
      (p.summaryTitle !== "" ? `- 评估说明标题:${p.summaryTitle}\n` : "") +
      (p.summary !== "" ? `- 评估说明:${p.summary}\n` : "") +
      "- 逐题结果(分数、成本、耗时,以及逐次运行的 Session id):\n" +
      p.cases
        .map(
          (c) =>
            `  - \`${c.id}\`:${c.score};${c.cost};${c.duration};Session ` +
            (c.sessionIds.length > 0 ? c.sessionIds.map((id) => `\`${id}\``).join("、") : "未记录"),
        )
        .join("\n") +
      "\n\n请读取 scoreboard.yaml 里这条记录,并按需读取上列 Session 的 Trace,然后说明:这些分数是怎么来的、" +
      "哪几道题最薄弱及其具体原因,以及下一步建议(改被测智能体的哪一处,或先补哪一类证据)。",
    askCaseTitle: "问 AI:这道题",
    askCaseDescription:
      "题干与评分细则的路径会交给智能体,请它讲清这道题考什么、怎样才算答好;题目已冻结,它只读不改。",
    askCaseDefault: "解释这道题考什么、怎样才算答好。",
    /** As for the evaluation dialog: the default question leads, equal to askCaseDefault. */
    askCaseExamples: {
      explain: {
        label: "解释这道题考什么、怎样才算答好",
        prompt: "解释这道题考什么、怎样才算答好。",
      },
      rubricRewards: {
        label: "评分细则在奖励什么?",
        prompt: "这道题的评分细则把分数主要放在哪些地方?哪些条目最能把优秀与及格区分开?",
      },
      whyRunLow: {
        label: "为什么有的运行在这道题上分数低?",
        prompt: "最近一次评估在这道题上分数不高,可能是被测智能体在哪一步做丢了?",
      },
      clearerStatement: {
        label: "题干怎样才能更清楚?",
        prompt:
          "这道题的题干有没有含糊或容易误读的地方?题目已冻结不能改,请说明如果下次新建 Benchmark 该怎么写得更清楚。",
      },
    },
    /** The case dialog's Ask AI tail: the two READMEs to read, and this case's latest run results. */
    askCaseTail: (p: {
      benchmarkId: string;
      caseId: string;
      latest: { time: string; score: string; runs: { score: string; sessionId: string }[] } | null;
    }): string =>
      "请解释下面这道 Benchmark 题目考的是什么、怎样才算答好。题目创建即冻结,只做阅读与分析,不要修改这套 Benchmark。\n\n" +
      `- benchmark_id:\`${p.benchmarkId}\`(项目的 \`benchmarks/${p.benchmarkId}/\`)\n` +
      `- case_id:\`${p.caseId}\`\n` +
      `- 题干:\`benchmarks/${p.benchmarkId}/${p.caseId}/statement/README.md\`\n` +
      `- 评分细则:\`benchmarks/${p.benchmarkId}/${p.caseId}/rubric/README.md\`\n` +
      (p.latest === null
        ? "- 这套 Benchmark 还没有评估记录。\n"
        : `- 最近一次评估(${p.latest.time})在这道题上的平均分 ${p.latest.score}\n` +
          p.latest.runs
            .map((r, i) => `  - 第 ${i + 1} 次运行:${r.score};Session \`${r.sessionId}\`\n`)
            .join("")) +
      "\n请读取上面两个 README(以及上列 Session 的 Trace,如果有),然后说明:这道题实际考察什么能力、" +
      "一份好答案长什么样(关键决定与产物),以及评分细则靠哪些条目把优秀与及格区分开。",
    // New Benchmark, AI mode: the target picker, the examples and the fixed tail.
    aiCreateTitle: "让 AI 创建 Benchmark",
    aiCreateDescription:
      "描述要考察的能力与场景,AI 会为被测智能体出题、逐题试测以校准难度,并取得基线分。",
    targetAgent: "被测智能体",
    targetAgentHint: "题目为它而出、分数记在它名下;出题本身由下方所示的智能体在新对话里完成",
    aiCreateExamples: {
      decisionAgent: {
        label: "决策:足球、售后与投资的有限选择",
        description: "公开规则、历史案例与当前事实互相冲突或不完整",
        prompt:
          "为通用决策智能体出题:足球投注、售后处置、投资动作三个场景,各给一组有限选项,公开规则、历史案例与当前事实要么不完整、要么互相冲突,看它能不能给出稳定、可解释的选择,而不是被最近的一条信息带着走。",
      },
      reportWriter: {
        label: "报告写作:材料互相矛盾",
        description: "冲突材料、缺失口径、严格的篇幅与引用",
        prompt:
          "为报告写作智能体出题:材料互相矛盾,币种、时区这类关键口径故意不写全,篇幅和引用格式卡得很严,看它会不会先指出缺口、再做保守假设。",
      },
      customerService: {
        label: "客服:隐藏政策前提的对话题",
        description: "信息不全的用户、藏在附录的政策条件、越权承诺陷阱",
        prompt:
          "为客服智能体出多轮对话题:用户描述模糊、关键事实要追问才给,政策的例外条款藏在附录里,情绪化的表达在诱导越权承诺,看它会不会先核实再答复、守住政策口径。",
      },
      codeReview: {
        label: "代码审查:缺陷藏在约定里",
        description: "未写明的调用与并发前提,误导人的注释与测试",
        prompt:
          "为代码审查智能体出题:每题一个小型多文件仓库,缺陷藏在没写明的调用顺序、时区或编码假设和并发前提里,再配上过时的注释和一份能通过却盖不住缺陷的测试,看它查全、误报和验证步骤。",
      },
    },
    /** The fixed tail after the draft: the `benchmark-design` inputs and the layout it writes. */
    aiCreateTail: (targetAgentId: string): string =>
      "请使用 `benchmark-design` Skill,作为 Builder 为下面的被测智能体设计并校准一套 Benchmark,不要修改被测智能体本身。\n\n" +
      `- test_agent_id:\`${targetAgentId}\`\n` +
      "- benchmark_id:上文已指定则沿用,否则按场景取一个简短的语义化 id(仅字母、数字、`_` 和 `-`)\n" +
      "- 题量:3 道左右——少而难,每题至少有一个能把「照着做」和「真会做」分开的决定点(上文另有要求时以上文为准)\n" +
      "- 出题手法:隐藏的先验条件、模糊或不完整的输入、互相冲突的材料、严格的交付格式;不要靠堆行数、堆规则来加难度\n" +
      "- desired_baseline_score:`<50`(上文另有要求时以上文为准)\n" +
      "- pilot_iteration_limit:`4`(上文另有要求时以上文为准)\n\n" +
      "Benchmark 与 Agent 平级:在项目的 `benchmarks/<benchmark_id>/` 下(不在被测智能体目录内)创建 `benchmark_config.toml`" +
      "(title、description、runs = 1;不记录被测智能体)、" +
      "每题一个 `CASE-NNN-<slug>/`(`statement/README.md` 为题干,`rubric/README.md` 为评分细则,每题满分 100 分,细则不得泄露到题干)" +
      "以及 `scoreboard.yaml`(初始为 `evaluations: []`;每条 evaluation 记录被测的 `agent_id`、`version`、成对的 `provider` / `model_id` 与 `thinking_level`)。" +
      "每一次试测都必须通过 `run_subagent` 派发子会话,并在子会话的 prompt 里写明使用 `agent-evaluation` Skill——不要自己打分,也不要绕过这个技能;" +
      "逐题试测以校准难度,定稿后冻结并把 Formal Baseline 追加进 scoreboard.yaml,最后报告 Benchmark id、基线分数与各题分数。",
    // New Benchmark, manual mode: the form.
    manualCreateTitle: "手动创建 Benchmark",
    manualCreateIntro:
      "填好标题、题干与评分细则后,目录结构会按技能约定写入项目的 benchmarks/ 下;Benchmark 与 Agent 平级,之后可以用它评测任意智能体。",
    idField: "Benchmark id",
    idHint: "目录名即标识:仅字母、数字、_ 和 -,例如 report-writing-v1",
    /** The id field's generation clause: a Benchmark is named by its title, not a display name. */
    idGenerateHint: ";也可以从标题生成",
    idExists: "已有同名 Benchmark,请换一个 id",
    titleField: "标题",
    descriptionField: "描述",
    descriptionHint: "一句话说明考察什么能力、题目难在哪里",
    runsField: "每题运行次数",
    runsHint: "1–1000 的整数;优化时每道题跑这么多次取平均",
    runsInfo:
      "多次运行能把稳定的能力差距和偶然波动分开,但评测成本按次数倍增。AI 出题校准时固定每题 1 次;这里的值给之后的优化用。",
    casesTitle: "题目",
    casesInfo:
      "每道题分两部分:题干交给被测智能体;评分细则只有评测方能看到,永远不进被测智能体的 Workspace。",
    rubricInfo:
      "有区分度的评分细则:条目可观察、合计 100 分,把分数主要放在「真正做对」和「看起来做对」会产生不同结果的决定或产物上,不要给格式合规太高的保底分。",
    caseHeading: (n: number): string => `第 ${n} 题`,
    caseSlugField: "目录名后缀",
    caseSlugHint: (id: string): string => `目录名 ${id}:仅字母、数字、_ 和 -`,
    caseTitleField: "题目标题",
    caseStatementField: "题干",
    caseStatementHint: "Markdown;写明目标、给定材料、要求的产物与格式,不要暗示解法或评分点",
    caseRubricField: "评分细则",
    caseRubricHint: "Markdown;逐条给分并合计 100 分,如「- 40 分:……」",
    addCase: "添加题目",
    removeCase: "删除此题",
    createSubmit: "创建 Benchmark",
    created: "Benchmark 已创建",
    invalidId: "仅允许字母、数字、_ 和 -",
    invalidRuns: "必须是 1–1000 的整数",
    invalidScore: "必须是 1–100 的整数",
    // Use: one dialog with an Evaluate tab and an Optimize tab, over a single exit.
    useTitle: (title: string): string => `使用:${title}`,
    // Shared by both tabs.
    testedAgent: "被测智能体",
    // Evaluate tab.
    evaluateDescription:
      "AI 会把被测智能体放到这套 Benchmark 上跑完整的 Case × runs 矩阵,并把结果作为一条带标签的评估追加进记分。",
    evaluateTestedAgentHint:
      "评估的是它当下的 Agent State;分数记在它名下,标签含其版本号、模型与思考等级",
    evaluatorAgent: "执行评估的智能体",
    evaluatorAgentHint:
      "派发评测子会话、按评分细则打分并写入记分的一方;需要装有 agent-evaluation 技能",
    evaluatorMissingSkill:
      "该智能体没有安装 agent-evaluation 技能,多半无法完成评估——建议换用默认智能体,或先为它安装 agent-tuning 插件。",
    evaluateSessionModel: "评估会话使用的模型",
    evaluateSessionModelHint:
      "派发与汇总评测的模型,缺省为项目默认模型;被测智能体用的是它自己配置的模型,不在这里改",
    evaluateRunsHint: "每道题跑几次取平均;缺省为 Benchmark 配置的次数",
    evaluateNoteField: "说明",
    evaluateNotePlaceholder: "例如:这一轮用来确认上次优化的效果,重点看引用规范那两道题",
    /** The fixed tail: the `agent-evaluation` inputs, the label check and the single append. */
    evaluateTail: (p: { targetAgentId: string; benchmarkId: string; runs: number }): string =>
      "请使用 `agent-evaluation` Skill,在这套已冻结的 Benchmark 上评估被测智能体。\n\n" +
      `- test_agent_id:\`${p.targetAgentId}\`\n` +
      `- benchmark_id:\`${p.benchmarkId}\`(项目的 \`benchmarks/${p.benchmarkId}/\`,与 Agent 平级)\n` +
      `- runs:\`${p.runs}\`\n\n` +
      "通过 `run_subagent` 按完整的 Case × runs 矩阵评测,每个矩阵单元一个自调用的子会话(省略 `agent_id`),并在每个子会话的 prompt 里写明使用 `agent-evaluation` Skill——不要自己打分,也不要绕过这个技能;" +
      "评测 Runtime 取被测智能体当前配置的模型与思考等级。校验每条返回结果的 `agent_id`、`provider`、`model_id` 与 `thinking_level` 完全一致," +
      "不一致就停下、不要把不同标签混成一条。按记分契约求各题(runs 平均)与整体(各题平均)的分数," +
      "然后只向 `scoreboard.yaml` 追加一条 evaluation,记上 `agent_id`、`version`、`provider` / `model_id` 与 `thinking_level` 作为标签。" +
      "不修改被测智能体,也不修改 Benchmark。结束时报告总分、各题分数与本条记录的标签。",
    // Optimize tab.
    optimizeDescription: "AI 会按可证伪的假设修改被测智能体并重新评测,分数严格提升才保留新版本。",
    optimizerAgent: "执行优化的智能体",
    optimizerAgentHint: "读分数与 Trace、修改被测智能体的一方;需要装有 agent-optimization 技能",
    optimizerMissingSkill:
      "该智能体没有安装 agent-optimization 技能,多半无法完成优化——建议换用默认智能体,或先为它安装 agent-tuning 插件。",
    testedAgentHint: "优化改的是它的 Agent State;分数记在它名下,只与它自己同标签的历史分数比较",
    sessionModel: "优化会话使用的模型",
    sessionModelHint:
      "做分析与改动的模型,缺省为项目默认模型;评测被测智能体时沿用基线记录的模型,不在这里改",
    optimizeRunsHint: "每个候选版本每道题跑几次取平均",
    roundLimitField: "最多轮数",
    roundLimitHint: "每轮一个改动;评测完整才算一轮",
    targetScoreField: "目标分数",
    targetScoreHint: "达到即提前结束;默认比当前基线高 10 分",
    focusField: "优化重点",
    focusPlaceholder: "例如:重点优化引用规范与格式合规,不要改动写作风格",
    noBaseline:
      "所选被测智能体在这套 Benchmark 上还没有基线分。优化需要一条完整的基线评估作为比较起点——先到「评估」跑一次完整评测取得基线。",
    baselineLine: (score: string, target: number): string => `当前基线 ${score} · 目标 ${target}`,
    /** The fixed tail: the `agent-optimization` inputs, the acceptance rule and the report. */
    optimizeTail: (p: {
      targetAgentId: string;
      benchmarkId: string;
      runs: number;
      roundLimit: number;
      targetScore: number;
    }): string =>
      "请使用 `agent-optimization` Skill,针对已冻结的 Benchmark 优化被测智能体。\n\n" +
      `- test_agent_id:\`${p.targetAgentId}\`\n` +
      `- benchmark_id:\`${p.benchmarkId}\`(项目的 \`benchmarks/${p.benchmarkId}/\`,与 Agent 平级)\n` +
      `- runs:\`${p.runs}\`\n` +
      `- desired_score:\`>=${p.targetScore}\`\n` +
      `- candidate_round_limit:\`${p.roundLimit}\`\n\n` +
      "每轮从当前 Reference 出发提出一个可证伪的假设、只做一个有界改动;通过 `run_subagent` 评测完整的 Case × runs 矩阵,每个子会话的 prompt 里都写明使用 `agent-evaluation` Skill——不要自己打分,也不要绕过这个技能;" +
      "评测沿用该被测智能体基线记录的 provider / model_id / thinking_level;仅当总分严格高于 Reference 时保留该版本," +
      "并把记有 `agent_id`、`version`、`provider` / `model_id` 与 `thinking_level` 的 evaluation 追加到 scoreboard.yaml,否则回滚。" +
      "结束时报告优化前后的分数、保留的版本号,以及每轮的改动与取舍。",
  },

  // Server error code → localized copy (the server's message is hardcoded Chinese; this is only a fallback for unknown codes).
  /** Company mode: the organization switcher and dialogs, and the six organization pages. */
  company: {
    /** The mode switch (top-left of the sidebar, above the Project switcher) and its two options. */
    workMode: "工作模式",
    modeDev: "开发",
    modeCompany: "公司",
    switchToCompany: "切换到公司模式",
    switchToDev: "切换到开发模式",
    /**
     * Company mode is a beta, said in three shapes: the mini tag at the top-right of 「公司」 in
     * the work-mode switch (and the suffix the collapsed rail's tooltip carries in its place),
     * the tag's own tooltip, and the one sentence shown both under the admin's master switch
     * and as the notice a person gets the first time they enter the mode.
     */
    beta: "内测版",
    betaTitle: "公司模式是内测功能,可能有不稳定的现象",
    betaNotice: "内测功能:可能有不稳定的现象,遇到问题请反馈。",
    /** The organization switcher that replaces the Project switcher in company mode. */
    switcher: "组织",
    noOrganizations: "还没有组织",
    createOrg: "新建组织",
    orgSettings: "组织设置",
    orgInvalid: "配置无效",
    orgPaused: "已暂停",
    /** The switcher's check mark beside the open organization (sr text). */
    switcherCurrent: "当前组织",
    /** `<project> / <org>` in the switcher: the Project half of the label. */
    inProject: (project: string, org: string): string => `${project} / ${org}`,
    /** The empty landing of `/org` when the user has no organization anywhere. */
    landingTitle: "公司模式",
    landingBody:
      "组织是一群员工 Agent 按汇报线协作:一位 CEO、它招募的员工、共享的看板与频道,以及驱动它们的日程。新建一个组织,先和 CEO 谈谈使命。",
    /** The page a stale deep link lands on: the organization it names is gone. */
    orgGoneTitle: "组织不存在",
    orgGoneBody: "它可能已被删除,或者你不再能访问它所属的项目。",
    backToOrgs: "回到组织列表",
    /** Create dialog. */
    createTitle: "新建组织",
    orgId: "组织 id",
    orgIdHint: "2~64 位:小写字母开头,仅小写字母、数字与下划线;也是目录名,创建后不可修改",
    displayName: "显示名",
    displayNameHint: "留空则使用组织 id",
    mission: "使命",
    missionHint: "一句话说明这个组织存在的目的;CEO 的初始化会话从它开始",
    missionPlaceholder: "例如:为 Adelie 维护文档站,并每周发布一期更新摘要",
    /** The three examples under the mission field (org-examples.ts holds their order). */
    missionExampleHint: "点一下填入使命",
    missionExamples: {
      research: {
        name: "科研论文公司",
        mission:
          "新建一个公司帮我做科研,产出可以投稿顶级会议的学术论文。实验按 autoresearch 的方式跑:先固定评测脚本与指标,只改一个文件,每次实验限定时长,结果逐行记入日志,只保留有提升的改动。开始任何实验循环之前,研究员先在群里向我申请资源——机器与 GPU/CPU、并发数、总时长、磁盘与数据、付费 API——批准后在额度内自主运行,要超出就再申请。论文由作者与审稿人两类员工对抗评审:审稿人复现结果、查基线与消融、找测试集泄漏与指标作弊,给出评分与必改项;作者逐条修改或反驳,直到审稿人接受。",
      },
      agentTuning: {
        name: "Agent 优化公司",
        mission: "新建一个公司帮我优化产品 Agent,提高 Agent 在实际业务中的准确度和产品体验",
      },
      cloudReseller: {
        name: "云服务转售站",
        mission:
          "新建一个公司帮我运营一个类似云服务的网站,收集市面上所有的低价服务,并且加价以后打包出售,目的是帮我赚钱,并且要提高站点的 SEO 和曝光程度",
      },
      mirror: {
        name: "员工数字分身公司",
        mission:
          "新建一个公司,作为我们现实公司的镜像:我会把现实公司的组织图告诉 CEO,CEO 为每位现实员工创建一个数字分身;每个分身的工位会话绑定到那位同事的飞书机器人。分身默认只被动接收自己同事的消息,能自己解决的就直接回答,解决不了的转给相关同事的分身、再由对方分身转给真人。CEO 不主动招募、不排日程、不开工单,公司只做传话和自主解决问题。",
      },
    },
    createdOpeningCeo: "组织已创建,正在打开 CEO 的工位会话",
    /** Create and settings dialogs: the model and the shared workspace, both optional. */
    modelField: "模型",
    modelInfo:
      "工位会话与工单会话默认使用的模型;员工在组织图里另有指定时以员工的为准。改动从下一次工作轮起生效。",
    modelHint: "留空则使用项目的默认模型",
    /** The picker offers models only, so the way back to the Project default is its own control. */
    modelClear: "改回项目默认",
    /** The stored model is no longer in the Project's model list. */
    modelStale: "这个模型已不在项目的模型列表里",
    modelProjectDefault: "项目默认",
    modelProjectDefaultNamed: (name: string): string => `项目默认(${name})`,
    modelsLoadFailed: "模型列表读取失败;仍可按项目默认模型创建",
    workspaceField: "公司工作区",
    workspaceInfo:
      "员工共同工作的目录:每位员工的工作区是它的一个子目录(或整个目录),工位会话与工单会话都在其中运行。",
    workspaceEmpty: "组织自己的 workspace/ 目录",
    workspaceClear: "使用组织自己的目录",
    /** CEO budget field (create dialog): the CEO's ceiling is the company's, since everyone reports to it. */
    ceoBudget: "CEO 预算",
    ceoBudgetHint: "每月上限;CEO 的预算就是整家公司的预算",
    /** The create dialog's draft (org-draft.ts): restored on reopen, dropped on create or on demand. */
    draftRestored: "已恢复上次未提交的草稿",
    clearDraft: "清空草稿",
    creating: "创建中…",
    /** Settings dialog (the switcher's entry). */
    settingsTitle: "组织设置",
    timezone: "时区",
    timezoneHint: "IANA 时区名,如 Asia/Shanghai;预算周期(自然月)与频道日志按它划分",
    language: "工作语言",
    languageInfo:
      "组织的工作语言:手册、员工简报、CEO 初始化会话与各工位的输出都用这个语言;创建时按使命的语言自动判断。",
    languages: {
      zh: "中文",
      en: "English",
    },
    approvalMode: "审批模式",
    approvalModeInfo:
      "工位会话与工单会话的工具审批口径。无人值守的运行不会停下来等人拍板,所以这里没有「总是询问」。",
    approvalModes: {
      "allow-all": "全部放行",
      "read-only": "只读",
      "deny-all": "全部拒绝",
    } as Record<string, string>,
    status: "状态",
    statusActive: "运行中",
    statusPaused: "已暂停",
    pause: "暂停组织",
    resume: "恢复组织",
    deleteOrg: "删除组织",
    deleteOrgDesc: "把组织移入项目的回收目录。员工保留为 Agent,对话也保留。",
    deleteOrgConfirm:
      "组织会从公司模式里消失。组织的文件移入项目的回收目录(organizations/.trash),可以手工移回来恢复。员工仍是项目的 Agent;工位与工单的对话会保留,但组织不在了,就没有页面再列出它们。要再次使用这个 id,需先删除旧 CEO 的 Agent。只是想让组织停下来而不丢任何东西,请改用暂停。",
    deleteOrgTypeId: (orgId: string) => `输入 ${orgId} 以确认`,
    deleted: (orgId: string) => `组织 ${orgId} 已删除`,
    pauseInfo:
      "暂停后所有自动触发停止——日程不再到点、@ 不再送达员工;你仍可以打开任意工位会话直接对话。组织只会被暂停,不会被删除:它的对话、员工与工单始终可以回去看。",
    settingsLoadFailed: "组织设置读取失败",
    /** Employee state dot, and the CEO mark. */
    employeeStates: {
      running: "运行中",
      idle: "在岗",
      paused: "预算暂停",
    } as Record<string, string>,
    ceo: "CEO",
    reportsTo: (name: string): string => `汇报给 ${name}`,
    openDesk: "打开工位会话",
    openingDesk: "正在打开工位会话…",
    /** Principals as the chat and tickets name them. */
    principalSystem: "系统",
    principalAll: "所有人",
    /** A data path in a ticket drawn as a capsule: the hover names the whole path, a click copies it. */
    pathCapsule: {
      hint: (path: string): string => `${path}\n点击复制完整路径`,
      copy: (path: string): string => `复制路径 ${path}`,
    },
    /** Spend against a budget, and the unbounded case. */
    spendOfBudget: (spend: string, budget: string): string => `${spend} / ${budget}`,
    noBudget: "不限",
    /**
     * A budget is a monthly cap the server keeps in USD. A budget box speaks the currency the
     * reader picked, so the unit rides after the box, and a box in CNY says under itself what
     * it will actually store.
     */
    budgetUnit: (symbol: string): string => `${symbol} / 月`,
    budgetStoredAs: (amount: string): string => `存为 ${amount} / 月`,
    /** The 工位 group under the company sidebar's channel list: one row per employee. */
    sessionList: {
      desks: (n: number): string => `工位(${n})`,
      deskOf: (name: string): string => `${name} 的工位`,
      running: "运行中",
      noEmployees: "这个组织还没有员工",
      untitledSession: "未命名会话",
      loadFailed: "员工列表加载失败",
      /** The group below the desks listing the ticket sessions opened from a ticket, each kept until removed. */
      temporary: (n: number): string => `临时(${n})`,
      /** A Temporary entry's name on the collapsed rail, where no group header says where it belongs. */
      temporaryEntry: (title: string): string => `临时 · ${title}`,
      closeTemporary: "从「临时」中移除",
      /** The Temporary group header's action: removes every entry at once; the sessions themselves are kept. */
      closeAllTemporary: "全部关闭",
    },
    overview: {
      title: "概览",
      info: "组织的全局一页:员工、看板、今日日程与本周期预算,以及需要你拍板的事。每块角上有一个按钮,点它进对应页面。",
      employees: "员工",
      onDesk: "在岗",
      running: "运行中",
      paused: "预算暂停",
      board: "看板",
      blocked: "被阻塞",
      today: "今日日程",
      todayEmpty: "今天没有日程",
      spend: "本周期支出",
      reviewTickets: "审核中的工单",
      alerts: "告警",
      alertsEmpty: "本周期没有预算告警",
      /** A fresh organization: point the user at the CEO. */
      firstStep: "组织刚建立:先打开 CEO 的工位会话,确认使命、招募员工并安排日程。",
      /** The hero: who made it, how big it is, which period the spend counts. */
      createdBy: (user: string): string => `由 ${user} 创建`,
      employeesCount: (n: number): string => `${n} 位员工`,
      period: (period: string): string => `${period} 周期`,
      openCeoDesk: "打开 CEO 工位",
      refreshFailed: "刷新失败,显示的是上次读取的数据",
      /** The hero's mission, clamped to one line until the toggle opens it. */
      mission: "使命",
      expand: "展开",
      collapse: "收起",
      /** The KPI strip. */
      openTickets: "未完结工单",
      boardTotal: (n: number): string => `共 ${n} 张`,
      todayCount: (n: number): string => `${n} 项`,
      upcoming: "待触发",
      failed: "未按时",
      budgetLeft: (amount: string): string => `剩余 ${amount}`,
      overBudget: (amount: string): string => `超支 ${amount}`,
      /** The corner button of a KPI cell and of the hero's spend block: where it jumps to. */
      openChart: "打开组织图",
      openBoard: "打开工单看板",
      openCalendar: "打开日历",
      openFinance: "打开财务",
      /** The tooltip of an inbox row's title: the row is inert, its title is what goes there. */
      openTicket: "查看工单",
      openChannel: "打开频道",
      /** The counts under the board bar: each opens the board filtered to the column it counts. */
      openColumn: (column: string): string => `查看「${column}」的工单`,
      /** The three first steps of a new organization (replaces the empty sections). */
      firstStepsTitle: "三步上手",
      firstStepsInfo:
        "组织刚建立时的引导:和 CEO 谈使命、招募员工、安排日程。招到第一位员工或开出第一张工单后,这里换成日常仪表盘。",
      stepCeoTitle: "和 CEO 谈使命",
      stepCeoBody: "打开 CEO 的工位会话,确认使命,让它提出组织结构与首批工单。",
      stepHireTitle: "招募员工",
      stepHireBody: "在组织图里为 CEO 招募下属:选已有 Agent 或新建一个,给头衔与预算。",
      stepScheduleTitle: "安排日程",
      stepScheduleBody: "在日历里为员工安排巡检:到点即向它的工位会话发送提示词。",
      stepDone: "已完成",
      goToChart: "去组织图",
      goToCalendar: "去日历",
      /** The inbox: what names the reader, what is stuck and what has landed, newest first. */
      inbox: "收件箱",
      inboxInfo:
        "按时间倒序列出组织要对你说的三件事:全员频道里 @我(或 @所有人)的消息、被阻塞的工单、本周期已完成的工单。其余的去频道与看板本身看。",
      inboxEmpty: "收件箱是空的",
      /** The filter chips over the rows, each with its own count. */
      inboxFilters: { all: "全部", mention: "@我", blocked: "阻塞", done: "已完成" },
      /** The chip that leads a row, naming what the row is. */
      inboxCategories: { mention: "@我", blocked: "阻塞", done: "已完成" },
      /** Today's timeline. */
      timelineMore: (n: number): string => `还有 ${n} 项,打开日历查看`,
    },
    calendarOutcomes: {
      fired: "已触发",
      queued: "排队",
      paused: "已暂停",
      missed: "已错过",
      error: "出错",
    } as Record<string, string>,
    chart: {
      title: "组织图",
      info: "员工树即汇报线:CEO 为根,每个节点是一位员工 Agent。节点右上角的菜单里是「打开工位会话」和人事操作,每一项人事操作都会改写组织图文件。画布可滚轮缩放、拖拽平移;点右上角的百分比回到适应窗口。",
      empty: "组织图为空",
      nodeMenu: "员工操作",
      hire: "招募下属",
      setBudget: "设预算",
      changeReportsTo: "调整汇报线",
      renewDesk: "换工位",
      leave: "离任",
      ceoCannotLeave: "CEO 不能离任",
      invalidEntry: "该条目无效",
      workspaceTail: "工作区",
      /** Hire dialog. */
      hireTitle: (manager: string): string => `为 ${manager} 招募下属`,
      hireSource: "来源",
      hireExisting: "选择已有 Agent",
      hireNew: "新建 Agent",
      agent: "Agent",
      pickAgent: "选择 Agent…",
      noAgentsLeft: "本项目没有可招募的 Agent",
      agentId: "Agent id",
      agentIdHint: "2~64 位:小写字母开头,仅小写字母、数字与下划线",
      agentName: "名称",
      agentNameHint: "留空则使用 Agent id",
      agentDescription: "描述",
      plugins: "插件",
      pluginsHint: "缺省安装 agent-company(组织流程)与 agent-development(开发技能)",
      pluginsPlaceholder: "未选择插件",
      pluginsPicked: (n: number): string => `已选 ${n} 个插件`,
      pluginsEmpty: "插件库暂无可安装的插件",
      employeeTitle: "头衔",
      employeeTitlePlaceholder: "例如:文档工程师",
      duties: "职责",
      dutiesHint: "写进组织图,员工每次工作轮都会读到",
      workspace: "工作区",
      workspaceHint: "公共工作区下的子目录(`.` 为整个公共工作区),或一个已存在的绝对路径",
      /** Hiring: the same spec, with the default the server fills in when the field is left empty. */
      hireWorkspaceHint:
        "公共工作区下的子目录,或一个已存在的绝对路径;留空即以该员工的 Agent id 命名的子目录",
      budget: "月预算",
      budgetHint: "每月上限,留空为不限;口径是本人加全部下属的累计支出",
      hireConfirm: (name: string, manager: string): string =>
        `将 ${name} 加入组织,汇报给 ${manager}?会改写组织图文件。`,
      hired: (name: string): string => `已招募 ${name}`,
      /** Budget / reporting line / desk renewal / leave dialogs. */
      budgetTitle: (name: string): string => `设置 ${name} 的预算`,
      budgetConfirm: (name: string, budget: string): string =>
        `将 ${name} 的月预算改为 ${budget}?超过 80% 告警,达到 100% 暂停其自动触发。`,
      reportsToTitle: (name: string): string => `调整 ${name} 的汇报线`,
      reportsToConfirm: (name: string, manager: string): string =>
        `让 ${name} 改为汇报给 ${manager}?其下属随之一起移动。`,
      reportsToCycle: "不能汇报给自己或自己的下属",
      renewDeskTitle: (name: string): string => `为 ${name} 换工位`,
      renewDeskExplain: "换工位会开一个新的工位会话并重置上下文;改了工作区就写入员工树。",
      workspaceInvalid: "工作区无效:需要是公共工作区下的子目录,或一个已存在的绝对路径。",
      renewed: "已换到新的工位会话",
      leaveConfirm: (name: string): string =>
        `让 ${name} 离任?它会移出组织图,其下属改为汇报给它的上级;Agent 本身与所有会话保留。`,
      left: (name: string): string => `${name} 已离任`,
      saved: "组织图已更新",
      /** The page: the canvas and its zoom control, the legend, counts, a failed refresh, the detached row. */
      canvas: "组织图画布",
      zoom: "缩放",
      zoomIn: "放大",
      zoomOut: "缩小",
      zoomFit: "适应窗口",
      legend: "运行态图例",
      employeeCount: (n: number): string => `${n} 位员工`,
      spend: "本周期支出",
      refreshFailed: (error: string): string => `刷新失败:${error}`,
      detached: "上级不在组织图中",
      detachedNotice: (n: number): string =>
        `${n} 位员工的汇报线接不到 CEO:上级已离开组织,或汇报线成环。用「调整汇报线」把它们接回员工树。`,
      /** Hire and edit dialogs: the two sections, the current value, and the field hints. */
      hireAgentSection: "Agent",
      hirePositionSection: "职位",
      agentHint: "只列出本项目中尚未加入组织的 Agent",
      budgetPlaceholder: "例如 30",
      clearBudget: "设为不限",
      currentValue: (value: string): string => `当前:${value}`,
      manager: "上级",
      reportsToHint: "只列出不在其下属范围内的员工",
    },
    calendar: {
      title: "日历",
      info: "全员日程项的月 / 周 / 日视图。每条日程属于一位员工,到点即向它的工位会话发送提示词;颜色按员工区分,已过去的实例标出触发结果。日程驱动员工的工位会话按时巡检看板、推进工单,点右上角「新建日程」为某位员工安排一条。",
      month: "月",
      week: "周",
      day: "日",
      today: "今天",
      prev: "上一段",
      next: "下一段",
      allEmployees: "全部员工",
      filterEmployee: "按员工筛选",
      create: "新建日程",
      createTitle: "新建日程",
      editTitle: (name: string): string => `编辑日程「${name}」`,
      employee: "员工",
      name: "名称",
      nameHint: "即文件名(不含 .toml),创建后不可改",
      prompt: "提示词",
      enabled: "启用",
      startAt: "开始时间",
      endAt: "结束时间",
      period: "周期",
      periodHint: "30m / 12h / 7d,留空为一次性;最短 5m",
      delete: "删除日程",
      deleteConfirm: (name: string): string => `确认删除日程「${name}」?`,
      saveConfirm: (name: string): string => `保存日程「${name}」?会改写它的日程文件。`,
      outcome: "结果",
      lastFired: "最近触发",
      nextFire: "下次触发",
      past: "已过去",
      pausedNote: "已暂停:到点跳过,不触发",
      disabledNote: "已停用",
      invalidFiles: "解析失败的日程文件",
      empty: "还没有日程",
      emptyHint:
        "日程驱动员工的工位会话按时巡检看板、推进工单,点右上角「新建日程」为某位员工安排一条。",
      moreEvents: (n: number): string => `还有 ${n} 项`,
      /** The month cell's "+N more" is a button: its accessible name, and the day panel it opens. */
      moreEventsExpand: (n: number): string => `还有 ${n} 项,展开`,
      openDay: "查看当天",
      weekdays: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] as readonly string[],
      allDay: "全天",
      promptHint: "写下你希望员工在这一刻做的巡检,例如:检查看板、推进自己的工单、在频道汇报",
      monthTitle: (year: number, month: number): string => `${year} 年 ${month} 月`,
      /** How an event recurs, for the legend: the period read as a cadence with the time of day. */
      cadence: {
        once: "一次性",
        minutes: (n: number): string => `每 ${n} 分钟`,
        hours: (n: number): string => `每 ${n} 小时`,
        daily: (time: string): string => `每天 ${time}`,
        days: (n: number, time: string): string => `每 ${n} 天 ${time}`,
        weekly: (time: string): string => `每周 ${time}`,
        weeks: (n: number, time: string): string => `每 ${n} 周 ${time}`,
        invalid: "周期无效",
      },
      legendEmpty: "还没有日程",
      legendFilter: (name: string): string => `只看 ${name} 的日程`,
      createAt: (label: string): string => `在 ${label} 新建日程`,
      loadFailed: (error: string): string => `日历加载失败:${error}`,
      /** The "×" that puts the empty-calendar note away for good (the same sentence stays in the page's "?"). */
      dismissHint: "知道了",
      /** Under the start time: why two employees should not share one minute. */
      staggerHint:
        "错峰安排:给每位员工各自的时刻,不要让多位员工在同一分钟触发,避免争抢预算与工单。",
      /** Heads the advisory lines a calendar write answers with (the lines themselves come from the server, in English). */
      warningsPrefix: "排班提醒",
    },
    tickets: {
      title: "工单",
      info: "五列看板即工单的生命周期:提议 → 进行中 → 审核中 → 已完成 / 已拒绝。点卡片在原地弹出详情窗口,把卡片拖到另一列即可移列(触屏上先长按卡片再拖);被阻塞的工单留在原列并带角标。工单是组织的工作单位:点右上角「新建工单」建一张并指定负责人,它的工位会话会为这张工单发起工单会话。",
      columns: {
        proposed: "提议",
        in_progress: "进行中",
        review: "审核中",
        done: "已完成",
        rejected: "已拒绝",
      } as Record<string, string>,
      blockedOnly: "只看被阻塞",
      create: "新建工单",
      createTitle: "新建工单",
      empty: "还没有工单",
      emptyHint:
        "工单是组织的工作单位:点右上角「新建工单」建一张并指定负责人,它的工位会话会为这张工单发起工单会话。",
      /** The "×" that puts the empty-board note away for good (the same sentence stays in the page's "?"). */
      dismissHint: "知道了",
      columnEmpty: "空",
      ticketTitle: "标题",
      goal: "目标",
      goalHint: "要达成什么,一段话即可",
      acceptance: "验收标准",
      acceptanceHint: "怎样算完成;审核时逐条核对",
      result: "结果",
      owner: "负责人",
      noOwner: "未指定",
      /** The create dialog's default owner: whoever is filing the ticket. */
      ownerSelf: "自己",
      ownerSelfHint: "留空则为自己",
      parent: "父工单",
      noParent: "无",
      notify: "通知人",
      notifyHint: "逗号分隔的主体,如 agent:ceo, user:alice;状态变化时通知",
      priority: "优先级",
      due: "截止",
      noDue: "无",
      blocked: "被阻塞",
      blockedReason: "阻塞原因",
      blockedBy: "等谁",
      blockedTooltip: (reason: string, by: string): string => `被阻塞:${reason}(等 ${by})`,
      unblock: "解除阻塞",
      unblockConfirm: (title: string): string => `解除「${title}」的阻塞?`,
      block: "标记阻塞",
      blockTitle: "标记阻塞",
      blockReasonHint: "一句话说明卡在哪里",
      blockByHint: "等哪张工单或哪位主体",
      sessions: "关联工单会话",
      sessionsCount: (n: number): string => `${n} 个会话`,
      openSession: "打开会话",
      /** The row action of a child ticket, and the tooltip of every ticket title that opens one. */
      openTicket: "打开工单",
      progress: "进度",
      progressEmpty: "还没有进度记录",
      addProgress: "追加进度",
      progressPlaceholder: "一句话记下进展…",
      children: "子工单",
      childrenEmpty: "没有子工单",
      cost: "本单成本",
      rolledUpCost: "总成本",
      /** The card's muted parent line; the drawer names the parent in a labelled field instead. */
      parentLine: (title: string): string => `父工单:${title}`,
      moveTitle: "移动工单",
      moveConfirm: (title: string, column: string): string => `将「${title}」移到「${column}」?`,
      rejectReason: "拒绝理由",
      rejectReasonHint: "一句话说明为什么拒绝,记入工单的结果",
      moved: "工单已移动",
      invalid: "该工单无效:状态与所在列不符,或 id 重复",
      invalidFiles: "无法解析的工单文件",
      edit: "编辑字段",
      saveConfirm: (title: string): string => `保存对「${title}」的修改?会改写工单文件。`,
      saved: "工单已保存",
      created: "工单已创建",
      detail: "工单详情",
      /** Header control of the detail dialog: back to the ticket this one was opened from (a parent, a child). */
      back: "返回",
      dragHint: "拖到另一列即可移动",
      searchPlaceholder: "搜索标题或 id",
      searchNoMatch: "没有匹配的工单",
      dropHere: "拖到这里",
      overdue: "已逾期",
      summary: "基本信息",
      history: "操作历史",
      historyEmpty: "还没有操作记录",
      /** The frontmatter's history actions; a history line names one and nothing else. */
      historyActions: {
        created: "创建",
        assigned: "指派给",
        moved: "移到",
        blocked: "阻塞",
        unblocked: "解除阻塞",
        progress: "写进展",
        session_started: "发起会话",
        session_attached: "挂接会话",
        edited: "编辑",
      } as Record<string, string>,
      slug: "id 短名",
      slugHint: "小写英文单词用连字符连接,如 marketplace-site;不能有数字,留空则由标题生成",
      slugInvalid: "只能用小写英文单词,以连字符连接,不能有数字",
      noGoal: "还没有写目标",
      noAcceptance: "还没有写验收标准",
      noResult: "还没有结果",
      moveTo: "移到…",
      move: "移动",
      copyId: "复制工单 id",
      invalidTickets: "无效的工单",
      loadFailed: (error: string): string => `看板加载失败:${error}`,
    },
    finance: {
      title: "财务",
      info: "预算按员工设置,口径是本人加全部下属的累计支出;周期为自然月(组织时区)。达到 80% 告警,达到 100% 暂停该员工的自动触发。",
      period: "周期",
      thisPeriod: "本周期",
      prevPeriod: "上周期",
      total: "合计",
      unpriced: "* 部分用量使用了未配置价格的模型,成本为下限",
      budget: "预算",
      editBudget: "编辑预算",
      budgetPlaceholder: "不限",
      clearBudget: "清空",
      budgetSaved: "预算已更新",
      own: "本人支出",
      cumulative: "累计支出",
      /** The spend tree reads cumulative against budget in one column; own spend rides in the row tooltip. */
      cumulativeBudget: "累计成本 / 预算",
      ratio: "占比",
      warned: "已告警",
      paused: "已暂停",
      spendTree: "支出树",
      spendTreeInfo: "沿汇报线展开:累计支出包含全部下属,预算与占比按同一口径。",
      ticketsTable: "工单支出",
      ticketsInfo: "每张工单的贡献会话成本;总成本沿父工单累加。挂到多张工单的会话按份数分摊。",
      ticketsEmpty: "本周期没有工单支出",
      rolledUp: "总成本",
      /** The ledger's fold: child tickets are hidden until the parent's chevron opens them. */
      expandChildren: "展开子工单",
      collapseChildren: "收起子工单",
      childCount: (n: number): string => `${n} 张子工单`,
      trend: "趋势",
      alerts: "告警与暂停",
      alertsEmpty: "本周期没有告警",
      alertWarned: (name: string, at: string): string => `${name} 于 ${at} 达到预算 80%`,
      alertPaused: (name: string, at: string): string =>
        `${name} 于 ${at} 达到预算上限,已暂停自动触发`,
      alertsHint: "解除方式:调高该员工的预算,或清空预算;下一次巡检自动恢复。",
      /** The KPI row under the title. */
      kpiTotal: "合计支出",
      orgBudget: "组织预算(CEO)",
      kpiEmployees: "员工",
      budgetsSet: (n: number): string => `${n} 人设了预算`,
      thresholds: "达到 80% 告警,达到 100% 暂停",
      kpiAlerts: "告警",
      alertsSummary: (warned: number, paused: number): string => `${warned} 告警 · ${paused} 暂停`,
      /** Column header explanations, and the tree's root mark. */
      cumulativeInfo: "本人加全部下属的支出之和;预算与占比按这个口径。",
      rolledUpInfo: "本工单与子工单的成本之和。",
      root: "根",
      /** The inline budget editor. */
      budgetEmptyHint: "留空为不限",
      saveBudget: "保存预算",
      cancelEdit: "取消",
      editBudgetOf: (name: string): string => `编辑 ${name} 的预算`,
      /** The ticket table's owner column and row action. */
      openTicket: "打开工单",
      /** The trend section. */
      trendInfo: "组织全部会话每天的成本合计,按组织时区分日;只画有支出的日子。",
      trendEmpty: "本周期还没有支出记录",
      /** The alert list. */
      alertsInfo:
        "每次巡检核对累计支出与预算:达到 80% 记一次告警,达到 100% 暂停该员工及其下属的自动触发;解除后自动恢复。",
      pausedGroup: "已暂停自动触发",
      warnedGroup: "已告警",
      warnedAt: (at: string): string => `${at} 达到 80%`,
      pausedAt: (at: string): string => `${at} 达到 100%`,
      /** A refetch failed while the last good data is still on screen. */
      refreshFailed: "刷新失败,显示的是上次加载的数据",
    },
    /**
     * Channels — company mode's home surface. The sidebar lists them where development mode
     * lists conversations; the channel view holds the header, the message stream and the
     * composer. The all-hands channel's stored name is never shown: `allHands` is its label
     * everywhere.
     */
    channels: {
      /** The sidebar's list, its groups and the dialog above it. */
      listTitle: "频道",
      /** The phone drawer's hamburger, which opens the channel list (development mode names it S.chat.sessionList). */
      drawerLabel: "频道列表",
      allHands: "全员频道",
      mine: "我的频道",
      others: "其他频道",
      archivedGroup: "已归档",
      newChannel: "新建频道",
      noChannels: "还没有频道",
      loadFailed: "频道列表加载失败",
      join: "加入",
      joining: "加入中…",
      joined: "已加入频道",
      joinTitle: "加入频道",
      joinConfirm: "加入后你会收到这个频道里 @你 的消息,也能在这里发言。",
      /** A row's badges, and the sentence they lend to its accessible name. */
      mentionChip: "@我",
      badgeUnread: (n: number): string => `${n} 条未读`,
      badgeMentions: (n: number): string => `${n} 条 @我`,
      /** The channel header and what its controls do. */
      streamLabel: (name: string): string => `「${name}」的消息`,
      purpose: "主题",
      purposeEmpty: "还没有写主题",
      memberCount: (n: number): string => `${n} 人`,
      memberList: "频道成员",
      invite: "邀请",
      inviteTitle: "邀请到频道",
      inviteSearch: "搜索员工或成员",
      inviteEmpty: "没有可邀请的人了",
      invited: (name: string): string => `已邀请 ${name}`,
      leave: "离开",
      leaveTitle: "离开频道",
      leaveConfirm: (name: string): string =>
        `确认离开「${name}」?你仍然可以阅读,但不会再收到 @,也不能发言,直到重新加入。`,
      left: "已离开频道",
      channelMenu: "频道操作",
      rename: "重命名",
      renameTitle: "重命名频道",
      editPurpose: "改主题",
      purposeTitle: "修改频道主题",
      archive: "归档",
      unarchive: "取消归档",
      archiveTitle: "归档频道",
      archiveConfirm: (name: string): string =>
        `确认归档「${name}」?归档后频道只读,并折叠进「已归档」,随时可以取消归档。`,
      archived: "频道已归档",
      unarchived: "已取消归档",
      archivedNotice: "这个频道已归档,只读。取消归档后才能继续发言。",
      notMemberNotice: "你还不是这个频道的成员。加入后才能发言。",
      channelLoadFailed: "频道加载失败",
      /** The "?" beside the channel name, in its two kinds. */
      allHandsInfo:
        "全员频道随组织一起创建:组织里的每个人都在这里——每位员工、每位项目成员,你也在这里看——谁也不能退出,也不能归档;预算告警等系统通知都发在这里。",
      channelInfo:
        "受邀频道:员工只能由成员邀请进来,@ 也只在频道成员之间送达;人可以自行加入,并且可以阅读任何频道。",
      /** Why the all-hands channel's menu has no archive row; what that channel IS stays in the "?" above. */
      allHandsNoArchive: "全员频道不可归档",
      /** The new-channel dialog. */
      createTitle: "新建频道",
      creating: "创建中…",
      created: "频道已创建",
      idField: "频道 id",
      idHint: "2–64 个字符:小写字母开头,仅小写字母、数字和下划线",
      idReserved: "default_channel 留给全员频道",
      idTaken: "这个 id 已经被占用",
      nameField: "显示名",
      nameHint: "留空则用 id",
      purposeHint: "一句话说明这个频道是做什么的",
      /** The message stream. */
      empty: "还没有消息",
      emptyHint:
        "只有 @ 才会打扰员工:@某位员工 送进它的工位会话,@all 送给频道里所有成员;不带 @ 的消息只是留言。",
      placeholder: "输入消息,Enter 发送,Shift+Enter 换行,@ 提及成员",
      send: "发送",
      you: "你",
      mentionAll: "所有人",
      mentionAllDesc: "频道全部成员",
      employees: "员工",
      members: "成员",
      earlierDays: "更早的记录",
      ticketRef: (id: string): string => `工单 ${id}`,
      sessionRef: "查看会话",
      replyTo: "回复",
      /** The ref chips' tooltips: what the chip's own text does not say — where it lands. */
      openTicketRef: "查看工单",
      replyToJump: "跳到被回复的消息",
      hop: (n: number): string => `自动接力 · 第 ${n} 跳`,
      /** The chip's tooltip, and the one line about hops the channel header's "?" carries. */
      hopInfo:
        "这条消息由员工的工作轮自动发出,是一条 @ 连锁的第 N 跳:人或日程发起的消息是第 0 跳,员工被 @ 后在工作轮里的回复是第 1 跳(不标),再被 @ 的员工回复是第 2 跳……到达组织设置的连锁上限(缺省 3)后 @ 只记录、不再触发任何人,避免两个员工互相 @ 到天亮。",
      hopSummary:
        "被 @ 的员工在回复里再 @ 别人,就是一条 @ 连锁:从第 2 跳起消息会标出「自动接力 · 第 N 跳」,到达组织的连锁上限(缺省 3)后 @ 只记录、不再触发任何人。",
      /** Day separators, paging and the read cursor in the stream. */
      today: "今天",
      yesterday: "昨天",
      noEarlier: "没有更早的记录",
      unreadDivider: "以下为未读",
      newMessages: (n: number): string => `${n} 条新消息`,
      /** The composer's @ autocomplete. */
      mentionPanel: "提及",
      mentionsYou: "提到了你",
      /** Accessible name of a system banner and of a message's per-line time. */
      systemMessage: "系统消息",
      sentAt: (time: string): string => `发送于 ${time}`,
      /**
       * The system lines, one sentence per kind the server records (features/company/channel-notices.ts).
       * Principals arrive already resolved to display names; a period is `yyyy-mm` and the money
       * figures are the server's own, in USD.
       */
      notices: {
        employee_joined: (agent: string, title: string, manager: string): string =>
          `${agent} 以「${title}」身份加入,汇报给 ${manager}。`,
        employee_left: (agent: string, manager: string): string =>
          `${agent} 已离开组织,其下属改为汇报给 ${manager}。`,
        channel_created: (by: string): string => `${by} 创建了这个频道。`,
        channel_archived: (by: string): string => `${by} 归档了这个频道。`,
        channel_unarchived: (by: string): string => `${by} 取消了这个频道的归档。`,
        channel_joined: (principal: string): string => `${principal} 加入了频道。`,
        channel_invited: (by: string, principal: string): string =>
          `${by} 邀请 ${principal} 加入了频道。`,
        channel_left: (principal: string): string => `${principal} 离开了频道。`,
        channel_removed: (by: string, principal: string): string =>
          `${by} 把 ${principal} 移出了频道。`,
        budget_warned: (
          agent: string,
          percent: string,
          period: string,
          cost: string,
          budget: string,
        ): string =>
          `预算提醒:${agent} 已用掉 ${period} 预算的 ${percent}%(${cost} / ${budget} USD)。`,
        budget_paused: (
          agent: string,
          percent: string,
          period: string,
          cost: string,
          budget: string,
        ): string =>
          `预算暂停:${agent} 已达到 ${period} 预算的 ${percent}%(${cost} / ${budget} USD)。它与下属的日历已暂停,直到下个月或调高预算;@ 提及和直接对话仍然可用。`,
        ticket_blocked: (ticket: string, title: string): string =>
          `工单 ${ticket}(${title})被阻塞了。`,
        ticket_done: (ticket: string, title: string): string =>
          `工单 ${ticket}(${title})已完成。`,
        ticket_rejected: (ticket: string, title: string): string =>
          `工单 ${ticket}(${title})已被拒绝。`,
      },
    },
    /** The handbook page: the knowledge base directory, its index and its documents. */
    handbook: {
      info: "组织的知识库:handbook/ 目录下的 Markdown 文档。索引(README.md)是每次触发都会让员工 Agent 先读的那一页,其余文档由索引列出、按需再读。",
      /** The pinned first row: the index, and why it is pinned. */
      indexLabel: "索引 · 每轮先读",
      documents: "文档",
      /** The tree's own controls: closing every folder, and what a folder row's count means. */
      collapseAll: "全部折叠",
      documentsInFolder: (n: number): string => `${n} 篇文档`,
      noOtherDocuments: "还没有其他文档。新建一篇,并在索引里列出它。",
      emptyDocument: "这篇文档还是空的。",
      newDocument: "新建文档",
      creating: "创建中…",
      pathField: "路径",
      pathPlaceholder: "decisions/2026-09-02-hire-plan.md",
      pathHint:
        "相对于 handbook/ 的路径,用 / 分层;每段以字母或数字开头,仅字母、数字、. _ -;省略扩展名时补 .md。",
      pathInvalid: "路径无效:每段以字母或数字开头,仅字母、数字、. _ -,用 / 分层,最多八层。",
      pathExists: "该文档已存在。",
      documentCreated: "文档已创建",
      deleteDocument: "删除文档",
      deleteConfirm: (path: string): string =>
        `删除 ${path}?文档会从 handbook/ 目录移除;索引里指向它的条目不会自动更新。`,
      documentDeleted: "文档已删除",
      loadFailed: "手册加载失败",
      documentLoadFailed: "文档加载失败",
      /** Above the editor after a refused save: the server's reason, and that Save is the retry. */
      saveRefused: (reason: string) => `保存失败:${reason}`,
      /** The same refusal while the editor holds text the file does not: nothing typed was lost. */
      saveRefusedDraftKept: (reason: string) => `保存失败:${reason}(编辑器里的改动没有写进文件)`,
      /** A row's tooltip: when the file was last written, and its size. */
      updatedAt: (time: string, size: string): string => `更新于 ${time} · ${size}`,
      /** Beside the editor's buttons: what the text is, and the save shortcut (null while unbound). */
      editorHint: (shortcut: string | null): string =>
        shortcut === null ? "Markdown" : `Markdown · ${shortcut} 保存`,
    },
  },
  errors: {
    networkError: "网络错误,请检查连接",
    modelCredentialMissing: (modelId: string) =>
      `模型 ${modelId} 还没有可用的 API key,请先在「模型」页为它配置`,
    noDefaultModel: "该项目还没有默认模型,请先在「模型」页添加模型并设为默认",
    /** Localized text for the common server error codes (server error messages are English-only); looked up by ApiError.code in apiErrorText, falling back to the raw message for unmapped codes. */
    byCode: {
      invalid_credentials: "用户名或密码错误。",
      too_many_attempts: "登录失败次数过多,请稍后重试。",
      password_mismatch: "当前密码不正确。",
      invalid_password: "密码至少 8 位。",
      admin_required: "仅管理员可执行此操作。",
      desktop_single_user: "桌面应用为单用户模式,用户管理不可用。",
      not_found: "资源不存在,或你没有访问权限。",
      internal: "服务器内部错误,请稍后重试。",
      skill_dir_busy:
        "技能目录正被别的程序占着(编辑器、杀毒扫描,或从该目录启动的进程如 WPS 桥),无法替换;关掉它再试一次。",
      agent_not_found: "该 Agent 已不存在。",
      unknown_agent: "该 Agent 不存在于本项目。",
      agent_exists: "该 Agent id 已被占用。",
      agent_deleting: "该 Agent 正在删除中。",
      project_exists: "该项目 ID 已被占用。",
      project_not_found: "该项目已不存在,或你没有访问权限。",
      modelscope_refresh_failed: "魔搭授权连续自动续期失败,请在「模型」页重新授权。",
      cannot_delete_last_project: "这是最后一个项目,不能删除。",
      user_exists: "该用户名已被占用。",
      user_not_found: "该用户已不存在。",
      cannot_delete_admin: "内置 admin 不可删除。",
      member_not_found: "该用户不是本项目的成员。",
      already_member: "该用户已是本项目的成员。",
      already_owner: "该用户已是本项目的所有者。",
      memory_import_confirm_required: "本次导入会覆盖或删除已有记忆,请确认后继续。",
      schedule_exists: "已存在同名定时任务。",
      schedule_not_found: "该定时任务已不存在。",
      model_not_addable: "该分组只承载内置模型,不能再添加其他模型;请在自定义分组中添加。",
      model_not_routable:
        "该模型 ID 无法按厂商分组的协议路由。厂商分组只承载内置模型;请在自定义分组中添加该模型,并选择或检测其接口协议。",
      unknown_skill: "所选目录下没有这个技能。",
      unknown_plugin: "该插件不在插件库中。",
      goal_plugin_not_installed:
        "目标模式需要 goal 插件——请先在插件库中为该 Agent 安装,并确认其钩子包已启用。",
      skill_too_large: "该技能目录过大,超出了导入限制。",
      hook_too_large: "该钩子包过大,超出了导入限制。",
      file_not_found: "该文件已不存在。",
      not_pending: "该插话已随本轮送达模型,无法撤回。",
      follow_up_started: "该跟进消息已开始发送,无法撤回。",
      file_too_large: "文件过大。",
      too_many_files: "一条消息附加的文件过多。",
      payload_too_large: "请求体过大。",
      image_too_large: "图片过大,无法随对话发送。",
      asr_not_configured: "还没有配置语音识别模型,请在「设置 → 服务器 → 语音输入」里配置。",
      asr_unreachable: "连不上语音服务,请检查设置里的服务地址与网络。",
      asr_credential_refused:
        "语音服务不认这把密钥:到「设置 → 服务器 → 语音输入」检查 API 密钥,改完点「测试连通性」。",
      asr_timeout: "语音服务没有及时返回结果,请再试一次。",
      asr_empty_audio: "没有录到声音,请再试一次。",
      asr_too_long: "录音太长了,请说得短一点。",
      asr_bad_audio: "录音数据不完整,请再试一次。",
      asr_bad_sample_rate: "录音的采样率不受支持。",
      invalid_asr_base_url: "服务地址必须是完整的 http(s) 地址。",
      invalid_asr_model: "识别模型不能为空。",
      invalid_asr_api_key: "API 密钥不能为空。",
      dir_not_absolute: "目录必须是绝对路径。",
      dir_not_found: "该目录不存在或不可访问。",
      dir_permission_denied: "没有访问该目录的权限。",
      dir_name_empty: "请输入文件夹名称。",
      dir_name_invalid: "文件夹名称不能是路径、`.` 或 `..`,也不能含有系统不接受的字符。",
      dir_exists: "这个名称已被占用。",
      dir_create_failed: "无法创建该文件夹。",
      dir_not_empty: "该文件夹不是空的,只能删除空文件夹。",
      dir_root_protected: "不能删除根目录。",
      dir_project_protected: "不能删除项目目录,或包含项目目录的上级目录。",
      dir_delete_failed: "无法删除该文件夹。",
      not_a_dir: "该路径不是目录。",
      path_not_found: "该路径不存在。",
      reveal_failed: "无法打开文件夹。",
      workspace_missing: "该 Session 的 Workspace 已不存在。",
      workspace_not_found: "该 Workspace 不存在或不是目录。",
      session_not_found: "该 Session 已不存在,或你没有访问权限。",
      session_deleting: "该 Session 正在删除中。",
      approval_not_found: "该授权请求已处理或已失效。",
      process_not_found: "该后台进程已结束或已被移除。",
      process_running: "该后台进程仍在运行,请先结束再移除。",
      terminal_not_found: "该终端已不存在或已被关闭。",
      memory_file_not_found: "该记忆文件已不存在。",
      memory_scope_not_found: "该记忆范围已不存在。",
      task_in_progress: "该 Session 已有任务在运行。",
      compacting: "该 Session 正在压缩上下文,暂不接受新的输入。",
      shutting_down: "服务正在关闭,请稍后重试。",
      platform_rate_limited: "平台授权请求过于频繁,请等待倒计时结束后重试。",
      // The three "cannot compact" reasons each have their own server code, so each keeps its
      // own explanation here — collapsing them into one sentence would tell a user who just
      // compacted that they have never spoken.
      compaction_not_configured: "该 Agent 没有配置上下文压缩。",
      same_model: "本会话已在使用该模型。",
      model_not_configured: "所选模型不在本项目的模型配置中。",
      model_unavailable: "所选模型暂不可用(例如还没有 API key),请先在「模型」页配置。",
      nothing_to_compact: "当前上下文还没有可压缩的内容(尚未完成一轮对话)。",
      already_compacted: "刚刚压缩过,之后还没有新的对话,无需重复压缩。",
      version_conflict: "快照版本不高于当前版本。",
      invalid_title: "标题无效。",
      invalid_proxy_url: "代理地址无效:应为 http(s):// 或 socks5:// 代理 URL,或 主机[:端口]。",
      invalid_attachment_limit: "上传限制无效:请填写允许范围内的整数 MB,且合计不低于单个上限。",
      invalid_trace: "该文件不是有效的 Trace 文件。",
      trace_not_found: "该 Trace 文件已不存在。",
      trace_session_exists: "该 Agent 已存在同名 Session,无法导入重复的 Trace。",
      feishu_secret_required: "需要填写 App Secret。",
      feishu_not_bound: "该 Session 尚未绑定飞书。",
      feishu_no_chat: "尚未收到飞书消息:先在飞书中给机器人发一条消息。",
      feishu_send_failed: "飞书消息发送失败。",
      telegram_token_required: "需要填写 Bot Token。",
      telegram_token_invalid: "Bot Token 格式不正确:应形如「数字:密钥」。",
      telegram_not_bound: "该 Session 尚未绑定 Telegram。",
      telegram_no_chat: "尚未收到 Telegram 消息:先在 Telegram 中给机器人发一条消息。",
      telegram_send_failed: "Telegram 消息发送失败。",
      another_channel_enabled: "该会话已启用另一渠道的连接:先停用它,再启用当前渠道。",
      // Deliberately names nothing about the other conversation: it may live in a Project
      // this user cannot see, and the remedy does not depend on knowing which one it is.
      account_enabled_elsewhere: "该机器人的连接已在另一个会话中启用:先在那边停用,再在此启用。",
      messaging_disable_before_clear: "先停用该渠道的连接,才能清除其凭证。",
      messaging_disable_before_scan: "先停用该渠道的连接,才能重新扫码绑定。",
      company_mode_off: "本服务器已关闭公司模式。",
      org_not_found: "该组织已不存在。",
      org_exists: "该组织 id 已被占用。",
      org_invalid: "该组织的配置文件需要修复,修好前不接受改动。",
      invalid_org_id: "组织 id 无效:2~64 位,小写字母开头,仅小写字母、数字与下划线。",
      employee_not_found: "该 Agent 不是本组织的员工。",
      employee_exists: "该 Agent 已是本组织的员工。",
      calendar_event_exists: "已存在同名日程。",
      calendar_event_not_found: "该日程已不存在。",
      desk_unavailable: "无法打开工位会话。",
      agent_folder_busy:
        "其他程序正占用该 Agent 目录中的文件,目录无法移走,未删除任何内容。关闭该程序后重试。",
      ticket_not_found: "该工单已不存在。",
      ticket_invalid: "该工单文件需要修复,修好前不接受改动。",
      ticket_session_failed: "无法发起工单会话。",
      handbook_file_not_found: "该文档已不存在。",
      handbook_index_required: "手册索引(README.md)不能删除。",
      browser_unavailable: "内置浏览器不可用:它需要 Adelie 桌面应用处于打开状态。",
      source_not_found: "找不到这个浏览器配置文件。",
      shell_unreachable: "无法联系桌面应用。",
      timeout: "操作超时,请重试。",
    },
  },
};

/** Dictionary shape (constrains the English dictionary so keys and function signatures line up). */
export type Strings = typeof zh;

/**
 * Runtime active dictionary (live binding): the locale Provider calls setActiveStrings
 * to switch before render, and remounts the whole tree keyed by locale so every `S.x`
 * read reflects the current language.
 */
export let S: Strings = zh;

export function setActiveStrings(next: Strings): void {
  S = next;
}