dsh-plugin-feihualing 1.0.0 → 1.1.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/README.md +33 -5
- package/cordis.yml +7 -3
- package/lib/client.js +1464 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.ts +109 -135
- package/lib/index.js +1156 -822
- package/package.json +19 -4
- package/lib/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
# dsh-plugin-feihualing —— 飞花令游戏插件
|
|
2
2
|
|
|
3
|
-
DeepSeek Harness
|
|
3
|
+
DeepSeek Harness 飞花令游戏插件,两种玩法:
|
|
4
|
+
|
|
5
|
+
- **🎴 浏览器即时对战(v1.1+)**:会话标题行点 🎴 打开浮层面板——内置 AI 对手出题、限时对诗、连击计分、三档难度、局制结算与本地战绩。判定在本机完成(与对话模式共用同一套规则),**不走模型回合**——AI 在后台跑任务时,随手就能开一局休闲。
|
|
6
|
+
- **💬 对话模式**:简易 / 古法严格双模式,游戏状态(令字、得分、已用诗句、剩余提示次数)由插件**按会话独立维护**;插件自身不向主聊天输出流写入任何内容,所有播报由模型根据工具返回值完成。
|
|
4
7
|
|
|
5
8
|
## 玩法
|
|
6
9
|
|
|
10
|
+
### 🎴 即时对战(浏览器面板)
|
|
11
|
+
|
|
12
|
+
在任意会话标题操作行点 **🎴** 打开「飞花令 · 即时对战」浮层:
|
|
13
|
+
|
|
14
|
+
- 对手先手出题(含令字的诗句),你在限时内对出**含令字的新句**(轻松 30s / 标准 20s / 困难 15s);
|
|
15
|
+
- 连续答对触发**连击加分**;双方(你与对手)用过的诗句都不能再用(双边去重);
|
|
16
|
+
- **连对 7 题通关**,超时 3 次惜败;简易 / 古法模式任选,古法按「令字位置 1→7 循环」推进;
|
|
17
|
+
- 「💡 提示」给出参考句(参考句直接跟对只得 5 分、断连击);「再来一局」自动换新令字;
|
|
18
|
+
- 战绩(胜 / 负 / 连胜 / 最佳)存于本机;关闭面板不丢对局(隐藏视同暂停);
|
|
19
|
+
- 面板判定与对话模式共用 `src/shared` 规则,**不占用模型上下文**。
|
|
20
|
+
|
|
7
21
|
### 关键词指令(直接对插件说)
|
|
8
22
|
|
|
9
23
|
| 指令 | 作用 |
|
|
@@ -81,20 +95,34 @@ dsh plugin --profile desktop add . # 在仓库根目录执行
|
|
|
81
95
|
|
|
82
96
|
```bash
|
|
83
97
|
dsh plugin --profile desktop add dsh-plugin-feihualing # 已发布 npm 时
|
|
84
|
-
dsh plugin --profile desktop add ./dsh-plugin-feihualing-1.
|
|
98
|
+
dsh plugin --profile desktop add ./dsh-plugin-feihualing-1.1.0.tgz # 或 pnpm pack 产物
|
|
85
99
|
```
|
|
86
100
|
|
|
101
|
+
> 💡 UI 说明:`dsh.client`(浏览器半边)随包分发,Web GUI 安装后**重启一次**即出现 🎴 面板按钮(client bundle 按内容 rev 刷新)。
|
|
102
|
+
|
|
87
103
|
### 验证与卸载
|
|
88
104
|
|
|
89
105
|
```bash
|
|
90
106
|
dsh --profile desktop --dump-config # 应能看到 "# == dsh-plugin-feihualing" 层
|
|
91
|
-
dsh --profile desktop #
|
|
107
|
+
dsh --profile desktop # 启动后:对话说「开始飞花令」可对诗;
|
|
108
|
+
# 会话标题行会出现 🎴 按钮,打开即时对战面板
|
|
92
109
|
|
|
93
110
|
dsh plugin --profile desktop remove dsh-plugin-feihualing # 卸载并清理快照
|
|
94
111
|
```
|
|
95
112
|
|
|
96
113
|
可选配置(提示次数、自动暂停等)见上方「配置」章节。
|
|
97
114
|
|
|
115
|
+
## 开发
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pnpm install
|
|
119
|
+
pnpm typecheck # 严格类型检查(tsc --noEmit)
|
|
120
|
+
pnpm test # 引擎逻辑冒烟测试(对局引擎 23 项断言)
|
|
121
|
+
pnpm run build # tsdown:lib/index.js(Host)+ lib/client.js(浏览器 UI)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
结构:`src/index.ts` Host 半边(状态机 / 三个工具 / 事件 / 快照白名单);`src/client/` 浏览器 UI(即时对战面板、引擎、战绩);`src/shared/` 双半共用(判定规则、诗句库,保证对话与面板判定一致)。Host 无任何第三方运行时依赖;Client 仅依赖 DSH 自带的 `react`。
|
|
125
|
+
|
|
98
126
|
## 文件读写安全(白名单)
|
|
99
127
|
|
|
100
128
|
- 快照目录固定为 `$DSH_HOME/storages/dsh-plugin-feihualing`(`DSH_HOME` 环境变量优先,否则 `~/.dsh`)。
|
|
@@ -103,6 +131,6 @@ dsh plugin --profile desktop remove dsh-plugin-feihualing # 卸载并清理快
|
|
|
103
131
|
|
|
104
132
|
## 其它说明
|
|
105
133
|
|
|
106
|
-
-
|
|
134
|
+
- Host 半边不使用定时器、无后台任务;会话之间状态完全隔离。
|
|
107
135
|
- 事件映射(需求名 → 本 Harness 实际事件):`user:message → user/message`、`turn:before → turn/start`、`turn:after → turn/end`、`tool:before → tool/call`、`plugin:unload → Cordis fiber dispose(ctx.effect 清理 + 字面量事件兜底)`。
|
|
108
|
-
-
|
|
136
|
+
- 浏览器 UI:会话头 🎴 按钮 + 浮层(`dsh.client` platform=web,仅依赖 DSH 运行时自带 react);面板对局为独立即时战,与本机会话的 localStorage 战绩。对话模式状态经 `feihualing_status` 返回给模型播报。
|
package/cordis.yml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# dsh-plugin-feihualing 插件元配置
|
|
3
3
|
# ============================================================
|
|
4
4
|
name: dsh-plugin-feihualing
|
|
5
|
-
version: 1.
|
|
5
|
+
version: 1.1.0
|
|
6
6
|
description: >-
|
|
7
7
|
飞花令游戏插件(简易 / 古法严格双模式)。
|
|
8
8
|
支持关键词指令(开始飞花令、结束飞花令、换字、提示、认输、暂停、继续飞花令)、
|
|
@@ -41,11 +41,15 @@ config:
|
|
|
41
41
|
(bash、pwsh、write、edit 等)自动暂停游戏并保存现场
|
|
42
42
|
|
|
43
43
|
# ------------------------------------------------------------
|
|
44
|
-
# UI
|
|
44
|
+
# UI 声明:浏览器侧即时对战面板(dsh.client,会话头 🎴 按钮 + 浮层)。
|
|
45
|
+
# 面板内置对手、本机即时判定,不走模型回合;对话模式(工具+关键词)保留。
|
|
45
46
|
# ------------------------------------------------------------
|
|
46
47
|
ui:
|
|
47
48
|
sidePanel: false
|
|
48
|
-
note:
|
|
49
|
+
note: >-
|
|
50
|
+
浏览器侧提供「飞花令 · 即时对战」浮层(会话头按钮打开):内置 AI 对手出题、
|
|
51
|
+
限时对诗、连击计分、三档难度与局制结算,判定与对话模式共用同一套规则;
|
|
52
|
+
对话模式仍经 feihualing_* 工具与关键词指令进行,状态由插件按会话维护。
|
|
49
53
|
|
|
50
54
|
# ------------------------------------------------------------
|
|
51
55
|
# 能力与安全声明
|