Skip to content
dsh.fish
Bundle

dsh-composer-collapse

DSH web 客户端补丁:输入框高度三态管理(auto 失焦 72px/聚焦 192px、常驻展开 336px=官方原值、常驻折叠 72px),官方内容自适应机制保持原样;卡片角标按钮 + Alt+Shift+C 循环切换,localStorage 持久化。

Source
483218131
License
MIT
Updated
Updated yesterday

Readme

# dsh-composer-collapse

[English](#english) | [简体中文](#中文)

Height manager for the DeepSeek Harness (DSH) Web composer — three modes for the input box height: **Auto** (collapsed while reading, expanded while editing), **Pinned Open** (official 336px), **Pinned Collapsed** (72px). Pure client-side patch plugin, zero host modification.

DeepSeek Harness(DSH)Web 输入框高度管理插件:**自动**(阅读时折叠/编辑时展开)、**常驻展开**(官方 336px)、**常驻折叠**(72px)三态循环。纯客户端补丁,零本体改动。

## English

### Why

The official composer auto-grows with content up to 336px (14 lines) and then scrolls internally — there is no collapse control or setting. While reading AI replies and editing a long draft at the same time, the expanded box covers a large part of the chat. This plugin keeps the official content-adaptive growth untouched and only tightens the `max-height` ceiling per mode.

### Modes

| Mode | Ceiling | Behavior |
| --- | --- | --- |
| Auto (default) | blurred 72px (3 lines) / focused 192px (8 lines) | collapses while reading, expands when you click into the editor |
| Pinned Open | 336px (official value) | identical to the official behavior, never auto-collapses |
| Pinned Collapsed | 72px (3 lines) | stays collapsed even when focused |

- Below each ceiling the height still fully follows the content (official mirror mechanism untouched).
- Toggle: the small arrow button at the top-right corner of the composer card cycles `auto → pinned open → pinned collapsed → auto`; keyboard `Alt+Shift+C` does the same.
- The mode is persisted in `localStorage` (`dsh.composerCollapse.mode`) and survives reloads.

### Install

```powershell
# from GitHub
dsh plugin --profile web add github:483218131/dsh-composer-collapse

# or from a local checkout
dsh plugin --profile web add link:<path-to>/dsh-composer-collapse

# uninstall (fully restores the official behavior)
dsh plugin --profile web remove dsh-composer-collapse
```

Refresh the Web page after installing.

### Tunables

Constants at the top of `client/client.js`: `CAP_COLLAPSED` / `CAP_FOCUSED` / `CAP_OPEN` (official line grid is 24px/line) and `TEXT_INSET_RIGHT` (right inset reserved for the corner button). Local `link:` installs pick up edits after a page refresh.

### Compatibility

| DSH | Status |
| --- | --- |
| 0.1.1-rc.2 | ✅ tested |
| 0.1.2-rc.1 | ✅ hooks verified (`data-composer-card` / `data-input-scroll` / `--dsh-composer-text-max-height` all present; the editor moved to Lexical — the focus selector covers both `textarea` and `[contenteditable]`); live smoke pending |

- The focus rule uses CSS `:has()`, Chromium 105+ (Edge/Chrome 2022+).
- Hooks are official `data-*` attributes, not hash classes; if a DSH upgrade breaks behavior, check the hook list below first.

### Hook evidence (upgrade checklist)

Source of truth: `@deepseek-ai/dsh-client-ui-conversation@0.1.1-rc.2 lib/client.js` (inspected 2026-09-08):

- card `data-composer-card` (~L3991); scroll container `data-input-scroll` (~L4020)
- container CSS `max-height:var(--dsh-composer-text-max-height);overflow-y:auto` (~L3463)
- variable default `336px` (~L7118); text layers `padding:4px 12px 0 16px`; line height 24px → 336px = 14 lines
- mirror layer `data-input-mirror` (~L4060) drives content-following height; `<textarea rows={2}>` (~L4042)

### Lifecycle note for plugin authors

All side effects (style injection, DOM nodes, observers, listeners) must be registered inside `ctx.effect(...)`. Side effects started directly in `apply()` get retracted by the kernel's epoch reconciliation right after activation — silently, with no console error.

### Layout integrity

- The corner button is an absolutely-positioned trailing node: it never participates in the official flex layout and cannot push away any official element.
- The text area reserves `padding-right` on the scroll container, so backdrop/mirror/input shrink together — draft text and command-hint decorations stay aligned.
- Known transient overlaps: when the notice bar or attachment thumbnails are visible, the button (35% opacity, highlighted on hover) may sit on their top-right corner; both remain clickable.

## 中文

### 为什么

官方输入框内容多时自动长高到 336px(14 行)后框内滚动,没有折叠控件也没有设置项。边阅读 AI 回复边编辑长草稿时,展开的输入框会挡住大量聊天内容。本插件不改官方内容自适应机制,只按模式收紧 `max-height` 天花板。

### 三态

| 模式 | 封顶 | 行为 |
| --- | --- | --- |
| auto(默认) | 失焦 72px(3 行)/ 聚焦 192px(8 行) | 阅读时自动折叠让出内容区;点进输入框自动展开 |
| 常驻展开 | 336px(14 行,官方原值) | 与官方行为完全一致,不自动折叠 |
| 常驻折叠 | 72px(3 行) | 聚焦也不展开,最大化阅读区 |

- 各档天花板以下高度仍完全跟随内容(官方 mirror 自适应机制原样保留),到线才内滚。
- 切换:输入框卡片右上角小箭头按钮循环 `auto → 常驻展开 → 常驻折叠 → auto`;快捷键 `Alt+Shift+C` 等效。
- 模式存 localStorage(`dsh.composerCollapse.mode`),刷新后保持。

### 安装

```powershell
# 从 GitHub 安装
dsh plugin --profile web add github:483218131/dsh-composer-collapse

# 或本地目录
dsh plugin --profile web add link:<路径>/dsh-composer-collapse

# 卸载(完全恢复官方行为,无本体文件改动)
dsh plugin --profile web remove dsh-composer-collapse
```

安装后刷新 Web 页面生效。

### 调参

`client/client.js` 顶部常量:`CAP_COLLAPSED` / `CAP_FOCUSED` / `CAP_OPEN`(官方行栅格 24px/行)、`TEXT_INSET_RIGHT`(角标按钮让位宽度)。`link:` 本地安装下改完刷新页面即生效。

### 兼容性

| DSH | 状态 |
| --- | --- |
| 0.1.1-rc.2 | ✅ 实测 |
| 0.1.2-rc.1 | ✅ 钩子已核对(`data-composer-card` / `data-input-scroll` / `--dsh-composer-text-max-height` 均在;编辑器换为 Lexical——聚焦选择器已同时覆盖 `textarea` 与 `[contenteditable]`);线上冒烟待测 |

- 焦点判定使用 CSS `:has()`,需 Chromium 105+(Edge/Chrome 2022+)。
- 钩子全部为官方 `data-*` 属性,不碰 hash class;DSH 升级后行为异常时先核对下方钩子清单。

### 钩子证据(升级核对清单)

来源 `@deepseek-ai/dsh-client-ui-conversation@0.1.1-rc.2 lib/client.js`(2026-09-08 实查):

- 卡片 `data-composer-card`(约 L3991);滚动容器 `data-input-scroll`(约 L4020)
- 滚动容器 CSS:`max-height:var(--dsh-composer-text-max-height);overflow-y:auto`(约 L3463)
- 变量默认 `336px`(约 L7118);文本层 `padding:4px 12px 0 16px`;行高 24px → 336 = 14 行
- 镜像层 `data-input-mirror`(约 L4060)驱动高度跟随内容;textarea `rows={2}`(约 L4042)

### 给插件作者的踩坑提醒

全部副作用(样式注入、DOM 节点、观察器、监听器)必须注册在 `ctx.effect(...)` 内。直接写在 `apply()` 本体的副作用会被内核 epoch 对账机制在激活后立刻回收——静默发生,控制台无任何报错。

### 布局完整性

- 角标按钮为 absolute 尾插节点:不参与官方 flex 布局,不可能挤走任何官方元素;
- 文字区通过滚动容器 `padding-right` 整体让位,backdrop/mirror/input 三层同步缩窄,草稿文字与命令提示装饰对齐不受影响;
- 已知瞬态重叠:顶部提示条或附件缩略图出现时,按钮(35% 透明度、hover 高亮)可能压在其右上角,双方点击均不受影响。

## License

MIT

Install

dsh plugin --profile web add github:483218131/dsh-composer-collapse

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source