dsh-plugin-soulbridge 0.0.0-stage → 0.0.102
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 +100 -2
- package/cordis.patch.yml +5 -0
- package/index.js +2402 -0
- package/package.json +45 -4
package/README.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugin-soulbridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把 [soulbridge](https://github.com/Jason0826/soulbridge) 接到 DSH 上的宿主适配器。
|
|
4
|
+
|
|
5
|
+
soulbridge 的核心不知道 DSH 的存在;这个包只做**接线**:在正确的时机调用四个动词,
|
|
6
|
+
把结果放进系统提示,并在失败时安静降级([ADR 0024](https://github.com/Jason0826/soulbridge/blob/main/docs/adr/0024-adapters.md))。
|
|
7
|
+
|
|
8
|
+
## 它做什么
|
|
9
|
+
|
|
10
|
+
| 时机 | 调用 | 现状 |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| 提示组装 | `context({ track: false })` → 注入 `<soul>` / `<style>` / `<affect>` / `<memories>` | 🚧 目前是占位标记 |
|
|
13
|
+
| 每条**用户**消息 | `observe(turn)` → 写记忆 + 情绪采样 | ✅ 已实现 |
|
|
14
|
+
| 会话结束 | `reflect(turns)` | ❌ 未接:`observe` 已逐轮蒸馏,`session/disposed` 在桌面端不触发 |
|
|
15
|
+
| 模型主动查询 | `recall` / `remember` 工具 | 🚧 未接 |
|
|
16
|
+
|
|
17
|
+
**不会做**:改变事实判断、编造记忆、把个人记忆写进项目文件。
|
|
18
|
+
|
|
19
|
+
日志:`~/.soulbridge/plugin.log`(`SOULBRIDGE_HOME` 可覆盖)。数据落在 `~/.soulbridge/soul.db`,
|
|
20
|
+
与 CLI 和任何其他工具共享同一个库。
|
|
21
|
+
|
|
22
|
+
## 安装(正式发版前,走 git 标签)
|
|
23
|
+
|
|
24
|
+
```powershell
|
|
25
|
+
cd $env:USERPROFILE\.dsh\profiles\desktop
|
|
26
|
+
dsh plugin --profile desktop add "github:Jason0826/dsh-plugin-soulbridge#v0.0.4"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
然后确认它出现在 `package.json` 的 `dsh.profile.bundles` 里,重启 DSH。
|
|
30
|
+
|
|
31
|
+
> `dsh plugin add` 会调用 pnpm;如果提示 store / virtual-store 不一致,见文末「已知问题」。
|
|
32
|
+
|
|
33
|
+
## 依赖
|
|
34
|
+
|
|
35
|
+
| 包 | 版本 | 说明 |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `soulbridge` | `^0.0.6` | 从 npm 安装,是第一个暴露库入口(`main`/`exports`)的版本 |
|
|
38
|
+
|
|
39
|
+
## 判读日志
|
|
40
|
+
|
|
41
|
+
| 日志 | 含义 |
|
|
42
|
+
|---|---|
|
|
43
|
+
| `apply() called (v0.0.2)` | 插件被加载(标签是历史遗留,不代表版本号) |
|
|
44
|
+
| `section registered` + `section.text() evaluated` | 注入通路成立 |
|
|
45
|
+
| `user/message source=user chars=N` | 收到用户消息 |
|
|
46
|
+
| `soul ready: db=… soul=… user=…` | core 与数据库就绪 |
|
|
47
|
+
| `observe ok: chars=… written=… affect=… confidence=…` | **整条链路成功** |
|
|
48
|
+
| `skipping profile bundle …` (stderr) | bundle 被启动器跳过,原因就在后面 |
|
|
49
|
+
|
|
50
|
+
## 卸载
|
|
51
|
+
|
|
52
|
+
```powershell
|
|
53
|
+
cd $env:USERPROFILE\.dsh\profiles\desktop
|
|
54
|
+
node "…/pnpm.mjs" remove dsh-plugin-soulbridge
|
|
55
|
+
# 或 dsh plugin --profile desktop remove dsh-plugin-soulbridge
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
再从 `dsh.profile.bundles` 里删掉 `dsh-plugin-soulbridge`,重启。
|
|
59
|
+
|
|
60
|
+
## 已知问题
|
|
61
|
+
|
|
62
|
+
### `dsh plugin add` 报 store / virtual-store 不一致
|
|
63
|
+
|
|
64
|
+
`~/.dsh` 若是指向另一块盘的目录联接,而 profile 的 `node_modules` 是在联接建立**之前**创建的,
|
|
65
|
+
pnpm 会同时报 `ERR_PNPM_UNEXPECTED_STORE` 和 `ERR_PNPM_UNEXPECTED_VIRTUAL_STORE`。
|
|
66
|
+
|
|
67
|
+
修复:在**真实路径**下重装一次依赖,让 `.modules.yaml` 记录的路径与 pnpm 的解析一致。
|
|
68
|
+
|
|
69
|
+
### profile 的 `package.json` 带 BOM 会让应用起不来
|
|
70
|
+
|
|
71
|
+
DSH 启动器对 `package.json` 直接 `JSON.parse`,不剥 BOM。用 Windows PowerShell 的
|
|
72
|
+
`Set-Content -Encoding utf8` 改它会写入 BOM,导致启动崩溃或 bundle 被静默跳过。
|
|
73
|
+
本仓库用 `scripts/profile-manifest.ps1` 改写清单,用 `scripts/check-encodings.ps1` 检查编码。
|
|
74
|
+
|
|
75
|
+
## 配置(可选)
|
|
76
|
+
|
|
77
|
+
`~/.soulbridge/plugin-config.json`:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"distill": "llm",
|
|
82
|
+
"provider": "deepseek-account",
|
|
83
|
+
"model": "deepseek-flash",
|
|
84
|
+
"maxLlmChars": 2000
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
| 字段 | 作用 |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `distill` | `rules`(默认)只在本地做规则抽取;`llm` 在**规则没抽到**时再问宿主模型 |
|
|
91
|
+
| `provider` / `model` | 宿主模型路由;只在 `distill: llm` 时使用 |
|
|
92
|
+
| `maxLlmChars` | 超过此长度的消息不送模型(跳过并记录,不做截断) |
|
|
93
|
+
|
|
94
|
+
为什么是"规则优先、模型补漏":实测规则精确率 1.00,但 26 条真实消息里漏了 19 条;
|
|
95
|
+
让模型覆盖规则没有收益,只在漏掉时补才有。宿主模型**只能在真实轮次内调用**,
|
|
96
|
+
启动时调用会被账号 provider 拒绝(见 `docs/experiment-2026-10-29-host-llm.md`)。
|
|
97
|
+
## 升级提示:新增工具需要新开会话
|
|
98
|
+
|
|
99
|
+
`ctx.inject(['tools'])` 注册的工具在**会话创建时**进入该会话的工具集。插件升级后
|
|
100
|
+
新增了工具,已经存在的会话仍然看不到它——需要新开一个会话(`/s new` 或界面新建)。
|
|
101
|
+
已经在会话里的注入、观察不受影响。
|