mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-23 10:28:06 +00:00
feat(webui): 总览改版 —— 阶段管道滑块 / per-agent 负载环 / 通道→agent 拓扑与光点
总览页此前是一堆数字与文字块,看不出「这一轮走到哪、谁忙、消息从哪进哪出」。 本次把运行态面板改成以图形为主: - 阶段管道:七阶段滑块,由 SSE stage 事件驱动,当前阶段高亮、滑块滑过去; 一轮结束(after_output 或 2.5s 无事件)自动回到空闲,不做假动画。 - 队列与中断栈:沿用五条进度条(L1–L4 + 排队),中断栈补一条深度进度条。 - Agent 拓扑:改成「每 agent 一条横带」——左 inputch、中 agent 节点(圆环 = 负载)、 右 outputch,连线即路由;删掉旧的「归属框 + 单个内核盒」画法(看得出哪个子接了哪条输入)。 - 光点动画:channel_input(新增轻量 SSE 事件)沿 inputch→agent 连线跑; agent_output 沿 agent→outputch 连线跑。用 SMIL animateMotion,不需要 rAF 循环。 - 负载:由该 agent **自己的**调度器积压(排队 / 四级中断 / 中断栈)按级别加权折算, 环形图展示。为此把驻留子的调度器积压透出到状态面(SDK 纯追加字段)。 后端:sdk.ResidentStatus / core.ResidentInfo 增加子 agent 调度器积压四项; WebUI SSE 增加 channel_input 轻量事件(只带通道名与 agent id,不带正文)。 顺带收口对话区视觉(页签改分段控件、消息间距/气泡区分、输入区分隔线)。
This commit is contained in:
@ -61,6 +61,17 @@ type ResidentInfo struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
TableSize int `json:"table_size"`
|
||||
Table []InputchRecord `json:"table,omitempty"`
|
||||
|
||||
// Sched* 是这个驻留子**自己的**输入调度器积压摘要(排队 / 待处理中断 /
|
||||
// 中断栈 / 四级中断队列)。
|
||||
//
|
||||
// 为什么必须单列:每个驻留子是独立 agent,跑自己的事件循环与调度器
|
||||
// (见 agent.go 的 newScheduler)。KernelStatus.Scheduler 只是**根**那份,
|
||||
// 拿它代表全部子会让界面把「某个子堵死」显示成「一切正常」。
|
||||
SchedReady int `json:"sched_ready"`
|
||||
SchedPending int `json:"sched_pending"`
|
||||
SchedStack int `json:"sched_stack"`
|
||||
SchedQueues [5]int `json:"sched_queues"`
|
||||
}
|
||||
|
||||
type residentChild struct {
|
||||
@ -527,10 +538,17 @@ func (rc *residentChild) info() ResidentInfo {
|
||||
state, full := rc.state, rc.state == "contextfull"
|
||||
rc.mu.Unlock()
|
||||
table := rc.agent.inputchTableSnapshot()
|
||||
// 子自己的调度器积压(per-agent 负载展示用)。schedulerStatus 只读快照,
|
||||
// 每次状态轮询为每个子算一次,成本可忽略(驻留子数量是个位数)。
|
||||
sc := rc.agent.schedulerStatus()
|
||||
info := ResidentInfo{
|
||||
ID: rc.id, State: state, InputChs: append([]string(nil), rc.inputChs...),
|
||||
AllowedOutputs: append([]string(nil), rc.allowed...),
|
||||
ContextFull: full, CreatedAt: rc.createdAt, TableSize: len(table),
|
||||
SchedReady: sc.ReadyQueueDepth,
|
||||
SchedPending: sc.PendingInterrupts,
|
||||
SchedStack: sc.SuspendStack,
|
||||
SchedQueues: sc.InterruptQueues,
|
||||
// Rounds = 子**已执行的轮次数**(调度器的执行计数,单调不减)。
|
||||
//
|
||||
// 此前这里根本没填这个字段 ⇒ 父看到的永远是 `轮次=0`,与"处理表已有 N 条"
|
||||
|
||||
@ -312,6 +312,11 @@ func residentStatuses(list []ResidentInfo) []ResidentStatus {
|
||||
InputChs: r.InputChs,
|
||||
AllowedOutputs: r.AllowedOutputs,
|
||||
InputChTable: r.TableSize,
|
||||
// 子自己的调度器积压:per-agent 负载图靠这四项,缺了就只能画根。
|
||||
ReadyQueueDepth: r.SchedReady,
|
||||
PendingInterrupts: r.SchedPending,
|
||||
SuspendStack: r.SchedStack,
|
||||
InterruptQueues: r.SchedQueues,
|
||||
}
|
||||
if !r.CreatedAt.IsZero() {
|
||||
st.CreatedAt = r.CreatedAt.Format(time.RFC3339)
|
||||
|
||||
Reference in New Issue
Block a user