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

Function resolveServerToken

apps/kimi-code/src/cli/sub/server/shared.ts:232–242  ·  view source on GitHub ↗
(homeDir: string)

Source from the content-addressed store, hash-verified

230 * build that predates token auth.
231 */
232export function resolveServerToken(homeDir: string): string {
233 const tokenPath = join(homeDir, SERVER_TOKEN_FILE);
234 try {
235 return readFileSync(tokenPath, 'utf8').trim();
236 } catch (error) {
237 throw new Error(
238 `unable to read server token at ${tokenPath}; has the server been started at least once?`,
239 { cause: error },
240 );
241 }
242}
243
244/** Best-effort token read: returns `undefined` instead of throwing. */
245export function tryResolveServerToken(homeDir: string): string | undefined {

Callers 3

handlePsCommandFunction · 0.90
server.test.tsFile · 0.85
tryResolveServerTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected