dsh-onesheet 0.0.0-stage → 0.3.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 +21 -0
- package/README.md +111 -2
- package/client.js +1455 -0
- package/cordis.patch.yml +3 -0
- package/docs/card.png +0 -0
- package/docs/pill.png +0 -0
- package/icon.svg +5 -0
- package/index.js +361 -0
- package/package.json +57 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OneSheet contributors
|
|
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,112 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OneSheet · 图卡
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Draw paged, clickable diagrams right inside a DSH conversation. (中文文档在下面)
|
|
4
|
+
|
|
5
|
+
在 DSH 对话的正文流里画「能翻页、能点」的图卡:一页只讲一个变化,点「下一步」就像跟着图走一遍。
|
|
6
|
+
点方框会把那一格引用进输入框(不直接发送);每张卡的页脚有「地图」入口,能列出这段会话里画过的卡。
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
*一张卡:一页一个变化,黄圈只圈当前这一步,页脚有「地图」入口;点方框会把那一格引用进输入框。*
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
*输入框左下角的「图卡 · 开/关」胶囊,点一下就切。*
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 在 DSH 里装(推荐,profile 里会写成 link 或依赖)
|
|
20
|
+
dsh plugin add dsh-onesheet
|
|
21
|
+
|
|
22
|
+
# 或者从本地开发目录装
|
|
23
|
+
dsh plugin add "link:/path/to/onesheet"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
装完 `plugin_manager` 里应能看到 `dsh-onesheet`,工具列表里出现 `show_figure` 与 `card_mode`。
|
|
27
|
+
宿主改动(`index.js`)要重启 DSH 才生效;面板改动(`client.js`)刷新页面即可。
|
|
28
|
+
|
|
29
|
+
## 5 行上手
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{ "title": "启动.bat 现在是怎么跑起来的", "w": 760, "h": 180,
|
|
33
|
+
"steps": [
|
|
34
|
+
{ "say": "双击之后,cmd 先按 GBK 读这个文件。", "items": [
|
|
35
|
+
{ "k": "box", "x": 20, "y": 20, "w": 200, "h": 76, "t": "双击 启动.bat", "ring": true } ] }
|
|
36
|
+
] }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
调用 `show_figure(scene)`。`say` 是这一页唯一那句话;`items` 里的元素画在 760 宽的坐标系里。
|
|
40
|
+
|
|
41
|
+
## 两种画法
|
|
42
|
+
|
|
43
|
+
**A. 元素式**(`items`)
|
|
44
|
+
|
|
45
|
+
| k | 字段 | 说明 |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| `box` | `x y w h t sub ring` | 方框;`ring:true` = 这一页给它套黄圈 |
|
|
48
|
+
| `arrow` | `x1 y1 x2 y2` | 直线箭头(前面各页的箭头会累积) |
|
|
49
|
+
| `text` | `x y w h t` | 纯文字块 |
|
|
50
|
+
| `circle` | `x y r t` | 圆点 |
|
|
51
|
+
|
|
52
|
+
**B. 整图式**(顶层 `view`,旧名 `svg`,≤12000 字)
|
|
53
|
+
|
|
54
|
+
一条 `<svg viewBox="0 0 760 h">`,用 `data-step` / `data-say` 控制每样东西第几页出现:
|
|
55
|
+
|
|
56
|
+
- `data-step="3"` —— 从第 3 页起一直在;`data-step="2-3"` —— 只在 2–3 页
|
|
57
|
+
- `data-say="3"` —— 只在第 3 页出现(翻过去就隐藏,不再变淡)
|
|
58
|
+
- `data-dim="2"` —— 从第 3 页起淡到 32%(讲完的历史留个影子)
|
|
59
|
+
- `data-name="8255"` —— 这一组可点;点击回传里带 `element: "8255"`
|
|
60
|
+
- `data-go="2"` —— 点它跳回第 2 页
|
|
61
|
+
|
|
62
|
+
渲染前会去掉 `<script>`、`on*=` 和 `javascript:`。颜色用 `--dsw-alias-*` 变量,深色模式自动适配。
|
|
63
|
+
|
|
64
|
+
## 尺寸与密度
|
|
65
|
+
|
|
66
|
+
- 宽度按 **760** 设计(对话列就这么宽),不要画 1100 让别人帮你缩小;画不下就拆页。
|
|
67
|
+
- 高度按内容给,别留大片空白;一页 6–7 行文字 + 一个小图比较合适。
|
|
68
|
+
- 默认**累积**:后面各页只往上加东西,不要挪已有坐标(挪了会叠重影)。要换布局给那一页加 `"fresh": true`。
|
|
69
|
+
- `steps` 1–12 页;每页元素 ≤ 40。
|
|
70
|
+
- 顶层 `sub` 会顶掉工具行标题(参数按字母序,`sub` 在 `title` 前),**通常别传**。
|
|
71
|
+
|
|
72
|
+
## 点起来的规矩
|
|
73
|
+
|
|
74
|
+
- 点框 → 卡底出现引用,并插入输入框(`insertIntoComposer`,不发送)。
|
|
75
|
+
- 点空白 → 只回页号。
|
|
76
|
+
- 收到 `figure_click` 时的接话顺序:先认位置 → 再讲那一格(一两句)→ 停住。
|
|
77
|
+
|
|
78
|
+
## 图卡模式开关
|
|
79
|
+
|
|
80
|
+
- 输入框左下角有「图卡 · 开/关」胶囊:点它切模式,状态存在 `~/.dsh/onesheet/card-mode.json`。
|
|
81
|
+
- 开着时,宿主往系统提示里加一段:本轮回答只用一张卡、话全写进图里。
|
|
82
|
+
- 也可以敲斜杠命令:`/cardmode on|off|status`。
|
|
83
|
+
- 模式在**每轮开头**固定:中途关掉,这一轮仍按开走。
|
|
84
|
+
|
|
85
|
+
## 已知限制
|
|
86
|
+
|
|
87
|
+
- 每轮开头读一次模式;中途切换下一轮才生效。
|
|
88
|
+
- 地图只列「已经渲染到页面过」的卡,不是全会话全量。
|
|
89
|
+
- 点击引用走的是编辑器插入;DSH 结构大改时可能失效(会退化成复制到剪贴板并在卡底提示)。
|
|
90
|
+
|
|
91
|
+
## 兼容性
|
|
92
|
+
|
|
93
|
+
- 需要 DSH 0.2.x(`peerDependencies` 里是 `@deepseek-ai/cordis ~4.1.0`)。
|
|
94
|
+
- 用到的宿主能力:`tools` / `systemPrompt.section` / `commands.register` / `connection.registerFetchRoute` / `slots.register`(`tool.call.toolview`)。
|
|
95
|
+
这些不是稳定公开 API,升级 DSH 后请跑一遍 `browser-check`。
|
|
96
|
+
|
|
97
|
+
## 开发
|
|
98
|
+
|
|
99
|
+
插件本体之外还有一个开发工作区(仓库外的 `figkit/`):场景样例、静态体检 `check-cards.mjs`、浏览器验收 `browser-check.mjs`。
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
node figkit/check-cards.mjs # 静态体检:内联 SVG + 场景文件
|
|
103
|
+
node figkit/browser-check.mjs --port 51539 \
|
|
104
|
+
--shot docs/card.png --shot-pill docs/pill.png # 真浏览器验收(会顺便出 README 截图)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`browser-check.mjs` 会自己签一个 `dsh-auth-*` cookie 进本机 GUI,断言卡片渲染、翻页、地图、胶囊、窄窗;
|
|
108
|
+
它依赖本机 `~/.dsh/.credentials.yaml` 和 Windows 上的 Edge,**普通用户不需要运行**。
|
|
109
|
+
|
|
110
|
+
## 许可
|
|
111
|
+
|
|
112
|
+
MIT,见 [LICENSE](./LICENSE)。
|