dsh-yebian 0.1.1 → 0.2.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 +14 -4
- package/client.js +7 -7
- package/index.js +5 -1
- package/lib/store.js +17 -4
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,20 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
给 DSH 的一个**对话小说工作室**:写暧昧向的成年人对话与场景,数据完全留在插件自己的目录里。
|
|
4
4
|
|
|
5
|
-
> **English**: Night Letter (夜笺) is a local-first dialogue-fiction studio for DeepSeek Harness (DSH). Two rooms — 1:1 chat and a 2
|
|
5
|
+
> **English**: Night Letter (夜笺) is a local-first dialogue-fiction studio for DeepSeek Harness (DSH). Two rooms — 1:1 chat and a scene with 2 or more characters (no upper limit) — with per-session × per-character memory, stickers, wallpapers and music. Data stays under `~/.dsh/dsh-yebian`.
|
|
6
6
|
>
|
|
7
7
|
> **搜索关键词 / Search terms**: DSH 插件、DeepSeek Harness 插件、对话小说、角色扮演、互动小说、chat novel、interactive fiction、AI roleplay、character chat、local-first、dsh-plugin、deepseek-harness.
|
|
8
8
|
|
|
9
9
|
- **房间一 · 对谈**:你和一个角色逐句聊。她说的话在旁边,头像跟着;可以互发表情图。
|
|
10
|
-
- **房间二 · 剧场**:选 2
|
|
10
|
+
- **房间二 · 剧场**:选 2 个以上角色(**不设上限**),给一句场景,她们自行互动,旁白把镜头接起来;可手动「继续」,也可自动连播。人数越多,提示词越长,实际能塞多少取决于你所接模型的上下文。
|
|
11
11
|
|
|
12
12
|
> 只写**虚构成年人**。人设的年龄必填,低于 18 岁会被服务端直接拒绝保存。不写真实人物、不写未成年人。
|
|
13
13
|
|
|
14
|
+
## 和 DSH 原本的记忆完全隔离(重点)
|
|
15
|
+
|
|
16
|
+
夜笺**不接** DSH 的会话/记忆服务,也**不读写** `~/.dsh/sessions` 或 cortex 的 SQLite。
|
|
17
|
+
|
|
18
|
+
- 数据只落在 `~/.dsh/dsh-yebian/<profile>/`;里面的 `sessions/`、`memory/` 是插件自己的同名子目录,和 DSH 的会话/记忆不是同一份东西。
|
|
19
|
+
- 启动时有物理隔离闸:数据目录只要碰到 `cortex-memory`、`cortex.sqlite`、`affection-memory`,直接拒绝启动(有负向测试)。
|
|
20
|
+
- 插件只从 host 拿 `webServer` 注册路由,不 `get`/`inject` 任何 DSH 记忆或会话服务;剧情文本不会写进 DSH 的上下文/记忆。
|
|
21
|
+
- 发布包不含 `config.json`、`sessions/`、`memory/`、API Key;卸载插件也不会碰 DSH 的数据。
|
|
22
|
+
- 记忆是「会话 × 角色」的独立文件,只喂给夜笺自己的提示词,不进入 DSH 的记忆库。
|
|
23
|
+
|
|
14
24
|
## 安装
|
|
15
25
|
|
|
16
26
|
**一键包(Windows,推荐给普通用户)**
|
|
17
27
|
|
|
18
|
-
下载 Release 里的 `dsh-yebian-0.
|
|
28
|
+
下载 Release 里的 `dsh-yebian-0.2.0-oneclick.zip`,解压后双击 `install.cmd`。
|
|
19
29
|
它会自动找到 DSH 的 CLI、把插件装进当前 profile 并启用 bundle;装完**完全退出 DSH 再打开**。
|
|
20
30
|
|
|
21
31
|
**npm**
|
|
@@ -26,7 +36,7 @@ dsh plugin add dsh-yebian
|
|
|
26
36
|
|
|
27
37
|
**图形界面**
|
|
28
38
|
|
|
29
|
-
`Plugins → Add plugin` → 选这个目录(开发用)或 `dsh-yebian-0.
|
|
39
|
+
`Plugins → Add plugin` → 选这个目录(开发用)或 `dsh-yebian-0.2.0.tgz`。
|
|
30
40
|
|
|
31
41
|
装完**重启 DSH**(host 是主进程加载的),左侧栏会出现「夜笺」。
|
|
32
42
|
|
package/client.js
CHANGED
|
@@ -671,7 +671,6 @@ window.__ModuleLoader__.load({
|
|
|
671
671
|
const toggleCast = (id) => {
|
|
672
672
|
setCast((prev) => {
|
|
673
673
|
if (prev.includes(id)) return prev.filter((x) => x !== id);
|
|
674
|
-
if (prev.length >= 3) { show('最多 3 个角色。', 'error'); return prev; }
|
|
675
674
|
return [...prev, id];
|
|
676
675
|
});
|
|
677
676
|
};
|
|
@@ -727,8 +726,8 @@ window.__ModuleLoader__.load({
|
|
|
727
726
|
return h('div', { style: { ...card, color: T.text, overflowY: 'auto' } },
|
|
728
727
|
h('div', { style: { fontSize: 14, fontWeight: 600, marginBottom: 4 } }, '开一场戏'),
|
|
729
728
|
h('div', { style: { fontSize: 12, color: T.muted, marginBottom: 14, lineHeight: 1.7 } },
|
|
730
|
-
'挑 2
|
|
731
|
-
h(Field, { label: '角色(已选 ' + cast.length + '
|
|
729
|
+
'挑 2 个以上角色(不设上限),写一句场景,然后让她们自己演。旁白会把镜头接起来。'),
|
|
730
|
+
h(Field, { label: '角色(已选 ' + cast.length + ',至少 2 个,不设上限)' },
|
|
732
731
|
h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(190px, 1fr))', gap: 8 } },
|
|
733
732
|
castPool.map((p) => {
|
|
734
733
|
const on = cast.includes(p.id);
|
|
@@ -761,7 +760,7 @@ window.__ModuleLoader__.load({
|
|
|
761
760
|
err ? h('div', { style: { color: '#d08a85', fontSize: 12 } }, err) : null),
|
|
762
761
|
cast.length < 2
|
|
763
762
|
? h('div', { style: { fontSize: 11, color: T.muted, marginTop: 8, lineHeight: 1.6 } },
|
|
764
|
-
cast.length === 0 ? '
|
|
763
|
+
cast.length === 0 ? '剧场要两个人才能演:点上面的角色卡选中,选多少个都行。' : '还差 1 个角色:再点一张卡,按钮就会亮。')
|
|
765
764
|
: null,
|
|
766
765
|
);
|
|
767
766
|
}
|
|
@@ -777,9 +776,10 @@ window.__ModuleLoader__.load({
|
|
|
777
776
|
flex: 1, minHeight: 0, display: 'flex', flexDirection: 'column',
|
|
778
777
|
},
|
|
779
778
|
},
|
|
780
|
-
h('div', { style: { position: 'relative', zIndex: 1, padding: '12px 16px', ...row, borderBottom: '1px solid rgba(255,255,255,0.12)' } },
|
|
781
|
-
|
|
782
|
-
h(
|
|
779
|
+
h('div', { style: { position: 'relative', zIndex: 1, padding: '12px 16px', ...row, flexWrap: 'wrap', rowGap: 6, borderBottom: '1px solid rgba(255,255,255,0.12)' } },
|
|
780
|
+
h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 6, maxHeight: 96, overflowY: 'auto', minWidth: 0 } },
|
|
781
|
+
castPersonas.map((p) => h('div', { key: p.id, style: { display: 'flex', alignItems: 'center', gap: 6 } },
|
|
782
|
+
h(Avatar, { persona: p, size: 28 }), h('span', { style: { fontSize: 12 } }, p.name)))),
|
|
783
783
|
h('div', { style: { flex: 1 } }),
|
|
784
784
|
h('select', {
|
|
785
785
|
value: sessionId, onChange: async (e) => {
|
package/index.js
CHANGED
|
@@ -581,7 +581,11 @@ export function apply(ctx, config) {
|
|
|
581
581
|
if (sess.meta.room !== 'room2') return deny(res, '这不是剧场房间的会话', 400);
|
|
582
582
|
const cfg = store.getLlm();
|
|
583
583
|
if (!cfg.apiKey) return deny(res, '还没配置接入:去「接入」页填 API Key。', 400);
|
|
584
|
-
const
|
|
584
|
+
const castIds = [];
|
|
585
|
+
for (const id of (sess.meta.cast || [])) {
|
|
586
|
+
if (typeof id === 'string' && !castIds.includes(id)) castIds.push(id);
|
|
587
|
+
}
|
|
588
|
+
const cast = castIds.map((id) => store.getPersona(id)).filter(Boolean);
|
|
585
589
|
if (!cast.length) return deny(res, '先给这场戏选至少一个角色。', 400);
|
|
586
590
|
if (busy.has(sid)) return deny(res, '这一段还在生成,等它演完。', 409);
|
|
587
591
|
|
package/lib/store.js
CHANGED
|
@@ -240,13 +240,23 @@ export function saveTemplates(patch) {
|
|
|
240
240
|
return cur.templates;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
/** 角色列表:只做去重与类型过滤,不设人数上限。 */
|
|
244
|
+
function castIds(list) {
|
|
245
|
+
if (!Array.isArray(list)) return [];
|
|
246
|
+
const out = [];
|
|
247
|
+
for (const x of list) {
|
|
248
|
+
if (typeof x !== 'string') continue;
|
|
249
|
+
if (!out.includes(x)) out.push(x);
|
|
250
|
+
}
|
|
251
|
+
return out;
|
|
252
|
+
}
|
|
253
|
+
|
|
243
254
|
export function saveRoom(room, patch) {
|
|
244
255
|
const cur = getConfig();
|
|
245
256
|
if (room !== 'room1' && room !== 'room2') throw new Error('bad room');
|
|
246
257
|
mergeKnown(cur.rooms[room], patch || {});
|
|
247
258
|
if (room === 'room2') {
|
|
248
|
-
cur.rooms.room2.cast = (cur.rooms.room2.cast
|
|
249
|
-
.filter((x) => typeof x === 'string').slice(0, 3);
|
|
259
|
+
cur.rooms.room2.cast = castIds(cur.rooms.room2.cast);
|
|
250
260
|
}
|
|
251
261
|
writeJson(CONFIG_FILE, cur);
|
|
252
262
|
return cur.rooms[room];
|
|
@@ -364,7 +374,7 @@ export function createSession(input) {
|
|
|
364
374
|
id,
|
|
365
375
|
room,
|
|
366
376
|
title,
|
|
367
|
-
cast: room === 'room2' ? (body.cast
|
|
377
|
+
cast: room === 'room2' ? castIds(body.cast) : castIds(body.cast).slice(0, 1),
|
|
368
378
|
scene: clampText(body.scene, 4000),
|
|
369
379
|
createdAt: now(),
|
|
370
380
|
updatedAt: now(),
|
|
@@ -384,7 +394,10 @@ export function updateSession(id, patch) {
|
|
|
384
394
|
const meta = getSessionMeta(id);
|
|
385
395
|
if (!meta) return null;
|
|
386
396
|
if (patch && typeof patch.title === 'string' && patch.title.trim()) meta.title = clampText(patch.title.trim(), 60);
|
|
387
|
-
if (patch && Array.isArray(patch.cast))
|
|
397
|
+
if (patch && Array.isArray(patch.cast)) {
|
|
398
|
+
const next = castIds(patch.cast);
|
|
399
|
+
meta.cast = meta.room === 'room2' ? next : next.slice(0, 1);
|
|
400
|
+
}
|
|
388
401
|
if (patch && typeof patch.scene === 'string') meta.scene = clampText(patch.scene, 4000);
|
|
389
402
|
meta.updatedAt = now();
|
|
390
403
|
writeJson(metaFile(id), meta);
|
package/locale/en.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Night Letter",
|
|
4
|
-
"description": "A dialogue-fiction studio: room one is a one-on-one intimate chat, room two is a 2
|
|
4
|
+
"description": "A dialogue-fiction studio: room one is a one-on-one intimate chat, room two is a scene with 2 or more characters (no upper limit) that plays itself with narration. Characters, sessions, memory, sticker galleries, wallpapers, music, endpoint, and templates are owned by the plugin; its data stays inside the plugin directory and never touches DSH sessions or memory."
|
|
5
5
|
},
|
|
6
6
|
"ui": {
|
|
7
7
|
"sidebar": "Night Letter"
|
package/locale/zh.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "夜笺",
|
|
4
|
-
"description": "对话小说工作室:房间一是一对一暧昧对谈,房间二是 2
|
|
4
|
+
"description": "对话小说工作室:房间一是一对一暧昧对谈,房间二是 2 个以上角色(不设上限)带旁白的自行互动。人设、会话、记忆、表情图库、背景、音乐、接口与模板全部由插件自己管理,数据保存在插件目录内,不读写 DSH 会话与记忆。"
|
|
5
5
|
},
|
|
6
6
|
"ui": {
|
|
7
7
|
"sidebar": "夜笺"
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-yebian",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Night Letter (夜笺) — a self-contained dialogue-fiction studio for DSH: two rooms (one-on-one talk and a 2
|
|
5
|
+
"description": "Night Letter (夜笺) — a self-contained dialogue-fiction studio for DSH: two rooms (one-on-one talk and a scene with 2 or more characters, no upper limit), per-session and per-character memory, sticker galleries, wallpapers, music, and an editable OpenAI-compatible endpoint. Data lives entirely in the plugin's own directory.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./index.js",
|