Bundle
long-draft-input
Collapse very long composer drafts into a summary card without changing DSH message submission.
- Source
- Heyflyingpig
- stars
- 3 stars
- License
- MIT
- Updated
- Updated 3 days ago
Readme
# long-draft-input
一个面向 DeepSeek Harness `0.1.0-rc.5` 的独立插件:当输入框草稿超过阈值时,将发送框向上扩展并显示附件式摘要卡片,但不改变 DSH 原有的草稿状态、消息格式或发送路径。
## 预览

## 行为
- 长文本仍完整保存在 DSH 的 `input.draft` 中。
- 摘要卡片展示首行预览、字符数和行数。
- 摘要卡片作为原发送框内部的正常布局子项,像附件一样将发送框向上撑高;折叠态隐藏原 textarea 的完整文本,保留原工具栏和发送按钮。
- 卡片下方保留独立的补充输入区;补充文字会追加到完整长文本后,继续通过原发送按钮提交。
- 点击“在文本框中显示”后恢复原 textarea,并将焦点交还给它。
- 点击 `×` 移除聚合的长文本;如果卡片下方已经输入补充正文,只保留这部分正文。
- 原 InputBar 的发送按钮仍调用原有 `inputActions.submit()`;插件不定义附件协议,也不改服务端消息格式。
- 未超过阈值的小文本不渲染插件 UI,因此保持原行为。
默认阈值为 2,000 个 JavaScript 字符,首行预览为 120 个 Unicode code point。可在 profile 的后续 patch 层覆盖;由于 patch 会替换整行配置,覆盖时请同时写出两个字段:
```yaml
- id: long-draft-input
config:
threshold: 20000
previewChars: 160
```
## 安装
### 在本地目录中执行
```sh
dsh plugin --profile demo add github: Heyflyingpig/long-draft-input
dsh --profile web
```
GitHub 安装会执行 `prepare` 构建 TypeScript 和浏览器 bundle。pnpm 10+ 可能要求 profile 的 `pnpm-workspace.yaml` 显式允许该包的构建脚本;也可以发布 npm 包或 `pnpm pack` tarball,直接携带已构建的 `lib/`,减少安装时的构建权限。
在 项目源码 checkout 中本地验证:
```sh
pnpm dsh plugin --profile demo add /absolute/path/to/long-draft-input
pnpm dsh --profile demo --dump-config
pnpm dsh --profile demo
```
## 开发和验证
```sh
pnpm install
pnpm test
pnpm run test:unit
pnpm pack:check
```
真实 Web 组合测试需要先在一个已安装本插件的 DSH profile 中启动 Web:
```sh
DSH_WEB_URL=http://127.0.0.1:3080 pnpm run test:web
```
## 当前版本限制
这个插件使用公开的 `conversation.input.dock` 扩展点承载生命周期,再通过 React Portal 把摘要卡片放入原 `[data-composer-card]`,使卡片真正参与发送框内部排版,而不是在对话区上方叠加独立层。折叠态通过 CSS 隐藏原 textarea 的可见文本层,但不会替换输入框的发送逻辑。公开扩展点无法控制 `InputBar.tsx` 内部的私有 React 渲染逻辑,因此它不能阻止原组件继续构造 backdrop 和 mirror 节点。
## 友情链接
https://linux.doInstall
dsh plugin --profile web add github:Heyflyingpig/long-draft-input
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install long-draft-input from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.