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

Method updateSession

apps/kimi-web/src/api/daemon/client.ts:350–381  ·  view source on GitHub ↗
(
    sessionId: string,
    input: {
      title?: string;
      cwd?: string;
      model?: string;
      permissionMode?: string;
      planMode?: boolean;
      swarmMode?: boolean;
      goalObjective?: string;
      goalControl?: 'pause' | 'resume' | 'cancel';
      thinking?: string;
    },
  )

Source from the content-addressed store, hash-verified

348 // setPermission/enterPlan|cancelPlan); the live values are read back from
349 // GET /sessions/{id}/status (the profile echo's agent_config can be stale/"").
350 async updateSession(
351 sessionId: string,
352 input: {
353 title?: string;
354 cwd?: string;
355 model?: string;
356 permissionMode?: string;
357 planMode?: boolean;
358 swarmMode?: boolean;
359 goalObjective?: string;
360 goalControl?: 'pause' | 'resume' | 'cancel';
361 thinking?: string;
362 },
363 ): Promise<AppSession> {
364 const body: Record<string, unknown> = {};
365 if (input.title !== undefined) body['title'] = input.title;
366 if (input.cwd !== undefined) body['metadata'] = { cwd: input.cwd };
367 const agentConfig: Record<string, unknown> = {};
368 if (input.model !== undefined) agentConfig['model'] = input.model;
369 if (input.permissionMode !== undefined) agentConfig['permission_mode'] = input.permissionMode;
370 if (input.planMode !== undefined) agentConfig['plan_mode'] = input.planMode;
371 if (input.swarmMode !== undefined) agentConfig['swarm_mode'] = input.swarmMode;
372 if (input.goalObjective !== undefined) agentConfig['goal_objective'] = input.goalObjective;
373 if (input.goalControl !== undefined) agentConfig['goal_control'] = input.goalControl;
374 if (input.thinking !== undefined) agentConfig['thinking'] = input.thinking;
375 if (Object.keys(agentConfig).length > 0) body['agent_config'] = agentConfig;
376 const data = await this.http.post<WireSession>(
377 `/sessions/${encodeURIComponent(sessionId)}/profile`,
378 body,
379 );
380 return toAppSession(data);
381 }
382
383 /**
384 * GET /sessions/{id}/status — the session's live runtime state (current model,

Callers

nothing calls this directly

Calls 2

toAppSessionFunction · 0.90
keysMethod · 0.80

Tested by

no test coverage detected