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

Method createSession

apps/kimi-web/src/api/daemon/client.ts:314–333  ·  view source on GitHub ↗
(input: {
    title?: string;
    cwd?: string;
    model?: string;
    workspaceId?: string;
  })

Source from the content-addressed store, hash-verified

312 }
313
314 async createSession(input: {
315 title?: string;
316 cwd?: string;
317 model?: string;
318 workspaceId?: string;
319 }): Promise<AppSession> {
320 // The real daemon requires `metadata` to be an object (rejects a missing
321 // metadata with 40001), so always send it — with cwd when provided.
322 const body: Record<string, unknown> = {
323 metadata: input.cwd !== undefined ? { cwd: input.cwd } : {},
324 };
325 // PRESUMED — daemon resolves cwd from workspace_id once the registry ships.
326 // We ALSO send metadata.cwd (above) as the fallback so today's daemon, which
327 // only understands cwd, still creates the session in the right folder.
328 if (input.workspaceId !== undefined) body['workspace_id'] = input.workspaceId;
329 if (input.title !== undefined) body['title'] = input.title;
330 if (input.model !== undefined) body['agent_config'] = { model: input.model };
331 const data = await this.http.post<WireSession>('/sessions', body);
332 return toAppSession(data);
333 }
334
335 // GET /sessions/{id} — fetch one session (deep links to sessions outside the
336 // first listSessions page).

Callers

nothing calls this directly

Calls 1

toAppSessionFunction · 0.90

Tested by

no test coverage detected