UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.98 kB
import{t as formatErrorMessage}from"./errors-D37BJTfI.mjs";import{_ as isSystemdUserServiceAvailable}from"./systemd-busctl-query-CVbse9JI.mjs";import{n as resolveGatewayService}from"./service-Bz63n2ee.mjs";import"./systemd-BLmKdJhz.mjs";import{n as gatewayInstallErrorHint}from"./daemon-install-helpers-CF_xtI3X.mjs";import{t as resolveGatewayInstallToken}from"./gateway-install-token-Pt-GC-0y.mjs";import{n as prepareGatewayServiceInstall,t as resolveGatewaySetupRuntime}from"./gateway-setup-runtime-BwSUwVHJ.mjs";import{n as ensureSystemdUserLingerNonInteractive}from"./systemd-linger-CaSI81r_.mjs"; //!src/commands/onboard-non-interactive/local/daemon-install.ts async function installGatewayDaemonNonInteractive(e){const{opts:t,runtime:n,port:r}=e;const i=process.platform===`linux`?await isSystemdUserServiceAvailable():true;if(process.platform===`linux`&&!i){n.log("Systemd user services are unavailable; skipping service install. Use a direct shell run (`openclaw gateway run`) or rerun without --install-daemon on this session.");return{installed:false,skippedReason:`systemd-user-unavailable`}}const a=resolveGatewayService();const o=await resolveGatewayInstallToken({config:e.nextConfig,env:process.env});for(const e of o.warnings)n.log(e);if(o.unavailableReason){n.error([`Gateway install blocked:`,o.unavailableReason,`Fix gateway auth config/token input and rerun setup.`].join(` `));n.exit(1);return{installed:false}}const s=await a.readCommand(process.env);const c=await resolveGatewaySetupRuntime({env:process.env,existingCommand:s,runtime:t.daemonRuntime});const l=await prepareGatewayServiceInstall({service:a,selection:c,port:r,existingCommand:s,warn:e=>n.log(e),config:e.nextConfig});try{await l.install()}catch(e){n.error(`Gateway service install failed: ${formatErrorMessage(e)}`);n.log(gatewayInstallErrorHint());return{installed:false}}await ensureSystemdUserLingerNonInteractive({runtime:n});return{installed:true}}export{installGatewayDaemonNonInteractive};