#!/usr/bin/env node /** * Claude Code statusline executable (temporal-grounding Phase 0, config-C). * * Reads the entire statusline stdin JSON (hook_event_name:"Status") on each * ~300ms refresh and: * 1. Prints ONE concise status line to stdout (Claude Code shows the first * line only) — model + live context usage + optional session cost. * 2. Fire-and-forget POSTs the live input-token count to the server's * /api/v1/hooks/context-stats so the SessionClock can later detect * compaction (token count dropping across an epoch). * * Contract (verified against code.claude.com/docs/en/statusline, 2026-07-08): * stdin carries session_id, cwd, model.{id,display_name}, * context_window.{used_percentage, context_window_size, total_input_tokens, * total_output_tokens}, cost.*. `used_percentage` is input-tokens-only (incl. * cache) and is NULL before the first API call and immediately after /compact. * * NEVER crashes: any parse/IO error prints a minimal fallback line and exits 0. * The report is skipped silently when used_percentage is null (no live window * yet) or the API key / config is unavailable. */ interface StatusInput { session_id?: string; cwd?: string; model?: { id?: string; display_name?: string; }; context_window?: { used_percentage?: number | null; context_window_size?: number | null; total_input_tokens?: number | null; total_output_tokens?: number | null; }; cost?: { total_cost_usd?: number | null; }; } /** * Build the single status line. Pure — never throws on missing fields. */ declare function renderLine(input: StatusInput): string; export { renderLine };