From 67046beb0a510b40dbc60727a2422edbea765cfe Mon Sep 17 00:00:00 2001 From: qyh15 Date: Thu, 26 Nov 2026 17:13:59 +0800 Subject: [PATCH] release: fix Desktop activation in v1.1.2 --- sansheng/README.md | 2 +- sansheng/index.js | 5 ++--- sansheng/package.json | 2 +- sansheng/test/wiring.test.js | 10 +++++++++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sansheng/README.md b/sansheng/README.md index 7ecdec0..657ac3d 100644 --- a/sansheng/README.md +++ b/sansheng/README.md @@ -1,4 +1,4 @@ -# 三省六部(dsh-sansheng)· v1.1.1 +# 三省六部(dsh-sansheng)· v1.1.2 在 DSH 里为每个项目提供固定的十席角色(丞相、中书、门下、尚书、吏部、户部、礼部、兵部、刑部、工部), 每席绑定一个独立的原生 root Session,模型与补充说明按项目独立保存。中间复用宿主原生会话,不替换聊天引擎。 diff --git a/sansheng/index.js b/sansheng/index.js index 39042c7..45de69a 100644 --- a/sansheng/index.js +++ b/sansheng/index.js @@ -1,4 +1,5 @@ // 三省六部宿主插件入口:只使用宿主公开注入服务,不 patch DSH,不写 profile 全局默认。 +import { randomUUID } from 'node:crypto' import { SanshengStore } from './src/host/store.js' import { GlobalModelStore } from './src/host/global-store.js' import { createModelSync } from './src/host/model-sync.js' @@ -40,9 +41,7 @@ export function apply(ctx, config = {}) { sessionController: ctx.sessionController, agents: ctx.agents, llm: ctx.llm, - // 宿主提供时用于内部消息构造与队列落盘;缺失时各模块有安全回退。 - createUserMessage: typeof ctx.createUserMessage === 'function' ? ctx.createUserMessage.bind(ctx) : undefined, - sessions: ctx.sessions ?? undefined, + createUserMessage: ({ content, source }) => ({ id: randomUUID(), role: 'user', content, source }), } const modelSync = createModelSync({ store, globalStore, host, normalizeCatalog }) const leadReporter = createLeadReporter({ store, host }) diff --git a/sansheng/package.json b/sansheng/package.json index 79c531a..da48dfe 100644 --- a/sansheng/package.json +++ b/sansheng/package.json @@ -1,6 +1,6 @@ { "name": "dsh-sansheng-liubu", - "version": "1.1.1", + "version": "1.1.2", "description": "三省六部:每个项目固定十席角色与独立会话的 DSH 插件(第一版)。", "keywords": [ "dsh-plugin", diff --git a/sansheng/test/wiring.test.js b/sansheng/test/wiring.test.js index ea4ccd2..fbcdb46 100644 --- a/sansheng/test/wiring.test.js +++ b/sansheng/test/wiring.test.js @@ -6,7 +6,15 @@ import { createFakeHost, tempStateFile } from './fake-ctx.js' test('apply 注册提示词与 /api/sansheng 路由并可处理请求', async () => { const fake = createFakeHost() const statePath = await tempStateFile() - await apply(fake.ctx, { statePath, globalSettingPath: statePath + '.global.json' }) + const ctx = new Proxy(fake.ctx, { + get(target, property, receiver) { + if (typeof property === 'string' && !(property in target) && property !== 'on' && property !== 'get') { + throw new Error(`cannot get property "${property}" without inject`) + } + return Reflect.get(target, property, receiver) + }, + }) + await apply(ctx, { statePath, globalSettingPath: statePath + '.global.json' }) assert.equal(name, 'sansheng') assert.ok(inject.includes('connection'))