conversation-session-subagent-interaction-delegate.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-subagent-interaction-delegate",
  4. "spec": "./test/e2e/conversation-session/conversation-session-subagent-interaction-delegate.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "subagent-hitl-yolo-parent-agent",
  8. "description": "父 agent 首轮请求返回 general-purpose Agent tool_use,用于 Full access 下的 child AskUserQuestion delegate。",
  9. "metadata": {
  10. "kind": "main",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "稳定制造父 Agent tool_use,核心语义是 child AskUserQuestion 必须代理回父 task。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "lastUserMessageIncludes": ["E2E_SUBAGENT_HITL_YOLO_PARENT"],
  20. "bodyIncludes": [
  21. "E2E_SUBAGENT_HITL_YOLO_PARENT",
  22. "E2E_SUBAGENT_HITL_YOLO_CHILD",
  23. "E2E_SUBAGENT_HITL_YOLO_PARENT_DONE"
  24. ],
  25. "bodyExcludes": [
  26. "Generate a concise title",
  27. "CRITICAL: Respond with TEXT ONLY"
  28. ]
  29. },
  30. "response": {
  31. "statusCode": 200,
  32. "toolUse": {
  33. "id": "toolu_e2e_subagent_hitl_yolo_agent",
  34. "name": "Agent",
  35. "input": {
  36. "description": "Run subagent AskUserQuestion delegate case",
  37. "prompt": "E2E_SUBAGENT_HITL_YOLO_CHILD: Ask the user one question containing E2E_SUBAGENT_HITL_YOLO_QUESTION, then after the answer reply exactly E2E_SUBAGENT_HITL_YOLO_CHILD_DONE and no other text.",
  38. "subagent_type": "general-purpose"
  39. }
  40. }
  41. }
  42. },
  43. {
  44. "id": "subagent-hitl-yolo-child-ask",
  45. "description": "Full access child subagent 返回 AskUserQuestion tool_use。",
  46. "metadata": {
  47. "kind": "main",
  48. "timingPolicy": "fast-text",
  49. "source": "synthetic",
  50. "syntheticReason": "稳定制造 child AskUserQuestion 等待态,验证 yolo 下仍代理到父 task 而不是被 deny broker 吞掉。"
  51. },
  52. "maxMatches": 1,
  53. "match": {
  54. "method": "POST",
  55. "pathIncludes": "/messages",
  56. "lastUserMessageIncludes": ["E2E_SUBAGENT_HITL_YOLO_CHILD"],
  57. "bodyIncludes": [
  58. "E2E_SUBAGENT_HITL_YOLO_CHILD",
  59. "E2E_SUBAGENT_HITL_YOLO_QUESTION"
  60. ],
  61. "bodyExcludes": [
  62. "E2E_SUBAGENT_HITL_YOLO_ANSWER",
  63. "Generate a concise title",
  64. "CRITICAL: Respond with TEXT ONLY"
  65. ]
  66. },
  67. "response": {
  68. "statusCode": 200,
  69. "toolUse": {
  70. "id": "toolu_e2e_subagent_hitl_yolo_ask",
  71. "name": "AskUserQuestion",
  72. "input": {
  73. "questions": [
  74. {
  75. "question": "E2E_SUBAGENT_HITL_YOLO_QUESTION: provide the yolo child answer.",
  76. "header": "Subagent question",
  77. "options": [
  78. {
  79. "label": "Use default",
  80. "description": "Continue with the default subagent answer."
  81. },
  82. {
  83. "label": "Use fallback",
  84. "description": "Continue with the fallback subagent answer."
  85. }
  86. ]
  87. }
  88. ]
  89. }
  90. }
  91. }
  92. },
  93. {
  94. "id": "subagent-hitl-yolo-child-final",
  95. "description": "Full access child subagent 收到用户回答后的最终回复。",
  96. "metadata": {
  97. "kind": "main",
  98. "timingPolicy": "fast-text",
  99. "source": "synthetic",
  100. "syntheticReason": "该响应证明 AskUserQuestion 回答已进入 child provider-visible 请求,child 可继续完成。"
  101. },
  102. "maxMatches": 1,
  103. "match": {
  104. "method": "POST",
  105. "pathIncludes": "/messages",
  106. "bodyIncludes": [
  107. "E2E_SUBAGENT_HITL_YOLO_CHILD",
  108. "E2E_SUBAGENT_HITL_YOLO_ANSWER",
  109. "toolu_e2e_subagent_hitl_yolo_ask"
  110. ],
  111. "bodyExcludes": [
  112. "Generate a concise title",
  113. "CRITICAL: Respond with TEXT ONLY"
  114. ]
  115. },
  116. "response": {
  117. "statusCode": 200,
  118. "text": {
  119. "id": "upstream-e2e-subagent-hitl-yolo-child-final",
  120. "inputTokens": 160,
  121. "outputTokens": 12,
  122. "text": "E2E_SUBAGENT_HITL_YOLO_CHILD_DONE"
  123. }
  124. }
  125. },
  126. {
  127. "id": "subagent-hitl-yolo-parent-final",
  128. "description": "父 agent 收到 yolo child 结果后的最终回复。",
  129. "metadata": {
  130. "kind": "main",
  131. "timingPolicy": "fast-text",
  132. "source": "synthetic",
  133. "syntheticReason": "最终回复用于证明 Agent tool_result 被父会话 continuation 消费并正常收口。"
  134. },
  135. "maxMatches": 1,
  136. "match": {
  137. "method": "POST",
  138. "pathIncludes": "/messages",
  139. "bodyIncludes": [
  140. "E2E_SUBAGENT_HITL_YOLO_PARENT",
  141. "E2E_SUBAGENT_HITL_YOLO_CHILD_DONE",
  142. "toolu_e2e_subagent_hitl_yolo_agent"
  143. ],
  144. "bodyExcludes": [
  145. "Generate a concise title",
  146. "CRITICAL: Respond with TEXT ONLY"
  147. ]
  148. },
  149. "response": {
  150. "statusCode": 200,
  151. "text": {
  152. "id": "upstream-e2e-subagent-hitl-yolo-parent-final",
  153. "inputTokens": 180,
  154. "outputTokens": 12,
  155. "text": "E2E_SUBAGENT_HITL_YOLO_PARENT_DONE"
  156. }
  157. }
  158. },
  159. {
  160. "id": "subagent-hitl-permission-parent-agent",
  161. "description": "父 agent 首轮请求返回 general-purpose Agent tool_use,用于 build 模式 child Bash permission delegate。",
  162. "metadata": {
  163. "kind": "main",
  164. "timingPolicy": "fast-text",
  165. "source": "synthetic",
  166. "syntheticReason": "稳定制造父 Agent tool_use,核心语义是 child Bash permission 必须代理回父 task。"
  167. },
  168. "maxMatches": 1,
  169. "match": {
  170. "method": "POST",
  171. "pathIncludes": "/messages",
  172. "lastUserMessageIncludes": ["E2E_SUBAGENT_HITL_PERMISSION_PARENT"],
  173. "bodyIncludes": [
  174. "E2E_SUBAGENT_HITL_PERMISSION_PARENT",
  175. "E2E_SUBAGENT_HITL_PERMISSION_CHILD",
  176. "E2E_SUBAGENT_HITL_PERMISSION_PARENT_DONE"
  177. ],
  178. "bodyExcludes": [
  179. "Generate a concise title",
  180. "CRITICAL: Respond with TEXT ONLY"
  181. ]
  182. },
  183. "response": {
  184. "statusCode": 200,
  185. "toolUse": {
  186. "id": "toolu_e2e_subagent_hitl_permission_agent",
  187. "name": "Agent",
  188. "input": {
  189. "description": "Run subagent Bash permission delegate case",
  190. "prompt": "E2E_SUBAGENT_HITL_PERMISSION_CHILD: Run Bash command mkdir -p .zcode-e2e/conversation-session-subagent-interaction-delegate && printf 'E2E_SUBAGENT_HITL_PERMISSION_BASH_OUTPUT\\n' > .zcode-e2e/conversation-session-subagent-interaction-delegate/output.txt && cat .zcode-e2e/conversation-session-subagent-interaction-delegate/output.txt, then after it succeeds reply exactly E2E_SUBAGENT_HITL_PERMISSION_CHILD_DONE and no other text.",
  191. "subagent_type": "general-purpose"
  192. }
  193. }
  194. }
  195. },
  196. {
  197. "id": "subagent-hitl-permission-child-bash",
  198. "description": "build 模式 child subagent 返回 Bash tool_use,触发权限请求。",
  199. "metadata": {
  200. "kind": "main",
  201. "timingPolicy": "fast-text",
  202. "source": "synthetic",
  203. "syntheticReason": "稳定制造 child Bash permission 等待态,验证权限请求代理回父 task。"
  204. },
  205. "maxMatches": 1,
  206. "match": {
  207. "method": "POST",
  208. "pathIncludes": "/messages",
  209. "lastUserMessageIncludes": ["E2E_SUBAGENT_HITL_PERMISSION_CHILD"],
  210. "bodyIncludes": [
  211. "E2E_SUBAGENT_HITL_PERMISSION_CHILD",
  212. "E2E_SUBAGENT_HITL_PERMISSION_BASH_OUTPUT"
  213. ],
  214. "bodyExcludes": [
  215. "toolu_e2e_subagent_hitl_permission_bash",
  216. "Generate a concise title",
  217. "CRITICAL: Respond with TEXT ONLY"
  218. ]
  219. },
  220. "response": {
  221. "statusCode": 200,
  222. "toolUse": {
  223. "id": "toolu_e2e_subagent_hitl_permission_bash",
  224. "name": "Bash",
  225. "input": {
  226. "command": "mkdir -p .zcode-e2e/conversation-session-subagent-interaction-delegate && printf 'E2E_SUBAGENT_HITL_PERMISSION_BASH_OUTPUT\\n' > .zcode-e2e/conversation-session-subagent-interaction-delegate/output.txt && cat .zcode-e2e/conversation-session-subagent-interaction-delegate/output.txt",
  227. "description": "Emit E2E_SUBAGENT_HITL_PERMISSION_BASH_OUTPUT"
  228. }
  229. }
  230. }
  231. },
  232. {
  233. "id": "subagent-hitl-permission-child-final",
  234. "description": "build 模式 child subagent 在 Bash 允许并执行后的最终回复。",
  235. "metadata": {
  236. "kind": "main",
  237. "timingPolicy": "fast-text",
  238. "source": "synthetic",
  239. "syntheticReason": "该响应证明 Bash 输出已进入 child provider-visible 请求,child 可继续完成。"
  240. },
  241. "maxMatches": 1,
  242. "match": {
  243. "method": "POST",
  244. "pathIncludes": "/messages",
  245. "bodyIncludes": [
  246. "E2E_SUBAGENT_HITL_PERMISSION_CHILD",
  247. "E2E_SUBAGENT_HITL_PERMISSION_BASH_OUTPUT",
  248. "toolu_e2e_subagent_hitl_permission_bash"
  249. ],
  250. "bodyExcludes": [
  251. "Generate a concise title",
  252. "CRITICAL: Respond with TEXT ONLY"
  253. ]
  254. },
  255. "response": {
  256. "statusCode": 200,
  257. "text": {
  258. "id": "upstream-e2e-subagent-hitl-permission-child-final",
  259. "inputTokens": 180,
  260. "outputTokens": 12,
  261. "text": "E2E_SUBAGENT_HITL_PERMISSION_CHILD_DONE"
  262. }
  263. }
  264. },
  265. {
  266. "id": "subagent-hitl-permission-parent-final",
  267. "description": "父 agent 收到 permission child 结果后的最终回复。",
  268. "metadata": {
  269. "kind": "main",
  270. "timingPolicy": "fast-text",
  271. "source": "synthetic",
  272. "syntheticReason": "最终回复用于证明 Agent tool_result 被父会话 continuation 消费并正常收口。"
  273. },
  274. "maxMatches": 1,
  275. "match": {
  276. "method": "POST",
  277. "pathIncludes": "/messages",
  278. "bodyIncludes": [
  279. "E2E_SUBAGENT_HITL_PERMISSION_PARENT",
  280. "E2E_SUBAGENT_HITL_PERMISSION_CHILD_DONE",
  281. "toolu_e2e_subagent_hitl_permission_agent"
  282. ],
  283. "bodyExcludes": [
  284. "Generate a concise title",
  285. "CRITICAL: Respond with TEXT ONLY"
  286. ]
  287. },
  288. "response": {
  289. "statusCode": 200,
  290. "text": {
  291. "id": "upstream-e2e-subagent-hitl-permission-parent-final",
  292. "inputTokens": 190,
  293. "outputTokens": 12,
  294. "text": "E2E_SUBAGENT_HITL_PERMISSION_PARENT_DONE"
  295. }
  296. }
  297. }
  298. ]
  299. }