claude-sdk-proxy 2.3.0 → 2.3.1
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 +1 -1
- package/src/proxy/server.ts +5 -5
package/package.json
CHANGED
package/src/proxy/server.ts
CHANGED
|
@@ -435,8 +435,8 @@ export function createProxyServer(config: Partial<ProxyConfig> = {}) {
|
|
|
435
435
|
// Client tool mode: serialize all messages as context, inject tools
|
|
436
436
|
const conversationParts = messages
|
|
437
437
|
.map((m) => {
|
|
438
|
-
const
|
|
439
|
-
return
|
|
438
|
+
const tag = m.role === "assistant" ? "assistant_message" : "user_message"
|
|
439
|
+
return `<${tag}>\n${serializeContent(m.content, tempFiles)}\n</${tag}>`
|
|
440
440
|
})
|
|
441
441
|
.join("\n\n")
|
|
442
442
|
const toolsSection = buildClientToolsPrompt(body.tools)
|
|
@@ -449,15 +449,15 @@ export function createProxyServer(config: Partial<ProxyConfig> = {}) {
|
|
|
449
449
|
systemPrompt = systemContext || undefined
|
|
450
450
|
prompt = serializeContent(messages[0]!.content, tempFiles)
|
|
451
451
|
} else {
|
|
452
|
-
// Multi-turn: build conversation context with
|
|
452
|
+
// Multi-turn: build conversation context with XML-delimited turns.
|
|
453
453
|
// Put prior turns in system prompt as context, last user message as prompt.
|
|
454
454
|
const lastMsg = messages[messages.length - 1]!
|
|
455
455
|
const priorMsgs = messages.slice(0, -1)
|
|
456
456
|
|
|
457
457
|
const contextParts = priorMsgs
|
|
458
458
|
.map((m) => {
|
|
459
|
-
const
|
|
460
|
-
return
|
|
459
|
+
const tag = m.role === "assistant" ? "assistant_message" : "user_message"
|
|
460
|
+
return `<${tag}>\n${serializeContent(m.content, tempFiles)}\n</${tag}>`
|
|
461
461
|
})
|
|
462
462
|
.join("\n\n")
|
|
463
463
|
|