From 799f7c3edbe336f977b4a34d3b7239a3dc5dd7b4 Mon Sep 17 00:00:00 2001 From: openqj Date: Tue, 27 Oct 2026 02:27:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=BB=E5=8A=A1=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E9=93=BE=E8=B7=AF=20SSE=20(#61)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit host.py:回合通知摘要成链路条目,增量追加到 /host-traces/.jsonl(上限 5000 行);dispatch/run/goal/delegate 设链路文件 cloud/server.py:GET /tasks/{id}/trace 快照 + /trace/stream SSE(snapshot → entry → done;worktree 在别机时空链路 + 说明) console:详情链路区,运行中 fetch 流式渲染(EventSource 不能带 X-API-Key 头),终态走快照;DOM 上限 1000 条 单测:test_host_trace 7 + test_task_trace 6;host 49、cloud 525、deploy 14 全过 Co-authored-by: host --- README.md | 4 + cloud/console.html | 106 ++++++++++++++++++++ cloud/server.py | 152 ++++++++++++++++++++++++++++ cloud/tests/test_task_trace.py | 178 +++++++++++++++++++++++++++++++++ host.py | 121 ++++++++++++++++++++++ tests/test_host_trace.py | 135 +++++++++++++++++++++++++ 6 files changed, 696 insertions(+) create mode 100644 cloud/tests/test_task_trace.py create mode 100644 tests/test_host_trace.py diff --git a/README.md b/README.md index e3c4a68..1e3efd7 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,10 @@ python3 host.py daemon-stop - 云端控制面演示另起一端(不跑模型回合): `python3 -m cloud.server`(默认 127.0.0.1:8765), 除 `GET /health`、`/webhooks/*`、`/oauth/*` 外都要 `X-API-Key` 请求头。 + 任务实时链路:`GET /tasks/{id}/trace`(已结束任务的快照)与 + `GET /tasks/{id}/trace/stream`(运行中任务的 SSE:先 snapshot 再逐条 + entry,终态发 done 关流;命令台详情的链路区用 fetch 流式读它, + EventSource 不能带 X-API-Key 头故不用)。 ## GitHub PR/CI 的外部条件(真实 PR 仍缺这两样) diff --git a/cloud/console.html b/cloud/console.html index c863f22..b6cbbf9 100644 --- a/cloud/console.html +++ b/cloud/console.html @@ -137,6 +137,8 @@ +

实时链路

+
点任务行查看详情后,这里显示过程链路