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

61 lines
129 KiB
JSON
Raw Normal View History

2026-07-23 22:41:53 +08:00
{
"request": {
"targetFilename": "snapshot-note.zh.md",
"messages": [
{
"role": "system",
2026-08-09 11:21:20 +08:00
"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\nDeepSeek Harness is under internal testing. Features and interfaces may change.\n\nThe internal build uploads all Session Logs by default to help diagnose reported problems. Set `DSH_TELEMETRY_DISABLED=1` to disable telemetry. Send feedback through the internal WeChat group.\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 default active checkout is `~/.dsh/source/current`, and the launcher is linked into `~/.local/bin`. Re-run the installer to update. [`scripts/install.sh`](scripts/install.sh) owns alternate locations, update mechanics, and recovery 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### Profiles\n\n`dsh` boots profiles — ordered stacks of plugin-bundle patch layers under your own overrides in `$DSH_HOME/profiles/<name>`:\n\n```sh\ndsh --profile web # the browser UI (same as: dsh web)\ndsh plugin --profile tui add <package> # install a plugin into a custom profile\ndsh --profile tui # boot it\n```\n\nThe [CLI contract](apps/cli/README.md#profiles) describes profile layout, layer semantics, and config dump commands.\n\n### Headless\n\nRun one task, print the final answer, and exit:\n\n```sh\ndsh run \"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.** Anything visible to the model is logged in the authoritative session stream; persistence, resume/fork/query, replay, telemetry, and UIs derive from the same events. See the [session-log architecture](docs/architecture.md#session-log).\n- **Code Mode (opt-in).** It exposes a `run_code` tool and a generated TypeScript SDK; only program output re-enters model context. See [Code Mode](packages/core/tools/README.md#code-mode).\n- **Self-referential Cordis tools are opt-in.** They let the agent inspect its live runtime and mount or unmount plugins while it r
2026-07-23 22:41:53 +08:00
},
{
"role": "assistant",
2026-08-09 11:21:20 +08:00
"content": "# DeepSeek Harness\n\n[English](README.md) | 中文\n\nDeepSeek Harness(`dsh`)是一款基于 DeepSeek Harness SDK æž„å»ºçš„å¼€æº coding agent(智能体)。\n\n它采用了**一切皆æ’ä»¶**的架构。\n\n## 内测声明\n\nDeepSeek Harness 正处于内部测试阶段,功能和接å£å¯èƒ½å‘生å˜åŒ–。\n\nä¸ºå¸®åŠ©è¯Šæ–­ä¸ŠæŠ¥çš„é—®é¢˜ï¼Œå†…æµ‹ç‰ˆæœ¬é»˜è®¤ä¸Šä¼ æ‰€æœ‰ä¼šè¯æ—¥å¿—。设置 `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/current`,å¯åŠ¨å™¨é“¾æŽ¥åˆ° `~/.local/bin`ã€‚å†æ¬¡è¿è¡Œå®‰è£…器å³å¯æ›´æ–°ã€‚å…¶ä»–ä½ç½®ã€æ›´æ–°æœºåˆ¶å’Œæ¢å¤é€‰é¡¹ç”± [`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### Profile\n\n`dsh` å¯åЍ profile:按åºå æ”¾çš„æ’ä»¶ç»„åˆåŒ… patch 层,之上å†å åŠ ä½ åœ¨ `$DSH_HOME/profiles/<name>` 中的自有覆盖层:\n\n```sh\ndsh --profile web # the browser UI (same as: dsh web)\ndsh plugin --profile tui add <package> # install a plugin into a custom profile\ndsh --profile tui # boot it\n```\n\nprofile 布局ã€å±‚语义与é…ç½®è¾“å‡ºå‘½ä»¤è¯¦è§ [CLI(命令行界é¢ï¼‰çº¦å®š](apps/cli/README.md#profiles)。\n\n### Headless\n\nè¿è¡Œä¸€é¡¹ä»»åŠ¡ï¼Œæ‰“å°æœ€ç»ˆç­”案åŽé€€å‡ºï¼š\n\n```sh\ndsh run \"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- **è¿è¡Œå¯é‡å»ºã€‚** 凡是模型å¯è§çš„内容,都会记录在æƒå¨ä¼šè¯æµä¸­ï¼›æŒä¹…åŒ–ã€æ¢å¤ï¼forkï¼æŸ¥è¯¢ã€å›žæ”¾ã€é¥æµ‹å’Œ UI å‡ä»ŽåŒä¸€ç»„事件派生。å‚è§[ä¼šè¯æ—¥å¿—æž¶æž„](docs/architecture.md#session-log)。\n- **Code Mode(需显å¼å¯ç”¨ï¼‰ã€‚** 它会æä¾› `run_code` 工具和生æˆçš„ TypeScript SDKï¼Œåªæœ‰ç¨‹åºè¾“å‡ºä¼šé‡æ–°è¿›å…¥æ¨¡åž‹ä¸Šä¸‹æ–‡ã€‚å‚è§ [Code Mode](packages/core/tools/README.md#code-mode)。\n- **自指 Cordis 工具需显å¼å¯ç”¨ã€‚** 这些工具å¯è®© agent 检查自身的实时è¿è¡Œæ—¶ï¼Œå¹¶åœ¨è¿è¡Œä¸­æŒ‚载或å¸è½½æ’件。å‚è§ [Cordis 工具](packages/self
2026-07-23 22:41:53 +08:00
},
{
"role": "user",
"content": "# Development guide\n\nEnglish | [中æ](development.zh.md)\n\nThe setup tutorial takes a new contributor from prerequisites to a checked checkout. The contributor reference that follows covers repository layout, daily workflow, and CI shape. Design rationale and implementation details belong to the linked Agent Notes and scripts.\n\n## Setup tutorial\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 configures worktree-local Lefthook hooks and the `dsh-translation-pairing` Git merge driver through `scripts/install-lefthook.mjs`. The [worktree-local hooks Agent Note](../.agents/notes/implemented/process/2026-07-27-worktree-local-lefthook.md) owns the hook-path safety contract; the [automatic pairing merges Agent Note](../.agents/notes/implemented/process/2026-08-08-automatic-translation-pairing-merges.md) owns the merge driver.\n\nIf either integration is missing because dependencies were restored from cache or `postinstall` was skipped, install them manually:\n\n```sh\nnode scripts/install-lefthook.mjs\n```\n\nIf the wrapper rejects existing Git configuration or reports a stale lock, follow its diagnostic and the linked Agent Note rather than editing worktree metadata speculatively. After moving a checkout, rerun the wrapper to regenerate the owned path.\n\nRun typecheck once after a fresh clone:\n\n```sh\npnpm run typecheck\n```\n\nSetup is complete when `pnpm run typecheck` exits successfully.\n\n## Contributor reference\n\n### TypeScript project layout\n\nThe repository uses isolated Host and Client aggregates. An ordinary package is registered in exactly one aggregate: Host packages in `tsconfig.host.json` and Client packages in `tsconfig.client.json`.\n\n| File | Role | Forms a program? |\n|---|---|---|\n| `tsconfig.json` | Solution root: `extends` base, `files: []`, and references to the two aggregates. It is the tsserver discovery entry and the entry for explicitly running the complete Project Reference graph; through the inherited `paths`, it is also the resolution config for tsx running `examples/` and `scripts/`. | No |\n| `tsconfig.host.json` | Host aggregate: Host packages, examples, tests, scripts, website, and the exceptional Host project of `api/remotes`. | Yes |\n| `tsconfig.client.json` | Client aggregate: `packages/client/*` packages and their tests, `apps/web`, and the exceptional Client project of `api/remotes`. | Yes |\n| `tsconfig.base.json` | Shared compilerOptions and the source `paths` map. Also the resolution facade the vitest configs point vite-tsconfig-paths at: it has no `include`, so its `paths` apply to every importer. | No |\n| `tsconfig.base.client.json` | Browser compiler shape (`jsx`, DOM libs, `types: []`) extended by the Client aggregate and every `packages/client/*` package. | No |\n\nHost and Client stay two aggregate programs because both sides declaration-merge the cordis `Context` interface under the same keys with different services; one program seeing both merges reports a collision. The collision exists only inside a `ts.Program` â module resolution never triggers it â which is why the solution may reference both aggregates and one paths facade may span both sides. Three disciplines follow:\n\n- `tsconfig.base.json` never gains `include` or `files`: they would leak into every extending package project and narrow the facade's match-all scope.\n- A script that builds a repo-wide `ts.Program` seeds `tsconfig.host.json` or `tsconfig.client.json` explicitly â
2026-07-23 22:41:53 +08:00
},
{
"role": "assistant",
"content": "# 开呿Œ‡å—\n\n[English](development.md) | 中文\n\næ­å»ºæ•™ç¨‹å¼•导新贡献者从准备å‰ç½®æ¡ä»¶å¼€å§‹ï¼Œç›´åˆ°æ£€å‡ºé€šè¿‡æ£€æŸ¥ã€‚åŽé¢çš„贡献者å‚考介ç»ä»“åº“å¸ƒå±€ã€æ—¥å¸¸å·¥ä½œæµå’Œ CI å½¢æ€ã€‚è®¾è®¡ä¾æ®ä¸Žå®žçŽ°ç»†èŠ‚å±žäºŽé“¾æŽ¥çš„ Agent Note 和脚本。\n\n## æ­å»ºæ•™ç¨‹\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安装过程还会通过 `scripts/install-lefthook.mjs` é…ç½® worktree 本地的 Lefthook é’©å­å’Œ `dsh-translation-pairing` Git åˆå¹¶é©±åŠ¨ã€‚[worktree æœ¬åœ°é’©å­ Agent Note](../.agents/notes/implemented/process/2026-07-27-worktree-local-lefthook.md) 负责钩å­è·¯å¾„的安全约定;[自动é…对åˆå¹¶ Agent Note](../.agents/notes/implemented/process/2026-08-08-automatic-translation-pairing-merges.md) è´Ÿè´£åˆå¹¶é©±åŠ¨ã€‚\n\n如果ä¾èµ–是从缓存æ¢å¤æˆ– `postinstall` 被跳过而导致任一集æˆç¼ºå¤±ï¼Œè¯·æ‰‹åŠ¨å®‰è£…ï¼š\n\n```sh\nnode scripts/install-lefthook.mjs\n```\n\n如果包装脚本拒ç»çŽ°æœ‰ Git é…置或报告陈旧é”,请éµå¾ªå…¶è¯Šæ–­å’Œæ‰€é“¾æŽ¥çš„ Agent Note,ä¸è¦å‡­çŒœæµ‹ç¼–辑 worktree 元数æ®ã€‚移动检出目录åŽï¼Œè¯·é‡æ–°è¿è¡ŒåŒ…è£…è„šæœ¬ä»¥é‡æ–°ç”Ÿæˆè‡ªæœ‰è·¯å¾„。\n\n新克隆åŽè¯·å…ˆè¿è¡Œä¸€æ¬¡ç±»åž‹æ£€æŸ¥ï¼š\n\n```sh\npnpm run typecheck\n```\n\n`pnpm run typecheck` æˆåŠŸé€€å‡ºå³è¡¨ç¤ºæ­å»ºå®Œæˆã€‚\n\n## 贡献者å‚考\n\n### TypeScript 项目布局\n\n仓库使用相互隔离的 Host 与 Client aggregate。普通包åªç™»è®°è¿›å…¶ä¸­ä¸€ä¸ª aggregateï¼›Host 包进入 `tsconfig.host.json`,Client 包进入 `tsconfig.client.json`。\n\n| 文件 | 角色 | æ˜¯å¦æž„æˆ program? |\n|---|---|---|\n| `tsconfig.json` | solution 根:`extends` baseã€`files: []`ã€å¼•用两个 aggregate。它是 tsserver å‘现入å£ï¼Œä¹Ÿæ˜¯æ˜¾å¼æ‰§è¡Œæ•´å¼  Project Reference 图时的入å£ï¼›ç»ç»§æ‰¿çš„ `paths` 充当 tsx è¿è¡Œ `examples/` 与 `scripts/` 时的解æžé…置。 | å¦ |\n| `tsconfig.host.json` | Host aggregate:Host 包ã€ç¤ºä¾‹ã€æµ‹è¯•ã€è„šæœ¬å’Œ websiteï¼Œä»¥åŠ `api/remotes` çš„ Host 特例 project。 | 是 |\n| `tsconfig.client.json` | Client aggregate:`packages/client/*` 包åŠå…¶æµ‹è¯•ã€`apps/web`ï¼Œä»¥åŠ `api/remotes` çš„ Client 特例 project。 | 是 |\n| `tsconfig.base.json` | 共享 compilerOptions 与æºç  `paths` æ˜ å°„ã€‚åŒæ—¶æ˜¯å„ vitest é…置让 vite-tsconfig-paths 指å‘的解æžé—¨é¢ï¼šå®ƒæ²¡æœ‰ `include`,因此其 `paths` 适用于任何 importer。 | å¦ |\n| `tsconfig.base.client.json` | æµè§ˆå™¨ç¼–译形状(`jsx`ã€DOM libã€`types: []`),由 Client aggregate å’Œæ¯ä¸ª `packages/client/*` 包 extends。 | å¦ |\n\nHost 与 Client ä¿æŒä¸¤ä¸ª aggregate program,是因为两侧在相åŒé”®ä¸‹ä»¥ä¸åŒæœåС坹 cordis `Context` 接å£åšå£°æ˜Žåˆå¹¶ï¼›å•一 program åŒæ—¶çœ‹åˆ°ä¸¤ä»½åˆå¹¶ä¼šæŠ¥å†²çªã€‚è¿™ç§å†²çªåªå­˜åœ¨äºŽ `ts.Program` 内部——模å—è§£æžæ°¸è¿œä¸ä¼šè§¦å‘它——所以 solution å¯ä»¥åŒæ—¶å¼•用两个 aggregate,一个 paths é—¨é¢ä¹Ÿå¯ä»¥æ¨ªè·¨ä¸¤ä¾§ã€‚由此推出三æ¡çºªå¾‹ï¼š\n\n- `tsconfig.base.json` æ°¸ä¸æ·»åŠ  `include` 或 `files`:它们会泄æ¼è¿›æ¯ä¸ª extends 它的包项目,并收窄门é¢çš„全匹é…范围。\n- 构造全仓 `ts.Program` 的脚本显å¼ç§å­ `tsconfig.host.json` 或 `tsconfig.client.json`——永ä¸ç§å­æ ¹ solution,因为把两个 aggregate 展平进一个 program 会撞上 `Context` åˆå¹¶å†²çªã€‚\n- 新包åªç™»è®°è¿›
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\n When two branches contain valid confirmations of the same pair, the installed `dsh-translation-pairing` Git merge driver composes a new record only if Git's default text merge succeeds for both recorded owner-blob triplets and the merged pair retains its required switchers and structural signature. The Chinese file must retain its English backlink; an authored English source must retain its Chinese link, while a listed generated English source is exempt. Any uncertain shape remains an ordinary conflict; `pnpm run resolve-translation-pairing-conflicts` applies the same fail-closed operation to a merge that has already stopped, stages every safe pairing record, and exits unsuccessfully when other pairing conflicts remain. The [automatic pairing merges Agent Note](../../.agents/notes/implemented/process/2026-08-08-automatic-translation-pairing-merges.md) owns the mechanism and alternative
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\n 当两个分支都包å«åŒä¸€é…对的有效确认时,已安装的 `dsh-translation-pairing` Git åˆå¹¶é©±åЍåªä¼šåœ¨ Git 默认文本åˆå¹¶èƒ½åˆ†åˆ«å¹²å‡€åˆå¹¶è®°å½•所指å‘的英文三方 blob 与中文三方 blob,且åˆå¹¶åŽçš„é…对ä»ä¿ç•™å¿…需的语言切æ¢è¡Œå’Œç»“æž„ç­¾åæ—¶ï¼Œç»„åˆå‡ºä¸€ä»½æ–°è®°å½•。中文文件必须ä¿ç•™æŒ‡å‘英文的åå‘链接;普通撰写的英文æºå¿…é¡»ä¿ç•™æŒ‡å‘中文的链接,而清å•内的生æˆè‹±æ–‡æºä¸ä½œæ­¤è¦æ±‚。任何无法确定的情形都ä¿ç•™ä¸ºæ™®é€šå†²çªï¼›`pnpm run resolve-translation-pairing-conflicts` 会对已ç»åœæ­¢çš„åˆå¹¶æ‰§è¡ŒåŒä¸€å¥—é‡é”™å³ä¿ç•™å†²çªçš„æ“ä½œï¼Œæš‚å­˜æ¯ä»½å¯å®‰å…¨ç”Ÿæˆçš„é…对记录,并在还有其他é…å¯¹å†²çªæ—¶ä»¥éžé›¶çжæ€é€€å‡ºã€‚[自动é…对åˆå¹¶ Agent Note](../../.agents/notes/implemented/process/2026-08-08-automatic-translation-pairing-merges.md) 负责记录该机制与备选方案。\n- **语言切æ¢è¡Œã€‚** 中文文件一律在 H1 标题åŽç«‹å³ä»¥ `[English](foo.md) | 中文` 链回英文。普通撰写的英文文件在åŒä¸€ä½ç½®ä»¥ `English | [中文](foo.zh.md)` 互链;清å•内ç
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",
2026-08-09 11:21:20 +08:00
"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
}
}