重构 worker 对话:复用 resume 机制,改专属 goroutine 运行

把「给运行中 Worker 发消息调方向」从自建的介入持久化协议,改为复用
已有的暂停/恢复 + transcript resume 能力,实现与主 Agent chat 一致。

- 拆 runWorkerStep:抽出 runIntent(执行+善后),池子与消息路径共用一份
  善后逻辑;新增 runDetachedIntent,把意图 paused→running(不经 frontier)
  并在专属 goroutine 里直接跑,用户消息不受 3 槽池限制、随发随跑。
- 精简 sendWorkerMessage handler:校验 + emit 用户活动 + 专属运行;消息经
  ExecuteWithMessage 作为下一轮输入注入,request_id 仅做 transcript 去重。
- 删除介入 DB 协议与 15 处 activity 查询过滤(回退 exploration.go)、
  directedClaims 调度屏障、RecoverWorkerMessages 恢复、workerWake/waitWorker、
  AbortWorkIntervenedByUser。无 DB schema 改动。
- 前端:保留消息框,恢复「直接继续」(resume)按钮;发送改由 SSE 承载,
  去掉乐观插入。
- 取舍(低频可接受):消息仅存内存,不做崩溃恢复;发消息时该任务可能瞬时
  超并发 1 个 worker。

净改动 9 文件 +583/-46(原 PR 15 文件 +1940/-72)。
This commit is contained in:
Autumn-27 committed 2026-08-31 09:00:21 -04:00
1 parent ff493ae42b
commit c9bf534818
14 files changed
+237 -1568

No files matched your search

+1 -2
View File
@@ -287,9 +287,8 @@ export const api = {
sendWorkerMessage: (taskId: string, intentId: string, message: string, requestId: string) =>
post<{
id: number;
state: "open" | "running" | "paused";
state: "running";
accepted: true;
activity_seq: number;
request_id: string;
}>(`/tasks/${taskId}/intents/${intentId}/messages`, { message, request_id: requestId }),
taskLLMResolution: (id: string) => get<TaskLLMResolutions>(`/tasks/${id}/llm/resolution`),