dsh-composer-lists 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wangjianghu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,65 @@
1
- # Temporary Holding Version
1
+ # dsh-composer-lists
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ DSH(DeepSeek Harness)聊天输入框的列表编排插件:自动续号与重排、标记感知的光标移动、层级升降,以及一个可撤销的 AI 提示词优化按钮。
4
+
5
+ Ordered/unordered list editing for the DeepSeek Harness message composer: automatic numbering and renumbering, marker-aware caret moves, level promotion, and an undoable AI prompt-polish button.
6
+
7
+ ## 安装 / Install
8
+
9
+ ```sh
10
+ dsh plugin add dsh-composer-lists
11
+ ```
12
+
13
+ Requires dsh 0.2.1+. 刷新页面后生效 / takes effect after a page refresh.
14
+
15
+ ## 行为 / Behavior
16
+
17
+ 遵循 DSH 原生按键约定(Enter 发送、⌘Enter 加速发送均不改动):
18
+
19
+ | 手势 | 行为 |
20
+ |---|---|
21
+ | **Shift+Enter** | 列表行内换行并自动续号(沿用当前行样式:`1.`→`2.`、`a.`→`b.`、`①`→`②`);空列表项上按 = 退出列表并入上一行行尾(不留空行) |
22
+ | **Backspace** | 光标紧跟标记后:二级及更深 → 升一级(如 `b. `→`2. `,光标停在新标记右侧);一级 → 整个标记一步删掉;空列表项 → 删整行并入上一行行尾 |
23
+ | **← / →** | 标记前缀(缩进+编号/符号+空格)作为一步跨过:标记右侧按 ← 一次到行首,行首按 → 一次到标记右侧 |
24
+ | **⌘← / Home** | 跳到行首;列表行落在标记右侧,再按一次到最左 |
25
+ | **Tab / Shift+Tab** | 仅列表行:降 / 升一级,所在块按新层级重排样式与编号;多行选中批量 |
26
+ | **⌘⇧8 / ⌘⇧7** | 当前行或选中行:加无序 / 有序标记;再按取消,可反复循环 |
27
+ | **⌘⇧B** | 选中文本加 `**粗体**`(⌘B 被 DSH 菜单占用,无法到达页面) |
28
+ | 输入/删除/粘贴 | 有序编号自动重排(多行块内顺序归一;手改编号不会被覆盖) |
29
+
30
+ ## 层级样式(默认,⚙ 中可自定义)
31
+
32
+ | 层级 | 有序 | 无序 |
33
+ |---|---|---|
34
+ | 一级 | `1. 2. 3.` | `-` |
35
+ | 二级 | `a. b. c.` | `*` |
36
+ | 三级 | `① ② ③` | `+` |
37
+ | 四级 | `(1) (2) (3)` | `•` |
38
+ | 五级 | `α. β. γ.` | `○` |
39
+ | 六级 | `1. 2. 3.` | `▪` |
40
+
41
+ 每层有序样式可选 `1.` / `a.` / `α.` / `(1)` / `①`,无序符号可选 `- * + • ○ ▪ –`,缩进宽度 2/4/8,另有自动重排与优化按钮开关。手写 `a.` `α.` `(3)` `①` 同样被识别并参与重排。设置存于浏览器 localStorage,即时生效。
42
+
43
+ ## AI 提示词优化(✨ 按钮)
44
+
45
+ 点击将当前草稿交由 Host 侧当前默认模型改写为「任务目标 + 有序步骤 + 无序约束」的结构化列表,完成后可一键 ↩ 撤销恢复原文;手动编辑过优化结果后撤销自动退场。请求 90 秒超时、优化中可按 Esc 中止,生成失败有明确提示。
46
+
47
+ ## 实现说明
48
+
49
+ - 浏览器半挂载于 `conversation.input.left` 槽位,所有编辑经会话 `inputActions.insertText / setDraft`(一次手势 = 一步撤销)
50
+ - 含引用 chip / 命令 chip / 引用块时键盘编排自动停用;触发菜单(`/`、`@`)打开时不拦截按键;IME 组词期间不处理
51
+ - Host 半注册 `POST /composer-lists/optimize` 路由:跨域精确校验、请求体 256KB 上限、思考档自动取模型最轻档、断连与卡流超时保护
52
+
53
+ ## 开发 / Development
54
+
55
+ ```sh
56
+ node test-pure.cjs # 纯函数回归 + 确定性混沌测试(7000+ 断言)
57
+ node test-host.cjs # Host 路由集成测试(假 req/res 驱动)
58
+ node bench-pure.cjs # 性能基准
59
+ ```
60
+
61
+ 改 `client.js` 后用插件管理停用→启用一次即同步页面;改 `index.js`(Host 半)需重启 dsh。
62
+
63
+ ## License
64
+
65
+ [MIT](./LICENSE)