CI : Update agent from web
Some checks failed
release / build (push) Successful in 27s
release / verify-windows (push) Failing after 59s

This commit is contained in:
jeanotx32
2026-08-11 20:16:08 +02:00
parent 4f7b8f56ae
commit 6916ff4be3
8 changed files with 217 additions and 9 deletions

View File

@@ -21,9 +21,12 @@ import { loadConfig, persistIdentity, type AgentConfig } from './config.ts';
import { runDiagnostics } from './doctor.ts';
import { ObsController } from './obs.ts';
import { StreamWatcher } from './watcher.ts';
import { currentBuildId, runningBundlePath, selfUpdate } from './updater.ts';
import { cpuUsagePercent, diskUsage, memoryUsage } from './system.ts';
const AGENT_VERSION = '0.1.0';
/** Empreinte du bundle courant, calculée une fois au démarrage. */
const BUILD_ID = currentBuildId();
const RECONNECT_MIN_MS = 1000;
const RECONNECT_MAX_MS = 30_000;
@@ -194,6 +197,14 @@ async function runAction(action: AgentAction, params: Record<string, unknown>):
return watcher.checkNow();
case 'hotkey.fullscreen':
return watcher.restoreFullscreen();
case 'agent.update':
return selfUpdate(
typeof params.url === 'string' && params.url ? params.url : config.packageUrl,
{
recordState: () => obs.recordState(),
log: (level, message) => report(level, message),
},
);
default:
return obs.execute(action, params);
}
@@ -214,6 +225,8 @@ async function buildStatus(): Promise<AgentStatus> {
...emptyStatus(),
...snapshot,
watch: watcher.snapshot,
buildId: BUILD_ID,
canSelfUpdate: Boolean(runningBundlePath() && config.packageUrl),
lastRecordingPath: obs.recordingPath,
systemCpu: cpuUsagePercent(),
systemMemoryUsed: memory.used,