conversation-session-custom-command-shell-handoff.json 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-custom-command-shell-handoff",
  4. "spec": "./test/e2e/conversation-session/tools/conversation-session-custom-command-shell-handoff.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "cch-title-sidecar",
  8. "description": "本例标题旁路响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "固定标题旁路响应,避免依赖 legacy fixture 或触发后台网络重试。"
  14. },
  15. "match": {
  16. "method": "POST",
  17. "pathIncludes": "/messages",
  18. "bodyIncludes": ["Generate a concise title", "E2E_CCH_"]
  19. },
  20. "response": {
  21. "statusCode": 200,
  22. "text": {
  23. "id": "cch-title-sidecar",
  24. "inputTokens": 64,
  25. "outputTokens": 8,
  26. "text": "{\"title\":\"Custom Command Shell Hand-off\"}"
  27. }
  28. }
  29. },
  30. {
  31. "id": "cch-deny-bash-call",
  32. "description": "收到转交说明后,模型对命令块里的步骤发起非只读 Bash 调用。",
  33. "metadata": {
  34. "kind": "main",
  35. "timingPolicy": "fast-text",
  36. "source": "synthetic",
  37. "syntheticReason": "固定 Bash tool_use,验证 `!` 块只能经模型的 Bash 调用执行,执行前先审批。"
  38. },
  39. "match": {
  40. "method": "POST",
  41. "pathIncludes": "/messages",
  42. "lastUserMessageIncludes": ["E2E_CCH_DENY"],
  43. "bodyExcludes": [
  44. "Generate a concise title",
  45. "CRITICAL: Respond with TEXT ONLY",
  46. "toolu_e2e_cch_deny"
  47. ]
  48. },
  49. "response": {
  50. "statusCode": 200,
  51. "toolUse": {
  52. "id": "toolu_e2e_cch_deny",
  53. "name": "Bash",
  54. "input": {
  55. "command": "printf '%s' \"$CLAUDE_CODE_SESSION_ID\" > \"${CLAUDE_PROJECT_DIR}/.zcode-e2e-cch.marker\""
  56. }
  57. }
  58. }
  59. },
  60. {
  61. "id": "cch-deny-final",
  62. "description": "收到拒绝结果后的最终回复。",
  63. "metadata": {
  64. "kind": "main",
  65. "timingPolicy": "fast-text",
  66. "source": "synthetic",
  67. "syntheticReason": "证明拒绝结果进入下一次请求,会话正常收口。"
  68. },
  69. "match": {
  70. "method": "POST",
  71. "pathIncludes": "/messages",
  72. "bodyIncludes": ["E2E_CCH_DENY", "toolu_e2e_cch_deny"],
  73. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  74. },
  75. "response": {
  76. "statusCode": 200,
  77. "text": {
  78. "id": "cch-deny-final",
  79. "inputTokens": 80,
  80. "outputTokens": 8,
  81. "text": "E2E_CCH_DENY_DONE"
  82. }
  83. }
  84. },
  85. {
  86. "id": "cch-approve-bash-call",
  87. "description": "收到转交说明后,模型对命令块里的步骤发起非只读 Bash 调用。",
  88. "metadata": {
  89. "kind": "main",
  90. "timingPolicy": "fast-text",
  91. "source": "synthetic",
  92. "syntheticReason": "固定 Bash tool_use(命令与 `!` 块逐字一致),验证用户允许一次后命令经 Bash 执行,并从 Bash 环境读到会话 ID 与工作区目录。"
  93. },
  94. "match": {
  95. "method": "POST",
  96. "pathIncludes": "/messages",
  97. "lastUserMessageIncludes": ["E2E_CCH_APPROVE"],
  98. "bodyExcludes": [
  99. "Generate a concise title",
  100. "CRITICAL: Respond with TEXT ONLY",
  101. "toolu_e2e_cch_approve"
  102. ]
  103. },
  104. "response": {
  105. "statusCode": 200,
  106. "toolUse": {
  107. "id": "toolu_e2e_cch_approve",
  108. "name": "Bash",
  109. "input": {
  110. "command": "printf '%s' \"$CLAUDE_CODE_SESSION_ID\" > \"${CLAUDE_PROJECT_DIR}/.zcode-e2e-cch.marker\""
  111. }
  112. }
  113. }
  114. },
  115. {
  116. "id": "cch-approve-final",
  117. "description": "收到执行结果后的最终回复。",
  118. "metadata": {
  119. "kind": "main",
  120. "timingPolicy": "fast-text",
  121. "source": "synthetic",
  122. "syntheticReason": "证明 Bash 执行结果进入下一次请求,会话正常收口。"
  123. },
  124. "match": {
  125. "method": "POST",
  126. "pathIncludes": "/messages",
  127. "bodyIncludes": ["E2E_CCH_APPROVE", "toolu_e2e_cch_approve"],
  128. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  129. },
  130. "response": {
  131. "statusCode": 200,
  132. "text": {
  133. "id": "cch-approve-final",
  134. "inputTokens": 80,
  135. "outputTokens": 8,
  136. "text": "E2E_CCH_APPROVE_DONE"
  137. }
  138. }
  139. }
  140. ]
  141. }