lume-dsh-plugin 0.7.1 → 0.7.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 +1 -1
- package/lib/index.js +34 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -307,7 +307,7 @@ Lume 因此选择「观察 + 重锚」:压缩发生时记录规模,在随后
|
|
|
307
307
|
|
|
308
308
|
## 宿主兼容性
|
|
309
309
|
|
|
310
|
-
- **RPC 通道必须注册在注入了 `webServer`
|
|
310
|
+
- **RPC 通道必须注册在注入了 `webServer` 的作用域里,且不能包 `effect`**:宿主的 `connection.rpc.handle` 内部以**调用方 ctx** 执行 `webServer.register(route)`(`register(owner, ...)` 里是 `owner.effect(() => owner.webServer.register(route))`)。而 cordis 的 `effect` 会另起一个 **fiber**,**注入授权不随子 fiber 继承**——所以 `webCtx.effect(() => webCtx.connection.rpc.handle(...))` 仍然越权抛错(0.7.1 就栽在这),必须像宿主自带的 `dsh-ppt` 那样**直接在 inject 回调里调用**。该注册还被挪到 `apply` 末尾并加独立 try/catch:它只服务客户端菜单,失败绝不该影响人设注入与工具。0.6.2 / 0.7.0 / 0.7.1 在 DSH Desktop 0.9.1 上的故障(DSH 起不来、或界面人设菜单空白)都源于此,请升级到 ≥0.7.2。
|
|
311
311
|
- **插件不会拖垮宿主**:`apply()` 外层有兜底 try/catch,插件内部的任何异常都降级为「部分功能不可用 + `logger.error`」,不再阻断 DSH 启动。
|
|
312
312
|
- **peer 声明只留宿主运行时保证提供的包**:`@deepseek-ai/dsh-client-ui-primitives` 这类前端包由宿主模块图在运行时提供,**不声明为 peer**——新版桌面安装器做严格 peer 闭包校验,声明它会连带检查它自己的 peer(`dsh-client-runtime`),导致安装/更新被拒绝(desktop 会写进 `.generations-deferred.json` 并冻结整个 profile 迁移)。它仍在 `devDependencies`(tsc 类型与 tsdown external 需要)。
|
|
313
313
|
|
package/lib/index.js
CHANGED
|
@@ -1214,24 +1214,9 @@ function applyInner(ctx, config = {}) {
|
|
|
1214
1214
|
},
|
|
1215
1215
|
});
|
|
1216
1216
|
// ── RPC 通道 ──
|
|
1217
|
-
//
|
|
1218
|
-
//
|
|
1219
|
-
//
|
|
1220
|
-
// "cannot get property \"webServer\" without inject"。宿主自带的 dsh-ppt / dsh-api-gateway
|
|
1221
|
-
// 也都是 `ctx.inject(["webServer"], (webCtx) => webCtx.connection.rpc.handle(...))` 这个写法。
|
|
1222
|
-
// 用作用域注入而不是把 webServer 塞进顶层 inject:没有 web 载体的宿主(headless)里只
|
|
1223
|
-
// 失去 RPC 通道,插件其余功能照常工作,不会被 inject 卡住。
|
|
1224
|
-
ctx.inject(["webServer"], (webCtx) => {
|
|
1225
|
-
webCtx.effect(() => webCtx.connection.rpc.handle(LUME_CHANNEL, async (endpoint, payload) => {
|
|
1226
|
-
currentStore ??= await storesReady;
|
|
1227
|
-
identity ??= await identityReady;
|
|
1228
|
-
const result = await handleEndpoint(endpoint, payload);
|
|
1229
|
-
if (endpoint !== "list" && endpoint !== "getSessionPersona") {
|
|
1230
|
-
webCtx.logger?.warn?.(`lume: rpc ${endpoint} ${JSON.stringify(payload ?? {})} → ok=${result.ok}${result.ok ? "" : ` code=${result.error.code}`}`);
|
|
1231
|
-
}
|
|
1232
|
-
return result;
|
|
1233
|
-
}, { authority: "trusted-host" }), "lume: rpc channel");
|
|
1234
|
-
});
|
|
1217
|
+
// 挪到 apply 的最后注册:它只服务客户端菜单(人设列表/蒸馏/管理),
|
|
1218
|
+
// 绝不该挡住人设段、工具与易变段的注册(0.7.1 的教训:这里抛错 → 整段 apply 中断 → 界面看不到人设)。
|
|
1219
|
+
// 注册本身见下方 registerRpcChannel()。
|
|
1235
1220
|
// ── 系统提示词段落 ──
|
|
1236
1221
|
ctx.effect(() => ctx.systemPrompt.section({
|
|
1237
1222
|
name: LUME_PERSONA_SECTION,
|
|
@@ -1292,4 +1277,35 @@ function applyInner(ctx, config = {}) {
|
|
|
1292
1277
|
},
|
|
1293
1278
|
});
|
|
1294
1279
|
}, "lume.tool-notice-context()");
|
|
1280
|
+
registerRpcChannel(ctx);
|
|
1281
|
+
/**
|
|
1282
|
+
* 注册客户端 RPC 通道(`/lume`)。放在最后 + 独立 try/catch:
|
|
1283
|
+
* 它只服务客户端菜单,任何失败都不该影响人设注入、工具与易变段。
|
|
1284
|
+
*
|
|
1285
|
+
* 关键细节(0.7.1 踩过):必须**直接在注入作用域里调用** `connection.rpc.handle`,
|
|
1286
|
+
* 不能包 `effect`——新宿主的实现在 `register(owner, ...)` 里执行
|
|
1287
|
+
* `owner.effect(() => owner.webServer.register(route))`,而 cordis 的 `effect` 会另起
|
|
1288
|
+
* 一个 fiber,**注入授权不随子 fiber 继承**,于是 `owner.webServer` 再次越权并抛
|
|
1289
|
+
* "cannot get property \"webServer\" without inject"。宿主自带的 dsh-ppt 也正是直接在
|
|
1290
|
+
* inject 回调里调用(不包 effect)。没有 web 载体的宿主(headless)只是没有 RPC 通道。
|
|
1291
|
+
*/
|
|
1292
|
+
function registerRpcChannel(scope) {
|
|
1293
|
+
scope.inject(["webServer"], (webCtx) => {
|
|
1294
|
+
try {
|
|
1295
|
+
webCtx.connection.rpc.handle(LUME_CHANNEL, async (endpoint, payload) => {
|
|
1296
|
+
currentStore ??= await storesReady;
|
|
1297
|
+
identity ??= await identityReady;
|
|
1298
|
+
const result = await handleEndpoint(endpoint, payload);
|
|
1299
|
+
if (endpoint !== "list" && endpoint !== "getSessionPersona") {
|
|
1300
|
+
webCtx.logger?.warn?.(`lume: rpc ${endpoint} ${JSON.stringify(payload ?? {})} → ok=${result.ok}${result.ok ? "" : ` code=${result.error.code}`}`);
|
|
1301
|
+
}
|
|
1302
|
+
return result;
|
|
1303
|
+
}, { authority: "trusted-host" });
|
|
1304
|
+
}
|
|
1305
|
+
catch (error) {
|
|
1306
|
+
// 局部兜底:RPC 通道起不来只是菜单不可用,人设注入与工具必须照常。
|
|
1307
|
+
webCtx.logger?.error?.("lume: RPC 通道注册失败(仅客户端菜单不可用,其余功能不受影响)", error);
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1295
1311
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lume-dsh-plugin",
|
|
3
3
|
"description": "微光 (Lume) — DSH Desktop 增强插件:给会话装上工程纪律与真实关系。纪律层约束「如何正确完成任务」——意图路由、阶段门控、真实工具证据、交付前复核、文档能力感知;方法层把量化需求、改动台账、假设台账与项目知识变成可检查的产出,并用行为触发器在轨迹上纠偏(撒网不收敛 / 连写不验 / 死路重撞);人设层塑造「以何种风格表达」——从聊天记录、小说、剧本、设定文档蒸馏具名角色,长期记忆与风格随对话演进。约束按需注入,闲聊不额外付 token。",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|