Files
deepseek-harness/examples/tui-agent
kingwl a00d1e0496 refactor(mode): move exit-tool visibility onto the registry restriction layer; register /mode; drop unconsumed surfaces
The master merge brought the tool registry's per-scope restriction layer
(tools.restrict), which makes dsh-mode's prepend assemble filter a duplicate
enforcement shape: it re-implemented the registry's SDK-section rendering
(renderToolsSdk + the RUN_CODE_NAME exclusion) and hid the exit tool from
prompts only — dispatch stayed open and the execute-time re-check was the
real gate. The service now reconciles a per-agent deny restriction on
agent.ctx at agent/created and at every boundary flush, so wire schemas, the
Code Mode tools:sdk section, AND dispatch resolve exit_plan_mode through the
one registry view (a default-mode call answers UNKNOWN_TOOL, byte-identical
to a no-dsh-mode deployment). The execute-time folded-mode re-check stays as
defense in depth for a direct foreign mode/set append no boundary has
reconciled yet.

Two zero-consumer surfaces removed per the pre-release stance:
- AgentOptions.mode creation seeding (declaration merge + agent/created
  listener); a caller selects through set() before the first turn, and the
  deferred subagent inheritance returns together with its consumer.
- The dropped-definition boundary notice (droppedNoticed + narration):
  custom mode definitions have no production consumer, so nothing can be
  dropped; fold-to-default degradation is unchanged.

The stdio removal had left plan mode ACP-only while docs still claimed a
/mode command. dsh-mode now registers /mode on the plugin-owned command
registry through an optional ctx.inject(['commands']) child (type-only peer
edge on dsh-commands), so the TUI and the ACP slash-command surface both
gain it; examples/tui-agent composes dsh-mode. ACP/TUI expected outputs
refreshed keyless for the available_commands_update delta.

Docs updated in place (mode READMEs, the plan-mode Agent Note's realization
sections); catalogs and graphs regenerated.
2026-07-21 11:11:35 +08:00
..
2026-07-20 19:26:04 +08:00

tui-agent

The full-screen interactive coding agent: DeepSeek V4, local bash and filesystem tools, compaction, subagents, workflows and fresh-agent Ralph iteration, todo_write, session modes (/mode, plan mode with the reviewed exit), timeout/spill policy, and @deepseek-ai/dsh-tui-demo.

Run it

pnpm run demo:tui

The command needs DEEPSEEK_API_KEY in the environment or gitignored repository-root .env. Set RESUME_SESSION_ID to reopen a persisted conversation under ./.sessions.

The TUI renders Markdown history, reasoning, tool-owned terminal/diff/generic cards, token totals, and the latest todo list. Enter submits or steers while the agent runs; Ctrl+O expands cards, Ctrl+R toggles reasoning, Escape cancels, and /help lists commands. ask_user_question opens a keyboard-driven overlay.

Run pnpm run demo:code-mode tui for the Code Mode overlay.

Composition

cordis.yml owns the interactive coding composition directly. code-mode.cordis.yml includes that leaf and replaces the tool presentation mode while adding the code runtime. Non-interactive automation uses the sibling headless-agent composition.

Snapshot tests

tests/snapshots/<scenario>/session.jsonl supplies recorded user prompts and model chunks; sibling child logs drive subagents and workflows. The keyless suite executes those scripts through the real loop and tools, then compares readable terminal cell/style output. Use pnpm run test:snapshot:refresh for presentation-only changes and pnpm run test:snapshot:record with a DeepSeek key when a recorded model journey changes. The implemented TUI snapshot Agent Note owns the scenario matrix.