conversation-session-subagent-prompt-assembly.json 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-subagent-prompt-assembly",
  4. "spec": "./test/e2e/conversation-session/subagents/conversation-session-subagent-prompt-assembly.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "subagent-prompt-assembly-title",
  8. "description": "Subagent prompt assembly case 内的标题生成固定响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题生成不是本 case 的产品语义,只需要稳定返回,防止标题请求误命中业务 fixture。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "statusMessage": "OK",
  23. "headers": {
  24. "content-type": "application/json; charset=utf-8"
  25. },
  26. "body": "{\"id\":\"upstream-e2e-subagent-prompt-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Subagent Prompt Assembly\\\"}\"}],\"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\"}}"
  27. }
  28. },
  29. {
  30. "id": "subagent-prompt-assembly-builtin-parent-tool",
  31. "description": "父 agent 首轮请求返回 built-in general-purpose Agent tool_use。",
  32. "metadata": {
  33. "kind": "main",
  34. "timingPolicy": "fast-text",
  35. "source": "synthetic",
  36. "syntheticReason": "核心验证点是 child provider-visible prompt assembly;父请求只需要稳定触发 Agent tool_use。"
  37. },
  38. "maxMatches": 2,
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_PARENT"],
  43. "bodyIncludes": [
  44. "E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_PARENT",
  45. "general-purpose",
  46. "Available agent types for the Agent tool:",
  47. "Available agent types are listed in <system-reminder> messages in the conversation.",
  48. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  49. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  50. ],
  51. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  52. },
  53. "response": {
  54. "statusCode": 200,
  55. "toolUse": {
  56. "id": "toolu_e2e_subagent_prompt_assembly_builtin",
  57. "name": "Agent",
  58. "input": {
  59. "description": "Verify built-in subagent prompt assembly",
  60. "prompt": "E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_CHILD: Reply with exactly \"E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_CHILD_OK\" and no other text.",
  61. "subagent_type": "general-purpose"
  62. }
  63. }
  64. }
  65. },
  66. {
  67. "id": "subagent-prompt-assembly-builtin-child",
  68. "description": "general-purpose child subagent 固定回复。",
  69. "metadata": {
  70. "kind": "main",
  71. "timingPolicy": "fast-text",
  72. "source": "synthetic",
  73. "syntheticReason": "child 请求本身是本 case 的验证证据;响应只需稳定完成并返回子结果 token。"
  74. },
  75. "maxMatches": 2,
  76. "match": {
  77. "method": "POST",
  78. "pathIncludes": "/messages",
  79. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_CHILD"],
  80. "bodyIncludes": [
  81. "E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_CHILD",
  82. "E2E_SUBAGENT_USER_AGENTS_INSTRUCTION",
  83. "E2E_SUBAGENT_WORKSPACE_AGENTS_INSTRUCTION"
  84. ],
  85. "bodyExcludes": [
  86. "Generate a concise title",
  87. "CRITICAL: Respond with TEXT ONLY",
  88. "Available agent types for the Agent tool:"
  89. ]
  90. },
  91. "response": {
  92. "statusCode": 200,
  93. "statusMessage": "OK",
  94. "text": {
  95. "id": "upstream-e2e-subagent-prompt-assembly-builtin-child",
  96. "inputTokens": 128,
  97. "outputTokens": 16,
  98. "text": "E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_CHILD_OK"
  99. }
  100. }
  101. },
  102. {
  103. "id": "subagent-prompt-assembly-builtin-parent-final",
  104. "description": "父 agent 收到 built-in child tool_result 后的固定最终回复。",
  105. "metadata": {
  106. "kind": "main",
  107. "timingPolicy": "fast-text",
  108. "source": "synthetic",
  109. "syntheticReason": "最终回复用于证明 Agent tool_result 被父会话 continuation 消费并回到 idle。"
  110. },
  111. "maxMatches": 2,
  112. "match": {
  113. "method": "POST",
  114. "pathIncludes": "/messages",
  115. "bodyIncludes": [
  116. "E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_PARENT",
  117. "E2E_SUBAGENT_PROMPT_ASSEMBLY_BUILTIN_CHILD_OK",
  118. "Available agent types for the Agent tool:",
  119. "Available agent types are listed in <system-reminder> messages in the conversation.",
  120. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  121. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  122. ],
  123. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  124. },
  125. "response": {
  126. "statusCode": 200,
  127. "statusMessage": "OK",
  128. "text": {
  129. "id": "upstream-e2e-subagent-prompt-assembly-builtin-parent-final",
  130. "inputTokens": 160,
  131. "outputTokens": 12,
  132. "text": "subagent-prompt-assembly-builtin-done"
  133. }
  134. }
  135. },
  136. {
  137. "id": "subagent-prompt-assembly-explore-parent-tool",
  138. "description": "父 agent 第二轮请求返回 built-in Explore Agent tool_use。",
  139. "metadata": {
  140. "kind": "main",
  141. "timingPolicy": "fast-text",
  142. "source": "synthetic",
  143. "syntheticReason": "核心验证点是 Explore child 省略父级 AGENTS.md;父请求只需要稳定触发 Agent tool_use。"
  144. },
  145. "maxMatches": 1,
  146. "match": {
  147. "method": "POST",
  148. "pathIncludes": "/messages",
  149. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_PARENT"],
  150. "bodyIncludes": [
  151. "E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_PARENT",
  152. "Explore",
  153. "Available agent types for the Agent tool:",
  154. "Available agent types are listed in <system-reminder> messages in the conversation.",
  155. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  156. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  157. ],
  158. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  159. },
  160. "response": {
  161. "statusCode": 200,
  162. "toolUse": {
  163. "id": "toolu_e2e_subagent_prompt_assembly_explore",
  164. "name": "Agent",
  165. "input": {
  166. "description": "Verify Explore omits inherited instructions",
  167. "prompt": "E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_CHILD: Reply with exactly \"E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_CHILD_OK\" and no other text.",
  168. "subagent_type": "Explore"
  169. }
  170. }
  171. }
  172. },
  173. {
  174. "id": "subagent-prompt-assembly-explore-child",
  175. "description": "Explore child subagent 固定回复,并拒绝匹配携带 AGENTS marker 的请求。",
  176. "metadata": {
  177. "kind": "main",
  178. "timingPolicy": "fast-text",
  179. "source": "synthetic",
  180. "syntheticReason": "Explore child 请求本身是省略 AGENTS.md 的 trajectory 证据;响应只需稳定完成。"
  181. },
  182. "maxMatches": 1,
  183. "match": {
  184. "method": "POST",
  185. "pathIncludes": "/messages",
  186. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_CHILD"],
  187. "bodyIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_CHILD", "You are ZCode Explore"],
  188. "bodyExcludes": [
  189. "E2E_SUBAGENT_USER_AGENTS_INSTRUCTION",
  190. "E2E_SUBAGENT_WORKSPACE_AGENTS_INSTRUCTION",
  191. "Generate a concise title",
  192. "CRITICAL: Respond with TEXT ONLY",
  193. "Available agent types for the Agent tool:"
  194. ]
  195. },
  196. "response": {
  197. "statusCode": 200,
  198. "statusMessage": "OK",
  199. "text": {
  200. "id": "upstream-e2e-subagent-prompt-assembly-explore-child",
  201. "inputTokens": 128,
  202. "outputTokens": 16,
  203. "text": "E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_CHILD_OK"
  204. }
  205. }
  206. },
  207. {
  208. "id": "subagent-prompt-assembly-explore-parent-final",
  209. "description": "父 agent 收到 Explore child tool_result 后的固定最终回复。",
  210. "metadata": {
  211. "kind": "main",
  212. "timingPolicy": "fast-text",
  213. "source": "synthetic",
  214. "syntheticReason": "Explore 最终回复用于证明 Agent tool_result 被父会话 continuation 消费并回到 idle。"
  215. },
  216. "maxMatches": 1,
  217. "match": {
  218. "method": "POST",
  219. "pathIncludes": "/messages",
  220. "bodyIncludes": [
  221. "E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_PARENT",
  222. "E2E_SUBAGENT_PROMPT_ASSEMBLY_EXPLORE_CHILD_OK",
  223. "Available agent types for the Agent tool:",
  224. "Available agent types are listed in <system-reminder> messages in the conversation.",
  225. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  226. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  227. ],
  228. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  229. },
  230. "response": {
  231. "statusCode": 200,
  232. "statusMessage": "OK",
  233. "text": {
  234. "id": "upstream-e2e-subagent-prompt-assembly-explore-parent-final",
  235. "inputTokens": 160,
  236. "outputTokens": 12,
  237. "text": "subagent-prompt-assembly-explore-done"
  238. }
  239. }
  240. },
  241. {
  242. "id": "subagent-prompt-assembly-custom-parent-tool",
  243. "description": "父 agent 第三轮请求返回缺省继承的 custom Agent tool_use。",
  244. "metadata": {
  245. "kind": "main",
  246. "timingPolicy": "fast-text",
  247. "source": "synthetic",
  248. "syntheticReason": "核心验证点是 custom child provider-visible prompt assembly;父请求只需要稳定触发 Agent tool_use。"
  249. },
  250. "maxMatches": 1,
  251. "match": {
  252. "method": "POST",
  253. "pathIncludes": "/messages",
  254. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_PARENT"],
  255. "bodyIncludes": [
  256. "E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_PARENT",
  257. "e2e-prompt-assembly-reviewer",
  258. "Available agent types for the Agent tool:",
  259. "Available agent types are listed in <system-reminder> messages in the conversation.",
  260. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  261. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  262. ],
  263. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  264. },
  265. "response": {
  266. "statusCode": 200,
  267. "toolUse": {
  268. "id": "toolu_e2e_subagent_prompt_assembly_custom",
  269. "name": "Agent",
  270. "input": {
  271. "description": "Verify custom subagent prompt assembly",
  272. "prompt": "E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_CHILD: Reply with exactly \"E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_CHILD_OK\" and no other text.",
  273. "subagent_type": "e2e-prompt-assembly-reviewer"
  274. }
  275. }
  276. }
  277. },
  278. {
  279. "id": "subagent-prompt-assembly-custom-child",
  280. "description": "custom child subagent 固定回复。",
  281. "metadata": {
  282. "kind": "main",
  283. "timingPolicy": "fast-text",
  284. "source": "synthetic",
  285. "syntheticReason": "custom child 请求本身是本 case 的验证证据;响应只需稳定完成并返回子结果 token。"
  286. },
  287. "maxMatches": 1,
  288. "match": {
  289. "method": "POST",
  290. "pathIncludes": "/messages",
  291. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_CHILD"],
  292. "bodyIncludes": [
  293. "E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_CHILD",
  294. "E2E_CUSTOM_PROMPT_ASSEMBLY_AGENT_BODY",
  295. "E2E_SUBAGENT_USER_AGENTS_INSTRUCTION",
  296. "E2E_SUBAGENT_WORKSPACE_AGENTS_INSTRUCTION"
  297. ],
  298. "bodyExcludes": [
  299. "Generate a concise title",
  300. "CRITICAL: Respond with TEXT ONLY",
  301. "Available agent types for the Agent tool:"
  302. ]
  303. },
  304. "response": {
  305. "statusCode": 200,
  306. "statusMessage": "OK",
  307. "text": {
  308. "id": "upstream-e2e-subagent-prompt-assembly-custom-child",
  309. "inputTokens": 128,
  310. "outputTokens": 16,
  311. "text": "E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_CHILD_OK"
  312. }
  313. }
  314. },
  315. {
  316. "id": "subagent-prompt-assembly-custom-parent-final",
  317. "description": "父 agent 收到 custom child tool_result 后的固定最终回复。",
  318. "metadata": {
  319. "kind": "main",
  320. "timingPolicy": "fast-text",
  321. "source": "synthetic",
  322. "syntheticReason": "custom 最终回复用于证明 Agent tool_result 被父会话 continuation 消费并回到 idle。"
  323. },
  324. "maxMatches": 1,
  325. "match": {
  326. "method": "POST",
  327. "pathIncludes": "/messages",
  328. "bodyIncludes": [
  329. "E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_PARENT",
  330. "E2E_SUBAGENT_PROMPT_ASSEMBLY_CUSTOM_CHILD_OK",
  331. "Available agent types for the Agent tool:",
  332. "Available agent types are listed in <system-reminder> messages in the conversation.",
  333. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  334. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  335. ],
  336. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  337. },
  338. "response": {
  339. "statusCode": 200,
  340. "statusMessage": "OK",
  341. "text": {
  342. "id": "upstream-e2e-subagent-prompt-assembly-custom-parent-final",
  343. "inputTokens": 160,
  344. "outputTokens": 12,
  345. "text": "subagent-prompt-assembly-custom-done"
  346. }
  347. }
  348. },
  349. {
  350. "id": "subagent-prompt-assembly-isolated-parent-tool",
  351. "description": "父 agent 第四轮请求返回显式关闭 AGENTS 继承的 custom Agent tool_use。",
  352. "metadata": {
  353. "kind": "main",
  354. "timingPolicy": "fast-text",
  355. "source": "synthetic",
  356. "syntheticReason": "核心验证点是 custom false child 省略父级 AGENTS.md;父请求只需要稳定触发 Agent tool_use。"
  357. },
  358. "maxMatches": 1,
  359. "match": {
  360. "method": "POST",
  361. "pathIncludes": "/messages",
  362. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_PARENT"],
  363. "bodyIncludes": [
  364. "E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_PARENT",
  365. "e2e-prompt-assembly-isolated",
  366. "Available agent types for the Agent tool:",
  367. "Available agent types are listed in <system-reminder> messages in the conversation.",
  368. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  369. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  370. ],
  371. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  372. },
  373. "response": {
  374. "statusCode": 200,
  375. "toolUse": {
  376. "id": "toolu_e2e_subagent_prompt_assembly_isolated",
  377. "name": "Agent",
  378. "input": {
  379. "description": "Verify custom subagent omits inherited instructions",
  380. "prompt": "E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_CHILD: Reply with exactly \"E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_CHILD_OK\" and no other text.",
  381. "subagent_type": "e2e-prompt-assembly-isolated"
  382. }
  383. }
  384. }
  385. },
  386. {
  387. "id": "subagent-prompt-assembly-isolated-child",
  388. "description": "显式关闭继承的 custom child 固定回复,并拒绝匹配携带 AGENTS marker 的请求。",
  389. "metadata": {
  390. "kind": "main",
  391. "timingPolicy": "fast-text",
  392. "source": "synthetic",
  393. "syntheticReason": "custom false child 请求本身是省略 AGENTS.md 的 trajectory 证据;响应只需稳定完成。"
  394. },
  395. "maxMatches": 1,
  396. "match": {
  397. "method": "POST",
  398. "pathIncludes": "/messages",
  399. "lastUserMessageIncludes": ["E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_CHILD"],
  400. "bodyIncludes": [
  401. "E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_CHILD",
  402. "E2E_ISOLATED_CUSTOM_PROMPT_ASSEMBLY_AGENT_BODY"
  403. ],
  404. "bodyExcludes": [
  405. "E2E_SUBAGENT_USER_AGENTS_INSTRUCTION",
  406. "E2E_SUBAGENT_WORKSPACE_AGENTS_INSTRUCTION",
  407. "Generate a concise title",
  408. "CRITICAL: Respond with TEXT ONLY",
  409. "Available agent types for the Agent tool:"
  410. ]
  411. },
  412. "response": {
  413. "statusCode": 200,
  414. "statusMessage": "OK",
  415. "text": {
  416. "id": "upstream-e2e-subagent-prompt-assembly-isolated-child",
  417. "inputTokens": 128,
  418. "outputTokens": 16,
  419. "text": "E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_CHILD_OK"
  420. }
  421. }
  422. },
  423. {
  424. "id": "subagent-prompt-assembly-isolated-parent-final",
  425. "description": "父 agent 收到显式关闭继承的 custom child tool_result 后的固定最终回复。",
  426. "metadata": {
  427. "kind": "main",
  428. "timingPolicy": "fast-text",
  429. "source": "synthetic",
  430. "syntheticReason": "custom false 最终回复用于证明 Agent tool_result 被父会话 continuation 消费并回到 idle。"
  431. },
  432. "maxMatches": 1,
  433. "match": {
  434. "method": "POST",
  435. "pathIncludes": "/messages",
  436. "bodyIncludes": [
  437. "E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_PARENT",
  438. "E2E_SUBAGENT_PROMPT_ASSEMBLY_ISOLATED_CHILD_OK",
  439. "Available agent types for the Agent tool:",
  440. "Available agent types are listed in <system-reminder> messages in the conversation.",
  441. "Use SendMessage with the agent's ID to continue a previously spawned agent with its context intact; a new Agent call starts fresh.",
  442. "Each agent type's model, reasoning effort, and tools come from its definition (`.zcode/agents/*.md` frontmatter)."
  443. ],
  444. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  445. },
  446. "response": {
  447. "statusCode": 200,
  448. "statusMessage": "OK",
  449. "text": {
  450. "id": "upstream-e2e-subagent-prompt-assembly-isolated-parent-final",
  451. "inputTokens": 160,
  452. "outputTokens": 12,
  453. "text": "subagent-prompt-assembly-isolated-done"
  454. }
  455. }
  456. }
  457. ]
  458. }