claude-sdk-proxy 3.1.2 → 3.1.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/package.json +2 -2
- package/src/proxy/server.ts +25 -0
- package/src/proxy/server.ts.bak +1841 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-sdk-proxy",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Anthropic Messages API proxy backed by Claude Agent SDK — use Claude Max with any API client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/proxy/server.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"claude-sdk-proxy": "
|
|
8
|
+
"claude-sdk-proxy": "bin/claude-sdk-proxy.js"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./src/proxy/server.ts"
|
package/src/proxy/server.ts
CHANGED
|
@@ -966,6 +966,18 @@ export function createProxyServer(config: Partial<ProxyConfig> = {}) {
|
|
|
966
966
|
|
|
967
967
|
if (hasTools) {
|
|
968
968
|
const { toolCalls, textBefore } = parseToolUse(fullText)
|
|
969
|
+
// Debug: log when tools were expected but none parsed
|
|
970
|
+
if (toolCalls.length === 0 && fullText.length > 0) {
|
|
971
|
+
logDebug("tool_parse.no_match", {
|
|
972
|
+
reqId,
|
|
973
|
+
outputLen: fullText.length,
|
|
974
|
+
textPreview: fullText.slice(0, 500),
|
|
975
|
+
hasToolUseTag: fullText.includes("<tool_use>"),
|
|
976
|
+
hasFunctionCalls: fullText.includes("<function_calls>"),
|
|
977
|
+
hasInvoke: fullText.includes("<invoke"),
|
|
978
|
+
hasAntmlInvoke: fullText.includes("antml:invoke"),
|
|
979
|
+
})
|
|
980
|
+
}
|
|
969
981
|
const content: any[] = []
|
|
970
982
|
if (textBefore) content.push({ type: "text", text: textBefore })
|
|
971
983
|
for (const tc of toolCalls) content.push({ type: "tool_use", id: tc.id, name: tc.name, input: tc.input })
|
|
@@ -1179,6 +1191,19 @@ export function createProxyServer(config: Partial<ProxyConfig> = {}) {
|
|
|
1179
1191
|
traceStore.phase(reqId, "responding")
|
|
1180
1192
|
const { toolCalls, textBefore } = parseToolUse(fullText)
|
|
1181
1193
|
|
|
1194
|
+
// Debug: log when tools were expected but none parsed
|
|
1195
|
+
if (toolCalls.length === 0 && fullText.length > 0) {
|
|
1196
|
+
logDebug("tool_parse.no_match_stream", {
|
|
1197
|
+
reqId,
|
|
1198
|
+
outputLen: fullText.length,
|
|
1199
|
+
textPreview: fullText.slice(0, 500),
|
|
1200
|
+
hasToolUseTag: fullText.includes("<tool_use>"),
|
|
1201
|
+
hasFunctionCalls: fullText.includes("<function_calls>"),
|
|
1202
|
+
hasInvoke: fullText.includes("<invoke"),
|
|
1203
|
+
hasAntmlInvoke: fullText.includes("antml:invoke"),
|
|
1204
|
+
})
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1182
1207
|
let blockIdx = 0
|
|
1183
1208
|
const textContent = toolCalls.length === 0 ? (fullText || "...") : textBefore
|
|
1184
1209
|
if (textContent) {
|