opencode-anthropic-multi-account 0.3.4 → 0.3.5
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/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
selectClaudeCodeSystemPrompt,
|
|
25
25
|
stampClaudeCodeCch,
|
|
26
26
|
toClaudeCodeWireModelId
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-OTUIWUMD.js";
|
|
28
28
|
import "./chunk-ITZJ5FTB.js";
|
|
29
29
|
import "./chunk-QTHKVNEI.js";
|
|
30
30
|
|
|
@@ -2222,7 +2222,10 @@ function normalizeAnthropicClientRequest(inputBody) {
|
|
|
2222
2222
|
const messages = Array.isArray(body.messages) ? body.messages : [];
|
|
2223
2223
|
const systemTexts = normalizeSystemTexts(body.system);
|
|
2224
2224
|
stripCacheControl(body);
|
|
2225
|
+
const trailingMessage = messages.at(-1);
|
|
2226
|
+
const trailingUserBoundary = trailingMessage?.role === "user" && hasMeaningfulContent(trailingMessage.content) ? structuredClone(trailingMessage) : void 0;
|
|
2225
2227
|
sanitizeMessages(body);
|
|
2228
|
+
const trailingUserBoundaryWasScrubbed = trailingUserBoundary !== void 0 && !hasMeaningfulContent(trailingMessage?.content);
|
|
2226
2229
|
stripAssistantThinkingBlocks(messages);
|
|
2227
2230
|
for (const message of messages) {
|
|
2228
2231
|
if (typeof message.content === "string") {
|
|
@@ -2239,6 +2242,9 @@ function normalizeAnthropicClientRequest(inputBody) {
|
|
|
2239
2242
|
compactMessageContent(messages);
|
|
2240
2243
|
removeEmptyTurns(messages);
|
|
2241
2244
|
trimTrailingEmptyTurns(messages);
|
|
2245
|
+
if (trailingUserBoundary && trailingUserBoundaryWasScrubbed && messages.at(-1)?.role === "assistant") {
|
|
2246
|
+
messages.push(trailingUserBoundary);
|
|
2247
|
+
}
|
|
2242
2248
|
body.messages = messages;
|
|
2243
2249
|
stripUnsupportedSamplingFields(body);
|
|
2244
2250
|
stripThinkingControlFields(body);
|