dsh-yebian 0.2.1 → 0.2.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/README.md +10 -6
- package/client.js +1 -1
- package/index.js +21 -0
- package/lib/store.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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 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
|
|
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_HOME/dsh-yebian` (default `~/.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
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
夜笺**不接** DSH 的会话/记忆服务,也**不读写** `~/.dsh/sessions` 或 cortex 的 SQLite。
|
|
17
17
|
|
|
18
|
-
- 数据只落在 `~/.dsh/dsh-yebian/<profile
|
|
18
|
+
- 数据只落在 `DSH_HOME/dsh-yebian/<profile>/`(没设 `DSH_HOME` 时是 `~/.dsh/dsh-yebian/<profile>/`);里面的 `sessions/`、`memory/` 是插件自己的同名子目录,和 DSH 的会话/记忆不是同一份东西。
|
|
19
19
|
- 启动时有物理隔离闸:数据目录只要碰到 `cortex-memory`、`cortex.sqlite`、`affection-memory`,直接拒绝启动(有负向测试)。
|
|
20
20
|
- 插件只从 host 拿 `webServer` 注册路由,不 `get`/`inject` 任何 DSH 记忆或会话服务;剧情文本不会写进 DSH 的上下文/记忆。
|
|
21
21
|
- 发布包不含 `config.json`、`sessions/`、`memory/`、API Key;卸载插件也不会碰 DSH 的数据。
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
**一键包(Windows,推荐给普通用户)**
|
|
27
27
|
|
|
28
|
-
下载 Release 里的 `dsh-yebian-0.2.
|
|
28
|
+
下载 Release 里的 `dsh-yebian-0.2.2-oneclick.zip`,解压后双击 `install.cmd`。
|
|
29
29
|
它会自动找到 DSH 的 CLI、把插件装进当前 profile 并启用 bundle;装完**完全退出 DSH 再打开**。
|
|
30
30
|
|
|
31
31
|
**npm**
|
|
@@ -36,7 +36,7 @@ dsh plugin add dsh-yebian
|
|
|
36
36
|
|
|
37
37
|
**图形界面**
|
|
38
38
|
|
|
39
|
-
`Plugins → Add plugin` → 选这个目录(开发用)或 `dsh-yebian-0.2.
|
|
39
|
+
`Plugins → Add plugin` → 选这个目录(开发用)或 `dsh-yebian-0.2.2.tgz`。
|
|
40
40
|
|
|
41
41
|
装完**重启 DSH**(host 是主进程加载的),左侧栏会出现「夜笺」。
|
|
42
42
|
|
|
@@ -75,7 +75,7 @@ dsh plugin add dsh-yebian
|
|
|
75
75
|
## 数据在哪
|
|
76
76
|
|
|
77
77
|
```
|
|
78
|
-
|
|
78
|
+
<DSH_HOME>/dsh-yebian/<profile>/
|
|
79
79
|
config.json 接口、模板、房间设置
|
|
80
80
|
personas/ 人设,一人一个 json
|
|
81
81
|
sessions/ 会话 .jsonl + .meta.json
|
|
@@ -85,8 +85,11 @@ dsh plugin add dsh-yebian
|
|
|
85
85
|
assets/ 背景、视频、音乐
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
- **数据根跟随 `DSH_HOME`**:第二个 DSH(不同 `DSH_HOME`)会用自己的 `dsh-yebian` 目录,不共用主房间的数据。
|
|
89
|
+
没设 `DSH_HOME` 时默认 `~/.dsh/dsh-yebian`。
|
|
90
|
+
|
|
88
91
|
- 按 profile 自动隔离;换 profile 就是另一套数据。**以 `link/` 本地目录方式安装时**,
|
|
89
|
-
路径里没有 `profiles/<name>/`,数据会落在
|
|
92
|
+
路径里没有 `profiles/<name>/`,数据会落在 `<DSH_HOME>/dsh-yebian/` 根目录;npm 安装则按 profile 分开。
|
|
90
93
|
- **不读也不写** DSH 的会话、cortex 记忆、~/.dsh/sessions。
|
|
91
94
|
- 想换位置:环境变量 `DSH_YEBIAN_DIR`,**只在 `DSH_YEBIAN_TEST=1` 时生效**(测试用)。
|
|
92
95
|
⚠️ `DSH_YEBIAN_TEST=1` 会同时放开 CSRF 旁路和目录限制,**绝不要在正式环境设这个变量**。
|
|
@@ -105,6 +108,7 @@ dsh plugin add dsh-yebian
|
|
|
105
108
|
- 只调你在「接入」页填的地址,不经过 DSH 的模型通道,也不读 DSH 的凭据。
|
|
106
109
|
- API 的用量与费用由你和你的服务商结算。
|
|
107
110
|
- Key 只存在 `config.json` 里;页面永远拿不到明文(只显示「已保存」)。也可以填环境变量名,优先从环境变量读。
|
|
111
|
+
⚠️ `config.json` 里的 key 是**明文**(本机文件,不加密)。如果介意,请在「接入」页填环境变量名(如 `DEEPSEEK_API_KEY`),把 key 放在环境变量里。
|
|
108
112
|
- 所有请求从本机直接发出:**接口方能看到你发送的剧情文本和提示词**。
|
|
109
113
|
|
|
110
114
|
## 安全
|
package/client.js
CHANGED
|
@@ -1325,7 +1325,7 @@ window.__ModuleLoader__.load({
|
|
|
1325
1325
|
),
|
|
1326
1326
|
h(Field, {
|
|
1327
1327
|
label: 'API Key' + (llm.hasKey ? '(已保存,留空 = 不改)' : ''),
|
|
1328
|
-
hint: '
|
|
1328
|
+
hint: '明文存在本实例的 config.json 里(不加密),不回传页面;介意就填上面的环境变量名。',
|
|
1329
1329
|
}, h('input', { type: 'password', value: form.apiKey, onChange: set('apiKey'), style: input, placeholder: llm.hasKey ? '已保存(留空不改)' : 'sk-…' })),
|
|
1330
1330
|
h(Field, {
|
|
1331
1331
|
label: '或者:读环境变量名',
|
package/index.js
CHANGED
|
@@ -17,6 +17,22 @@ import {
|
|
|
17
17
|
|
|
18
18
|
export const name = 'dsh-yebian';
|
|
19
19
|
|
|
20
|
+
let Schema = null;
|
|
21
|
+
try {
|
|
22
|
+
const mod = await import('@deepseek-ai/schemastery');
|
|
23
|
+
Schema = mod.default ?? mod;
|
|
24
|
+
} catch {
|
|
25
|
+
Schema = null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 行配置:用于 Config.listConfigs / 设置页投影。
|
|
30
|
+
* 插件自己的 LLM/房间配置仍在数据目录的 config.json(不在这里)。
|
|
31
|
+
*/
|
|
32
|
+
export const Config = Schema ? Schema.object({
|
|
33
|
+
enabled: Schema.boolean().default(true).description('总开关;关闭后不挂载 /__yebian 路由'),
|
|
34
|
+
}) : undefined;
|
|
35
|
+
|
|
20
36
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
21
37
|
const CSRF_TOKEN = randomBytes(24).toString('hex');
|
|
22
38
|
const MAX_JSON = 2 * 1024 * 1024;
|
|
@@ -234,6 +250,11 @@ function decodeHeader(v) {
|
|
|
234
250
|
}
|
|
235
251
|
|
|
236
252
|
export function apply(ctx, config) {
|
|
253
|
+
const cfg = config || {};
|
|
254
|
+
if (cfg.enabled === false) {
|
|
255
|
+
try { console.log('[yebian] 行配置 enabled=false,本次不挂载'); } catch { /* ignore */ }
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
237
258
|
store.ensureDirs();
|
|
238
259
|
const seeded = store.seedAssets(join(HERE, 'assets'));
|
|
239
260
|
if (seeded && seeded.added && seeded.added.length) {
|
package/lib/store.js
CHANGED
|
@@ -23,7 +23,13 @@ function detectProfile() {
|
|
|
23
23
|
} catch { return ''; }
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/** 当前 DSH 的家目录:优先 DSH_HOME,否则退回 ~/.dsh。 */
|
|
27
|
+
function dshHome() {
|
|
28
|
+
const h = process.env.DSH_HOME;
|
|
29
|
+
return h && String(h).trim() ? resolve(String(h).trim()) : join(homedir(), '.dsh');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const BASE_DIR = join(dshHome(), PLUGIN_KEY);
|
|
27
33
|
const PROFILE = detectProfile();
|
|
28
34
|
const TEST_MODE = process.env.DSH_YEBIAN_TEST === '1';
|
|
29
35
|
export const DIR = (TEST_MODE && process.env.DSH_YEBIAN_DIR)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-yebian",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
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",
|