ai-protocol-adapters 1.0.0-alpha.10 → 1.0.0-alpha.11

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
@@ -5670,6 +5670,7 @@ var StandardProtocolAdapter = class {
5670
5670
  }
5671
5671
  };
5672
5672
  let currentTextContent = "";
5673
+ let currentThinkingContent = "";
5673
5674
  const toolCalls = /* @__PURE__ */ new Map();
5674
5675
  const toolInputBuffers = /* @__PURE__ */ new Map();
5675
5676
  const indexToToolId = /* @__PURE__ */ new Map();
@@ -5709,6 +5710,12 @@ var StandardProtocolAdapter = class {
5709
5710
  this.logDebug(`\u{1F4DD} [StandardProtocolAdapter] \u7D2F\u79EF\u6587\u672C\u5185\u5BB9 (${currentTextContent.length}\u5B57\u7B26)`, currentTextContent.substring(currentTextContent.length - 20));
5710
5711
  }
5711
5712
  }
5713
+ if (data.type === "content_block_delta" && data.delta?.type === "thinking_delta") {
5714
+ currentThinkingContent += data.delta.thinking;
5715
+ if (this.debugMode && currentThinkingContent.length % 50 === 0) {
5716
+ this.logDebug(`\u{1F4AD} [StandardProtocolAdapter] \u7D2F\u79EFthinking\u5185\u5BB9 (${currentThinkingContent.length}\u5B57\u7B26)`, currentThinkingContent.substring(currentThinkingContent.length - 20));
5717
+ }
5718
+ }
5712
5719
  if (data.type === "content_block_delta" && data.delta?.type === "input_json_delta") {
5713
5720
  const toolIndex = data.index;
5714
5721
  const toolId = indexToToolId.get(toolIndex);
@@ -5773,6 +5780,17 @@ var StandardProtocolAdapter = class {
5773
5780
  }
5774
5781
  }
5775
5782
  }
5783
+ if (currentThinkingContent.trim()) {
5784
+ response.content.push({
5785
+ type: "text",
5786
+ text: currentThinkingContent.trim()
5787
+ });
5788
+ if (this.debugMode) {
5789
+ this.logDebug("\u{1F4AD} [StandardProtocolAdapter] \u6DFB\u52A0thinking\u5185\u5BB9:", {
5790
+ thinkingLength: currentThinkingContent.length
5791
+ });
5792
+ }
5793
+ }
5776
5794
  if (currentTextContent.trim()) {
5777
5795
  response.content.push({
5778
5796
  type: "text",
@@ -5784,6 +5802,7 @@ var StandardProtocolAdapter = class {
5784
5802
  this.logDebug("\u2705 [StandardProtocolAdapter] \u6807\u51C6\u54CD\u5E94\u6784\u5EFA\u5B8C\u6210:", {
5785
5803
  contentCount: response.content.length,
5786
5804
  textLength: currentTextContent.length,
5805
+ thinkingLength: currentThinkingContent.length,
5787
5806
  toolCallsCount: toolCalls.size,
5788
5807
  finalUsage: response.usage,
5789
5808
  stopReason: response.stop_reason
package/dist/index.mjs CHANGED
@@ -5563,6 +5563,7 @@ var StandardProtocolAdapter = class {
5563
5563
  }
5564
5564
  };
5565
5565
  let currentTextContent = "";
5566
+ let currentThinkingContent = "";
5566
5567
  const toolCalls = /* @__PURE__ */ new Map();
5567
5568
  const toolInputBuffers = /* @__PURE__ */ new Map();
5568
5569
  const indexToToolId = /* @__PURE__ */ new Map();
@@ -5602,6 +5603,12 @@ var StandardProtocolAdapter = class {
5602
5603
  this.logDebug(`\u{1F4DD} [StandardProtocolAdapter] \u7D2F\u79EF\u6587\u672C\u5185\u5BB9 (${currentTextContent.length}\u5B57\u7B26)`, currentTextContent.substring(currentTextContent.length - 20));
5603
5604
  }
5604
5605
  }
5606
+ if (data.type === "content_block_delta" && data.delta?.type === "thinking_delta") {
5607
+ currentThinkingContent += data.delta.thinking;
5608
+ if (this.debugMode && currentThinkingContent.length % 50 === 0) {
5609
+ this.logDebug(`\u{1F4AD} [StandardProtocolAdapter] \u7D2F\u79EFthinking\u5185\u5BB9 (${currentThinkingContent.length}\u5B57\u7B26)`, currentThinkingContent.substring(currentThinkingContent.length - 20));
5610
+ }
5611
+ }
5605
5612
  if (data.type === "content_block_delta" && data.delta?.type === "input_json_delta") {
5606
5613
  const toolIndex = data.index;
5607
5614
  const toolId = indexToToolId.get(toolIndex);
@@ -5666,6 +5673,17 @@ var StandardProtocolAdapter = class {
5666
5673
  }
5667
5674
  }
5668
5675
  }
5676
+ if (currentThinkingContent.trim()) {
5677
+ response.content.push({
5678
+ type: "text",
5679
+ text: currentThinkingContent.trim()
5680
+ });
5681
+ if (this.debugMode) {
5682
+ this.logDebug("\u{1F4AD} [StandardProtocolAdapter] \u6DFB\u52A0thinking\u5185\u5BB9:", {
5683
+ thinkingLength: currentThinkingContent.length
5684
+ });
5685
+ }
5686
+ }
5669
5687
  if (currentTextContent.trim()) {
5670
5688
  response.content.push({
5671
5689
  type: "text",
@@ -5677,6 +5695,7 @@ var StandardProtocolAdapter = class {
5677
5695
  this.logDebug("\u2705 [StandardProtocolAdapter] \u6807\u51C6\u54CD\u5E94\u6784\u5EFA\u5B8C\u6210:", {
5678
5696
  contentCount: response.content.length,
5679
5697
  textLength: currentTextContent.length,
5698
+ thinkingLength: currentThinkingContent.length,
5680
5699
  toolCallsCount: toolCalls.size,
5681
5700
  finalUsage: response.usage,
5682
5701
  stopReason: response.stop_reason
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-protocol-adapters",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "Universal AI Protocol Converter - OpenAI ⇄ Anthropic with full TypeScript support",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",