handoff 新增必填 title 参数:交接时刻的标题回写会话标题

顾问在 handoff 此刻最懂这单任务,其起的标题比首交互后自动生成(maybeGenerateTitle)
的更有价值。落地:
- definitions.json:handoff 参数加 title(必填),描述对齐 title-prompt 口径
  (3-7 词/中文 6-14 字,无引号无前缀);工具字母序复查未破坏;
- executor.toolHandoff:清洗(压空白+截 60,同 cleanTitle 口径;executor 反引用
  engine 会成环故就地实现),task.md 落盘成功后才 UPDATE sessions.title
  (切换半途失败不留「有名无书」残局);空 title 拒回执;
- engine 批尾 handoffDone:enterExecuting 前广播 title 事件,已开窗口刷详情页
  标题+重拉列表(与自动生成同链路);finalize 的 maybeGenerateTitle 见非空即跳过,
  getSession 现读 DB 无覆盖竞态;
- advising-system.txt:handoff 调用说明同步带 title(提示词与必填参数对齐)。

存量被画像污染的旧标题可被下次 handoff 直接顶掉。
This commit is contained in:
2026-09-26 07:04:06 +08:00
parent 5535d4cd0d
commit 0dca2ab7f5
4 changed files with 25 additions and 4 deletions
+7 -1
View File
@@ -820,7 +820,13 @@ async function runLoopInner(sessionId, run) {
handoffDone = true;
}
}
if (handoffDone) enterExecuting(sessionId);
if (handoffDone) {
// 顾问标题已由 toolHandoff 直写 sessions.title:广播同 maybeGenerateTitle 的 title 事件,
// 已开窗口刷详情页标题 + 重拉会话列表(finalize 的自动标题见非空即跳过,不会覆盖)。
const ht = db.prepare('SELECT title FROM sessions WHERE id = ?').get(sessionId);
if (ht && ht.title) bus.emit(sessionId, 'title', { title: ht.title });
enterExecuting(sessionId);
}
iter++;
}
if (iter >= maxIter && !run.cancelled) {