ai-sdk-provider-claude-code 3.4.3 → 3.4.4
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/README.md +2 -2
- package/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<a href="https://www.npmjs.com/package/ai-sdk-provider-claude-code"><img src="https://img.shields.io/npm/l/ai-sdk-provider-claude-code?color=00A79E" alt="License: MIT" /></a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
|
-
# AI SDK Provider for Claude
|
|
10
|
+
# AI SDK Provider for Claude Agent SDK
|
|
11
11
|
|
|
12
12
|
> **Latest Release**: Version 3.x supports AI SDK v6 stable with the Claude Agent SDK. For AI SDK v5 support, use the `ai-sdk-v5` tag.
|
|
13
13
|
|
|
@@ -82,7 +82,7 @@ npm install ai-sdk-provider-claude-code@ai-sdk-v4 ai@^4.3.16
|
|
|
82
82
|
|
|
83
83
|
**This is an unofficial community provider** and is not affiliated with or endorsed by Anthropic or Vercel. By using this provider:
|
|
84
84
|
|
|
85
|
-
- You understand that your data will be sent to Anthropic's servers through the Claude
|
|
85
|
+
- You understand that your data will be sent to Anthropic's servers through the Claude Agent SDK
|
|
86
86
|
- You agree to comply with [Anthropic's Terms of Service](https://www.anthropic.com/legal/consumer-terms)
|
|
87
87
|
- You acknowledge this software is provided "as is" without warranties of any kind
|
|
88
88
|
|
package/dist/index.cjs
CHANGED
|
@@ -1831,11 +1831,18 @@ var ClaudeCodeLanguageModel = class _ClaudeCodeLanguageModel {
|
|
|
1831
1831
|
const toolName = typeof toolBlock.name === "string" && toolBlock.name.length > 0 ? toolBlock.name : _ClaudeCodeLanguageModel.UNKNOWN_TOOL_NAME;
|
|
1832
1832
|
hasReceivedStreamEvents = true;
|
|
1833
1833
|
if (textPartId) {
|
|
1834
|
+
const closedTextId = textPartId;
|
|
1834
1835
|
controller.enqueue({
|
|
1835
1836
|
type: "text-end",
|
|
1836
|
-
id:
|
|
1837
|
+
id: closedTextId
|
|
1837
1838
|
});
|
|
1838
1839
|
textPartId = void 0;
|
|
1840
|
+
for (const [idx, blockTextId] of textBlocksByIndex) {
|
|
1841
|
+
if (blockTextId === closedTextId) {
|
|
1842
|
+
textBlocksByIndex.delete(idx);
|
|
1843
|
+
break;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1839
1846
|
}
|
|
1840
1847
|
toolBlocksByIndex.set(blockIndex, toolId);
|
|
1841
1848
|
toolInputAccumulators.set(toolId, "");
|
|
@@ -1894,11 +1901,18 @@ var ClaudeCodeLanguageModel = class _ClaudeCodeLanguageModel {
|
|
|
1894
1901
|
const blockIndex = "index" in event ? event.index : -1;
|
|
1895
1902
|
hasReceivedStreamEvents = true;
|
|
1896
1903
|
if (textPartId) {
|
|
1904
|
+
const closedTextId = textPartId;
|
|
1897
1905
|
controller.enqueue({
|
|
1898
1906
|
type: "text-end",
|
|
1899
|
-
id:
|
|
1907
|
+
id: closedTextId
|
|
1900
1908
|
});
|
|
1901
1909
|
textPartId = void 0;
|
|
1910
|
+
for (const [idx, blockTextId] of textBlocksByIndex) {
|
|
1911
|
+
if (blockTextId === closedTextId) {
|
|
1912
|
+
textBlocksByIndex.delete(idx);
|
|
1913
|
+
break;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1902
1916
|
}
|
|
1903
1917
|
const reasoningPartId = (0, import_provider_utils.generateId)();
|
|
1904
1918
|
reasoningBlocksByIndex.set(blockIndex, reasoningPartId);
|
|
@@ -2009,11 +2023,18 @@ var ClaudeCodeLanguageModel = class _ClaudeCodeLanguageModel {
|
|
|
2009
2023
|
const content = message.message.content;
|
|
2010
2024
|
const tools = this.extractToolUses(content);
|
|
2011
2025
|
if (textPartId && tools.length > 0) {
|
|
2026
|
+
const closedTextId = textPartId;
|
|
2012
2027
|
controller.enqueue({
|
|
2013
2028
|
type: "text-end",
|
|
2014
|
-
id:
|
|
2029
|
+
id: closedTextId
|
|
2015
2030
|
});
|
|
2016
2031
|
textPartId = void 0;
|
|
2032
|
+
for (const [idx, blockTextId] of textBlocksByIndex) {
|
|
2033
|
+
if (blockTextId === closedTextId) {
|
|
2034
|
+
textBlocksByIndex.delete(idx);
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2017
2038
|
}
|
|
2018
2039
|
for (const tool3 of tools) {
|
|
2019
2040
|
const toolId = tool3.id;
|