运行中发送改为待发送条幅:排队 / 干预 / 立即发送

- 运行中点发送不再立即插话,改为进服务端队列(engine.pendings,内存态),
  输入框上方一行条幅:默认本轮结束后发出,队首可「干预」(当前工具跑完就插话)
  或「立即发送」(终止本轮工具调用并立刻发)。队列在服务端,关页面/重连不丢。
- 新增 closeToolBatch():给未闭合批次里缺回执的 tool_call 补合成回执,
  取消/干预/finalize 兜底三处调用;顺带修掉「中途停止后库里留孤儿 tool_calls、
  下一轮请求被上游拒收」的存量 bug。
- llm.buildMessages 加读侧配对过滤(pairedByAssistant / emittedCallIds):
  只下发本批确有回执的调用,孤儿回执也不下发,兜历史脏数据,DB/UI 不动。
- HTTP:POST /messages 支持 delivery:'queue';新增 POST/DELETE /pending/:qid;
  会话详情与 status 事件带 pending。
- 前端:条幅渲染与动作、pending_added/pending_removed/user_message 事件、
  硬中断后工具卡标「已取消」;发送始终交服务端判定,避免过期状态把 user 行
  插进工具批次中间。
- 文档:app/AGENTS.md 补生命周期、SSE 事件清单与待投递队列语义。
This commit is contained in:
2026-10-25 22:44:02 +08:00
parent 0ac161c579
commit 2e220d0a22
13 changed files with 488 additions and 25 deletions
+21
View File
@@ -1616,6 +1616,27 @@ body.pv-resizing #pv-pane iframe { pointer-events: none; }
}
@keyframes drop-overlay-in { from { opacity: 0; } to { opacity: 1; } }
/* ================= 待发送条幅(运行中排队 / 干预 / 立即发送) ================= */
/* 输入卡上方一行小条:正文单行省略 + 动作按钮。多条时逐条堆叠,每条仍是一行。
配色刻意与「编辑提示条」的蓝色区分:排队是“稍后执行”的提示态,不是输入态。 */
.send-queue { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sq-item {
display: flex; align-items: center; gap: 6px;
padding: 5px 5px 5px 11px;
border-radius: 12px; background: #fff4dc; color: #a06a00; font-size: 12.5px;
}
.sq-item .sq-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sq-item .sq-tag { flex: none; font-size: 11.5px; opacity: .75; }
.sq-item button {
flex: none; padding: 2px 9px; border-radius: 8px;
font-size: 12.5px; font-weight: 600; color: inherit; background: none; border: none;
}
.sq-item button:active { background: rgba(160, 106, 0, 0.12); }
.sq-item button:disabled { opacity: .45; }
.sq-item .sq-x { padding: 2px 7px; font-weight: 500; }
/* 已升级为「干预/立即发送」但还没到边界:按钮置灰,显示“等待当前步骤” */
.sq-item.sq-busy button:not(.sq-x) { opacity: .45; }
/* ================= 编辑已发送消息提示条 ================= */
/* 覆盖式重发:输入框内部的浅蓝提示条(嵌在 .input-shell 顶端,间距由 shell 的 gap 提供)。 */
.edit-bar {