| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- {
- "version": 1,
- "caseName": "plugin-extension-session-approvals",
- "spec": "./test/e2e/plugins/extensions/plugin-extension-session-approvals.test.ts",
- "fixtures": [
- {
- "id": "p3e-title",
- "description": "PLM-EXT-P3E 标题",
- "metadata": {
- "kind": "common",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["Generate a concise title", "E2E_P3E"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "{\"title\":\"E2E_P3E\"}"
- }
- }
- },
- {
- "id": "p3e-allow-call",
- "description": "PLM-EXT-P3E allow:Write 触发审批(会话默认是变更前确认)",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_ALLOW"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_p3e_allow"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_p3e_allow",
- "name": "Write",
- "input": {
- "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/allow.txt",
- "content": "E2E_P3E_ALLOW\n"
- }
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-allow-final",
- "description": "PLM-EXT-P3E allow:tool_result 回灌后的最终文本",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_P3E_ALLOW", "toolu_p3e_allow"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_ALLOW_DONE"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-deny-call",
- "description": "PLM-EXT-P3E deny:Write 触发审批(会话默认是变更前确认)",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_DENY"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_p3e_deny"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_p3e_deny",
- "name": "Write",
- "input": {
- "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/deny.txt",
- "content": "E2E_P3E_DENY\n"
- }
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-deny-final",
- "description": "PLM-EXT-P3E deny:tool_result 回灌后的最终文本",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_P3E_DENY", "toolu_p3e_deny"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_DENY_DONE"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-host-call",
- "description": "PLM-EXT-P3E host:Write 触发审批(会话默认是变更前确认)",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_HOST"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_p3e_host"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_p3e_host",
- "name": "Write",
- "input": {
- "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/host.txt",
- "content": "E2E_P3E_HOST\n"
- }
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-host-final",
- "description": "PLM-EXT-P3E host:tool_result 回灌后的最终文本",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_P3E_HOST", "toolu_p3e_host"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_HOST_DONE"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-full-call",
- "description": "PLM-EXT-P3E full:Write 触发审批(会话默认是变更前确认)",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_FULL"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_p3e_full"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_p3e_full",
- "name": "Write",
- "input": {
- "file_path": "{{e2eRuntimeRoot}}/plugin-extension-approvals/full.txt",
- "content": "E2E_P3E_FULL\n"
- }
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-full-final",
- "description": "PLM-EXT-P3E full:tool_result 回灌后的最终文本",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_P3E_FULL", "toolu_p3e_full"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_FULL_DONE"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-ask-call",
- "description": "PLM-EXT-P3E ask:AskUserQuestion",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_ASK"],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_p3e_ask"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_p3e_ask",
- "name": "AskUserQuestion",
- "input": {
- "questions": [
- {
- "question": "E2E_P3E_ASK_QUESTION: which answer?",
- "header": "E2E",
- "options": [
- {
- "label": "E2E_P3E_ANSWER_A",
- "description": "First answer."
- },
- {
- "label": "E2E_P3E_ANSWER_B",
- "description": "Second answer."
- }
- ]
- }
- ]
- }
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-ask-final",
- "description": "PLM-EXT-P3E ask:答案回到模型(请求里有插件选的答案)",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_P3E_ASK", "toolu_p3e_ask", "E2E_P3E_ANSWER_B"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_ASK_GOT_B"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-mode",
- "description": "PLM-EXT-P3E mode:纯文本回复",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_MODE"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_MODE_DONE"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-yolo",
- "description": "PLM-EXT-P3E yolo:纯文本回复",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_YOLO"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_YOLO_DONE"
- }
- },
- "maxMatches": 1
- },
- {
- "id": "p3e-outside",
- "description": "PLM-EXT-P3E outside:纯文本回复",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "受控模型只选择工具和回复文本;扩展经 ctx.sessions.* 发出的回答与模式切换是真实 V4 命令,在 Electron/Host/Agent 里执行,审批与提问由真实的 Write / AskUserQuestion 工具调用产生;最终文本只在 tool_result 带对应工具 id 时命中,所以回复出现就证明工具结果(批准、拒绝、答案)回到了模型。"
- },
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "lastUserMessageIncludes": ["E2E_P3E_OUTSIDE"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": {
- "text": "E2E_P3E_OUTSIDE_DONE"
- }
- },
- "maxMatches": 1
- }
- ]
- }
|