feat(dashboard): 60s base refresh with event-driven immediate updates
Raise the status dashboard base refresh from 10s to 60s, and refresh immediately (debounced 1.5s) on events between ticks: - a real chat message arrives in a registered room (index.ts onMessage) - an agent starts/finishes a run, i.e. activity moves between rooms (GroupQueue.setOnActivityChange fired on activeCount changes) requestImmediateStatusUpdate() drives updateStatus out-of-band via a coalescing trigger. The existing re-entrancy guard means the base periodic refresh does not run while an edit-retry is in flight; a refresh requested during that window is remembered and runs once afterward. Adds createCoalescingTrigger with tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
13
src/index.ts
13
src/index.ts
@@ -52,7 +52,10 @@ import {
|
||||
} from './sender-allowlist.js';
|
||||
import { createMessageRuntime } from './message-runtime.js';
|
||||
import { nudgeSchedulerLoop, startSchedulerLoop } from './task-scheduler.js';
|
||||
import { startUnifiedDashboard } from './unified-dashboard.js';
|
||||
import {
|
||||
requestImmediateStatusUpdate,
|
||||
startUnifiedDashboard,
|
||||
} from './unified-dashboard.js';
|
||||
import { startUsagePrimer } from './usage-primer.js';
|
||||
import { startWebDashboardServer } from './web-dashboard-server.js';
|
||||
import { Channel, NewMessage, RegisteredGroup } from './types.js';
|
||||
@@ -395,6 +398,11 @@ async function main(): Promise<void> {
|
||||
}
|
||||
}
|
||||
storeMessage(msg);
|
||||
// A real chat message in a registered room: refresh the status dashboard
|
||||
// immediately instead of waiting for the next periodic tick.
|
||||
if (!msg.is_from_me && !msg.is_bot_message && roomBindings[chatJid]) {
|
||||
requestImmediateStatusUpdate();
|
||||
}
|
||||
},
|
||||
onChatMetadata: (
|
||||
chatJid: string,
|
||||
@@ -569,6 +577,9 @@ async function main(): Promise<void> {
|
||||
},
|
||||
purgeOnStart: true,
|
||||
});
|
||||
// Refresh the status dashboard immediately when an agent starts/finishes a run
|
||||
// (activity moves between rooms) rather than waiting for the periodic tick.
|
||||
queue.setOnActivityChange(requestImmediateStatusUpdate);
|
||||
webDashboardServer = startWebDashboardServer({
|
||||
...WEB_DASHBOARD,
|
||||
getRoomBindings: runtimeState.getRoomBindings,
|
||||
|
||||
Reference in New Issue
Block a user