feat(harness): implement Plan-20 transparent agentic client bridge
Wave 0 + Wave 1 core of the transparent agentic-client integration: a
developer types prompts normally in Claude Code / Codex while every
certified turn still carries a full H1->H7 trace and an H6 record.
- agentic_bridge.py: stdlib-only lifecycle state machine (begin/pre-tool/
post-tool/telemetry/finalize/abort + report/doctor). Single-model
invariant (never calls a model), fail-closed at the side-effect point,
admission TTL + canonical-project/session binding, atomic state under
.specify/state/agentic-sessions/, secret redaction, null-not-zero H6.
- agentic-lifecycle.schema.json: client-agnostic JSON contract.
- adapters/claude-code + adapters/codex: thin hook renderers + config
templates that call the core bridge.
- phase-agentic-bridge-tests.sh: C1-C12 acceptance + threat suite (30/30).
- devkit templates/{claude,codex} + windows/install-agentic.ps1
(install/doctor/uninstall with manifest, path-safe).
- docs/casan Windows + security/bypass guides; plan status -> IMPLEMENTED.
- harden generate-agentops-dashboard.py aggregation against null H6 costs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0cc43d94d3
commit
4bb184b935
@@ -44,15 +44,25 @@ tools = read_jsonl(TOOL)
|
||||
provider_usage = read_jsonl(PROVIDER)
|
||||
project_registry = json.loads(PROJECT_REGISTRY.read_text(encoding="utf-8")) if PROJECT_REGISTRY.exists() else {"projects": []}
|
||||
|
||||
total_cost = sum(float(row.get("cost_estimate", 0)) for row in metrics)
|
||||
avg_latency = round(sum(int(row.get("latency_ms", 0)) for row in metrics) / max(len(metrics), 1), 2)
|
||||
# Plan-20 §5: agentic (H6-agentic) records deliberately store token/cost as `null`
|
||||
# when the client gave no reliable source (never coerced to 0 in the record). Sums
|
||||
# below must therefore treat a MISSING/null number as 0 for aggregation without
|
||||
# crashing — the null still surfaces as-is in the per-row table.
|
||||
def _num(v, cast):
|
||||
try:
|
||||
return cast(v)
|
||||
except (TypeError, ValueError):
|
||||
return cast(0)
|
||||
|
||||
total_cost = sum(_num(row.get("cost_estimate", 0), float) for row in metrics)
|
||||
avg_latency = round(sum(_num(row.get("latency_ms", 0), int) for row in metrics) / max(len(metrics), 1), 2)
|
||||
failures = sum(1 for row in metrics if row.get("status") == "failed")
|
||||
fallback_routes = sum(1 for row in fallback if row.get("route") == "fallback")
|
||||
tool_denies = sum(1 for row in tools if row.get("decision") == "denied")
|
||||
provider_tokens = sum(int(row.get("total_tokens", 0)) for row in provider_usage)
|
||||
provider_cost = sum(float(row.get("cost_usd", 0)) for row in provider_usage)
|
||||
provider_tokens = sum(_num(row.get("total_tokens", 0), int) for row in provider_usage)
|
||||
provider_cost = sum(_num(row.get("cost_usd", 0), float) for row in provider_usage)
|
||||
registered_projects = len(project_registry.get("projects", []))
|
||||
hallucination_signals = sum(int(row.get("hallucination_signals", 0)) for row in metrics)
|
||||
hallucination_signals = sum(_num(row.get("hallucination_signals", 0), int) for row in metrics)
|
||||
|
||||
# --- Harness maturity: rubric assessment (công tâm), khớp evidence/scoring-run-report.md ---
|
||||
ASSESS_DATE = "2026-07-05"
|
||||
|
||||
Reference in New Issue
Block a user