From dd62068fed96ce00b9a6959c1e98244d01a7aa5c Mon Sep 17 00:00:00 2001 From: qyh15 Date: Sat, 7 Nov 2026 18:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=9A=E5=BC=80=E6=96=B0?= =?UTF-8?q?=E6=9C=9D=E5=A0=82=E5=8A=A0=E5=88=86=E6=AD=A5=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E8=BE=93=E5=87=BA=EF=BC=8C=E5=AE=9A=E4=BD=8D=E5=AE=BF=E4=B8=BB?= =?UTF-8?q?=E5=BB=BA=E4=BC=9A=E8=AF=9D=E5=A4=B1=E8=B4=A5=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- panel/lib/client.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/panel/lib/client.js b/panel/lib/client.js index c128cfc..e739c43 100644 --- a/panel/lib/client.js +++ b/panel/lib/client.js @@ -564,6 +564,7 @@ window.__ModuleLoader__.load({ h("div", { className: "sl-head" }, [ h("h1", { children: "三省六部" }), h("small", { children: team === undefined ? "尚未组建朝班" : "在朝 " + team.members.length + " 人 · 任务 " + (Array.isArray(team.tasks) ? team.tasks.length : 0) }), + h("small", { className: "sl-debug", "data-sansheng-debug": "1", children: host.getLastAction ? "· " + host.getLastAction() : "" }), h("span", { className: "sl-spacer" }), h("button", { type: "button", @@ -727,6 +728,8 @@ window.__ModuleLoader__.load({ const sessions = ctx.sessions; const conversations = new WeakMap(); let selectedSessionId; + let lastAction = "尚未操作"; + const note = (text) => { lastAction = text; try { console.log("[三省六部] " + text); } catch (error) { /* 忽略 */ } }; /** layout 服务用可选查找:直接读 ctx.layout 会命中 inject 声明守卫。 */ const layoutService = () => { @@ -1009,6 +1012,7 @@ window.__ModuleLoader__.load({ try { sessions.refreshProjections(sessionId).catch(() => {}); } catch (error) { /* 忽略 */ } } }, + getLastAction() { return lastAction; }, sendPrompt(sessionId, text) { const binding = bindingOf(sessionId); if (!binding) return Promise.resolve({ ok: false, error: "该部门还没有可用的会话" }); @@ -1042,6 +1046,7 @@ window.__ModuleLoader__.load({ if (first && first.workspaceId) workspaceId = first.workspaceId; } const request = (ws) => { + note("请求新建会话,工作区=" + String(ws || "自动") + ",现有会话 " + beforeCount + " 个"); try { ctx.uiWorkspace.startSession(ws, { agentPreset: "sansheng-liubu" }); } catch (error) { console.warn("[三省六部] 新建会话失败:", error); } }; const waitNew = (left) => { @@ -1054,10 +1059,12 @@ window.__ModuleLoader__.load({ request(workspaceId); return waitNew(15).then((first) => first || Promise.resolve().then(() => { request(undefined); return waitNew(30); })).then((sessionId) => { if (!sessionId) { + note("等待新会话超时,宿主未创建会话"); console.warn("[三省六部] 新会话未创建", { workspaceId: workspaceId, beforeCount: beforeCount }); return { ok: false, error: "宿主没有创建出新会话(工作区:" + String(workspaceId || "未识别") + ",原有会话 " + beforeCount + " 个)。请用左侧「新会话」手动建一个,并在顶部选「上朝」预设。" }; } const finish = (sent) => { + note("已建会话 " + sessionId.slice(0, 8) + ",投递" + (sent && sent.ok === false ? "失败" : "成功")); selectedSessionId = sessionId; try { ctx.uiWorkspace.openSession(sessionId); } catch (error) { /* 忽略 */ } return sent && sent.ok === false