docs: remove code mode example

This commit is contained in:
Turtle
2026-07-30 10:03:49 +08:00
parent c3b253db28
commit 7e36758cd6
5 changed files with 0 additions and 119 deletions

View File

@@ -1,6 +0,0 @@
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write examples/code-mode/README.md
README.md: 1557483ee98fab60aa63f8c5ec40f7e592c275ba
README.zh.md: c20a9a7dde80eb0e03f17b62b5dc21189ef65f06

View File

@@ -1,35 +0,0 @@
# code-mode
English | [中文](README.zh.md)
Code Mode over the shipped TUI: the model stops calling one tool per turn and instead writes TypeScript programs for a single `run_code` tool, executed in a worker thread.
This leaf is an **overlay**, not a tree. `dsh --config` includes the shared [`apps/cli/base.cordis.yml`](../../apps/cli/base.cordis.yml), applies the [`tui.cordis.yml`](../../apps/cli/tui.cordis.yml) surface overlay, then applies this file — all as sibling patch lists at one include level.
## Run it
```sh
# repo root .env (gitignored) or exported env:
# DEEPSEEK_API_KEY=sk-…
# DEEPSEEK_BASE_URL=https://… # optional; defaults to the public API
pnpm run demo:code-mode
```
`pnpm run demo:code-mode acp` boots the same idea over the ACP transport from [`examples/acp-agent/code-mode.cordis.yml`](../acp-agent/code-mode.cordis.yml).
## What the overlay changes
| Row | Change |
| --- | --- |
| `tools` | `mode: code` — the wire registry collapses to `run_code` plus its generated TypeScript SDK prompt section |
| `system-prompt` | a persona telling the model to batch tool work into one program |
| `tui` | a Code Mode welcome line |
| `code-runtime` | inserted: `@deepseek-ai/dsh-code-runtime-worker`, the worker thread `run_code` executes in |
Everything else — the model backend, executors, filesystem tools, persistence, delegation, and the front door — comes from the base and the TUI overlay.
A patch replaces a row's whole `config` rather than merging into it, so each row above restates every key it owns. A patch whose `id` matches no row is skipped with a Loader warning, so renaming a row in the base or the surface overlay requires updating this file.
## Model Experience
The model sees one tool instead of the full native registry. Its request carries the `run_code` schema and a generated TypeScript SDK section describing the callable surface, which costs more prompt tokens up front but replaces many single-call turns with one program — fewer round trips and fewer intermediate tool results in the transcript. Because the tool catalog is part of the cached request prefix, switching modes invalidates the KV cache for the session.

View File

@@ -1,35 +0,0 @@
# code-mode
[English](README.md) | 中文
在交付的 TUI 之上启用 Code Mode模型不再每轮调用一个工具而是为单一的 `run_code` 工具编写 TypeScript 程序,并在 worker 线程中执行。
本叶节点是一个 **overlay**,而不是配置树。`dsh --config` 会 include 共享的 [`apps/cli/base.cordis.yml`](../../apps/cli/base.cordis.yml),应用 [`tui.cordis.yml`](../../apps/cli/tui.cordis.yml) surface overlay再应用本文件——三者都是同一 include 层级上的平级 patch 列表。
## 运行
```sh
# repo root .env (gitignored) or exported env:
# DEEPSEEK_API_KEY=sk-…
# DEEPSEEK_BASE_URL=https://… # optional; defaults to the public API
pnpm run demo:code-mode
```
`pnpm run demo:code-mode acp` 通过 ACP 传输启动同样的思路,配置位于 [`examples/acp-agent/code-mode.cordis.yml`](../acp-agent/code-mode.cordis.yml)。
## 该 overlay 改动了什么
| 配置项 | 改动 |
| --- | --- |
| `tools` | `mode: code`——线上注册表收敛为 `run_code`,外加其生成的 TypeScript SDK 提示词片段 |
| `system-prompt` | 指示模型把相关工具调用批量写进一个程序的 persona |
| `tui` | Code Mode 的欢迎行 |
| `code-runtime` | 新插入:`@deepseek-ai/dsh-code-runtime-worker`,即 `run_code` 的执行 worker 线程 |
其余部分——模型后端、执行器、文件系统工具、持久化、委派与前端入口——全部来自 base 与 TUI overlay。
配置 patch 会整体替换该配置项的 `config`,而非与其合并,因此上表每一行都必须重述自己拥有的全部键。若某个 patch 的 `id` 不再匹配任何配置项Loader 只会告警并跳过它,所以在 base 或 surface overlay 中重命名配置项时必须同步更新本文件。
## Model Experience模型体验
模型看到的是一个工具,而不是完整的原生注册表。其请求携带 `run_code` 的 schema 以及一段生成的 TypeScript SDK 说明,用于描述可调用面。这会在前置阶段消耗更多提示词 token但把多个单次调用的轮次压缩为一个程序——往返更少transcript 中的中间工具结果也更少。由于工具目录属于被缓存的请求前缀,切换模式会使该会话的 KV 缓存失效。

View File

@@ -1,36 +0,0 @@
# Code Mode over the shipped TUI: the model stops calling one tool per turn and
# instead writes TypeScript programs for a single `run_code` tool, executed in a
# worker thread.
#
# This file is a `--config` OVERLAY, not a tree: `dsh --config
# examples/code-mode/cordis.yml` includes the shared base, applies the TUI
# overlay, then applies these patches, all at one include level. Patches never
# cross an include boundary, so an overlay must stay a patch list rather than a
# file that includes another config.
#
# A patch replaces the targeted row's whole `config`, so each row restates every
# key it owns.
- id: tools
config:
mode: code
- id: system-prompt
config:
persona: |
You are a coding agent powered by the {{model}} model.
You work by writing TypeScript programs for run_code: batch related
tool work into one program, loop and branch where it helps, and print
or return ONLY the findings that matter.
- id: tui
config:
sessionId: !!js configuredAgentIdentities?.main?.id ?? 'main'
welcome: 'TUI Code Mode ready. Give it a multi-tool task.'
showReasoning: true
maxToolOutputLines: 6
# The worker thread `run_code` executes in; the base mounts no code runtime.
- insert:
- id: code-runtime
name: '@deepseek-ai/dsh-code-runtime-worker'

View File

@@ -1,7 +0,0 @@
{
"name": "code-mode-example",
"private": true,
"version": "0.0.1",
"type": "module",
"description": "Runnable overlay: the shipped TUI composition with the model-facing registry reduced to the run_code transport"
}