conversation-session-dynamic-workflow-gray-always-on-activity-retention.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-dynamic-workflow-gray-always-on-activity-retention",
  4. "spec": "./test/e2e/conversation-session/workflows/conversation-session-dynamic-workflow-gray-always-on-activity-retention.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "activity-workflow-clear",
  8. "description": "清除完成摘要",
  9. "metadata": {
  10. "kind": "main",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "真实接纳后固定普通回复。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "lastUserMessageIncludes": [
  19. "E2E_ACTIVITY_WORKFLOW_CLEAR"
  20. ],
  21. "bodyExcludes": [
  22. "Generate a concise title",
  23. "CRITICAL: Respond with TEXT ONLY"
  24. ]
  25. },
  26. "response": {
  27. "statusCode": 200,
  28. "text": {
  29. "id": "workflow-clear",
  30. "text": "E2E_ACTIVITY_WORKFLOW_CLEARED",
  31. "inputTokens": 32
  32. }
  33. }
  34. },
  35. {
  36. "id": "activity-mixed-child",
  37. "description": "另一个 child 在目标 Stop 后由测试放行完成。",
  38. "metadata": {
  39. "kind": "subagent",
  40. "timingPolicy": "controlled-stream",
  41. "source": "synthetic",
  42. "syntheticReason": "保持 sibling 独立运行,证明单项停止不误停另一 child。"
  43. },
  44. "maxMatches": 1,
  45. "match": {
  46. "method": "POST",
  47. "pathIncludes": "/messages",
  48. "lastUserMessageIncludes": [
  49. "E2E_ACTIVITY_MIXED_CHILD_CHILD"
  50. ],
  51. "bodyExcludes": [
  52. "Generate a concise title",
  53. "CRITICAL: Respond with TEXT ONLY"
  54. ]
  55. },
  56. "response": {
  57. "statusCode": 200,
  58. "headers": {
  59. "content-type": "text/event-stream; charset=utf-8"
  60. },
  61. "releaseAfterChunks": 3,
  62. "chunks": [
  63. {
  64. "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"
  65. },
  66. {
  67. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  68. },
  69. {
  70. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_ACTIVITY_MIXED_CHILD_RUNNING\"}}\n\n"
  71. },
  72. {
  73. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_ACTIVITY_MIXED_CHILD_DONE\"}}\n\n"
  74. },
  75. {
  76. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  77. },
  78. {
  79. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"output_tokens\":12}}\n\n"
  80. },
  81. {
  82. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  83. }
  84. ]
  85. }
  86. },
  87. {
  88. "id": "activity-mixed-launch",
  89. "description": "三类活动混合启动",
  90. "metadata": {
  91. "kind": "main",
  92. "source": "synthetic",
  93. "timingPolicy": "fast-text",
  94. "syntheticReason": "在真实 Workflow 运行期间启动独立终端和 Subagent,验证顶层混合计数。"
  95. },
  96. "maxMatches": 1,
  97. "match": {
  98. "method": "POST",
  99. "pathIncludes": "/messages",
  100. "bodyExcludes": [
  101. "Generate a concise title",
  102. "CRITICAL: Respond with TEXT ONLY"
  103. ],
  104. "lastUserMessageIncludes": [
  105. "E2E_ACTIVITY_MIXED_START"
  106. ]
  107. },
  108. "response": {
  109. "statusCode": 200,
  110. "toolUses": [
  111. {
  112. "id": "toolu_activity_mixed_bash",
  113. "name": "Bash",
  114. "input": {
  115. "command": "sleep 300",
  116. "run_in_background": true,
  117. "description": "E2E_ACTIVITY_MIXED_BASH"
  118. }
  119. },
  120. {
  121. "id": "toolu_activity_mixed_agent",
  122. "name": "Agent",
  123. "input": {
  124. "description": "Independent mixed agent",
  125. "prompt": "E2E_ACTIVITY_MIXED_CHILD_CHILD: finish after release.",
  126. "subagent_type": "general-purpose",
  127. "run_in_background": true
  128. }
  129. }
  130. ]
  131. }
  132. },
  133. {
  134. "id": "activity-mixed-final",
  135. "description": "混合任务启动与通知收尾",
  136. "metadata": {
  137. "kind": "main",
  138. "source": "synthetic",
  139. "timingPolicy": "fast-text",
  140. "syntheticReason": "在真实 Workflow 运行期间启动独立终端和 Subagent,验证顶层混合计数。"
  141. },
  142. "match": {
  143. "method": "POST",
  144. "pathIncludes": "/messages",
  145. "bodyExcludes": [
  146. "Generate a concise title",
  147. "CRITICAL: Respond with TEXT ONLY"
  148. ],
  149. "bodyIncludes": [
  150. "E2E_ACTIVITY_MIXED_START",
  151. "toolu_activity_mixed_agent"
  152. ]
  153. },
  154. "response": {
  155. "statusCode": 200,
  156. "text": "E2E_ACTIVITY_MIXED_ACK"
  157. }
  158. },
  159. {
  160. "id": "dwr-title",
  161. "metadata": {
  162. "kind": "common",
  163. "source": "synthetic",
  164. "timingPolicy": "fast-text",
  165. "syntheticReason": "固定 Skill/CreateWorkflow 与收尾回复的模型选择;真实 Skill 加载、工作流编译、确认窗、run 引擎、子代理会话与完成通知由 Agent 执行。"
  166. },
  167. "match": {
  168. "method": "POST",
  169. "pathIncludes": "/messages",
  170. "bodyExcludes": [],
  171. "bodyIncludes": [
  172. "Generate a concise title",
  173. "E2E_DWR_"
  174. ]
  175. },
  176. "response": {
  177. "statusCode": 200,
  178. "headers": {
  179. "content-type": "application/json; charset=utf-8"
  180. },
  181. "body": "{\"id\":\"msg_upstream_e2e_text\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"工作流运行 E2E\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":12,\"service_tier\":\"standard\"}}"
  182. },
  183. "description": "dwr-title"
  184. },
  185. {
  186. "id": "dwr-agent-a",
  187. "metadata": {
  188. "kind": "main",
  189. "source": "synthetic",
  190. "timingPolicy": "fast-text",
  191. "syntheticReason": "固定工作流子代理的回答;子代理会话、并行调度、阶段推进与结果回传仍走真实 run 引擎。"
  192. },
  193. "match": {
  194. "method": "POST",
  195. "pathIncludes": "/messages",
  196. "bodyIncludes": [
  197. "You are a subagent inside a dynamic workflow run"
  198. ],
  199. "bodyExcludes": [
  200. "Generate a concise title",
  201. "CRITICAL: Respond with TEXT ONLY",
  202. "You are now acting as the memory extraction subagent"
  203. ],
  204. "lastUserMessageIncludes": [
  205. "E2E_DWR_TASK_A"
  206. ]
  207. },
  208. "response": {
  209. "statusCode": 200,
  210. "text": "E2E_DWR_ANSWER_A 第一份材料结论成立。"
  211. },
  212. "description": "dwr-agent-a"
  213. },
  214. {
  215. "id": "dwr-agent-b",
  216. "metadata": {
  217. "kind": "main",
  218. "source": "synthetic",
  219. "timingPolicy": "fast-text",
  220. "syntheticReason": "固定工作流子代理的回答;子代理会话、并行调度、阶段推进与结果回传仍走真实 run 引擎。"
  221. },
  222. "match": {
  223. "method": "POST",
  224. "pathIncludes": "/messages",
  225. "bodyIncludes": [
  226. "You are a subagent inside a dynamic workflow run"
  227. ],
  228. "bodyExcludes": [
  229. "Generate a concise title",
  230. "CRITICAL: Respond with TEXT ONLY",
  231. "You are now acting as the memory extraction subagent"
  232. ],
  233. "lastUserMessageIncludes": [
  234. "E2E_DWR_TASK_B"
  235. ]
  236. },
  237. "response": {
  238. "statusCode": 200,
  239. "text": "E2E_DWR_ANSWER_B 第二份材料结论成立。"
  240. },
  241. "description": "dwr-agent-b"
  242. },
  243. {
  244. "id": "dwr-agent-c",
  245. "metadata": {
  246. "kind": "main",
  247. "source": "synthetic",
  248. "timingPolicy": "controlled-stream",
  249. "syntheticReason": "第二阶段子代理的回答以门闩挂起,在运行态断言完成后由测试显式释放,不依赖固定响应延时。"
  250. },
  251. "match": {
  252. "method": "POST",
  253. "pathIncludes": "/messages",
  254. "bodyIncludes": [
  255. "You are a subagent inside a dynamic workflow run"
  256. ],
  257. "bodyExcludes": [
  258. "Generate a concise title",
  259. "CRITICAL: Respond with TEXT ONLY",
  260. "You are now acting as the memory extraction subagent"
  261. ],
  262. "lastUserMessageIncludes": [
  263. "E2E_DWR_TASK_C"
  264. ]
  265. },
  266. "response": {
  267. "statusCode": 200,
  268. "headers": {
  269. "content-type": "text/event-stream; charset=utf-8"
  270. },
  271. "body": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_dwr_agent_c\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"usage\":{\"input_tokens\":256,\"output_tokens\":0}}}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_DWR_ANSWER_C 两份结论一致,可以合并。\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\"},\"usage\":{\"output_tokens\":32}}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
  272. "chunks": [
  273. {
  274. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"msg_e2e_dwr_agent_c\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"usage\":{\"input_tokens\":256,\"output_tokens\":0}}}\n\n",
  275. "delayMs": 0
  276. },
  277. {
  278. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n",
  279. "delayMs": 0
  280. },
  281. {
  282. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"E2E_DWR_ANSWER_C 两份结论一致,可以合并。\"}}\n\n",
  283. "delayMs": 0
  284. },
  285. {
  286. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n",
  287. "delayMs": 0
  288. },
  289. {
  290. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\"},\"usage\":{\"output_tokens\":32}}\n\n",
  291. "delayMs": 0
  292. },
  293. {
  294. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n",
  295. "delayMs": 0
  296. }
  297. ],
  298. "releaseAfterChunks": 2
  299. },
  300. "maxMatches": 1,
  301. "description": "dwr-agent-c"
  302. },
  303. {
  304. "id": "dwr-skill",
  305. "metadata": {
  306. "kind": "main",
  307. "source": "synthetic",
  308. "timingPolicy": "fast-text",
  309. "syntheticReason": "固定 Skill/CreateWorkflow 与收尾回复的模型选择;真实 Skill 加载、工作流编译、确认窗、run 引擎、子代理会话与完成通知由 Agent 执行。"
  310. },
  311. "match": {
  312. "method": "POST",
  313. "pathIncludes": "/messages",
  314. "bodyExcludes": [
  315. "Generate a concise title",
  316. "CRITICAL: Respond with TEXT ONLY",
  317. "You are now acting as the memory extraction subagent",
  318. "You are a subagent inside a dynamic workflow run",
  319. "toolu_dwr_skill"
  320. ],
  321. "lastUserMessageIncludes": [
  322. "E2E_DWR_START"
  323. ]
  324. },
  325. "response": {
  326. "statusCode": 200,
  327. "toolUse": {
  328. "id": "toolu_dwr_skill",
  329. "name": "Skill",
  330. "input": {
  331. "skill": "dynamic-workflows"
  332. }
  333. }
  334. },
  335. "description": "dwr-skill"
  336. },
  337. {
  338. "id": "dwr-create",
  339. "metadata": {
  340. "kind": "main",
  341. "source": "synthetic",
  342. "timingPolicy": "fast-text",
  343. "syntheticReason": "固定 Skill/CreateWorkflow 与收尾回复的模型选择;真实 Skill 加载、工作流编译、确认窗、run 引擎、子代理会话与完成通知由 Agent 执行。"
  344. },
  345. "match": {
  346. "method": "POST",
  347. "pathIncludes": "/messages",
  348. "bodyExcludes": [
  349. "Generate a concise title",
  350. "CRITICAL: Respond with TEXT ONLY",
  351. "You are now acting as the memory extraction subagent",
  352. "You are a subagent inside a dynamic workflow run",
  353. "toolu_dwr_create"
  354. ],
  355. "bodyIncludes": [
  356. "E2E_DWR_START",
  357. "toolu_dwr_skill"
  358. ]
  359. },
  360. "response": {
  361. "statusCode": 200,
  362. "toolUse": {
  363. "id": "toolu_dwr_create",
  364. "name": "CreateWorkflow",
  365. "input": {
  366. "name": "E2E 调研汇总",
  367. "script": "phase(\"调研\");\nconst first = agent(\"调研员甲\").ask(\"E2E_DWR_TASK_A 调研第一份材料,给出一句结论。\");\nconst second = agent(\"调研员乙\").ask(\"E2E_DWR_TASK_B 调研第二份材料,给出一句结论。\");\n// 两份调研并行,汇总需要两份结论:这里是唯一的汇合点。\nconst [a, b] = await Promise.all([first, second]);\nphase(\"汇总\");\nconst summary = await agent(\"汇总员\").ask(`E2E_DWR_TASK_C 汇总两份结论:${a} / ${b}`);\nreturn { summary, parts: [a, b] };"
  368. }
  369. }
  370. },
  371. "description": "dwr-create"
  372. },
  373. {
  374. "id": "dwr-notified",
  375. "metadata": {
  376. "kind": "main",
  377. "source": "synthetic",
  378. "timingPolicy": "fast-text",
  379. "syntheticReason": "固定 Skill/CreateWorkflow 与收尾回复的模型选择;真实 Skill 加载、工作流编译、确认窗、run 引擎、子代理会话与完成通知由 Agent 执行。"
  380. },
  381. "match": {
  382. "method": "POST",
  383. "pathIncludes": "/messages",
  384. "bodyExcludes": [
  385. "Generate a concise title",
  386. "CRITICAL: Respond with TEXT ONLY",
  387. "You are now acting as the memory extraction subagent",
  388. "You are a subagent inside a dynamic workflow run"
  389. ],
  390. "bodyIncludes": [
  391. "E2E_DWR_START"
  392. ],
  393. "lastUserMessageIncludes": [
  394. "<task-notification>",
  395. "<status>completed</status>"
  396. ]
  397. },
  398. "response": {
  399. "statusCode": 200,
  400. "text": "E2E_DWR_DONE 工作流已完成:两份材料结论一致。"
  401. },
  402. "description": "dwr-notified"
  403. },
  404. {
  405. "id": "dwr-created",
  406. "metadata": {
  407. "kind": "main",
  408. "source": "synthetic",
  409. "timingPolicy": "fast-text",
  410. "syntheticReason": "固定 Skill/CreateWorkflow 与收尾回复的模型选择;真实 Skill 加载、工作流编译、确认窗、run 引擎、子代理会话与完成通知由 Agent 执行。"
  411. },
  412. "match": {
  413. "method": "POST",
  414. "pathIncludes": "/messages",
  415. "bodyExcludes": [
  416. "Generate a concise title",
  417. "CRITICAL: Respond with TEXT ONLY",
  418. "You are now acting as the memory extraction subagent",
  419. "You are a subagent inside a dynamic workflow run"
  420. ],
  421. "bodyIncludes": [
  422. "E2E_DWR_START",
  423. "toolu_dwr_create"
  424. ]
  425. },
  426. "response": {
  427. "statusCode": 200,
  428. "text": "E2E_DWR_STARTED 工作流已启动,结果会以通知送达。"
  429. },
  430. "description": "dwr-created"
  431. }
  432. ]
  433. }