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

Method deleteSession

src/context/storage/PersistentStore.ts:147–159  ·  view source on GitHub ↗

* 删除会话数据

(sessionId: string)

Source from the content-addressed store, hash-verified

145 * 删除会话数据
146 */
147 async deleteSession(sessionId: string): Promise<void> {
148 try {
149 const sessionPath = path.join(this.storagePath, 'sessions', `${sessionId}.json`);
150 const conversationPath = path.join(this.storagePath, 'conversations', `${sessionId}.json`);
151
152 await Promise.all([
153 fs.unlink(sessionPath).catch(() => {}),
154 fs.unlink(conversationPath).catch(() => {}),
155 ]);
156 } catch (error) {
157 console.warn(`警告:无法删除会话 ${sessionId}:`, error);
158 }
159 }
160
161 /**
162 * 清理旧会话(保持最近的N个会话)

Callers 1

cleanupOldSessionsMethod · 0.95

Calls 1

warnMethod · 0.45

Tested by

no test coverage detected