2nd dokployH
Find a file
Tianyi Cui 7aabd2a3df Add in-process subagent backends: spawn (fresh) and fork (seeded)
The second PR of the subagent seam: the two in-process backends that run a
child agent on the same cordis context, reusing the agent factory's quiescent
AgentHandle teardown. Both register on ctx.subagents (PR1's named-provider
registry) and share one run driver.

- dsh-subagent-spawn: a FRESH child via ctx.agents.create — own session, the
  parent's model by default (overridable), zero inherited conversation. Also
  exports the shared in-process run driver (startInProcessRun): mint ids, stamp
  cwd/parentSession-lineage/depth, drive the one-shot (send → whenIdle), read
  the last assistant/message + turn/end reason, dispose to quiescence.
- dsh-subagent-fork: a child SEEDED with the parent's balanced completed-turn
  prefix (the log up to and including its last turn/end), so the child inherits
  context. The in-flight unbalanced turn is excluded — a raw seed would fail the
  invariants replay. Proven: a regression test goes red if the boundary seeds
  the open turn.
- Seam extension: CreateAgentOptions.seed, threaded through AgentLoop.createAgent
  → ctx.sessions.prepare({ seed }) (the primitive resume already used). This is
  the fork-lineage path the TODO(sub-agents) markers anticipated.
- Depth: a merge-extensible AgentOptions.subagentDepth (0 top-level, parent+1 for
  a child); the depthLimit capability refuses a spawn past request.maxDepth.

Tests: real-loop unit tests for both backends (mock MODEL only, real loop +
invariants), a multi-subagent test (one parent drives a fork AND a spawn child
then keeps working), and a with-key e2e (a real parent delegates via the
`subagent` tool to a real child that writes a file on disk — world-verified).
100% per-file coverage. The coding-agent demo wires the spawn backend + tool.

Snapshot coverage of nested agents is deferred to a stacked follow-up
(TODO(subagent-snapshots)): dsh-llm-replay is a single global positional cursor
that cannot route calls to a parent vs. a child on one context. Recorded in the
RFC's deferrals and a new AGENTS.md rule: designing a subsystem must design its
test infrastructure END TO END up front, verifying the snapshot/e2e harness can
express the new shape — a gap this plan hit.
2026-06-22 05:58:40 +08:00
.agents/skills docs(rfc): classify RFCs by kind via path-encoded subdirectories 2026-06-20 22:29:45 +08:00
.claude docs: accuracy sweep, architecture restructure, two ADRs, review skill 2026-06-13 22:05:34 +08:00
.github/workflows fix review findings: harden the app bins + built-bin smokes, arch-exception doc, snapshot fixture-guard 2026-06-21 15:39:24 +08:00
docs Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
examples Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
packages Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
scripts Fix review findings: lifecycle containment, configurable tool name, coverage, type catalog 2026-06-21 23:15:43 +08:00
vendor feat: migrate to pnpm 2026-06-16 14:55:37 +08:00
.gitignore fix(ui-stdio): cancel EOF-exit timer on dispose; harden config defaults; doc fixes 2026-06-19 14:53:07 +08:00
AGENTS.md Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
CLAUDE.md Initialize repo with README, AGENTS.md, and CLAUDE.md symlink 2026-06-10 22:58:56 +08:00
eslint.config.mjs Reorganize packages into a modular hierarchy 2026-06-20 22:55:20 +08:00
knip.json Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
lefthook.yml feat(acp-example): snapshot harness, normalizers, wiring, and handshake scenario 2026-06-19 03:36:12 +08:00
LICENSE Initialize repo with README, AGENTS.md, and CLAUDE.md symlink 2026-06-10 22:58:56 +08:00
package.json refactor(examples): extract the app spine into dsh-agent-core + app packages 2026-06-21 12:06:38 +08:00
pnpm-lock.yaml Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
pnpm-workspace.yaml Reorganize packages into a modular hierarchy 2026-06-20 22:55:20 +08:00
README.md feat: migrate to pnpm 2026-06-16 14:55:37 +08:00
tsconfig.base.json Add subagent capability seam: interface, mock backend, model-facing tool 2026-06-21 22:31:56 +08:00
tsconfig.build.json Add in-process subagent backends: spawn (fresh) and fork (seeded) 2026-06-22 05:58:40 +08:00
tsconfig.json Fix CI: order steps by artifact dependency, resolve fresh-clone builds 2026-06-11 23:10:43 +08:00
tsconfig.test.json Reorganize packages into a modular hierarchy 2026-06-20 22:55:20 +08:00
tsconfig.typecheck.json Add subagent capability seam: interface, mock backend, model-facing tool 2026-06-21 22:31:56 +08:00
tsdown.config.ts Reorganize packages into a modular hierarchy 2026-06-20 22:55:20 +08:00
vitest.config.ts refactor(examples): extract the app spine into dsh-agent-core + app packages 2026-06-21 12:06:38 +08:00
vitest.e2e.config.ts Reorganize packages into a modular hierarchy 2026-06-20 22:55:20 +08:00
vitest.snapshot.config.ts ci+fix: run snapshot tests in CI and load .env only when recording 2026-06-19 04:28:09 +08:00

DeepSeek Harness

Monorepo for the DeepSeek Harness group.

Projects

  • DeepSeek Code — DeepSeek's coding agent product.

Development

This monorepo is built on the Cordis framework (vendored as source under vendor/), microkernel-style: everything is a plugin.

pnpm install
pnpm run test          # vitest
pnpm run demo:echo     # runnable echo-agent example (no API key needed)
pnpm run demo:coding   # the real DeepSeek coding agent (needs DEEPSEEK_API_KEY)

For humans, start with the development guide for local setup, hooks, environment variables, and quality gates, then read the architecture design before package work. Local context lives in packages/ and vendor/.

For agents, follow AGENTS.md.