@warlock.js/ai-anthropic 5.44.0 → 5.45.0
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/CHANGELOG.md +8 -0
- package/cjs/index.cjs +47 -2
- package/cjs/index.cjs.map +1 -1
- package/esm/known-context-windows.mjs +16 -0
- package/esm/known-context-windows.mjs.map +1 -1
- package/esm/model.d.mts.map +1 -1
- package/esm/model.mjs +3 -1
- package/esm/model.mjs.map +1 -1
- package/esm/utils/to-anthropic-messages.d.mts.map +1 -1
- package/esm/utils/to-anthropic-messages.mjs +29 -1
- package/esm/utils/to-anthropic-messages.mjs.map +1 -1
- package/llms-full.txt +4 -0
- package/package.json +3 -3
- package/skills/SKILL.md +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to `@warlock.js/ai-anthropic` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.45.0 - 2026-11-05
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- The agent-level `contextEditing.clearToolResults.clearAtLeast` is mapped to `clear_at_least` on the native `clear_tool_uses` edit, next to the resolved `trigger`, `keep` and `exclude_tools`.
|
|
12
|
+
- Image parts in a tool result are sent as `image` blocks inside the `tool_result`; the model reports `capabilities.toolResultImages: true`.
|
|
13
|
+
- `capabilities.contextWindow` is reported for every known Claude release: 1M for Opus 4.6 to 5.5, Sonnet 4.6 to 5.5, Haiku 5.5, Fable and Mythos, and 200K for Opus 4 to 4.5, Sonnet 4 to 4.5, Haiku 4.5 and the Claude 3 line. `contextWindow` in the model config still wins.
|
|
14
|
+
|
|
7
15
|
## 5.44.0 - 2026-11-05
|
|
8
16
|
|
|
9
17
|
### Added
|
package/cjs/index.cjs
CHANGED
|
@@ -408,8 +408,24 @@ function inferPreservedThinking(modelName) {
|
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region ../../packages/ai-anthropic/src/known-context-windows.ts
|
|
410
410
|
const RELEASE_CONTEXT_WINDOWS = [
|
|
411
|
+
["claude-fable-5-1", 1e6],
|
|
412
|
+
["claude-fable-5", 1e6],
|
|
413
|
+
["claude-mythos-5-1", 1e6],
|
|
414
|
+
["claude-mythos-5", 1e6],
|
|
415
|
+
["claude-opus-5-5", 1e6],
|
|
416
|
+
["claude-opus-5", 1e6],
|
|
417
|
+
["claude-opus-4-8", 1e6],
|
|
418
|
+
["claude-opus-4-7", 1e6],
|
|
419
|
+
["claude-opus-4-6", 1e6],
|
|
411
420
|
["claude-opus-4-5", 2e5],
|
|
421
|
+
["claude-opus-4-1", 2e5],
|
|
422
|
+
["claude-opus-4", 2e5],
|
|
423
|
+
["claude-sonnet-5-5", 1e6],
|
|
424
|
+
["claude-sonnet-5", 1e6],
|
|
425
|
+
["claude-sonnet-4-6", 1e6],
|
|
412
426
|
["claude-sonnet-4-5", 2e5],
|
|
427
|
+
["claude-sonnet-4", 2e5],
|
|
428
|
+
["claude-haiku-5-5", 1e6],
|
|
413
429
|
["claude-haiku-4-5", 2e5],
|
|
414
430
|
["claude-3-7-sonnet", 2e5],
|
|
415
431
|
["claude-3-5-sonnet", 2e5],
|
|
@@ -775,7 +791,7 @@ function toAnthropicMessages(messages, options = {}) {
|
|
|
775
791
|
const toolResult = {
|
|
776
792
|
type: "tool_result",
|
|
777
793
|
tool_use_id: message.toolCallId ?? "",
|
|
778
|
-
content:
|
|
794
|
+
content: toToolResultContent(message.content)
|
|
779
795
|
};
|
|
780
796
|
const previous = mapped[mapped.length - 1];
|
|
781
797
|
if (previous && previous.role === "user" && isToolResultTurn(previous)) previous.content.push(toolResult);
|
|
@@ -883,6 +899,33 @@ function stringifyContent(content) {
|
|
|
883
899
|
return content.filter((part) => part.type === "text").map((part) => part.text).join("");
|
|
884
900
|
}
|
|
885
901
|
/**
|
|
902
|
+
* A tool result's `content`: the plain string, or text and `image` blocks
|
|
903
|
+
* when the tool returned content parts. A `url` image cannot appear here
|
|
904
|
+
* (tool images are inline base64) but degrades to the placeholder text.
|
|
905
|
+
*/
|
|
906
|
+
function toToolResultContent(content) {
|
|
907
|
+
if (typeof content === "string") return content;
|
|
908
|
+
if (!content.some((part) => part.type === "image")) return stringifyContent(content);
|
|
909
|
+
const blocks = [];
|
|
910
|
+
for (const part of content) if (part.type === "text") blocks.push({
|
|
911
|
+
type: "text",
|
|
912
|
+
text: part.text
|
|
913
|
+
});
|
|
914
|
+
else if (part.type === "image" && "base64" in part.source) blocks.push({
|
|
915
|
+
type: "image",
|
|
916
|
+
source: {
|
|
917
|
+
type: "base64",
|
|
918
|
+
media_type: part.source.mediaType,
|
|
919
|
+
data: part.source.base64
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
else blocks.push({
|
|
923
|
+
type: "text",
|
|
924
|
+
text: _warlock_js_ai.TOOL_RESULT_IMAGE_PLACEHOLDER
|
|
925
|
+
});
|
|
926
|
+
return blocks;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
886
929
|
* Map a single resolved `ContentPart` to an Anthropic content block.
|
|
887
930
|
* Text passes straight through; images become an `image` block with a
|
|
888
931
|
* `url` source (remote) or a `base64` source (inlined bytes). The
|
|
@@ -1245,6 +1288,7 @@ var AnthropicModel = class {
|
|
|
1245
1288
|
this.capabilities = {
|
|
1246
1289
|
structuredOutput: config.structuredOutput ?? true,
|
|
1247
1290
|
vision: config.vision ?? inferVisionCapability(config.name),
|
|
1291
|
+
toolResultImages: true,
|
|
1248
1292
|
reasoning: config.reasoning ?? true,
|
|
1249
1293
|
...windowCapability(config.contextWindow ?? inferContextWindow(config.name)),
|
|
1250
1294
|
promptCaching: true,
|
|
@@ -1992,7 +2036,8 @@ function neutralClearToolUses(neutral) {
|
|
|
1992
2036
|
return {
|
|
1993
2037
|
...rule.afterTokens !== void 0 ? { trigger: { inputTokens: rule.afterTokens } } : {},
|
|
1994
2038
|
...rule.keep !== void 0 ? { keep: rule.keep } : {},
|
|
1995
|
-
...rule.exclude?.length ? { excludeTools: rule.exclude } : {}
|
|
2039
|
+
...rule.exclude?.length ? { excludeTools: rule.exclude } : {},
|
|
2040
|
+
...rule.clearAtLeast !== void 0 ? { clearAtLeast: rule.clearAtLeast } : {}
|
|
1996
2041
|
};
|
|
1997
2042
|
}
|
|
1998
2043
|
function clearThinkingEdit(options) {
|