// Scenario format for the mock agents. A scenario is a list of turns; the initial // prompt starts turn 0 and every prompt submitted afterwards starts the next turn. // It is read from /.peppa/mock-scenario.json. export type Action = | { say: string } // print an assistant message (the last one is the turn's final message) | { work: number } // animate a spinner for N ms (screen keeps changing) | { sleep: number } | { mcp: string; args?: Record } // call a peppa MCP tool | { permission: { tool: string; input: Record } } // claude: PermissionRequest | { ask: Array<{ question: string; options?: string[] }> } // claude: AskUserQuestion // usage limit: StopFailure (claude) / banner only (codex); resetInSec → "resets at HH:MM"; // credential → only when the run's login (Claude token, Codex auth.json, OpenCode key) contains it | { limit: true | { resetInSec?: number; reset?: "unknown"; credential?: string } } // PEP-5: an assistant message with this token usage in the transcript, then (claude) the // statusLine command with cost / context / limit windows (pct, reset in N seconds) | { usage: { input?: number; output?: number; cacheRead?: number; cacheWrite?: number; model?: string; costUsd?: number; context?: { used: number; size: number }; fiveHour?: number; sevenDay?: number; resetInSec?: number } } // PEP-205 (codex): the «Switch to ?» menu near the limit — waits for a key (1–3, Esc), logs `menu` with it; // `afterLimit` prints the limit line above it like the real screen | { menu: true | { afterLimit?: boolean } } // PEP-241 (codex 0.171): «Folder access — Trust this folder?» about `path` (default: the cwd) — waits // for a key, logs `trust` with it; «2» (back) ends the run | { trust: true | { path?: string } } // PEP-205 (codex): the CLI cannot sign in — «account/read failed … timed out», exit 1 | { loginFail: true } | { warn: number } // usage warning banner: "You've used N% of your weekly limit" | { hang: true } // freeze: no output, no input handling | { crash: number } // exit with this code | { clear: true } // claude: /clear (SessionEnd + SessionStart with a new id) // PEP-266: write a file in the working copy and commit it (the launch smoke test's task) | { commit: { file: string; text?: string; message?: string } } | { exit: true }; // clean exit (code 0) export interface Scenario { turns: Action[][]; /** PEP-266: turns of one provider instead of `turns` (one workspace, several CLIs). */ providers?: Partial>; /** Used instead of `turns` when the CLI is started with a resume target. */ resumeTurns?: Action[][]; /** PEP-227: Claude forgot every conversation — `--resume ` prints «No conversation found…» and exits 1. */ forgetResume?: boolean; /** PEP-54: env variables the mock prints as `NAME=value` at start and logs (secrets tests). */ echoEnv?: string[]; /** PEP-265: the CLI shows this question at start and waits forever — no hook, no turn (a start hang). */ startQuestion?: string; } export interface MockLogEntry { ev: string; [k: string]: unknown; }