feat(desktop): add an isolated Electron client with scoped native project actions

This commit is contained in:
Agent Workbench Dev
2026-10-31 10:16:12 +08:00
parent 72a496adfa
commit 5354d95e54
57 changed files with 1388 additions and 15 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { fileURLToPath } from 'node:url';
import { HostController } from '../core/desktop/host-controller.mjs';
import { HostController, HOST_ENVIRONMENT } from '../core/desktop/host-controller.mjs';
const args = process.argv.slice(2);
if (args.includes('--help')) { console.log('node host-launcher.mjs <start|status|stop> [--app-root <absolute>] [--data-root <absolute>] [--node <absolute>] [--port <1..65535>]'); process.exit(0); }
@@ -19,6 +19,6 @@ const dataRoot = options['--data-root'] || process.env.AGENT_WORKBENCH_DATA_DIR
const nodePath = options['--node'] || (fs.existsSync(path.join(appRoot, 'runtime/node.exe')) ? path.join(appRoot, 'runtime/node.exe') : process.execPath);
try {
const controller = new HostController({ appRoot, dataRoot, nodePath, port: Number(options['--port'] || process.env.AGENT_WORKBENCH_PORT || 4318),
environment: Object.fromEntries(['AGENT_WORKBENCH_ENGINE_ROOT', 'AGENT_WORKBENCH_PURGE_ROOT', 'AWB_QA_PYTHON'].filter(key => process.env[key]).map(key => [key, process.env[key]])) });
environment: Object.fromEntries(HOST_ENVIRONMENT.filter(key => process.env[key]).map(key => [key, process.env[key]])) });
console.log(JSON.stringify(await controller[command]()));
} catch (cause) { console.error(JSON.stringify({ success: false, code: cause.code || 'HOST_FAILED', message: cause.message })); process.exitCode = 1; }