
























@@ -221,6 +221,11 @@ describe("user turn transcript persistence", () => {
221221it("appends a structured user turn through the shared transcript writer", async () => {
222222const dir = createTempDir("openclaw-user-turn-append-");
223223const transcriptPath = path.join(dir, "session.jsonl");
224+const provenance = {
225+kind: "inter_session" as const,
226+sourceSessionKey: "source-main",
227+sourceTool: "sessions_send",
228+};
224229225230const appended = await appendUserTurnTranscriptMessage({
226231 transcriptPath,
@@ -231,11 +236,7 @@ describe("user turn transcript persistence", () => {
231236text: "What is in this image?",
232237media: [{ path: "/tmp/image.png", contentType: "image/png" }],
233238timestamp: 123,
234-provenance: {
235-kind: "inter_session",
236-sourceSessionKey: "source-main",
237-sourceTool: "sessions_send",
238-},
239+ provenance,
239240},
240241updateMode: "none",
241242});
@@ -250,11 +251,7 @@ describe("user turn transcript persistence", () => {
250251role: "user",
251252content: "What is in this image?",
252253MediaPath: "/tmp/image.png",
253-provenance: {
254-kind: "inter_session",
255-sourceSessionKey: "source-main",
256-sourceTool: "sessions_send",
257-},
254+ provenance,
258255MediaType: "image/png",
259256}),
260257]);
@@ -336,6 +333,11 @@ describe("user turn transcript persistence", () => {
336333337334it("preserves idempotency keys when before_message_write replaces a user turn", async () => {
338335let hookCalls = 0;
336+const provenance = {
337+kind: "inter_session" as const,
338+sourceSessionKey: "source-main",
339+sourceTool: "sessions_send",
340+};
339341initializeGlobalHookRunner(
340342createMockPluginRegistry([
341343{
@@ -360,6 +362,7 @@ describe("user turn transcript persistence", () => {
360362input: {
361363text: "secret prompt",
362364idempotencyKey: "chat-run-1:user",
365+ provenance,
363366},
364367beforeMessageWrite: runAgentHarnessBeforeMessageWriteHook,
365368});
@@ -368,6 +371,7 @@ describe("user turn transcript persistence", () => {
368371input: {
369372text: "secret prompt",
370373idempotencyKey: "chat-run-1:user",
374+ provenance,
371375},
372376beforeMessageWrite: runAgentHarnessBeforeMessageWriteHook,
373377});
@@ -377,6 +381,7 @@ describe("user turn transcript persistence", () => {
377381role: "user",
378382content: "[redacted by hook]",
379383idempotencyKey: "chat-run-1:user",
384+ provenance,
380385}),
381386]);
382387expect(hookCalls).toBe(1);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。