MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / append

Method append

src/core/session.ts:174–189  ·  view source on GitHub ↗
(partial: Omit<SessionEntry, 'uuid' | 'parentUuid' | 'sessionId' | 'timestamp'>)

Source from the content-addressed store, hash-verified

172 }
173
174 private async append(partial: Omit<SessionEntry, 'uuid' | 'parentUuid' | 'sessionId' | 'timestamp'>): Promise<SessionEntry> {
175 const entry: SessionEntry = {
176 ...partial,
177 uuid: randomUUID(),
178 parentUuid: this.lastUuid,
179 sessionId: this.sessionId,
180 timestamp: new Date().toISOString(),
181 cwd: process.cwd(),
182 }
183
184 await mkdir(dirname(this.filePath), { recursive: true })
185 await appendFile(this.filePath, JSON.stringify(entry) + '\n')
186
187 this.lastUuid = entry.uuid
188 return entry
189 }
190}
191
192// ==================== In-Memory Session Store ====================

Callers 2

appendUserMethod · 0.95
appendAssistantMethod · 0.95

Calls 1

cwdMethod · 0.80

Tested by

no test coverage detected