Physically move the pure-code subtrees out of .specify into the package, leaving compat symlinks at the old .specify/<dir> paths so every existing reference (internal CASAN_HARNESS_ROOT + external CI/docker/mjs) keeps resolving. Runtime state stays put. Moved (git mv): scripts/ tests/ security/ templates/ config/ governance/ memory/ .specify/<dir> -> packages/casan-harness/<dir> (+ .specify/<dir> symlink) Stays in .specify (state/governance/domain, handled later): logs/ agentops/ level5/ init-options.json traceability-map.json Python `.resolve()` self-location followed the compat symlink into packages and lost the app root; generate-casan-demo-context.py, generate-agentops-dashboard.py and dashboard-server.py now walk UP for the `.specify` state marker instead of a fixed parent depth (fixes "missing trace files" in run-casan4). Full gate: PASS=64 FAIL=0 SKIP=3 (CASAN_CI_STEP_TIMEOUT_SEC=1200 — track-a ~450s runs close to the 600s default and can tip over under load; this is timing variance, not a regression — it passed cleanly with headroom). Runtime log/audit artifacts kept unstaged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
915 B
Python
Executable File
30 lines
915 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Return '<total_tokens> <cost_usd>' for the provider-telemetry record that
|
|
matches the given step, or print nothing if there is no genuine match.
|
|
|
|
Never falls back to an arbitrary record — reusing one sample's cost across
|
|
every step would misrepresent an estimate as real per-step billing.
|
|
|
|
Usage: provider-cost-lookup.py <provider-usage.jsonl> <step-name>
|
|
"""
|
|
import json
|
|
import sys
|
|
|
|
if len(sys.argv) < 3:
|
|
sys.exit(0)
|
|
path, step = sys.argv[1], sys.argv[2]
|
|
match = None
|
|
try:
|
|
with open(path, encoding="utf-8") as fh:
|
|
for line in fh:
|
|
line = line.strip()
|
|
if not line:
|
|
continue
|
|
rec = json.loads(line)
|
|
if rec.get("step") == step:
|
|
match = rec # last matching record wins
|
|
except OSError:
|
|
sys.exit(0)
|
|
if match is not None:
|
|
print(f"{match.get('total_tokens', 0)} {match.get('cost_usd', 0)}")
|