Lines 7-47javascript
7 * the unified config and passes them here.
10 * 1. Load unified config via loadUnifiedConfig()
11 * 2. Apply engine filter (--engine flag) if provided
12 * 3. Acquire PID lock at .telora/daemon.pid
13 * 4. Register uncaughtException / unhandledRejection handlers
14 * 5. Set up signal handlers (SIGTERM, SIGINT)
15 * 6. For each enabled engine: build config, create instance, init, recover, start
16 * 7. Register SIGUSR1 (status) and SIGUSR2 (circuit breaker reset) handlers
17 * 8. Keep the process running indefinitely
19 * On shutdown (SIGTERM/SIGINT):
20 * 1. Stop all engines (stop accepting new work)
21 * 2. Shut down all engines in parallel (graceful cleanup)
25import { openSync, closeSync, existsSync } from 'node:fs';
26import { dirname, resolve } from 'node:path';
27import { fileURLToPath } from 'node:url';
28import { spawn, execFileSync } from 'node:child_process';
29import { loadUnifiedConfig, loadEnvConfig, acquirePidLock, releasePidLock, PidLockError, } from '@telora/daemon-core';
HighChild Process
Package source references child process execution.
dist/unified-shell.jsView on unpkg · L27 30import { startAutoUpdateLoop } from './auto-update.js';
31import { createDebouncedIdleGate, isBatchSafeIdle } from './auto-update-idle.js';
32import { getActiveTeamCount } from './focus-team-state.js';
33import { getReadyFocusQueueDepth } from './listener.js';
34import { isIntakeDraining, armDrainForUpdate } from './intake-control.js';
35import { runDrainToIdleTeardown } from './drain-teardown.js';
36import { readStopRequest, clearStopRequest, decideStopAction } from './stop-request.js';
37import { startVersionCacheRefreshLoop, readFreshVersionCache } from './staleness.js';
38import { detectInstallMode, getCurrentVersion, isNpxRunMode, npxRunRefusalMessage } from './self-update.js';
39import { setDaemonShuttingDown } from './shutdown-state.js';
40import { startOtlpReceiver, stopOtlpReceiver } from './otlp/index.js';
41import { initTelemetryWriter, stopTelemetryWriter } from './telemetry-writer.js';
42import { startCircuitWedgeWatcher, stopCircuitWedgeWatcher } from './circuit-wedge-watcher.js';
43import { reapWorkerFleet } from './spawner/index.js';
44import { clearWorkerPidfile, reapAndClearWorkerPidfile } from './worker-pidfile.js';
45import { startLacunaSidecarIfEnabled, stopLacunaSidecar } from './backends/lacuna/index.js';
46import { rotateDaemonLog, setupCanonicalLogTee, writeDaemonMeta, removeDaemonMeta, resolveDaemonLogPath, resolvePidFilePath, ensureGlobalStateDir, STOP_DRAIN_BUDGET_MS } from './daemon-process.js';
47import { printUnifiedConfigSummary } from './unified-shell-status.js';