Add automatic agent updates with verified rollback
This commit is contained in:
@@ -2,7 +2,9 @@ import { readFile } from 'node:fs/promises';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
/** adapter-node copies public assets to build/client; Vite serves static in development. */
|
||||
export async function agentReleaseAsset(file: 'install.sh' | 'ec-agent.py' | 'manifest.json'): Promise<string> {
|
||||
export async function agentReleaseAsset(file: 'install.sh' | 'ec-agent.py' | 'ec-agent-update.py' | 'manifest.json'): Promise<string> {
|
||||
// A prior production build must never shadow a freshly packaged development release.
|
||||
if (process.env.NODE_ENV === 'development') return readFile(resolve('static/agent', file), 'utf8');
|
||||
try { return await readFile(resolve('build/client/agent', file), 'utf8'); }
|
||||
catch (cause) {
|
||||
if ((cause as NodeJS.ErrnoException).code !== 'ENOENT') throw cause;
|
||||
|
||||
Reference in New Issue
Block a user