// 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 } } | { 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) | { exit: true }; // clean exit (code 0) export interface Scenario { turns: Action[][]; /** Used instead of `turns` when the CLI is started with a resume target. */ resumeTurns?: Action[][]; /** PEP-54: env variables the mock prints as `NAME=value` at start and logs (secrets tests). */ echoEnv?: string[]; } export interface MockLogEntry { ev: string; [k: string]: unknown; }