(partial: Omit<SessionEntry, 'uuid' | 'parentUuid' | 'sessionId' | 'timestamp'>)
| 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 ==================== |
no test coverage detected