Feat : Prio order for auto stream record
All checks were successful
release / build (push) Successful in 27s
release / verify-windows (push) Successful in 1m20s

This commit is contained in:
jeanotx32
2026-08-12 16:01:18 +02:00
parent 96b364bd66
commit eae694d49a
12 changed files with 442 additions and 72 deletions

View File

@@ -122,17 +122,24 @@ class Hub {
// Le profil n'est cherché que tant qu'il manque : une capture déjà
// rattachée l'est pour de bon, inutile de reposer la question toutes les
// deux secondes.
spansRepo.touch(open.id, now, open.targetId ? null : this.recordedTargetId(agentId));
spansRepo.touch(open.id, now, open.targetId ? null : this.recordingTarget(agentId)?.id ?? null);
} else {
spansRepo.open(agentId, this.recordedTargetId(agentId), now);
spansRepo.open(agentId, this.recordingTarget(agentId)?.id ?? null, now);
}
}
/** Le profil que cette VM capture, d'après le pseudo sur lequel sa veille est calée. */
private recordedTargetId(agentId: string): string | null {
/**
* Le profil que cette VM capture, d'après le pseudo sur lequel sa veille est
* calée — `startTargetRecording()` l'y pose, c'est le seul lien fiable.
*
* Nul si la VM n'enregistre pas, ou si sa veille ne désigne aucun profil
* suivi : une capture lancée à la main depuis l'onglet Agents, par exemple.
*/
recordingTarget(agentId: string): WatchTarget | null {
if (!this.statusOf(agentId).recording) return null;
const record = agentsRepo.get(agentId);
if (!record?.watch.username) return null;
return targetsRepo.findByUsername(record.watch.provider, record.watch.username)?.id ?? null;
return targetsRepo.findByUsername(record.watch.provider, record.watch.username);
}
resolveCommand(agentId: string, requestId: string, ok: boolean, data: unknown, error?: string): void {