Commit Graph
3 Commits
Author SHA1 Message Date
gongzhiyongandClaude Opus 4.8 e32f711f26 docs: 统一 HMAC 签名回调状态口径(README ↔ event-schema)
README 将该项标 🟡「事件 envelope 与签名待 Manager 对齐」,暗示规范尚未
确定;而 event-schema.md §1 写「已实现,与 HM 一致」并给出完整规范串/头/
容差。两处口径不一致(组织规则:文档冲突应点出、不自行裁定——本次按总架构
指示统一)。

依据代码实证(swarm_runtime.py:691-702 HMAC-SHA256(timestamp.event_id.body)
→ X-Agent-Signature/Timestamp,_post_callback httpx 投递)+ event-schema §1
已含 HM 侧参数(容差 300s、去重顺序),统一为:
**机制已实现、规范与 HM 对齐、待主链路端到端联调验收**。

- README 行 11:改为「机制已实现,待主链路联调验收」并分别指向 runtime-
  contract §3 与 event-schema §1。
- event-schema.md §1:「已实现,与 HM 一致」→「机制已实现,规范与 HM 对齐;
  待主链路端到端联调验收」。

纯文档措辞,未改任何事件 schema 字段/类型/sequence/artifact(契约冻结不受影响)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 13:17:18 +08:00
gongzhiyongandClaude Opus 4.8 4aaf63cea5 docs(README): benchmark collector has landed — only scoring standard pending
The capability table claimed "🔴 规划中(采集器尚未落地)", but the benchmark
collector is in fact implemented under benchmark/: metric formulas (metrics.py:
S_swarm/G_E/G_E,c/Benchmark_Agent + governance/collaboration/communication/
robustness), live-run collection (collectors/), the 4 baseline runners (runners/),
G_E/G_E,c comparison (baselines.compare), self-cert merge (selfcert_collector),
and telemetry export to Cosmos/Blob (export/).

Updated the row to 🟡: collector landed; the remaining piece is the scoring
standard — the O (observability) formula, BASE_COEFFICIENTS, and S_gain thresholds
must be empirically calibrated from accumulated real user usage data (long-term
ticket). Keeps the honesty rule: metrics lacking real inputs return NaN, never
fabricated scores.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 01:12:43 +08:00
gongzhiyongandClaude Opus 4.8 9d07bfeb76 feat(#51): add SSE endpoint GET /api/swarms/{id}/events/stream
Real-time event stream for the cockpit, reverse-proxied by HM to the client
EventSource (orchestrator SSE → HM → client). The SSE overlay over the existing
GET /events?after=<sequence>:

- Replays history after `after`, then holds the connection and pushes new events.
- Reuses the existing swarm_events:{swarm_id} store + per-swarm INCR sequence — no
  new storage, no schema change.
- Each frame: `id: <sequence>` / `event: message` / `data: <envelope JSON>`, where
  data is byte-identical to /events so SSE and polling share one cursor space (a
  dropped SSE can fall back to /events?after=<last id> with no gap/dup).
- Supports Last-Event-ID header (takes precedence over the `after` query) for
  end-to-end resume through HM.
- Heartbeat `: ping` every ~15s + X-Accel-Buffering:no to survive nginx ingress /
  HM reverse-proxy buffering.
- Closes after a terminal event (swarm.completed/failed/stopped); releases on client
  disconnect (request.is_disconnected).
- Auth: require_runtime_auth (service token) — caller is HM, never the client direct.

Adds TERMINAL_CLIENT_EVENT_TYPES to swarm_runtime. Events are already redacted at
emit time, so frames are streamed as-is. No change to the callback POST path,
event schema, sequence, or terminal definitions (event-schema v1 frozen).

Verified: contract-freeze / runtime-contract / merge-smoke / workflow-e2e all pass;
plus a dedicated SSE check (history replay, id ordering, Last-Event-ID resume,
byte-identical envelope, terminal close).

Part of #40 (the SSE half). HM reverse-proxy side = heicode-mananger#46.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 23:07:35 +08:00