MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / withStatusDetails

Function withStatusDetails

apps/kimi-code/src/cli/sub/server/lifecycle.ts:233–250  ·  view source on GitHub ↗
(
  result: Record<string, unknown>,
  status: ServiceStatus | undefined,
  fallback?: { host: string; port: number },
)

Source from the content-addressed store, hash-verified

231}
232
233function withStatusDetails(
234 result: Record<string, unknown>,
235 status: ServiceStatus | undefined,
236 fallback?: { host: string; port: number },
237): Record<string, unknown> & { url?: string; running?: boolean } {
238 const host = status?.host ?? fallback?.host;
239 const port = status?.port ?? fallback?.port;
240 const url = host !== undefined && port !== undefined ? formatServiceUrl(host, port) : undefined;
241 return {
242 ...result,
243 url,
244 running: status?.running,
245 host,
246 port,
247 logPath: status?.logPath,
248 notes: status?.notes,
249 };
250}
251
252function formatServiceUrl(host: string, port: number): string {
253 return serverOrigin(host === '0.0.0.0' ? LOCAL_SERVER_HOST : host, port);

Callers 1

addLifecycleCommandsFunction · 0.85

Calls 1

formatServiceUrlFunction · 0.85

Tested by

no test coverage detected