控制端点
代理暴露 /__control,用于以编程方式切换模式。
# Get current statecurl http://localhost:8100/__control
# Switch modescurl -X POST http://localhost:8100/__control \ -H "Content-Type: application/json" \ -d '{"mode": "record", "id": "my-test-1"}'interface ControlRequest { mode?: 'transparent' | 'record' | 'replay'; // required unless cleanup is true id?: string; // required for record/replay (and for cleanup) timeout?: number; // auto-reset timeout in ms (default: 120000) cleanup?: boolean; // when true, clean up the session instead of switching mode websocket?: WebSocketReplayConfig; // per-session WebSocket replay pacing override}在大多数配置中,你不会直接调用它 —— playwrightProxy.before() 和 setProxyMode()(参见 API 参考)会替你发送 POST。当你从 shell、CI 步骤或 AI agent 驱动代理时,再使用 /__control。