@aigne/anthropic 0.14.16-beta.7 → 0.14.16-beta.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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.14.16-beta.9](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.14.16-beta.8...anthropic-v0.14.16-beta.9) (2025-12-31)
4
+
5
+
6
+ ### Features
7
+
8
+ * add session compact support for AIAgent ([#863](https://github.com/AIGNE-io/aigne-framework/issues/863)) ([9010918](https://github.com/AIGNE-io/aigne-framework/commit/9010918cd3f18b02b5c60ddc9ed5c34b568d0b28))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/core bumped to 1.72.0-beta.8
16
+ * devDependencies
17
+ * @aigne/test-utils bumped to 0.5.69-beta.8
18
+
19
+ ## [0.14.16-beta.8](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.14.16-beta.7...anthropic-v0.14.16-beta.8) (2025-12-26)
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * The following workspace dependencies were updated
25
+ * dependencies
26
+ * @aigne/core bumped to 1.72.0-beta.7
27
+ * devDependencies
28
+ * @aigne/test-utils bumped to 0.5.69-beta.7
29
+
3
30
  ## [0.14.16-beta.7](https://github.com/AIGNE-io/aigne-framework/compare/anthropic-v0.14.16-beta.6...anthropic-v0.14.16-beta.7) (2025-12-25)
4
31
 
5
32
 
@@ -291,13 +291,23 @@ async function convertMessages({ messages, responseFormat, tools, modelOptions,
291
291
  const ttl = cacheConfig.ttl === "1h" ? "1h" : undefined;
292
292
  for (const msg of messages) {
293
293
  if (msg.role === "system") {
294
- if (typeof msg.content !== "string")
295
- throw new Error("System message must have content");
296
- const block = {
297
- type: "text",
298
- text: msg.content,
299
- };
300
- systemBlocks.push(block);
294
+ if (typeof msg.content === "string") {
295
+ const block = {
296
+ type: "text",
297
+ text: msg.content,
298
+ };
299
+ systemBlocks.push(block);
300
+ }
301
+ else if (Array.isArray(msg.content)) {
302
+ systemBlocks.push(...msg.content.map((item) => {
303
+ if (item.type !== "text")
304
+ throw new Error("System message only supports text content blocks");
305
+ return { type: "text", text: item.text };
306
+ }));
307
+ }
308
+ else {
309
+ throw new Error("System message must have string or array content");
310
+ }
301
311
  }
302
312
  else if (msg.role === "tool") {
303
313
  if (!msg.toolCallId)
@@ -284,13 +284,23 @@ async function convertMessages({ messages, responseFormat, tools, modelOptions,
284
284
  const ttl = cacheConfig.ttl === "1h" ? "1h" : undefined;
285
285
  for (const msg of messages) {
286
286
  if (msg.role === "system") {
287
- if (typeof msg.content !== "string")
288
- throw new Error("System message must have content");
289
- const block = {
290
- type: "text",
291
- text: msg.content,
292
- };
293
- systemBlocks.push(block);
287
+ if (typeof msg.content === "string") {
288
+ const block = {
289
+ type: "text",
290
+ text: msg.content,
291
+ };
292
+ systemBlocks.push(block);
293
+ }
294
+ else if (Array.isArray(msg.content)) {
295
+ systemBlocks.push(...msg.content.map((item) => {
296
+ if (item.type !== "text")
297
+ throw new Error("System message only supports text content blocks");
298
+ return { type: "text", text: item.text };
299
+ }));
300
+ }
301
+ else {
302
+ throw new Error("System message must have string or array content");
303
+ }
294
304
  }
295
305
  else if (msg.role === "tool") {
296
306
  if (!msg.toolCallId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/anthropic",
3
- "version": "0.14.16-beta.7",
3
+ "version": "0.14.16-beta.9",
4
4
  "description": "AIGNE Anthropic SDK for integrating with Claude AI models",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@anthropic-ai/sdk": "^0.63.0",
39
39
  "zod": "^3.25.67",
40
- "@aigne/core": "^1.72.0-beta.6",
40
+ "@aigne/core": "^1.72.0-beta.8",
41
41
  "@aigne/platform-helpers": "^0.6.7-beta"
42
42
  },
43
43
  "devDependencies": {
@@ -46,7 +46,7 @@
46
46
  "npm-run-all": "^4.1.5",
47
47
  "rimraf": "^6.0.1",
48
48
  "typescript": "^5.9.2",
49
- "@aigne/test-utils": "^0.5.69-beta.6"
49
+ "@aigne/test-utils": "^0.5.69-beta.8"
50
50
  },
51
51
  "scripts": {
52
52
  "lint": "tsc --noEmit",