Feat : Log recorder
Some checks failed
release / build (push) Successful in 29s
release / verify-windows (push) Failing after 1m0s

This commit is contained in:
jeanotx32
2026-08-11 22:34:45 +02:00
parent 03b1963150
commit 1dd3959f29
16 changed files with 631 additions and 53 deletions

View File

@@ -1,11 +1,11 @@
import { execFile, spawn } from 'node:child_process';
import { promisify } from 'node:util';
import type { BrowserSettings } from '@stream-control/shared';
import type { AgentEvent, BrowserSettings } from '@stream-control/shared';
const run = promisify(execFile);
export interface BrowserLog {
(level: 'info' | 'warn' | 'error', message: string): void;
(level: 'info' | 'warn' | 'error', message: string, event?: AgentEvent): void;
}
/**
@@ -42,7 +42,7 @@ export async function openUrl(
const target = assertWebUrl(url);
const args = [...settings.args, target];
log('info', `Ouverture de ${target} (${settings.command})`);
log('info', `Ouverture de ${target} (${settings.command})`, 'browser.opened');
const child = spawn(settings.command, args, {
detached: true,
@@ -103,7 +103,7 @@ export async function closeWindow(
await run('xdotool', ['windowclose', id], { env, timeout: 5000 }).catch(() => undefined);
}
log('info', `${ids.length} fenêtre(s) « ${match} » fermée(s)`);
log('info', `${ids.length} fenêtre(s) « ${match} » fermée(s)`, 'browser.closed');
return { closed: ids.length };
}