feat(serve+dashboard): write endpoints, SSE live, run dialog #129
Reference in New Issue
Block a user
Delete Branch "feat/118-serve-write-sse"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds write API endpoints + SSE live streaming to serve, and thread controls + run dialog to dashboard.
Why
RFC #118 — dashboard needs to not just view, but also operate threads and watch them in real-time.
Changes
Serve API (cli-workflow)
Dashboard
Ref
Part of #118. 262 tests pass.
Review: feat(serve+dashboard) — write endpoints, SSE live, run dialog
8 files, +467/-12. 整体不错,几个需要确认的点:
⚠️ 需要处理
1. SSE live 每次 pump 重读整个文件 (routes-live.ts:80)
每次 watch 触发都 readFile 全文再 slice,长 thread 性能隐患。建议增量读取或加 TODO。
2. POST /api/threads 是阻塞的吗? (routes-thread.ts:55)
await cmdRun()如果等 workflow 跑完才返回,请求会 hang 几分钟。需确认 cmdRun 是 fire-and-forget 还是阻塞。3. Dashboard 没用 SSE live 端点
thread-detail 仍然一次性 fetch,没连 SSE。"实时"功能写好了但前端没接入。
💡 Nits
✅ 做得好的
Verdict: Comment — 确认 #2 后 approve。
确认:
cmdRun是非阻塞的 ✅sendWorkerTcpCommand设置了awaitResponseLine: false,发完 run 指令就立刻返回{ threadId },workflow 在 worker 子进程里异步执行。POST/api/threads不会 hang。另外两个 follow-up 已开 issue 跟踪:
✅ 确认 cmdRun 非阻塞(fire-and-forget),#2 不是问题。#1 SSE 读全文和 #3 前端接 SSE 已有 Issue #128 跟踪。LGTM,合并。