dsh-kaomoji 0.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/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ All notable changes to **dsh-kaomoji** are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-09-09
11
+
12
+ ### Added
13
+
14
+ - 首个可用版本:向 dsh 系统提示词注入「情绪 → 颜文字」白名单规则。
15
+ - 三种模式:`off` / `auto` / `frequent`,默认 `auto`。
16
+ - 放置位置可调:`inline`(贴合情绪的句子后,默认)/ `end`(回复末尾)。
17
+ - 单条回复颜文字数量上限 `maxPerTurn`(默认 1,范围 1–5)。
18
+ - 用户附加提示词 `customPrompt`(只细化风格,不能覆盖模式/白名单/上限)。
19
+ - Web 端「设置 → 通用设置」配置卡片:模式 / 放置位置 / 数量上限 / 附加提示词,
20
+ 通过 loopback RPC 写入 `~/.dsh/dsh-kaomoji.json`,保存即热生效。
21
+ - 与 dsh-emoji 的共存设计:独立提示词段(order 176)、独立 RPC 通道、
22
+ 独立设置槽位(通用设置 vs 插件页),互不覆盖。
23
+ - 精选词库 `data/catalog.json`(12 个情绪分类,标注来源页),词库来自
24
+ [顔文字屋 kaomojiya.org](https://www.kaomojiya.org/)。
25
+ - 零第三方运行时依赖;内置 `node:test` 单测(Host RPC + Client 加载)。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-kaomoji 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.en.md ADDED
@@ -0,0 +1,218 @@
1
+ # dsh-kaomoji
2
+
3
+ > Add Japanese kaomoji to [DeepSeek Harness](https://github.com/deepseek-ai) (dsh) replies.
4
+
5
+ [![npm](https://img.shields.io/npm/v/dsh-kaomoji.svg)](https://www.npmjs.com/package/dsh-kaomoji)
6
+ [![license](https://img.shields.io/github/license/TianJie52009/dsh-kaomoji.svg)](./LICENSE)
7
+ [![node](https://img.shields.io/node/v/dsh-kaomoji.svg)](https://nodejs.org)
8
+
9
+ > 🤖 **Pure Codex generation** — the code and docs in this repository were
10
+ > generated entirely by OpenAI Codex and have not been human-reviewed. Please
11
+ > read and test before use.
12
+
13
+ `dsh-kaomoji` is a zero-dependency dsh plugin. Before a model call it injects a
14
+ “mood → kaomoji” whitelist rule into the system prompt, so the model copies a
15
+ real, well-formed kaomoji verbatim at the right moment. The curated library is
16
+ based on [顔文字屋 kaomojiya.org](https://www.kaomojiya.org/), one of the
17
+ largest Japanese kaomoji sites.
18
+
19
+ [简体中文](./README.md) | English
20
+
21
+ ## Features
22
+
23
+ - **Prompt-only design** — no stream rewriting, no extra model calls, stable
24
+ for KV caches.
25
+ - **Whitelist prevents garbled output** — the model copies characters exactly
26
+ instead of inventing malformed faces.
27
+ - **12 mood buckets** — happy, love, sad, cry, angry, surprised, confused,
28
+ shy, playful, encourage, thanks, sorry.
29
+ - **Three frequency modes** — `auto` (default), `frequent`, `off`.
30
+ - **Placement control** — `inline` after the mood-matching sentence (default)
31
+ or `end` of the reply.
32
+ - **Visual settings card** under Settings → General, saved live without a restart.
33
+ - **No third-party runtime dependencies** — only the dsh `systemPrompt`
34
+ service and Node built-ins.
35
+
36
+ ## How it works
37
+
38
+ 1. On startup the plugin registers a prompt section named
39
+ `dsh-kaomoji:guidance` (order `176`) via `ctx.systemPrompt.section()`.
40
+ 2. On every prompt assembly the section contributes:
41
+ - the active mode and placement rules;
42
+ - the mood-categorized kaomoji whitelist;
43
+ - an optional user `customPrompt`.
44
+ 3. The model emits one of the listed kaomoji where it fits. Because kaomoji
45
+ are plain text, no custom rendering is needed in the chat UI.
46
+
47
+ Settings use a dedicated loopback RPC channel (`/dsh-kaomoji-settings`):
48
+
49
+ 1. The Settings → General card reads/writes `~/.dsh/dsh-kaomoji.json`.
50
+ 2. The Host updates the prompt section and emits `system-prompt/change`
51
+ immediately, so the next reply follows the new settings without a restart.
52
+
53
+ Prompt injection is preferred over post-processing the stream because it avoids
54
+ stream parsing, sentence-boundary guessing, and keyword-based sentiment
55
+ guessing, and it follows the same mechanism as plugins like `dsh-emoji`.
56
+
57
+ ## Install
58
+
59
+ Prerequisites: a dsh Web Profile with `@deepseek-ai/dsh-system-prompt`,
60
+ Node.js `^22.19.0 || >=24.0.0`, pnpm 11.
61
+
62
+ ```powershell
63
+ cd "$env:USERPROFILE\.dsh\profiles\web"
64
+
65
+ # Option A: install straight from GitHub (works today)
66
+ dsh plugin --profile web add github:TianJie52009/dsh-kaomoji
67
+
68
+ # Option B: install from npm (after the package is published)
69
+ dsh plugin --profile web add dsh-kaomoji
70
+
71
+ # Local development build
72
+ pnpm add file:C:\path\to\dsh-kaomoji
73
+ ```
74
+
75
+ > If you install with pnpm manually, make sure `"dsh-kaomoji"` is listed in
76
+ > `dsh.profile.bundles` inside `package.json`.
77
+
78
+ Restart the Web Host afterwards (or let `dsh-hot-reload` mount it live).
79
+ The Host starts injecting the guidance; the Web client adds the
80
+ “Kaomoji (dsh-kaomoji)” card at the bottom of **Settings → General**.
81
+
82
+ ## Configuration
83
+
84
+ Defaults are ready to use (`mode: auto`). There are two settings layers:
85
+
86
+ 1. **Deployment defaults**: override `config` for `id: dsh-kaomoji` in the
87
+ profile’s `cordis.patch.yml`;
88
+ 2. **User settings**: edited in the Settings → General card and stored in
89
+ `~/.dsh/dsh-kaomoji.json`; user settings win. “Reset to defaults” removes
90
+ the user layer and falls back to the deployment defaults.
91
+
92
+ Example `cordis.patch.yml`:
93
+
94
+ ```yaml
95
+ - id: dsh-kaomoji
96
+ config:
97
+ mode: frequent # off | auto | frequent
98
+ placement: end # inline | end
99
+ maxPerTurn: 2
100
+ customPrompt: "Keep it professional; prefer thanks/encourage kaomoji"
101
+ ```
102
+
103
+ | Key | Type | Default | Description |
104
+ | --- | --- | --- | --- |
105
+ | `mode` | `'off' \| 'auto' \| 'frequent'` | `'auto'` | `off` disables; `auto` uses kaomoji only when helpful; `frequent` adds one to every conversational reply (code-only/formal replies excluded) |
106
+ | `placement` | `'inline' \| 'end'` | `'inline'` | Put the kaomoji after the best-matching sentence, or at the reply end |
107
+ | `maxPerTurn` | `number` (1–5) | `1` | Max kaomoji per reply |
108
+ | `customPrompt` | `string` | `''` | Extra style/scene guidance; cannot change mode, whitelist or limits |
109
+ | `settingsFile` | `string` | `~/.dsh/dsh-kaomoji.json` | (advanced) user-settings file path |
110
+
111
+ Card edits take effect immediately; deployment-default edits in
112
+ `cordis.patch.yml` require a dsh restart.
113
+
114
+ ## Kaomoji library & attribution
115
+
116
+ The built-in library lives in [`data/catalog.json`](./data/catalog.json), with a
117
+ source URL per category:
118
+
119
+ | Mood | Source page |
120
+ | --- | --- |
121
+ | happy | [happy-kaomoji](https://www.kaomojiya.org/happy-kaomoji) |
122
+ | love | [love-kaomoji](https://www.kaomojiya.org/love-kaomoji) |
123
+ | sad | [sad-kaomoji](https://www.kaomojiya.org/sad-kaomoji) |
124
+ | cry | [cry-kaomoji](https://www.kaomojiya.org/cry-kaomoji) |
125
+ | angry | [angry-kaomoji](https://www.kaomojiya.org/angry-kaomoji) |
126
+ | surprised | [odoroiteru-kaomoji](https://www.kaomojiya.org/odoroiteru-kaomoji) |
127
+ | confused | [komaru-kaomoji](https://www.kaomojiya.org/komaru-kaomoji) |
128
+ | shy / playful | [shy-kaomoji](https://www.kaomojiya.org/shy-kaomoji) |
129
+ | encourage | [hagemasu-kaomoji](https://www.kaomojiya.org/hagemasu-kaomoji) |
130
+ | thanks | [thanks-kaomoji](https://www.kaomojiya.org/thanks-kaomoji) |
131
+ | sorry | [sorry-kaomoji](https://www.kaomojiya.org/sorry-kaomoji) |
132
+
133
+ Kaomojiya states the pages are free to use (no registration required, personal
134
+ and commercial use allowed). This plugin ships a small hand-picked subset and
135
+ keeps the source attribution. The plugin code itself is MIT-licensed.
136
+
137
+ To extend the library, update both `data/catalog.json` (full catalog) and the
138
+ `CATALOG` constant in `lib/index.js` (the prompt whitelist).
139
+
140
+ ## Development
141
+
142
+ ```text
143
+ dsh-kaomoji/
144
+ ├── lib/
145
+ │ ├── index.js # Host: config, guidance builder, section registration, settings RPC
146
+ │ ├── client.js # Web: Settings → General card (ModuleLoader format)
147
+ │ └── index.d.ts # TypeScript declarations
148
+ ├── data/
149
+ │ └── catalog.json # curated kaomoji library with source URLs
150
+ ├── test/
151
+ │ ├── plugin.test.mjs# Host unit tests (guidance + settings RPC)
152
+ │ └── client.test.mjs# Client ModuleLoader/store tests
153
+ ├── cordis.patch.yml # dsh bundle patch
154
+ ├── package.json
155
+ ├── README.md / README.en.md
156
+ ├── CHANGELOG.md
157
+ └── LICENSE
158
+ ```
159
+
160
+ ```powershell
161
+ npm test # run unit tests
162
+ npm pack # verify the publish payload (runs npm test via prepack)
163
+ ```
164
+
165
+ Inspect the injected guidance quickly:
166
+
167
+ ```powershell
168
+ node -e "import('./lib/index.js').then((m) => console.log(m.buildGuidance({ mode: 'frequent', placement: 'end' })))"
169
+ ```
170
+
171
+ ### Publishing to npm (maintainers)
172
+
173
+ The bare-name install (`dsh plugin --profile web add dsh-kaomoji`) requires a
174
+ real npm release. `registry.npmmirror.com` is a read-only mirror and cannot
175
+ publish, so log in to the official registry once:
176
+
177
+ ```powershell
178
+ npm login --registry https://registry.npmjs.org
179
+ npm publish --access public --registry https://registry.npmjs.org
180
+ ```
181
+
182
+ `package.json` already pins `publishConfig.registry` to
183
+ `https://registry.npmjs.org/`.
184
+
185
+ ## Compatibility
186
+
187
+ - Targets the npm `@deepseek-ai/dsh` rc.7 runtime line.
188
+ - Peer deps: `@deepseek-ai/cordis`, `@deepseek-ai/dsh-system-prompt`, plus the
189
+ Web client peers (`dsh-client-*`, `react`) — all optional, provided by the
190
+ Web Profile shared runtime.
191
+ - Coexists with [dsh-emoji](https://github.com/hellodigua/dsh-emoji): different
192
+ prompt section names/orders (`dsh-emoji:guidance` @175 vs
193
+ `dsh-kaomoji:guidance` @176), settings namespace, RPC channel, and card slot
194
+ (Plugins page vs General). Kaomoji are plain text, so dsh-emoji’s stream
195
+ rewrite (which handles canonical Unicode emoji only) never touches them.
196
+
197
+ ## FAQ
198
+
199
+ - **Why does the model sometimes skip kaomoji in `auto` mode?** That is by
200
+ design. Only `frequent` requires one per conversational reply.
201
+ - **Can I use kaomoji outside the whitelist?** Yes — put the exact string in
202
+ `customPrompt`; explicit user requests are an exception to the whitelist.
203
+ - **Will code replies be polluted?** No. The rules forbid kaomoji inside code
204
+ blocks, inline code, links, tables, and tool output.
205
+ - **Where is the settings card?** At the bottom of Settings → General (after
206
+ language, appearance, composer rows). Changes save live; “Reset to defaults”
207
+ is available in the card.
208
+ - **Does it conflict with dsh-emoji?** No technical conflict (see
209
+ Compatibility). If both run in `frequent` mode a reply may contain an emoji
210
+ and a kaomoji — keep one of them in `auto` (or turn one off) for the cleanest
211
+ look.
212
+
213
+ ## License
214
+
215
+ [MIT](./LICENSE)
216
+
217
+ Kaomoji characters are sourced from [顔文字屋 kaomojiya.org](https://www.kaomojiya.org/)
218
+ (free for personal and commercial use per the site).
package/README.md ADDED
@@ -0,0 +1,226 @@
1
+ # dsh-kaomoji
2
+
3
+ > 给 [DeepSeek Harness](https://github.com/deepseek-ai)(dsh)的回复自动添加日式颜文字(kaomoji)。
4
+
5
+ [![npm](https://img.shields.io/npm/v/dsh-kaomoji.svg)](https://www.npmjs.com/package/dsh-kaomoji)
6
+ [![license](https://img.shields.io/github/license/TianJie52009/dsh-kaomoji.svg)](./LICENSE)
7
+ [![node](https://img.shields.io/node/v/dsh-kaomoji.svg)](https://nodejs.org)
8
+
9
+ > 🤖 **纯 Codex 生成**:本仓库的代码与文档均由 OpenAI Codex 自动生成,未经人工逐行审查。使用前请自行阅读并测试。
10
+
11
+ `dsh-kaomoji` 是一个零第三方依赖的 dsh 插件:它在模型生成前向系统提示词注入一段「情绪 → 颜文字」白名单规则,让模型按回复情绪**原样复制**一个真实、可读的颜文字。精选词库来自日本最大的颜文字站之一 [顔文字屋 kaomojiya.org](https://www.kaomojiya.org/)。
12
+
13
+ [English](./README.en.md) | 简体中文
14
+
15
+ ## 特性
16
+
17
+ - **纯提示词方案**:不截断、不改写模型流,也不额外调用模型,稳定且对 KV 缓存友好。
18
+ - **白名单防乱码**:模型只会从词库中逐字符复制颜文字,不会凭印象拼出坏字符。
19
+ - **情绪分桶**:内置 12 个情绪分类(开心 / 心动 / 难过 / 大哭 / 生气 / 惊讶 / 困惑 / 害羞 / 俏皮 / 鼓励 / 感谢 / 道歉),并随规则给出可用样例。
20
+ - **三种频率模式**:`auto`(智能点缀,默认)/ `frequent`(每条对话回复都带)/ `off`(关闭)。
21
+ - **放置位置可选**:贴在情绪最贴切的句子后(`inline`,默认)或固定在回复末尾(`end`)。
22
+ - **可视化配置卡片**:卡片位于「设置 → 通用设置」,保存即生效、无需重启。
23
+ - **零第三方运行时依赖**:只用 dsh 自带的 `systemPrompt` 服务与 Node 标准库。
24
+
25
+ ## 工作原理
26
+
27
+ 1. 插件启动时通过 `ctx.systemPrompt.section()` 注册一段名为 `dsh-kaomoji:guidance`、顺序号为 `176` 的提示词段。
28
+ 2. 每次组装模型提示词时,该段会把下面的内容交给模型:
29
+ - 当前模式与放置规则(如「每条回复一个」「不要放进代码块」);
30
+ - 按情绪分类的颜文字白名单;
31
+ - 用户附加的 `customPrompt`(可选)。
32
+ 3. 模型生成时在合适位置直接输出列表内的颜文字——因为它只是普通文本,聊天界面无需任何自定义渲染即可显示。
33
+
34
+ 设置部分走独立的 loopback RPC(`/dsh-kaomoji-settings`):
35
+
36
+ 1. 「设置 → 通用设置」的卡片读取/写入 `~/.dsh/dsh-kaomoji.json`;
37
+ 2. Host 收到写入后立刻更新提示词段并发出 `system-prompt/change`,**下一次回复就生效**,不需要重启。
38
+
39
+ 选择提示词注入而不是「流后处理追加」的原因:
40
+
41
+ - 不需要解析流式输出、判断句子边界或猜测情绪,规避追加错位的风险;
42
+ - 由模型在上下文里选择最贴切的情绪桶,而不是按关键词硬猜;
43
+ - 与 dsh-emoji 等既有插件保持同一套机制,行为可预期。
44
+
45
+ ### 效果示例
46
+
47
+ `frequent + end` 模式下的回复结尾:
48
+
49
+ ```text
50
+ 当然可以,我帮你把正则改成忽略大小写再跑一次测试。
51
+ 测试已经全绿了 (๑•̀ㅂ•́)و✧
52
+ ```
53
+
54
+ ## 安装
55
+
56
+ ### 环境要求
57
+
58
+ - dsh(DeepSeek Harness)Web Profile,内置 `@deepseek-ai/dsh-system-prompt`
59
+ - Node.js `^22.19.0 || >=24.0.0`
60
+ - pnpm 11(dsh 默认使用 pnpm)
61
+
62
+ ### 方式一:从 GitHub 直装(现在就能用)
63
+
64
+ 无需等 npm 发布,dsh CLI 支持直接装 GitHub 仓库:
65
+
66
+ ```powershell
67
+ dsh plugin --profile web add github:TianJie52009/dsh-kaomoji
68
+ ```
69
+
70
+ 等价的 pnpm 写法:
71
+
72
+ ```powershell
73
+ cd "$env:USERPROFILE\.dsh\profiles\web"
74
+ pnpm add github:TianJie52009/dsh-kaomoji
75
+ ```
76
+
77
+ ### 方式二:从 npm 安装(包发布后)
78
+
79
+ ```powershell
80
+ cd "$env:USERPROFILE\.dsh\profiles\web"
81
+
82
+ # dsh CLI 会自动把插件加入 dsh.profile.bundles
83
+ dsh plugin --profile web add dsh-kaomoji
84
+
85
+ # 本地开发版:先把仓库 clone/解压到本地,再把路径换成该目录
86
+ pnpm add file:C:\path\to\dsh-kaomoji
87
+ ```
88
+
89
+ > 用 pnpm 手动安装时,请确认 `package.json` 的 `dsh.profile.bundles` 已包含 `"dsh-kaomoji"`,否则插件不会加载。
90
+
91
+ 装好后重启 Web Host(或由已安装的 `dsh-hot-reload` 完成热挂载)。Host 端开始注入提示词;Web 端在「设置 → 通用设置」底部会出现「颜文字(dsh-kaomoji)」配置卡片。
92
+
93
+ ## 配置
94
+
95
+ 默认配置即开即用(`mode: auto`)。有两层设置:
96
+
97
+ 1. **部署默认值**:在 profile 的 `cordis.patch.yml` 中以 `id: dsh-kaomoji` 覆盖 `config`(适合管理员/装机默认);
98
+ 2. **用户设置**:通用设置卡片里修改,写入 `~/.dsh/dsh-kaomoji.json`,优先级高于部署默认值;点「恢复默认」会删掉用户层,回到部署默认值。
99
+
100
+ `cordis.patch.yml` 示例:
101
+
102
+ ```yaml
103
+ - id: dsh-kaomoji
104
+ config:
105
+ mode: frequent # off | auto | frequent
106
+ placement: end # inline | end
107
+ maxPerTurn: 2
108
+ customPrompt: "正式场景克制一点,优先使用「感谢 / 鼓励」类颜文字"
109
+ ```
110
+
111
+ ### 配置项
112
+
113
+ | 配置项 | 类型 | 默认值 | 说明 |
114
+ | --- | --- | --- | --- |
115
+ | `mode` | `'off' \| 'auto' \| 'frequent'` | `'auto'` | `off` 关闭;`auto` 只在确有助益时使用;`frequent` 每条对话回复都带一个(纯代码 / 正式技术交付除外) |
116
+ | `placement` | `'inline' \| 'end'` | `'inline'` | 放在情绪最贴切的句子/短段后,或固定在回复末尾 |
117
+ | `maxPerTurn` | `number`(1–5) | `1` | 每条回复最多允许的颜文字数量 |
118
+ | `customPrompt` | `string` | `''` | 附加风格/场景说明;不能改变模式、白名单或数量上限 |
119
+ | `settingsFile` | `string` | `~/.dsh/dsh-kaomoji.json` | (进阶)用户设置持久化文件路径 |
120
+
121
+ 卡片里的修改即时写入用户层并热生效;修改 `cordis.patch.yml` 的部署默认值后需重启 dsh。
122
+
123
+ ## 词库来源与许可
124
+
125
+ 内置词库见 [`data/catalog.json`](./data/catalog.json),每个分类都标注了 kaomojiya.org 对应的来源页:
126
+
127
+ | 情绪 | 来源页 |
128
+ | --- | --- |
129
+ | happy(开心/高兴) | [happy-kaomoji](https://www.kaomojiya.org/happy-kaomoji) |
130
+ | love(喜欢/心动) | [love-kaomoji](https://www.kaomojiya.org/love-kaomoji) |
131
+ | sad(难过/低落) | [sad-kaomoji](https://www.kaomojiya.org/sad-kaomoji) |
132
+ | cry(大哭/泪目) | [cry-kaomoji](https://www.kaomojiya.org/cry-kaomoji) |
133
+ | angry(生气/不满) | [angry-kaomoji](https://www.kaomojiya.org/angry-kaomoji) |
134
+ | surprised(惊讶/震惊) | [odoroiteru-kaomoji](https://www.kaomojiya.org/odoroiteru-kaomoji) |
135
+ | confused(困惑/困扰) | [komaru-kaomoji](https://www.kaomojiya.org/komaru-kaomoji) |
136
+ | shy(害羞) | [shy-kaomoji](https://www.kaomojiya.org/shy-kaomoji) |
137
+ | playful(俏皮/卖萌) | [shy-kaomoji](https://www.kaomojiya.org/shy-kaomoji)(てへぺろ 系) |
138
+ | encourage(鼓励/加油) | [hagemasu-kaomoji](https://www.kaomojiya.org/hagemasu-kaomoji) |
139
+ | thanks(感谢) | [thanks-kaomoji](https://www.kaomojiya.org/thanks-kaomoji) |
140
+ | sorry(道歉) | [sorry-kaomoji](https://www.kaomojiya.org/sorry-kaomoji) |
141
+
142
+ 顔文字屋的页面声明可免费使用(无需注册,商用・非商用均可)。本插件仅收录其人工精选子集,并在 `catalog.json` 中保留来源标注。本插件本体以 MIT 协议发布。
143
+
144
+ 想扩充词库时,请同步修改:
145
+
146
+ 1. [`data/catalog.json`](./data/catalog.json)——完整词库(含来源标注);
147
+ 2. [`lib/index.js`](./lib/index.js) 的 `CATALOG`——真正注入提示词的白名单。
148
+
149
+ ## 本地开发
150
+
151
+ ### 目录结构
152
+
153
+ ```text
154
+ dsh-kaomoji/
155
+ ├── lib/
156
+ │ ├── index.js # 插件入口:config 归一化、规则生成、systemPrompt 段注册
157
+ │ ├── client.js # Web 端:设置 → 通用设置 的配置卡片(ModuleLoader 格式)
158
+ │ └── index.d.ts # TypeScript 声明
159
+ ├── data/
160
+ │ └── catalog.json # 情绪 -> 颜文字 精选词库(含来源标注)
161
+ ├── test/
162
+ │ └── plugin.test.mjs# node:test 单元测试
163
+ ├── cordis.patch.yml # dsh bundle 挂载补丁
164
+ ├── package.json
165
+ ├── README.md / README.en.md
166
+ ├── CHANGELOG.md
167
+ └── LICENSE
168
+ ```
169
+
170
+ ### 常用命令
171
+
172
+ ```powershell
173
+ npm test # 运行 node:test 单元测试
174
+ npm pack # 打包验证发布内容(会先跑 prepack: npm test)
175
+ ```
176
+
177
+ 快速查看注入后的提示词规则:
178
+
179
+ ```powershell
180
+ node -e "import('./lib/index.js').then((m) => console.log(m.buildGuidance({ mode: 'frequent', placement: 'end' })))"
181
+ ```
182
+
183
+ ### 发布到 npm(维护者)
184
+
185
+ `dsh plugin --profile web add dsh-kaomoji` 这种裸包名安装依赖 npm 上的正式发布。维护者首次发布前需要登录一次官方 registry(`registry.npmmirror.com` 是只读镜像,不能发布):
186
+
187
+ ```powershell
188
+ npm login --registry https://registry.npmjs.org
189
+ npm publish --access public --registry https://registry.npmjs.org
190
+ ```
191
+
192
+ `package.json` 已声明 `publishConfig.registry = https://registry.npmjs.org/`,发布后其他人即可直接使用上面的「方式二」。
193
+
194
+ ## 兼容性
195
+
196
+ - 面向 npm `@deepseek-ai/dsh` rc.7 系运行时;
197
+ - peer 依赖:`@deepseek-ai/cordis`、`@deepseek-ai/dsh-system-prompt`(均为可选声明,由 Web Profile 提供共享运行时);
198
+ - 与 [dsh-emoji](https://github.com/hellodigua/dsh-emoji) 可共存:提示词段名/排序不同(`dsh-emoji:guidance` @175 vs `dsh-kaomoji:guidance` @176),设置命名空间、RPC 通道、卡片槽位(插件页 vs 通用设置)均无冲突;颜文字是纯文本,dsh-emoji 的流转写只处理规范 Unicode emoji,不会互相改写。
199
+
200
+ ## FAQ
201
+
202
+ ### 为什么模型偶尔没有加颜文字?
203
+
204
+ `auto` 模式本来就不要求每回合使用;只有 `frequent` 才要求「对话回复都带一个」。如果 `frequent` 下仍经常漏掉,多半是回复被模型判为纯代码/正式交付,或上下文里其它 persona 指令更强势——可用 `customPrompt` 再强调一次。
205
+
206
+ ### 我想用白名单之外的颜文字怎么办?
207
+
208
+ 在 `customPrompt` 中给出精确字符串,例如「这次回复结尾用 (=^・ω・^=) 猫猫颜文字」。规则允许用户显式指定的内容例外;若你希望长期使用,建议把它加入 `CATALOG` 与 `catalog.json`。
209
+
210
+ ### 会污染代码回复吗?
211
+
212
+ 不会。规则明确禁止把颜文字放进代码块、行内代码、链接、表格和工具输出,且代码型回复不适用 `frequent` 的「每条都带」要求。
213
+
214
+ ### 设置卡片在哪里?
215
+
216
+ 在「设置 → 通用设置」底部(主题、语言、回车行为等行之后)。卡片里可切换模式、放置位置、数量上限和附加提示词;保存即生效,也可以在卡片里一键恢复默认。
217
+
218
+ ### 和 dsh-emoji 一起用会冲突吗?
219
+
220
+ 不会产生技术冲突(见「兼容性」)。唯一要注意的是使用节奏:如果两个插件都开 `frequent`,同一条回复可能既带 😊 又带 (´∀`)。建议只让其中一个保持 `frequent`,另一个用 `auto`(或在对应设置页关掉),观感会更好。
221
+
222
+ ## License
223
+
224
+ [MIT](./LICENSE)
225
+
226
+ 词库字符来源:[顔文字屋 kaomojiya.org](https://www.kaomojiya.org/)(页面声明免费使用,商用・非商用均可)。
@@ -0,0 +1,12 @@
1
+ # dsh-kaomoji bundle layer:把颜文字插件挂载进 profile。
2
+ #
3
+ # 纯 insert(id/name) 可热挂载;想改默认行为时,在自己的 profile
4
+ # cordis.patch.yml 里用同一个 id 覆盖 config 即可,例如:
5
+ # - id: dsh-kaomoji
6
+ # config:
7
+ # mode: frequent # off | auto | frequent
8
+ # placement: end # inline | end
9
+ # maxPerTurn: 2
10
+ - insert:
11
+ - id: dsh-kaomoji
12
+ name: dsh-kaomoji
@@ -0,0 +1,83 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "dsh-kaomoji-core@1",
4
+ "source": {
5
+ "name": "顔文字屋 (Kaomojiya)",
6
+ "url": "https://www.kaomojiya.org/",
7
+ "note": "本站页面声明:注册、收费均不需要,商用・非商用皆可自由使用。本目录是该站 3000+ 颜文字中的人工精选子集(以适合对话回复的纯颜文字为主),仅供 dsh-kaomoji 本地白名单使用。"
8
+ },
9
+ "categories": [
10
+ {
11
+ "id": "happy",
12
+ "labels": { "zh": "开心/高兴", "en": "happy" },
13
+ "sourceUrl": "https://www.kaomojiya.org/happy-kaomoji",
14
+ "examples": ["(´∀`)", "(´∀`*)", "( ◜ω◝ )", "\(^o^)/", "(*´▽`*)"]
15
+ },
16
+ {
17
+ "id": "love",
18
+ "labels": { "zh": "喜欢/心动", "en": "love" },
19
+ "sourceUrl": "https://www.kaomojiya.org/love-kaomoji",
20
+ "examples": ["(♡´౪`♡)", "(●´ω`●)♡", "( ˘ ³˘)♡", "(´∀`)♡", "(。♥‿♥。)"]
21
+ },
22
+ {
23
+ "id": "sad",
24
+ "labels": { "zh": "难过/低落", "en": "sad" },
25
+ "sourceUrl": "https://www.kaomojiya.org/sad-kaomoji",
26
+ "examples": ["(´;ω;`)", "(´;ω;`)", "(。•́︿•̀。)", "(〒﹏〒)", "(இωஇ)"]
27
+ },
28
+ {
29
+ "id": "cry",
30
+ "labels": { "zh": "大哭/泪目", "en": "cry" },
31
+ "sourceUrl": "https://www.kaomojiya.org/cry-kaomoji",
32
+ "examples": ["。゚(゚´Д`゚)゚。", "(T_T)", "(ಥ_ಥ)", "(つд⊂)", "( ;∀;)"]
33
+ },
34
+ {
35
+ "id": "angry",
36
+ "labels": { "zh": "生气/不满", "en": "angry" },
37
+ "sourceUrl": "https://www.kaomojiya.org/angry-kaomoji",
38
+ "examples": ["(`ε´)", "ヽ(`Д´)ノ", "(# ゚Д゚)", "( `_ゝ´)", "(¬˛¬ )", "( ・᷄ὢ・᷅ )"]
39
+ },
40
+ {
41
+ "id": "surprised",
42
+ "labels": { "zh": "惊讶/震惊", "en": "surprised" },
43
+ "sourceUrl": "https://www.kaomojiya.org/odoroiteru-kaomoji",
44
+ "examples": ["( °Д° )", "Σ(*゚д゚*)", "Σ(゚ロ゚;)", "(〇o〇)", "(๑°ㅁ°๑)"]
45
+ },
46
+ {
47
+ "id": "confused",
48
+ "labels": { "zh": "困惑/困扰", "en": "confused" },
49
+ "sourceUrl": "https://www.kaomojiya.org/komaru-kaomoji",
50
+ "examples": ["(´・-・`)", "(^_^;)", "(´・ω・`)", "( -᷄ω-᷅ )", "(。ŏ﹏ŏ)", "╮( •́ω•̀ )╭"]
51
+ },
52
+ {
53
+ "id": "shy",
54
+ "labels": { "zh": "害羞/不好意思", "en": "shy" },
55
+ "sourceUrl": "https://www.kaomojiya.org/shy-kaomoji",
56
+ "examples": ["(〃ノдノ)", "(*ノωノ)", "(///ω///)", "(//∇//)", "(〃▽〃)"]
57
+ },
58
+ {
59
+ "id": "playful",
60
+ "labels": { "zh": "俏皮/卖萌", "en": "playful" },
61
+ "sourceUrl": "https://www.kaomojiya.org/shy-kaomoji",
62
+ "examples": ["(・ω<)", "(。•ω<。)", "(∩_∩)", "(〃´∀`〃)"]
63
+ },
64
+ {
65
+ "id": "encourage",
66
+ "labels": { "zh": "鼓励/加油", "en": "encourage" },
67
+ "sourceUrl": "https://www.kaomojiya.org/hagemasu-kaomoji",
68
+ "examples": ["(•̀ω•́)✧", "(。•̀ᴗ-)✧", "(๑•̀ㅂ•́)و✧", "(ง •̀_•́)ง", "(つω`。)"]
69
+ },
70
+ {
71
+ "id": "thanks",
72
+ "labels": { "zh": "感谢", "en": "thanks" },
73
+ "sourceUrl": "https://www.kaomojiya.org/thanks-kaomoji",
74
+ "examples": ["(人´∀`)", "(*´▽`人)", "(*˘︶˘人)", "m(_ _)m", "⸜(*ˊᵕˋ*)⸝"]
75
+ },
76
+ {
77
+ "id": "sorry",
78
+ "labels": { "zh": "道歉", "en": "sorry" },
79
+ "sourceUrl": "https://www.kaomojiya.org/sorry-kaomoji",
80
+ "examples": ["(人'д`o)", "(´。・д人)", "(。-人-。)", "m(_ _)m"]
81
+ }
82
+ ]
83
+ }