Skip to content

feat: configurable paste collapse thresholds (TUI + CLI)#24990

Closed
kylekahraman wants to merge 1 commit into
NousResearch:mainfrom
kylekahraman:paste-collapse
Closed

feat: configurable paste collapse thresholds (TUI + CLI)#24990
kylekahraman wants to merge 1 commit into
NousResearch:mainfrom
kylekahraman:paste-collapse

Conversation

@kylekahraman

Copy link
Copy Markdown
Contributor

Adds two new config keys for controlling paste collapse behavior:

  • paste_collapse_threshold (default: 5) — number of lines above which a bracketed paste gets collapsed to a file reference in both the TUI and CLI. Set to 0 to disable.
  • paste_collapse_threshold_fallback (default: 0, disabled) — same threshold for the fallback heuristic used by terminals without bracketed paste support. Defaults to disabled because the fallback is destructive (replaces the entire buffer rather than appending).

Changes

File Change
hermes_cli/config.py Added config keys + bumped _config_version to 24
cli.py Both paste handlers read from config instead of hardcoded 5
ui-tui/src/config/limits.ts LARGE_PASTE now line-only, default 5
ui-tui/src/app/useComposerState.ts Reads pasteCollapseLines from uiStore
ui-tui/src/app/useConfigSync.ts _pasteCollapseLinesFromConfig() helper wired into applyDisplay
ui-tui/src/app/uiStore.ts pasteCollapseLines: 5 default
ui-tui/src/app/interfaces.ts pasteCollapseLines: number in UiState
ui-tui/src/gatewayTypes.ts paste_collapse_threshold?: number in ConfigFullResponse

Related

Adds two new config keys:
- paste_collapse_threshold (default: 5) — line count threshold for
  bracketed paste collapse in both TUI and CLI
- paste_collapse_threshold_fallback (default: 0, disabled) — same for
  the fallback heuristic in terminals without bracketed paste support

TUI frontend reads these from config.get full via applyDisplay/patchUiState.
CLI reads from self.config at paste-handling time.

Closes NousResearch#5626
Related: NousResearch#5623
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) area/config Config system, migrations, profiles labels May 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #8491 which also implements configurable paste collapse thresholds and closes #5626. Prior attempts include #5623, #10834, and #12389. Please coordinate with the existing PR.

@kylekahraman

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up — I checked #8491 and the other prior attempts.

Not a true duplicate. #8491 only touches cli.py (the classic prompt_toolkit CLI). Our PR is specifically about the TUI (Ink React frontend), which #8491 doesnt address at all. The TUI had a completely separate hardcoded threshold ({ chars: 8000, lines: 80 } in limits.ts) that wasnt plumbed to config — thats the bug that motivated #5626.

Scope comparison:

#8491 This PR
CLI (cli.py) ✅ Reads display.paste_collapse_threshold ✅ Reads paste_collapse_threshold
TUI frontend (ui-tui/) ❌ Not touched ✅ Full plumbing: config.get full → applyDisplay → patchUiState → composer
Default 25 lines 5 lines
Fallback threshold ❌ Not handled ✅ Separate _fallback key (0=disabled)

Im happy to converge on display.paste_collapse_threshold as the key name (fits Hermes conventions better) and adjust the default if theres consensus. The main thing that shouldnt be lost is the TUI frontend plumbing — without it, the issue (#5626) is only half-fixed.

@kylekahraman

Copy link
Copy Markdown
Contributor Author

Closing in favor of #8491 — I'll add TUI frontend support to that PR. The TUI plumbing is the novel part here (config.get full → applyDisplay → patchUiState → composer) and it belongs on the same branch that already has the CLI half.

@kylekahraman

Copy link
Copy Markdown
Contributor Author

Re-opening — no response from iRonin on #8491 in 7 days. This PR covers CLI + TUI, both paste paths (bracketed + fallback).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: configurable paste collapse thresholds + input scroll indicators

2 participants