conversation-session-shared-cli.json 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-shared-cli",
  4. "spec": "./test/e2e/conversation-session/runtime/conversation-session-shared-cli.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "shared-cli-title",
  8. "description": "本例标题旁路响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "source": "synthetic",
  12. "timingPolicy": "fast-text",
  13. "syntheticReason": "共享进程用例的标题旁路固定响应,不参与运行归属断言。"
  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-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\"}}"
  27. }
  28. },
  29. {
  30. "id": "shared-cli-tool-done-a",
  31. "metadata": {
  32. "kind": "main",
  33. "source": "synthetic",
  34. "timingPolicy": "fast-text",
  35. "syntheticReason": "工具结果后的固定 continuation;实际权限审批和文件写入由 CLI 执行。"
  36. },
  37. "maxMatches": 1,
  38. "match": {
  39. "method": "POST",
  40. "pathIncludes": "/messages",
  41. "bodyIncludes": ["E2E_SHARED_CLI_TOOL_A", "toolu_shared_cli_cwd"],
  42. "bodyExcludes": ["Generate a concise title"]
  43. },
  44. "response": {
  45. "statusCode": 200,
  46. "text": {
  47. "id": "shared-cli-tool-done-A",
  48. "inputTokens": 128,
  49. "outputTokens": 12,
  50. "text": "shared-cli-tool-done"
  51. }
  52. }
  53. },
  54. {
  55. "id": "shared-cli-tool-done-b",
  56. "metadata": {
  57. "kind": "main",
  58. "source": "synthetic",
  59. "timingPolicy": "fast-text",
  60. "syntheticReason": "工具结果后的固定 continuation;实际权限审批和文件写入由 CLI 执行。"
  61. },
  62. "maxMatches": 1,
  63. "match": {
  64. "method": "POST",
  65. "pathIncludes": "/messages",
  66. "bodyIncludes": ["E2E_SHARED_CLI_TOOL_B", "toolu_shared_cli_cwd"],
  67. "bodyExcludes": ["Generate a concise title"]
  68. },
  69. "response": {
  70. "statusCode": 200,
  71. "text": {
  72. "id": "shared-cli-tool-done-B",
  73. "inputTokens": 128,
  74. "outputTokens": 12,
  75. "text": "shared-cli-tool-done"
  76. }
  77. }
  78. },
  79. {
  80. "id": "shared-cli-tool-a",
  81. "metadata": {
  82. "kind": "main",
  83. "source": "synthetic",
  84. "timingPolicy": "fast-text",
  85. "syntheticReason": "同名工具调用经真实审批与 Bash 执行,验证共享 CLI 的 session 路由和 cwd 隔离。"
  86. },
  87. "maxMatches": 1,
  88. "match": {
  89. "method": "POST",
  90. "pathIncludes": "/messages",
  91. "lastUserMessageIncludes": ["E2E_SHARED_CLI_TOOL_A"],
  92. "bodyExcludes": ["Generate a concise title", "toolu_shared_cli_cwd"]
  93. },
  94. "response": {
  95. "statusCode": 200,
  96. "toolUses": [
  97. {
  98. "id": "toolu_shared_cli_cwd",
  99. "name": "Bash",
  100. "input": {
  101. "command": "node -e \"require('node:fs').writeFileSync('shared-cli-proof.txt',process.cwd())\"",
  102. "timeout": 120000
  103. }
  104. }
  105. ]
  106. }
  107. },
  108. {
  109. "id": "shared-cli-tool-b",
  110. "metadata": {
  111. "kind": "main",
  112. "source": "synthetic",
  113. "timingPolicy": "fast-text",
  114. "syntheticReason": "同名工具调用经真实审批与 Bash 执行,验证共享 CLI 的 session 路由和 cwd 隔离。"
  115. },
  116. "maxMatches": 1,
  117. "match": {
  118. "method": "POST",
  119. "pathIncludes": "/messages",
  120. "lastUserMessageIncludes": ["E2E_SHARED_CLI_TOOL_B"],
  121. "bodyExcludes": ["Generate a concise title", "toolu_shared_cli_cwd"]
  122. },
  123. "response": {
  124. "statusCode": 200,
  125. "toolUses": [
  126. {
  127. "id": "toolu_shared_cli_cwd",
  128. "name": "Bash",
  129. "input": {
  130. "command": "node -e \"require('node:fs').writeFileSync('shared-cli-proof.txt',process.cwd())\"",
  131. "timeout": 120000
  132. }
  133. }
  134. ]
  135. }
  136. },
  137. {
  138. "id": "shared-cli-running",
  139. "description": "A 的流式响应保持在途,验证 B 并发发送与 A 停止互不串扰。",
  140. "metadata": {
  141. "kind": "main",
  142. "timingPolicy": "controlled-stream",
  143. "source": "synthetic",
  144. "syntheticReason": "上游时间线保持 A 运行,测试以请求开始事件同步,不使用 sleep 猜状态。"
  145. },
  146. "maxMatches": 1,
  147. "match": {
  148. "method": "POST",
  149. "pathIncludes": "/messages",
  150. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"],
  151. "lastUserMessageIncludes": ["E2E_SHARED_CLI_RUNNING"],
  152. "lastUserMessageExcludes": [
  153. "E2E_SHARED_CLI_A_RESTARTED",
  154. "E2E_SHARED_CLI_A_MOVED",
  155. "E2E_SHARED_CLI_A_RECOVERED"
  156. ]
  157. },
  158. "response": {
  159. "statusCode": 200,
  160. "statusMessage": "OK",
  161. "headers": {
  162. "cache-control": "no-cache",
  163. "content-type": "text/event-stream; charset=utf-8"
  164. },
  165. "events": [
  166. {
  167. "sequence": 0,
  168. "offsetMs": 0,
  169. "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"upstream-e2e-stop-empty-running-slow-stream\",\"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"
  170. },
  171. {
  172. "sequence": 1,
  173. "offsetMs": 250,
  174. "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n"
  175. },
  176. {
  177. "sequence": 2,
  178. "offsetMs": 700,
  179. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"deep\"}}\n\n"
  180. },
  181. {
  182. "sequence": 3,
  183. "offsetMs": 60000,
  184. "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"seek-e2e-ok\"}}\n\n"
  185. },
  186. {
  187. "sequence": 4,
  188. "offsetMs": 60100,
  189. "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n"
  190. },
  191. {
  192. "sequence": 5,
  193. "offsetMs": 60200,
  194. "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":120,\"output_tokens\":12,\"service_tier\":\"standard\"}}\n\n"
  195. },
  196. {
  197. "sequence": 6,
  198. "offsetMs": 60300,
  199. "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n"
  200. }
  201. ]
  202. }
  203. },
  204. {
  205. "id": "shared-cli-reply",
  206. "metadata": {
  207. "kind": "main",
  208. "source": "synthetic",
  209. "timingPolicy": "fast-text",
  210. "syntheticReason": "模型仅完成真实消息链路;用例断言跨任务 PID 复用与消息归属。"
  211. },
  212. "maxMatches": 32,
  213. "match": {
  214. "method": "POST",
  215. "pathIncludes": "/messages",
  216. "lastUserMessageIncludes": ["E2E_SHARED_CLI_"],
  217. "bodyExcludes": ["Generate a concise title"]
  218. },
  219. "response": {
  220. "statusCode": 200,
  221. "text": {
  222. "id": "draft-singleflight",
  223. "inputTokens": 128,
  224. "outputTokens": 12,
  225. "text": "shared-cli-ok"
  226. }
  227. }
  228. }
  229. ]
  230. }