agent_evaluator 1.0.2__tar.gz → 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/PKG-INFO +14 -11
  2. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/README.md +13 -10
  3. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/__init__.py +1 -1
  4. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/_integration_health.py +38 -0
  5. agent_evaluator-1.0.4/agent_evaluator/cli/_violations_detail.py +167 -0
  6. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/claude.py +143 -14
  7. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/opencode.py +28 -4
  8. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/live_guardrail.py +84 -3
  9. agent_evaluator-1.0.4/agent_evaluator/integrations/_blocked_detail.py +329 -0
  10. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/claude_code_hook.py +25 -10
  11. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/live_guardrail_stdio.py +23 -4
  12. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/opencode_plugin/agent-evaluator.ts +17 -3
  13. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/violation_search_mcp.py +67 -5
  14. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/storage/sqlite_backend.py +105 -11
  15. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/pyproject.toml +1 -1
  16. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/.gitignore +0 -0
  17. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/LICENSE +0 -0
  18. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/alerts/__init__.py +0 -0
  19. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/alerts/engine.py +0 -0
  20. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/alerts/handlers.py +0 -0
  21. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/anomaly/__init__.py +0 -0
  22. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/anomaly/detector.py +0 -0
  23. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/__init__.py +0 -0
  24. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/_utils.py +0 -0
  25. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/abtest.py +0 -0
  26. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/benchmark.py +0 -0
  27. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/claims.py +0 -0
  28. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/dataset.py +0 -0
  29. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/diagnose.py +0 -0
  30. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/experiment.py +0 -0
  31. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/gate.py +0 -0
  32. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/improve.py +0 -0
  33. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/main.py +0 -0
  34. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/monitor.py +0 -0
  35. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/targets.py +0 -0
  36. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cli/trend.py +0 -0
  37. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/config.py +0 -0
  38. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/__init__.py +0 -0
  39. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/agent_evaluator.py +0 -0
  40. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/hybrid_monitor.py +0 -0
  41. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/monitor_context.py +0 -0
  42. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/otel/__init__.py +0 -0
  43. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/otel/metrics.py +0 -0
  44. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/otel/provider.py +0 -0
  45. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/__init__.py +0 -0
  46. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/base.py +0 -0
  47. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/conversation.py +0 -0
  48. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/feedback.py +0 -0
  49. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/layer1.py +0 -0
  50. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/layer2.py +0 -0
  51. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/monitor.py +0 -0
  52. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/core/trackers/security.py +0 -0
  53. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cost/__init__.py +0 -0
  54. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/cost/policy.py +0 -0
  55. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/datasets/__init__.py +0 -0
  56. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/datasets/builder.py +0 -0
  57. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/datasets/golden_health.py +0 -0
  58. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/datasets/korean_rag_dataset_generator.py +0 -0
  59. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/datasets/korean_rag_evaluator.py +0 -0
  60. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/decorators.py +0 -0
  61. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/examples/__init__.py +0 -0
  62. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/examples/example_runner.py +0 -0
  63. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/exceptions.py +0 -0
  64. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/__init__.py +0 -0
  65. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/base.py +0 -0
  66. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/branch_guard.py +0 -0
  67. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_a_goal/__init__.py +0 -0
  68. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_a_goal/aggregate.py +0 -0
  69. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_a_goal/configs.py +0 -0
  70. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_a_goal/evaluators.py +0 -0
  71. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_b_behavioral/__init__.py +0 -0
  72. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_b_behavioral/aggregate.py +0 -0
  73. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_b_behavioral/configs.py +0 -0
  74. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_b_behavioral/evaluators.py +0 -0
  75. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_c_reliability/__init__.py +0 -0
  76. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_c_reliability/aggregate.py +0 -0
  77. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_c_reliability/configs.py +0 -0
  78. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_c_reliability/evaluators.py +0 -0
  79. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_d_performance/__init__.py +0 -0
  80. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_d_performance/aggregate.py +0 -0
  81. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_d_performance/configs.py +0 -0
  82. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_d_performance/evaluators.py +0 -0
  83. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_e_security/__init__.py +0 -0
  84. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_e_security/aggregate.py +0 -0
  85. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_e_security/configs.py +0 -0
  86. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_e_security/evaluators.py +0 -0
  87. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_f_multiagent/__init__.py +0 -0
  88. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_f_multiagent/aggregate.py +0 -0
  89. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_f_multiagent/configs.py +0 -0
  90. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_f_multiagent/evaluators.py +0 -0
  91. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_g_observability/__init__.py +0 -0
  92. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_g_observability/aggregate.py +0 -0
  93. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_g_observability/configs.py +0 -0
  94. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/gate_g_observability/evaluators.py +0 -0
  95. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/shared_metrics.py +0 -0
  96. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/gates/team_concurrency.py +0 -0
  97. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/helpers/__init__.py +0 -0
  98. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/helpers/taskresult_helpers.py +0 -0
  99. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/__init__.py +0 -0
  100. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/ask_insights_mcp.py +0 -0
  101. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/dspy_integration.py +0 -0
  102. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/framework_integrations.py +0 -0
  103. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/live_guardrail_report.py +0 -0
  104. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/llm_judge.py +0 -0
  105. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/llm_judge_calibration.py +0 -0
  106. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/metric_adapters.py +0 -0
  107. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/opencode_plugin/package-lock.json +0 -0
  108. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/opencode_plugin/package.json +0 -0
  109. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/opencode_plugin/tsconfig.json +0 -0
  110. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/pydanticai_integration.py +0 -0
  111. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/integrations/recommend_fix_mcp.py +0 -0
  112. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/ontology/__init__.py +0 -0
  113. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/ontology/failure_taxonomy.py +0 -0
  114. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/ontology/mast_taxonomy.py +0 -0
  115. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/ontology/metric_registry.py +0 -0
  116. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/py.typed +0 -0
  117. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/quick_eval.py +0 -0
  118. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/__init__.py +0 -0
  119. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/diagnose.py +0 -0
  120. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/experiment_metadata.py +0 -0
  121. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/experiments.py +0 -0
  122. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/improvement_priors.py +0 -0
  123. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/recommendation_tracking.py +0 -0
  124. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/rca/verify.py +0 -0
  125. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/reporting/__init__.py +0 -0
  126. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/reporting/comprehensive_report.py +0 -0
  127. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/reporting/history.py +0 -0
  128. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/reporting/insights.py +0 -0
  129. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/schemas/harness_groups.schema.json +0 -0
  130. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/schemas/insights.schema.json +0 -0
  131. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/__init__.py +0 -0
  132. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/cache.py +0 -0
  133. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/loader.py +0 -0
  134. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/__init__.py +0 -0
  135. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/_utils.py +0 -0
  136. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/alerts.py +0 -0
  137. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/anomaly.py +0 -0
  138. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/config.py +0 -0
  139. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/conversation.py +0 -0
  140. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/cost.py +0 -0
  141. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/data.py +0 -0
  142. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/diagnose.py +0 -0
  143. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/export.py +0 -0
  144. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/feedback.py +0 -0
  145. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/golden.py +0 -0
  146. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/stream.py +0 -0
  147. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/transparency.py +0 -0
  148. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/routers/webhook.py +0 -0
  149. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/server.py +0 -0
  150. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/templates/dashboard2.html.j2 +0 -0
  151. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/templates/sdk_docs.html.j2 +0 -0
  152. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/templates/slides.html.j2 +0 -0
  153. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/serve/watcher.py +0 -0
  154. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/storage/__init__.py +0 -0
  155. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/streaming/__init__.py +0 -0
  156. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/streaming/evaluator.py +0 -0
  157. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/streaming/middleware.py +0 -0
  158. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/__init__.py +0 -0
  159. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/confidence.py +0 -0
  160. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/dashboard_integration.py +0 -0
  161. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/data_registry.py +0 -0
  162. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/lazy_import.py +0 -0
  163. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/path_helpers.py +0 -0
  164. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/pii_redaction.py +0 -0
  165. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/reference.py +0 -0
  166. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/targets.py +0 -0
  167. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/text_similarity.py +0 -0
  168. {agent_evaluator-1.0.2 → agent_evaluator-1.0.4}/agent_evaluator/utils/transparency_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-evaluator
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: Production-ready evaluation framework for AI agents — 58 metrics (25 native + 33 Harness Config) across 7 evaluation gates: goal achievement, behavioral integrity, reliability, performance, security, multi-agent coordination, and observability
5
5
  Project-URL: Homepage, https://github.com/bullpeng72/Agent-Evaluator
6
6
  Project-URL: Repository, https://github.com/bullpeng72/Agent-Evaluator
@@ -159,7 +159,7 @@ Description-Content-Type: text/markdown
159
159
  [![PyPI version](https://img.shields.io/pypi/v/agent-evaluator.svg)](https://pypi.org/project/agent-evaluator/)
160
160
  [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
161
161
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
162
- [![Version](https://img.shields.io/badge/version-1.0.2-brightgreen.svg)](https://github.com/bullpeng72/Agent-Evaluator)
162
+ [![Version](https://img.shields.io/badge/version-1.0.4-brightgreen.svg)](https://github.com/bullpeng72/Agent-Evaluator)
163
163
 
164
164
  **Harness Engineering evaluation SDK that judges AI agent deployment readiness through 7 Gates.**
165
165
 
@@ -260,7 +260,9 @@ Full Gate reference: [`Docs/05_QUALITY_GATE.md`](https://github.com/bullpeng72/A
260
260
  [OpenCode](https://opencode.ai) — fully local, no cloud model) via `agent-eval opencode install`, or
261
261
  **AC** (Agent-Evaluator + [Claude Code](https://claude.com/claude-code) — native CLI hooks) via
262
262
  `agent-eval claude install`. Identical verdict logic; the difference is the process model (a resident
263
- subprocess vs. per-call replay). →
263
+ subprocess vs. per-call replay). A blocked call keeps a redacted excerpt of its command, so
264
+ `agent-eval {claude,opencode} violations` / `blocked-detail <task_id>` (and the `show_violation` MCP
265
+ tool) surface *what* was blocked in a later session. →
264
266
  [`Docs/AOO_STACK.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/AOO_STACK.md) ·
265
267
  [`Docs/CLAUDE_CODE_HOOKS.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/CLAUDE_CODE_HOOKS.md) ·
266
268
  [`Docs/OPENCODE_VS_CLAUDE_CODE.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/OPENCODE_VS_CLAUDE_CODE.md)
@@ -278,7 +280,7 @@ to do. Every category is additive and independent; combine as needed.
278
280
  |---|----------|---------|---------------|
279
281
  | **1** | **Base measurement + diagnosis** | `pip install agent-evaluator` | 25 trackers · 33 Harness Config · 7 Gates · LLMJudge · **RCA diagnosis engine** (`agent_evaluator.rca`/`ontology`, no extra deps needed) · full CLI (`gate`/`diagnose`/`abtest`/`trend`/`dataset`/`experiment`/`target`/`benchmark`/`improve`/`claims`) |
280
282
  | **2** | **SDK — dashboard + monitoring** | `pip install "agent-evaluator[sdk]"` | FastAPI dashboard (`serve`), Phoenix/OTEL (`otel`), Korean RAG PDF processing (`pdf`+`korean`) — recommended for most users |
281
- | **3** | **Real-time guardrail — OpenCode/Claude Code + MCP** | `pip install "agent-evaluator[mcp]"` | `search_violations`, `recommend_fix`, and `ask_insights` stdio MCP servers so OpenCode, Claude Code (or another MCP client) can call them as tools during a live session — the underlying functions already work without this (`recommend_fix`'s knowledge is used directly by `agent-eval diagnose`); this only wires up the MCP protocol layer |
283
+ | **3** | **Real-time guardrail — OpenCode/Claude Code + MCP** | `pip install "agent-evaluator[mcp]"` | `search_violations` + `show_violation`, `recommend_fix`, and `ask_insights` stdio MCP servers so OpenCode, Claude Code (or another MCP client) can call them as tools during a live session — the underlying functions already work without this (`recommend_fix`'s knowledge is used directly by `agent-eval diagnose`); this only wires up the MCP protocol layer |
282
284
  | **4** | **Your agent's framework** | `pip install "agent-evaluator[langchain]"` (or `[crewai]`/`[autogen]`/`[dspy]`/`[pydanticai]`/`[eval]`) | Packages your *agent code* imports directly — agent-evaluator itself works without them via duck typing; install only what you actually use |
283
285
  | **5** | **Examples / full / dev** | `pip install "agent-evaluator[examples]"` | Everything needed to run `Evaluator_Examples/` with real (non-mock) DeepEval/Ragas/dashboard/Phoenix output. `[full]` = category 4's frameworks all at once (⚠️ 10+ min install); `[dev]` = contributor tooling |
284
286
 
@@ -303,7 +305,8 @@ Single-feature extras that don't fit the 5 categories above: `[export]` (dashboa
303
305
  | `agent-eval experiment register\|list\|score` | Register a Gate/field hypothesis, score predicted vs actual |
304
306
  | `agent-eval improve plan\|start\|verify\|patch` | Closed loop: proposal → experiment → re-verify → outcome log |
305
307
  | `agent-eval monitor` | Arize Phoenix + OTEL real-time monitoring |
306
- | `agent-eval opencode install` / `claude install` | Install the LiveGuardrail OpenCode plugin / Claude Code CLI hooks |
308
+ | `agent-eval opencode` / `claude` `install\|upgrade\|doctor\|uninstall` | Install & manage the LiveGuardrail OpenCode plugin / Claude Code CLI hooks |
309
+ | `agent-eval opencode` / `claude` `violations\|blocked-detail` | Search past Gate B/E blocks; show the exact blocked command for a session |
307
310
  | `agent-eval claims add\|list\|release\|audit` | Team scope-claim management (`.aoo/claims.jsonl`) |
308
311
 
309
312
  ---
@@ -336,18 +339,18 @@ agent_evaluator/
336
339
  # experiment, target, benchmark, improve, claims, monitor, opencode, claude)
337
340
 
338
341
  Evaluator_Examples/ # 32 example files (ch01–ch32)
339
- tests/ # 4,800+ test functions
342
+ tests/ # 4,850+ test functions
340
343
  ```
341
344
 
342
345
  ---
343
346
 
344
347
  ## Changelog
345
348
 
346
- **v1.0.2** (2026-09-04) — Phoenix / OTEL integration: `arize-phoenix` pin is now Python-version-scoped (v20 on 3.12+, `<19.0.0` on 3.10/3.11, dropped on 3.8/3.9); Phoenix annotations now delivered at span + trace + session tiers with a `?sync=true` + backoff POST and a non-Phoenix-endpoint probe; `agent-eval monitor` console output is ASCII-only (no more mojibake on non-UTF-8 consoles); new [`Docs/10_OTEL_DATA_REFERENCE.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/10_OTEL_DATA_REFERENCE.md) and a local-Ollama end-to-end example (`ch32_ollama_realtime.py`). No public SDK API, Config, or schema changes.
347
-
348
- **v1.0.1** (2026-09-03) — Patch: report-generation hardening (malformed / partial / externally-produced result JSON no longer crashes the static report, `agent-eval gate`, or the dashboard results list; `NaN`/`Infinity` scrubbed on read and write), dashboard ↔ static-report value parity (hallucination rate, task count, per-task fallbacks, all 7 Gate detail tables, score-breakdown reconciliation), and completion of the English-only runtime-output pass. No API, Config, or schema changes.
349
-
350
- **v1.0.0** (2026-08-31) — General Availability: completes SPEC-041's machine-readable insight layer (`extra_metrics.insights`, ~62 schema-validated keys) plus the `target` / `benchmark` / `experiment` / `improve` CLI loop; public SDK API unchanged from `1.0.0-rc*`.
349
+ - **v1.0.4** (2026-09-08) — Blocked-attempt command detail: a fully-blocked tool call keeps a redacted command excerpt, so `search_violations "rm -rf"` now matches the command itself; new `show_violation` MCP tool + `agent-eval {claude,opencode} violations` / `blocked-detail <task_id>` CLI; `doctor` live-checks it. Symmetric across Claude Code and OpenCode. No API/Config/schema changes.
350
+ - **v1.0.3** (2026-09-08) — `agent-eval claude install --with-violation-search` now points the `search_violations` MCP server at the Claude Code batch-report DB (it opened the OpenCode default before); `search_violations` degrades to a readable sentence when the DB is missing. OpenCode unaffected.
351
+ - **v1.0.2** (2026-09-04) — Phoenix / OTEL: Python-version-scoped `arize-phoenix` pin; span + trace + session annotation tiers; ASCII-only `agent-eval monitor` console; new [`Docs/10_OTEL_DATA_REFERENCE.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/10_OTEL_DATA_REFERENCE.md) + local-Ollama example.
352
+ - **v1.0.1** (2026-09-03) — Report-generation hardening (malformed / partial result JSON no longer crashes the report, `gate`, or the dashboard) + dashboard ↔ static-report value parity + English-only runtime output.
353
+ - **v1.0.0** (2026-08-31) — General Availability: completes the machine-readable insight layer (`extra_metrics.insights`, ~62 schema-validated keys) + the `target` / `benchmark` / `experiment` / `improve` CLI loop.
351
354
 
352
355
  Full history (incl. the `1.0.0-rc.1`–`rc4` series): [`CHANGELOG.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/CHANGELOG.md).
353
356
 
@@ -3,7 +3,7 @@
3
3
  [![PyPI version](https://img.shields.io/pypi/v/agent-evaluator.svg)](https://pypi.org/project/agent-evaluator/)
4
4
  [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/downloads/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![Version](https://img.shields.io/badge/version-1.0.2-brightgreen.svg)](https://github.com/bullpeng72/Agent-Evaluator)
6
+ [![Version](https://img.shields.io/badge/version-1.0.4-brightgreen.svg)](https://github.com/bullpeng72/Agent-Evaluator)
7
7
 
8
8
  **Harness Engineering evaluation SDK that judges AI agent deployment readiness through 7 Gates.**
9
9
 
@@ -104,7 +104,9 @@ Full Gate reference: [`Docs/05_QUALITY_GATE.md`](https://github.com/bullpeng72/A
104
104
  [OpenCode](https://opencode.ai) — fully local, no cloud model) via `agent-eval opencode install`, or
105
105
  **AC** (Agent-Evaluator + [Claude Code](https://claude.com/claude-code) — native CLI hooks) via
106
106
  `agent-eval claude install`. Identical verdict logic; the difference is the process model (a resident
107
- subprocess vs. per-call replay). →
107
+ subprocess vs. per-call replay). A blocked call keeps a redacted excerpt of its command, so
108
+ `agent-eval {claude,opencode} violations` / `blocked-detail <task_id>` (and the `show_violation` MCP
109
+ tool) surface *what* was blocked in a later session. →
108
110
  [`Docs/AOO_STACK.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/AOO_STACK.md) ·
109
111
  [`Docs/CLAUDE_CODE_HOOKS.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/CLAUDE_CODE_HOOKS.md) ·
110
112
  [`Docs/OPENCODE_VS_CLAUDE_CODE.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/OPENCODE_VS_CLAUDE_CODE.md)
@@ -122,7 +124,7 @@ to do. Every category is additive and independent; combine as needed.
122
124
  |---|----------|---------|---------------|
123
125
  | **1** | **Base measurement + diagnosis** | `pip install agent-evaluator` | 25 trackers · 33 Harness Config · 7 Gates · LLMJudge · **RCA diagnosis engine** (`agent_evaluator.rca`/`ontology`, no extra deps needed) · full CLI (`gate`/`diagnose`/`abtest`/`trend`/`dataset`/`experiment`/`target`/`benchmark`/`improve`/`claims`) |
124
126
  | **2** | **SDK — dashboard + monitoring** | `pip install "agent-evaluator[sdk]"` | FastAPI dashboard (`serve`), Phoenix/OTEL (`otel`), Korean RAG PDF processing (`pdf`+`korean`) — recommended for most users |
125
- | **3** | **Real-time guardrail — OpenCode/Claude Code + MCP** | `pip install "agent-evaluator[mcp]"` | `search_violations`, `recommend_fix`, and `ask_insights` stdio MCP servers so OpenCode, Claude Code (or another MCP client) can call them as tools during a live session — the underlying functions already work without this (`recommend_fix`'s knowledge is used directly by `agent-eval diagnose`); this only wires up the MCP protocol layer |
127
+ | **3** | **Real-time guardrail — OpenCode/Claude Code + MCP** | `pip install "agent-evaluator[mcp]"` | `search_violations` + `show_violation`, `recommend_fix`, and `ask_insights` stdio MCP servers so OpenCode, Claude Code (or another MCP client) can call them as tools during a live session — the underlying functions already work without this (`recommend_fix`'s knowledge is used directly by `agent-eval diagnose`); this only wires up the MCP protocol layer |
126
128
  | **4** | **Your agent's framework** | `pip install "agent-evaluator[langchain]"` (or `[crewai]`/`[autogen]`/`[dspy]`/`[pydanticai]`/`[eval]`) | Packages your *agent code* imports directly — agent-evaluator itself works without them via duck typing; install only what you actually use |
127
129
  | **5** | **Examples / full / dev** | `pip install "agent-evaluator[examples]"` | Everything needed to run `Evaluator_Examples/` with real (non-mock) DeepEval/Ragas/dashboard/Phoenix output. `[full]` = category 4's frameworks all at once (⚠️ 10+ min install); `[dev]` = contributor tooling |
128
130
 
@@ -147,7 +149,8 @@ Single-feature extras that don't fit the 5 categories above: `[export]` (dashboa
147
149
  | `agent-eval experiment register\|list\|score` | Register a Gate/field hypothesis, score predicted vs actual |
148
150
  | `agent-eval improve plan\|start\|verify\|patch` | Closed loop: proposal → experiment → re-verify → outcome log |
149
151
  | `agent-eval monitor` | Arize Phoenix + OTEL real-time monitoring |
150
- | `agent-eval opencode install` / `claude install` | Install the LiveGuardrail OpenCode plugin / Claude Code CLI hooks |
152
+ | `agent-eval opencode` / `claude` `install\|upgrade\|doctor\|uninstall` | Install & manage the LiveGuardrail OpenCode plugin / Claude Code CLI hooks |
153
+ | `agent-eval opencode` / `claude` `violations\|blocked-detail` | Search past Gate B/E blocks; show the exact blocked command for a session |
151
154
  | `agent-eval claims add\|list\|release\|audit` | Team scope-claim management (`.aoo/claims.jsonl`) |
152
155
 
153
156
  ---
@@ -180,18 +183,18 @@ agent_evaluator/
180
183
  # experiment, target, benchmark, improve, claims, monitor, opencode, claude)
181
184
 
182
185
  Evaluator_Examples/ # 32 example files (ch01–ch32)
183
- tests/ # 4,800+ test functions
186
+ tests/ # 4,850+ test functions
184
187
  ```
185
188
 
186
189
  ---
187
190
 
188
191
  ## Changelog
189
192
 
190
- **v1.0.2** (2026-09-04) — Phoenix / OTEL integration: `arize-phoenix` pin is now Python-version-scoped (v20 on 3.12+, `<19.0.0` on 3.10/3.11, dropped on 3.8/3.9); Phoenix annotations now delivered at span + trace + session tiers with a `?sync=true` + backoff POST and a non-Phoenix-endpoint probe; `agent-eval monitor` console output is ASCII-only (no more mojibake on non-UTF-8 consoles); new [`Docs/10_OTEL_DATA_REFERENCE.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/10_OTEL_DATA_REFERENCE.md) and a local-Ollama end-to-end example (`ch32_ollama_realtime.py`). No public SDK API, Config, or schema changes.
191
-
192
- **v1.0.1** (2026-09-03) — Patch: report-generation hardening (malformed / partial / externally-produced result JSON no longer crashes the static report, `agent-eval gate`, or the dashboard results list; `NaN`/`Infinity` scrubbed on read and write), dashboard ↔ static-report value parity (hallucination rate, task count, per-task fallbacks, all 7 Gate detail tables, score-breakdown reconciliation), and completion of the English-only runtime-output pass. No API, Config, or schema changes.
193
-
194
- **v1.0.0** (2026-08-31) — General Availability: completes SPEC-041's machine-readable insight layer (`extra_metrics.insights`, ~62 schema-validated keys) plus the `target` / `benchmark` / `experiment` / `improve` CLI loop; public SDK API unchanged from `1.0.0-rc*`.
193
+ - **v1.0.4** (2026-09-08) — Blocked-attempt command detail: a fully-blocked tool call keeps a redacted command excerpt, so `search_violations "rm -rf"` now matches the command itself; new `show_violation` MCP tool + `agent-eval {claude,opencode} violations` / `blocked-detail <task_id>` CLI; `doctor` live-checks it. Symmetric across Claude Code and OpenCode. No API/Config/schema changes.
194
+ - **v1.0.3** (2026-09-08) — `agent-eval claude install --with-violation-search` now points the `search_violations` MCP server at the Claude Code batch-report DB (it opened the OpenCode default before); `search_violations` degrades to a readable sentence when the DB is missing. OpenCode unaffected.
195
+ - **v1.0.2** (2026-09-04) — Phoenix / OTEL: Python-version-scoped `arize-phoenix` pin; span + trace + session annotation tiers; ASCII-only `agent-eval monitor` console; new [`Docs/10_OTEL_DATA_REFERENCE.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/Docs/10_OTEL_DATA_REFERENCE.md) + local-Ollama example.
196
+ - **v1.0.1** (2026-09-03) — Report-generation hardening (malformed / partial result JSON no longer crashes the report, `gate`, or the dashboard) + dashboard ↔ static-report value parity + English-only runtime output.
197
+ - **v1.0.0** (2026-08-31) — General Availability: completes the machine-readable insight layer (`extra_metrics.insights`, ~62 schema-validated keys) + the `target` / `benchmark` / `experiment` / `improve` CLI loop.
195
198
 
196
199
  Full history (incl. the `1.0.0-rc.1`–`rc4` series): [`CHANGELOG.md`](https://github.com/bullpeng72/Agent-Evaluator/blob/HEAD/CHANGELOG.md).
197
200
 
@@ -41,7 +41,7 @@ from __future__ import annotations
41
41
 
42
42
  from typing import TYPE_CHECKING
43
43
 
44
- __version__ = "1.0.2"
44
+ __version__ = "1.0.4"
45
45
  __author__ = "Sungwoo Kim"
46
46
 
47
47
  # Exception hierarchy (경량 — 외부 의존성 없음)
@@ -306,3 +306,41 @@ def validate_guardrail_config(config: dict) -> tuple[bool, list[str]]:
306
306
  if "SKIPPED" in ln or "invalid" in ln
307
307
  ]
308
308
  return True, warnings
309
+
310
+
311
+ # ---------------------------------------------------------------------------
312
+ # SPEC-041: blocked-attempt capture live round-trip (claude + opencode doctor)
313
+ # ---------------------------------------------------------------------------
314
+ def probe_blocked_capture(config: dict) -> tuple[str, str]:
315
+ """실제 차단 1건을 흘려 ``arg_excerpt``(PII 마스킹된 명령 발췌)가 잡히는지 본다.
316
+
317
+ ``blocked_attempt_capture``가 명시적으로 꺼져 있으면 ``"info"``(정상적인 선택),
318
+ 켜져 있는데 발췌가 안 나오거나 마스킹이 안 되면 ``"warn"``.
319
+
320
+ Returns:
321
+ ``(status, detail)`` — status는 ``"ok" | "warn" | "info"``.
322
+ """
323
+ from agent_evaluator.gates.live_guardrail import LiveVerdict
324
+ from agent_evaluator.integrations.live_guardrail_stdio import build_guardrail
325
+
326
+ cfg = dict(config)
327
+ for bridge_only in ("output_dir", "circuit_breaker_after"):
328
+ cfg.pop(bridge_only, None)
329
+ cap = cfg.get("blocked_attempt_capture")
330
+ if isinstance(cap, dict) and not cap.get("enabled", True):
331
+ return "info", "blocked_attempt_capture disabled — blocked-detail falls back to transcripts"
332
+ try:
333
+ guardrail = build_guardrail(cfg)
334
+ entry = guardrail.record_blocked_attempt(
335
+ "doctor-probe", "Bash",
336
+ LiveVerdict(block=True, gate="B", reason="dangerous tool parameters"),
337
+ tool_input={"command": "rm -rf /tmp/x # reach doctor@example.com"},
338
+ )
339
+ except Exception as exc: # noqa: BLE001 — doctor absorbs every failure into the report
340
+ return "warn", f"record_blocked_attempt round-trip failed: {exc}"
341
+ excerpt = entry.get("arg_excerpt")
342
+ if not excerpt:
343
+ return "warn", "no arg_excerpt produced (blocked-detail will need host transcripts)"
344
+ if "doctor@example.com" in excerpt:
345
+ return "warn", "arg_excerpt is not PII-redacted"
346
+ return "ok", f"captures a redacted command excerpt ({len(excerpt)} chars)"
@@ -0,0 +1,167 @@
1
+ """
2
+ agent_evaluator.cli._violations_detail
3
+ ========================================
4
+ SPEC-041: shared implementation of the ``violations`` / ``blocked-detail``
5
+ subcommands, mounted symmetrically under both ``agent-eval claude`` and
6
+ ``agent-eval opencode`` so the two hosts give the same experience.
7
+
8
+ * ``agent-eval <host> violations "<query>" [--detail]`` — wraps
9
+ :func:`agent_evaluator.storage.sqlite_backend.search_violations`.
10
+ * ``agent-eval <host> blocked-detail <task_id>`` — wraps
11
+ :func:`agent_evaluator.storage.sqlite_backend.show_violation` + host-transcript
12
+ fallback (:mod:`agent_evaluator.integrations._blocked_detail`).
13
+
14
+ The only per-host difference is the default batch-report DB path.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import json
20
+ import os
21
+ from pathlib import Path
22
+
23
+ _G = "\033[32m"
24
+ _R = "\033[0m"
25
+ _D = "\033[2m"
26
+ _RD = "\033[31m"
27
+
28
+ _PROJECT_ROOT_MARKERS = (".git", "pyproject.toml", "setup.py", "setup.cfg")
29
+
30
+ _HOST_DEFAULTS = {
31
+ "claude": ("results/claude_code_live_guardrail", "claude_code_sessions.db"),
32
+ "opencode": ("results/opencode_live_guardrail", "opencode_sessions.db"),
33
+ }
34
+
35
+
36
+ def _project_root(start: Path | None = None) -> Path:
37
+ try:
38
+ cur = (start or Path.cwd()).resolve()
39
+ except (OSError, RuntimeError):
40
+ return Path(".").resolve()
41
+ for cand in (cur, *cur.parents):
42
+ if any((cand / m).exists() for m in _PROJECT_ROOT_MARKERS):
43
+ return cand
44
+ return cur
45
+
46
+
47
+ def resolve_db_path(host: str, explicit: str | None = None) -> str:
48
+ """Return the batch-report SQLite path for *host* (``"claude"`` / ``"opencode"``).
49
+
50
+ Precedence: ``explicit`` (``--db``) → ``$AGENT_EVALUATOR_OUTPUT_DIR`` → the host
51
+ default dir, all anchored at the project root when relative.
52
+ """
53
+ if explicit:
54
+ return explicit
55
+ default_dir, filename = _HOST_DEFAULTS.get(host, _HOST_DEFAULTS["claude"])
56
+ output_dir = os.environ.get("AGENT_EVALUATOR_OUTPUT_DIR", default_dir)
57
+ rel = Path(output_dir) / filename
58
+ return str(rel if rel.is_absolute() else _project_root() / rel)
59
+
60
+
61
+ def _no_db_msg(db_path: str, host: str) -> str:
62
+ return (
63
+ f"{_RD}No batch-report database at {db_path}{_R}\n"
64
+ f"{_D}It is created when the first LiveGuardrail-monitored {host} session ends. "
65
+ f"Pass --db <path> if it lives elsewhere.{_R}"
66
+ )
67
+
68
+
69
+ def run_violations(
70
+ host: str, query: str, *, detail: bool = False, db: str | None = None, limit: int = 10
71
+ ) -> int:
72
+ from agent_evaluator.integrations.violation_search_mcp import format_results
73
+ from agent_evaluator.storage.sqlite_backend import search_violations
74
+
75
+ db_path = resolve_db_path(host, db)
76
+ if not os.path.exists(db_path):
77
+ print(_no_db_msg(db_path, host))
78
+ return 1
79
+ try:
80
+ results = search_violations(
81
+ db_path, query, limit=limit, include_blocked=True, detail=detail
82
+ )
83
+ except Exception as exc: # noqa: BLE001 - surface any read failure verbatim
84
+ print(f"{_RD}Could not read {db_path}: {exc}{_R}")
85
+ return 1
86
+ print(format_results(results))
87
+ return 0
88
+
89
+
90
+ def run_blocked_detail(
91
+ host: str, task_id: str, *, db: str | None = None, as_json: bool = False
92
+ ) -> int:
93
+ from agent_evaluator.integrations._blocked_detail import (
94
+ format_blocked_detail,
95
+ recover_blocked_commands,
96
+ )
97
+ from agent_evaluator.storage.sqlite_backend import show_violation
98
+
99
+ db_path = resolve_db_path(host, db)
100
+ sv: dict = {"task_id": task_id, "found": False, "blocked": []}
101
+ if os.path.exists(db_path):
102
+ try:
103
+ sv = show_violation(db_path, task_id)
104
+ except Exception as exc: # noqa: BLE001
105
+ print(f"{_RD}Could not read {db_path}: {exc}{_R}")
106
+ return 1
107
+
108
+ if as_json:
109
+ recovered = None
110
+ need = any(not (b.get("arg_excerpt") or "").strip() for b in sv.get("blocked") or [])
111
+ if need or not sv.get("found"):
112
+ recovered = recover_blocked_commands(task_id, host=host)
113
+ print(json.dumps({"db_path": db_path, "detail": sv, "recovered": recovered}, indent=2))
114
+ return 0 if (sv.get("found") or (recovered and recovered.get("items"))) else 1
115
+
116
+ print(format_blocked_detail(sv, host=host))
117
+ if not sv.get("found"):
118
+ _rec = recover_blocked_commands(task_id, host=host)
119
+ return 0 if _rec.get("items") else 1
120
+ return 0
121
+
122
+
123
+ def add_violation_detail_subcommands(host_sub, host: str) -> None:
124
+ """Register ``violations`` + ``blocked-detail`` on a host's subparser action.
125
+
126
+ ``host_sub`` is the ``add_subparsers()`` result for ``agent-eval <host>``;
127
+ ``host`` is ``"claude"`` or ``"opencode"``.
128
+ """
129
+ v = host_sub.add_parser(
130
+ "violations",
131
+ help="Search past blocked/observed Gate B/E violations (like the search_violations MCP)",
132
+ description=(
133
+ "Full-text search the LiveGuardrail batch-report DB for past Gate B/E "
134
+ "violations. --detail also prints the captured command excerpt for blocked rows."
135
+ ),
136
+ epilog=(
137
+ f'{_G}agent-eval {host} violations "rm -rf"{_R}\n'
138
+ f'{_G}agent-eval {host} violations "dangerous tool parameters" --detail{_R}\n'
139
+ ),
140
+ )
141
+ v.add_argument("query", help="free-text query (keywords; command text also matches now)")
142
+ v.add_argument("--detail", action="store_true", help="show the captured command excerpt")
143
+ v.add_argument("--db", default=None, help="override the batch-report DB path")
144
+ v.add_argument("--limit", type=int, default=10, help="max rows per sub-query (default 10)")
145
+
146
+ b = host_sub.add_parser(
147
+ "blocked-detail",
148
+ help="Show the exact blocked command(s) for one session (task_id)",
149
+ description=(
150
+ "Given a task_id (== the session id, e.g. from `violations` output), print "
151
+ "every blocked tool call with its captured argument excerpt. Falls back to the "
152
+ "host session transcript when the excerpt was not captured."
153
+ ),
154
+ epilog=f"{_G}agent-eval {host} blocked-detail 16325c72-3030-4cee-a8c6-7b66f048bb81{_R}\n",
155
+ )
156
+ b.add_argument("task_id", help="session / task id from a `violations` result")
157
+ b.add_argument("--json", dest="as_json", action="store_true", help="machine-readable output")
158
+ b.add_argument("--db", default=None, help="override the batch-report DB path")
159
+
160
+
161
+ def dispatch(host: str, cmd: str | None, args) -> int | None:
162
+ """Return an exit code if *cmd* is one of ours, else ``None`` (not handled)."""
163
+ if cmd == "violations":
164
+ return run_violations(host, args.query, detail=args.detail, db=args.db, limit=args.limit)
165
+ if cmd == "blocked-detail":
166
+ return run_blocked_detail(host, args.task_id, db=args.db, as_json=args.as_json)
167
+ return None
@@ -86,6 +86,60 @@ _VIOLATION_SEARCH_MCP_NAME = "agent-evaluator-violations"
86
86
  _RECOMMEND_FIX_MCP_NAME = "agent-evaluator-recommend-fix"
87
87
  _ASK_INSIGHTS_MCP_NAME = "agent-evaluator-ask-insights"
88
88
 
89
+ # SPEC-041: the violations MCP server (violation_search_mcp) defaults its DB path to the
90
+ # *OpenCode* batch-report DB (results/opencode_live_guardrail/opencode_sessions.db). A Claude
91
+ # Code install writes its SessionEnd batch report somewhere else, so without an explicit path
92
+ # argument `search_violations` fails with "unable to open database file". These mirror
93
+ # claude_code_hook's SessionEnd report location (output_dir + save_filename="claude_code_sessions").
94
+ _REPORT_DB_DEFAULT_DIR = "results/claude_code_live_guardrail"
95
+ _REPORT_DB_FILENAME = "claude_code_sessions.db"
96
+ _PROJECT_ROOT_MARKERS = (".git", "pyproject.toml", "setup.py", "setup.cfg")
97
+
98
+
99
+ def _project_root(start: Path | None = None) -> Path:
100
+ """Walk up from *start* (cwd by default) to the nearest project-root marker.
101
+
102
+ Mirrors ``claude_code_hook._project_root_for`` so the report-DB path we hand the
103
+ violations MCP server matches where the SessionEnd batch report actually lands.
104
+ Falls back to *start* (resolved) when no marker is found.
105
+ """
106
+ try:
107
+ cur = (start or Path.cwd()).resolve()
108
+ except (OSError, RuntimeError):
109
+ return Path(".").resolve()
110
+ for cand in (cur, *cur.parents):
111
+ if any((cand / m).exists() for m in _PROJECT_ROOT_MARKERS):
112
+ return cand
113
+ return cur
114
+
115
+
116
+ def _resolve_report_db_arg(config_path: Path, is_global: bool) -> str:
117
+ """Return the LiveGuardrail batch-report SQLite path to pass the violations MCP server.
118
+
119
+ - honours a custom ``"output_dir"`` in an existing ``guardrail_config.json``;
120
+ - local install → an absolute path anchored to the project root (where the SessionEnd
121
+ hook writes the report), so it resolves regardless of the MCP server's own cwd;
122
+ - ``--global`` install → a *relative* path: a global install writes one report DB per
123
+ project (``claude_code_hook`` anchors ``output_dir`` per session), so there is no single
124
+ absolute path to pin — relative still points at the Claude Code sub-dir rather than the
125
+ wrong OpenCode default.
126
+ """
127
+ output_dir = _REPORT_DB_DEFAULT_DIR
128
+ try:
129
+ if config_path.exists():
130
+ cfg = json.loads(config_path.read_text(encoding="utf-8"))
131
+ if isinstance(cfg, dict):
132
+ _od = cfg.get("output_dir")
133
+ if isinstance(_od, str) and _od.strip():
134
+ output_dir = _od.strip()
135
+ except (json.JSONDecodeError, OSError):
136
+ pass
137
+
138
+ rel = Path(output_dir) / _REPORT_DB_FILENAME
139
+ if rel.is_absolute() or is_global:
140
+ return str(rel)
141
+ return str(_project_root() / rel)
142
+
89
143
 
90
144
  def cmd_claude(args: argparse.Namespace) -> int:
91
145
  """claude 서브커맨드 진입점."""
@@ -98,14 +152,22 @@ def cmd_claude(args: argparse.Namespace) -> int:
98
152
  return _cmd_uninstall(args)
99
153
  if cmd == "doctor":
100
154
  return _cmd_doctor(args)
155
+ from agent_evaluator.cli._violations_detail import dispatch as _vd_dispatch
156
+
157
+ _rc = _vd_dispatch("claude", cmd, args)
158
+ if _rc is not None:
159
+ return _rc
101
160
  print(
102
161
  f"{_B}agent-eval claude{_R} — LiveGuardrail Claude Code CLI hooks\n\n"
103
- f" {_Y}install{_R} Register PreToolUse/PostToolUse/SessionEnd hooks in "
162
+ f" {_Y}install{_R} Register PreToolUse/PostToolUse/SessionEnd hooks in "
104
163
  f".claude/settings.json\n"
105
- f" {_Y}upgrade{_R} Refresh hooks/config after a package update "
164
+ f" {_Y}upgrade{_R} Refresh hooks/config after a package update "
106
165
  f"(keeps your guardrail_config.json edits)\n"
107
- f" {_Y}doctor{_R} Verify the install actually works (static + live round-trip)\n"
108
- f" {_Y}uninstall{_R} Remove the hooks/MCP servers (run before 'pip uninstall')\n\n"
166
+ f" {_Y}doctor{_R} Verify the install actually works (static + live round-trip)\n"
167
+ f" {_Y}uninstall{_R} Remove the hooks/MCP servers (run before 'pip uninstall')\n"
168
+ f" {_Y}violations{_R} Search past Gate B/E blocks in the batch-report DB "
169
+ f"(--detail shows the command)\n"
170
+ f" {_Y}blocked-detail{_R} Show the exact blocked command(s) for one session (task_id)\n\n"
109
171
  f"Usage: agent-eval claude <command> --help",
110
172
  file=sys.stderr,
111
173
  )
@@ -198,18 +260,27 @@ def _merge_settings(existing: dict, python_bin: str) -> tuple[dict, list[str], l
198
260
  return merged, added, updated
199
261
 
200
262
 
201
- def _register_mcp_server(name: str, module: str, flag: str, scope: str) -> None:
263
+ def _register_mcp_server(
264
+ name: str, module: str, flag: str, scope: str,
265
+ extra_args: list[str] | None = None,
266
+ ) -> None:
202
267
  """``claude mcp add``로 ``module``의 stdio MCP 서버를 등록한다.
203
268
 
204
269
  ``opencode.py``의 ``_register_mcp_server()``와 동일한 원칙 — 실패해도(``claude`` CLI
205
270
  미설치, ``mcp`` extra 미설치 등) 경고만 출력하고 예외를 올리지 않는다. 설치 자체(``install``의
206
271
  본래 목적)는 이 등록 성공 여부와 무관하게 이미 끝난 뒤이므로, 이 단계의 실패로 전체 install
207
272
  명령을 실패 처리할 이유가 없다.
273
+
274
+ ``extra_args``는 ``python -m <module>`` 뒤에 그대로 붙는 위치 인자다(violation_search_mcp에
275
+ 넘기는 DB 경로 등).
208
276
  """
209
- _manual = f"claude mcp add {name} --scope {scope} -- {sys.executable} -m {module}"
277
+ extra_args = list(extra_args or [])
278
+ _tail = " ".join(["-m", module, *extra_args])
279
+ _manual = f"claude mcp add {name} --scope {scope} -- {sys.executable} {_tail}"
210
280
  try:
211
281
  result = subprocess.run(
212
- ["claude", "mcp", "add", name, "--scope", scope, "--", sys.executable, "-m", module],
282
+ ["claude", "mcp", "add", name, "--scope", scope, "--",
283
+ sys.executable, "-m", module, *extra_args],
213
284
  capture_output=True, text=True, timeout=30,
214
285
  )
215
286
  except FileNotFoundError:
@@ -228,10 +299,17 @@ def _register_mcp_server(name: str, module: str, flag: str, scope: str) -> None:
228
299
 
229
300
  if result.returncode == 0:
230
301
  print(f"{_G}✅ MCP server registered: {name}{_R}")
302
+ if extra_args:
303
+ print(f"{_D} args: {' '.join(extra_args)}{_R}")
231
304
  elif "already exists" in (result.stderr or "").lower():
232
305
  # 재설치/업그레이드 시 정상 상태 — 실패가 아니다. 과거엔 이걸 ⚠️ + 수동
233
306
  # 명령으로 출력해 업그레이드가 깨진 것처럼 보였다.
234
307
  print(f"{_D} MCP server already registered: {name} — nothing to change{_R}")
308
+ if extra_args:
309
+ print(
310
+ f"{_D} (run `agent-eval claude upgrade --with-violation-search` to "
311
+ f"refresh its args to: {' '.join(extra_args)}){_R}"
312
+ )
235
313
  else:
236
314
  print(
237
315
  f"{_Y}⚠️ {flag}: 'claude mcp add' failed (exit {result.returncode}) — "
@@ -282,10 +360,13 @@ def _deregister_mcp_server(name: str, scope: str) -> None:
282
360
  print(f"{_D} {result.stderr.strip()}{_R}", file=sys.stderr)
283
361
 
284
362
 
285
- def _register_violation_search_mcp(scope: str) -> None:
363
+ def _register_violation_search_mcp(
364
+ scope: str, config_path: Path, is_global: bool,
365
+ ) -> None:
286
366
  _register_mcp_server(
287
367
  _VIOLATION_SEARCH_MCP_NAME, "agent_evaluator.integrations.violation_search_mcp",
288
368
  "--with-violation-search", scope,
369
+ extra_args=[_resolve_report_db_arg(config_path, is_global)],
289
370
  )
290
371
 
291
372
 
@@ -343,7 +424,7 @@ def _cmd_install(args: argparse.Namespace) -> int:
343
424
 
344
425
  if getattr(args, "with_violation_search", False):
345
426
  print()
346
- _register_violation_search_mcp(scope)
427
+ _register_violation_search_mcp(scope, config_path, is_global)
347
428
 
348
429
  if getattr(args, "with_recommend_fix", False):
349
430
  print()
@@ -388,15 +469,23 @@ def _cmd_install(args: argparse.Namespace) -> int:
388
469
  # ===========================================================================
389
470
  # upgrade — 패키지 업데이트 후 훅/설정 현행화 (사용자 편집 보존)
390
471
  # ===========================================================================
391
- def _mcp_is_registered(name: str) -> bool | None:
392
- """``claude mcp get <name>``으로 등록 여부를 확인한다. CLI 미설치/오류면 ``None``."""
472
+ def _mcp_get(name: str) -> tuple[bool | None, str]:
473
+ """``claude mcp get <name>`` — returns ``(registered, stdout)``.
474
+
475
+ ``registered`` is ``None`` when the ``claude`` CLI is missing or errored.
476
+ """
393
477
  try:
394
478
  r = subprocess.run(
395
479
  ["claude", "mcp", "get", name], capture_output=True, text=True, timeout=15,
396
480
  )
397
481
  except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
398
- return None
399
- return r.returncode == 0
482
+ return None, ""
483
+ return (r.returncode == 0), (r.stdout or "")
484
+
485
+
486
+ def _mcp_is_registered(name: str) -> bool | None:
487
+ """``claude mcp get <name>``으로 등록 여부를 확인한다. CLI 미설치/오류면 ``None``."""
488
+ return _mcp_get(name)[0]
400
489
 
401
490
 
402
491
  def _cmd_upgrade(args: argparse.Namespace) -> int:
@@ -470,7 +559,7 @@ def _cmd_upgrade(args: argparse.Namespace) -> int:
470
559
  if getattr(args, "with_violation_search", False):
471
560
  print()
472
561
  _deregister_mcp_server(_VIOLATION_SEARCH_MCP_NAME, scope)
473
- _register_violation_search_mcp(scope)
562
+ _register_violation_search_mcp(scope, config_path, is_global)
474
563
  if getattr(args, "with_recommend_fix", False):
475
564
  print()
476
565
  _deregister_mcp_server(_RECOMMEND_FIX_MCP_NAME, scope)
@@ -753,6 +842,7 @@ def _cmd_doctor(args: argparse.Namespace) -> int:
753
842
  DoctorReport,
754
843
  interpreter_from_command,
755
844
  mcp_initialize_probe,
845
+ probe_blocked_capture,
756
846
  probe_import,
757
847
  validate_guardrail_config,
758
848
  )
@@ -853,6 +943,12 @@ def _cmd_doctor(args: argparse.Namespace) -> int:
853
943
  else:
854
944
  rpt.error("static", "guardrail_config builds", " | ".join(warns))
855
945
 
946
+ # SPEC-041: blocked-attempt capture → `agent-eval claude blocked-detail` usability.
947
+ _bc_status, _bc_detail = probe_blocked_capture(resolved_cfg)
948
+ {"ok": rpt.ok, "warn": rpt.warn, "info": rpt.info, "error": rpt.error}[_bc_status](
949
+ "live", "blocked-attempt capture", _bc_detail
950
+ )
951
+
856
952
  mcp_targets = (
857
953
  (_VIOLATION_SEARCH_MCP_NAME, "agent_evaluator.integrations.violation_search_mcp",
858
954
  "search_violations"),
@@ -875,6 +971,32 @@ def _cmd_doctor(args: argparse.Namespace) -> int:
875
971
  else:
876
972
  rpt.info("static", f"MCP registered: {mname}", "could not query `claude mcp get`")
877
973
 
974
+ # SPEC-041: the violations MCP server needs the Claude Code report-DB path as an
975
+ # argument, or `search_violations` opens the wrong (OpenCode) default and fails with
976
+ # "unable to open database file". Flag a stale registration made before this was wired.
977
+ if reg and mname == _VIOLATION_SEARCH_MCP_NAME:
978
+ _, reg_out = _mcp_get(mname)
979
+ want_db = _resolve_report_db_arg(config_path, is_global)
980
+ if not reg_out:
981
+ pass # cannot inspect the registered command — nothing actionable to say
982
+ elif _REPORT_DB_FILENAME not in reg_out:
983
+ rpt.warn(
984
+ "static", f"{mname}: report-DB arg",
985
+ "registered without a Claude Code DB path — `search_violations` will hit "
986
+ "the OpenCode default and fail. Run "
987
+ "`agent-eval claude upgrade --with-violation-search`"
988
+ + (" --global" if is_global else ""),
989
+ )
990
+ elif Path(want_db).is_absolute() and want_db not in reg_out:
991
+ rpt.info(
992
+ "static", f"{mname}: report-DB arg",
993
+ f"points at a different DB than this project's ({want_db}) — rerun "
994
+ "`agent-eval claude upgrade --with-violation-search` from the project root "
995
+ "if that is wrong",
996
+ )
997
+ else:
998
+ rpt.ok("static", f"{mname}: report-DB arg")
999
+
878
1000
  # ---------- Tier 2: 라이브 ----------
879
1001
  if no_live:
880
1002
  rpt.info("live", "skipped (--no-live)")
@@ -937,6 +1059,8 @@ def build_claude_subparser(sub: argparse._SubParsersAction) -> None: # type: ig
937
1059
  f" {_G}agent-eval claude install --force{_R}\n"
938
1060
  f" {_G}agent-eval claude install --with-violation-search{_R}\n"
939
1061
  f" {_G}agent-eval claude install --with-recommend-fix{_R}\n"
1062
+ f' {_G}agent-eval claude violations "rm -rf" --detail{_R}\n'
1063
+ f" {_G}agent-eval claude blocked-detail <task_id>{_R}\n"
940
1064
  ),
941
1065
  )
942
1066
  cl_sub = p.add_subparsers(dest="claude_command")
@@ -1105,3 +1229,8 @@ def build_claude_subparser(sub: argparse._SubParsersAction) -> None: # type: ig
1105
1229
  "--yes", "-y", dest="yes", action="store_true",
1106
1230
  help="Skip the confirmation prompt",
1107
1231
  )
1232
+
1233
+ # SPEC-041: violations / blocked-detail (identical under `agent-eval opencode`).
1234
+ from agent_evaluator.cli._violations_detail import add_violation_detail_subcommands
1235
+
1236
+ add_violation_detail_subcommands(cl_sub, "claude")