feat(coding-agent): add prompt cache miss tracking (#6427)
Detect prompt cache misses per turn by comparing each assistant message's cache reads against the previous request's prompt tokens (core/cache-stats.ts). Significant misses emit a warning-colored transcript notice at the turn they occur, noting idle gaps past the cache TTL and model switches when relevant. /session gained cache statistics: a compact token/cache breakdown with hit rate, a $-prefixed cost section with per-model cost breakdown, and the cumulative cost re-billed due to cache misses.
This commit is contained in:
+4
-4
@@ -42,8 +42,8 @@ type RenderSessionContextThis = {
|
||||
getShowImages(): boolean;
|
||||
getImageWidthCells(): number;
|
||||
};
|
||||
sessionManager: { getCwd(): string };
|
||||
session: { retryAttempt: number };
|
||||
sessionManager: { getCwd(): string; getEntries(): SessionEntry[] };
|
||||
session: { retryAttempt: number; modelRegistry: { find(provider: string, modelId: string): undefined } };
|
||||
toolOutputExpanded: boolean;
|
||||
isInitialized: boolean;
|
||||
updateEditorBorderColor(): void;
|
||||
@@ -71,8 +71,8 @@ function createFakeInteractiveModeThis(): RenderSessionContextThis {
|
||||
getShowImages: () => false,
|
||||
getImageWidthCells: () => 60,
|
||||
},
|
||||
sessionManager: { getCwd: () => process.cwd() },
|
||||
session: { retryAttempt: 0 },
|
||||
sessionManager: { getCwd: () => process.cwd(), getEntries: () => [] },
|
||||
session: { retryAttempt: 0, modelRegistry: { find: () => undefined } },
|
||||
toolOutputExpanded: false,
|
||||
isInitialized: true,
|
||||
updateEditorBorderColor: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user