{ "version": 1, "caseName": "conversation-session-plan-session-switch-restore", "spec": "./test/e2e/conversation-session/planning/conversation-session-plan-session-switch-restore.test.ts", "fixtures": [ { "id": "conversation-session-plan-session-switch-restore-title-sidecar", "description": "本例标题旁路响应。", "metadata": { "kind": "common", "source": "synthetic", "timingPolicy": "fast-text", "syntheticReason": "运行时证据显示标题旁路缺少响应;在本例显式登记固定标题,避免依赖 legacy fixture 或触发后台网络重试。" }, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": ["Generate a concise title"] }, "response": { "statusCode": 200, "statusMessage": "OK", "headers": { "content-type": "application/json; charset=utf-8" }, "body": "{\"id\":\"upstream-e2e-title-fixture\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Upstream E2E Fixture\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":125,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":24,\"service_tier\":\"standard\"}}" } }, { "id": "upstream-conversation-plan-session-switch-enter", "description": "首轮请求返回 EnterPlanMode,建立计划模式前置状态。", "metadata": { "kind": "main", "timingPolicy": "fast-text", "source": "synthetic", "syntheticReason": "稳定进入 plan mode,避免依赖真实模型是否选择 EnterPlanMode。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "lastUserMessageIncludes": ["E2E_PLAN_SESSION_SWITCH_RESTORE"], "bodyIncludes": [ "E2E_PLAN_SESSION_SWITCH_RESTORE", "E2E_PLAN_SESSION_SWITCH_ENTER", "E2E_PLAN_SESSION_SWITCH_EXIT" ], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"] }, "response": { "statusCode": 200, "toolUse": { "id": "toolu_e2e_plan_session_switch_enter", "name": "EnterPlanMode", "input": {} } } }, { "id": "upstream-conversation-plan-session-switch-exit-controlled-stream", "description": "发送真实 ExitPlanMode 部分参数后等待释放;测试切走后才补齐完整参数。 正文先提交可重试前奏,再逐段释放真实工具参数。", "metadata": { "kind": "main", "timingPolicy": "controlled-stream", "source": "synthetic", "syntheticReason": "稳定制造用户在 ExitPlanMode 参数生成期间切走、完整 tool call 在后台到达的恢复窗口。" }, "maxMatches": 1, "match": { "method": "POST", "pathIncludes": "/messages", "bodyIncludes": [ "E2E_PLAN_SESSION_SWITCH_EXIT", "E2E_PLAN_SESSION_SWITCH_RESTORED_BODY", "toolu_e2e_plan_session_switch_enter" ], "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"] }, "response": { "statusCode": 200, "statusMessage": "OK", "headers": { "cache-control": "no-cache", "content-type": "text/event-stream; charset=utf-8" }, "chunks": [ { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-plan-session-switch-exit\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":120,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" }, { "offsetMs": 1, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" }, { "offsetMs": 2, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_PLAN_SESSION_SWITCH_PREVIEW\"}}\n\n" }, { "offsetMs": 3, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" }, { "offsetMs": 4, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":1,\"content_block\":{\"type\":\"tool_use\",\"id\":\"toolu_e2e_plan_session_switch_exit\",\"name\":\"ExitPlanMode\",\"input\":{}}}\n\n" }, { "offsetMs": 5, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"plan\\\":\\\"\"}}\n\n" }, { "offsetMs": 6, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"E2E_PLAN_SESSION_SWITCH_RESTORED_BODY: 1. Hydrate the persisted plan. 2. Keep the task waiting for approval. 3. Verify before stop.\\\",\\\"allowedPrompts\\\":[]}\"}}\n\n" }, { "offsetMs": 7, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":1}\n\n" }, { "offsetMs": 8, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"tool_use\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":24,\"service_tier\":\"standard\"}}\n\n" }, { "offsetMs": 9, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" } ], "releaseAfterChunks": 6 } } ] }