tdsh-emoji 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 +23 -0
- package/LICENSE +21 -0
- package/README.en.md +84 -0
- package/README.md +94 -0
- package/cordis.patch.yml +15 -0
- package/data/catalog.json +70 -0
- package/lib/client.js +540 -0
- package/lib/index.d.ts +44 -0
- package/lib/index.js +410 -0
- package/package.json +98 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **tdsh-emoji** 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-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- 首个版本:向 dsh 系统提示词注入「情绪 → 标准 emoji」白名单规则,emoji 贴合
|
|
15
|
+
对应情绪的句子/短句之后。
|
|
16
|
+
- 三种模式 `off` / `auto` / `frequent`,默认 `auto`;单条回复上限 `maxPerTurn`
|
|
17
|
+
(1–10,默认 3)。
|
|
18
|
+
- 放置位置 `inline`(贴合句子,默认)/ `end`(回复结尾)。
|
|
19
|
+
- 与 dsh-kaomoji 共存:规则禁止 emoji 与颜文字出现在同一句/同一行,两者会自动
|
|
20
|
+
分散到不同句子;设置卡片同在「设置 → 通用设置」。
|
|
21
|
+
- 设置卡片通过同源路由 `POST /tdsh-emoji-settings` 读写 `~/.dsh/tdsh-emoji.json`,
|
|
22
|
+
Tailscale/局域网/SSH 转发都能保存,保存即生效。
|
|
23
|
+
- 零第三方运行时依赖;内置 `node:test` 单测。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tdsh-emoji 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,84 @@
|
|
|
1
|
+
# Tdsh-emoji
|
|
2
|
+
|
|
3
|
+
> Add standard Unicode emoji to [DeepSeek Harness](https://github.com/deepseek-ai) (dsh) replies, designed to coexist with dsh-kaomoji.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/tdsh-emoji)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
> 🤖 **Pure Codex generation** — the code and docs in this repository were
|
|
9
|
+
> generated entirely by OpenAI Codex and have not been human-reviewed.
|
|
10
|
+
|
|
11
|
+
`Tdsh-emoji` injects a “mood → emoji” whitelist into the system prompt, so the
|
|
12
|
+
model puts a standard emoji **right after the sentence or short phrase whose
|
|
13
|
+
mood it matches**. The library only uses emoji that ship with iOS, Windows and
|
|
14
|
+
Android; no skin-tone modifiers, no exotic sequences.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Inline placement** — after the matching sentence (default), or at the end of the reply (`end`).
|
|
19
|
+
- **Up to 10 per reply** — `maxPerTurn` 1–10, default 3; `frequent` spreads them across sentences.
|
|
20
|
+
- **Coexists with dsh-kaomoji** — both place decorations after sentences, so this plugin also forbids emoji and kaomoji in the **same sentence or line**; the model picks different sentences. Both settings cards live next to each other under Settings → General.
|
|
21
|
+
- **Visual settings card** — mode, placement, limit and extra guidance; saved live, no restart.
|
|
22
|
+
- **Remote-friendly** — the settings route is same-origin, so Tailscale/LAN/SSH-tunnel pages can save.
|
|
23
|
+
- **No third-party runtime dependencies** — dsh's `systemPrompt` service and Node built-ins only.
|
|
24
|
+
|
|
25
|
+
## How it works
|
|
26
|
+
|
|
27
|
+
1. Registers the prompt section `tdsh-emoji:guidance` (order `177`; dsh-kaomoji uses `176`).
|
|
28
|
+
2. Each assembly contributes mode/placement rules, the per-reply cap, the emoji whitelist, and the “never share a sentence with a kaomoji” rule.
|
|
29
|
+
3. The settings card uses `POST /tdsh-emoji-settings` to read/write `~/.dsh/tdsh-emoji.json`; the Host updates the prompt section immediately.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
cd "$env:USERPROFILE\.dsh\profiles\web"
|
|
35
|
+
|
|
36
|
+
# npm (recommended)
|
|
37
|
+
dsh plugin --profile web add tdsh-emoji
|
|
38
|
+
|
|
39
|
+
# or straight from GitHub
|
|
40
|
+
dsh plugin --profile web add github:TianJie52009/Tdsh-emoji
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Restart the Web Host; the “Emoji (tdsh-emoji)” card appears under Settings → General, right next to the dsh-kaomoji card.
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
Defaults: `mode: auto`, `placement: inline`, `maxPerTurn: 3`. Deployment defaults can be overridden in the profile’s `cordis.patch.yml`:
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
- id: tdsh-emoji
|
|
51
|
+
config:
|
|
52
|
+
mode: frequent # off | auto | frequent
|
|
53
|
+
placement: inline # inline | end
|
|
54
|
+
maxPerTurn: 5 # 1-10
|
|
55
|
+
customPrompt: "Keep it professional; prefer encourage/thanks emoji"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| Key | Type | Default | Description |
|
|
59
|
+
| --- | --- | --- | --- |
|
|
60
|
+
| `mode` | `'off' \| 'auto' \| 'frequent'` | `'auto'` | `off` disables; `auto` decorates conversational replies; `frequent` decorates every conversational reply (code-only/formal excluded) |
|
|
61
|
+
| `placement` | `'inline' \| 'end'` | `'inline'` | After the matching sentence, or at the reply end |
|
|
62
|
+
| `maxPerTurn` | `number` (1–10) | `3` | Emoji cap per reply; `frequent` spreads them across sentences |
|
|
63
|
+
| `customPrompt` | `string` | `''` | Extra style/scene guidance |
|
|
64
|
+
| `settingsFile` | `string` | `~/.dsh/tdsh-emoji.json` | (advanced) user-settings path |
|
|
65
|
+
|
|
66
|
+
## Coexistence with dsh-kaomoji
|
|
67
|
+
|
|
68
|
+
| Plugin | Inserts | Position | Conflict handling |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| dsh-kaomoji | Japanese kaomoji `(´∀`)` | after the matching sentence | emoji side forbids sharing a sentence/line |
|
|
71
|
+
| Tdsh-emoji | Standard emoji 😊 | after the matching sentence | `Never place an emoji in the same sentence or line as a kaomoji` |
|
|
72
|
+
|
|
73
|
+
Both cards live under Settings → General (order 30 / 31).
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
npm test # node:test (guidance rules + settings route + client loading)
|
|
79
|
+
npm pack # verify the publish payload
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
[MIT](./LICENSE)
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Tdsh-emoji
|
|
2
|
+
|
|
3
|
+
> 给 [DeepSeek Harness](https://github.com/deepseek-ai)(dsh)的回复自动添加标准 emoji,并且能和 dsh-kaomoji 共存。
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/tdsh-emoji)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
> 🤖 **纯 Codex 生成**:本仓库的代码与文档均由 OpenAI Codex 自动生成,未经人工逐行审查。使用前请自行阅读并测试。
|
|
9
|
+
|
|
10
|
+
`Tdsh-emoji` 在模型生成前向系统提示词注入一段「情绪 → emoji」白名单规则,让模型在**贴合情绪的句子或短句之后**放一个标准 Unicode 表情。词库只收 iOS / Windows / Android 普遍内置的表情,不用肤色修饰、组合序列和新版本 emoji,老设备也能正常显示。
|
|
11
|
+
|
|
12
|
+
## 特性
|
|
13
|
+
|
|
14
|
+
- **贴合句子**:emoji 放在最贴合情绪的句子/短句之后(`inline`,默认),或统一放回复结尾(`end`)。
|
|
15
|
+
- **单条上限 10 个**:`maxPerTurn` 范围 1–10,默认 3;`frequent` 模式下会按数量分散到不同句子。
|
|
16
|
+
- **与 dsh-kaomoji 共存**:两个插件都是“贴合句子”的插法,所以本插件额外规定 **emoji 与颜文字不得出现在同一句/同一行**,模型会把它们分到不同句子;两张设置卡片同在「设置 → 通用设置」且相邻排列。
|
|
17
|
+
- **可视化配置卡片**:模式(关闭 / 智能 / 高频)、放置位置、每条上限、附加提示词,保存即生效,无需重启。
|
|
18
|
+
- **远程可改**:设置走同源路由,Tailscale、局域网、SSH 端口转发打开页面都能保存。
|
|
19
|
+
- **零第三方运行时依赖**:只用 dsh 自带的 `systemPrompt` 与 Node 标准库。
|
|
20
|
+
|
|
21
|
+
## 工作原理
|
|
22
|
+
|
|
23
|
+
1. 启动时注册系统提示词段 `tdsh-emoji:guidance`(order `177`,dsh-kaomoji 是 `176`)。
|
|
24
|
+
2. 每次组装提示词时注入:模式与位置规则、每条上限、emoji 白名单、以及“不得与颜文字同句”的共存规则。
|
|
25
|
+
3. 设置卡片通过同源路由 `POST /tdsh-emoji-settings` 读写 `~/.dsh/tdsh-emoji.json`;Host 写入后立即更新提示词段,下一次回复生效。
|
|
26
|
+
|
|
27
|
+
## 安装
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
cd "$env:USERPROFILE\.dsh\profiles\web"
|
|
31
|
+
|
|
32
|
+
# npm(推荐)
|
|
33
|
+
dsh plugin --profile web add tdsh-emoji
|
|
34
|
+
|
|
35
|
+
# 或 GitHub 直装
|
|
36
|
+
dsh plugin --profile web add github:TianJie52009/Tdsh-emoji
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
装完重启 Web Host,在「设置 → 通用设置」中会看到「Emoji(tdsh-emoji)」卡片,就排在「颜文字(dsh-kaomoji)」旁边。
|
|
40
|
+
|
|
41
|
+
## 配置
|
|
42
|
+
|
|
43
|
+
默认 `mode: auto`、`placement: inline`、`maxPerTurn: 3`。也可以在 profile 的 `cordis.patch.yml` 里覆盖部署默认值:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
- id: tdsh-emoji
|
|
47
|
+
config:
|
|
48
|
+
mode: frequent # off | auto | frequent
|
|
49
|
+
placement: inline # inline | end
|
|
50
|
+
maxPerTurn: 5 # 1-10
|
|
51
|
+
customPrompt: "正式场景克制一点,优先用「鼓励 / 感谢」类 emoji"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| `mode` | `'off' \| 'auto' \| 'frequent'` | `'auto'` | `off` 关闭;`auto` 对话式回复基本都会带;`frequent` 每条对话回复都带(纯代码/正式交付除外) |
|
|
57
|
+
| `placement` | `'inline' \| 'end'` | `'inline'` | 贴合情绪的句子之后,或回复结尾 |
|
|
58
|
+
| `maxPerTurn` | `number`(1–10) | `3` | 单条回复 emoji 上限;`frequent` 会按数量分散到不同句子 |
|
|
59
|
+
| `customPrompt` | `string` | `''` | 附加风格/场景说明,不能改变模式、白名单或上限 |
|
|
60
|
+
| `settingsFile` | `string` | `~/.dsh/tdsh-emoji.json` | (进阶)用户设置持久化路径 |
|
|
61
|
+
|
|
62
|
+
## 与 dsh-kaomoji 共存
|
|
63
|
+
|
|
64
|
+
| 插件 | 插入内容 | 位置 | 冲突处理 |
|
|
65
|
+
| --- | --- | --- | --- |
|
|
66
|
+
| dsh-kaomoji | 日式颜文字 `(´∀`)` | 贴合情绪的句子之后 | 互不干扰:emoji 一侧明确禁止与颜文字同句/同行 |
|
|
67
|
+
| Tdsh-emoji | 标准 emoji 😊 | 贴合情绪的句子之后 | `Never place an emoji in the same sentence or line as a kaomoji` |
|
|
68
|
+
|
|
69
|
+
两张设置卡片都在「设置 → 通用设置」(order 30 / 31),可以挨着调。
|
|
70
|
+
|
|
71
|
+
## 开发
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
npm test # node:test 单测(提示词规则 + 设置路由 + client 加载)
|
|
75
|
+
npm pack # 验证发布内容
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
Tdsh-emoji/
|
|
80
|
+
├── lib/
|
|
81
|
+
│ ├── index.js # Host:config、规则生成、提示词段、设置路由
|
|
82
|
+
│ ├── client.js # Web:设置 → 通用设置 卡片
|
|
83
|
+
│ └── index.d.ts
|
|
84
|
+
├── data/catalog.json # 情绪 -> emoji 白名单
|
|
85
|
+
├── test/
|
|
86
|
+
├── cordis.patch.yml
|
|
87
|
+
├── package.json
|
|
88
|
+
├── README.md / README.en.md
|
|
89
|
+
└── CHANGELOG.md
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[MIT](./LICENSE)
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# tdsh-emoji bundle layer:把 Emoji 插件挂载进 profile。
|
|
2
|
+
#
|
|
3
|
+
# 与 dsh-kaomoji 可共存:两个插件各注入自己的装饰规则,位置都贴合影情绪
|
|
4
|
+
# 句子,但规则要求「emoji 与颜文字不得出现在同一句/同一行」,模型会把它们
|
|
5
|
+
# 分散到不同句子。设置卡片同在「设置 → 通用设置」,id 相邻排列。
|
|
6
|
+
#
|
|
7
|
+
# 想改默认行为,在自己的 profile cordis.patch.yml 里用同一个 id 覆盖 config:
|
|
8
|
+
# - id: tdsh-emoji
|
|
9
|
+
# config:
|
|
10
|
+
# mode: frequent # off | auto | frequent
|
|
11
|
+
# placement: inline # inline | end
|
|
12
|
+
# maxPerTurn: 5 # 1-10
|
|
13
|
+
- insert:
|
|
14
|
+
- id: tdsh-emoji
|
|
15
|
+
name: tdsh-emoji
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"name": "tdsh-emoji-core@1",
|
|
4
|
+
"source": {
|
|
5
|
+
"name": "Standard Unicode emoji",
|
|
6
|
+
"note": "精选各平台(iOS / Windows / Android)普遍内置的标准 Unicode 表情,避免肤色修饰、组合序列和新版本表情,保证在旧设备上也能正常显示。"
|
|
7
|
+
},
|
|
8
|
+
"categories": [
|
|
9
|
+
{
|
|
10
|
+
"id": "happy",
|
|
11
|
+
"labels": { "zh": "开心/高兴", "en": "happy" },
|
|
12
|
+
"examples": ["😀", "😄", "😊", "🌟", "✨"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "love",
|
|
16
|
+
"labels": { "zh": "喜欢/心动", "en": "love" },
|
|
17
|
+
"examples": ["😍", "😘", "❤️", "💕", "💖"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "sad",
|
|
21
|
+
"labels": { "zh": "难过/低落", "en": "sad" },
|
|
22
|
+
"examples": ["😢", "😔", "😞", "💧"]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "cry",
|
|
26
|
+
"labels": { "zh": "大哭/泪目", "en": "cry" },
|
|
27
|
+
"examples": ["😭", "😿", "💦"]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "angry",
|
|
31
|
+
"labels": { "zh": "生气/不满", "en": "angry" },
|
|
32
|
+
"examples": ["😠", "😡", "💢", "👿"]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "surprised",
|
|
36
|
+
"labels": { "zh": "惊讶/震惊", "en": "surprised" },
|
|
37
|
+
"examples": ["😮", "😲", "😱", "❗"]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "confused",
|
|
41
|
+
"labels": { "zh": "困惑/困扰", "en": "confused" },
|
|
42
|
+
"examples": ["😕", "🤔", "😅", "🤷"]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "shy",
|
|
46
|
+
"labels": { "zh": "害羞/不好意思", "en": "shy" },
|
|
47
|
+
"examples": ["😳", "🙈", "☺️", "😊"]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "playful",
|
|
51
|
+
"labels": { "zh": "俏皮/卖萌", "en": "playful" },
|
|
52
|
+
"examples": ["😜", "😝", "😉", "🤪"]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "encourage",
|
|
56
|
+
"labels": { "zh": "鼓励/加油", "en": "encourage" },
|
|
57
|
+
"examples": ["💪", "👍", "🙌", "✊", "🔥"]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "thanks",
|
|
61
|
+
"labels": { "zh": "感谢", "en": "thanks" },
|
|
62
|
+
"examples": ["🙏", "💖", "🎀", "😊"]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "sorry",
|
|
66
|
+
"labels": { "zh": "道歉", "en": "sorry" },
|
|
67
|
+
"examples": ["🙇", "😔", "🙏", "💧"]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|