chore: align setup with EJClaw dual-service architecture

This commit is contained in:
Eyejoker
2026-03-26 19:10:07 +09:00
parent 3efacbdda1
commit 2fd4cfc9d0
10 changed files with 567 additions and 198 deletions

View File

@@ -2,7 +2,9 @@
* Step: service — Generate and load service manager config.
* Replaces 08-setup-service.sh
*
* Fixes: Root→system systemd, WSL nohup fallback, no `|| true` swallowing errors.
* Supports dual-service architecture:
* - ejclaw (Claude Code) — always installed
* - ejclaw-codex (Codex) — installed when .env.codex exists
*/
import { execSync } from 'child_process';
import fs from 'fs';
@@ -20,8 +22,58 @@ import {
} from './platform.js';
import { emitStatus } from './status.js';
const EJCLAW_SERVICE_NAME = 'ejclaw';
const EJCLAW_LAUNCHD_LABEL = 'com.ejclaw';
/* ------------------------------------------------------------------ */
/* Service definition */
/* ------------------------------------------------------------------ */
interface ServiceDef {
/** systemd unit name / nohup script name */
name: string;
/** launchd label */
launchdLabel: string;
/** Human-readable description for systemd/launchd */
description: string;
/** Log file prefix (e.g. "ejclaw" → logs/ejclaw.log) */
logName: string;
/** Absolute path to EnvironmentFile (systemd) — loaded before Environment= */
environmentFile?: string;
/** Extra Environment= lines for systemd / env dict entries for launchd */
extraEnv?: Record<string, string>;
}
function getServiceDefs(projectRoot: string): ServiceDef[] {
const defs: ServiceDef[] = [
{
name: 'ejclaw',
launchdLabel: 'com.ejclaw',
description: 'EJClaw Personal Assistant (Claude Code)',
logName: 'ejclaw',
},
];
const codexEnvPath = path.join(projectRoot, '.env.codex');
if (fs.existsSync(codexEnvPath)) {
defs.push({
name: 'ejclaw-codex',
launchdLabel: 'com.ejclaw-codex',
description: 'EJClaw Codex Assistant',
logName: 'ejclaw-codex',
environmentFile: codexEnvPath,
extraEnv: {
ASSISTANT_NAME: 'codex',
},
});
logger.info(
'Detected .env.codex — will also install ejclaw-codex service',
);
}
return defs;
}
/* ------------------------------------------------------------------ */
/* Entry point */
/* ------------------------------------------------------------------ */
export async function run(_args: string[]): Promise<void> {
const projectRoot = process.cwd();
@@ -54,10 +106,14 @@ export async function run(_args: string[]): Promise<void> {
fs.mkdirSync(path.join(projectRoot, 'logs'), { recursive: true });
const serviceDefs = getServiceDefs(projectRoot);
if (platform === 'macos') {
setupLaunchd(projectRoot, nodePath, homeDir);
for (const def of serviceDefs) {
setupLaunchd(def, projectRoot, nodePath, homeDir);
}
} else if (platform === 'linux') {
setupLinux(projectRoot, nodePath, homeDir);
setupLinux(serviceDefs, projectRoot, nodePath, homeDir);
} else {
emitStatus('SETUP_SERVICE', {
SERVICE_TYPE: 'unknown',
@@ -71,7 +127,12 @@ export async function run(_args: string[]): Promise<void> {
}
}
/* ------------------------------------------------------------------ */
/* macOS (launchd) */
/* ------------------------------------------------------------------ */
function setupLaunchd(
def: ServiceDef,
projectRoot: string,
nodePath: string,
homeDir: string,
@@ -80,16 +141,30 @@ function setupLaunchd(
homeDir,
'Library',
'LaunchAgents',
`${EJCLAW_LAUNCHD_LABEL}.plist`,
`${def.launchdLabel}.plist`,
);
fs.mkdirSync(path.dirname(plistPath), { recursive: true });
// Build extra env dict entries
const envEntries = [
` <key>PATH</key>`,
` <string>${path.dirname(nodePath)}:/usr/local/bin:/usr/bin:/bin:${homeDir}/.local/bin:${homeDir}/.npm-global/bin</string>`,
` <key>HOME</key>`,
` <string>${homeDir}</string>`,
];
if (def.extraEnv) {
for (const [k, v] of Object.entries(def.extraEnv)) {
envEntries.push(` <key>${k}</key>`);
envEntries.push(` <string>${v}</string>`);
}
}
const plist = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>${EJCLAW_LAUNCHD_LABEL}</string>
<string>${def.launchdLabel}</string>
<key>ProgramArguments</key>
<array>
<string>${nodePath}</string>
@@ -103,40 +178,41 @@ function setupLaunchd(
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>${path.dirname(nodePath)}:/usr/local/bin:/usr/bin:/bin:${homeDir}/.local/bin:${homeDir}/.npm-global/bin</string>
<key>HOME</key>
<string>${homeDir}</string>
${envEntries.join('\n')}
</dict>
<key>StandardOutPath</key>
<string>${projectRoot}/logs/ejclaw.log</string>
<string>${projectRoot}/logs/${def.logName}.log</string>
<key>StandardErrorPath</key>
<string>${projectRoot}/logs/ejclaw.error.log</string>
<string>${projectRoot}/logs/${def.logName}.error.log</string>
</dict>
</plist>`;
fs.writeFileSync(plistPath, plist);
logger.info({ plistPath }, 'Wrote launchd plist');
logger.info({ plistPath, service: def.name }, 'Wrote launchd plist');
try {
execSync(`launchctl load ${JSON.stringify(plistPath)}`, {
stdio: 'ignore',
});
logger.info('launchctl load succeeded');
logger.info({ service: def.name }, 'launchctl load succeeded');
} catch {
logger.warn('launchctl load failed (may already be loaded)');
logger.warn(
{ service: def.name },
'launchctl load failed (may already be loaded)',
);
}
// Verify
let serviceLoaded = false;
try {
const output = execSync('launchctl list', { encoding: 'utf-8' });
serviceLoaded = output.includes(EJCLAW_LAUNCHD_LABEL);
serviceLoaded = output.includes(def.launchdLabel);
} catch {
// launchctl list failed
}
emitStatus('SETUP_SERVICE', {
SERVICE_NAME: def.name,
SERVICE_TYPE: 'launchd',
NODE_PATH: nodePath,
PROJECT_PATH: projectRoot,
@@ -147,7 +223,12 @@ function setupLaunchd(
});
}
/* ------------------------------------------------------------------ */
/* Linux */
/* ------------------------------------------------------------------ */
function setupLinux(
serviceDefs: ServiceDef[],
projectRoot: string,
nodePath: string,
homeDir: string,
@@ -155,10 +236,12 @@ function setupLinux(
const serviceManager = getServiceManager();
if (serviceManager === 'systemd') {
setupSystemd(projectRoot, nodePath, homeDir);
setupSystemdAll(serviceDefs, projectRoot, nodePath, homeDir);
} else {
// WSL without systemd or other Linux without systemd
setupNohupFallback(projectRoot, nodePath, homeDir);
for (const def of serviceDefs) {
setupNohupFallback(def, projectRoot, nodePath, homeDir);
}
}
}
@@ -177,151 +260,221 @@ function killOrphanedProcesses(projectRoot: string): void {
}
}
function setupSystemd(
/* ------------------------------------------------------------------ */
/* systemd */
/* ------------------------------------------------------------------ */
function setupSystemdAll(
serviceDefs: ServiceDef[],
projectRoot: string,
nodePath: string,
homeDir: string,
): void {
const runningAsRoot = isRoot();
const systemctlPrefix = runningAsRoot ? 'systemctl' : 'systemctl --user';
// Root uses system-level service, non-root uses user-level
let unitPath: string;
let systemctlPrefix: string;
if (runningAsRoot) {
unitPath = `/etc/systemd/system/${EJCLAW_SERVICE_NAME}.service`;
systemctlPrefix = 'systemctl';
logger.info('Running as root — installing system-level systemd unit');
} else {
// Check if user-level systemd session is available
// Pre-flight: verify user-level systemd session is available
if (!runningAsRoot) {
try {
execSync('systemctl --user daemon-reload', { stdio: 'pipe' });
} catch {
logger.warn(
'systemd user session not available — falling back to nohup wrapper',
);
setupNohupFallback(projectRoot, nodePath, homeDir);
for (const def of serviceDefs) {
setupNohupFallback(def, projectRoot, nodePath, homeDir);
}
return;
}
const unitDir = path.join(homeDir, '.config', 'systemd', 'user');
fs.mkdirSync(unitDir, { recursive: true });
unitPath = path.join(unitDir, `${EJCLAW_SERVICE_NAME}.service`);
systemctlPrefix = 'systemctl --user';
}
const unit = `[Unit]
Description=EJClaw Personal Assistant
After=network.target
[Service]
Type=simple
ExecStart=${nodePath} ${projectRoot}/dist/index.js
WorkingDirectory=${projectRoot}
Restart=always
RestartSec=5
Environment=HOME=${homeDir}
Environment=PATH=${path.dirname(nodePath)}:/usr/local/bin:/usr/bin:/bin:${homeDir}/.local/bin:${homeDir}/.npm-global/bin
StandardOutput=append:${projectRoot}/logs/ejclaw.log
StandardError=append:${projectRoot}/logs/ejclaw.error.log
[Install]
WantedBy=${runningAsRoot ? 'multi-user.target' : 'default.target'}`;
fs.writeFileSync(unitPath, unit);
logger.info({ unitPath }, 'Wrote systemd unit');
// Kill orphaned ejclaw processes to avoid channel connection conflicts
// Kill orphaned processes once before installing any services
killOrphanedProcesses(projectRoot);
// Enable and start
// Install each service
for (const def of serviceDefs) {
setupSystemdUnit(def, projectRoot, nodePath, homeDir, runningAsRoot);
}
// Reload daemon once after all units are written
try {
execSync(`${systemctlPrefix} daemon-reload`, { stdio: 'ignore' });
} catch (err) {
logger.error({ err }, 'systemctl daemon-reload failed');
}
try {
execSync(`${systemctlPrefix} enable ${EJCLAW_SERVICE_NAME}`, {
stdio: 'ignore',
});
} catch (err) {
logger.error({ err }, 'systemctl enable failed');
}
// Enable and start each service
for (const def of serviceDefs) {
try {
execSync(`${systemctlPrefix} enable ${def.name}`, { stdio: 'ignore' });
} catch (err) {
logger.error({ err, service: def.name }, 'systemctl enable failed');
}
try {
execSync(`${systemctlPrefix} start ${EJCLAW_SERVICE_NAME}`, {
stdio: 'ignore',
});
} catch (err) {
logger.error({ err }, 'systemctl start failed');
}
try {
execSync(`${systemctlPrefix} start ${def.name}`, { stdio: 'ignore' });
} catch (err) {
logger.error({ err, service: def.name }, 'systemctl start failed');
}
// Verify
let serviceLoaded = false;
try {
execSync(`${systemctlPrefix} is-active ${EJCLAW_SERVICE_NAME}`, {
stdio: 'ignore',
});
serviceLoaded = true;
} catch {
// Not active
}
// Verify
let serviceLoaded = false;
try {
execSync(`${systemctlPrefix} is-active ${def.name}`, {
stdio: 'ignore',
});
serviceLoaded = true;
} catch {
// Not active
}
emitStatus('SETUP_SERVICE', {
SERVICE_TYPE: runningAsRoot ? 'systemd-system' : 'systemd-user',
NODE_PATH: nodePath,
PROJECT_PATH: projectRoot,
UNIT_PATH: unitPath,
SERVICE_LOADED: serviceLoaded,
STATUS: 'success',
LOG: 'logs/setup.log',
});
emitStatus('SETUP_SERVICE', {
SERVICE_NAME: def.name,
SERVICE_TYPE: runningAsRoot ? 'systemd-system' : 'systemd-user',
NODE_PATH: nodePath,
PROJECT_PATH: projectRoot,
UNIT_PATH: getUnitPath(def.name, homeDir, runningAsRoot),
SERVICE_LOADED: serviceLoaded,
STATUS: 'success',
LOG: 'logs/setup.log',
});
}
}
function getUnitPath(
serviceName: string,
homeDir: string,
runningAsRoot: boolean,
): string {
if (runningAsRoot) {
return `/etc/systemd/system/${serviceName}.service`;
}
return path.join(
homeDir,
'.config',
'systemd',
'user',
`${serviceName}.service`,
);
}
function setupSystemdUnit(
def: ServiceDef,
projectRoot: string,
nodePath: string,
homeDir: string,
runningAsRoot: boolean,
): void {
const unitPath = getUnitPath(def.name, homeDir, runningAsRoot);
fs.mkdirSync(path.dirname(unitPath), { recursive: true });
// Build Environment= lines
const envLines = [
`Environment=HOME=${homeDir}`,
`Environment=PATH=${path.dirname(nodePath)}:/usr/local/bin:/usr/bin:/bin:${homeDir}/.local/bin:${homeDir}/.npm-global/bin`,
];
if (def.extraEnv) {
for (const [k, v] of Object.entries(def.extraEnv)) {
envLines.push(`Environment=${k}=${v}`);
}
}
// EnvironmentFile line (optional — for codex service loading .env.codex)
const envFileLine = def.environmentFile
? `EnvironmentFile=${def.environmentFile}\n`
: '';
const unit = `[Unit]
Description=${def.description}
After=network.target
[Service]
${envFileLine}Type=simple
ExecStart=${nodePath} ${projectRoot}/dist/index.js
WorkingDirectory=${projectRoot}
Restart=always
RestartSec=5
${envLines.join('\n')}
StandardOutput=append:${projectRoot}/logs/${def.logName}.log
StandardError=append:${projectRoot}/logs/${def.logName}.error.log
[Install]
WantedBy=${runningAsRoot ? 'multi-user.target' : 'default.target'}`;
fs.writeFileSync(unitPath, unit);
logger.info({ unitPath, service: def.name }, 'Wrote systemd unit');
}
/* ------------------------------------------------------------------ */
/* nohup fallback (WSL / no systemd) */
/* ------------------------------------------------------------------ */
function setupNohupFallback(
def: ServiceDef,
projectRoot: string,
nodePath: string,
homeDir: string,
): void {
logger.warn('No systemd detected — generating nohup wrapper script');
logger.warn(
{ service: def.name },
'No systemd detected — generating nohup wrapper script',
);
const wrapperPath = path.join(projectRoot, 'start-ejclaw.sh');
const pidFile = path.join(projectRoot, 'ejclaw.pid');
const wrapperPath = path.join(projectRoot, `start-${def.name}.sh`);
const pidFile = path.join(projectRoot, `${def.name}.pid`);
// Build export lines for extra env
const exportLines: string[] = [];
if (def.environmentFile) {
exportLines.push(`# Load environment file`);
exportLines.push(`set -a`);
exportLines.push(`source ${JSON.stringify(def.environmentFile)}`);
exportLines.push(`set +a`);
exportLines.push('');
}
if (def.extraEnv) {
for (const [k, v] of Object.entries(def.extraEnv)) {
exportLines.push(`export ${k}=${JSON.stringify(v)}`);
}
exportLines.push('');
}
const lines = [
'#!/bin/bash',
'# start-ejclaw.sh — Start EJClaw without systemd',
`# start-${def.name}.sh — Start ${def.description} without systemd`,
`# To stop: kill \\$(cat ${pidFile})`,
'',
'set -euo pipefail',
'',
`cd ${JSON.stringify(projectRoot)}`,
'',
...exportLines,
'# Stop existing instance if running',
`if [ -f ${JSON.stringify(pidFile)} ]; then`,
` OLD_PID=$(cat ${JSON.stringify(pidFile)} 2>/dev/null || echo "")`,
' if [ -n "$OLD_PID" ] && kill -0 "$OLD_PID" 2>/dev/null; then',
' echo "Stopping existing EJClaw (PID $OLD_PID)..."',
` echo "Stopping existing ${def.name} (PID $OLD_PID)..."`,
' kill "$OLD_PID" 2>/dev/null || true',
' sleep 2',
' fi',
'fi',
'',
'echo "Starting EJClaw..."',
`echo "Starting ${def.description}..."`,
`nohup ${JSON.stringify(nodePath)} ${JSON.stringify(projectRoot + '/dist/index.js')} \\`,
` >> ${JSON.stringify(projectRoot + '/logs/ejclaw.log')} \\`,
` 2>> ${JSON.stringify(projectRoot + '/logs/ejclaw.error.log')} &`,
` >> ${JSON.stringify(projectRoot + '/logs/' + def.logName + '.log')} \\`,
` 2>> ${JSON.stringify(projectRoot + '/logs/' + def.logName + '.error.log')} &`,
'',
`echo $! > ${JSON.stringify(pidFile)}`,
'echo "EJClaw started (PID $!)"',
`echo "Logs: tail -f ${projectRoot}/logs/ejclaw.log"`,
`echo "${def.name} started (PID $!)"`,
`echo "Logs: tail -f ${projectRoot}/logs/${def.logName}.log"`,
];
const wrapper = lines.join('\n') + '\n';
fs.writeFileSync(wrapperPath, wrapper, { mode: 0o755 });
logger.info({ wrapperPath }, 'Wrote nohup wrapper script');
logger.info({ wrapperPath, service: def.name }, 'Wrote nohup wrapper script');
emitStatus('SETUP_SERVICE', {
SERVICE_NAME: def.name,
SERVICE_TYPE: 'nohup',
NODE_PATH: nodePath,
PROJECT_PATH: projectRoot,

View File

@@ -2,6 +2,10 @@
* Step: verify — End-to-end health check of the full installation.
* Replaces 09-verify.sh
*
* Supports dual-service architecture:
* - ejclaw (Claude Code) — always checked
* - ejclaw-codex (Codex) — checked when .env.codex exists
*
* Uses better-sqlite3 directly (no sqlite3 CLI), platform-aware service checks.
*/
import { execSync } from 'child_process';
@@ -16,64 +20,125 @@ import { logger } from '../src/logger.js';
import { getPlatform, getServiceManager, isRoot } from './platform.js';
import { emitStatus } from './status.js';
/* ------------------------------------------------------------------ */
/* Types */
/* ------------------------------------------------------------------ */
type ServiceStatus = 'running' | 'stopped' | 'not_found' | 'not_configured';
interface ServiceCheck {
name: string;
status: ServiceStatus;
}
/* ------------------------------------------------------------------ */
/* Service status checks */
/* ------------------------------------------------------------------ */
function checkLaunchdService(label: string): ServiceStatus {
try {
const output = execSync('launchctl list', { encoding: 'utf-8' });
if (output.includes(label)) {
const line = output.split('\n').find((l) => l.includes(label));
if (line) {
const pidField = line.trim().split(/\s+/)[0];
return pidField !== '-' && pidField ? 'running' : 'stopped';
}
}
} catch {
// launchctl not available
}
return 'not_found';
}
function checkSystemdService(name: string): ServiceStatus {
const prefix = isRoot() ? 'systemctl' : 'systemctl --user';
try {
execSync(`${prefix} is-active ${name}`, { stdio: 'ignore' });
return 'running';
} catch {
try {
const output = execSync(`${prefix} list-unit-files`, {
encoding: 'utf-8',
});
if (output.includes(name)) {
return 'stopped';
}
} catch {
// systemctl not available
}
}
return 'not_found';
}
function checkNohupService(
projectRoot: string,
serviceName: string,
): ServiceStatus {
const pidFile = path.join(projectRoot, `${serviceName}.pid`);
if (fs.existsSync(pidFile)) {
try {
const raw = fs.readFileSync(pidFile, 'utf-8').trim();
const pid = Number(raw);
if (raw && Number.isInteger(pid) && pid > 0) {
process.kill(pid, 0);
return 'running';
}
} catch {
return 'stopped';
}
}
return 'not_found';
}
function checkService(
projectRoot: string,
mgr: ReturnType<typeof getServiceManager>,
serviceName: string,
launchdLabel: string,
): ServiceStatus {
if (mgr === 'launchd') return checkLaunchdService(launchdLabel);
if (mgr === 'systemd') return checkSystemdService(serviceName);
return checkNohupService(projectRoot, serviceName);
}
/* ------------------------------------------------------------------ */
/* Main */
/* ------------------------------------------------------------------ */
export async function run(_args: string[]): Promise<void> {
const projectRoot = process.cwd();
const platform = getPlatform();
const mgr = getServiceManager();
logger.info('Starting verification');
// 1. Check service status
let service = 'not_found';
const mgr = getServiceManager();
// 1. Check service statuses
const services: ServiceCheck[] = [];
if (mgr === 'launchd') {
try {
const output = execSync('launchctl list', { encoding: 'utf-8' });
if (output.includes('com.ejclaw')) {
// Check if it has a PID (actually running)
const line = output.split('\n').find((l) => l.includes('com.ejclaw'));
if (line) {
const pidField = line.trim().split(/\s+/)[0];
service = pidField !== '-' && pidField ? 'running' : 'stopped';
}
}
} catch {
// launchctl not available
}
} else if (mgr === 'systemd') {
const prefix = isRoot() ? 'systemctl' : 'systemctl --user';
try {
execSync(`${prefix} is-active ejclaw`, { stdio: 'ignore' });
service = 'running';
} catch {
try {
const output = execSync(`${prefix} list-unit-files`, {
encoding: 'utf-8',
});
if (output.includes('ejclaw')) {
service = 'stopped';
}
} catch {
// systemctl not available
}
}
} else {
// Check for nohup PID file
const pidFile = path.join(projectRoot, 'ejclaw.pid');
if (fs.existsSync(pidFile)) {
try {
const raw = fs.readFileSync(pidFile, 'utf-8').trim();
const pid = Number(raw);
if (raw && Number.isInteger(pid) && pid > 0) {
process.kill(pid, 0);
service = 'running';
}
} catch {
service = 'stopped';
}
}
// Primary service (always checked)
services.push({
name: 'ejclaw',
status: checkService(projectRoot, mgr, 'ejclaw', 'com.ejclaw'),
});
// Codex service (checked when .env.codex exists)
const codexEnvPath = path.join(projectRoot, '.env.codex');
const codexConfigured = fs.existsSync(codexEnvPath);
if (codexConfigured) {
services.push({
name: 'ejclaw-codex',
status: checkService(
projectRoot,
mgr,
'ejclaw-codex',
'com.ejclaw-codex',
),
});
}
for (const svc of services) {
logger.info({ service: svc.name, status: svc.status }, 'Service status');
}
logger.info({ service }, 'Service status');
// 2. Check credentials
let credentials = 'missing';
@@ -99,6 +164,7 @@ export async function run(_args: string[]): Promise<void> {
// 4. Check registered groups (using better-sqlite3, not sqlite3 CLI)
let registeredGroups = 0;
let groupsByAgent: Record<string, number> = {};
const dbPath = path.join(STORE_DIR, 'messages.db');
if (fs.existsSync(dbPath)) {
try {
@@ -107,6 +173,21 @@ export async function run(_args: string[]): Promise<void> {
.prepare('SELECT COUNT(*) as count FROM registered_groups')
.get() as { count: number };
registeredGroups = row.count;
// Count by agent type
try {
const rows = db
.prepare(
'SELECT agent_type, COUNT(*) as count FROM registered_groups GROUP BY agent_type',
)
.all() as { agent_type: string; count: number }[];
for (const r of rows) {
groupsByAgent[r.agent_type || 'unknown'] = r.count;
}
} catch {
// agent_type column might not exist in older schema
}
db.close();
} catch {
// Table might not exist
@@ -114,22 +195,36 @@ export async function run(_args: string[]): Promise<void> {
}
// Determine overall status
const primaryRunning = services[0].status === 'running';
const codexOk = !codexConfigured || services[1]?.status === 'running';
const status =
service === 'running' &&
primaryRunning &&
codexOk &&
credentials !== 'missing' &&
anyChannelConfigured &&
registeredGroups > 0
? 'success'
: 'failed';
logger.info({ status, channelAuth }, 'Verification complete');
// Build service status summary
const servicesSummary: Record<string, string> = {};
for (const svc of services) {
servicesSummary[svc.name] = svc.status;
}
logger.info({ status, channelAuth, servicesSummary }, 'Verification complete');
emitStatus('VERIFY', {
SERVICE: service,
SERVICES: JSON.stringify(servicesSummary),
// Legacy field (keep for backward compatibility)
SERVICE: services[0].status,
CREDENTIALS: credentials,
CONFIGURED_CHANNELS: configuredChannels.join(','),
CHANNEL_AUTH: JSON.stringify(channelAuth),
REGISTERED_GROUPS: registeredGroups,
GROUPS_BY_AGENT: JSON.stringify(groupsByAgent),
CODEX_CONFIGURED: codexConfigured,
STATUS: status,
LOG: 'logs/setup.log',
});