Files
deepseek-harness/scripts/snapshots/translation-prompt-v4/request-response.expected.json
T

61 lines
125 KiB
JSON
Raw Normal View History

2026-07-23 22:41:53 +08:00
{
"request": {
"targetFilename": "snapshot-note.zh.md",
"messages": [
{
"role": "system",
"content": "# Translation Prompt\n\nYou are a senior technical translator specializing in LLM and agent development documentation. Your task is to translate the complete source document from English to Chinese, producing natural, professional technical prose.\n\nRead each complete semantic unit, understand it, and restate it as a native technical author would write it in the target language. Do not mechanically preserve source-language syntax. Then verify the translation against the source clause by clause: preserve every proposition and add none. Fluency never justifies losing or altering meaning, and completeness never justifies unnatural word-for-word prose.\n\n## Priority\n\nApply these authorities in order:\n\n1. Preserve the source meaning and the required document structure, protected content, and formatting.\n2. Follow the injected terminology table exactly.\n3. Use the injected whole-document gold pairs to calibrate target-language voice and phrasing.\n4. Apply the general writing guidance and illustrative examples in this prompt.\n\nA lower-priority rule may refine but never override a higher-priority requirement. Gold pairs calibrate voice; they are not a translation memory. No style preference, gold-pair phrasing, or embedded example may override source meaning, required structure, protected content, or the terminology table.\n\n## Quality Requirements\n\n### Structure and Format Preservation\n- Output a complete translated document that maintains the same document frame as the source: heading hierarchy and order, list kinds and item counts, ordered-list starts, table rows and columns, link targets, and code blocks.\n- Paragraph boundaries may change within the same structural unit when the target language needs different semantic grouping. Do not merge or move content across headings, list items, table cells, or other independent structural units.\n- Keep each prose paragraph on one physical line. Use paragraph breaks, not hard-wrapped lines inside a paragraph.\n- Fenced code blocks must be byte-identical to the source, including info strings, whitespace, and ALL comments inside them. Do NOT translate or reformat any content inside code blocks. This is a hard rule with no exceptions.\n- Inline code spans must be kept verbatim. This includes commands, flags, paths, identifiers, API and event names, config keys, protocol values, version numbers, and other machine-readable tokens. Never translate or reformat them.\n- Every relative link must point to the same target as in the source. Translate link text; do not change link targets.\n- Language switcher line: when an English source contains `English | [中文](source-filename.zh.md)`, write `[English](source-filename.md) | 中文`. When a Chinese source contains `[English](source-filename.md) | 中文`, write `English | [中文](source-filename.zh.md)`. Do NOT copy the source switcher unchanged. If the source has no switcher, do not invent a filename or switcher; the pipeline inserts the canonical target switcher after parsing `<final>`.\n- Preserve emphasis marker types and the semantic spans they cover. Do not add, remove, move, or change bold and italic markers.\n\n### Faithfulness\n- Preserve every proposition in the source and add none. Every sentence, list item, note, FIXME, warning, example, caveat, prerequisite, and guarantee must have an equivalent in the translation. Count list items on both sides.\n- Preserve actors, objects, conditions, exceptions, negation, modality, causal relationships, and distinctions between concepts.\n- Preserve the exact strength and orientation of contracts. Completion and lifecycle conditions, failure behavior, directions and data flow, normal and exceptional result channels, ownership changes, and quantitative bounds must not be weakened, strengthened, reversed, or merged.\n- Translate ideas rather than source-language idioms, but never use fluency as a reason to omit or alter meaning.\n\n### Tone and Style\n- The translation must read as if originally written in the target language by a native technical author. I
2026-07-23 22:41:53 +08:00
},
{
"role": "user",
"content": "# DeepSeek Harness\n\nEnglish | [中文](README.zh.md)\n\nDeepSeek Harness (`dsh`) is an open-source coding agent built on the DeepSeek Harness SDK.\n\nIt uses an architecture where **everything is a plugin**.\n\n## Internal testing notice\n\n感谢您愿æ„�拨冗试用 DeepSeek Harness。当å‰�版本ä»�å¤„äºŽå†…éƒ¨æµ‹è¯•é˜æ®µï¼ŒåŠŸèƒ½ä»�待完善,体验难å…�有些粗糙。\n\n“如切如磋,如ç�¢å¦‚磨。â€� 产å“�çš„æˆ�长,离ä¸�开一次次真实的碰撞与å�¦è¯šçš„å��馈。您在真实使用中å�‘现的问题,也å�¯èƒ½ä¿ƒä½¿æˆ‘们é‡�新审视,甚至推翻已有的设计。\n\n为了帮助我们更准确地还原您真实使用中的问题,内测版本默认会上传所有 Session Log;如需关闭,å�¯ä»¥è®¾ç½®çŽ¯å¢ƒå�˜é‡� `DSH_TELEMETRY_DISABLED=1`。å�¦å¤–,如果您有任何å��馈与建议,请在ä¼�业微信群中留言告诉我们。æ¯�一æ�¡å��馈,都会帮助我们把它打磨得更好。\n\n## Install\n\nClone the repository, then run the installer:\n\n```sh\ngit clone <repo-url>\ncd deepseek-harness\nscripts/install.sh\n```\n\nThe installer requires `git` and Node `^22.19 || >=24`, offers to install `pnpm` when it is missing, prompts for a DeepSeek API key, builds the required repository artifacts, and launches the Web UI.\n\nThe installer keeps every checkout under `~/.dsh/source`: the master clone at `~/.dsh/source/master` and each install's staging checkout as a git worktree `~/.dsh/source/staging-<timestamp>`. The stable symlink `~/.dsh/source/current` points at the active staging worktree, and `dsh` in `~/.local/bin` links to `current/bin/dsh`, so an upgrade repoints one symlink and the `dsh` on PATH never moves. Re-running the command adds a fresh staging worktree from an updated master and repoints `current` at it. See [`scripts/install.sh`](scripts/install.sh) for alternate install locations and other options.\n\n## Use DeepSeek Harness\n\n### Web UI\n\nFor the recommended local interface, choose Web UI when the installer finishes. To start it later, or after updating the active checkout, build the repository and run:\n\n```sh\n(cd ~/.dsh/source/current && pnpm run build)\ndsh web\n```\n\nThe path above is the installer's default. If you set `DSH_SOURCE` or `DSH_CURRENT`, or reused an existing checkout, replace `~/.dsh/source/current` with that checkout path; see [`scripts/install.sh`](scripts/install.sh) for details. The Web UI is served at `http://127.0.0.1:3080` by default.\n\n### Configured runtime\n\nRaw `dsh` requires a patch-list configuration applied over the shipped base:\n\n```sh\ndsh --config ./app.cordis.yml\n```\n\nThe [CLI contract](apps/cli/README.md#raw-config) describes the base, overlay semantics, and config dump commands.\n\n### Headless\n\nRun one task, print the final answer, and exit:\n\n```sh\ndsh -p \"summarize this workspace\"\n```\n\n### Automation and SDKs\n\nFrom a source checkout with `DEEPSEEK_API_KEY` in the environment or its root `.env`, start the ACP automation server:\n\n```sh\npnpm run demo:acp\n```\n\nThe [Python SDK](python/README.md) drives a bundled JSON-RPC runtime. The [examples](examples/README.md) cover the runnable headless, ACP, JSON-RPC, Code Mode, and self-referential compositions.\n\n## Why DeepSeek Harness\n\nBuilt-in capabilities cover file reading, editing, and search; shell and persistent PTY execution; reusable skills; task tracking, goals, plans, todos, and background tasks; subagents and workflows; sandboxing and approvals; settings and credentials; persistent, resumable, forkable, and queryable sessions; LSP and web access; context compaction; and telemetry. Each composition selects the subset appropriate to its surface. The Web UI includes Plan Mode.\n\n- **Everything is a plugin.** Models, tools, policies, storage, context management, and interfaces are composable [Cordis plugins](docs/user/develop/basic/index.md), so deployments can extend or replace behavior without forking the agent loop. See the [architecture](docs/architecture.md) for the underlying design.\n- **Runs are reconstructable.** Anyt
2026-07-23 22:41:53 +08:00
},
{
"role": "assistant",
"content": "# DeepSeek Harness\n\n[English](README.md) | 中文\n\nDeepSeek Harness(`dsh`)是一款基于 DeepSeek Harness SDK 构建的开æº� coding agent(编程智能体)。\n\n它采用了**一切皆æ�’ä»¶**的架构。\n\n## 内测声明\n\n感谢您愿æ„�拨冗试用 DeepSeek Harness。当å‰�版本ä»�处于内部测试阶段,功能ä»�待完善,体验难å…�有些粗糙。\n\n“如切如磋,如ç�¢å¦‚磨。â€� 产å“�çš„æˆ�长,离ä¸�开一次次真实的碰撞与å�¦è¯šçš„å��馈。您在真实使用中å�‘现的问题,也å�¯èƒ½ä¿ƒä½¿æˆ‘们é‡�新审视,甚至推翻已有的设计。\n\n为了帮助我们更准确地还原您真实使用中的问题,内测版本默认会上传所有 Session Log;如需关闭,å�¯ä»¥è®¾ç½®çŽ¯å¢ƒå�˜é‡� `DSH_TELEMETRY_DISABLED=1`。å�¦å¤–,如果您有任何å��馈与建议,请在ä¼�业微信群中留言告诉我们。æ¯�一æ�¡å��馈,都会帮助我们把它打磨得更好。\n\n## 安装\n\n克隆仓库,然å�Žè¿�行安装器:\n\n```sh\ngit clone <repo-url>\ncd deepseek-harness\nscripts/install.sh\n```\n\n安装器è¦�求系统已安装 `git` å’Œ Node `^22.19 || >=24`,缺少 `pnpm` æ—¶å�¯ä»£ä¸ºå®‰è£…,并会æ��示输入 DeepSeek API 密钥,然å�Žæž„建所需的仓库产物并å�¯åЍ Web UI。\n\n安装器会把所有检出都放在 `~/.dsh/source` 下:master 克隆ä½�于 `~/.dsh/source/master`,æ¯�次安装的 staging 检出是一个 git worktree `~/.dsh/source/staging-<时间戳>`。稳定符å�·é“¾æŽ¥ `~/.dsh/source/current` 指å�‘当å‰�生效的 staging worktree,`~/.local/bin` 中的 `dsh` 链接到 `current/bin/dsh`,因此å�‡çº§å�ªéœ€é‡�指一个符å�·é“¾æŽ¥ï¼ŒPATH 上的 `dsh` 从ä¸�移动。å†�次è¿�行该命令会基于更新å�Žçš„ master 新增一个 staging worktree,并把 `current` é‡�指到它。其他安装ä½�置和选项è§� [`scripts/install.sh`](scripts/install.sh)。\n\n## 使用 DeepSeek Harness\n\n### Web UI\n\n推è��在本地使用 Web UI;安装结æ�Ÿæ—¶ï¼Œé€‰æ‹© Web UI å�³å�¯ã€‚以å�Žéœ€è¦�å�¯åŠ¨æ—¶ï¼Œæˆ–æ›´æ–°å½“å‰�生效的检出å�Žï¼Œè¯·æž„建仓库并è¿�行:\n\n```sh\n(cd ~/.dsh/source/current && pnpm run build)\ndsh web\n```\n\n上述路径是安装器的默认ä½�置。如果你设置过 `DSH_SOURCE` 或 `DSH_CURRENT`,或者å¤�用了已有检出,请把 `~/.dsh/source/current` æ�¢æˆ�该检出路径;详情è§� [`scripts/install.sh`](scripts/install.sh)。Web UI 默认通过 `http://127.0.0.1:3080` æ��ä¾›æœ�务。\n\n### 自定义è¿�行时\n\n原始 `dsh` è¦�求传入一份 patch 列表é…�置,并将其å� åŠ åœ¨éš�附 base 之上:\n\n```sh\ndsh --config ./app.cordis.yml\n```\n\nbaseã€�overlay 语义与é…�置输出命令详è§� [CLI(命令行界é�¢ï¼‰å¥‘约](apps/cli/README.md#raw-config)。\n\n### Headless\n\nè¿�行一项任务,打å�°æœ€ç»ˆç­”案å�Žé€€å‡ºï¼š\n\n```sh\ndsh -p \"summarize this workspace\"\n```\n\n### 自动化与 SDK\n\n在æº�ç �检出中通过环境å�˜é‡�或根目录 `.env` 设置 `DEEPSEEK_API_KEY`,然å�Žå�¯åЍ ACP(Agent Client Protocol)自动化æœ�务器:\n\n```sh\npnpm run demo:acp\n```\n\n[Python SDK](python/README.md) 驱动éš�附的 JSON-RPC è¿�行时。[示例](examples/README.md)涵盖å�¯è¿�行的 headlessã€�ACPã€�JSON-RPCã€�Code Mode 和自指组å�ˆã€‚\n\n## 为什么选择 DeepSeek Harness\n\n内置功能涵盖文件读å�–ã€�编辑与æ�œç´¢ã€�shell å’ŒæŒ�ä¹… PTY 执行ã€�å�¯å¤�用 skill(技能)ã€�任务跟踪ã€�目标ã€�计划ã€�待办事项与å�Žå�°ä»»åŠ¡ã€�subagent 与工作æµ�ã€�沙箱与审批ã€�设置与凭æ�®ã€�å�¯æŒ�久化ã€�æ�¢å¤�ã€�fork 与查询的会è¯�ã€�LSP 与 Web 访问ã€�上下文压缩(context compaction),以å�Šé�¥æµ‹ã€‚æ¯�个组å�ˆå�ªé€‰ç”¨é€‚å�ˆå…¶ä½¿ç”¨æ–¹å¼�的能力å­�集。Web UI 包å�« Plan Mode。\n\n- **一切皆æ�’件。** 模型ã€�工具ã€�ç­–ç•¥ã€�存储ã€�上下文管ç�†å’Œç•Œé�¢å�‡å�¯ç»„å�ˆä¸º [Cordis æ�’ä»¶](docs/user/develop/basic/index.md),部署方无需 fork agent loop(智能体循环)å�³å�¯æ‰©å±•或替æ�¢è¡Œä¸ºã€‚底层设计è§�[架构文档](docs/architecture.md)。\n- **è¿�行å�¯é‡�建。** 凡是模型å�¯è§�的内容ï
2026-07-23 22:41:53 +08:00
},
{
"role": "user",
"content": "# Development guide\n\nEnglish | [中文](development.zh.md)\n\nThis onboarding guide helps project contributors get started with the local environment, daily workflow, and CI flow; see the Agent Notes for design rationale and technical trade-offs.\n\n## Prerequisites\n\n- Node.js supports 22.19+ and 24+. CI covers 22.19, 24, and 26; see the [Node engine floor Agent Note](../.agents/notes/implemented/process/2026-07-06-node-engine-floor.md).\n- Corepack-enabled pnpm. The repo pins `pnpm@11.7.0` in `package.json`; run `corepack enable` if `pnpm --version` does not resolve through Corepack.\n- Git 2.26 or newer; hook setup enables Git's worktree-specific configuration extension.\n- Optional: a DeepSeek API key for the Web, headless, and ACP automation demos and real-API e2e tests.\n\n## First-time setup\n\nInstall dependencies from the repo root:\n\n```sh\npnpm install\n```\n\nThe install also runs the root `postinstall` script, which installs lefthook from the repo dev dependency through `scripts/install-lefthook.mjs`. With `CI=true` or `GITHUB_ACTIONS=true`, the wrapper returns before Git discovery because automated jobs do not consume contributor hooks. Otherwise, it requires Git 2.26 or newer and gives the current worktree an explicit hook directory under its own Git directory; linked worktrees therefore use their own lefthook binary and configuration instead of rewriting common hooks. The first install enables Git's worktree-specific configuration extension and repository format 1; see the [worktree-local hooks Agent Note](../.agents/notes/implemented/process/2026-07-27-worktree-local-lefthook.md).\n\nIf hooks are missing because dependencies were restored from cache or `postinstall` was skipped, install them manually:\n\n```sh\nnode scripts/install-lefthook.mjs\n```\n\nThe wrapper refuses user-owned `core.hooksPath` values. An inherited system, global, or common-repository path requires `DSH_LEFTHOOK_ALLOW_HOOKS_PATH_OVERRIDE=1`. When Git seeds a new worktree with another registered worktree's marker-backed hook path, the wrapper replaces that copied value with the new worktree's own path; command-scoped and other worktree-scoped paths must be integrated or removed explicitly.\n\nBefore enabling worktree config, migrate direct `extensions.*` in a format-0 common config, direct `core.worktree` or `core.bare=true`, and any non-empty dormant `config.worktree`. The common config and every worktree config must be regular files, while the owned hook directory may contain only unaliased regular files.\n\nAfter moving a checkout, rerun the wrapper to relocate its owned path and regenerate hooks. For a stale or invalid installer lock, first confirm no installer is running, then remove the reported lock and retry. If installation and hook-path rollback both fail, inspect the reported worktree config before retrying. The [worktree-local hooks Agent Note](../.agents/notes/implemented/process/2026-07-27-worktree-local-lefthook.md) owns the full safety contract.\n\nRun typecheck once after a fresh clone:\n\n```sh\npnpm run typecheck\n```\n\nThat first typecheck runs the whole-repo `tsc -b` graph: it emits every package/vendor `lib/types` and checks examples, tests, and scripts through the two no-emit aggregates described below.\n\n## TypeScript project layout\n\nThe repository's TypeScript configuration has exactly three roles; every tsconfig file plays one of them.\n\n| File | Role | Forms a program? |\n|---|---|---|\n| `tsconfig.json` | Solution root: `extends` base, `files: []`, references to the two aggregates. The whole-repo `tsc -b tsconfig.json` graph, the tsserver discovery entry, and — through the inherited `paths` — the resolution config for tsx running `examples/` and `scripts/` (their nearest tsconfig is this file). | No |\n| `tsconfig.host.json` | Host aggregate: host-side packages (via references), examples, tests, scripts, website. Excludes `packages/client`. | Yes |\n| `tsconfig.client.json` | Client aggregate: `packages/client/*` packages and their tests, `apps/web`. | Yes |\n| `tsconfig.b
2026-07-23 22:41:53 +08:00
},
{
"role": "assistant",
"content": "# 开�指�\n\n[English](development.md) | 中文\n\n本指�覆盖�与 DeepSeek Harness 开�所需的本地环境�建�日常工作�与 CI �程;设计动机与技术�衡请查阅相应 Agent Note。\n\n## �置�件\n\n- Node.js 支� 22.19+ 与 24+。CI 覆盖 22.19�24 和 26;� [Node 引擎下� Agent Note](../.agents/notes/implemented/process/2026-07-06-node-engine-floor.md)。\n- �用了 Corepack 的 pnpm。仓库在 `package.json` 中固定使用 `pnpm@11.7.0`;如果 `pnpm --version` 无法通过 Corepack 解�,请先�行 `corepack enable`。\n- Git 2.26 或更高版本;钩�设置会�用 Git 的 worktree 专属�置扩展。\n- �选:一个 DeepSeek API key,用于 Web�headless 和 ACP(Agent Client Protocol)自动化 agent(智能体)演示以�真实 API 的 e2e 测试。\n\n## 首次�建\n\n在仓库根目录安装�赖:\n\n```sh\npnpm install\n```\n\n安装过程�时会�行根目录的 `postinstall` 脚本,该脚本通过 `scripts/install-lefthook.mjs` 从仓库 dev �赖安装 lefthook。当 `CI=true` 或 `GITHUB_ACTIONS=true` 时,该脚本会在探测 Git �返回,因为自动化任务�会使用贡献者钩�。�则,包装脚本�求使用 Git 2.26 或更高版本,并会为当� worktree 在其自身的 Git 目录下设置显�钩�目录;因此,关� worktree 会使用�自的 lefthook 二进制文件和�置,而�会改写共用钩�。首次安装会�用 Git 的 worktree 专属�置扩展和仓库格� 1;� [worktree 本地钩� Agent Note](../.agents/notes/implemented/process/2026-07-27-worktree-local-lefthook.md)。\n\n如果�赖是从缓存��或 `postinstall` 被跳过而导致缺少钩�,请手动安装:\n\n```sh\nnode scripts/install-lefthook.mjs\n```\n\n包装层会拒�用户自有的 `core.hooksPath` 值。继承自系统�全局或共用仓库�置的路径必须设置 `DSH_LEFTHOOK_ALLOW_HOOKS_PATH_OVERRIDE=1`。当 Git 使用�一个已注册 worktree 中由所有�标记��的钩�路径�始化新 worktree 时,包装层会将这个�制值替�为新 worktree 自有的路径;命令作用域和其他 worktree 作用域的路径必须显�集�或移除。\n\n�用 worktree �置之�,请�移格� 0 共用�置中直接设置的 `extensions.*`,并�移直接设置的 `core.worktree` 或 `core.bare=true`,以�任何�空且尚未生效的 `config.worktree`。共用�置和�个 worktree �置都必须是常规文件,而自有钩�目录�能包��带别�的常规文件。\n\n检出目录移动�,请�新�行包装层,使其�新定�自有路径并�新生�钩�。对于陈旧或无效的安装程��,请先确认没有安装程�正在�行,�移除报告的�并�试。若安装和钩�路径回滚都失败,请在�试�检查报告的 worktree �置。完整安全契约由 [worktree 本地钩� Agent Note](../.agents/notes/implemented/process/2026-07-27-worktree-local-lefthook.md) 统一定义。\n\n新克隆�请先�行一次类型检查:\n\n```sh\npnpm run typecheck\n```\n\n首次类型检查会执行全仓 `tsc -b tsconfig.json` 图:�射�个 package/vendor 的 `lib/types`,并通过下述两个 no-emit ��检查示例�测试和脚本。\n\n## TypeScript 项目布局\n\n仓库的 TypeScript �置�有三�角色;�个 tsconfig 文件�好扮演其中一�。\n\n| 文件 | 角色 | 是�构� program? |\n|---|---|---|\n| `tsconfig.json` | solution 根:`extends` base�`files: []`�引用两个��。全仓 `tsc -b tsconfig.json` 图�tsserver �现入�,并�继承的 `paths` 充当 tsx �行 `examples/` 与 `scripts/` 时的解��置(它们最近的 tsconfig 就是此文件)。 | � |\n| `tsconfig.host.json` | host ��:host 侧�包(� references)�示例�测试�脚本�website。排除 `packages/client`。 | 是 |\n| `tsconfig.client.json` | client ��:`packages/client/*` �包�其测试�`apps/web`。 |
2026-07-23 22:41:53 +08:00
},
{
"role": "user",
"content": "# Bilingual documentation\n\nEnglish | [中文](README.zh.md)\n\nThis repo's documentation is read by people and agents both inside and outside the company, so every document in scope is maintained in English and Simplified Chinese. This page defines the pairing contract, enforcement gate, scope, and exclusions; [translation-rules.md](translation-rules.md) defines how to translate; [terminology.md](terminology.md) is the terminology source of truth. The committed agent workflow lives in [.agents/skills/dsh-translate-docs](../../.agents/skills/dsh-translate-docs/SKILL.md).\n\n## The pairing contract\n\n- **Both languages carry equal authority.** A document may be authored and reviewed in either language first — a Chinese-first Agent Note is as legitimate as an English-first one — and the counterpart is translated from it. Neither file outranks the other; what binds them is that they must say the same thing.\n- **A pair is three sibling files.** The English `foo.md`, the Chinese `foo.zh.md`, and a consistency record `foo.i18n.yaml`, all in the same directory. No locale directories, no separate translation repo, no interleaved bilingual files. Pairs merge whole: a PR never lands one language without the other two files.\n- **The consistency record.** `foo.i18n.yaml` holds the full git blob hash of each side as of the last time the two were confirmed to say the same thing:\n\n ```yaml\n foo.md: 3f786850e387550fdab836ed7e6dc881de23001b\n foo.zh.md: 89e6c98d92887913cadf06b2adb97f26cde4849b\n ```\n\n Blob hashes, not commit hashes, so the record is computable for files edited in the same PR (`git hash-object foo.md`) and consistency is a pure content comparison. `--write` stores those snapshots in the local Git object database before recording them, including uncommitted working-tree contents, and pins every distinct stored blob under a content-addressed `refs/dsh/translation-pairing/snapshots/` ref so garbage collection cannot invalidate a recorded recovery pointer. The recorded hashes therefore recover the exact last-confirmed text of either side, so an out-of-sync pair is updated by patching the counterpart minimally against the edited side's diff — never by re-translating whole files. `pnpm run gen-translation-brief <pair>` assembles that update's working set mechanically at the narrowest safely aligned granularity — changed Markdown units, then heading sections, then whole document — with the edited side's diff since last confirmation, each changed span's three-way text, the terminology rows the change touches, and the binding update rules; a change confined to the pair's byte-identical code fences is computed outright, and `--apply` splices it into the counterpart after structural validation ([briefed-updates Agent Note](../../.agents/notes/implemented/process/2026-07-26-briefed-minimal-translation-updates.md)). After bringing the pair back in line, `pnpm run verify-translation-pairing --write <pair>` re-records both hashes; that yaml diff is the reviewable act of confirming consistency, which is why `--write` requires naming the pairs you confirmed (`--write --all` is the explicit corpus-wide form).\n- **Language switcher.** Both files link to each other immediately after their H1 heading: the English file carries `English | [中文](foo.zh.md)` and the Chinese file carries `[English](foo.md) | 中文`.\n- **Structure mirrors the counterpart.** Heading depths and order, list kinds, ordered-list starts, list item counts, table row and column counts, link targets, and verbatim code blocks match one to one across the pair — see [translation-rules.md](translation-rules.md) for the full preservation rules. Existing Markdown gates apply to `.zh.md` files unchanged (`verify-md-wrap`, `verify-md-links`).\n\n## The gate: verify-translation-pairing\n\n`pnpm run verify-translation-pairing` (part of `doc-sync`, which contributors run locally for documentation changes and CI runs exhaustively) enforces the contract mechanically:\n\n1. Every document in scope has a complete pair. README discovery
2026-07-23 22:41:53 +08:00
},
{
"role": "assistant",
"content": "# �语文档\n\n[English](README.md) | 中文\n\n本仓库的文档会被公�内外的人和 agent(智能体)阅读,因此范围内的�篇文档都以英文和简体中文维护。本页定义�对契约�强制门��范围与排除规则;[translation-rules.md](translation-rules.md) 定义如何翻译;[terminology.md](terminology.md) 是术语真�。仓库内置的 agent 工作�� [.agents/skills/dsh-translate-docs](../../.agents/skills/dsh-translate-docs/SKILL.md)。\n\n## �对契约\n\n- **两�语言��。** 一篇文档�以先用任一语言撰写和评审(先写中文的 Agent Note 与先写英文的一样正当),�一侧由它翻译而�。两个文件�也�高于�;约�它们的是二者必须说�样的�。\n- **一对文档是三个�目录文件。** 英文 `foo.md`�中文 `foo.zh.md`,加一份一致性记录 `foo.i18n.yaml`,都在�一目录。�用语言目录,�用独立翻译仓库,�用中英混排的�文件。�对必须整体�并:PR(Pull Request)永远�会�带一�语言而缺其余两个文件。\n- **一致性记录。**`foo.i18n.yaml` �存两侧文件在上一次被确认「说�样的��时�自的完整 git blob hash:\n\n ```yaml\n foo.md: 3f786850e387550fdab836ed7e6dc881de23001b\n foo.zh.md: 89e6c98d92887913cadf06b2adb97f26cde4849b\n ```\n\n 用 blob hash 而�是 commit hash,这样�一个 PR 里改动的文件也能算出记录(`git hash-object foo.md`),一致性是纯内容比较。`--write` 会先把这些快照存入本地 Git 对象库�写下记录,未�交的工作树内容也�例外;它还会在内容寻�的 `refs/dsh/translation-pairing/snapshots/` ref 下固定�个��的已存 blob,使垃圾回收无法让已记录的��指针失效。因此记录的 hash 能还原任一侧上次确认时的确切文本,所以失去�步的�对是「按被改一侧的 diff 最�化地修补�一侧�,从�整篇�译。`pnpm run gen-translation-brief <pair>` 会以能安全对�的最窄粒度——先是有改动的 Markdown �元,�是标题�节,最�是整篇文档——机械地汇集这次更新的工作集:被改一侧自上次确认以�的 diff��个改动�的三方文本�改动触�的术语表行,以�有约�力的更新规则;仅�在�对中�字节一致的围�代��内的改动�以直接算出,`--apply` 则�结构签�校验�把它拼接进对侧文件([briefed-updates Agent Note](../../.agents/notes/implemented/process/2026-07-26-briefed-minimal-translation-updates.md))。两侧对��,`pnpm run verify-translation-pairing --write <pair>` �新记录两个 hash;那份 yaml diff 就是「确认一致�这个动作本身,�以被评审,也正因如此,`--write` �求点�你确认过的�对(`--write --all` 是显�的全语料形�)。\n- **语言切�行。** 两个文件在�自 H1 标题之�立�互链:英文文件带 `English | [中文](foo.zh.md)`,中文文件带 `[English](foo.md) | 中文`。\n- **结构与�一侧一一对应。** 标题深度与顺��列表类型�有�列表起始编��列表项数��表格行列数�链接目标与�字节一致的代��在�对两侧一一对应;完整��规则� [translation-rules.md](translation-rules.md)。既有 Markdown 门�对 `.zh.md` 文件原样生效(`verify-md-wrap`�`verify-md-links`)。\n\n## 门�:verify-translation-pairing\n\n`pnpm run verify-translation-pairing`(`doc-sync`(文档�步门�)的一环,贡献者会针对文档�更在本地�行,CI 则会完整�行)机械地强制执行这份契约:\n\n1. 范围内的�篇文档都有完整�对。�现 README 时,basename �区分大�写,因此 `missions/readme.md` 与其他文档根一样属于范围。\n2. 任何已存在的�对产物都完整且一致:三个文件�全��一侧的当� blob hash 等于记录值(改了任一侧而没�新确认�对就�红)��
2026-07-23 22:41:53 +08:00
},
{
"role": "user",
"content": "# Translation rules\n\nEnglish | [中文](translation-rules.zh.md)\n\nHow to translate between the two sides of a documentation pair in this repo. Both languages carry equal authority ([README.md](README.md)): a change is authored in either language, and that side is the source for that update — these rules govern producing or updating the counterpart. They bind humans and agents equally; the committed agent workflow that applies them is [.agents/skills/dsh-translate-docs](../../.agents/skills/dsh-translate-docs/SKILL.md). Rule levels follow RFC 2119 usage: **MUST** / **MUST NOT** are gate- or review-blocking; **SHOULD** needs a stated reason to deviate; **MAY** is discretionary.\n\n## Faithfulness\n\n- The counterpart *MUST* say what the authored side says — no added behavior, prerequisites, warnings, version claims, or examples, and no dropped ones. If the pair disagrees on substance, neither language wins by default: fix the side that is wrong, then bring the other along in the same change.\n- The counterpart *SHOULD* read as natural technical writing in its own language, not word-by-word gloss. Translate meaning, restructure sentences where the target grammar wants it, and keep the author's register — terse stays terse.\n- Do not translate the untranslatable: if a sentence resists natural rendering because it leans on an idiom of the source language, translate the idea, not the idiom.\n\n## Voice\n\n- The register is calibrated by [style-samples.md](style-samples.md) — human-approved gold pairs, one per document genre. The counterpart MUST match the target-language side of the nearest sample; where its voice and a prose voice rule disagree, the sample wins. Chinese targets use institutional technical Chinese; English targets use concise professional developer prose.\n- Write as a native technical author restating the content, not as a translator transposing sentences. Then verify against the source clause by clause: nothing added, nothing dropped — fluency never justifies losing a clause.\n- Give sentences an explicit actor when the target language would otherwise obscure it; for Chinese, replace vague passives or abstract subjects with the actual actor (系统�门��评审人).\n- Prefer established target-language engineering idiom over calques (误报��检 for false positive/negative, 执行红线 for enforcement frontier); localize metaphors instead of transplanting them, and unpack noun chains where the target language requires it.\n- Split long paragraphs by semantic unit — one idea per paragraph. Paragraph boundaries MAY differ from the source; the structural signature does not count paragraphs.\n- When translating into Chinese, category nouns use Chinese with a first-mention English annotation (实�手册(cookbook)); when translating into English, use the conventional English category name. Literal directory or file references stay code-formatted English.\n\n## Structure preservation\n\nThe pairing gate checks heading depths, fenced code blocks, table row and column counts, list kinds, ordered-list starts, list item counts, and link targets. Preserve the rest of the frame manually; the paired files MUST match one to one in:\n\n- heading hierarchy (same levels, same order — heading TEXT is translated),\n- list shape and numbering,\n- tables (same columns, same row order; header cells translated per terminology),\n- fenced code blocks — **byte-identical, including comments**; the pairing signature compares their info strings and contents, and ` ```ts ` blocks compile under `doc-typecheck`,\n- inline code spans (commands, flags, config keys, file paths, event names, API names, version numbers) — verbatim, never translated or reformatted,\n- links and anchors: every relative link MUST point at the same target in both files — by convention the `.md` path, not the `.zh.md` sibling — so links never dangle when one pair lands before its neighbors. The ONLY zh-specific link is the language switcher. Link TEXT is translated; the target is not.\n\nThe repo's Mark
},
{
"role": "assistant",
"content": "# 翻译规则\n\n[English](translation-rules.md) | 中文\n\n本文规定:如何在本仓库文档é…�对的中英文两ç§�语言之间进行翻译。两ç§�语言å�Œæ�ƒï¼ˆè§� [README.md](README.md)):æ¯�次å�˜æ›´å�¯ä»¥ç”¨ä»»ä¸€è¯­è¨€æ’°å†™ï¼Œè¢«ç¼–辑的一侧å�³ä¸ºæœ¬æ¬¡æ›´æ–°çš„æº�;本文的规则约æ�Ÿå¦‚何产出或更新对侧文件。这些规则对人类和 agent(智能体)å�Œç­‰ç”Ÿæ•ˆï¼›åº”用这些规则的仓库内置 agent 工作æµ�是 [.agents/skills/dsh-translate-docs](../../.agents/skills/dsh-translate-docs/SKILL.md)。规则级别沿用 RFC 2119 的用法:**必须(MUST)** ï¼� **ç¦�止(MUST NOT)** 会å�¡é—¨ç¦�或评审;**应当(SHOULD)** å��离时è¦�说明ç�†ç”±ï¼›**å�¯ä»¥ï¼ˆMAY)** 自行è£�é‡�。\n\n## 忠实性\n\n- 对侧文件*å¿…é¡»*传达与撰写侧相å�Œçš„内容:ä¸�添加行为ã€�å‰�ç½®æ�¡ä»¶ã€�警告ã€�版本声明或示例,也ä¸�æ¼�掉任何一项。如果两侧在实质内容上ä¸�一致,没有哪ç§�语言默认获胜;请修正错误的一侧,并在å�Œä¸€ä¸ªå�˜æ›´é‡Œå�Œæ­¥æ›´æ–°å�¦ä¸€ä¾§ã€‚\n- 对侧文件读起æ�¥*应当*是其语言自然的技术文字,而é�žé€�è¯�对照的译文。请根æ�®è¯­ä¹‰ç¿»è¯‘,在目标语言语法需è¦�æ—¶é‡�组å�¥å­�,并ä¿�æŒ�原作者的语域(比如:简练的ä¿�æŒ�简练)。\n- ä¸�è¦�翻译ä¸�å�¯è¯‘的内容:如果一å�¥è¯�ä¾�èµ–æº�语言的习语ã€�无法自然转æ�¢ï¼Œè¯·ç¿»è¯‘它的æ„�æ€�,而é�žä¹ è¯­æœ¬èº«ã€‚\n\n## 行文\n\n- 语体以 [style-samples.md](style-samples.md) 为校准锚点。人工定稿的金标样例按文体å�„一组,译文必须å�‚照文体最接近的样例,采用其中目标语言一侧的语体;如果样例与本文的行文规则冲çª�,以样例为准。译æˆ�中文时,采用规范的技术制度文;译æˆ�英文时,采用简æ´�ã€�专业的开å�‘者文档语体。\n- 以æ¯�语技术作者的身份é‡�述内容,而ä¸�是é€�å�¥è½¬å†™çš„译者。写完å�Žé€�å�¥å¯¹ç…§åŽŸæ–‡æ ¸éªŒï¼šä¸�添加ã€�ä¸�é�—æ¼�——æµ�畅永远ä¸�是丢掉语义æˆ�分的ç�†ç”±ã€‚\n- 如果直译会让执行主体å�«ç³Šï¼Œè¯·æ˜Žç¡®å†™å‡ºå®žé™…执行者;译æˆ�中文时,应由「系统ã€�é—¨ç¦�ã€�评审人ã€�等实际执行者作主语,é�¿å…�å�«ç³Šçš„被动å�¥æˆ–抽象主语。\n- 优先采用目标语言中通行的工程表达,é�¿å…�生硬直译(false positive/negative→误报ï¼�æ¼�检ã€�enforcement frontier→执行红线);éš�喻应自然改写,å��è¯�链则按目标语言的习惯拆开。\n- 长段按语义å�•元拆分,一段一件事。段è�½è¾¹ç•Œå�¯ä»¥ä¸ŽåŽŸæ–‡ä¸�å�Œï¼›ç»“构签å��ä¸�比对段è�½æ•°ã€‚\n- 翻译为中文时,类别å��è¯�使用中文并在首现括注英文(实æ“�手册(cookbook));翻译为英文时,使用通行的英文类别å��。指目录或文件本身时ä¿�留代ç �体英文。\n\n## 结构ä¿�æŒ�\n\né…�对门ç¦�会检查标题深度ã€�å›´æ �代ç �å�—ã€�表格行列数ã€�列表类型ã€�有åº�列表起始编å�·ã€�列表项数é‡�与链接目标;门ç¦�未覆盖的结构ä»�需人工核对。两个é…�对文件必须在以下方é�¢ä¸€ä¸€å¯¹åº”:\n\n- 标题层级(相å�Œçº§åˆ«ã€�相å�Œé¡ºåº�;标题的**文字**è¦�翻译);\n- 列表形æ€�与编å�·ï¼›\n- 表格(相å�Œçš„列ã€�相å�Œçš„行åº�;表头å�•元格按术语表翻译);\n- å›´æ �代ç �å�—:**é€�字节一致,包括注释**。é…�对签å��比对信æ�¯å­—符串与内容,` ```ts ` å�—还è¦�通过 `doc-typecheck` 编译;\n- 行内代ç �(命令ã€�flagã€�é…�置键ã€�文件路径ã€�事件å��ã€�API å��ã€�版本å�·ï¼‰ï¼šåŽŸæ ·ä¿�留,从ä¸�翻译或é‡�排;\n- 链接与锚点:æ¯�个相对链接在两个文件中必须指å�‘相å�Œçš„目标(按约定是 `.md` 路径而é�ž `.zh.md` 兄弟文件),这样å�³ä½¿æŸ�对文档先于相邻文件è�½åœ°ï¼Œé“¾æŽ¥ä¹Ÿä¸�会悬空。唯一的 zh 特有链接是语言切æ�¢è¡Œã€‚链接**文字**翻译;链接目标ä¸�翻。\n\n本仓库的 Markdown 约定对 `.zh.md` 文件原样生效:一个段è�½ä¸€ä¸ªç‰©ç�†è¡Œï¼ˆ`verify-md-wrap`)ã€�相对链接必须å�¯è§£æž�(`verify-md-links`)ã€�文件末尾æ�°å¥½ä¸
},
{
"role": "user",
"content": "# Agent Note: Bilingual documentation via paired sibling files and a pairing gate\n\nStatus: implemented\n\nEnglish | [中文](2026-07-02-bilingual-docs-and-pairing-gate.zh.md)\n\n## Problem\n\nThis repo's documentation corpus is read by people and agents inside and outside the company, in both English and Chinese. Maintaining a second language by hand, with no mechanism, is how translations rot: one side moves on, the other silently lies, and no gate notices. The repo's standing answer to invariants of this kind is to encode them as a mechanical check (see [quality gates](2026-06-11-quality-gates.md) and [doc-sync enforcement](../../archived/process/2026-06-11-doc-sync-enforcement.md)), so the bilingual policy ships with one.\n\n## Decision\n\n- **Paired sibling files with equal authority.** A documentation pair is three sibling files: English `foo.md`, Chinese `foo.zh.md`, and a consistency record `foo.i18n.yaml`. Neither language is canonical — a document may be authored and reviewed Chinese-first and translated to English afterwards, or the reverse; what binds the pair is that both sides must say the same thing, and pairs merge whole (both languages plus the record, never one alone). Policy: [docs/i18n/README.md](../../../../docs/i18n/README.md); translation rules: [docs/i18n/translation-rules.md](../../../../docs/i18n/translation-rules.md); terminology source of truth: [docs/i18n/terminology.md](../../../../docs/i18n/terminology.md).\n- **A sidecar record of both blob hashes makes consistency checkable.** `foo.i18n.yaml` holds the full git blob hash of each side as of the last confirmed-consistent state. An edit to either side without re-confirming the pair is then mechanically detectable as a pure content comparison — no history lookup — and the hashes are computable for files edited in the same PR, which a commit-hash record is not. Re-recording (`verify-translation-pairing --write <pair>`, which requires naming the confirmed pairs — bulk re-record is an explicit `--write --all`) produces a reviewable yaml diff: confirming consistency is an explicit, visible act in the PR.\n- **`verify-translation-pairing` joins `doc-sync`.** The gate ([scripts/verify-translation-pairing.ts](../../../../scripts/verify-translation-pairing.ts)) enforces: every discovered, non-excluded source has a complete pair; every existing pair is complete (all three files) and consistent (both hashes match, switcher links both ways, structural signatures identical); and excluded generated, instruction, or bilingual-by-construction files stay unpaired. [scripts/translation-pairing.manifest.json](../../../../scripts/translation-pairing.manifest.json) contains only explicit exclusions, so no requirement can bypass discovery and receive a weaker check. Source-oriented code gates consume a `.zh.md` fence sequence as a derivative only when its unsuffixed sibling has the same tracked fences in the same order with byte-identical bodies; an incomplete, reordered, reclassified, or changed sequence stays independent, so the owning code gate or pairing gate reports the mismatch.\n- **One corpus-wide requirement.** Every document in scope requires a complete pair from creation; the policy has no per-file rollout state, date cutoff, or README-specific class. README discovery covers every case-insensitive README basename outside vendored, dependency, and ignored build-output trees, including future top-level directories. A site-published pair uses `pairedPages()` so the root locale projects `.zh.md` and `/en/` projects `.md`; creating a counterpart alone does not publish it.\n- **Pairing records are metadata, not Cordis Loader configuration.** Cordis configuration discovery accepts actual `.cordis.yml` and `.cordis.yaml` files while excluding `*.i18n.yaml`, even when the document name contains `cordis`. This preserves validation of executable Loader entries without parsing translation hashes as configuration.\n- **Translation is agent work with human review.** The committed workflow is [.agents/skills/dsh-translate-docs](../../../
2026-07-23 22:41:53 +08:00
},
{
"role": "assistant",
"content": "# Agent Note: 通过�对兄弟文件与�对门�实现�语文档\n\nStatus: implemented\n\n[English](2026-07-02-bilingual-docs-and-pairing-gate.md) | 中文\n\n## 问题\n\n本仓库的文档语料会被公�内外的人和 agent(智能体)以中英两�语言阅读。在没有机制的情况下纯�手工维护第二语言,正是译文�烂的根�:一侧�续演进,�一侧默默失实,而没有门�会注�到。对于这类���,本仓库一贯的�法是将其编�为机械检查(�[质�门�](2026-06-11-quality-gates.md)与 [doc-sync 强制](../../archived/process/2026-06-11-doc-sync-enforcement.md)),因此�语政策�附一�门�一起交付。\n\n## 决策\n\n- **�对兄弟文件,两�语言��。** 一对文档由三个兄弟文件组�:英文 `foo.md`�中文 `foo.zh.md`,以�一份一致性记录 `foo.i18n.yaml`。没有哪�语言是正典:一篇文档�以先用中文撰写和评审�之��译�英文,�之亦�;约��对的是:两侧必须表达相�的内容,且�对整体�并(两�语言加记录,���独�一侧)。政策� [docs/i18n/README.md](../../../../docs/i18n/README.md);翻译规则� [docs/i18n/translation-rules.md](../../../../docs/i18n/translation-rules.md);术语真�� [docs/i18n/terminology.md](../../../../docs/i18n/terminology.md)。\n- **伴�记录�存两侧 blob hash,使一致性�检查。** `foo.i18n.yaml` �存两侧文件在上一次确认一致时�自的完整 git blob hash。此�修改了任一侧而未�新确认�对,都能被机械检测出�(纯内容比较,无需查询历�),而且�一个 PR(Pull Request)内改动的文件也能计算出 hash,commit hash �的记录��到这一点。�新记录(`verify-translation-pairing --write <pair>`,�求点�所确认的�对;批��新记录是显�的 `--write --all`)会产生一份�评审的 yaml diff:确认一致在 PR 中是一个显����的动作。\n- **`verify-translation-pairing` 加入 `doc-sync`。** 门�([scripts/verify-translation-pairing.ts](../../../../scripts/verify-translation-pairing.ts))强制执行以下规则:�个已�现且未排除的�文档都有完整�对;�个现有�对都完整(三个文件�全)且一致(两个 hash 匹��切�行��互链�结构签�一致);被排除的生�文档�指令文档或本身��语的文档�得�对。[scripts/translation-pairing.manifest.json](../../../../scripts/translation-pairing.manifest.json) �包�显�排除项,因此任何�求都无法绕过�现�程而接�较弱的检查。�有当 `.zh.md` 围��列与其无�缀兄弟文件拥有顺�相��正文按字节一致的�一组�跟踪围�时,����的代�门��会将其作为派生内容消费;�完整�顺��更��分类或已改动的�列�会独立�检,因此由其所属的代�门�或�对门�报告�匹�。\n- **全语料统一�求。** 范围内的�篇文档从创建起就必须有完整�对;政策没有�文件推进状��日期分界或 README 专用类别。README �现会覆盖 vendor ����赖目录与被忽略的构建产物目录之外所有文件��区分大�写匹� README 的文件,包括今�新增的顶层目录。�布到文档站的�对使用 `pairedPages()`,由根 locale 投影 `.zh.md`,由 `/en/` 投影 `.md`;仅创建对侧文件并�会�布它。\n- **�对记录是元数�,而�是 Cordis Loader �置。** Cordis �置�现会接�实际的 `.cordis.yml` 和 `.cordis.yaml` 文件,�时排除 `*.i18n.yaml`,�使文档�中包� `cordis` 也�例外。这样既能继续校验�执行的 Loader �置项,��会把翻译 hash 当作�置�解�。\n- **翻译是 agent 的工作,由人评审。** 仓库内置的工作�是 [.agents/skills/dsh-translate-docs](../../../skills/dsh-translate-docs/SKILL.md),与 [dsh-code-review](../.
2026-07-23 22:41:53 +08:00
},
{
"role": "user",
2026-07-23 23:12:56 +08:00
"content": "---\nlayout: doc\n---\n\n# Snapshot note\n\nThe agent performs one step.\n"
2026-07-23 22:41:53 +08:00
}
]
},
"response": {
2026-07-23 23:12:56 +08:00
"translation": "---\nlayout: doc\n---\n\n# 快照说明\n\nagent(智能体)执行一个步骤。",
2026-07-23 22:41:53 +08:00
"review": "- 无修正",
2026-07-23 23:12:56 +08:00
"final": "---\nlayout: doc\n---\n\n# 快照说明\n\n[English](snapshot-note.md) | 中文\n\nagent(智能体)执行一个步骤。\n"
2026-07-23 22:41:53 +08:00
}
}