





















@@ -53,6 +53,13 @@ function writeSessionJsonl(fileName: string, records: readonly unknown[]): strin
5353return filePath;
5454}
555556+function buildSessionEntryWithoutStoreClassification(filePath: string) {
57+return buildSessionEntry(filePath, {
58+generatedByCronRun: false,
59+generatedByDreamingNarrative: false,
60+});
61+}
62+5663describe("listSessionFilesForAgent", () => {
5764it("includes reset and deleted transcripts in session file listing", async () => {
5865const sessionsDir = path.join(tmpDir, "agents", "main", "sessions");
@@ -104,7 +111,7 @@ describe("buildSessionEntry", () => {
104111const filePath = path.join(tmpDir, "session.jsonl");
105112fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
106113107-const entry = await buildSessionEntry(filePath);
114+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
108115expect(entry).not.toBeNull();
109116110117// The content should have 3 lines (3 message records)
@@ -131,7 +138,7 @@ describe("buildSessionEntry", () => {
131138const filePath = path.join(tmpDir, "empty-session.jsonl");
132139fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
133140134-const entry = await buildSessionEntry(filePath);
141+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
135142expect(entry).not.toBeNull();
136143expect(entry!.content).toBe("");
137144expect(entry!.lineMap).toEqual([]);
@@ -149,7 +156,7 @@ describe("buildSessionEntry", () => {
149156const filePath = path.join(tmpDir, "gaps.jsonl");
150157fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
151158152-const entry = await buildSessionEntry(filePath);
159+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
153160expect(entry).not.toBeNull();
154161expect(entry!.lineMap).toEqual([3, 5]);
155162expect(entry!.messageTimestampsMs).toEqual([0, 0]);
@@ -174,7 +181,7 @@ describe("buildSessionEntry", () => {
174181const filePath = path.join(tmpDir, "timestamps.jsonl");
175182fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
176183177-const entry = await buildSessionEntry(filePath);
184+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
178185expect(entry).not.toBeNull();
179186expect(entry!.messageTimestampsMs).toEqual([
180187Date.parse("2026-04-05T10:00:00.000Z"),
@@ -215,7 +222,7 @@ describe("buildSessionEntry", () => {
215222const filePath = path.join(tmpDir, "enveloped-session.jsonl");
216223fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
217224218-const entry = await buildSessionEntry(filePath);
225+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
219226expect(entry).not.toBeNull();
220227221228const contentLines = entry!.content.split("\n");
@@ -253,7 +260,7 @@ describe("buildSessionEntry", () => {
253260const filePath = path.join(tmpDir, "enveloped-session-array.jsonl");
254261fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
255262256-const entry = await buildSessionEntry(filePath);
263+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
257264expect(entry).not.toBeNull();
258265expect(entry!.content).toBe("User: Actual user text");
259266});
@@ -271,7 +278,7 @@ describe("buildSessionEntry", () => {
271278const filePath = path.join(tmpDir, "wrapped-session.jsonl");
272279fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
273280274-const entry = await buildSessionEntry(filePath);
281+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
275282expect(entry).not.toBeNull();
276283277284const contentLines = entry!.content.split("\n");
@@ -293,7 +300,7 @@ describe("buildSessionEntry", () => {
293300const filePath = path.join(tmpDir, "hard-wrapped-session.jsonl");
294301fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
295302296-const entry = await buildSessionEntry(filePath);
303+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
297304expect(entry).not.toBeNull();
298305299306const contentLines = entry!.content.split("\n");
@@ -317,7 +324,7 @@ describe("buildSessionEntry", () => {
317324const filePath = path.join(tmpDir, "surrogate-safe-session.jsonl");
318325fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
319326320-const entry = await buildSessionEntry(filePath);
327+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
321328expect(entry).not.toBeNull();
322329323330const contentLines = entry!.content.split("\n");
@@ -344,7 +351,7 @@ describe("buildSessionEntry", () => {
344351const filePath = path.join(tmpDir, "assistant-sentinel.jsonl");
345352fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
346353347-const entry = await buildSessionEntry(filePath);
354+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
348355expect(entry).not.toBeNull();
349356expect(entry!.content).toBe(`Assistant: ${assistantText}`);
350357});
@@ -367,7 +374,7 @@ describe("buildSessionEntry", () => {
367374const filePath = path.join(tmpDir, "dreaming-session.jsonl");
368375fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
369376370-const entry = await buildSessionEntry(filePath);
377+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
371378372379expect(entry).not.toBeNull();
373380expect(entry?.generatedByDreamingNarrative).toBe(true);
@@ -478,7 +485,7 @@ describe("buildSessionEntry", () => {
478485const filePath = path.join(tmpDir, "dreaming-prompt-session.jsonl");
479486fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
480487481-const entry = await buildSessionEntry(filePath);
488+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
482489483490expect(entry).not.toBeNull();
484491expect(entry?.generatedByDreamingNarrative).toBeUndefined();
@@ -595,7 +602,7 @@ describe("buildSessionEntry", () => {
595602596603for (const testCase of cases) {
597604const filePath = writeSessionJsonl(testCase.fileName, testCase.records);
598-const entry = await buildSessionEntry(filePath);
605+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
599606600607expect(entry, testCase.name).not.toBeNull();
601608expect(entry?.content, testCase.name).toBe(testCase.content);
@@ -626,7 +633,7 @@ describe("buildSessionEntry", () => {
626633const filePath = path.join(tmpDir, "spoof-attempt-session.jsonl");
627634fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
628635629-const entry = await buildSessionEntry(filePath);
636+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
630637631638expect(entry).not.toBeNull();
632639expect(entry?.content).toContain(
@@ -644,8 +651,8 @@ describe("buildSessionEntry", () => {
644651fsSync.writeFileSync(deletedPath, content);
645652fsSync.writeFileSync(checkpointPath, content);
646653647-const deletedEntry = await buildSessionEntry(deletedPath);
648-const checkpointEntry = await buildSessionEntry(checkpointPath);
654+const deletedEntry = await buildSessionEntryWithoutStoreClassification(deletedPath);
655+const checkpointEntry = await buildSessionEntryWithoutStoreClassification(checkpointPath);
649656650657expect(deletedEntry).not.toBeNull();
651658expect(deletedEntry?.content).toBe("");
@@ -672,7 +679,7 @@ describe("buildSessionEntry", () => {
672679const filePath = path.join(tmpDir, "substring-marker-session.jsonl");
673680fsSync.writeFileSync(filePath, jsonlLines.join("\n"));
674681675-const entry = await buildSessionEntry(filePath);
682+const entry = await buildSessionEntryWithoutStoreClassification(filePath);
676683677684expect(entry).not.toBeNull();
678685expect(entry?.generatedByDreamingNarrative).toBeUndefined();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。