Dashboard 开发
本页讲 扩展 dashboard。日常使用见 用户指南。
Dashboard code 位于 internal/dashboard。它是 server-rendered Go UI,使用 gateway RPC methods,而不是
import product runtime internals。
Server Routes
Routes 注册在 /dashboard 下。Page handlers 位于 page_*.go,shared routing 位于 routes.go,static
assets 位于 static/。
Route handlers 应保持薄:decode request、call RPC、assemble view data、render template 或 redirect。
RPC Proxy
Dashboard RPC calls 通过 dashboard RPC client/proxy 和 internal/protocol 中的 gateway protocol methods。
当新 dashboard feature 需要 method 时,更新 allowlist。不要从 browser proxy 任意 method names。
页面
Templates 位于 internal/dashboard/templates。每个页面应有小的 view model、deterministic empty/error
states,以及使用 fake RPC client 的 tests。
Workflow explanation 优先链接到现有 user docs,不要在 UI 中放长帮助文本。
Forms
Forms 应 post 到 dashboard handlers、validate input、call RPC,并渲染小 status fragment 或 redirect。 Secret fields 必须作为 secret refs 提交,或通过 setup RPCs 存储。
不要把提交的 token values echo 回 HTML。
本地化
Locale files 位于 internal/dashboard/locales。使用 stable keys,不要在 templates 中嵌 English strings。
添加 visible label 时,至少更新 English 和 zh-CN locale files,或明确保持该 label 非本地化。
Smoke Tests
Route behavior 用 Go handler tests。需要检查 interactive flows 或 layout-sensitive pages 时,使用现有 dashboard tests 中的 browser automation patterns。
Channel、MCP、model、chat、memory、approvals 和 roles pages 已有可复制的测试模式。