refactor: remove file-only transcript update mode

This commit is contained in:
Peter Steinberger
2026-05-08 21:27:53 +01:00
parent d4f6a04e51
commit 257bb2cb87
6 changed files with 15 additions and 13 deletions

View File

@@ -469,10 +469,11 @@ export function chunkMarkdown(
* source file positions using a lineMap. Each entry in lineMap gives the
* 1-indexed source line for the corresponding 0-indexed content line.
*
* This is used for session JSONL files where buildSessionTranscriptEntry() flattens
* messages into a plain-text string before chunking. Without remapping the
* stored line numbers would reference positions in the flattened text rather
* than the original JSONL file.
* This is used for SQLite-backed session transcripts where
* buildSessionTranscriptEntry() flattens messages into a plain-text string
* before chunking. Without remapping the stored line numbers would reference
* positions in the flattened text rather than the original transcript event
* sequence.
*/
export function remapChunkLines(chunks: MemoryChunk[], lineMap: number[] | undefined): void {
if (!lineMap || lineMap.length === 0) {

View File

@@ -400,13 +400,13 @@ describe("appendAssistantMessageToSessionTranscript", () => {
}
});
it("can emit file-only transcript refresh events for exact assistant appends", async () => {
it("can emit signal-only transcript refresh events for exact assistant appends", async () => {
await writeTranscriptStore();
const emitSpy = vi.spyOn(transcriptEvents, "emitSessionTranscriptUpdate");
const result = await appendExactAssistantMessageToSessionTranscript({
sessionKey,
updateMode: "file-only",
updateMode: "signal-only",
message: createExactAssistantMessage({
text: "Done.",
provider: "openclaw",

View File

@@ -24,7 +24,7 @@ export type SessionTranscriptAppendResult =
| { ok: true; sessionFile: string; messageId: string }
| { ok: false; reason: string };
export type SessionTranscriptUpdateMode = "inline" | "file-only" | "none";
export type SessionTranscriptUpdateMode = "inline" | "signal-only" | "none";
export type SessionTranscriptAssistantMessage = Parameters<SessionManager["appendMessage"]>[0] & {
role: "assistant";
@@ -299,7 +299,7 @@ export async function appendExactAssistantMessageToSessionTranscript(params: {
messageId,
});
break;
case "file-only":
case "signal-only":
emitSessionTranscriptUpdate({
agentId,
sessionId: entry.sessionId,

View File

@@ -2045,8 +2045,9 @@ export function listSessionsFromStore(params: {
* batches of session row builds. This prevents large session row sets from
* blocking the event loop during sessions.list requests.
*
* The synchronous file I/O in readSessionTitleFieldsFromTranscript (head/tail
* reads for derived titles and last-message previews) is the dominant blocker.
* The synchronous transcript lookup in readSessionTitleFieldsFromTranscript
* (SQLite event scans for derived titles and last-message previews) is the
* dominant blocker.
* By yielding every SESSIONS_LIST_YIELD_BATCH_SIZE rows, we keep the event
* loop responsive for WebSocket heartbeats, channel I/O, and concurrent RPC.
*/

View File

@@ -80,7 +80,7 @@ async function appendTranscriptMessage(params: {
}): Promise<string> {
const appended = await appendExactAssistantMessageToSessionTranscript({
sessionKey: params.sessionKey,
updateMode: params.emitInlineMessage === false ? "file-only" : "inline",
updateMode: params.emitInlineMessage === false ? "signal-only" : "inline",
message: params.message,
});
expect(appended.ok).toBe(true);

View File

@@ -1236,8 +1236,8 @@ export function createHookRunner(
* session transcripts are appended synchronously.
*
* Handlers are executed sequentially in priority order (higher first).
* If any handler returns { block: true }, the message is NOT written
* to the session JSONL and we return immediately.
* If any handler returns { block: true }, the message is NOT persisted
* to the SQLite transcript and we return immediately.
* If a handler returns { message }, the modified message replaces the
* original for subsequent handlers and the final write.
*/