plugin-extension-session-approvals.json 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. {
  2. "version": 1,
  3. "caseName": "plugin-extension-session-approvals",
  4. "spec": "./test/e2e/plugins/extensions/plugin-extension-session-approvals.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "p3e-title",
  8. "description": "PLM-EXT-P3E 标题",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_P3E"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "text": {
  23. "text": "{\"title\":\"E2E_P3E\"}"
  24. }
  25. }
  26. },
  27. {
  28. "id": "p3e-allow-call",
  29. "description": "PLM-EXT-P3E allow:Write 触发审批(会话默认是变更前确认)",
  30. "metadata": {
  31. "kind": "main",
  32. "timingPolicy": "fast-text",
  33. "source": "synthetic",
  34. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  35. },
  36. "match": {
  37. "method": "POST",
  38. "pathIncludes": "/messages",
  39. "lastUserMessageIncludes": ["E2E_P3E_ALLOW"],
  40. "bodyExcludes": [
  41. "Generate a concise title",
  42. "CRITICAL: Respond with TEXT ONLY",
  43. "toolu_p3e_allow"
  44. ]
  45. },
  46. "response": {
  47. "statusCode": 200,
  48. "toolUse": {
  49. "id": "toolu_p3e_allow",
  50. "name": "Write",
  51. "input": {
  52. "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/allow.txt",
  53. "content": "E2E_P3E_ALLOW\n"
  54. }
  55. }
  56. },
  57. "maxMatches": 1
  58. },
  59. {
  60. "id": "p3e-allow-final",
  61. "description": "PLM-EXT-P3E allow:tool_result 回灌后的最终文本",
  62. "metadata": {
  63. "kind": "main",
  64. "timingPolicy": "fast-text",
  65. "source": "synthetic",
  66. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  67. },
  68. "match": {
  69. "method": "POST",
  70. "pathIncludes": "/messages",
  71. "bodyIncludes": ["E2E_P3E_ALLOW", "toolu_p3e_allow"],
  72. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  73. },
  74. "response": {
  75. "statusCode": 200,
  76. "text": {
  77. "text": "E2E_P3E_ALLOW_DONE"
  78. }
  79. },
  80. "maxMatches": 1
  81. },
  82. {
  83. "id": "p3e-deny-call",
  84. "description": "PLM-EXT-P3E deny:Write 触发审批(会话默认是变更前确认)",
  85. "metadata": {
  86. "kind": "main",
  87. "timingPolicy": "fast-text",
  88. "source": "synthetic",
  89. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  90. },
  91. "match": {
  92. "method": "POST",
  93. "pathIncludes": "/messages",
  94. "lastUserMessageIncludes": ["E2E_P3E_DENY"],
  95. "bodyExcludes": [
  96. "Generate a concise title",
  97. "CRITICAL: Respond with TEXT ONLY",
  98. "toolu_p3e_deny"
  99. ]
  100. },
  101. "response": {
  102. "statusCode": 200,
  103. "toolUse": {
  104. "id": "toolu_p3e_deny",
  105. "name": "Write",
  106. "input": {
  107. "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/deny.txt",
  108. "content": "E2E_P3E_DENY\n"
  109. }
  110. }
  111. },
  112. "maxMatches": 1
  113. },
  114. {
  115. "id": "p3e-deny-final",
  116. "description": "PLM-EXT-P3E deny:tool_result 回灌后的最终文本",
  117. "metadata": {
  118. "kind": "main",
  119. "timingPolicy": "fast-text",
  120. "source": "synthetic",
  121. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  122. },
  123. "match": {
  124. "method": "POST",
  125. "pathIncludes": "/messages",
  126. "bodyIncludes": ["E2E_P3E_DENY", "toolu_p3e_deny"],
  127. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  128. },
  129. "response": {
  130. "statusCode": 200,
  131. "text": {
  132. "text": "E2E_P3E_DENY_DONE"
  133. }
  134. },
  135. "maxMatches": 1
  136. },
  137. {
  138. "id": "p3e-host-call",
  139. "description": "PLM-EXT-P3E host:Write 触发审批(会话默认是变更前确认)",
  140. "metadata": {
  141. "kind": "main",
  142. "timingPolicy": "fast-text",
  143. "source": "synthetic",
  144. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  145. },
  146. "match": {
  147. "method": "POST",
  148. "pathIncludes": "/messages",
  149. "lastUserMessageIncludes": ["E2E_P3E_HOST"],
  150. "bodyExcludes": [
  151. "Generate a concise title",
  152. "CRITICAL: Respond with TEXT ONLY",
  153. "toolu_p3e_host"
  154. ]
  155. },
  156. "response": {
  157. "statusCode": 200,
  158. "toolUse": {
  159. "id": "toolu_p3e_host",
  160. "name": "Write",
  161. "input": {
  162. "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/host.txt",
  163. "content": "E2E_P3E_HOST\n"
  164. }
  165. }
  166. },
  167. "maxMatches": 1
  168. },
  169. {
  170. "id": "p3e-host-final",
  171. "description": "PLM-EXT-P3E host:tool_result 回灌后的最终文本",
  172. "metadata": {
  173. "kind": "main",
  174. "timingPolicy": "fast-text",
  175. "source": "synthetic",
  176. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  177. },
  178. "match": {
  179. "method": "POST",
  180. "pathIncludes": "/messages",
  181. "bodyIncludes": ["E2E_P3E_HOST", "toolu_p3e_host"],
  182. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  183. },
  184. "response": {
  185. "statusCode": 200,
  186. "text": {
  187. "text": "E2E_P3E_HOST_DONE"
  188. }
  189. },
  190. "maxMatches": 1
  191. },
  192. {
  193. "id": "p3e-full-call",
  194. "description": "PLM-EXT-P3E full:Write 触发审批(会话默认是变更前确认)",
  195. "metadata": {
  196. "kind": "main",
  197. "timingPolicy": "fast-text",
  198. "source": "synthetic",
  199. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  200. },
  201. "match": {
  202. "method": "POST",
  203. "pathIncludes": "/messages",
  204. "lastUserMessageIncludes": ["E2E_P3E_FULL"],
  205. "bodyExcludes": [
  206. "Generate a concise title",
  207. "CRITICAL: Respond with TEXT ONLY",
  208. "toolu_p3e_full"
  209. ]
  210. },
  211. "response": {
  212. "statusCode": 200,
  213. "toolUse": {
  214. "id": "toolu_p3e_full",
  215. "name": "Write",
  216. "input": {
  217. "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/full.txt",
  218. "content": "E2E_P3E_FULL\n"
  219. }
  220. }
  221. },
  222. "maxMatches": 1
  223. },
  224. {
  225. "id": "p3e-full-final",
  226. "description": "PLM-EXT-P3E full:tool_result 回灌后的最终文本",
  227. "metadata": {
  228. "kind": "main",
  229. "timingPolicy": "fast-text",
  230. "source": "synthetic",
  231. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  232. },
  233. "match": {
  234. "method": "POST",
  235. "pathIncludes": "/messages",
  236. "bodyIncludes": ["E2E_P3E_FULL", "toolu_p3e_full"],
  237. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  238. },
  239. "response": {
  240. "statusCode": 200,
  241. "text": {
  242. "text": "E2E_P3E_FULL_DONE"
  243. }
  244. },
  245. "maxMatches": 1
  246. },
  247. {
  248. "id": "p3e-ask-call",
  249. "description": "PLM-EXT-P3E ask:AskUserQuestion",
  250. "metadata": {
  251. "kind": "main",
  252. "timingPolicy": "fast-text",
  253. "source": "synthetic",
  254. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  255. },
  256. "match": {
  257. "method": "POST",
  258. "pathIncludes": "/messages",
  259. "lastUserMessageIncludes": ["E2E_P3E_ASK"],
  260. "bodyExcludes": [
  261. "Generate a concise title",
  262. "CRITICAL: Respond with TEXT ONLY",
  263. "toolu_p3e_ask"
  264. ]
  265. },
  266. "response": {
  267. "statusCode": 200,
  268. "toolUse": {
  269. "id": "toolu_p3e_ask",
  270. "name": "AskUserQuestion",
  271. "input": {
  272. "questions": [
  273. {
  274. "question": "E2E_P3E_ASK_QUESTION: which answer?",
  275. "header": "E2E",
  276. "options": [
  277. {
  278. "label": "E2E_P3E_ANSWER_A",
  279. "description": "First answer."
  280. },
  281. {
  282. "label": "E2E_P3E_ANSWER_B",
  283. "description": "Second answer."
  284. }
  285. ]
  286. }
  287. ]
  288. }
  289. }
  290. },
  291. "maxMatches": 1
  292. },
  293. {
  294. "id": "p3e-ask-final",
  295. "description": "PLM-EXT-P3E ask:答案回到模型(请求里有插件选的答案)",
  296. "metadata": {
  297. "kind": "main",
  298. "timingPolicy": "fast-text",
  299. "source": "synthetic",
  300. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  301. },
  302. "match": {
  303. "method": "POST",
  304. "pathIncludes": "/messages",
  305. "bodyIncludes": ["E2E_P3E_ASK", "toolu_p3e_ask", "E2E_P3E_ANSWER_B"],
  306. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  307. },
  308. "response": {
  309. "statusCode": 200,
  310. "text": {
  311. "text": "E2E_P3E_ASK_GOT_B"
  312. }
  313. },
  314. "maxMatches": 1
  315. },
  316. {
  317. "id": "p3e-mode",
  318. "description": "PLM-EXT-P3E mode:纯文本回复",
  319. "metadata": {
  320. "kind": "main",
  321. "timingPolicy": "fast-text",
  322. "source": "synthetic",
  323. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  324. },
  325. "match": {
  326. "method": "POST",
  327. "pathIncludes": "/messages",
  328. "lastUserMessageIncludes": ["E2E_P3E_MODE"],
  329. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  330. },
  331. "response": {
  332. "statusCode": 200,
  333. "text": {
  334. "text": "E2E_P3E_MODE_DONE"
  335. }
  336. },
  337. "maxMatches": 1
  338. },
  339. {
  340. "id": "p3e-yolo",
  341. "description": "PLM-EXT-P3E yolo:纯文本回复",
  342. "metadata": {
  343. "kind": "main",
  344. "timingPolicy": "fast-text",
  345. "source": "synthetic",
  346. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  347. },
  348. "match": {
  349. "method": "POST",
  350. "pathIncludes": "/messages",
  351. "lastUserMessageIncludes": ["E2E_P3E_YOLO"],
  352. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  353. },
  354. "response": {
  355. "statusCode": 200,
  356. "text": {
  357. "text": "E2E_P3E_YOLO_DONE"
  358. }
  359. },
  360. "maxMatches": 1
  361. },
  362. {
  363. "id": "p3e-outside",
  364. "description": "PLM-EXT-P3E outside:纯文本回复",
  365. "metadata": {
  366. "kind": "main",
  367. "timingPolicy": "fast-text",
  368. "source": "synthetic",
  369. "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
  370. },
  371. "match": {
  372. "method": "POST",
  373. "pathIncludes": "/messages",
  374. "lastUserMessageIncludes": ["E2E_P3E_OUTSIDE"],
  375. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  376. },
  377. "response": {
  378. "statusCode": 200,
  379. "text": {
  380. "text": "E2E_P3E_OUTSIDE_DONE"
  381. }
  382. },
  383. "maxMatches": 1
  384. }
  385. ]
  386. }