@anthonyhaussman/opencode-agy-auth 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -268,7 +268,7 @@ function createAgyActivityRequestId() {
268
268
  import os from "os";
269
269
 
270
270
  // src/sdk/agy-cli-version.ts
271
- var AGY_CLI_VERSION = "1.4.2";
271
+ var AGY_CLI_VERSION = "1.4.3";
272
272
 
273
273
  // src/sdk/user-agent.ts
274
274
  var cachedUserAgent = null;
@@ -2092,7 +2092,8 @@ function initDiskSignatureCache(config2) {
2092
2092
  return diskCache;
2093
2093
  }
2094
2094
  function hashText(text) {
2095
- return createHash("sha256").update(text, "utf8").digest("hex").slice(0, SIGNATURE_TEXT_HASH_HEX_LEN);
2095
+ const normalized = text.replace(/\r\n/g, "\n").trim();
2096
+ return createHash("sha256").update(normalized, "utf8").digest("hex").slice(0, SIGNATURE_TEXT_HASH_HEX_LEN);
2096
2097
  }
2097
2098
  function makeDiskKey(sessionId, textHash) {
2098
2099
  return `${sessionId}:${textHash}`;
@@ -16152,7 +16153,7 @@ var models_default = {
16152
16153
  106865006,
16153
16154
  106865004,
16154
16155
  106828854,
16155
- 106427252,
16156
+ 106140402,
16156
16157
  106815069,
16157
16158
  106805272,
16158
16159
  105979552,
@@ -16160,6 +16161,7 @@ var models_default = {
16160
16161
  106015333,
16161
16162
  106568772,
16162
16163
  105867471,
16164
+ 106749606,
16163
16165
  106123599,
16164
16166
  106121401,
16165
16167
  106100625,
@@ -16170,7 +16172,6 @@ var models_default = {
16170
16172
  106544525,
16171
16173
  106021688,
16172
16174
  105887299,
16173
- 106428370,
16174
16175
  106640126,
16175
16176
  106793266,
16176
16177
  106798730,
@@ -16182,7 +16183,6 @@ var models_default = {
16182
16183
  106032303,
16183
16184
  106228452,
16184
16185
  106121607,
16185
- 106793059,
16186
16186
  106848320,
16187
16187
  105979531,
16188
16188
  105979553,
@@ -16193,11 +16193,9 @@ var models_default = {
16193
16193
  106121399,
16194
16194
  106100654,
16195
16195
  106064028,
16196
- 105906495,
16197
16196
  106640124,
16198
16197
  106032301,
16199
16198
  106121604,
16200
- 106793057,
16201
16199
  106778026,
16202
16200
  106786388
16203
16201
  ],
@@ -16259,7 +16257,7 @@ var models_default = {
16259
16257
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16260
16258
  quotaInfo: {
16261
16259
  remainingFraction: 1,
16262
- resetTime: "2026-10-18T13:33:10Z"
16260
+ resetTime: "2026-10-20T11:56:04Z"
16263
16261
  },
16264
16262
  recommended: true,
16265
16263
  supportedMimeTypes: {
@@ -16300,7 +16298,7 @@ var models_default = {
16300
16298
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16301
16299
  quotaInfo: {
16302
16300
  remainingFraction: 1,
16303
- resetTime: "2026-10-18T13:33:10Z"
16301
+ resetTime: "2026-10-20T11:56:04Z"
16304
16302
  },
16305
16303
  recommended: true,
16306
16304
  supportedMimeTypes: {
@@ -16341,7 +16339,7 @@ var models_default = {
16341
16339
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16342
16340
  quotaInfo: {
16343
16341
  remainingFraction: 1,
16344
- resetTime: "2026-10-18T13:33:10Z"
16342
+ resetTime: "2026-10-20T11:56:04Z"
16345
16343
  },
16346
16344
  recommended: true,
16347
16345
  supportedMimeTypes: {
@@ -16382,7 +16380,7 @@ var models_default = {
16382
16380
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16383
16381
  quotaInfo: {
16384
16382
  remainingFraction: 1,
16385
- resetTime: "2026-10-18T13:33:10Z"
16383
+ resetTime: "2026-10-20T11:56:04Z"
16386
16384
  },
16387
16385
  recommended: true,
16388
16386
  supportedMimeTypes: {
@@ -16423,7 +16421,7 @@ var models_default = {
16423
16421
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16424
16422
  quotaInfo: {
16425
16423
  remainingFraction: 1,
16426
- resetTime: "2026-10-18T13:33:10Z"
16424
+ resetTime: "2026-10-20T11:56:04Z"
16427
16425
  },
16428
16426
  recommended: true,
16429
16427
  supportedMimeTypes: {
@@ -16464,7 +16462,7 @@ var models_default = {
16464
16462
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16465
16463
  quotaInfo: {
16466
16464
  remainingFraction: 1,
16467
- resetTime: "2026-10-18T13:33:10Z"
16465
+ resetTime: "2026-10-20T11:56:04Z"
16468
16466
  },
16469
16467
  recommended: true,
16470
16468
  supportedMimeTypes: {
@@ -16502,8 +16500,8 @@ var models_default = {
16502
16500
  },
16503
16501
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16504
16502
  quotaInfo: {
16505
- remainingFraction: 0.9709832,
16506
- resetTime: "2026-10-18T12:59:56Z"
16503
+ remainingFraction: 0.9870602,
16504
+ resetTime: "2026-10-20T09:03:27Z"
16507
16505
  },
16508
16506
  recommended: true,
16509
16507
  supportedMimeTypes: {
@@ -16583,8 +16581,8 @@ var models_default = {
16583
16581
  },
16584
16582
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16585
16583
  quotaInfo: {
16586
- remainingFraction: 0.9709832,
16587
- resetTime: "2026-10-18T12:59:56Z"
16584
+ remainingFraction: 0.9870602,
16585
+ resetTime: "2026-10-20T09:03:27Z"
16588
16586
  },
16589
16587
  recommended: true,
16590
16588
  supportedMimeTypes: {
@@ -16664,8 +16662,8 @@ var models_default = {
16664
16662
  },
16665
16663
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16666
16664
  quotaInfo: {
16667
- remainingFraction: 0.9709832,
16668
- resetTime: "2026-10-18T12:59:56Z"
16665
+ remainingFraction: 0.9870602,
16666
+ resetTime: "2026-10-20T09:03:27Z"
16669
16667
  },
16670
16668
  recommended: true,
16671
16669
  supportedMimeTypes: {
@@ -16742,8 +16740,8 @@ var models_default = {
16742
16740
  },
16743
16741
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16744
16742
  quotaInfo: {
16745
- remainingFraction: 0.9709832,
16746
- resetTime: "2026-10-18T12:59:56Z"
16743
+ remainingFraction: 0.9870602,
16744
+ resetTime: "2026-10-20T09:03:27Z"
16747
16745
  },
16748
16746
  recommended: true,
16749
16747
  requiresImageOutputOutsideFunctionResponses: true,
@@ -16820,8 +16818,8 @@ var models_default = {
16820
16818
  },
16821
16819
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16822
16820
  quotaInfo: {
16823
- remainingFraction: 0.9709832,
16824
- resetTime: "2026-10-18T12:59:56Z"
16821
+ remainingFraction: 0.9870602,
16822
+ resetTime: "2026-10-20T09:03:27Z"
16825
16823
  },
16826
16824
  recommended: true,
16827
16825
  supportedMimeTypes: {
@@ -16926,8 +16924,8 @@ var models_default = {
16926
16924
  },
16927
16925
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16928
16926
  quotaInfo: {
16929
- remainingFraction: 0.9709832,
16930
- resetTime: "2026-10-18T12:59:56Z"
16927
+ remainingFraction: 0.9870602,
16928
+ resetTime: "2026-10-20T09:03:27Z"
16931
16929
  },
16932
16930
  recommended: true,
16933
16931
  supportedMimeTypes: {
@@ -16996,8 +16994,8 @@ var models_default = {
16996
16994
  model: "MODEL_PLACEHOLDER_M21",
16997
16995
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16998
16996
  quotaInfo: {
16999
- remainingFraction: 0.9709832,
17000
- resetTime: "2026-10-18T12:59:56Z"
16997
+ remainingFraction: 0.9870602,
16998
+ resetTime: "2026-10-20T09:03:27Z"
17001
16999
  },
17002
17000
  supportedMimeTypes: {
17003
17001
  "application/json": true,
@@ -17047,8 +17045,8 @@ var models_default = {
17047
17045
  },
17048
17046
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17049
17047
  quotaInfo: {
17050
- remainingFraction: 0.9709832,
17051
- resetTime: "2026-10-18T12:59:56Z"
17048
+ remainingFraction: 0.9870602,
17049
+ resetTime: "2026-10-20T09:03:27Z"
17052
17050
  },
17053
17051
  recommended: true,
17054
17052
  supportedMimeTypes: {
@@ -17153,8 +17151,8 @@ var models_default = {
17153
17151
  },
17154
17152
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17155
17153
  quotaInfo: {
17156
- remainingFraction: 0.9709832,
17157
- resetTime: "2026-10-18T12:59:56Z"
17154
+ remainingFraction: 0.9870602,
17155
+ resetTime: "2026-10-20T09:03:27Z"
17158
17156
  },
17159
17157
  recommended: true,
17160
17158
  supportedMimeTypes: {
@@ -17234,8 +17232,8 @@ var models_default = {
17234
17232
  },
17235
17233
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17236
17234
  quotaInfo: {
17237
- remainingFraction: 0.9709832,
17238
- resetTime: "2026-10-18T12:59:56Z"
17235
+ remainingFraction: 0.9870602,
17236
+ resetTime: "2026-10-20T09:03:27Z"
17239
17237
  },
17240
17238
  recommended: true,
17241
17239
  supportedMimeTypes: {
@@ -17340,8 +17338,8 @@ var models_default = {
17340
17338
  },
17341
17339
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17342
17340
  quotaInfo: {
17343
- remainingFraction: 0.9709832,
17344
- resetTime: "2026-10-18T12:59:56Z"
17341
+ remainingFraction: 0.9870602,
17342
+ resetTime: "2026-10-20T09:03:27Z"
17345
17343
  },
17346
17344
  recommended: true,
17347
17345
  supportedMimeTypes: {
@@ -17452,8 +17450,8 @@ var models_default = {
17452
17450
  },
17453
17451
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17454
17452
  quotaInfo: {
17455
- remainingFraction: 0.9709832,
17456
- resetTime: "2026-10-18T12:59:56Z"
17453
+ remainingFraction: 0.9870602,
17454
+ resetTime: "2026-10-20T09:03:27Z"
17457
17455
  },
17458
17456
  recommended: true,
17459
17457
  supportedMimeTypes: {
@@ -17564,8 +17562,8 @@ var models_default = {
17564
17562
  },
17565
17563
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17566
17564
  quotaInfo: {
17567
- remainingFraction: 0.9709832,
17568
- resetTime: "2026-10-18T12:59:56Z"
17565
+ remainingFraction: 0.9870602,
17566
+ resetTime: "2026-10-20T09:03:27Z"
17569
17567
  },
17570
17568
  recommended: true,
17571
17569
  supportedMimeTypes: {
@@ -17676,8 +17674,8 @@ var models_default = {
17676
17674
  },
17677
17675
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17678
17676
  quotaInfo: {
17679
- remainingFraction: 0.9709832,
17680
- resetTime: "2026-10-18T12:59:56Z"
17677
+ remainingFraction: 0.9870602,
17678
+ resetTime: "2026-10-20T09:03:27Z"
17681
17679
  },
17682
17680
  recommended: true,
17683
17681
  supportedMimeTypes: {
@@ -17787,8 +17785,8 @@ var models_default = {
17787
17785
  },
17788
17786
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17789
17787
  quotaInfo: {
17790
- remainingFraction: 0.9709832,
17791
- resetTime: "2026-10-18T12:59:56Z"
17788
+ remainingFraction: 0.9870602,
17789
+ resetTime: "2026-10-20T09:03:27Z"
17792
17790
  },
17793
17791
  recommended: true,
17794
17792
  supportedMimeTypes: {
@@ -18118,7 +18116,7 @@ monitors {
18118
18116
  },
18119
18117
  modelProvider: "MODEL_PROVIDER_GOOGLE",
18120
18118
  quotaInfo: {
18121
- remainingFraction: 0.7963,
18119
+ remainingFraction: 0.5537493,
18122
18120
  resetTime: "2026-10-24T16:42:08Z"
18123
18121
  },
18124
18122
  recommended: true,
@@ -18451,7 +18449,7 @@ monitors {
18451
18449
  },
18452
18450
  modelProvider: "MODEL_PROVIDER_GOOGLE",
18453
18451
  quotaInfo: {
18454
- remainingFraction: 0.7963,
18452
+ remainingFraction: 0.5537493,
18455
18453
  resetTime: "2026-10-24T16:42:08Z"
18456
18454
  },
18457
18455
  recommended: true,
@@ -18784,7 +18782,7 @@ monitors {
18784
18782
  },
18785
18783
  modelProvider: "MODEL_PROVIDER_GOOGLE",
18786
18784
  quotaInfo: {
18787
- remainingFraction: 0.7963,
18785
+ remainingFraction: 0.5537493,
18788
18786
  resetTime: "2026-10-24T16:42:08Z"
18789
18787
  },
18790
18788
  recommended: true,
@@ -18864,7 +18862,7 @@ monitors {
18864
18862
  modelProvider: "MODEL_PROVIDER_OPENAI",
18865
18863
  quotaInfo: {
18866
18864
  remainingFraction: 1,
18867
- resetTime: "2026-10-18T13:33:10Z"
18865
+ resetTime: "2026-10-20T11:56:04Z"
18868
18866
  },
18869
18867
  recommended: true,
18870
18868
  supportsThinking: true,
@@ -19682,21 +19680,52 @@ function getModelEnum(modelName) {
19682
19680
  function isClaudeModel(model) {
19683
19681
  return model.toLowerCase().includes("claude");
19684
19682
  }
19683
+ function isThinkingLikePart(part) {
19684
+ return !!part && typeof part === "object" && (part.thought === true || part.type === "thinking" || part.type === "redacted_thinking" || part.type === "reasoning" || typeof part.thinking === "string");
19685
+ }
19686
+ function isToolResultTurn(turn) {
19687
+ if (!turn || turn.role !== "user" && turn.role !== "tool" || !Array.isArray(turn.parts)) {
19688
+ return false;
19689
+ }
19690
+ return turn.parts.some(
19691
+ (p) => p && typeof p === "object" && ("functionResponse" in p || p.type === "tool_result")
19692
+ );
19693
+ }
19685
19694
  function sanitizeClaudeThinkingParts(contents, model, sessionId) {
19686
19695
  if (!isClaudeModel(model) || !Array.isArray(contents)) {
19687
19696
  return;
19688
19697
  }
19689
- for (const turn of contents) {
19698
+ const lastTurn = contents[contents.length - 1];
19699
+ const isTrailingToolResponse = Boolean(lastTurn && isToolResultTurn(lastTurn));
19700
+ let activeLoopStartIdx = -1;
19701
+ if (isTrailingToolResponse) {
19702
+ let lastRealUserIdx = -1;
19703
+ for (let i = 0; i < contents.length; i++) {
19704
+ const turn = contents[i];
19705
+ if (turn && (turn.role === "user" || turn.role === "human") && !isToolResultTurn(turn)) {
19706
+ lastRealUserIdx = i;
19707
+ }
19708
+ }
19709
+ activeLoopStartIdx = lastRealUserIdx + 1;
19710
+ } else if (contents.length === 1 && (contents[0]?.role === "model" || contents[0]?.role === "assistant")) {
19711
+ activeLoopStartIdx = 0;
19712
+ }
19713
+ for (let turnIdx = 0; turnIdx < contents.length; turnIdx++) {
19714
+ const turn = contents[turnIdx];
19690
19715
  if (!turn || typeof turn !== "object") continue;
19691
19716
  if (turn.role !== "model" && turn.role !== "assistant") continue;
19692
19717
  if (!Array.isArray(turn.parts)) continue;
19718
+ const canPreserveThinking = activeLoopStartIdx !== -1 && turnIdx >= activeLoopStartIdx;
19693
19719
  const filteredParts = turn.parts.filter((part) => {
19694
19720
  if (!part || typeof part !== "object") return true;
19695
- const isThinking = part.thought === true || part.type === "thinking" || part.type === "reasoning" || typeof part.thinking === "string";
19696
- if (!isThinking) {
19721
+ if (!isThinkingLikePart(part)) {
19697
19722
  return true;
19698
19723
  }
19699
- let sig = typeof part.signature === "string" ? part.signature : typeof part.thoughtSignature === "string" ? part.thoughtSignature : typeof part.state?.thoughtSignature === "string" ? part.state.thoughtSignature : void 0;
19724
+ if (!canPreserveThinking) {
19725
+ return false;
19726
+ }
19727
+ const isUsableSig = (s) => typeof s === "string" && s.length > 0 && s !== "skip_thought_signature_validator";
19728
+ let sig = isUsableSig(part.thoughtSignature) ? part.thoughtSignature : isUsableSig(part.signature) ? part.signature : isUsableSig(part.state?.thoughtSignature) ? part.state.thoughtSignature : void 0;
19700
19729
  let recovered = false;
19701
19730
  if ((!sig || sig === "skip_thought_signature_validator") && sessionId) {
19702
19731
  const text = typeof part.text === "string" ? part.text : typeof part.thinking === "string" ? part.thinking : void 0;
@@ -19707,35 +19736,17 @@ function sanitizeClaudeThinkingParts(contents, model, sessionId) {
19707
19736
  recovered = true;
19708
19737
  }
19709
19738
  }
19710
- if (!sig) {
19711
- const latest = getLatestSignature(sessionId);
19712
- if (latest) {
19713
- sig = latest;
19714
- recovered = true;
19715
- }
19716
- }
19717
19739
  }
19718
19740
  const isValidSig = typeof sig === "string" && sig.length > 0 && sig !== "skip_thought_signature_validator";
19719
19741
  if (isValidSig) {
19720
- if (part.type === "reasoning") {
19721
- part.thoughtSignature = sig;
19722
- part.signature = sig;
19723
- if (part.state) {
19724
- part.state.thoughtSignature = sig;
19725
- }
19726
- } else if (recovered) {
19727
- if (typeof part.thoughtSignature === "string" || part.thought) {
19728
- part.thoughtSignature = sig;
19729
- }
19730
- if (part.type === "thinking" || typeof part.thinking === "string") {
19731
- part.signature = sig;
19732
- }
19733
- if (!part.thoughtSignature && !part.signature) {
19734
- part.signature = sig;
19735
- }
19742
+ part.thoughtSignature = sig;
19743
+ part.signature = sig;
19744
+ if (part.state) {
19745
+ part.state.thoughtSignature = sig;
19736
19746
  }
19747
+ return true;
19737
19748
  }
19738
- return isValidSig;
19749
+ return false;
19739
19750
  });
19740
19751
  if (filteredParts.length === 0) {
19741
19752
  turn.parts = [{ text: "" }];
@@ -19743,6 +19754,67 @@ function sanitizeClaudeThinkingParts(contents, model, sessionId) {
19743
19754
  turn.parts = filteredParts;
19744
19755
  }
19745
19756
  }
19757
+ if (isTrailingToolResponse && activeLoopStartIdx !== -1) {
19758
+ let needsLoopClosure = false;
19759
+ for (let i = activeLoopStartIdx; i < contents.length; i++) {
19760
+ const turn = contents[i];
19761
+ if (!turn || turn.role !== "model" && turn.role !== "assistant") continue;
19762
+ const parts = Array.isArray(turn.parts) ? turn.parts : [];
19763
+ const hasFunctionCall = parts.some(
19764
+ (p) => p && typeof p === "object" && ("functionCall" in p || p.type === "tool_use")
19765
+ );
19766
+ const hasValidThinking = parts.some(isThinkingLikePart);
19767
+ if (hasFunctionCall && !hasValidThinking) {
19768
+ needsLoopClosure = true;
19769
+ break;
19770
+ }
19771
+ }
19772
+ if (needsLoopClosure) {
19773
+ for (let i = activeLoopStartIdx; i < contents.length; i++) {
19774
+ const turn = contents[i];
19775
+ if (!turn || turn.role !== "model" && turn.role !== "assistant" || !Array.isArray(turn.parts)) continue;
19776
+ const stripped = turn.parts.filter((p) => !isThinkingLikePart(p));
19777
+ turn.parts = stripped.length === 0 ? [{ text: "" }] : stripped;
19778
+ }
19779
+ const closed = closeToolLoopForThinking(contents);
19780
+ contents.splice(0, contents.length, ...closed);
19781
+ }
19782
+ }
19783
+ }
19784
+ function cleanProtobufParts(contents, isClaude) {
19785
+ if (!Array.isArray(contents)) return;
19786
+ for (const turn of contents) {
19787
+ if (turn && Array.isArray(turn.parts)) {
19788
+ for (const part of turn.parts) {
19789
+ if (part && typeof part === "object") {
19790
+ if (!part.thoughtSignature || part.thoughtSignature === "skip_thought_signature_validator") {
19791
+ const fallbackSig = typeof part.signature === "string" && part.signature.length > 0 ? part.signature : typeof part.state?.thoughtSignature === "string" && part.state.thoughtSignature.length > 0 ? part.state.thoughtSignature : void 0;
19792
+ if (fallbackSig && fallbackSig !== "skip_thought_signature_validator") {
19793
+ part.thoughtSignature = fallbackSig;
19794
+ }
19795
+ }
19796
+ if (part.type === "thinking" || part.type === "redacted_thinking" || part.type === "reasoning" || typeof part.thinking === "string") {
19797
+ part.thought = true;
19798
+ if (typeof part.text !== "string" && typeof part.thinking === "string") {
19799
+ part.text = part.thinking;
19800
+ }
19801
+ delete part.thinking;
19802
+ }
19803
+ delete part.type;
19804
+ delete part.signature;
19805
+ delete part.state;
19806
+ if (isClaude) {
19807
+ if (part.thoughtSignature === "skip_thought_signature_validator") {
19808
+ delete part.thoughtSignature;
19809
+ }
19810
+ if (part.functionCall && part.thoughtSignature) {
19811
+ delete part.thoughtSignature;
19812
+ }
19813
+ }
19814
+ }
19815
+ }
19816
+ }
19817
+ }
19746
19818
  }
19747
19819
  function transformRequestBody(body, projectId, effectiveModel, requestedModel, thinkingConfigDefaults) {
19748
19820
  const fallbackId = randomUUID3();
@@ -19806,6 +19878,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19806
19878
  const latestSig = getLatestSignature(sessionId2);
19807
19879
  applyLatestSignature(contents2, latestSig);
19808
19880
  sanitizeClaudeThinkingParts(contents2, effectiveModel || requestedModel, sessionId2);
19881
+ cleanProtobufParts(contents2, isClaudeModel(effectiveModel || requestedModel));
19809
19882
  requestPayloadInside.contents = contents2;
19810
19883
  }
19811
19884
  return { body: JSON.stringify(wrappedBody2), userPromptId: userPromptId2, sessionId: sessionId2 };
@@ -19821,7 +19894,9 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19821
19894
  }
19822
19895
  normalizeToolConfig(requestPayload, toolMapper);
19823
19896
  transformOpenAIToolCalls(requestPayload, toolMapper);
19824
- addThoughtSignaturesToFunctionCalls(requestPayload);
19897
+ if (!isClaudeModel(effectiveModel || requestedModel)) {
19898
+ addThoughtSignaturesToFunctionCalls(requestPayload);
19899
+ }
19825
19900
  normalizeThinking(
19826
19901
  requestPayload,
19827
19902
  resolveDefaultThinkingConfig(thinkingConfigDefaults, requestedModel, effectiveModel),
@@ -19848,6 +19923,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19848
19923
  const latestSig = getLatestSignature(sessionId);
19849
19924
  applyLatestSignature(contents, latestSig);
19850
19925
  sanitizeClaudeThinkingParts(contents, effectiveModel || requestedModel, sessionId);
19926
+ cleanProtobufParts(contents, isClaudeModel(effectiveModel || requestedModel));
19851
19927
  requestPayload.contents = contents;
19852
19928
  }
19853
19929
  if ("model" in requestPayload) {