from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def test_agent_orchestration_uses_compact_agent_workbench_contract(): template = (ROOT / "templates/admin/agent_orchestration.html").read_text(encoding="utf-8") assert 'data-density-guardrail="compact-agent-workbench"' in template assert 'aria-label="AI 分工狀態模式"' in template assert "AI 分工" in template assert "成本守門" in template assert "知識命中" in template def test_agent_orchestration_keeps_first_layer_metrics_without_explanatory_copy(): template = (ROOT / "templates/admin/agent_orchestration.html").read_text(encoding="utf-8") for marker in ["呼叫總量", "主力路徑占比", "付費成本", "知識命中率"]: assert marker in template assert ".agent-subtitle,.agent-signal-note,.agent-row-desc,.agent-card-desc,.agent-footer-copy{display:none}" in template assert 'class="agent-subtitle"' in template assert 'class="text-muted agent-signal-note"' in template assert 'class="d-block text-muted agent-row-desc"' in template assert 'class="d-block text-muted agent-card-desc"' in template assert 'agent-footer-copy' in template def test_agent_orchestration_preserves_workbench_tables_and_non_raw_wording(): template = (ROOT / "templates/admin/agent_orchestration.html").read_text(encoding="utf-8") for marker in ["建議路徑、工具與知識命中矩陣", "工具協作明細", "工具協作 × 使用情境"]: assert marker in template for forbidden in ["Agent 指揮矩陣", "四 Agent 矩陣", "LLM × MCP × RAG 編排矩陣", "權杖"]: assert forbidden not in template