MCPcopy Create free account
hub / github.com/echoVic/blade-code / saveSession

Method saveSession

src/context/storage/PersistentStore.ts:33–44  ·  view source on GitHub ↗

* 保存会话上下文

(sessionId: string, sessionContext: SessionContext)

Source from the content-addressed store, hash-verified

31 * 保存会话上下文
32 */
33 async saveSession(sessionId: string, sessionContext: SessionContext): Promise<void> {
34 try {
35 const sessionPath = path.join(this.storagePath, 'sessions', `${sessionId}.json`);
36 const data = {
37 ...sessionContext,
38 lastSaved: Date.now(),
39 };
40 await fs.writeFile(sessionPath, JSON.stringify(data, null, 2), 'utf-8');
41 } catch (error) {
42 console.warn(`警告:无法保存会话 ${sessionId}:`, error);
43 }
44 }
45
46 /**
47 * 加载会话上下文

Callers 1

saveContextMethod · 0.95

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected