( logsDir: string, wsId: string, harness: string, ctx: ParseContext, )
| 236 | } |
| 237 | |
| 238 | export function processWorkspaceEntry( |
| 239 | logsDir: string, |
| 240 | wsId: string, |
| 241 | harness: string, |
| 242 | ctx: ParseContext, |
| 243 | ): string { |
| 244 | const { workspaces, sessions, editLocIndex, sessionSourceIndex } = ctx; |
| 245 | const startIdx = sessions.length; |
| 246 | const { entryPath, wsName, isCLI, customInstructionsBytes } = initializeWorkspaceEntry(logsDir, wsId, harness, workspaces); |
| 247 | |
| 248 | if (isCLI) { |
| 249 | const eventsFile = path.join(entryPath, 'events.jsonl'); |
| 250 | const cliSession = parseCLIEventsFile(eventsFile, wsId, wsName, customInstructionsBytes); |
| 251 | if (cliSession) { |
| 252 | sessions.push(cliSession); |
| 253 | sessionSourceIndex.set(cliSession.sessionId, { |
| 254 | kind: 'cli-events', |
| 255 | filePath: eventsFile, |
| 256 | workspaceId: wsId, |
| 257 | workspaceName: wsName, |
| 258 | harness, |
| 259 | }); |
| 260 | } |
| 261 | stripSessionsFrom(sessions, startIdx); |
| 262 | return wsName; |
| 263 | } |
| 264 | |
| 265 | const chatDir = path.join(entryPath, 'chatSessions'); |
| 266 | for (const sessionFile of listChatSessionFiles(chatDir)) { |
| 267 | const session = parseSessionFile(sessionFile, wsId, wsName, harness, customInstructionsBytes); |
| 268 | if (session) { |
| 269 | sessions.push(session); |
| 270 | sessionSourceIndex.set(session.sessionId, { |
| 271 | kind: 'vscode-session-file', |
| 272 | filePath: sessionFile, |
| 273 | workspaceId: wsId, |
| 274 | workspaceName: wsName, |
| 275 | harness, |
| 276 | }); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | const eventsFile = path.join(entryPath, 'events.jsonl'); |
| 281 | const cliSession = parseCLIEventsFile(eventsFile, wsId, wsName, customInstructionsBytes); |
| 282 | if (cliSession) { |
| 283 | sessions.push(cliSession); |
| 284 | sessionSourceIndex.set(cliSession.sessionId, { |
| 285 | kind: 'cli-events', |
| 286 | filePath: eventsFile, |
| 287 | workspaceId: wsId, |
| 288 | workspaceName: wsName, |
| 289 | harness, |
| 290 | }); |
| 291 | } |
| 292 | |
| 293 | const esDir = path.join(entryPath, 'chatEditingSessions'); |
| 294 | for (const stateFile of listEditStateFiles(esDir)) { |
| 295 | parseEditStateFile(stateFile, editLocIndex); |
no test coverage detected