






















@@ -10,7 +10,6 @@ import {
1010dropReasoningFromHistory,
1111dropThinkingBlocks,
1212isAssistantMessageWithContent,
13-sanitizeThinkingForRecovery,
1413stripInvalidThinkingSignatures,
1514stripStaleThinkingSignaturesForCompactionReplay,
1615wrapAnthropicStreamWithRecovery,
@@ -406,50 +405,7 @@ describe("stripInvalidThinkingSignatures", () => {
406405});
407406});
408407409-describe("sanitizeThinkingForRecovery", () => {
410-it("drops the latest assistant message when the thinking block is unsigned", () => {
411-const messages = castAgentMessages([
412-{ role: "user", content: "hello" },
413-{
414-role: "assistant",
415-content: [{ type: "thinking", thinking: "partial" }],
416-},
417-]);
418-419-const result = sanitizeThinkingForRecovery(messages);
420-expect(result.messages).toEqual([messages[0]]);
421-expect(result.prefill).toBe(false);
422-});
423-424-it("preserves later turns when dropping an incomplete assistant message", () => {
425-const messages = castAgentMessages([
426-{ role: "user", content: "hello" },
427-{
428-role: "assistant",
429-content: [{ type: "thinking", thinking: "partial" }],
430-},
431-{ role: "user", content: "follow up" },
432-]);
433-434-const result = sanitizeThinkingForRecovery(messages);
435-expect(result.messages).toEqual([messages[0], messages[2]]);
436-expect(result.prefill).toBe(false);
437-});
438-439-it("marks signed thinking without text as a prefill recovery case", () => {
440-const messages = castAgentMessages([
441-{ role: "user", content: "hello" },
442-{
443-role: "assistant",
444-content: [{ type: "thinking", thinking: "complete", thinkingSignature: "sig" }],
445-},
446-]);
447-448-const result = sanitizeThinkingForRecovery(messages);
449-expect(result.messages).toBe(messages);
450-expect(result.prefill).toBe(true);
451-});
452-408+describe("assessLastAssistantMessage", () => {
453409it("marks signed thinking with an empty text block as incomplete text", () => {
454410const message = castAgentMessage({
455411role: "assistant",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。