The snapshot tier was built single-session: dsh-llm-replay served calls from one global positional cursor, and the harness harvested one session log. A subagent runs as a second agent with its own session, so a parent→child scenario could neither replay deterministically nor harvest the child's log. This resolves the TODO(subagent-snapshots) deferral from the subagent RFC. - Stamp the calling session id onto the model request: GenerateOptions.sessionId (typed Branded<'SessionId'> to avoid the dsh-llm↔dsh-session cycle), set by the agent loop from agent.session.id. Adapters ignore it; an llm/stream listener routes by it. - Key replay per session: dsh-llm-replay loads the parent log plus one per child (childFiles / $DSH_SNAPSHOT_CHILD_FILES), derives a script per recorded session, and binds each live (freshly-random) session to a recorded script by first-call order — parent first (earliest createdAt, first to stream). Keys by WHO calls, so it survives a future concurrent/backgrounded subagent; a global cursor would not. An unrecorded extra session fails loud. - Harvest every log: the harness collects all .jsonl across cwd buckets, ordered primary-first (top-level, then children by createdAt), and RunResult exposes the plural sessionLogs. The spec writes each back on record (session.jsonl + session.<n>.jsonl) and diffs each against its fixture on replay. - Wire the subagent seam + spawn + fork + tool into the acp-agent example (both cordis configs) and add two nested scenarios recorded against the real API: subagent-spawn (parent + 1 child) and subagent-multi (parent + 2 children, 3 sessions). Both replay keyless in the default gate. A new RFC documents the design (docs/rfc/implemented/testing/). Single-session replay is unchanged (a call with no sessionId is one anonymous primary session). TODO follow-up: a dedicated branded-ids package could own the SessionId brand and dissolve the cross-package cycle note; out of scope for this testing PR.
64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
# Snapshot-test REPLAY config: the acp-agent plugin tree with the model backend
|
|
# swapped to llm-replay (serves a recorded session JSONL — no API key, no
|
|
# network). The dsh-acp-agent bin selects this file for DSH_SNAPSHOT=replay.
|
|
#
|
|
# Same app as cordis.yml (@deepseek-ai/dsh-acp-agent: the agent-core spine +
|
|
# JSONL persistence + the ACP bridge) — only the LLM backend differs: llm-replay
|
|
# here, llm-deepseek there. It can't reuse the real adapter because llm-deepseek's
|
|
# apply() throws without DEEPSEEK_API_KEY, killing a keyless replay run at boot.
|
|
#
|
|
# stdout is reserved for the ACP JSON-RPC protocol — no stdout logger (the app
|
|
# package omits it). The replay fixture path comes from $DSH_SNAPSHOT_FILE (and
|
|
# an optional $DSH_SNAPSHOT_OVERRIDE sidecar), set by the snapshot harness.
|
|
|
|
# The replay adapter: short-circuits llm/stream with the recorded log's chunks,
|
|
# in place of llm-deepseek.
|
|
- id: llm-replay
|
|
name: '@deepseek-ai/dsh-llm-replay'
|
|
|
|
# Local bash executor (the agent's only tool, via agent-core's tool-bash schema).
|
|
- id: bash
|
|
name: '@deepseek-ai/dsh-bash-local'
|
|
config:
|
|
timeoutMs: 60000
|
|
|
|
# The ACP server app — identical to cordis.yml's entry.
|
|
- id: acp-agent
|
|
name: '@deepseek-ai/dsh-acp-agent'
|
|
config:
|
|
model: deepseek-v4-flash
|
|
persistenceRoot: !!js process.env.DSH_SNAPSHOT_SESSIONS_ROOT ?? './.sessions'
|
|
systemPrompt: |
|
|
You are a coding assistant driven over the Agent Client Protocol.
|
|
|
|
Your tools are bash (plus bash_output/bash_kill for background tasks)
|
|
and subagent. Do ALL file operations through bash: read with
|
|
cat/sed/head, search with grep, write with heredocs (cat <<'EOF' >
|
|
file), edit with sed or a rewrite. Each bash call runs in a fresh
|
|
shell — pass workdir instead of cd. Check the [exit code: N] marker;
|
|
verify your work. Keep answers brief and factual.
|
|
|
|
Use the subagent tool to delegate a focused, self-contained subtask to
|
|
a fresh child agent (it works in its own context and returns only its
|
|
final result) — give it a complete, standalone instruction.
|
|
|
|
# The subagent seam + both in-process backends + the model-facing `subagent`
|
|
# tool — identical to cordis.yml's wiring (only the LLM backend differs above).
|
|
- id: subagent
|
|
name: '@deepseek-ai/dsh-subagent'
|
|
|
|
- id: subagent-spawn
|
|
name: '@deepseek-ai/dsh-subagent-spawn'
|
|
config:
|
|
providerName: spawn
|
|
|
|
- id: subagent-fork
|
|
name: '@deepseek-ai/dsh-subagent-fork'
|
|
config:
|
|
providerName: fork
|
|
|
|
- id: tool-subagent
|
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
config:
|
|
provider: spawn
|