fix: fix bug conversation log syncronization

This commit is contained in:
d-kimsuon
2025-10-15 12:59:05 +09:00
parent f34943c9cc
commit 7c05168e4e
12 changed files with 109 additions and 21 deletions

View File

@@ -1,6 +1,9 @@
import { resolve } from "node:path";
import { ulid } from "ulid";
import type { Config } from "../../config/config";
import { eventBus } from "../events/EventBus";
import { parseCommandXml } from "../parseCommandXml";
import { decodeProjectId } from "../project/id";
import { predictSessionsDatabase } from "../session/PredictSessionsDatabase";
import { ClaudeCodeExecutor } from "./ClaudeCodeExecutor";
import { createMessageGenerator } from "./createMessageGenerator";
@@ -270,7 +273,10 @@ class ClaudeCodeTaskController {
// because it takes time for the Claude Code file to be updated, simulate the message
predictSessionsDatabase.createPredictSession({
id: message.session_id,
jsonlFilePath: message.session_id,
jsonlFilePath: resolve(
decodeProjectId(currentSession.projectId),
`${message.session_id}.jsonl`,
),
conversations: [
{
type: "user",
@@ -289,11 +295,15 @@ class ClaudeCodeTaskController {
},
],
meta: {
firstCommand: null,
firstCommand: parseCommandXml(userMessage),
messageCount: 0,
},
lastModifiedAt: new Date(),
});
eventBus.emit("sessionListChanged", {
projectId: task.projectId,
});
}
if (!resolved) {
@@ -421,12 +431,10 @@ class ClaudeCodeTaskController {
Object.assign(target, task);
}
if (task.status === "paused" || task.status === "running") {
eventBus.emit("taskChanged", {
aliveTasks: this.aliveTasks,
changed: task,
});
}
eventBus.emit("taskChanged", {
aliveTasks: this.aliveTasks,
changed: task,
});
}
}