- parseResetTime: 'resets 5pm', 'resets at 3:10 AM', 'resets in 2h 15m',
'try again at 23:30'; nearest future time, local clock
- recordLimit (hook StopFailure and the watchdog's banner path): status
rate_limited, resume_at = reset + 60 s, or probes 30 → 60 → 120 min when
unknown or the limit came back right after a resume; cap 6/day;
PEPPA_LIMIT_AUTORESUME=off; PM is told 'continues at HH:MM'
- watchdog: at resume_at nudges the live agent or relaunches it with
resume (vanished/dead rate-limited runners wait instead of failing); the
limit message is closed as resolved; tick(db, { now }) for tests
- mocks: limit with resetInSec / unknown reset (claude and codex)
- tests: one per spec scenario + Codex (82 e2e total, green)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
// 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 <workspace>/.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<string, unknown> } // call a peppa MCP tool
|
|
| { permission: { tool: string; input: Record<string, unknown> } } // claude: PermissionRequest
|
|
| { ask: Array<{ question: string; options?: string[] }> } // claude: AskUserQuestion
|
|
| { limit: true | { resetInSec?: number; reset?: "unknown" } } // usage limit: StopFailure (claude) / banner only (codex); resetInSec → "resets at HH:MM"
|
|
| { 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[][];
|
|
}
|
|
|
|
export interface MockLogEntry {
|
|
ev: string;
|
|
[k: string]: unknown;
|
|
}
|