面板:开新朝堂加分步调试输出,定位宿主建会话失败点
This commit is contained in:
parent
1f35f3c781
commit
dd62068fed
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue