Files
openclaw/src/agents/pi-embedded-helpers/bootstrap.test.ts
Ayaan Zaidi c65e152b39 fix: preserve anthropic thinking replay (#58916)
* test: add anthropic thinking replay regressions

* fix: preserve anthropic thinking blocks on replay

* fix: preserve anthropic thinking replay (#58916)

* fix: move anthropic replay changelog entry (#58916)
2026-04-01 16:23:47 +05:30

44 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { stripThoughtSignatures } from "./bootstrap.js";
describe("stripThoughtSignatures", () => {
it("preserves thinkingSignature while still stripping invalid thought signatures", () => {
const thinkingBlock = {
type: "thinking",
thinking: "internal",
thinkingSignature: "keep_me",
thoughtSignature: "msg_123",
};
const redactedBlock = {
type: "redacted_thinking",
redacted_thinking: "...",
thinkingSignature: "keep_me_too",
thoughtSignature: "msg_456",
};
const textBlock = {
type: "text",
text: "visible",
thoughtSignature: "msg_789",
};
const result = stripThoughtSignatures([thinkingBlock, redactedBlock, textBlock], {
includeCamelCase: true,
});
expect(result[0]).toEqual({
type: "thinking",
thinking: "internal",
thinkingSignature: "keep_me",
});
expect(result[1]).toEqual({
type: "redacted_thinking",
redacted_thinking: "...",
thinkingSignature: "keep_me_too",
});
expect(result[2]).toEqual({
type: "text",
text: "visible",
});
});
});