11// Shared Gateway service CLI helpers: status styles, env filtering, port parsing, and hints.
22import { colorize , isRich , theme } from "../../../packages/terminal-core/src/theme.js" ;
3- import { readBestEffortConfig , resolveGatewayPort } from "../../config/config.js" ;
4- import { createConfigIO } from "../../config/io.js" ;
53import { resolveIsNixMode } from "../../config/paths.js" ;
64import {
75 resolveGatewayLaunchAgentLabel ,
@@ -14,9 +12,6 @@ import {
1412 buildPlatformRuntimeLogHints ,
1513 buildPlatformServiceStartHints ,
1614} from "../../daemon/runtime-hints.js" ;
17- import { mergeGatewayServiceEnv } from "../../daemon/service-env-merge.js" ;
18- import { resolveGatewayService } from "../../daemon/service.js" ;
19- import { parseTcpPortFromArgs } from "../../infra/tcp-port.js" ;
2015import { formatCliCommand } from "../command-format.js" ;
2116import { parsePort } from "../shared/parse-port.js" ;
2217import { createDaemonActionContext } from "./response.js" ;
@@ -225,33 +220,3 @@ export function filterContainerGenericHints(
225220 ! hint . includes ( "systemd user services are unavailable; install/enable systemd" ) ,
226221 ) ;
227222}
228-
229- export async function resolveGatewayLifecycleContext (
230- service = resolveGatewayService ( ) ,
231- requireEffective = false ,
232- ) {
233- const command = requireEffective
234- ? await service . readCommand ( process . env , { requireEffective : true } )
235- : await service . readCommand ( process . env ) . catch ( ( ) => null ) ;
236- if ( requireEffective && ! command ) {
237- throw new Error (
238- "Updated gateway service could not be inspected; run `openclaw gateway status --deep`." ,
239- ) ;
240- }
241- const env = mergeGatewayServiceEnv ( process . env , command ) ;
242- const config = await createConfigIO ( {
243- env,
244- observe : false ,
245- pluginValidation : "skip" ,
246- suppressFutureVersionWarning : true ,
247- } )
248- . readBestEffortConfig ( )
249- . catch ( ( ) => undefined ) ;
250- const port = parseTcpPortFromArgs ( command ?. programArguments ) ?? resolveGatewayPort ( config , env ) ;
251- return { port, env, command } ;
252- }
253-
254- export async function resolveGatewayConfigPorts ( ) {
255- const config = await readBestEffortConfig ( { observe : false } ) . catch ( ( ) => undefined ) ;
256- return { explicit : config ?. gateway ?. port , fallback : resolveGatewayPort ( config , process . env ) } ;
257- }
0 commit comments