Skip to content

feat(tui): configure when a paste is summarized and what its placeholder says - #54458

Closed
Nowaker wants to merge 1 commit into
anomalyco:v1from
Nowaker:paste-summary-config
Closed

Nowaker wants to merge 1 commit into
anomalyco:v1from
Nowaker:paste-summary-config

Conversation

@Nowaker

@Nowaker Nowaker commented Oct 11, 2026

Copy link
Copy Markdown

Note: I'm aware v1 is now the maintenance branch and new features go to v2 only. This PR is here for others to use, and I'll submit the v2 version once I've migrated my whole plugin system to it.

Issue for this PR

Related: #15767, #8501.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

A paste of three lines or more, or over 150 characters, always becomes [Pasted ~N lines]. The label says nothing about what was pasted, and the only control is the global toggle.

This adds prompt.paste_summary to tui.json:

{
  "prompt": {
    "paste_summary": {
      "lines": 10,
      "characters": 2000,
      "format": "[Pasted {lines} lines, {bytes} B: {excerpt}]",
      "excerpt": 40
    }
  }
}
  • lines / characters: the thresholds (defaults 3 and 150).
  • format: the placeholder, with {lines}, {characters}, {bytes} (UTF-8) and {excerpt}, the paste's start with line breaks and repeated spaces collapsed. The placeholder is kept on one line.
  • excerpt: characters {excerpt} shows before … (default 30).

The defaults reproduce today's rule and label exactly, and Disable paste summary still turns summarizing off. Documented in tui.mdx under "Paste summary".

How did you verify your code works?

  • test/prompt/paste.test.ts: the default thresholds and label, configured thresholds, counts in the format, the excerpt (whitespace, cut, surrogate pairs) and the one-line rule. test/config.test.tsx: the schema accepts the options and rejects bad values.
  • bun typecheck and bun test in packages/tui.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

This PR is AI generated, but under direct supervision and on request of @Nowaker.

…der says

A paste of three lines or more, or over 150 characters, always became
"[Pasted ~N lines]", which says nothing about what was pasted; only the
global toggle could change it.

prompt.paste_summary in tui.json sets the line and character
thresholds and the placeholder format, with {lines}, {characters},
{bytes} and an {excerpt} of the paste's start, whose length is
configurable. pasteSummary (src/prompt/paste.ts) builds it and keeps it
on one line. The defaults reproduce the previous rule and label
exactly; the toggle still turns summarizing off.
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@Nowaker

Nowaker commented Nov 2, 2026

Copy link
Copy Markdown
Author

Closing: this targets the v1 TUI, which upstream now maintains for critical fixes only, so it is not going to be merged. The branch stays on Nowaker/opencode if anyone wants to pick it up.

@Nowaker Nowaker closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant