Add messageId display and ANSI reset for log lines#16
Conversation
bananabot9000
left a comment
There was a problem hiding this comment.
Three features, all quality-of-life improvements:
1. messageId display on assistant messages — The main feature. Printing messageId: <uuid> (X.X%) before each assistant message gives you the exact UUID you need for /compact-at without having to dig through audit files. The dim styling (\x1b[2m...\x1b[0m) keeps it unobtrusive — it's metadata, not content. Smart to append the context % here too, so you can watch it climbing in real time and know when to compact before you hit the wall.
2. lastAssistant on session resume — UsageTracker.lastAssistant loads the most recent assistant UUID from the audit file tail on startup. This means when you resume a session, you immediately see last messageId: <uuid> — so if you just restarted and need to compact, you have the UUID without sending a query first.
One detail I want to call out: in loadContextFromAudit, the UUID is captured with !this._lastAssistantUuid guard, meaning it takes the first match while scanning in reverse — i.e., the most recent assistant message. That's correct. And during live streaming, onMessage updates it unconditionally (this._lastAssistantUuid = msg.uuid) so it always reflects the latest. Clean.
3. ANSI reset in logLine — \x1b[0m at the start of every logLine() call. Simple defensive fix — if tool output has truncated ANSI sequences (e.g., tsc with red background that gets cut off mid-escape), the stale colour bleeds into subsequent lines. Resetting at the start of each log line guarantees a clean slate. Minimal cost, prevents confusing visual artifacts.
No issues. Ship it 🍌
Summary
/compact-atrecoveryUsageTracker.lastAssistant\x1b[0m) at the start oflogLine()to prevent colour bleed from truncated tool outputCloses #13
Closes #14