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

Function postSession

packages/server/test/snapshot.perf.test.ts:45–57  ·  view source on GitHub ↗
(baseUrl: string, cwd: string)

Source from the content-addressed store, hash-verified

43});
44
45async function postSession(baseUrl: string, cwd: string): Promise<string> {
46 const res = await fetch(
47 `${baseUrl}/api/v1/sessions`,
48 withAuth({
49 method: 'POST',
50 headers: { 'content-type': 'application/json' },
51 body: JSON.stringify({ metadata: { cwd } }),
52 }),
53 );
54 const env = (await res.json()) as { code: number; data: { id: string } | null };
55 if (env.code !== 0 || env.data === null) throw new Error(JSON.stringify(env));
56 return env.data.id;
57}
58
59async function timeSnapshot(baseUrl: string, sid: string): Promise<number> {
60 const t = performance.now();

Callers 1

Calls 2

withAuthFunction · 0.90
jsonMethod · 0.80

Tested by

no test coverage detected