@kenkaiiii/gg-ai 4.6.1 → 4.6.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
@@ -421,6 +421,29 @@ function isRawThinking(part) {
421
421
  const t = part.data.type;
422
422
  return t === "thinking" || t === "redacted_thinking";
423
423
  }
424
+ var ANTHROPIC_INPUT_BLOCK_TYPES = /* @__PURE__ */ new Set([
425
+ "bash_code_execution_tool_result",
426
+ "code_execution_tool_result",
427
+ "connector_text",
428
+ "container_upload",
429
+ "document",
430
+ "image",
431
+ "mid_conv_system",
432
+ "redacted_thinking",
433
+ "search_result",
434
+ "server_tool_use",
435
+ "text",
436
+ "text_editor_code_execution_tool_result",
437
+ "thinking",
438
+ "tool_result",
439
+ "tool_search_tool_result",
440
+ "tool_use",
441
+ "web_fetch_tool_result",
442
+ "web_search_tool_result"
443
+ ]);
444
+ function isAnthropicCompatibleRaw(part) {
445
+ return ANTHROPIC_INPUT_BLOCK_TYPES.has(part.data.type);
446
+ }
424
447
  function isPositionSensitiveThinking(part) {
425
448
  if (part.type === "thinking") return hasValidThinkingSignature(part);
426
449
  return isRawThinking(part);
@@ -447,7 +470,8 @@ function toAnthropicAssistantPart(part, idMap) {
447
470
  };
448
471
  if (part.type === "server_tool_result")
449
472
  return part.data;
450
- if (part.type === "raw") return part.data;
473
+ if (part.type === "raw")
474
+ return isAnthropicCompatibleRaw(part) ? part.data : null;
451
475
  return null;
452
476
  }
453
477
  function toAnthropicAssistantContent(content, preserveThinking, idMap) {