mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-28 12:35:13 +02:00
fix(hooks): update cost-tracker pricing table and filter harness noise from session summaries
cost-tracker.js: RATE_TABLE priced all Opus models at the legacy $15/$75 tier and routed Fable/Mythos 5 to Sonnet rates, overstating Opus 5 sessions ~3x and understating Fable ~3.3x in costs.jsonl. Adds fable ($10/$50) and current opus ($5/$25) tiers, keeps Opus 4.0/4.1/3 on the legacy tier, updates haiku to 4.5 pricing ($1/$5). session-end.js: extractSessionSummary included local-command echoes (<local-command-caveat>, <command-name>, <local-command-stdout>), system reminders, tool_result carrier turns and isMeta entries in the Tasks list, so SessionStart reloaded noise instead of user asks. Adds a noise filter. Both test suites pass (10/10 cost-tracker, 1/1 session-end). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
committed by
Alex Schmitt
co-authored by
Claude Fable 5
parent
d8409a4b08
commit
4c2659666b
@@ -43,9 +43,13 @@ function extractSessionSummary(transcriptPath) {
|
||||
if (entry.type === 'user' || entry.role === 'user' || entry.message?.role === 'user') {
|
||||
// Support both direct content and nested message.content (Claude Code JSONL format)
|
||||
const rawContent = entry.message?.content ?? entry.content;
|
||||
// Skip tool_result carrier turns — they are not user asks.
|
||||
const isToolResult = Array.isArray(rawContent) && rawContent.some(c => c && c.type === 'tool_result');
|
||||
const text = typeof rawContent === 'string' ? rawContent : Array.isArray(rawContent) ? rawContent.map(c => (c && c.text) || '').join(' ') : '';
|
||||
const cleaned = stripAnsi(text).trim();
|
||||
if (cleaned) {
|
||||
// Skip harness noise: local command echoes, caveats, system reminders.
|
||||
const isNoise = /^<(local-command-caveat|local-command-stdout|command-name|command-message|command-args|system-reminder|task-notification)/i.test(cleaned);
|
||||
if (cleaned && !isToolResult && !isNoise && !entry.isMeta) {
|
||||
userMessages.push(cleaned.slice(0, 200));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user