@code-yeongyu/senpi-ai 2026.9.8 → 2026.9.9
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/api/anthropic-messages.js +23 -5
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/image-models.generated.d.ts +30 -0
- package/dist/image-models.generated.d.ts.map +1 -1
- package/dist/image-models.generated.js +30 -0
- package/dist/image-models.generated.js.map +1 -1
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/package.json +2 -2
|
@@ -1618,11 +1618,19 @@ function buildParams(model, context, isOAuthToken, options, unsignedThinkingRepl
|
|
|
1618
1618
|
disableThinkingForRequest(params, model, compat);
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
//
|
|
1622
|
-
//
|
|
1623
|
-
//
|
|
1624
|
-
//
|
|
1625
|
-
|
|
1621
|
+
// A budget-thinking request whose final assistant turn came from another API
|
|
1622
|
+
// and starts with tool_use (its thinking demoted to text or dropped) is the
|
|
1623
|
+
// history shape Anthropic has rejected with "final assistant message must
|
|
1624
|
+
// start with a thinking block", so that request degrades thinking instead of
|
|
1625
|
+
// failing every turn. Nothing else degrades: adaptive families accept a
|
|
1626
|
+
// tool_use-first final turn (verified live 2026-09-09 on claude-opus-5,
|
|
1627
|
+
// claude-opus-4-6 and claude-fable-5), the model itself skips thinking before
|
|
1628
|
+
// trivial tool calls, and every change to `thinking` re-keys the prompt
|
|
1629
|
+
// cache - degrading here re-wrote the whole cached prefix on each tool
|
|
1630
|
+
// continuation (the "cache misses every second prompt" report).
|
|
1631
|
+
if (params.thinking?.type === "enabled" &&
|
|
1632
|
+
finalAssistantTurnIsForeign(context.messages) &&
|
|
1633
|
+
finalAssistantTurnStartsWithToolUse(params.messages))
|
|
1626
1634
|
disableThinkingForRequest(params, model, compat);
|
|
1627
1635
|
if (options?.metadata) {
|
|
1628
1636
|
const userId = options.metadata.user_id;
|
|
@@ -1663,6 +1671,16 @@ function applyExtraBodyToAnthropicParams(params, extraBody) {
|
|
|
1663
1671
|
* thinking/redacted_thinking block. Anthropic requires thinking-enabled
|
|
1664
1672
|
* requests to start that turn with a thinking block.
|
|
1665
1673
|
*/
|
|
1674
|
+
/** True when the last assistant message was produced through a different wire API. */
|
|
1675
|
+
function finalAssistantTurnIsForeign(messages) {
|
|
1676
|
+
for (let index = messages.length - 1; index >= 0; index--) {
|
|
1677
|
+
const message = messages[index];
|
|
1678
|
+
if (message.role !== "assistant")
|
|
1679
|
+
continue;
|
|
1680
|
+
return message.api !== "anthropic-messages";
|
|
1681
|
+
}
|
|
1682
|
+
return false;
|
|
1683
|
+
}
|
|
1666
1684
|
function finalAssistantTurnStartsWithToolUse(messages) {
|
|
1667
1685
|
for (let index = messages.length - 1; index >= 0; index--) {
|
|
1668
1686
|
const message = messages[index];
|