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

Method createSession

packages/node-sdk/src/kimi-harness.ts:92–114  ·  view source on GitHub ↗
(options: CreateSessionOptions)

Source from the content-addressed store, hash-verified

90 }
91
92 async createSession(options: CreateSessionOptions): Promise<Session> {
93 const { planMode, kaos, persistenceKaos, sessionStartedProperties, ...coreOptions } = options;
94 const summary =
95 kaos === undefined && persistenceKaos === undefined
96 ? await this.rpc.createSession(coreOptions)
97 : await this.rpc.createSessionWithKaos(coreOptions, kaos ?? persistenceKaos as Kaos, persistenceKaos);
98 const session = new Session({
99 id: summary.id,
100 workDir: summary.workDir,
101 summary,
102 rpc: this.rpc,
103 onClose: () => {
104 this.activeSessions.delete(summary.id);
105 },
106 });
107 this.activeSessions.set(session.id, session);
108 if (planMode === true) {
109 await session.setPlanMode(true);
110 }
111 this.trackSessionStarted(summary.id, false, sessionStartedProperties);
112 this.trackSessionEvent(session.id, 'session_new');
113 return session;
114 }
115
116 async resumeSession(input: ResumeSessionInput): Promise<Session> {
117 const id = normalizeSessionId(input.id);

Callers

nothing calls this directly

Calls 7

setPlanModeMethod · 0.95
trackSessionStartedMethod · 0.95
trackSessionEventMethod · 0.95
createSessionWithKaosMethod · 0.80
createSessionMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected