mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
Session format v2 embeds each attempt's compact stream in assistant/message and assistant/attempt, but Host and client consumers still expanded it into per-member TimedStreamChunk arrays and did per-member work; expandAssistantStream materializes the full array before find/toReversed/break can answer. Session Stats (the projection phase of every Session open), the token meter's usage and provider-assembly folds, the subagent output fold, and the Session Controller image lookup still paid O(members) allocation and time per settlement. The Chat and Trajectory definitions were already settled from message.content on master; the remaining per-member folds stay. dsh-llm now exports record-level readers (first token, visible content, visible text, last raw chunk of a type, raw chunks of a type, joined text, run-aware assembly, per-run first-token/first-visible times) that scan the compact records once with early exit. Session Stats reads assistantStreamFirstTokenTime, the token meter reads lastAssistantStreamChunk(stream, 'usage') and assembles through assembleAssistantStream, the subagent output fold appends joinAssistantStreamText, and the Session Controller scans assistantStreamChunks(stream, 'block-end'). expandAssistantStream is deliberately not memoized: retaining expansions costs roughly ten times the compact stream for the Session's lifetime. It remains the validating path at durable boundaries. Synthetic 200-turn v0 migration benchmark, median of five: first-open projection 28.0 ms -> 5.4 ms, first-open total 76.9 -> 50.0 ms, peak RSS 137.2 -> 94.9 MB; reopen projection 17.8 -> 5.6 ms; all phase budgets and the 128 MB heap constraint keep passing.
description, kind
| description | kind |
|---|---|
| The subagent package group: the delegation seam, its in-process and out-of-process backends, and the model-facing delegation tools. | package-group |
subagent/ — subagent capability family
English | 中文
Summary
The subagent group is the delegation family: it lets an agent hand a task to a child agent, wait for or continue the child's work, and keep every child discoverable. One contract (ctx.subagents) serves any number of named providers, so a single composition can mix in-process children (fresh, or forked from the parent's completed history) with out-of-process children — an ACP agent, a real Codex or Claude Code installation, or a complete Harness runtime over the SDK. The model-facing tools expose delegation, adjacent-Agent messaging, and listing to agents, and a parent can always see which children exist and whether they are live or stored. This page maps the group; each package README owns its package contract.
Table of Contents
Packages
| Package | Role | ctx key |
|---|---|---|
subagent/ |
Defines the delegation service: provider registry, one-shot runs, continuable children, and discovery | ctx.subagents |
subagent-in-process-driver/ |
Provides the shared in-process run driver | — |
subagent-spawn-in-process/ |
Runs a fresh in-process child | registers on ctx.subagents |
subagent-fork-in-process/ |
Runs an in-process child seeded from the parent's completed history | registers on ctx.subagents |
subagent-acp/ |
Runs an out-of-process child over the Agent Client Protocol | registers on ctx.subagents |
subagent-codex/ |
Runs a real Codex child through the official app-server protocol | registers on ctx.subagents |
subagent-claude-code/ |
Runs a real Claude Code child through the official Agent SDK | registers on ctx.subagents |
subagent-dsh-sdk/ |
Runs an out-of-process Harness child through the TypeScript SDK | registers on ctx.subagents |
tool-subagent/ |
Exposes delegation to the model | registers on ctx.tools |
tool-subagent-control/ |
Exposes adjacent-Agent messaging, interrupt, and listing to the model | registers on ctx.tools |
Related documentation
- Subagent subsystem — the service contract, provider contract, and terminal result semantics.
- Subagent capability seam — the design record for the delegation capability family.
- Continuable subagents — durable children that accept follow-up turns.
- tool-subagent-control README — the follow-up, interrupt, and listing surface.
Dev Note
None.