Files
deepseek-harness/examples/plan-acp-agent/tests/acp.snapshot.ts
kingwl c5cb7da364 test(mode): record the plan-mode approve and keep-planning scenarios
The with-key recording session the RFC deferred. plan-mode is the 'plan'
header class's pinning scenario and necessarily carries BOTH header
shapes verbatim: the plan-shaped initial snapshot and the widened
fallback snapshot the approved exit produces mid-turn — so the suite
factory's pin guards relax from exactly-one to at-least-one header (the
classmates' uniformity anchor is the pin's FIRST header; transition
headers are legal only in the pin, matching the sandbox stack's
precedent). plan-mode-reject pins the keep-planning branch: the
corrective isError carries the reviewer's free-text feedback verbatim
and the session stays in plan mode, one header, uniform with the pin.

Recording notes, encoded in the prompts: the model is pinned to RELATIVE
paths (a recorded absolute temp path neither replays on another host nor
normalizes — the normalizers scrub the run's own cwd, not the
recording's), and the recorded model never calls a filtered tool, so the
gate's deny path stays pinned at the unit tier — that refusal is the
behavior the soft layer exists to produce. The gen-tool-catalog
meta-test pins exit_plan_mode in the harvested schema list.
2026-07-10 03:39:29 +08:00

54 lines
3.0 KiB
TypeScript

import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineAcpSnapshotSuite, type Scenario } from '@deepseek-ai/dsh-acp-snapshot'
/**
* Snapshot suite for the plan-mode composition (`../cordis.yml`, swapped to
* the sibling `cordis.snapshot.yml` replay overlay by the bin under
* `DSH_SNAPSHOT=replay`).
*
* The recorded scenarios re-execute the fs tools for real on replay (the
* replay overlay swaps only the model); their prompts pin the model to
* RELATIVE paths, because a recorded absolute temp path would neither replay
* on another host nor normalize (the normalizers scrub the RUN's own cwd,
* not the recording's). The gate's deny path is pinned at the unit tier
* (packages/mode/mode/tests) — the recorded model never calls a filtered
* tool, which is the behavior the soft layer exists to produce.
*/
const SCENARIOS: Scenario[] = [
// Protocol-only (keyless, authored): the session-mode surface this
// composition adds — availableModes/currentModeId advertised on
// session/new, the optimistic current_mode_update a session/set_mode
// answers with, and the loud rejection of an unknown mode id — as committed
// wire bytes. No model turn, so it replays keyless and needs no header pin.
{ name: 'modes-advertise', hasModelTurn: false, recorded: false },
// The full plan-mode arc, and NECESSARILY the pinned-header scenario for
// the 'plan' class: the first request ships the plan-shaped header (reason
// initial), the approved exit widens it back — a second, fallback snapshot
// (adding/removing exit_plan_mode resorts the canonical tool list, which
// the delta encoding cannot express) — so this composition's full header
// content, both shapes, is committed here verbatim. The arc: setMode(plan)
// → the model reads under the plan allowlist (it never attempts the
// filtered write — the deny path stays pinned at the unit tier) and
// presents the plan via exit_plan_mode → the scripted elicitation approves
// → the very next step already runs the widened toolset and writes for
// real, mid-turn.
{ name: 'plan-mode', hasModelTurn: true, recorded: true, pinsHeader: true, headerClass: 'plan' },
// The keep-planning branch: one presentation, the scripted review answers
// with free-text feedback (no approval), and the corrective isError carries
// it back verbatim — the session stays in plan mode, so the log holds one
// plan-shaped header, uniform with the pin's first.
{ name: 'plan-mode-reject', hasModelTurn: true, recorded: true, headerClass: 'plan' },
]
defineAcpSnapshotSuite({
agent: {
binScript: fileURLToPath(new URL('../../../packages/ui/acp-agent/src/bin.ts', import.meta.url)),
configPath: fileURLToPath(new URL('../cordis.yml', import.meta.url)),
tsconfigPath: fileURLToPath(new URL('../../../tsconfig.json', import.meta.url)),
},
snapshotsDir: join(dirname(fileURLToPath(import.meta.url)), 'snapshots'),
scenarios: SCENARIOS,
mode: process.env.DSH_SNAPSHOT === 'record' ? 'record' : 'replay',
})