





















@@ -308,10 +308,10 @@ describe("google transport stream", () => {
308308{
309309content: {
310310parts: [
311-{ thought: true, text: "draft", thoughtSignature: "sig_1" },
311+{ thought: true, text: "draft", thoughtSignature: "c2lnXzE=" },
312312{ text: "answer" },
313313{
314-thoughtSignature: "call_sig_1",
314+thoughtSignature: "Y2FsbF9zaWdfMQ==",
315315functionCall: { name: "lookup", args: { q: "hello" } },
316316},
317317],
@@ -416,14 +416,14 @@ describe("google transport stream", () => {
416416expect(result.content[0]).toEqual({
417417type: "thinking",
418418thinking: "draft",
419-thinkingSignature: "sig_1",
419+thinkingSignature: "c2lnXzE=",
420420});
421421expect(result.content[1]?.type).toBe("text");
422422expect(result.content[1]).toHaveProperty("text", "answer");
423423expect(result.content[2]?.type).toBe("toolCall");
424424expect(result.content[2]).toHaveProperty("name", "lookup");
425425expect(result.content[2]).toHaveProperty("arguments", { q: "hello" });
426-expect(result.content[2]).toHaveProperty("thoughtSignature", "call_sig_1");
426+expect(result.content[2]).toHaveProperty("thoughtSignature", "Y2FsbF9zaWdfMQ==");
427427});
428428429429it("merges tool-call thought signatures from sibling SSE parts", async () => {
@@ -437,7 +437,7 @@ describe("google transport stream", () => {
437437{
438438functionCall: { id: "call_1", name: "lookup", args: { q: "hello" } },
439439},
440-{ thoughtSignature: "call_sig_merged_1" },
440+{ thoughtSignature: "Y2FsbF9zaWdfbWVyZ2VkXzE=" },
441441],
442442},
443443finishReason: "STOP",
@@ -467,7 +467,7 @@ describe("google transport stream", () => {
467467id: "call_1",
468468name: "lookup",
469469arguments: { q: "hello" },
470-thoughtSignature: "call_sig_merged_1",
470+thoughtSignature: "Y2FsbF9zaWdfbWVyZ2VkXzE=",
471471},
472472]);
473473});
@@ -483,7 +483,7 @@ describe("google transport stream", () => {
483483{
484484functionCall: { id: "call_1", name: "lookup", args: { q: "hello" } },
485485},
486-{ thought: true, thoughtSignature: "thought_sig_after_call" },
486+{ thought: true, thoughtSignature: "dGhvdWdodF9zaWdfYWZ0ZXJfY2FsbA==" },
487487{ thought: true, text: "draft" },
488488{ text: "answer" },
489489],
@@ -518,7 +518,7 @@ describe("google transport stream", () => {
518518expect(result.content[1]).toEqual({
519519type: "thinking",
520520thinking: "draft",
521-thinkingSignature: "thought_sig_after_call",
521+thinkingSignature: "dGhvdWdodF9zaWdfYWZ0ZXJfY2FsbA==",
522522});
523523expect(result.content[2]).toEqual({ type: "text", text: "answer" });
524524});
@@ -984,7 +984,7 @@ describe("google transport stream", () => {
984984id: "call_1",
985985name: "lookup",
986986arguments: { q: "hello" },
987-thoughtSignature: "call_sig_1",
987+thoughtSignature: "Y2FsbF9zaWdfMQ==",
988988},
989989],
990990},
@@ -995,7 +995,7 @@ describe("google transport stream", () => {
995995role: "model",
996996parts: [
997997{
998-thoughtSignature: "call_sig_1",
998+thoughtSignature: "Y2FsbF9zaWdfMQ==",
999999functionCall: { name: "lookup", args: { q: "hello" } },
10001000},
10011001],
@@ -1010,7 +1010,7 @@ describe("google transport stream", () => {
1010101010111011const params = buildGoogleGenerativeAiParams(model, {
10121012messages: [
1013-googleToolCallAssistantTurn({ thoughtSignature: "call_sig_replay_1" }),
1013+googleToolCallAssistantTurn({ thoughtSignature: "Y2FsbF9zaWdfcmVwbGF5XzE=" }),
10141014toolResultTurn(),
10151015googleToolCallAssistantTurn({ timestamp: 2 }),
10161016],
@@ -1022,7 +1022,7 @@ describe("google transport stream", () => {
10221022role: "model",
10231023parts: [
10241024{
1025-thoughtSignature: "call_sig_replay_1",
1025+thoughtSignature: "Y2FsbF9zaWdfcmVwbGF5XzE=",
10261026functionCall: { name: "lookup", args: { q: "hello" } },
10271027},
10281028],
@@ -1040,7 +1040,7 @@ describe("google transport stream", () => {
1040104010411041const params = buildGoogleGenerativeAiParams(model, {
10421042messages: [
1043-googleToolCallAssistantTurn({ thoughtSignature: "call_sig_alias_1" }),
1043+googleToolCallAssistantTurn({ thoughtSignature: "Y2FsbF9zaWdfYWxpYXNfMQ==" }),
10441044toolResultTurn(),
10451045googleToolCallAssistantTurn({ timestamp: 2 }),
10461046],
@@ -1050,7 +1050,7 @@ describe("google transport stream", () => {
10501050role: "model",
10511051parts: [
10521052{
1053-thoughtSignature: "call_sig_alias_1",
1053+thoughtSignature: "Y2FsbF9zaWdfYWxpYXNfMQ==",
10541054functionCall: { name: "lookup", args: { q: "hello" } },
10551055},
10561056],
@@ -1079,12 +1079,12 @@ describe("google transport stream", () => {
10791079{
10801080type: "thinking",
10811081thinking: "plan",
1082-thinkingSignature: "think_sig_alias_1",
1082+thinkingSignature: "dGhpbmtfc2lnX2FsaWFzXzE=",
10831083},
10841084{
10851085type: "text",
10861086text: "answer",
1087-textSignature: "text_sig_alias_1",
1087+textSignature: "dGV4dF9zaWdfYWxpYXNfMQ==",
10881088},
10891089],
10901090},
@@ -1097,11 +1097,11 @@ describe("google transport stream", () => {
10971097{
10981098thought: true,
10991099text: "plan",
1100-thoughtSignature: "think_sig_alias_1",
1100+thoughtSignature: "dGhpbmtfc2lnX2FsaWFzXzE=",
11011101},
11021102{
11031103text: "answer",
1104-thoughtSignature: "text_sig_alias_1",
1104+thoughtSignature: "dGV4dF9zaWdfYWxpYXNfMQ==",
11051105},
11061106],
11071107});
@@ -1115,7 +1115,7 @@ describe("google transport stream", () => {
1115111511161116const params = buildGoogleGenerativeAiParams(model, {
11171117messages: [
1118-googleToolCallAssistantTurn({ thoughtSignature: "opaque.sig-url_safe~1" }),
1118+googleToolCallAssistantTurn({ thoughtSignature: "b3BhcXVlLnNpZy11cmxfc2FmZX4x" }),
11191119toolResultTurn(),
11201120googleToolCallAssistantTurn({ timestamp: 2 }),
11211121],
@@ -1125,7 +1125,7 @@ describe("google transport stream", () => {
11251125role: "model",
11261126parts: [
11271127{
1128-thoughtSignature: "opaque.sig-url_safe~1",
1128+thoughtSignature: "b3BhcXVlLnNpZy11cmxfc2FmZX4x",
11291129functionCall: { name: "lookup", args: { q: "hello" } },
11301130},
11311131],
@@ -1140,11 +1140,11 @@ describe("google transport stream", () => {
1140114011411141const params = buildGoogleGenerativeAiParams(model, {
11421142messages: [
1143-googleToolCallAssistantTurn({ thoughtSignature: "call_sig_first_1" }),
1143+googleToolCallAssistantTurn({ thoughtSignature: "Y2FsbF9zaWdfZmlyc3RfMQ==" }),
11441144toolResultTurn(),
11451145googleToolCallAssistantTurn({
11461146timestamp: 2,
1147-thoughtSignature: "call_sig_second_1",
1147+thoughtSignature: "Y2FsbF9zaWdfc2Vjb25kXzE=",
11481148}),
11491149],
11501150} as never);
@@ -1154,15 +1154,15 @@ describe("google transport stream", () => {
11541154expect(modelTurns[0]).toMatchObject({
11551155parts: [
11561156{
1157-thoughtSignature: "call_sig_first_1",
1157+thoughtSignature: "Y2FsbF9zaWdfZmlyc3RfMQ==",
11581158functionCall: { name: "lookup", args: { q: "hello" } },
11591159},
11601160],
11611161});
11621162expect(modelTurns[1]).toMatchObject({
11631163parts: [
11641164{
1165-thoughtSignature: "call_sig_second_1",
1165+thoughtSignature: "Y2FsbF9zaWdfc2Vjb25kXzE=",
11661166functionCall: { name: "lookup", args: { q: "hello" } },
11671167},
11681168],
@@ -1181,7 +1181,7 @@ describe("google transport stream", () => {
11811181toolResultTurn(),
11821182googleToolCallAssistantTurn({
11831183timestamp: 2,
1184-thoughtSignature: "call_sig_future_1",
1184+thoughtSignature: "Y2FsbF9zaWdfZnV0dXJlXzE=",
11851185}),
11861186],
11871187} as never);
@@ -1199,7 +1199,7 @@ describe("google transport stream", () => {
11991199expect(modelTurns[1]).toMatchObject({
12001200parts: [
12011201{
1202-thoughtSignature: "call_sig_future_1",
1202+thoughtSignature: "Y2FsbF9zaWdfZnV0dXJlXzE=",
12031203functionCall: { name: "lookup", args: { q: "hello" } },
12041204},
12051205],
@@ -1214,7 +1214,7 @@ describe("google transport stream", () => {
1214121412151215const params = buildGoogleGenerativeAiParams(model, {
12161216messages: [
1217-googleToolCallAssistantTurn({ thoughtSignature: "call_sig_replay_1" }),
1217+googleToolCallAssistantTurn({ thoughtSignature: "Y2FsbF9zaWdfcmVwbGF5XzE=" }),
12181218toolResultTurn(),
12191219googleToolCallAssistantTurn({ timestamp: 2, args: { q: "hello-again" } }),
12201220],
@@ -1247,7 +1247,7 @@ describe("google transport stream", () => {
12471247model: "claude-sonnet-4",
12481248id: "call_foreign",
12491249// Plausible-looking base64 from a non-Gemini provider.
1250-thoughtSignature: "msg_01XFDUDYJgAACcnSM2TTgQsA",
1250+thoughtSignature: "bXNnXzAxWEZEVURZSmdBQUNjblNNMlRUZ1FzQQ==",
12511251}),
12521252toolResultTurn("call_foreign"),
12531253{
@@ -1270,7 +1270,9 @@ describe("google transport stream", () => {
12701270},
12711271],
12721272});
1273-expect(firstModelTurn.parts[0].thoughtSignature).not.toBe("msg_01XFDUDYJgAACcnSM2TTgQsA");
1273+expect(firstModelTurn.parts[0].thoughtSignature).not.toBe(
1274+"bXNnXzAxWEZEVURZSmdBQUNjblNNMlRUZ1FzQQ==",
1275+);
12741276});
1275127712761278it("does not replay prior Gemini thought signatures onto a later foreign route", () => {
@@ -1281,7 +1283,7 @@ describe("google transport stream", () => {
1281128312821284const params = buildGoogleGenerativeAiParams(model, {
12831285messages: [
1284-googleToolCallAssistantTurn({ thoughtSignature: "call_sig_google_1" }),
1286+googleToolCallAssistantTurn({ thoughtSignature: "Y2FsbF9zaWdfZ29vZ2xlXzE=" }),
12851287toolResultTurn(),
12861288googleToolCallAssistantTurn({
12871289provider: "anthropic",
@@ -1302,7 +1304,7 @@ describe("google transport stream", () => {
13021304},
13031305],
13041306});
1305-expect(modelTurns[1]?.parts[0].thoughtSignature).not.toBe("call_sig_google_1");
1307+expect(modelTurns[1]?.parts[0].thoughtSignature).not.toBe("Y2FsbF9zaWdfZ29vZ2xlXzE=");
13061308});
1307130913081310it("replaces invalid Gemini tool-call sentinel signatures with the skip fallback", () => {
@@ -1362,7 +1364,7 @@ describe("google transport stream", () => {
13621364id: "call_math",
13631365name: "math_eval",
13641366arguments: { expression: "17*23" },
1365-thoughtSignature: "real_sig_1",
1367+thoughtSignature: "cmVhbF9zaWdfMQ==",
13661368},
13671369{
13681370type: "toolCall",
@@ -1384,7 +1386,7 @@ describe("google transport stream", () => {
13841386const parts = (params.contents[0] as { parts: Array<Record<string, unknown>> }).parts;
13851387expect(parts).toHaveLength(3);
13861388expect(parts[0]).toMatchObject({
1387-thoughtSignature: "real_sig_1",
1389+thoughtSignature: "cmVhbF9zaWdfMQ==",
13881390functionCall: { name: "math_eval", args: { expression: "17*23" } },
13891391});
13901392expect(parts[1]).toMatchObject({
@@ -1418,7 +1420,7 @@ describe("google transport stream", () => {
14181420id: "call_1",
14191421name: "lookup",
14201422arguments: { q: "hello" },
1421-thoughtSignature: "foreign_sig",
1423+thoughtSignature: "Zm9yZWlnbl9zaWc=",
14221424},
14231425],
14241426},
@@ -1429,7 +1431,7 @@ describe("google transport stream", () => {
14291431role: "model",
14301432parts: [{ functionCall: { name: "lookup", args: { q: "hello" } } }],
14311433});
1432-expect(JSON.stringify(params.contents)).not.toContain("foreign_sig");
1434+expect(JSON.stringify(params.contents)).not.toContain("Zm9yZWlnbl9zaWc=");
14331435expect(JSON.stringify(params.contents)).not.toContain("skip_thought_signature_validator");
14341436});
14351437@@ -1748,8 +1750,8 @@ describe("google transport stream", () => {
17481750{
17491751content: {
17501752parts: [
1751-{ thought: true, text: "draft", thoughtSignature: "sig_1" },
1752-{ thoughtSignature: "sig_2" },
1753+{ thought: true, text: "draft", thoughtSignature: "c2lnXzE=" },
1754+{ thoughtSignature: "c2lnXzI=" },
17531755{ text: "answer" },
17541756],
17551757},
@@ -1789,7 +1791,7 @@ describe("google transport stream", () => {
17891791const result = await stream.result();
1790179217911793expect(result.content).toEqual([
1792-{ type: "thinking", thinking: "draft", thinkingSignature: "sig_2" },
1794+{ type: "thinking", thinking: "draft", thinkingSignature: "c2lnXzI=" },
17931795{ type: "text", text: "answer" },
17941796]);
17951797expect(events.map((event) => event.type)).toEqual([
@@ -1815,7 +1817,7 @@ describe("google transport stream", () => {
18151817{
18161818content: {
18171819parts: [
1818-{ thoughtSignature: "sig_1" },
1820+{ thoughtSignature: "c2lnXzE=" },
18191821{ thought: true, text: "draft" },
18201822{ text: "answer" },
18211823],
@@ -1852,7 +1854,7 @@ describe("google transport stream", () => {
18521854const result = await stream.result();
1853185518541856expect(result.content).toEqual([
1855-{ type: "thinking", thinking: "draft", thinkingSignature: "sig_1" },
1857+{ type: "thinking", thinking: "draft", thinkingSignature: "c2lnXzE=" },
18561858{ type: "text", text: "answer" },
18571859]);
18581860});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。