fix(coding-agent): fixed context usage tracking to keep status and selector totals in sync

- Added context snapshot metadata to AssistantMessage for prompt and non-message token history.
- Anchored context usage calculations on assistant snapshots and computed percent numerically.
- Updated status-line, /context, selector, and interactive mode flows to share session usage totals.
- Extended status-line cache fingerprinting and invalidation for assistant usage and prompt/tool/skill changes.
This commit is contained in:
can1357
2026-06-17 12:24:20 +02:00
parent 3f32971944
commit 48decd15d7
19 changed files with 777 additions and 202 deletions
+6 -1
View File
@@ -17,7 +17,12 @@ import { formatDuration, getProjectDir } from "@oh-my-pi/pi-utils";
import chalk from "chalk";
import type { ApiKeyResolverModel } from "../config/api-key-resolver";
import { type CanonicalModelQueryOptions, ModelRegistry } from "../config/model-registry";
import { formatModelSelectorValue, formatModelString, getModelMatchPreferences, resolveCliModel } from "../config/model-resolver";
import {
formatModelSelectorValue,
formatModelString,
getModelMatchPreferences,
resolveCliModel,
} from "../config/model-resolver";
import { Settings } from "../config/settings";
import benchPrompt from "../prompts/bench.md" with { type: "text" };
import { discoverAuthStorage } from "../sdk";