Added a dedicated Anthropic payload logger that writes exact request JSON (as sent) plus per‑run usage stats (input/output/cache read/write) to a standalone JSONL file, gated by an env flag. Changes - New logger: src/agents/anthropic-payload-log.ts (writes logs/anthropic-payload.jsonl under the state dir, optional override via env). - Hooked into embedded runs to wrap the stream function and record usage: src/agents/pi-embedded-runner/run/attempt.ts. How to enable - CLAWDBOT_ANTHROPIC_PAYLOAD_LOG=1 - Optional: CLAWDBOT_ANTHROPIC_PAYLOAD_LOG_FILE=/path/to/anthropic-payload.jsonl What you’ll get (JSONL) - stage: "request" with payload (exact Anthropic params) + payloadDigest - stage: "usage" with usage (input/output/cacheRead/cacheWrite/totalTokens/etc.) Notes - Usage is taken from the last assistant message in the run; if the run fails before usage is present, you’ll only see an error field. Files touched - src/agents/anthropic-payload-log.ts - src/agents/pi-embedded-runner/run/attempt.ts Tests not run. |
||
|---|---|---|
| .. | ||
| attempt.test.ts | ||
| attempt.ts | ||
| images.test.ts | ||
| images.ts | ||
| params.ts | ||
| payloads.test.ts | ||
| payloads.ts | ||
| types.ts | ||