-
Notifications
You must be signed in to change notification settings - Fork 49.6k
feat: Rich-based rendering engine with intra-line diff highlighting (PR1) #4470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KUSH42
wants to merge
13
commits into
NousResearch:main
Choose a base branch
from
KUSH42:feat/rich-diff-renderer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
aaff152
feat: Rich-based rendering engine with intra-line diff highlighting
KUSH42 bc45f30
fix(rich_output): Error token uses text colour not background
KUSH42 f0f7310
feat(rich_output): truncate DiffRenderer output at 80 lines
KUSH42 e3539af
feat(rich_output): syntax highlighting in diff output
KUSH42 74eb7ef
fix(rich_output): extend diff background to line numbers and sigils
KUSH42 578310c
fix(rich_output): preserve path-distinct diff headers and summary counts
KUSH42 a79001e
fix: unblock read-file guards and color assertions in tests
KUSH42 cb0aa3b
feat(config): expose diff and preview line limits in config.yaml
KUSH42 52403a8
fix(reasoning): make show_reasoning sole gate for reasoning callback
KUSH42 ea4b477
test(reasoning,display): fix stub isolation and add coverage for toda…
KUSH42 7e08f16
fix(tui): animate spinner during agent runs
KUSH42 e4190b2
feat(tui): configurable spinner style + terminal tab/title animation
KUSH42 1b2708e
fix(display): wire missing imports and suppress code snippet when hig…
KUSH42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,6 +97,19 @@ | |
| r"(?<![A-Za-z0-9_-])(" + "|".join(_PREFIX_PATTERNS) + r")(?![A-Za-z0-9_-])" | ||
| ) | ||
|
|
||
| _FAST_MARKERS_CASE_SENSITIVE = ( | ||
| "sk-", "ghp_", "github_pat_", "gho_", "ghu_", "ghs_", "ghr_", | ||
| "xox", "AIza", "pplx-", "fal_", "fc-", "bb_live_", "gAAAA", | ||
| "AKIA", "sk_live_", "sk_test_", "rk_live_", "SG.", "hf_", "r8_", | ||
| "npm_", "pypi-", "dop_v1_", "doo_v1_", "am_", "sk_", "tvly-", | ||
| "exa_", "Authorization:", "://", "PRIVATE KEY", | ||
| ) | ||
| _FAST_MARKERS_LOWER = ( | ||
| "api_key", "apikey", "token", "secret", "password", "passwd", | ||
| "credential", "authorization:", "bearer", "access_token", | ||
| "refresh_token", "auth_token", | ||
| ) | ||
|
|
||
|
|
||
| def _mask_token(token: str) -> str: | ||
| """Mask a token, preserving prefix for long tokens.""" | ||
|
|
@@ -119,6 +132,15 @@ def redact_sensitive_text(text: str) -> str: | |
| return text | ||
| if not _REDACT_ENABLED: | ||
| return text | ||
| # Fast path for large plain text blobs with no secret-like markers. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This security-sensitive redaction optimization is unrelated to the Rich diff feature. Please split it from this renderer PR; current main has later redaction fixes that should be preserved independently during salvage. |
||
| # This avoids running several regex passes across large source files or | ||
| # logs that contain no credentials at all. | ||
| if len(text) > 8192: | ||
| lower_text = text.lower() | ||
| if not any(marker in text for marker in _FAST_MARKERS_CASE_SENSITIVE) and not any( | ||
| marker in lower_text for marker in _FAST_MARKERS_LOWER | ||
| ): | ||
| return text | ||
|
|
||
| # Known prefixes (sk-, ghp_, etc.) | ||
| text = _PREFIX_RE.sub(lambda m: _mask_token(m.group(1)), text) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns ANSI-only output. Current
ui-tui/src/app/createGatewayEventHandler.ts:740strips ANSI frominline_diff, so the proposed backgrounds and intra-line emphasis do not reach the TUI. Please carry structured styling through the event or add a TUI-native renderer and integration coverage.