feat(dashboard): 提供脱敏运行摘要并加固登录令牌 - #793
Merged
deepcoldy merged 4 commits intoAug 9, 2026
Merged
Conversation
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.
改动内容
GET /api/dashboard/v1/summary,以版本化、正向白名单的结构返回 fleet 健康状态、在线 bot 数、活跃/待关注会话数和排程摘要;任一 live daemon 快照失败或格式异常时返回 503,不用伪造的零值掩盖缺失状态。Retry-After;携带当前 Dashboard 登录态的请求不受匿名配额影响。stalled会话未计入 attention、daemon snapshot 字段未做最小运行时校验等摘要口径问题,并补齐中英文 API 契约、鉴权边界和 fleet/core-only 模式说明。botmux dashboard与dashboard current获取或首次创建当前 token,已有 token 时不轮换;只有dashboard rotate显式替换 token。--help出现在任意位置、未知子命令和多余参数都不会触碰凭证端点。改动目的
普通 fleet 模式缺少一个适合外部健康页、监控和编排器消费的稳定摘要接口。直接消费现有 sessions/events 会暴露过多会话细节,也会让匿名高频轮询放大为对每个在线 daemon 的实时 IPC。本次新增的强脱敏 summary 契约用于更安全地把 Botmux 的普通 Dashboard facade 作为常驻服务观测入口,并用前置限流约束 fan-out 成本;它不改变
botmux serve --api-only的 core-only 接口。原有裸
botmux dashboard会无条件轮换 token,导致dashboard rotate --help等只读意图也可能让旧链接失效。随着 token 已持久化并跨重启复用,默认“获取可用链接”、显式rotate才撤销旧链接更符合用户预期;首次尚无 token 时仍会安全创建一个,避免为了取链接再多走一步。持久化和跨进程加固保证返回给用户的链接就是所有本机 Dashboard 进程共同认可的 durable 凭证。影响面
验证
pnpm build:通过(TypeScript、Dashboard bundle、domain/dist audit)。pnpm exec vitest run test/dashboard-auth.test.ts test/dashboard-command.test.ts test/dashboard-endpoint.test.ts test/dashboard-summary.test.ts test/dashboard-summary-endpoint.test.ts test/terminal-write-auth.test.ts test/desktop/desktop-ipc-runtime-monitor.test.ts:7 files,162/162 通过。pnpm test:13,994 passed,37 skipped;并行全量运行中 2 个既有重负载用例超时,随后独立重跑:pnpm exec vitest run test/codex-app-runner.integration.test.ts:42/42 通过。pnpm exec vitest run test/cost-calculator-cache.test.ts:49/49 通过。BOTMUX_DOCS_BASE=/botmux/ BOTMUX_DOCS_ASSET_PREFIX=/botmux/ ./node_modules/.bin/rspress build(docs-site/):通过,包含页面渲染与死链检查。