feat(expose): render agent previews in their real colors - #133
Conversation
Capture pane output with -e (includeEscapes) and keep SGR color/style sequences through sanitization, stripping only non-color escapes (cursor moves, OSC, stray control bytes) so a rogue pane still can't hijack the host terminal or misalign tile borders. Body lines now truncate and pad by visible width via truncateAnsi/stripAnsi. Covers both per-project and cross-project (meta dashboard) Exposé. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 18 minutes and 45 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesANSI Color Preservation in Tile Previews
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tmux/expose.ts`:
- Around line 44-53: The regex patterns in the `stripAnsi` and `truncateAnsi`
functions use `[0-9;]*` for ANSI parameter bytes, but `sanitizeLine` uses
`[0-9;:?]*` to preserve colon-separated SGR sequences like `\x1b[38:2:255:0:0m`,
causing a mismatch that leads to incorrect sequence counting during truncation
and padding. Update the regex patterns in `stripAnsi` and `truncateAnsi` to
include `:` and `?` in the parameter byte character class (changing `[0-9;]*` to
`[0-9;:?]*`) to align with the `sanitizeLine` implementation and correctly
handle all valid SGR syntax.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
- Keep only pure SGR (\x1b[…m with [0-9;:] params); previously any kept sequence ending in m (incl. ?-param private-mode forms) survived. - Strip a trailing incomplete CSI left by a capture-boundary cut. - stripAnsi/truncateAnsi now accept colon-separated SGR (\x1b[38:2:r:g:bm) so visible-width truncation/padding stays correct and borders align. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Sub-agent review — additional findings (handled in c129a86) Two issues beyond the CodeRabbit thread, both fixed:
|
Summary
Exposé tiles previously rendered all captured agent output in a uniform dim grey because the capture stripped every escape sequence. This makes the previews show the agents' real colors.
Changes (
src/tmux/expose.ts)includeEscapes: truetocaptureTargetso tmux emits SGR via-e.sanitizeLinenow keeps SGR sequences (\x1b[…m) and strips everything else dangerous (non-SGR CSI/cursor moves, OSC, stray escapes, control bytes). Security posture is unchanged: a rogue pane still can't inject cursor moves or break tile borders.truncateAnsiand pad by visible width viastripAnsi, so colored lines don't bleed into borders. Removed the old uniform-greyBODY_STYLE.Covers both per-project Exposé (
Ctrl-A g) and cross-project Exposé from the meta dashboard, since they sharetilePreview/drawTile.Verification
yarn typecheck,yarn lint,yarn test(1180 passed),yarn buildall green.🤖 Generated with Claude Code
Summary by CodeRabbit