Files
maestro/app/src/main.jsx
T
wangjia d6ae4dbe13 feat(app): 阶段2 接真实数据——REST + WS 直连本地 daemon
前端从 mock 切换到真实数据源(按 ⑧ 前端 API 契约,复用现有 :4517 daemon API):

- src/api.js:REST 封装 + WS 单向订阅(断线指数退避重连)
- src/adapt.js:纯映射层,把 API 的 camelCase 行映射成各 surface 期望形状
  (扁平任务→children 树、priority 整数→P0/1/2、complexity→cplx、终态→归档卡)
- src/app.jsx:改为 useEffect 拉取 + WS 增量刷新;decide/sync 走真实 POST;
  审批闸收紧到 plan/spec/exec_review 三态(needs_attention 仍在任务树可见)
- vite.config.js:加 /api + /ws 反代到 :4517;去掉 jsxInject(surface 走全局
  React,避免生产构建 rollup 从 design/ 解析 react 失败)
- main.jsx:移除 data.js mock 导入

验证:dev + 生产构建双通过;真实数据渲染(4 项目/审批闸带 diff/真实配额),
WS 已连接,0 console 错误。token/成本类(agentSummary)属 ⑧ ★ 新 /api/usage
(预算特性),暂留空待补。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 14:29:19 +08:00

21 lines
741 B
React
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 加载顺序很重要:globals 先注入 window.React → bundle → mock/i18n → 各 surface → App。
import './globals.js';
import '@ds/styles.css';
import './ambience.css';
import '@ds/_ds_bundle.js';
// 文案 i18n(真实数据由 src/api.js + src/adapt.js 提供,不再用 data.js mock
import '@ds/ui_kits/console/i18n.js';
// 六个整屏 surface(保持 design/ 源文件不动,作为单一真相源)
import '@ds/ui_kits/console/Sidebar.jsx';
import '@ds/ui_kits/console/EventPanel.jsx';
import '@ds/ui_kits/console/Topbar.jsx';
import '@ds/ui_kits/console/GateSection.jsx';
import '@ds/ui_kits/console/TaskTree.jsx';
import '@ds/ui_kits/console/ArchiveSection.jsx';
import { mount } from './app.jsx';
mount();