@xia-sc/dsh-cc-studio 0.3.2

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 xia-sc
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 ADDED
@@ -0,0 +1,295 @@
1
+ <div align="right">
2
+
3
+ [English](./README_EN.md) | 中文
4
+
5
+ </div>
6
+
7
+ # dsh-cc-studio · CCv3 角色卡工坊
8
+
9
+ > 从一句话点子到可导入 SillyTavern / Risu 的 `chara_card_v3`。专治「只有点子,世界观薄弱」。
10
+
11
+ DSH(DeepSeek Harness)插件:输入框上方的胶囊 → 全屏融合工坊,配合 `CC 模式` 预设让 LLM 通过 14 个 Tool **先问再填**、与你共创角色卡,最后一键导出 `JSON / PNG / CHARX`。
12
+
13
+ | 项目 | 值 |
14
+ | --- | --- |
15
+ | 插件包名 | `@xia-sc/dsh-cc-studio` |
16
+ | 当前版本 | `0.3.2` |
17
+ | 宿主 RPC | `/dsh-cc-studio-rpc`(自带路由,适配 dsh ≥ `0.1.5-rc.1`;已在 `0.1.6-alpha.1` 实测) |
18
+ | 客户端挂载点 | `conversation.input.dock`(胶囊)+ `shell.overlay`(工坊)+ `settings.section` |
19
+ | 落盘位置 | `~/.dsh/cc-library/`(角色卡)、`~/.dsh/cc-drafts/`(会话草稿) |
20
+
21
+ ## 安装
22
+
23
+ ### 1. 从 npm 安装(推荐)
24
+
25
+ ```bash
26
+ dsh plugin --profile web add @xia-sc/dsh-cc-studio
27
+
28
+ # 锁定版本
29
+ dsh plugin --profile web add @xia-sc/dsh-cc-studio@0.3.2
30
+ ```
31
+
32
+ **或从 GitHub 源安装**:
33
+
34
+ ```bash
35
+ dsh plugin --profile web add github:xia-sc/dsh-cc-studio
36
+ ```
37
+
38
+ `dsh plugin` 只是把参数转发给 profile 目录(`~/.dsh/profiles/web`)里的 pnpm;装完 dsh 会把 `@xia-sc/dsh-cc-studio` 自动追加到该 profile 的 `dsh.profile.bundles`,不需要手改 `package.json`。
39
+
40
+ > **0.3.2 起包名由 `@dsh-plugins/dsh-cc-studio` 改为 `@xia-sc/dsh-cc-studio`**(前者不是本项目持有的 npm scope,发布不出去)。装过旧名的先按「5. 更新与卸载」移除旧包再装新包;`~/.dsh/cc-library/`、`~/.dsh/cc-drafts/`、`~/.dsh/.agent-presets/cc/` 以及插件设置都不受影响。
41
+
42
+ - **锁定版本 / 指定分支**:`github:xia-sc/dsh-cc-studio#v0.3.0`、`...#master`(tag 见仓库 Tags)。
43
+ - **`allowBuilds` 提示**:本插件没有 `prepare` 构建脚本,正常安装不会触发 pnpm 的构建拦截;若 pnpm 仍打印该提示,把提示里给出的键加进 `~/.dsh/profiles/web/pnpm-workspace.yaml` 的 `allowBuilds` 后重跑。
44
+ - **在 DSH 会话里由 Agent 执行时**:写入位置在会话工作区之外,需先把文件权限切到 `danger-full-access`;自己在终端执行则无此限制。
45
+
46
+ ### 2. 从本地仓库安装(开发 / 调试)
47
+
48
+ ```bash
49
+ git clone https://github.com/xia-sc/dsh-cc-studio.git
50
+ cd dsh-cc-studio
51
+ dsh plugin --profile web add .
52
+ ```
53
+
54
+ 相对路径按**你执行命令时所在的目录**解析(dsh 会先把 `.`、`./xxx` 重写成绝对路径再交给 pnpm,避免误链到 profile 目录)。装出来的是 `link:` 到源码目录:改 `lib/*.js` 后重启 dsh web 生效;只改 `lib/client.js` 时刷新页面即可(若同时跑着 dsh 仓库的 `pnpm run dev:web`,客户端 bundle 会重建,连刷新都省了)。
55
+
56
+ ### 3. CC 预设(已自动安装,无需手工拷贝)
57
+
58
+ **插件挂载时会自动把 `presets/cc` 装到 `<DSH_HOME>/.agent-presets/cc`**(`DSH_HOME` 默认 `~/.dsh`),目录名固定为 `cc`——宿主与客户端都按 preset id `cc` 判定 CC 模式。装完插件、启动 `dsh web` 后即可在会话模式里选到 `CC 模式`。
59
+
60
+ 之所以需要这一步:dsh 的预设发现只扫三个根——**shipped 根**(`dsh-agent-presets` 包内自带)+ **部署 `config.roots`** + **用户根 `<DSH_HOME>/.agent-presets`**;插件包内的 `presets/` 不在其中,**「随包分发」≠「已注册」**。所以由插件在启动时把它装进用户根。
61
+
62
+ 更新策略是幂等的,且**绝不静默覆盖你的改动**:
63
+
64
+ | 目标文件状态 | 行为 |
65
+ | --- | --- |
66
+ | 不存在 | 写入模板 |
67
+ | 与模板一致 | 不动(只补记安装记录) |
68
+ | 与插件上次写入的内容一致(你没改过) | 插件升级时安全更新 |
69
+ | 你改过 / 是旧版手工拷贝(无安装记录) | **保留并告警**,不覆盖 |
70
+
71
+ 安装记录是预设目录里的 `.dsh-cc-studio-preset.json`(记版本与各文件写入时的 sha256)。若出现「已保留未覆盖」的告警而你想改用插件模板,二选一:
72
+
73
+ ```powershell
74
+ # A. 删掉旧目录,重启 dsh web 即重新自动安装
75
+ Remove-Item "$env:USERPROFILE\.dsh\.agent-presets\cc" -Recurse -Force
76
+ ```
77
+
78
+ ```bash
79
+ # B. 用环境变量强制覆盖后重启 dsh web(macOS / Linux)
80
+ DSH_CC_STUDIO_PRESET_INSTALL=force dsh web # auto(默认)| force | off
81
+ ```
82
+
83
+ ```powershell
84
+ # B. 同上(Windows PowerShell)
85
+ $env:DSH_CC_STUDIO_PRESET_INSTALL = 'force'; dsh web
86
+ ```
87
+
88
+ > 也可在插件行声明 `config.presetInstall`(需自己写 overlay patch),它的优先级高于环境变量。`off` 时请按下面的手工方式自行管理预设。
89
+
90
+ <details>
91
+ <summary>手工安装(仅在自动安装被关闭或失败时需要)</summary>
92
+
93
+ ```powershell
94
+ # Windows PowerShell(GitHub 安装)
95
+ $src = "$env:USERPROFILE\.dsh\profiles\web\node_modules\@dsh-plugins\dsh-cc-studio\presets\cc"
96
+ Copy-Item $src "$env:USERPROFILE\.dsh\.agent-presets\cc" -Recurse -Force
97
+
98
+ # 本地仓库开发时改用:$src = ".\presets\cc"
99
+ ```
100
+
101
+ ```bash
102
+ # macOS / Linux(GitHub 安装)
103
+ mkdir -p ~/.dsh/.agent-presets/cc
104
+ cp -R ~/.dsh/profiles/web/node_modules/@xia-sc/dsh-cc-studio/presets/cc/. ~/.dsh/.agent-presets/cc/
105
+ ```
106
+
107
+ > 若你自定义了 `DSH_HOME`,把上面命令里的 `~/.dsh` / `%USERPROFILE%\.dsh` 换成该路径;插件本体位于 `<DSH_HOME>/profiles/web/node_modules/@xia-sc/dsh-cc-studio/`。
108
+
109
+ `agent.cordis.yml` 在一份 `standard` 拷贝上追加 `id: cc-studio-agent, name: '@xia-sc/dsh-cc-studio/agent'`,并把 `persona` 改为「共创搭档」——先问再填、每步 1-2 问。切换会话模式后胶囊自动出现。
110
+
111
+ > 手工拷贝的目录**没有**安装记录,因此会被自动安装流程视为「你的自有文件」而跳过;想交回插件管理,删掉该目录后重启即可。
112
+
113
+ </details>
114
+
115
+ > 卸载/删除插件**不会**删除 `<DSH_HOME>/.agent-presets/cc/`(自动安装也不注册删除动作)。
116
+
117
+ ### 4. 重启与验证
118
+
119
+ ```bash
120
+ # 宿主行在启动时组合,装完必须重启 dsh web
121
+ dsh web
122
+
123
+ # 配置里应出现插件行
124
+ dsh --profile web --dump-config | findstr dsh-cc-studio # Windows
125
+ dsh --profile web --dump-config | grep dsh-cc-studio # macOS / Linux
126
+
127
+ # —— 以下两项自检需要会话 cookie:用 dsh web 启动时打印的 token 换取 ——
128
+ TOKEN='<dsh web 打印的 token>'
129
+ COOKIE=$(curl -s -D - -o /dev/null "http://127.0.0.1:3080/?token=$TOKEN" \
130
+ | sed -n 's/^[Ss]et-[Cc]ookie:[[:space:]]*\(dsh-auth-[^;]*\).*/\1/p' | head -1)
131
+
132
+ # 客户端资源应返回 200。地址形如 /plugins/??<包名>/client.js&rev=<内容哈希>:
133
+ # 缺 ?? 或缺 rev 都会 404,而 rev 每次改 lib/client.js 都会变,所以从首页里取。
134
+ ASSET=$(curl -s http://127.0.0.1:3080/ -H "cookie: $COOKIE" \
135
+ | grep -o '/plugins/??@xia-sc/dsh-cc-studio/client\.js&rev=[0-9a-f]*' | head -1)
136
+ curl -s -o /dev/null -w "%{http_code} $ASSET\n" "http://127.0.0.1:3080$ASSET" -H "cookie: $COOKIE"
137
+ # -> 200 /plugins/??@xia-sc/dsh-cc-studio/client.js&rev=…
138
+
139
+ # RPC 自检(与其它 /api 同源:需要宿主/Origin 围栏 + 会话 cookie)
140
+ curl -s http://127.0.0.1:3080/dsh-cc-studio-rpc/ping \
141
+ -H 'content-type: application/json' \
142
+ -H "cookie: $COOKIE" \
143
+ --data '{"type":"client-request","rpcId":"smoke","method":"ping","payload":{}}'
144
+ # -> {"type":"server-response","rpcId":"smoke","result":{"ok":true,"value":{"ok":true,"time":...}}}
145
+ ```
146
+
147
+ Windows PowerShell 等价写法(`rev` 同样从首页取):
148
+
149
+ ```powershell
150
+ $TOKEN='<dsh web 打印的 token>'
151
+ $s=New-Object Microsoft.PowerShell.Commands.WebRequestSession
152
+ $null=Invoke-WebRequest "http://127.0.0.1:3080/?token=$TOKEN" -WebSession $s -UseBasicParsing
153
+ $idx=(Invoke-WebRequest 'http://127.0.0.1:3080/' -WebSession $s -UseBasicParsing).Content
154
+ $asset=[regex]::Match($idx,'/plugins/\?\?@xia-sc/dsh-cc-studio/client\.js&rev=[0-9a-f]+').Value
155
+ Invoke-WebRequest "http://127.0.0.1:3080$asset" -WebSession $s -UseBasicParsing | Select-Object StatusCode
156
+ ```
157
+
158
+ 首页(`/`)与 RPC 端点都受会话 cookie 保护,不带 cookie 会得到 `401 dsh web authentication required`,这是正常行为,不代表插件没装上。会话 cookie 的**名字不是** `dsh-auth-127.0.0.1:3080`,而是 `dsh-auth-` + base64url(sha256(权威段)),本机即 `dsh-auth-VPhEEcLKeqRDBoBalzN2Nm7CnfxKhLE00pKIDWxt1sw`——从浏览器 devtools 抄,或用上面的 token 换取。另外,资源地址 `/plugins/??…&rev=…` 本身不走鉴权,缺 `??` / `rev` 只会 404,别把 404 误判成鉴权问题。浏览器刷新页面后切到 `CC 模式` 会话,输入框上方出现胶囊即安装成功。
159
+
160
+ ### 5. 更新与卸载
161
+
162
+ ```bash
163
+ # 更新到 npm 上的最新版
164
+ dsh plugin --profile web add @xia-sc/dsh-cc-studio@latest
165
+
166
+ # 更新到默认分支(master)最新提交:重新执行 add,pnpm 会重新解析
167
+ dsh plugin --profile web add github:xia-sc/dsh-cc-studio
168
+
169
+ # 若解析未前移,先移除再装
170
+ dsh plugin --profile web remove @xia-sc/dsh-cc-studio
171
+ dsh plugin --profile web add @xia-sc/dsh-cc-studio@latest
172
+
173
+ # 卸载(dsh 会同步把它从 dsh.profile.bundles 移除)
174
+ dsh plugin --profile web remove @xia-sc/dsh-cc-studio
175
+ ```
176
+
177
+ **从旧包名 `@dsh-plugins/dsh-cc-studio` 迁移**:包名变了就是另一个包,必须显式换掉,否则 `dsh.profile.bundles` 里会留下一行永远解析不到的旧名。
178
+
179
+ ```bash
180
+ dsh plugin --profile web remove @dsh-plugins/dsh-cc-studio
181
+ dsh plugin --profile web add @xia-sc/dsh-cc-studio
182
+ ```
183
+
184
+ 记录在 `~/.dsh/cc-library/` 的角色卡与 `~/.dsh/cc-drafts/` 的会话草稿不会被卸载流程删除。
185
+
186
+ ### 6. 常见问题
187
+
188
+ | 现象 | 处理 |
189
+ | --- | --- |
190
+ | 输入框上方没有胶囊 | 确认当前会话模式是 `CC 模式`;确认 `~/.dsh/.agent-presets/cc/` 下 `preset.yml` 与 `agent.cordis.yml` 都在且目录名是 `cc`(正常应由插件自动安装;缺失则看启动日志里 `[dsh-cc-studio]` 的告警);重启 dsh web 后刷新页面 |
191
+ | 工坊出现橙色条「草稿已新建」 | 该会话没有历史草稿(首次创建或草稿目录被清);已存档会话恢复时会改为蓝色条并显示 `creation_date`,下次写入后提示消失 |
192
+ | 切 CC 模式报 `invalid config: S.prefix missing required value` | `presets/cc/agent.cordis.yml` 是 0.2.22 之前的旧版(persona 用了 `text:`),重新拷贝新模板 |
193
+ | dsh 启动报 `cannot get property "webServer" without inject` | 插件版本低于 0.2.22,更新插件 |
194
+ | 校验报错 | 必填 `spec: chara_card_v3` / `spec_version: 3.0` / `group_only_greetings`;主图标需唯一;正则需合法 |
195
+ | 重启后浏览器报 `Failed to load plugins` / `web boot: 1 entry did not activate` / `import failed` | 包名迁移后**没有按新名重装**:profile 里的安装身份(`dsh.profile.bundles` 那行与 `dependencies` 里的 `link:`)还是旧名 `@dsh-plugins/dsh-cc-studio`,而包内 `package.json` 与 `lib/client.js` 已改叫 `@xia-sc/dsh-cc-studio`,客户端资源就解析不上(宿主照样起,只有浏览器那一半挂)。看一眼 `~/.dsh/profiles/web/node_modules/` 下的目录名是否等于 `package.json` 的 `name` 即可确认;修法是按新名重装(见「5. 更新与卸载」的迁移命令)→ 重启 `dsh web` → **硬刷新**(`Ctrl+Shift+R`;旧页面的引导图是缓存,普通刷新会复现同一句错) |
196
+
197
+ ## 快速上手
198
+
199
+ 1. 新建会话,会话模式选 **CC 模式**(胶囊随即出现在输入框上方)。
200
+ 2. 直接说需求:「我想做雨城记忆典当行老板娘,世界观很薄」。
201
+ 3. LLM 按 6 步推进,每一步都会先问你 1-2 个问题再落笔;每次调用 Tool,胶囊与工坊实时刷新:
202
+ `cc_get_card`(总结进度并提问)→ `cc_patch_character`(讨论气质/关系后填四件套)→ `cc_patch_world`(讨论世界侧重后补 ≥3 维,`autoLorebook`)→ `cc_add_lorebook_entries`(讨论触发词后补 ≥5,至少 1 条 `constant`)→ `cc_patch_greetings`(讨论场景后补问候语)→ `cc_validate`。
203
+ 4. 随时点胶囊进工坊手改。校验通过后:侧栏 `★ 保存当前`(已载入 ID 时原地覆盖,未载入则新建 ID)或 `+ 另存为新`,或导出 `JSON / PNG / CHARX`。后续可按 ID 载入/重命名/导出/删除(顶部 `已载入 ID:xxxx` 高亮当前卡),也可以直接对模型说「帮我载入 ID xxxx」。
204
+
205
+ ## 特性
206
+
207
+ ### 融合工坊(客户端)
208
+
209
+ - **布局**:输入框上方胶囊(CC 模式自动出现)→ `shell.overlay` 全屏工坊,左侧导航 4 页(**5维世界观 / 角色细化 / 世界书 / 校验导出**)/ 自适应主区 / 280px 已存角色侧栏 / 360px 实时 `card.json` 预览。深浅色自适应(DSW Token + 品牌紫 `#7c5cff` 固定)。
210
+ - **风格标签**:在「角色细化」中以逗号分隔编辑 `tags`,实时写回 `data.tags`。
211
+ - **5 维世界观**:年表 / 势力 / 地理 / 力量体系 / 日常 → `cc_patch_world(autoLorebook=true)` 自动生成带 `@@position / @@depth / @@activate` 的 Lorebook 条目(至少 1 条 `constant` 常驻;再次调用自动覆盖旧自动条目、保留手动条目)。每维为**预览卡片 + 展开大框编辑**(小卡显示 140 字预览/字数,点击卡片或「⛶ 编辑」弹出 720px 大框)。
212
+ - **全量长文本大框编辑**:`description / personality / scenario / system_prompt / post_history_instructions / first_mes / alternate_greetings / group_only_greetings / mes_example / creator_notes` 全部是「标签 + 右上 `⛶`」的小框 + 720px 大框,实时同步,解决多行长文在小框里难预览/编辑。
213
+ - **已存角色侧栏(ID 化 CRUD)**:280px 可折叠,高亮当前载入卡(紫框 + 顶部 `已载入 ID:xxxx`,显示 ID 前 8 位),`★ 保存当前` 在已载入 ID 时原地覆盖、`+ 另存为新` 强制新建、`✎ 重命名` / `+ 新建`;搜索/载入/导出/删除落盘 `~/.dsh/cc-library/<id>.json`。
214
+ - **导入导出**:`⬆ 导入 JSON/PNG/CHARX` 自动识别容器;`⬇ JSON` / `⬇ PNG`(1×1 占位图)/ `⬆ 写入 PNG`(写入你上传的任意 PNG,自动剥离旧 `ccv3/chara` 块并 `CRC32` 重算)/ `⬇ CHARX`(打包 `card.json`)。
215
+ - **中英双语**:完整 `zh / en` 词表(`locale: dshCcStudio`),跟随全局 `设置 → 通用 → 语言` 自动切换(胶囊/工坊/设置即时刷新,插件内无手动开关)。
216
+ - **深浅色自适应**:全量使用 `var(--dsw-alias-bg-* / border-l1/l2 / label-primary/secondary)`,主按钮/选中态固定品牌紫,刷新即生效。
217
+
218
+ ### CC 模式(模型侧 14 个 Tool)
219
+
220
+ - **6 步工作流 + 共创约束**:每步前 LLM 必须用 1-2 个开放问题征求偏好(气质/关系/世界侧重/触发词/开场场景等),严禁未讨论就一次性推断填满;角色四件套 → 五维 ≥3 → 世界书 ≥5 → 问候语 → `cc_validate` 才可收口。
221
+ `cc_get_card` / `cc_patch_character` / `cc_patch_world` / `cc_add_lorebook_entries` / `cc_patch_greetings` / `cc_validate`
222
+ - **Lorebook 精细管理**:`cc_delete_lorebook_entries` / `cc_update_lorebook_entry`。
223
+ - **已存库 CRUD(与侧栏共享 ID)**:`cc_list_library` / `cc_save_to_library` / `cc_load_from_library` / `cc_delete_from_library` / `cc_rename_in_library` / `cc_get_library_entry`——用户说「帮我更新/载入 ID xxxx」时模型可直接操作,无需手动点 UI。
224
+
225
+ ### 校验与规范
226
+
227
+ - 宿主实时校验:`spec / group_only_greetings` 必填、主图标唯一性、正则合法性,`spec: chara_card_v3 / spec_version: 3.0`。
228
+ - CCv3 全覆盖:`name / nickname / tags / description / personality / scenario / system_prompt / post_history_instructions / first_mes / alternate_greetings / group_only_greetings / mes_example / creator_notes / assets / character_book`,支持 CBS `{{char}} / {{random}} / {{roll}}`。
229
+
230
+ ## 结构
231
+
232
+ ```
233
+ dsh-cc-studio/
234
+ ├── package.json # @xia-sc/dsh-cc-studio, dsh.bundle.patch + dsh.client, exports ./client ./agent
235
+ ├── cordis.patch.yml # 宿主行插入:id dsh-cc-studio
236
+ ├── lib/
237
+ │ ├── index.js # host: /dsh-cc-studio-rpc(validate, cc_getDraft/cc_setDraft/cc_patchDraft, cc_isCcMode,
238
+ │ │ # cc_validateDraft, 已存库 cc_*Library, 容器 cc_importFromPng/cc_exportPng(+imageB64)/
239
+ │ │ # cc_importFromCharx/cc_exportCharx, CRC32/ZIP/STORE&DEFLATE)
240
+ │ ├── agent.js # CC 模式 Tools:6 步共创 + 2 Lorebook 管理 + 6 已存库 CRUD = 14 个,含「先与用户讨论」提示
241
+ │ └── client.js # client: dock 胶囊 + overlay 工坊 + settings.section(DSW Token 深浅色、品牌紫、
242
+ │ # 五维回显、长文本大框、JSON/PNG/CHARX 导入导出/写入)
243
+ ├── presets/cc/ # CC 模式预设模板(共创 persona + cc-studio-agent)
244
+ │ ├── preset.yml
245
+ │ └── agent.cordis.yml
246
+ ├── prototypes/ # A/B 融合前的对比原型(H5,浏览器直接打开)
247
+ │ ├── index.html
248
+ │ ├── prototype-a.html # 轻量浮层
249
+ │ └── prototype-b.html # 侧边常驻
250
+ ├── tests/
251
+ │ └── rpc-channel.test.mjs # host 半 RPC 通道回归(假 ctx + 真实 http,23 项断言)
252
+ ├── CHANGELOG.md # 完整版本历史
253
+ ├── README.md # 中文(默认)
254
+ └── README_EN.md # English
255
+ ```
256
+
257
+ > `dsh-cc-agent` 已于 `5f95110` 合并为 `lib/agent.js`(`@xia-sc/dsh-cc-studio/agent`),无需单独安装;`CC 模式` 预设仅挂该单一来源,不污染 `standard`。
258
+
259
+ ## 开发与测试
260
+
261
+ ```bash
262
+ pnpm test # = node tests/rpc-channel.test.mjs
263
+ node tests/rpc-channel.test.mjs # host 半 RPC 通道回归(23 项断言)
264
+ ```
265
+
266
+ - **原型预览**(本地直接打开,无需安装):`prototypes/index.html` 总览 → `prototype-a.html`(轻量浮层)/ `prototype-b.html`(侧边常驻)对比。
267
+ - **改客户端**:`lib/client.js` 改动刷新页面即可;跑着 dsh 仓库的 `pnpm run dev:web` 时可热更新。
268
+ - **改宿主**:`lib/index.js` 改动需重启 dsh web(宿主行在启动时组合)。
269
+
270
+ ## 外观
271
+
272
+ 深浅色通过 `var(--dsw-alias-*)` 自动适配(`body[data-ds-dark-theme]`),主操作固定 `#7c5cff` 保证对比度。切换路径:设置 → 外观 → 浅色/深色/跟随系统,刷新后工坊立即生效。
273
+
274
+ ## 规范依据
275
+
276
+ - [CCv3 SPEC_V3.md](https://github.com/kwaroran/character-card-spec-v3/blob/main/SPEC_V3.md)(权威)
277
+ - [concepts.md](https://github.com/kwaroran/character-card-spec-v3/blob/main/concepts.md) 已过时,仅参考
278
+
279
+ ## 更新日志
280
+
281
+ 完整历史见 [CHANGELOG.md](./CHANGELOG.md)。最近几版:
282
+
283
+ - `0.3.2` 包名迁移至 `@xia-sc/dsh-cc-studio`(原 `@dsh-plugins` 不是本项目持有的 npm scope),并首次发布到 npm;新增 `publishConfig.access` / `prepublishOnly` 等发布元数据。
284
+ - `0.3.1` 适配 dsh `0.1.6-alpha.1`:CC 预设里的 `workflow-worker-thread` 行换成 `workflow-ptc`,否则整份预设被判「加载失败」、CC 模式直接不可选。
285
+ - `0.3.0` 移除「点子」页:工坊导航改为 4 页(5维世界观 / 角色细化 / 世界书 / 校验导出),`⛶ 大框` 能力改用统一 `fieldHead()` 落到全部长文本 string 字段,侧栏搜索保留。同步修掉该改动引入的数组往返回退(`[]` 会被写成 `[""]`,即凭空多一条空白问候语);并把问候语字段改为**逐条独立编辑**(一条 = 一个编辑框),根除「多段问候语一编辑就被拆成多条」的静默损坏,顺带补上问候语增删与 10 条上限对齐。另修大框「取消」真正回滚、清掉自 67172fd 起就调不通的 `expandIdea` / `expandWorld` 死代码、**完成全量 i18n 接线**(此前词表已建好但大量调用点硬编码中文,切到 English 仍显示中文;现全部 122 条中文字面量接入词表,中文界面逐字未变)、**CC 预设改为自动安装**(此前需手工拷贝),并修掉**首次切到 CC 模式时胶囊不出现**(探测读错了 `projectionValues.agentPreset` 字段,导致必须刷新页面或切换会话才出现)。
286
+ - `0.2.22` 适配 dsh `0.1.5-rc.1` 启动崩溃:`connection.rpc.handle()` 对外部插件不可用,host 半改为在 `webServer` 上自注册 `/dsh-cc-studio-rpc` 前缀路由并实现同一套 RPC 线上协议;请求体改事件式读取;修 `presets/cc` persona 的 `prefix`;新增 23 项回归测试。
287
+ - `0.2.21` 修复 #2 草稿静默丢失:草稿变更即落盘 `~/.dsh/cc-drafts/<会话>.json`,重启/换会话自动恢复;建空会警告、恢复会提示。
288
+
289
+ ## License
290
+
291
+ MIT © 2026 xia-sc — see [LICENSE](./LICENSE).
292
+
293
+ ## 收录
294
+
295
+ [![Listed on dsh-plugin.org](https://dsh-plugin.org/badges/listed.svg)](https://dsh-plugin.org/plugins/xia-sc/dsh-cc-studio)
@@ -0,0 +1,6 @@
1
+ # @xia-sc/dsh-cc-studio — CCv3 角色卡工坊
2
+ # 融合形态:conversation.input.dock 胶囊常驻 + shell.overlay 全屏/侧边抽屉工坊
3
+ # Host 挂 /dsh-cc-studio-rpc,Client 挂 dock + overlay + settings.section
4
+ - insert:
5
+ - id: dsh-cc-studio
6
+ name: '@xia-sc/dsh-cc-studio'