feat(h5-session): Session Broker、run SSE replay 与 Finish 竞态修复

落地 H5 Session 架构 Patch 1–5(Broker 收口、Router decision、SSE taxonomy、goosed 边界检查),
并新增可选 MEMIND_RUN_STREAM_REPLAY run 事件回放与 H5 假交付 guard;修复 Finish 先于 agent-run
gate 导致 UI 永久 loading 的竞态,接入 verify:h5-session-patches 回归脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-06 14:19:48 +08:00
parent e2ad3bf62b
commit 08feae8bef
41 changed files with 2728 additions and 130 deletions
+28
View File
@@ -43,6 +43,34 @@ H5_PUBLIC_BASE_URL=http://127.0.0.1:5173
# MEMIND_RUNTIME_SLO_HOUR=23
# MEMIND_RUNTIME_SLO_MINUTE=55
# H5 Session Brokerdocs/h5-session-architecture-20260706.md Patch 1+
# 本地开发:Patch 2 接入后可设 1 验证 broker 路径;默认 0 保持 userAuth 直调。
# 103 生产:仅在灰度窗口于服务器 /Users/john/Project/Memind/.env 设置,勿把生产值写入 Git。
# MEMIND_SESSION_BROKER_ENABLED=0
# 103 生产 goosed 多实例示例(仅服务器 .env,见 docs/103-runtime-topology.md):
# TKMIND_API_TARGET=https://127.0.0.1:18006
# TKMIND_API_TARGET_1=https://127.0.0.1:18007
# H5 Router normalized decisiondocs/h5-session-architecture-20260706.md Patch 3
# 默认 0gateway 仍读 legacy route;设 1 时 gateway 优先读 classification.decision.route。
# MEMIND_ROUTER_NORMALIZED_DECISION=0
# H5 SSE event taxonomydocs/h5-session-architecture-20260706.md Patch 4
# 默认 0:不改变 SSE wire format;设 1 时在 session/run SSE payload 附加 taxonomy 字段(shadow)。
# MEMIND_SSE_EVENT_TAXONOMY=0
# H5 goosed proxy boundarydocs/h5-session-architecture-20260706.md Patch 5
# CI/发版前跑:npm run verify:goosed-proxy-boundary
# 新增 goosed 调用须走 tkmind-proxyMindSpace 例外见 goosed-proxy-boundary.mjs allowlist
# H5 public HTML 假交付 guarddocs/pending-fixes/h5-public-html-fake-delivery-guard-20260706.md
# 默认 0:仅 warn;设 1 时 Finish 后检测缺失 public/*.html / assets/* 并自动 session repair(每 session 1 次)
# MEMIND_H5_HTML_FINISH_GUARD=0
# H5 run SSE replayPatch 4b,仅本地/测试分支;默认关,未合并 main / 未上 103)
# 设 1 时 GET /agent/runs/:id/events 使用 h5_agent_run_events + Last-Event-ID 重连回放
# MEMIND_RUN_STREAM_REPLAY=0
# ===== memind_adm(独立后台服务)=====
# 平台超管 /admin-api/* 与广场运营 /api/ops/v1/* 已从公网服务拆出,独立进程运行。
# 登录仍在主域完成;后台凭 H5_COOKIE_DOMAIN=.tkmind.cn 共享的会话 Cookie 鉴权(生产务必设置)。