UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

60 lines (59 loc) • 2.46 kB
import { s as resolveManagedGatewayServiceCommand } from "./service-types-DdxELPHF.mjs"; import { u as resolveRecordedDaemonRuntime } from "./runtime-paths-xW9-a89Z.mjs"; import { c as withDaemonRuntimePinMigration, o as readDaemonRuntimePinForInstall } from "./runtime-pin-state-DXPlp4E4.mjs"; import { a as resolveRunningBunFallback } from "./daemon-install-runtime-warning-0qx7euD-.mjs"; import { t as DEFAULT_GATEWAY_DAEMON_RUNTIME } from "./daemon-runtime-agdJw6fb.mjs"; import { t as buildGatewayInstallPlan } from "./daemon-install-helpers-DYNaMvoO.mjs"; //#region src/commands/gateway-service-setup.ts async function prepareGatewayServiceInstall(e) { const { runtimePinUpdate: t, ...n } = e.selection; const r = await buildGatewayInstallPlan({ ...n, port: e.port, existingCommand: e.existingCommand, config: e.config, warn: e.warn }); return { runtime: r.runtime, install: () => e.service.install({ env: process.env, stdout: process.stdout, ...r, runtimePinUpdate: t }) }; } //#endregion //#region src/commands/gateway-setup-runtime.ts /** Resolve setup runtime intent without turning automatic choices into persistent pins. */ 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 }; } //#endregion export { prepareGatewayServiceInstall as n, resolveGatewaySetupRuntime as t };