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

Function status

packages/server/src/svc/schtasks.ts:179–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177 }
178
179 async function status(): Promise<ServiceStatus> {
180 const plan = readInstallPlan();
181 const installed = await deps.taskExists();
182
183 const base: ServiceStatus = {
184 platform: 'win32',
185 installed,
186 running: false,
187 taskName: KIMI_SERVER_TASK_NAME,
188 ...(plan?.host !== undefined ? { host: plan.host } : {}),
189 ...(plan?.port !== undefined ? { port: plan.port } : {}),
190 logPath: deps.logPath(),
191 };
192
193 if (!installed) {
194 return { ...base, notes: ['Scheduled task is not installed.'] };
195 }
196
197 const query = await deps.execSchtasks([
198 '/Query',
199 '/TN',
200 KIMI_SERVER_TASK_NAME,
201 '/FO',
202 'CSV',
203 '/V',
204 ]);
205 if (query.code !== 0) {
206 return {
207 ...base,
208 notes: [
209 `schtasks /Query failed (code ${query.code}): ${detail(query) ?? 'unknown'}.`,
210 'The task is registered but its state could not be read.',
211 ],
212 };
213 }
214 const row = parseSchtasksQuery(query.stdout);
215 const taskStatus = row?.['Status'];
216 const running = taskStatus === 'Running';
217 return {
218 ...base,
219 running,
220 notes: [`schtasks status: ${taskStatus ?? 'unknown'}`],
221 };
222 }
223
224 return { install, uninstall, start, stop, restart, status };
225}

Callers

nothing calls this directly

Calls 6

readInstallPlanFunction · 0.90
parseSchtasksQueryFunction · 0.90
taskExistsMethod · 0.80
execSchtasksMethod · 0.80
detailFunction · 0.70
logPathMethod · 0.65

Tested by

no test coverage detected