Repository navigation
feat(dashboard): add session monitor room - #405
Merged
Merged
Conversation
nil-err
marked this pull request as ready for review
July 8, 2026 08:05
render() 不再 grid.innerHTML= 全量重建,改用 Map<sessionId, entry> 保持 <article> 稳定:sessionId 存在且 bodyKey(iframe URL) 不变时只更新 header, 不碰 .monitor-room-frame-wrap,iframe browsing context / WebSocket 保持存活。 - 导出 monitorRoomPanelBodyKey 纯函数供测试断言 - resize 用 requestAnimationFrame 合并 + ResizeObserver 观察容器变化 - dispose 清理:cancelAnimationFrame + disconnect + removeEventListener - 新增 4 个回归测试:status-only 变化 bodyKey 不变、removable 不进 bodyKey 等
解冲突: - sessions.ts:terminalHref 已抽到 session-terminal.ts(export const terminalHref = sessionTerminalHref),保留 master(deepcoldy#404) 新增的 sessionLocationText/isUnknownChatSession 等 - test/dashboard-create-session.test.ts:取 master 版(含更全 mock: getActiveSessionsRegistry / resolveRoleInjection injectMode)
monitorRoomPanelBodyKey 用 sessionTerminalHref(session, loc ?? null),但生产 render() 调用不传 loc → undefined ?? null = null,显式 null 让 sessionTerminalHref 的默认参 currentLocation() 失效 → 恒返 null → bodyKey 恒 'frame:none'。 后果:keyed-DOM 缓存键失效,iframe 面板首次绘制后永不因终端 URL 变化重建。 HTTPS dashboard 上尤甚(url 需 proxyPort 才非空):新加会话先显「终端不可用」, proxyPort 起来后仍卡占位,直到整页刷新。旧测试因总注入 loc 把这条路盖住了。 - 修法:sessionTerminalHref(session, loc),undefined 触发默认、null 仍 null - 加 window 桩回归测试锁生产路径:对旧代码报错(frame:none)、新代码通过
emptyPlaceholder 宿主 div 已挂 .monitor-room-empty,emptyPlaceholderHtml 又 包了一层同 class div → 空态 padding/min-height 翻倍。改为只返回内部 h2/p/a。 (Codex 二审非阻塞建议)
deepcoldy
pushed a commit
that referenced
this pull request
Jul 10, 2026
将 dashboard 迁移到 React(esbuild 按页面分包),按统一 UI 规范重构工作台/会话/洞察/工作流/群组/定时/白板/角色/Bot配置/Skills/团队/Webhook/全局设置等页面,沉淀 UI 基准规范与通用组件。含 review 修复(locate 图标/team capability/timezone/DropdownMenu/floating-scrollbars/insights/bot-defaults/legacy-workflow/替身编辑等)+ 集成 master 新功能(#404 会话筛选列/#405 监控室/#409 运行监控页/#412 lark-cli状态+飞书QR/#401 替身/#420 agentbuddy 源)。build 绿、全量 unit 0 非环境失败。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景和目标
Dashboard 目前每个会话只能单独点击「终端」查看 Web Terminal。这个 PR 新增「监控室」能力,让用户可以把多个会话的终端放在同一个页面里观察,适合长时间跟进多路任务执行状态。
功能变更情况
localStorage,不引入服务端持久化,也不会影响其他浏览器或其他用户。代码更改情况
src/dashboard/web/monitor-room-store.ts:封装监控室会话 ID 列表和「空列表显示活跃会话」开关的localStorage读写逻辑。src/dashboard/web/session-terminal.ts:抽出单会话终端 URL 生成逻辑,供会话页、监控室 iframe 和浮层复用。src/dashboard/web/monitor-room.ts:实现监控室页面渲染、手动/自动会话列表选择、终端 iframe、比例缩放、动态网格布局、浮层终端、移除和清空交互。src/dashboard/web/dashboard-routes.ts:注册#/monitor-room路由。src/dashboard/web/sessions.ts/sessions-page.tsx:增加监控室入口、批量添加按钮,并将入口改为当前页跳转。src/dashboard/web/i18n.ts:补充监控室、自动活跃开关和浮层相关中英文文案。src/dashboard/web/style.css:增加监控室网格、会话面板、iframe 容器、自动开关、浮层终端、占位态样式;补充顶部对齐、动态比例和 iframe 等比例缩放布局。test/dashboard-monitor-room.test.ts:覆盖监控列表存储、自动活跃开关存储、终端 URL、iframe 缩放几何计算和动态网格几何计算。验证情况
git diff --check通过。corepack pnpm test -- test/dashboard-monitor-room.test.ts通过,9 个用例通过。corepack pnpm exec tsc通过。node scripts/build-dashboard.mjs通过。window.innerWidth / window.innerHeight一致,列数会随窗口变化;iframe 内部终端 viewport 跟随当前真实窗口尺寸;右上角终端按钮弹出页面内浮层且不新建页面。兼容性和风险
localStorage,刷新和重开页面仍保留,但不会跨浏览器同步。