| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- {
- "version": 1,
- "caseName": "conversation-session-activity-subagent-retention",
- "spec": "./test/e2e/conversation-session/subagents/conversation-session-activity-subagent-retention.test.ts",
- "fixtures": [
- {
- "id": "activity-rewind-edit-controlled",
- "description": "编辑后新响应受控结算",
- "metadata": {
- "kind": "main",
- "timingPolicy": "controlled-stream",
- "source": "synthetic",
- "syntheticReason": "隔离本次编辑响应,证明旧回复不能满足完成屏障;放行后再核对在线及重启计数。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
- "lastUserMessageIncludes": ["E2E_ACTIVITY_REWIND_EDITED"]
- },
- "response": {
- "statusCode": 200,
- "headers": {
- "content-type": "text/event-stream; charset=utf-8"
- },
- "releaseAfterChunks": 3,
- "chunks": [
- {
- "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-activity-rewind\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":0}}}\n\n"
- },
- {
- "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_ACTIVITY_REWIND_RUNNING\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_ACTIVITY_REWIND_DONE\"}}\n\n"
- },
- {
- "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
- },
- {
- "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"output_tokens\":12}}\n\n"
- },
- {
- "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
- }
- ]
- }
- },
- {
- "id": "activity-subagent-clear",
- "description": "成功接纳后清除摘要",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "固定清除后的普通响应,不替代发送接纳。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": [
- "E2E_ACTIVITY_SUBAGENT_CLEAR"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "subagent-clear",
- "inputTokens": 32,
- "text": "E2E_ACTIVITY_SUBAGENT_CLEARED"
- }
- }
- },
- {
- "id": "activity-resume-tool",
- "description": "恢复原 Subagent",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "从真实 tool_result 读取 agentId 后恢复同一 Subagent,验证清除边界不误隐藏新结果。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ],
- "lastUserMessageIncludes": [
- "E2E_ACTIVITY_RESUME_START"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_activity_resume",
- "name": "SendMessage",
- "inputTokens": 32,
- "input": {
- "to": "{{latestAgentId}}",
- "summary": "resume completed inspection",
- "message": "E2E_ACTIVITY_RESUME_CHILD"
- }
- }
- }
- },
- {
- "id": "activity-resume-child",
- "description": "同一 child 的新结果",
- "metadata": {
- "kind": "main",
- "timingPolicy": "controlled-stream",
- "source": "synthetic",
- "syntheticReason": "从真实 tool_result 读取 agentId 后恢复同一 Subagent,验证清除边界不误隐藏新结果。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ],
- "lastUserMessageIncludes": [
- "E2E_ACTIVITY_RESUME_CHILD"
- ]
- },
- "response": {
- "statusCode": 200,
- "headers": {
- "content-type": "text/event-stream; charset=utf-8"
- },
- "releaseAfterChunks": 3,
- "chunks": [
- {
- "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-capsule-keep\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":0}}}\n\n"
- },
- {
- "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_ACTIVITY_RESUME_RUNNING\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_ACTIVITY_RESUME_NEW_RESULT\"}}\n\n"
- },
- {
- "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
- },
- {
- "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"output_tokens\":12}}\n\n"
- },
- {
- "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
- }
- ]
- }
- },
- {
- "id": "activity-resume-final",
- "description": "恢复后父回复",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "从真实 tool_result 读取 agentId 后恢复同一 Subagent,验证清除边界不误隐藏新结果。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ],
- "bodyIncludes": [
- "E2E_ACTIVITY_RESUME_START",
- "toolu_activity_resume"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": "E2E_ACTIVITY_RESUME_ACK"
- }
- },
- {
- "id": "capsule-foreground-title",
- "description": "隔离标题请求。",
- "metadata": {
- "kind": "common",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "标题不是 SAT12 的停止语义,固定响应确保 replay 可复现。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "Generate a concise title",
- "E2E_CAPSULE_FOREGROUND_STOP"
- ]
- },
- "response": {
- "statusCode": 200,
- "statusMessage": "OK",
- "headers": {
- "content-type": "application/json; charset=utf-8"
- },
- "body": "{\"id\":\"upstream-e2e-capsule-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Capsule foreground stop\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":12}}"
- }
- },
- {
- "id": "capsule-foreground-parent-launch",
- "description": "同一父回复并行发起两个前台 Agent。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-tool-use",
- "source": "synthetic",
- "syntheticReason": "固定两个并行 foreground child,验证只停止用户选择的执行。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": [
- "E2E_CAPSULE_FOREGROUND_STOP"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUses": [
- {
- "id": "toolu_e2e_capsule_foreground_stop",
- "name": "Agent",
- "input": {
- "description": "Stop target foreground child",
- "prompt": "E2E_CAPSULE_STOP_CHILD: wait for the controlled result.",
- "run_in_background": false,
- "subagent_type": "general-purpose"
- }
- },
- {
- "id": "toolu_e2e_capsule_foreground_keep",
- "name": "Agent",
- "input": {
- "description": "Keep running foreground child",
- "prompt": "E2E_CAPSULE_KEEP_CHILD: wait for the controlled result.",
- "run_in_background": false,
- "subagent_type": "general-purpose"
- }
- }
- ]
- }
- },
- {
- "id": "capsule-foreground-stop-controlled",
- "description": "停止目标 child 保持真实请求流不完成;由 Stop 中断。",
- "metadata": {
- "kind": "subagent",
- "timingPolicy": "controlled-stream",
- "source": "synthetic",
- "syntheticReason": "显式受控模型响应保持前台 running 窗口,Stop 必须中断原 Agent 调用。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": [
- "E2E_CAPSULE_STOP_CHILD"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "headers": {
- "content-type": "text/event-stream; charset=utf-8"
- },
- "releaseAfterChunks": 3,
- "chunks": [
- {
- "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-capsule-stop\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":0}}}\n\n"
- },
- {
- "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_CAPSULE_STOP_RUNNING\"}}\n\n"
- },
- {
- "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
- },
- {
- "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"output_tokens\":12}}\n\n"
- },
- {
- "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
- }
- ]
- }
- },
- {
- "id": "capsule-foreground-keep-controlled",
- "description": "另一个 child 在目标 Stop 后由测试放行完成。",
- "metadata": {
- "kind": "subagent",
- "timingPolicy": "controlled-stream",
- "source": "synthetic",
- "syntheticReason": "保持 sibling 独立运行,证明单项停止不误停另一 child。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": [
- "E2E_CAPSULE_KEEP_CHILD"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "headers": {
- "content-type": "text/event-stream; charset=utf-8"
- },
- "releaseAfterChunks": 3,
- "chunks": [
- {
- "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-capsule-keep\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":32,\"output_tokens\":0}}}\n\n"
- },
- {
- "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_CAPSULE_KEEP_RUNNING\"}}\n\n"
- },
- {
- "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_CAPSULE_KEEP_DONE\"}}\n\n"
- },
- {
- "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
- },
- {
- "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"output_tokens\":12}}\n\n"
- },
- {
- "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
- }
- ]
- }
- },
- {
- "id": "capsule-foreground-parent-final",
- "description": "收到前台 Stop 原工具结果及 sibling 完成后的父回复。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "固定父模型继续回复,以断言单子项 Stop 不打断原父 turn。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_CAPSULE_FOREGROUND_STOP",
- "toolu_e2e_capsule_foreground_stop",
- "toolu_e2e_capsule_foreground_keep",
- "E2E_CAPSULE_KEEP_DONE"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY"
- ]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "id": "upstream-e2e-capsule-foreground-parent-done",
- "inputTokens": 32,
- "text": "E2E_CAPSULE_PARENT_DONE"
- }
- }
- }
- ]
- }
|