Files
deepseek-harness/examples
Turtle f290a8b851 refactor(cli)!: one shared base config with per-surface overlays
`dsh` shipped two config trees that were 43 rows the same: apps/cli/cordis.yml
composed web as 74 flat rows, while the TUI booted examples/tui-agent/cordis.yml
whose single `@deepseek-ai/dsh-tui-demo` row mounted twelve plugins behind a
twenty-key pass-through Config. Neither file was what its location claimed —
apps/cli hardcoded the "example" as the product default and the "demo" bundle
was the application — and every capability change had to be made twice.

- apps/cli/base.cordis.yml holds the 43 shared rows; tui.cordis.yml and
  web.cordis.yml are patch lists stating only what differs per surface
- overlays apply as SIBLING patch lists at one include level, because include
  patches never cross an include boundary. Precedence: base < surface <
  (--config | personal ~/.dsh/config.yaml) < launcher flag/profile patches
- `--config` now applies an overlay INSTEAD OF the personal one, so a demo or
  test tree never inherits the user's route; new `--config-replace` boots a file
  as the entire tree (the old `--config` behaviour). Both survive /resume
- vendor/include: index each `insert`ed row as it is added so a later patch can
  configure or disable it. Upstream built the id index once before the patch
  loop, leaving every surface-only row — the whole TUI front door — silently
  unpatchable from user config. Logged as local modification 8
- session identity moves to dsh-agent-loop's CONFIGURED_AGENT_IDENTITIES_KEY;
  dsh-tui's MAIN_SESSION_ID_KEY is deleted (only the bundle read it)
- delete examples/tui-agent, examples/cordis-agent, packages/examples/tui-demo;
  TUI tests → apps/cli/tests, cordis e2e → packages/cordis/tool-cordis/tests,
  examples/code-mode survives as an overlay leaf
- `dsh web` gains --config, threaded into AppCLIEntry as an extra overlay

Three latent defects surfaced and are fixed here: the TUI captured the optional
sessionQuery service once at construction and could permanently disable /resume
when it won the mount race; the session-store root silently reverted to a
project-local ./.sessions; --config-replace was dropped by the resume handoff.

Verified by booting each tree through the real Loader (TUI 55 entries, web 75,
zero unsettled) rather than reading YAML. All eight terminal snapshots replay
byte-identically; 14/14 PTY smoke, 112/112 snapshots, 25/25 doc-sync, hygiene
and lint clean.
2026-07-29 21:15:42 +08:00
..

Examples

English | 中文

Runnable demos (not workspaces) that showcase how the harness is wired. Each example is a thin leaf: either a cordis.yml tree that picks swappable backends and loads one app package, or an overlay — a patch list dsh --config applies over the shipped composition (apps/cli/base.cordis.yml plus a surface overlay). Bundled compositions live in @deepseek-ai/dsh-cli-demo, @deepseek-ai/dsh-acp-demo, and their shared @deepseek-ai/dsh-agent-spine-demo bundle; the dsh surfaces use flat config trees instead. There is no start.ts; the terminal demo:* scripts boot through the dsh CLI, and the headless/ACP scripts invoke the cli-demo/acp-demo bins.

headless-agent

A non-interactive agent demo that accepts one positional task, runs one complete model/tool turn on the @deepseek-ai/dsh-cli-demo app, persists a fresh session, prints text, json, or stream-json, and exits.

Run with: pnpm run demo:headless "task" (needs DEEPSEEK_API_KEY). See headless-agent/README.md for the output contract, safety boundaries, and snapshot suite.

code-mode

An overlay over the shipped TUI that reduces the model-facing registry to the run_code transport, so the model batches tool work into TypeScript programs instead of one call per turn.

Run with: pnpm run demo:code-mode (needs DEEPSEEK_API_KEY). See code-mode/README.md. The interactive agent itself is not an example: pnpm run demo:tui boots apps/cli/tui.cordis.yml over the shared base, and its PTY and snapshot scenarios live in apps/cli/tests/.

jsonrpc-agent

An unattended coding agent driven through the Python SDK: JSON-RPC stdio, foreground-only bash, read / write / edit, one foreground subagent, todo_write, JSONL persistence, and compaction. It excludes terminal UI, stdout logging, approvals, skills, and background task controls. See jsonrpc-agent/README.md.

web-cordis

The self-referential demo: the coding spine plus @deepseek-ai/dsh-tool-cordis, whose three tools (cordis_inspect / cordis_mount / cordis_unmount) let the agent inspect the current DSH process, mount model-written temporary Plugins (an event listener, a brand-new tool, or a service another temporary Plugin injects), and unmount them again. These Plugins exist only in memory and share one internal cordis-dynamic fiber subtree; ctx.fs/ctx.web ride along provider-only as capabilities they can use.

Run the browser UI at http://127.0.0.1:3081 with pnpm run demo:cordis, or the ACP server with pnpm run demo:cordis acp (both need DEEPSEEK_API_KEY). See the toolset Agent Note for the design and sandbox caveats.

acp-agent

An agent exposed as an Agent Client Protocol (ACP) automation server over JSON-RPC stdio, via @deepseek-ai/dsh-acp-demo. Programmatic clients create fresh sessions, send text prompts, consume committed assistant text, answer one-shot permission requests, and cancel work. It owns the ACP keyless snapshot suite.

Run with: pnpm run demo:acp (needs DEEPSEEK_API_KEY); pnpm run demo:code-mode acp boots the same server in Code Mode via the code-mode.cordis.yml overlay. See acp-agent/README.md for the protocol and snapshot-test contracts.

The default cordis.yml composes @deepseek-ai/dsh-sandbox-local, @deepseek-ai/dsh-bash-sandbox, and @deepseek-ai/dsh-user-approval. workspace-write confines bash and filesystem mutations to each session workspace; a wider retry becomes a one-shot machine permission request over ACP.