mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 14:34:47 +00:00
* 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)
44 lines
1.1 KiB
TypeScript
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",
|
|
});
|
|
});
|
|
});
|