@anthonyhaussman/opencode-agy-auth 1.2.16-alpha.1 → 1.2.16-alpha.2

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
@@ -19685,6 +19685,34 @@ function getModelEnum(modelName) {
19685
19685
  }
19686
19686
  return "MODEL_PLACEHOLDER_M16";
19687
19687
  }
19688
+ function isClaudeModel(model) {
19689
+ return model.toLowerCase().includes("claude");
19690
+ }
19691
+ function sanitizeClaudeThinkingParts(contents, model) {
19692
+ if (!isClaudeModel(model) || !Array.isArray(contents)) {
19693
+ return;
19694
+ }
19695
+ for (const turn of contents) {
19696
+ if (!turn || typeof turn !== "object") continue;
19697
+ if (turn.role !== "model" && turn.role !== "assistant") continue;
19698
+ if (!Array.isArray(turn.parts)) continue;
19699
+ const filteredParts = turn.parts.filter((part) => {
19700
+ if (!part || typeof part !== "object") return true;
19701
+ const isThinking = part.thought === true || part.type === "thinking" || typeof part.thinking === "string";
19702
+ if (!isThinking) {
19703
+ return true;
19704
+ }
19705
+ const sig = typeof part.signature === "string" ? part.signature : typeof part.thoughtSignature === "string" ? part.thoughtSignature : void 0;
19706
+ const isValidSig = typeof sig === "string" && sig.length > 0 && sig !== "skip_thought_signature_validator";
19707
+ return isValidSig;
19708
+ });
19709
+ if (filteredParts.length === 0) {
19710
+ turn.parts = [{ text: "" }];
19711
+ } else {
19712
+ turn.parts = filteredParts;
19713
+ }
19714
+ }
19715
+ }
19688
19716
  function transformRequestBody(body, projectId, effectiveModel, requestedModel, thinkingConfigDefaults) {
19689
19717
  const fallbackId = randomUUID3();
19690
19718
  try {
@@ -19718,7 +19746,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19718
19746
  last_step_index: "0",
19719
19747
  model_enum: getModelEnum(effectiveModel),
19720
19748
  trajectory_id: randomUUID3(),
19721
- used_claude: "false",
19749
+ used_claude: isClaudeModel(effectiveModel) || isClaudeModel(requestedModel) ? "true" : "false",
19722
19750
  used_claude_conservative: "false"
19723
19751
  };
19724
19752
  }
@@ -19746,6 +19774,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19746
19774
  contents2 = ensureTrailingUserTurn(contents2);
19747
19775
  const latestSig = getLatestSignature(sessionId2);
19748
19776
  applyLatestSignature(contents2, latestSig);
19777
+ sanitizeClaudeThinkingParts(contents2, effectiveModel || requestedModel);
19749
19778
  requestPayloadInside.contents = contents2;
19750
19779
  }
19751
19780
  return { body: JSON.stringify(wrappedBody2), userPromptId: userPromptId2, sessionId: sessionId2 };
@@ -19787,6 +19816,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19787
19816
  contents = ensureTrailingUserTurn(contents);
19788
19817
  const latestSig = getLatestSignature(sessionId);
19789
19818
  applyLatestSignature(contents, latestSig);
19819
+ sanitizeClaudeThinkingParts(contents, effectiveModel || requestedModel);
19790
19820
  requestPayload.contents = contents;
19791
19821
  }
19792
19822
  if ("model" in requestPayload) {
@@ -19798,7 +19828,7 @@ function transformRequestBody(body, projectId, effectiveModel, requestedModel, t
19798
19828
  last_step_index: "0",
19799
19829
  model_enum: getModelEnum(effectiveModel),
19800
19830
  trajectory_id: randomUUID3(),
19801
- used_claude: "false",
19831
+ used_claude: isClaudeModel(effectiveModel) || isClaudeModel(requestedModel) ? "true" : "false",
19802
19832
  used_claude_conservative: "false"
19803
19833
  };
19804
19834
  }