From 37afbbaa158ca6d56e54a4c375a36e56504967f8 Mon Sep 17 00:00:00 2001 From: Scotlight <155151440+Scotlight@users.noreply.github.com> Date: Sun, 23 Aug 2026 18:36:46 +0800 Subject: [PATCH] fix: accept inline system/developer roles in Anthropic requests --- convert.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/convert.go b/convert.go index 8848102..2f928c6 100644 --- a/convert.go +++ b/convert.go @@ -412,6 +412,17 @@ func decodeBridgeRequest(protocol Protocol, input map[string]any) (bridgeRequest return request, fmt.Errorf("messages[%d] must be an object", i) } role := stringAt(message, "role") + // Some clients (e.g. Claude Code) inline system/developer messages + // into the messages array instead of using the top-level system + // field. Fold them into the system prompt rather than rejecting. + if role == "system" { + request.System = append(request.System, decodeAnthropicBlocks(message["content"])...) + continue + } + if role == "developer" { + request.Developer = append(request.Developer, decodeAnthropicBlocks(message["content"])...) + continue + } if role != "user" && role != "assistant" { return request, fmt.Errorf("messages[%d] has unsupported role %q", i, role) }