InputScript gains an optional permissionAnswers queue, consumed FIFO by the harness's requestPermission handler. Each entry selects by option KIND (allow_once, reject_once, …): option ids are agent-issued randoms a committed script cannot know, while kinds are the ACP-stable vocabulary, so the client maps kind → the offered optionId at answer time. An absent or exhausted queue answers cancelled — existing scenarios and goldens are untouched — and a scripted kind the request never offered throws, surfacing as a JSON-RPC error on the permission request: the scenario scripted an impossible click. This is what lets an approval-flow suite (the sandbox composition) drive allow/reject round-trips deterministically from input.json, per the shared-acp-snapshot RFC.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/**
|
|
* ACP snapshot suite kit — the shared machinery behind the keyless snapshot
|
|
* tier (`pnpm run test:snapshot`). Three layers, composable per example:
|
|
* the subprocess scenario harness ({@link runScenario}), the pure golden
|
|
* normalizers ({@link normalizeStdout} / {@link normalizeSessionLog} /
|
|
* {@link scrubRequestHeaders}), and the suite factory
|
|
* ({@link defineAcpSnapshotSuite}) that registers a scenario table as a full
|
|
* describe/it tree. An example's `*.snapshot.ts` supplies only its
|
|
* {@link AgentUnderTest} paths, its snapshots directory, and its
|
|
* {@link Scenario} table.
|
|
*
|
|
* NOTE: ./suite.ts imports vitest, so this package is importable only inside a
|
|
* vitest run — a support-tier constraint stated in the README.
|
|
*
|
|
* @module @deepseek-ai/dsh-acp-snapshot
|
|
*/
|
|
|
|
export {
|
|
runScenario,
|
|
type AgentUnderTest,
|
|
type HarvestedLog,
|
|
type InputScript,
|
|
type InputStep,
|
|
type PermissionAnswer,
|
|
type RunOptions,
|
|
type RunResult,
|
|
} from './harness.ts'
|
|
export {
|
|
normalizeSessionLog,
|
|
normalizeStdout,
|
|
scrubRequestHeaders,
|
|
type NormalizeContext,
|
|
} from './normalize.ts'
|
|
export {
|
|
defineAcpSnapshotSuite,
|
|
type Scenario,
|
|
type SnapshotSuiteOptions,
|
|
} from './suite.ts'
|