feat: surface auto project sync guidance in master chat

This commit is contained in:
kris
2026-04-04 08:53:28 +08:00
parent 6bad739ab9
commit c4ce8d4b0a
2 changed files with 24 additions and 0 deletions

View File

@@ -6233,6 +6233,17 @@ export async function completeMasterAgentTask(payload: {
body: buildProjectUnderstandingUpdateDigest(targetProject.name, understanding),
kind: "system_notice",
});
if (
understanding.recommendedNextStep?.trim() &&
previousUnderstanding?.recommendedNextStep !== understanding.recommendedNextStep
) {
pushProjectLedgerMessage(state, "master-agent", {
sender: "master",
senderLabel: "主 Agent",
body: buildProjectUnderstandingNextStepNotice(targetProject.name, understanding),
kind: "system_notice",
});
}
publishBossEvent("project.messages.updated", { projectId: "master-agent" });
publishBossEvent("conversation.updated", { projectId: "master-agent" });
}
@@ -7396,6 +7407,12 @@ function buildProjectUnderstandingUpdateDigest(projectName: string, snapshot: Pr
.join("\n");
}
function buildProjectUnderstandingNextStepNotice(projectName: string, snapshot: ProjectUnderstandingSnapshot) {
return [`建议下一步推进:${projectName}`, snapshot.recommendedNextStep?.trim() || ""]
.filter(Boolean)
.join("\n");
}
function shouldQueueProjectUnderstandingSync(project: Project, observedActivityAt: string, state: BossState) {
if (!isDispatchableThreadProject(project)) {
return false;

View File

@@ -617,6 +617,13 @@ test("imported thread projects queue hidden understanding sync tasks on newer ac
/实时状态同步和 UI 联调阶段/.test(message.body),
);
assert.ok(syncNotice, "expected master-agent conversation to receive a lightweight sync digest");
const nextStepNotice = masterAgentProject?.messages.findLast(
(message) =>
message.kind === "system_notice" &&
/建议下一步推进:智能看板主线程/.test(message.body) &&
/优先压平实时状态刷新抖动,再验证群聊调度链路。/.test(message.body),
);
assert.ok(nextStepNotice, "expected master-agent conversation to receive a lightweight next-step suggestion");
});
test("heartbeat candidates no longer auto-create chat windows from legacy projects when import draft is present", async () => {