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

Function requestShutdownViaApi

apps/kimi-code/src/cli/sub/server/kill.ts:136–153  ·  view source on GitHub ↗
(
  origin: string,
  token: string | undefined,
)

Source from the content-addressed store, hash-verified

134
135/** POST the shutdown endpoint; resolves once the request completes or times out. */
136export async function requestShutdownViaApi(
137 origin: string,
138 token: string | undefined,
139): Promise<void> {
140 const controller = new AbortController();
141 const timeout = setTimeout(() => {
142 controller.abort();
143 }, API_TIMEOUT_MS);
144 try {
145 await fetch(`${origin}/api/v1/shutdown`, {
146 method: 'POST',
147 headers: token !== undefined ? authHeaders(token) : undefined,
148 signal: controller.signal,
149 });
150 } finally {
151 clearTimeout(timeout);
152 }
153}
154
155const DEFAULT_KILL_DEPS: KillCommandDeps = {
156 getLiveLock,

Callers

nothing calls this directly

Calls 2

authHeadersFunction · 0.90
abortMethod · 0.65

Tested by

no test coverage detected