Skip to content

feat: hub client + SSE + version compat + HubLauncher (UI-1b) - #1

Merged
Smirk1921 merged 1 commit into
mainfrom
feat/phase8-ui1b
Oct 7, 2026
Merged

Smirk1921 merged 1 commit into
mainfrom
feat/phase8-ui1b

Conversation

@Smirk1921

Copy link
Copy Markdown
Owner

窗口 UI-1b — UI 联通(tts-desktop 侧)

蓝本

新增(src/hub 五件套 + HubLauncher + Rust 探测)

文件 行数 职责
src/hub/errors.ts 43 HubError 唯一错误类型
src/hub/client.ts 321 fetch 版 HubClient(16 路由 + PUT)
src/hub/sse.ts 115 EventSource 封装(自动重连)
src/hub/capabilities.ts 61 版本兼容策略 §8.3
src/hub/HubContext.ts 30 React Context
src/components/HubLauncher.tsx 187 hub 未启动引导对话框
src/components/HubLauncher.css — tokens.css 变量样式
src-tauri/src/lib.rs +50 #[tauri::command] check_hub (std::net)

版本兼容矩阵(实测 4 场景全对)

hub 状态 canReadFiles canWriteFiles isSupported
v0.7.1(当前) false false true (降级)
v0.8.0 true true true (全功能)
旧版(无 version) false false false (拒绝)
standalone true true true

自检

  • tsc --noEmit ✅
  • cargo check ✅

联通验收

tts-toolkit#4 落地后,npm run tauri dev 启动会经 HubLauncher → capabilities 判定 → 进入主界面(五面骨架已 prop 化接入真实状态)。

🤖 Generated with CreateWorkflow + GLM-5.3-Flash × 3 (concurrent)

- src/hub/errors.ts: HubError {code, message, userAction?, details?} —
  the only error type UI components catch
- src/hub/client.ts: fetch-based HubClient covering all 16 routes
  (14 existing + filesRead/filesWrite), PUT support, AbortController timeouts
- src/hub/sse.ts: EventSource wrapper for /v1/events with auto-reconnect
- src/hub/capabilities.ts: version-compat policy (≥0.7.0 supported,
  ≥0.8.0 full features, missing version = legacy reject)
- src/hub/HubContext.ts: React Context for client + caps
- src/components/HubLauncher.tsx: hub detection dialog (Tauri check_hub
  command + guided startup with one-click copy)
- src/App.tsx: caps state machine; HubLauncher gates the app until
  hub is reachable and version-supported
- src/components/{Frame,LayerNav}.tsx: prop-driven status (no hardcode)
- src-tauri/src/lib.rs: #[tauri::command] check_hub via std::net::TcpStream

tsc --noEmit and cargo check both green.
@Smirk1921
Smirk1921 merged commit e11de54 into main Oct 7, 2026
@Smirk1921
Smirk1921 deleted the feat/phase8-ui1b branch October 7, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant