rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
matata2017/dsh-paste-collapse
Codex-style paste collapse for DeepSeek Harness: a large paste becomes a [Pasted Content N chars] placeholder with a pill in the composer, and the host expands it back to the full text before the model sees it.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:matata2017/dsh-paste-collapse
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Collapse a large paste in the DeepSeek Harness composer into a Codex style placeholder, show a pill for it, and expand it back to the full text on the host right before the model reads the turn.
The model still sees every character you pasted. Nothing is written to disk and no tokens are saved — the placeholder is a display convenience, not a compression.
you paste 12 000 characters
│
▼
the composer shows [Pasted Content 12000 chars] and a pill with a preview
│
▼ you press send
the host swaps the placeholder for the original text
│
▼
the model reads the full 12 000 characters
| Threshold | 1000 characters (LARGE_PASTE_CHAR_THRESHOLD in Codex) |
| Placeholder | [Pasted Content 12000 chars] |
| A second paste of the same size | [Pasted Content 12000 chars] #2, then #3, … |
| The counter | per size: a 3000 character paste starts its own sequence |
| Expansion | FIFO: the first occurrence of a placeholder gets the first text |
| A placeholder without a text | left alone, sent to the model as it is |
The placeholder text, the numbering and the FIFO expansion are a port of
Codex (codex-rs/tui/src/bottom_pane/chat_composer.rs): next_large_paste_placeholder
and expand_pending_pastes.
Every collapsed paste gets a pill on the top edge of the composer:
6.7k instead of 6684)The side panel is the drawer Codex and WorkBuddy use: the whole text, the
character count, a copy button and a close button. Esc or a click outside
closes it.
The pill uses the DSH native colours (CSS variables only, no hard coded hex), so it follows the light and the dark theme.
The turn you already sent shows the collapsed paste as a pill as well, instead of a wall of text: the bubble renders the pasted text as a small chip with the preview and the character count, and clicking it opens the same side panel with the whole text.
The bubble asks the client first and the host second, so a message still shows its pill after the client lost its copy (after a restart, for example). When neither of them has the text any more, the message simply shows the plain text.
The bubble carries the expanded text, not the placeholder. The host swaps
the placeholder back for the full text in agent/pre-step, and that expanded
text is what the session stores and what the bubble shows. The pill is
therefore found by looking for the pasted text the client remembers inside
the message. When neither the client nor the host holds that text any more —
after a host restart, for example — the message falls back to the plain text.
The slot is won, not negotiated. The host renders the text of a user
message with the text key of the conversation.user.text.node slot, and
this plugin takes that seat. In the browser the priority is allocated by the
cordis-client-runner facade (guard.ts, allocatePriority()), and a plugin
half that registers later naturally gets the lower priority — so it wins over
the host's 100. The priority: 50 this plugin passes explicitly only really
takes effect on the static bundled path. Both paths win, but that is a
precondition, not a coincidence: do not rely on being able to reorder the
registrations.
# in the DSH profile
dsh plugin --profile desktop add github:matata2017/dsh-paste-collapse
Use the github: form: this plugin is not published to npm, and the name
dsh-paste-collapse on npm belongs to a different author's package.
or link a checkout:
{
"dependencies": {
"dsh-paste-collapse": "link:D:\\work\\huanghao\\dsh-paste-collapse"
}
}
The plugin has two halves: the host half (lib/index.js) and the client half
(client.js). The client half is what turns the paste into a placeholder, the
host half is what expands it again.
Only two:
agent/pre-step, right before the
model reads the turn.node --check lib/marker.js
node --check lib/index.js
node --check client.js
node test/run-tests.mjs # 66 checks: the marker rules and the client bundle
node selftest/host-e2e.mjs # 24 checks: the host plugin end to end
test/client-bundle.mjs runs client.js inside a fake window with a fake
React and a fake DOM, so the composer behaviour is tested without a browser.
selftest/host-e2e.mjs runs the host plugin against a fake Cordis context and
uses a temporary DSH_HOME.
See VERIFY.md for the full acceptance checklist.
MIT
The browser loader concatenates every installed plugin client bundle into one script, so a top-level const belongs to all plugins. This file runs inside its own function for that reason: two plugins declaring the same top-level name is a syntax error that stops the app from booting.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: model、deepseek。