openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
5 lines • 2.35 kB
JavaScript
import{s as resolveManagedGatewayServiceCommand}from"./service-types-B7cjFijA.mjs";import{u as resolveRecordedDaemonRuntime}from"./runtime-paths-BOio2Rt6.mjs";import{c as withDaemonRuntimePinMigration,o as readDaemonRuntimePinForInstall}from"./runtime-pin-state-DeLfcMhS.mjs";import{r as installDurableServiceCli}from"./durable-service-entrypoint-CYy_WbI9.mjs";import{a as resolveRunningBunFallback}from"./daemon-install-runtime-warning-ySUnuFLs.mjs";import{t as DEFAULT_GATEWAY_DAEMON_RUNTIME}from"./daemon-runtime-CM-TWmEx.mjs";import{t as buildGatewayInstallPlan}from"./daemon-install-helpers-CF_xtI3X.mjs";
//!src/commands/gateway-service-setup.ts
async function prepareGatewayServiceInstall(e){const{runtimePinUpdate:t,...n}=e.selection;const{durableCliReplacement:r,...i}=await buildGatewayInstallPlan({...n,port:e.port,existingCommand:e.existingCommand,config:e.config,installDurableCli:true,warn:e.warn});return{runtime:i.runtime,install:()=>installDurableServiceCli({env:n.env,replacement:r,verify:()=>e.service.isLoaded({env:process.env}),warn:t=>e.warn(t,`Gateway service`),install:(n,r)=>e.service.install({env:process.env,stdout:process.stdout,...i,runtimePinUpdate:t,beforeMutation:n,beforeRecovery:r})})}}
//!src/commands/gateway-setup-runtime.ts
async function resolveGatewaySetupRuntime(e){const t=await withDaemonRuntimePinMigration(e.env,()=>readDaemonRuntimePinForInstall({kind:`gateway`,env:e.env},e.existingCommand,e.runtime!==void 0));const n=e.runtime===void 0?t.pin:void 0;const r=resolveManagedGatewayServiceCommand(e.existingCommand);const i={...e.env,OPENCLAW_WRAPPER:e.env.OPENCLAW_WRAPPER??r?.environment?.OPENCLAW_WRAPPER};const a=e.runtime===void 0&&!n&&!i.OPENCLAW_WRAPPER?.trim()?await resolveRecordedDaemonRuntime(r?.programArguments[0],i):void 0;const o=a?.status===`supported`?a:void 0;const s=e.selectRuntime&&e.runtime===void 0&&!n&&!o&&!i.OPENCLAW_WRAPPER?.trim()?await resolveRunningBunFallback({env:i}):void 0;const c=o?.runtime??(s?`bun`:`node`);const l=e.runtime??n?.runtime??(e.selectRuntime?await e.selectRuntime(c):c);return{runtime:l,runtimeExplicit:e.runtime!==void 0||n!==void 0||e.selectRuntime!==void 0,runtimePath:l===o?.runtime?o.path:l===`bun`?s:void 0,pinnedRuntimePath:n?.path,runtimePinUpdate:{expected:t,pin:n},env:i}}export{prepareGatewayServiceInstall as n,resolveGatewaySetupRuntime as t};