Implements modular provider probing with two distinct header schemas: - Teams direct (unified schema): 5h/7d utilization floats, status, reset countdown - Shelley proxy (classic schema): token/request counts + Exedev-Gateway-Cost (USD/call) - api-ateam: reports no billing data (confirmed non-existent by recon) Key: uses claude-haiku-4-5-20251001 for minimal probe calls (1 token). Rate-limit headers present on ALL responses (200 and 429). 113/113 tests passing. Built from Face recon (trentuna/a-team#91) — live header capture confirmed unified schema with utilization floats replaces old per-count schema.
19 lines
651 B
JavaScript
19 lines
651 B
JavaScript
/**
|
|
* logger.js — persistent JSONL log to ~/.logs/token-monitor/YYYY-MM-DD.jsonl
|
|
*/
|
|
|
|
import { appendFileSync, mkdirSync } from 'fs';
|
|
import { homedir } from 'os';
|
|
import { join } from 'path';
|
|
|
|
export function logRun(data) {
|
|
const dir = join(homedir(), '.logs', 'token-monitor');
|
|
mkdirSync(dir, { recursive: true });
|
|
const file = join(dir, `${new Date().toISOString().slice(0, 10)}.jsonl`);
|
|
appendFileSync(file, JSON.stringify({ ts: new Date().toISOString(), ...data }) + '\n');
|
|
}
|
|
|
|
export function getLogPath() {
|
|
const today = new Date().toISOString().slice(0, 10);
|
|
return join(homedir(), '.logs', 'token-monitor', `${today}.jsonl`);
|
|
}
|