Feat : Streamer watch list
Some checks failed
release / build (push) Successful in 28s
release / verify-windows (push) Failing after 1m13s

This commit is contained in:
jeanotx32
2026-08-11 19:24:31 +02:00
parent b85a535dd8
commit e87afc49c0
13 changed files with 936 additions and 48 deletions

View File

@@ -8,10 +8,11 @@ import type {
LogLevel,
ServerToAgent,
ServerToDashboard,
WatchTarget,
} from '@stream-control/shared';
import { emptyStatus } from '@stream-control/shared';
import { config } from './config.ts';
import { agentsRepo, logsRepo, type AgentRecord } from './db.ts';
import { agentsRepo, logsRepo, targetsRepo, type AgentRecord } from './db.ts';
interface PendingCommand {
resolve: (value: unknown) => void;
@@ -190,6 +191,7 @@ class Hub {
type: 'snapshot',
agents: this.views(),
logs: logsRepo.recent(200),
targets: targetsRepo.list(),
});
}
@@ -211,6 +213,21 @@ class Hub {
this.broadcast({ type: 'agent.removed', agentId });
}
// --- Profils surveillés -------------------------------------------------
publishTarget(target: WatchTarget): void {
this.broadcast({ type: 'target', target });
}
publishTargetRemoval(targetId: string): void {
this.broadcast({ type: 'target.removed', targetId });
}
/** Passage en direct : le dashboard en fait une notification. */
publishTargetLive(target: WatchTarget): void {
this.broadcast({ type: 'target.live', target });
}
/** Journalise un évènement : persistance + diffusion temps réel. */
log(agentId: string | null, level: LogLevel, message: string, ts = Date.now()): LogEntry {
const entry = logsRepo.append(agentId, level, message, ts);