@deepstrike/sdk 0.2.13 → 0.2.14
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Anthropic from "@anthropic-ai/sdk";
|
|
2
2
|
import { assistantReplayKey } from "../runtime/provider-replay.js";
|
|
3
3
|
import { withServerRuntimeGuard } from "../runtime/server.js";
|
|
4
|
-
import { CircuitBreaker, normalizeToolCall, omitExtensionKeys,
|
|
4
|
+
import { CircuitBreaker, normalizeToolCall, omitExtensionKeys, toAnthropicMessages } from "./base.js";
|
|
5
5
|
const CLAUDE_POLICIES = {
|
|
6
6
|
"claude-opus-4-1": { maxTurns: 50 },
|
|
7
7
|
"claude-opus-4-7": { maxTurns: 50 },
|
|
@@ -261,10 +261,11 @@ export class AnthropicProvider {
|
|
|
261
261
|
// the deep breakpoint at the compaction boundary; absent ⇒ rolling-pair fallback.
|
|
262
262
|
applyMessageCacheControl(msgs, context.frozenPrefixLen);
|
|
263
263
|
if (context.stateTurn) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
264
|
+
// Render through toAnthropicMessages so assistant tool_use blocks and
|
|
265
|
+
// tool-role tool_result parts are serialized correctly — toAnthropicContent
|
|
266
|
+
// only handles contentParts/content and would silently drop toolCalls.
|
|
267
|
+
const stateMsgs = toAnthropicMessages([context.stateTurn], message => this.nativeAssistantBlocks.get(assistantReplayKey(message)));
|
|
268
|
+
msgs.push(...stateMsgs);
|
|
268
269
|
}
|
|
269
270
|
if (msgs.length === 0) {
|
|
270
271
|
msgs.push({ role: "user", content: "Proceed." });
|
|
@@ -58,11 +58,28 @@ export class OpenAIResponsesAdapter {
|
|
|
58
58
|
// The volatile State turn is sent every turn (it changes each call and is
|
|
59
59
|
// never "covered" by previous_response_id). Absent on un-rebuilt bindings,
|
|
60
60
|
// where the state is already inside the covered/uncovered history.
|
|
61
|
+
// Rendered through the same assistant-toolCalls / tool-result branches above
|
|
62
|
+
// so tool_use blocks are not silently dropped.
|
|
61
63
|
if (context.stateTurn) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
content
|
|
65
|
-
|
|
64
|
+
const st = context.stateTurn;
|
|
65
|
+
if (st.role === "assistant" && st.toolCalls?.length) {
|
|
66
|
+
if (st.content || st.contentParts?.length) {
|
|
67
|
+
input.push({ role: "assistant", content: this.buildMessageContent(st) });
|
|
68
|
+
}
|
|
69
|
+
for (const tc of st.toolCalls) {
|
|
70
|
+
input.push({ type: "function_call", call_id: tc.id, name: tc.name, arguments: tc.arguments });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (st.role === "tool") {
|
|
74
|
+
for (const part of st.contentParts ?? []) {
|
|
75
|
+
if (part.type !== "tool_result")
|
|
76
|
+
continue;
|
|
77
|
+
input.push({ type: "function_call_output", call_id: part.callId, output: part.output });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
input.push({ role: st.role, content: this.buildMessageContent(st) });
|
|
82
|
+
}
|
|
66
83
|
}
|
|
67
84
|
return input;
|
|
68
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "DeepStrike Node.js SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@anthropic-ai/sdk": "^0.99.0",
|
|
23
|
-
"@deepstrike/core": "0.2.
|
|
23
|
+
"@deepstrike/core": "0.2.14",
|
|
24
24
|
"@google/generative-ai": "^0.24.1",
|
|
25
25
|
"openai": "^5.23.2"
|
|
26
26
|
},
|