langgraph-ui-components 0.0.7 → 0.0.8
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.es100.js +25 -157
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +3130 -176
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +36 -13
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +5 -30
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +69 -30
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +28 -3148
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +5 -16
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +2 -7
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +13 -2
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +499 -9
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es11.js +2 -2
- package/dist/index.es11.js.map +1 -1
- package/dist/index.es110.js +5 -501
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +2 -7
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +148 -2
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +878 -118
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +251 -877
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +3 -281
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +445 -3
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +39 -437
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +22 -46
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +78 -21
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es120.js +126 -76
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +45 -125
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +9 -48
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +45 -10
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +97 -43
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +48 -94
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +14 -51
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +13 -162
- package/dist/index.es127.js.map +1 -1
- package/dist/index.es128.js +89 -2
- package/dist/index.es128.js.map +1 -1
- package/dist/index.es129.js +2 -15
- package/dist/index.es129.js.map +1 -1
- package/dist/index.es130.js +54 -87
- package/dist/index.es130.js.map +1 -1
- package/dist/index.es131.js +100 -2
- package/dist/index.es131.js.map +1 -1
- package/dist/index.es132.js +186 -51
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +97 -87
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +31 -187
- package/dist/index.es134.js.map +1 -1
- package/dist/index.es135.js +10 -110
- package/dist/index.es135.js.map +1 -1
- package/dist/index.es136.js +11 -35
- package/dist/index.es136.js.map +1 -1
- package/dist/index.es137.js +12 -10
- package/dist/index.es137.js.map +1 -1
- package/dist/index.es138.js +90 -10
- package/dist/index.es138.js.map +1 -1
- package/dist/index.es139.js +274 -11
- package/dist/index.es139.js.map +1 -1
- package/dist/index.es140.js +2 -91
- package/dist/index.es140.js.map +1 -1
- package/dist/index.es141.js +150 -261
- package/dist/index.es141.js.map +1 -1
- package/dist/index.es142.js +51 -2
- package/dist/index.es142.js.map +1 -1
- package/dist/index.es143.js +34 -158
- package/dist/index.es143.js.map +1 -1
- package/dist/index.es144.js +34 -50
- package/dist/index.es144.js.map +1 -1
- package/dist/index.es145.js +32 -32
- package/dist/index.es145.js.map +1 -1
- package/dist/index.es146.js +23 -34
- package/dist/index.es146.js.map +1 -1
- package/dist/index.es147.js +583 -32
- package/dist/index.es147.js.map +1 -1
- package/dist/index.es148.js +121 -20
- package/dist/index.es148.js.map +1 -1
- package/dist/index.es149.js +158 -585
- package/dist/index.es149.js.map +1 -1
- package/dist/index.es15.js +15 -15
- package/dist/index.es150.js +2 -125
- package/dist/index.es150.js.map +1 -1
- package/dist/index.es157.js +2 -2
- package/dist/index.es159.js +2 -2
- package/dist/index.es161.js +64 -25
- package/dist/index.es161.js.map +1 -1
- package/dist/index.es162.js +22 -12
- package/dist/index.es162.js.map +1 -1
- package/dist/index.es163.js +5 -53
- package/dist/index.es163.js.map +1 -1
- package/dist/index.es164.js +337 -52
- package/dist/index.es164.js.map +1 -1
- package/dist/index.es165.js +24 -21
- package/dist/index.es165.js.map +1 -1
- package/dist/index.es166.js +12 -6
- package/dist/index.es166.js.map +1 -1
- package/dist/index.es167.js +49 -344
- package/dist/index.es167.js.map +1 -1
- package/dist/index.es175.js +1 -1
- package/dist/index.es178.js +1 -1
- package/dist/index.es183.js +1 -1
- package/dist/index.es195.js +2 -2
- package/dist/index.es197.js +2 -2
- package/dist/index.es200.js +1 -1
- package/dist/index.es201.js +1 -1
- package/dist/index.es203.js +1 -1
- package/dist/index.es204.js +2 -2
- package/dist/index.es206.js +1 -1
- package/dist/index.es209.js +3 -3
- package/dist/index.es21.js +1 -1
- package/dist/index.es210.js +2 -2
- package/dist/index.es212.js +1 -1
- package/dist/index.es214.js +1 -1
- package/dist/index.es215.js +1 -1
- package/dist/index.es217.js +1 -1
- package/dist/index.es218.js +2 -2
- package/dist/index.es219.js +1 -1
- package/dist/index.es220.js +1 -1
- package/dist/index.es221.js +1 -1
- package/dist/index.es222.js +1 -1
- package/dist/index.es223.js +1 -1
- package/dist/index.es224.js +1 -1
- package/dist/index.es225.js +1 -1
- package/dist/index.es229.js +2 -2
- package/dist/index.es28.js +7 -7
- package/dist/index.es29.js +1 -1
- package/dist/index.es32.js +4 -4
- package/dist/index.es33.js +15 -1191
- package/dist/index.es33.js.map +1 -1
- package/dist/index.es34.js +117 -6
- package/dist/index.es34.js.map +1 -1
- package/dist/index.es35.js +70 -8
- package/dist/index.es35.js.map +1 -1
- package/dist/index.es36.js +19 -148
- package/dist/index.es36.js.map +1 -1
- package/dist/index.es37.js +255 -112
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +40 -68
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +214 -17
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es40.js +53 -247
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +123 -24
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +14 -205
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +221 -58
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +7 -140
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +1185 -17
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +6 -229
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +146 -15
- package/dist/index.es47.js.map +1 -1
- package/dist/index.es49.js +7 -90
- package/dist/index.es49.js.map +1 -1
- package/dist/index.es50.js +92 -6
- package/dist/index.es50.js.map +1 -1
- package/dist/index.es51.js +3 -14
- package/dist/index.es51.js.map +1 -1
- package/dist/index.es52.js +36 -8
- package/dist/index.es52.js.map +1 -1
- package/dist/index.es53.js +61 -83
- package/dist/index.es53.js.map +1 -1
- package/dist/index.es54.js +37 -3
- package/dist/index.es54.js.map +1 -1
- package/dist/index.es55.js +304 -34
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +9 -72
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es57.js +85 -32
- package/dist/index.es57.js.map +1 -1
- package/dist/index.es58.js +6 -304
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +15 -9
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es60.js +142 -5
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +285 -148
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +62 -668
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +201 -131
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es64.js +29 -295
- package/dist/index.es64.js.map +1 -1
- package/dist/index.es65.js +8 -65
- package/dist/index.es65.js.map +1 -1
- package/dist/index.es66.js +9 -210
- package/dist/index.es66.js.map +1 -1
- package/dist/index.es67.js +181 -28
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +23 -8
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +1397 -9
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es70.js +9 -187
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +8 -24
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +5 -1399
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +163 -9
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +672 -8
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +11 -36
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +40 -5
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +32 -71
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +225 -30
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +29 -11
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es80.js +72 -37
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +74 -32
- package/dist/index.es81.js.map +1 -1
- package/dist/index.es82.js +46 -226
- package/dist/index.es82.js.map +1 -1
- package/dist/index.es83.js +6 -6
- package/dist/index.es83.js.map +1 -1
- package/dist/index.es84.js +39 -71
- package/dist/index.es84.js.map +1 -1
- package/dist/index.es85.js +54 -73
- package/dist/index.es85.js.map +1 -1
- package/dist/index.es86.js +13 -52
- package/dist/index.es86.js.map +1 -1
- package/dist/index.es87.js +135 -28
- package/dist/index.es87.js.map +1 -1
- package/dist/index.es88.js +20 -42
- package/dist/index.es88.js.map +1 -1
- package/dist/index.es89.js +175 -50
- package/dist/index.es89.js.map +1 -1
- package/dist/index.es90.js +240 -12
- package/dist/index.es90.js.map +1 -1
- package/dist/index.es91.js +348 -130
- package/dist/index.es91.js.map +1 -1
- package/dist/index.es92.js +134 -18
- package/dist/index.es92.js.map +1 -1
- package/dist/index.es93.js +62 -174
- package/dist/index.es93.js.map +1 -1
- package/dist/index.es94.js +30 -234
- package/dist/index.es94.js.map +1 -1
- package/dist/index.es95.js +26 -344
- package/dist/index.es95.js.map +1 -1
- package/dist/index.es96.js +156 -127
- package/dist/index.es96.js.map +1 -1
- package/dist/index.es97.js +196 -63
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +14 -37
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +27 -34
- package/dist/index.es99.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es61.js
CHANGED
|
@@ -1,166 +1,303 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { _isContentBlock, _isObject, _isString, _isArray, iife, safeParseJson, _isNumber } from "./index.es77.js";
|
|
2
|
+
function convertAnthropicAnnotation(citation) {
|
|
3
|
+
if (citation.type === "char_location" && _isString(citation.document_title) && _isNumber(citation.start_char_index) && _isNumber(citation.end_char_index) && _isString(citation.cited_text)) {
|
|
4
|
+
const { document_title, start_char_index, end_char_index, cited_text, ...rest } = citation;
|
|
5
|
+
return {
|
|
6
|
+
...rest,
|
|
7
|
+
type: "citation",
|
|
8
|
+
source: "char",
|
|
9
|
+
title: document_title ?? void 0,
|
|
10
|
+
startIndex: start_char_index,
|
|
11
|
+
endIndex: end_char_index,
|
|
12
|
+
citedText: cited_text
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (citation.type === "page_location" && _isString(citation.document_title) && _isNumber(citation.start_page_number) && _isNumber(citation.end_page_number) && _isString(citation.cited_text)) {
|
|
16
|
+
const { document_title, start_page_number, end_page_number, cited_text, ...rest } = citation;
|
|
17
|
+
return {
|
|
18
|
+
...rest,
|
|
19
|
+
type: "citation",
|
|
20
|
+
source: "page",
|
|
21
|
+
title: document_title ?? void 0,
|
|
22
|
+
startIndex: start_page_number,
|
|
23
|
+
endIndex: end_page_number,
|
|
24
|
+
citedText: cited_text
|
|
25
|
+
};
|
|
17
26
|
}
|
|
18
|
-
if (
|
|
19
|
-
|
|
27
|
+
if (citation.type === "content_block_location" && _isString(citation.document_title) && _isNumber(citation.start_block_index) && _isNumber(citation.end_block_index) && _isString(citation.cited_text)) {
|
|
28
|
+
const { document_title, start_block_index, end_block_index, cited_text, ...rest } = citation;
|
|
29
|
+
return {
|
|
30
|
+
...rest,
|
|
31
|
+
type: "citation",
|
|
32
|
+
source: "block",
|
|
33
|
+
title: document_title ?? void 0,
|
|
34
|
+
startIndex: start_block_index,
|
|
35
|
+
endIndex: end_block_index,
|
|
36
|
+
citedText: cited_text
|
|
37
|
+
};
|
|
20
38
|
}
|
|
21
|
-
if (
|
|
22
|
-
|
|
39
|
+
if (citation.type === "web_search_result_location" && _isString(citation.url) && _isString(citation.title) && _isString(citation.encrypted_index) && _isString(citation.cited_text)) {
|
|
40
|
+
const { url, title, encrypted_index, cited_text, ...rest } = citation;
|
|
41
|
+
return {
|
|
42
|
+
...rest,
|
|
43
|
+
type: "citation",
|
|
44
|
+
source: "url",
|
|
45
|
+
url,
|
|
46
|
+
title,
|
|
47
|
+
startIndex: Number(encrypted_index),
|
|
48
|
+
endIndex: Number(encrypted_index),
|
|
49
|
+
citedText: cited_text
|
|
50
|
+
};
|
|
23
51
|
}
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.originalError.stack = this.stack;
|
|
37
|
-
}
|
|
38
|
-
this.name = "AbortError";
|
|
39
|
-
this.message = message;
|
|
52
|
+
if (citation.type === "search_result_location" && _isString(citation.source) && _isString(citation.title) && _isNumber(citation.start_block_index) && _isNumber(citation.end_block_index) && _isString(citation.cited_text)) {
|
|
53
|
+
const { source, title, start_block_index, end_block_index, cited_text, ...rest } = citation;
|
|
54
|
+
return {
|
|
55
|
+
...rest,
|
|
56
|
+
type: "citation",
|
|
57
|
+
source: "search",
|
|
58
|
+
url: source,
|
|
59
|
+
title: title ?? void 0,
|
|
60
|
+
startIndex: start_block_index,
|
|
61
|
+
endIndex: end_block_index,
|
|
62
|
+
citedText: cited_text
|
|
63
|
+
};
|
|
40
64
|
}
|
|
65
|
+
return void 0;
|
|
41
66
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
function convertToV1FromAnthropicContentBlock(block) {
|
|
68
|
+
if (_isContentBlock(block, "document") && _isObject(block.source) && "type" in block.source) {
|
|
69
|
+
if (block.source.type === "base64" && _isString(block.source.media_type) && _isString(block.source.data)) return {
|
|
70
|
+
type: "file",
|
|
71
|
+
mimeType: block.source.media_type,
|
|
72
|
+
data: block.source.data
|
|
73
|
+
};
|
|
74
|
+
else if (block.source.type === "url" && _isString(block.source.url)) return {
|
|
75
|
+
type: "file",
|
|
76
|
+
url: block.source.url
|
|
77
|
+
};
|
|
78
|
+
else if (block.source.type === "file" && _isString(block.source.file_id)) return {
|
|
79
|
+
type: "file",
|
|
80
|
+
fileId: block.source.file_id
|
|
81
|
+
};
|
|
82
|
+
else if (block.source.type === "text" && _isString(block.source.data)) return {
|
|
83
|
+
type: "file",
|
|
84
|
+
mimeType: String(block.source.media_type ?? "text/plain"),
|
|
85
|
+
data: block.source.data
|
|
86
|
+
};
|
|
87
|
+
} else if (_isContentBlock(block, "image") && _isObject(block.source) && "type" in block.source) {
|
|
88
|
+
if (block.source.type === "base64" && _isString(block.source.media_type) && _isString(block.source.data)) return {
|
|
89
|
+
type: "image",
|
|
90
|
+
mimeType: block.source.media_type,
|
|
91
|
+
data: block.source.data
|
|
92
|
+
};
|
|
93
|
+
else if (block.source.type === "url" && _isString(block.source.url)) return {
|
|
94
|
+
type: "image",
|
|
95
|
+
url: block.source.url
|
|
96
|
+
};
|
|
97
|
+
else if (block.source.type === "file" && _isString(block.source.file_id)) return {
|
|
98
|
+
type: "image",
|
|
99
|
+
fileId: block.source.file_id
|
|
100
|
+
};
|
|
52
101
|
}
|
|
53
|
-
return
|
|
102
|
+
return void 0;
|
|
54
103
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
|
|
62
|
-
const context = Object.freeze({
|
|
63
|
-
error: normalizedError,
|
|
64
|
-
attemptNumber,
|
|
65
|
-
retriesLeft,
|
|
66
|
-
retriesConsumed
|
|
67
|
-
});
|
|
68
|
-
await options.onFailedAttempt(context);
|
|
69
|
-
if (calculateRemainingTime(startTime, maxRetryTime) <= 0) {
|
|
70
|
-
throw normalizedError;
|
|
71
|
-
}
|
|
72
|
-
const consumeRetry = await options.shouldConsumeRetry(context);
|
|
73
|
-
const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
|
|
74
|
-
if (remainingTime <= 0 || retriesLeft <= 0) {
|
|
75
|
-
throw normalizedError;
|
|
76
|
-
}
|
|
77
|
-
if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
|
|
78
|
-
if (consumeRetry) {
|
|
79
|
-
throw normalizedError;
|
|
104
|
+
function convertToV1FromAnthropicInput(content) {
|
|
105
|
+
function* iterateContent() {
|
|
106
|
+
for (const block of content) {
|
|
107
|
+
const stdBlock = convertToV1FromAnthropicContentBlock(block);
|
|
108
|
+
if (stdBlock) yield stdBlock;
|
|
109
|
+
else yield block;
|
|
80
110
|
}
|
|
81
|
-
options.signal?.throwIfAborted();
|
|
82
|
-
return false;
|
|
83
111
|
}
|
|
84
|
-
|
|
85
|
-
throw normalizedError;
|
|
86
|
-
}
|
|
87
|
-
if (!consumeRetry) {
|
|
88
|
-
options.signal?.throwIfAborted();
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
const delayTime = calculateDelay(retriesConsumed, options);
|
|
92
|
-
const finalDelay = Math.min(delayTime, remainingTime);
|
|
93
|
-
options.signal?.throwIfAborted();
|
|
94
|
-
if (finalDelay > 0) {
|
|
95
|
-
await new Promise((resolve, reject) => {
|
|
96
|
-
const onAbort = () => {
|
|
97
|
-
clearTimeout(timeoutToken);
|
|
98
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
99
|
-
reject(options.signal.reason);
|
|
100
|
-
};
|
|
101
|
-
const timeoutToken = setTimeout(() => {
|
|
102
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
103
|
-
resolve();
|
|
104
|
-
}, finalDelay);
|
|
105
|
-
if (options.unref) {
|
|
106
|
-
timeoutToken.unref?.();
|
|
107
|
-
}
|
|
108
|
-
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
options.signal?.throwIfAborted();
|
|
112
|
-
return true;
|
|
112
|
+
return Array.from(iterateContent());
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
114
|
+
function convertToV1FromAnthropicMessage(message) {
|
|
115
|
+
function* iterateContent() {
|
|
116
|
+
const content = typeof message.content === "string" ? [{
|
|
117
|
+
type: "text",
|
|
118
|
+
text: message.content
|
|
119
|
+
}] : message.content;
|
|
120
|
+
for (const block of content) {
|
|
121
|
+
if (_isContentBlock(block, "text") && _isString(block.text)) {
|
|
122
|
+
const { text, citations, ...rest } = block;
|
|
123
|
+
if (_isArray(citations) && citations.length) {
|
|
124
|
+
const _citations = citations.reduce((acc, item) => {
|
|
125
|
+
const citation = convertAnthropicAnnotation(item);
|
|
126
|
+
if (citation) return [...acc, citation];
|
|
127
|
+
return acc;
|
|
128
|
+
}, []);
|
|
129
|
+
yield {
|
|
130
|
+
...rest,
|
|
131
|
+
type: "text",
|
|
132
|
+
text,
|
|
133
|
+
annotations: _citations
|
|
134
|
+
};
|
|
135
|
+
continue;
|
|
136
|
+
} else {
|
|
137
|
+
yield {
|
|
138
|
+
...rest,
|
|
139
|
+
type: "text",
|
|
140
|
+
text
|
|
141
|
+
};
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
} else if (_isContentBlock(block, "thinking") && _isString(block.thinking)) {
|
|
145
|
+
const { thinking, signature, ...rest } = block;
|
|
146
|
+
yield {
|
|
147
|
+
...rest,
|
|
148
|
+
type: "reasoning",
|
|
149
|
+
reasoning: thinking,
|
|
150
|
+
signature
|
|
151
|
+
};
|
|
152
|
+
continue;
|
|
153
|
+
} else if (_isContentBlock(block, "redacted_thinking")) {
|
|
154
|
+
yield {
|
|
155
|
+
type: "non_standard",
|
|
156
|
+
value: block
|
|
157
|
+
};
|
|
158
|
+
continue;
|
|
159
|
+
} else if (_isContentBlock(block, "tool_use") && _isString(block.name) && _isString(block.id)) {
|
|
160
|
+
yield {
|
|
161
|
+
type: "tool_call",
|
|
162
|
+
id: block.id,
|
|
163
|
+
name: block.name,
|
|
164
|
+
args: block.input
|
|
165
|
+
};
|
|
166
|
+
continue;
|
|
167
|
+
} else if (_isContentBlock(block, "input_json_delta")) {
|
|
168
|
+
if (_isAIMessageChunk(message) && message.tool_call_chunks?.length) {
|
|
169
|
+
const tool_call_chunk = message.tool_call_chunks[0];
|
|
170
|
+
yield {
|
|
171
|
+
type: "tool_call_chunk",
|
|
172
|
+
id: tool_call_chunk.id,
|
|
173
|
+
name: tool_call_chunk.name,
|
|
174
|
+
args: tool_call_chunk.args,
|
|
175
|
+
index: tool_call_chunk.index
|
|
176
|
+
};
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
} else if (_isContentBlock(block, "server_tool_use") && _isString(block.name) && _isString(block.id)) {
|
|
180
|
+
const { name, id } = block;
|
|
181
|
+
if (name === "web_search") {
|
|
182
|
+
const query = iife(() => {
|
|
183
|
+
if (typeof block.input === "string") return block.input;
|
|
184
|
+
else if (_isObject(block.input) && _isString(block.input.query)) return block.input.query;
|
|
185
|
+
else if (_isString(block.partial_json)) {
|
|
186
|
+
const json = safeParseJson(block.partial_json);
|
|
187
|
+
if (json?.query) return json.query;
|
|
188
|
+
}
|
|
189
|
+
return "";
|
|
190
|
+
});
|
|
191
|
+
yield {
|
|
192
|
+
id,
|
|
193
|
+
type: "server_tool_call",
|
|
194
|
+
name: "web_search",
|
|
195
|
+
args: { query }
|
|
196
|
+
};
|
|
197
|
+
continue;
|
|
198
|
+
} else if (block.name === "code_execution") {
|
|
199
|
+
const code = iife(() => {
|
|
200
|
+
if (typeof block.input === "string") return block.input;
|
|
201
|
+
else if (_isObject(block.input) && _isString(block.input.code)) return block.input.code;
|
|
202
|
+
else if (_isString(block.partial_json)) {
|
|
203
|
+
const json = safeParseJson(block.partial_json);
|
|
204
|
+
if (json?.code) return json.code;
|
|
205
|
+
}
|
|
206
|
+
return "";
|
|
207
|
+
});
|
|
208
|
+
yield {
|
|
209
|
+
id,
|
|
210
|
+
type: "server_tool_call",
|
|
211
|
+
name: "code_execution",
|
|
212
|
+
args: { code }
|
|
213
|
+
};
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
} else if (_isContentBlock(block, "web_search_tool_result") && _isString(block.tool_use_id) && _isArray(block.content)) {
|
|
217
|
+
const { content: content$1, tool_use_id } = block;
|
|
218
|
+
const urls = content$1.reduce((acc, content$2) => {
|
|
219
|
+
if (_isContentBlock(content$2, "web_search_result")) return [...acc, content$2.url];
|
|
220
|
+
return acc;
|
|
221
|
+
}, []);
|
|
222
|
+
yield {
|
|
223
|
+
type: "server_tool_call_result",
|
|
224
|
+
name: "web_search",
|
|
225
|
+
toolCallId: tool_use_id,
|
|
226
|
+
status: "success",
|
|
227
|
+
output: { urls }
|
|
228
|
+
};
|
|
229
|
+
continue;
|
|
230
|
+
} else if (_isContentBlock(block, "code_execution_tool_result") && _isString(block.tool_use_id) && _isObject(block.content)) {
|
|
231
|
+
yield {
|
|
232
|
+
type: "server_tool_call_result",
|
|
233
|
+
name: "code_execution",
|
|
234
|
+
toolCallId: block.tool_use_id,
|
|
235
|
+
status: "success",
|
|
236
|
+
output: block.content
|
|
237
|
+
};
|
|
238
|
+
continue;
|
|
239
|
+
} else if (_isContentBlock(block, "mcp_tool_use")) {
|
|
240
|
+
yield {
|
|
241
|
+
id: block.id,
|
|
242
|
+
type: "server_tool_call",
|
|
243
|
+
name: "mcp_tool_use",
|
|
244
|
+
args: block.input
|
|
245
|
+
};
|
|
246
|
+
continue;
|
|
247
|
+
} else if (_isContentBlock(block, "mcp_tool_result") && _isString(block.tool_use_id) && _isObject(block.content)) {
|
|
248
|
+
yield {
|
|
249
|
+
type: "server_tool_call_result",
|
|
250
|
+
name: "mcp_tool_use",
|
|
251
|
+
toolCallId: block.tool_use_id,
|
|
252
|
+
status: "success",
|
|
253
|
+
output: block.content
|
|
254
|
+
};
|
|
255
|
+
continue;
|
|
256
|
+
} else if (_isContentBlock(block, "container_upload")) {
|
|
257
|
+
yield {
|
|
258
|
+
type: "server_tool_call",
|
|
259
|
+
name: "container_upload",
|
|
260
|
+
args: block.input
|
|
261
|
+
};
|
|
262
|
+
continue;
|
|
263
|
+
} else if (_isContentBlock(block, "search_result")) {
|
|
264
|
+
yield {
|
|
265
|
+
id: block.id,
|
|
266
|
+
type: "non_standard",
|
|
267
|
+
value: block
|
|
268
|
+
};
|
|
269
|
+
continue;
|
|
270
|
+
} else if (_isContentBlock(block, "tool_result")) {
|
|
271
|
+
yield {
|
|
272
|
+
id: block.id,
|
|
273
|
+
type: "non_standard",
|
|
274
|
+
value: block
|
|
275
|
+
};
|
|
276
|
+
continue;
|
|
277
|
+
} else {
|
|
278
|
+
const stdBlock = convertToV1FromAnthropicContentBlock(block);
|
|
279
|
+
if (stdBlock) {
|
|
280
|
+
yield stdBlock;
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
157
283
|
}
|
|
284
|
+
yield {
|
|
285
|
+
type: "non_standard",
|
|
286
|
+
value: block
|
|
287
|
+
};
|
|
158
288
|
}
|
|
159
289
|
}
|
|
160
|
-
|
|
290
|
+
return Array.from(iterateContent());
|
|
291
|
+
}
|
|
292
|
+
const ChatAnthropicTranslator = {
|
|
293
|
+
translateContent: convertToV1FromAnthropicMessage,
|
|
294
|
+
translateContentChunk: convertToV1FromAnthropicMessage
|
|
295
|
+
};
|
|
296
|
+
function _isAIMessageChunk(message) {
|
|
297
|
+
return typeof message?._getType === "function" && typeof message.concat === "function" && message._getType() === "ai";
|
|
161
298
|
}
|
|
162
299
|
export {
|
|
163
|
-
|
|
164
|
-
|
|
300
|
+
ChatAnthropicTranslator,
|
|
301
|
+
convertToV1FromAnthropicInput
|
|
165
302
|
};
|
|
166
303
|
//# sourceMappingURL=index.es61.js.map
|
package/dist/index.es61.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es61.js","sources":["../node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js"],"sourcesContent":["import isNetworkError from 'is-network-error';\n\nfunction validateRetries(retries) {\n\tif (typeof retries === 'number') {\n\t\tif (retries < 0) {\n\t\t\tthrow new TypeError('Expected `retries` to be a non-negative number.');\n\t\t}\n\n\t\tif (Number.isNaN(retries)) {\n\t\t\tthrow new TypeError('Expected `retries` to be a valid number or Infinity, got NaN.');\n\t\t}\n\t} else if (retries !== undefined) {\n\t\tthrow new TypeError('Expected `retries` to be a number or Infinity.');\n\t}\n}\n\nfunction validateNumberOption(name, value, {min = 0, allowInfinity = false} = {}) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || Number.isNaN(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? ' or Infinity' : ''}.`);\n\t}\n\n\tif (!allowInfinity && !Number.isFinite(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\t}\n\n\tif (value < min) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n\t}\n}\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? (Math.random() + 1) : 1;\n\n\tlet timeout = Math.round(random * options.minTimeout * (options.factor ** (attempt - 1)));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\n\treturn timeout;\n}\n\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) {\n\t\treturn max;\n\t}\n\n\treturn max - (performance.now() - start);\n}\n\nasync function onAttemptFailure({error, attemptNumber, retriesConsumed, startTime, options}) {\n\tconst normalizedError = error instanceof Error\n\t\t? error\n\t\t: new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\n\tif (normalizedError instanceof AbortError) {\n\t\tthrow normalizedError.originalError;\n\t}\n\n\tconst retriesLeft = Number.isFinite(options.retries)\n\t\t? Math.max(0, options.retries - retriesConsumed)\n\t\t: options.retries;\n\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t});\n\n\tawait options.onFailedAttempt(context);\n\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst consumeRetry = await options.shouldConsumeRetry(context);\n\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTime <= 0 || retriesLeft <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tif (consumeRetry) {\n\t\t\tthrow normalizedError;\n\t\t}\n\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tif (!await options.shouldRetry(context)) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst finalDelay = Math.min(delayTime, remainingTime);\n\n\toptions.signal?.throwIfAborted();\n\n\tif (finalDelay > 0) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tconst onAbort = () => {\n\t\t\t\tclearTimeout(timeoutToken);\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\treject(options.signal.reason);\n\t\t\t};\n\n\t\t\tconst timeoutToken = setTimeout(() => {\n\t\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\t\tresolve();\n\t\t\t}, finalDelay);\n\n\t\t\tif (options.unref) {\n\t\t\t\ttimeoutToken.unref?.();\n\t\t\t}\n\n\t\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\t\t});\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\treturn true;\n}\n\nexport default async function pRetry(input, options = {}) {\n\toptions = {...options};\n\n\tvalidateRetries(options.retries);\n\n\tif (Object.hasOwn(options, 'forever')) {\n\t\tthrow new Error('The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.');\n\t}\n\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1000;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\n\t// Validate numeric options and normalize edge cases\n\tvalidateNumberOption('factor', options.factor, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('minTimeout', options.minTimeout, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('maxTimeout', options.maxTimeout, {min: 0, allowInfinity: true});\n\tvalidateNumberOption('maxRetryTime', options.maxRetryTime, {min: 0, allowInfinity: true});\n\n\t// Treat non-positive factor as 1 to avoid zero backoff or negative behavior\n\tif (!(options.factor > 0)) {\n\t\toptions.factor = 1;\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\tconst result = await input(attemptNumber);\n\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions,\n\t\t\t})) {\n\t\t\t\tretriesConsumed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Should not reach here, but in case it does, throw an error\n\tthrow new Error('Retry attempts exhausted without throwing an error.');\n}\n\nexport function makeRetriable(function_, options) {\n\treturn function (...arguments_) {\n\t\treturn pRetry(() => function_.apply(this, arguments_), options);\n\t};\n}\n"],"names":[],"mappings":";AAEA,SAAS,gBAAgB,SAAS;AACjC,MAAI,OAAO,YAAY,UAAU;AAChC,QAAI,UAAU,GAAG;AAChB,YAAM,IAAI,UAAU,iDAAiD;AAAA,IACtE;AAEA,QAAI,OAAO,MAAM,OAAO,GAAG;AAC1B,YAAM,IAAI,UAAU,+DAA+D;AAAA,IACpF;AAAA,EACD,WAAW,YAAY,QAAW;AACjC,UAAM,IAAI,UAAU,gDAAgD;AAAA,EACrE;AACD;AAEA,SAAS,qBAAqB,MAAM,OAAO,EAAC,MAAM,GAAG,gBAAgB,MAAK,IAAI,IAAI;AACjF,MAAI,UAAU,QAAW;AACxB;AAAA,EACD;AAEA,MAAI,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,GAAG;AACrD,UAAM,IAAI,UAAU,cAAc,IAAI,oBAAoB,gBAAgB,iBAAiB,EAAE,GAAG;AAAA,EACjG;AAEA,MAAI,CAAC,iBAAiB,CAAC,OAAO,SAAS,KAAK,GAAG;AAC9C,UAAM,IAAI,UAAU,cAAc,IAAI,2BAA2B;AAAA,EAClE;AAEA,MAAI,QAAQ,KAAK;AAChB,UAAM,IAAI,UAAU,cAAc,IAAI,cAAmB,GAAG,GAAG;AAAA,EAChE;AACD;AAEO,MAAM,mBAAmB,MAAM;AAAA,EACrC,YAAY,SAAS;AACpB,UAAK;AAEL,QAAI,mBAAmB,OAAO;AAC7B,WAAK,gBAAgB;AACrB,OAAC,EAAC,QAAO,IAAI;AAAA,IACd,OAAO;AACN,WAAK,gBAAgB,IAAI,MAAM,OAAO;AACtC,WAAK,cAAc,QAAQ,KAAK;AAAA,IACjC;AAEA,S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AM;AAGrC,uBAAqB,UAAU,QAAQ,QAAQ,EAAC,KAAK,GAAG,eAAe,MAAK,CAAC;AAC7E,uBAAqB,cAAc,QAAQ,YAAY,EAAC,KAAK,GAAG,eAAe,MAAK,CAAC;AACrF,uBAAqB,cAAc,QAAQ,YAAY,EAAC,KAAK,GAAG,eAAe,KAAI,CAAC;AACpF,uBAAqB,gBAAgB,QAAQ,cAAc,EAAC,KAAK,GAAG,eAAe,KAAI,CAAC;AAGxF,MAAI,EAAE,QAAQ,SAAS,IAAI;AAC1B,YAAQ,SAAS;AAAA,EAClB;AAEA,UAAQ,QAAQ,eAAc;AAE9B,MAAI,gBAAgB;AACpB,MAAI,kBAAkB;AACtB,QAAM,YAAY,YAAY,IAAG;AAEjC,SAAO,OAAO,SAAS,QAAQ,OAAO,IAAI,mBAAmB,QAAQ,UAAU,MAAM;AACpF;AAEA,QAAI;AACH,cAAQ,QAAQ,eAAc;AAE9B,YAAM,SAAS,MAAM,MAAM,aAAa;AAExC,cAAQ,QAAQ,eAAc;AAE9B,aAAO;AAAA,IACR,SAAS,OAAO;AACf,UAAI,MAAM,iBAAiB;AAAA,QAC1B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACJ,CAAI,GAAG;AACH;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAGA,QAAM,IAAI,MAAM,qDAAqD;AACtE;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.es61.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/anthropic.js"],"sourcesContent":["import { _isArray, _isContentBlock, _isNumber, _isObject, _isString, iife, safeParseJson } from \"./utils.js\";\n\n//#region src/messages/block_translators/anthropic.ts\nfunction convertAnthropicAnnotation(citation) {\n\tif (citation.type === \"char_location\" && _isString(citation.document_title) && _isNumber(citation.start_char_index) && _isNumber(citation.end_char_index) && _isString(citation.cited_text)) {\n\t\tconst { document_title, start_char_index, end_char_index, cited_text,...rest } = citation;\n\t\treturn {\n\t\t\t...rest,\n\t\t\ttype: \"citation\",\n\t\t\tsource: \"char\",\n\t\t\ttitle: document_title ?? void 0,\n\t\t\tstartIndex: start_char_index,\n\t\t\tendIndex: end_char_index,\n\t\t\tcitedText: cited_text\n\t\t};\n\t}\n\tif (citation.type === \"page_location\" && _isString(citation.document_title) && _isNumber(citation.start_page_number) && _isNumber(citation.end_page_number) && _isString(citation.cited_text)) {\n\t\tconst { document_title, start_page_number, end_page_number, cited_text,...rest } = citation;\n\t\treturn {\n\t\t\t...rest,\n\t\t\ttype: \"citation\",\n\t\t\tsource: \"page\",\n\t\t\ttitle: document_title ?? void 0,\n\t\t\tstartIndex: start_page_number,\n\t\t\tendIndex: end_page_number,\n\t\t\tcitedText: cited_text\n\t\t};\n\t}\n\tif (citation.type === \"content_block_location\" && _isString(citation.document_title) && _isNumber(citation.start_block_index) && _isNumber(citation.end_block_index) && _isString(citation.cited_text)) {\n\t\tconst { document_title, start_block_index, end_block_index, cited_text,...rest } = citation;\n\t\treturn {\n\t\t\t...rest,\n\t\t\ttype: \"citation\",\n\t\t\tsource: \"block\",\n\t\t\ttitle: document_title ?? void 0,\n\t\t\tstartIndex: start_block_index,\n\t\t\tendIndex: end_block_index,\n\t\t\tcitedText: cited_text\n\t\t};\n\t}\n\tif (citation.type === \"web_search_result_location\" && _isString(citation.url) && _isString(citation.title) && _isString(citation.encrypted_index) && _isString(citation.cited_text)) {\n\t\tconst { url, title, encrypted_index, cited_text,...rest } = citation;\n\t\treturn {\n\t\t\t...rest,\n\t\t\ttype: \"citation\",\n\t\t\tsource: \"url\",\n\t\t\turl,\n\t\t\ttitle,\n\t\t\tstartIndex: Number(encrypted_index),\n\t\t\tendIndex: Number(encrypted_index),\n\t\t\tcitedText: cited_text\n\t\t};\n\t}\n\tif (citation.type === \"search_result_location\" && _isString(citation.source) && _isString(citation.title) && _isNumber(citation.start_block_index) && _isNumber(citation.end_block_index) && _isString(citation.cited_text)) {\n\t\tconst { source, title, start_block_index, end_block_index, cited_text,...rest } = citation;\n\t\treturn {\n\t\t\t...rest,\n\t\t\ttype: \"citation\",\n\t\t\tsource: \"search\",\n\t\t\turl: source,\n\t\t\ttitle: title ?? void 0,\n\t\t\tstartIndex: start_block_index,\n\t\t\tendIndex: end_block_index,\n\t\t\tcitedText: cited_text\n\t\t};\n\t}\n\treturn void 0;\n}\n/**\n* Converts an Anthropic content block to a standard V1 content block.\n*\n* This function handles the conversion of Anthropic-specific content blocks\n* (document and image blocks) to the standardized V1 format. It supports\n* various source types including base64 data, URLs, file IDs, and text data.\n*\n* @param block - The Anthropic content block to convert\n* @returns A standard V1 content block if conversion is successful, undefined otherwise\n*\n* @example\n* ```typescript\n* const anthropicBlock = {\n* type: \"image\",\n* source: {\n* type: \"base64\",\n* media_type: \"image/png\",\n* data: \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==\"\n* }\n* };\n*\n* const standardBlock = convertToV1FromAnthropicContentBlock(anthropicBlock);\n* // Returns: { type: \"image\", mimeType: \"image/png\", data: \"...\" }\n* ```\n*/\nfunction convertToV1FromAnthropicContentBlock(block) {\n\tif (_isContentBlock(block, \"document\") && _isObject(block.source) && \"type\" in block.source) {\n\t\tif (block.source.type === \"base64\" && _isString(block.source.media_type) && _isString(block.source.data)) return {\n\t\t\ttype: \"file\",\n\t\t\tmimeType: block.source.media_type,\n\t\t\tdata: block.source.data\n\t\t};\n\t\telse if (block.source.type === \"url\" && _isString(block.source.url)) return {\n\t\t\ttype: \"file\",\n\t\t\turl: block.source.url\n\t\t};\n\t\telse if (block.source.type === \"file\" && _isString(block.source.file_id)) return {\n\t\t\ttype: \"file\",\n\t\t\tfileId: block.source.file_id\n\t\t};\n\t\telse if (block.source.type === \"text\" && _isString(block.source.data)) return {\n\t\t\ttype: \"file\",\n\t\t\tmimeType: String(block.source.media_type ?? \"text/plain\"),\n\t\t\tdata: block.source.data\n\t\t};\n\t} else if (_isContentBlock(block, \"image\") && _isObject(block.source) && \"type\" in block.source) {\n\t\tif (block.source.type === \"base64\" && _isString(block.source.media_type) && _isString(block.source.data)) return {\n\t\t\ttype: \"image\",\n\t\t\tmimeType: block.source.media_type,\n\t\t\tdata: block.source.data\n\t\t};\n\t\telse if (block.source.type === \"url\" && _isString(block.source.url)) return {\n\t\t\ttype: \"image\",\n\t\t\turl: block.source.url\n\t\t};\n\t\telse if (block.source.type === \"file\" && _isString(block.source.file_id)) return {\n\t\t\ttype: \"image\",\n\t\t\tfileId: block.source.file_id\n\t\t};\n\t}\n\treturn void 0;\n}\n/**\n* Converts an array of content blocks from Anthropic format to v1 standard format.\n*\n* This function processes each content block in the input array, attempting to convert\n* Anthropic-specific block formats (like image blocks with source objects, document blocks, etc.)\n* to the standardized v1 content block format. If a block cannot be converted, it is\n* passed through as-is with a type assertion to ContentBlock.Standard.\n*\n* @param content - Array of content blocks in Anthropic format to be converted\n* @returns Array of content blocks in v1 standard format\n*/\nfunction convertToV1FromAnthropicInput(content) {\n\tfunction* iterateContent() {\n\t\tfor (const block of content) {\n\t\t\tconst stdBlock = convertToV1FromAnthropicContentBlock(block);\n\t\t\tif (stdBlock) yield stdBlock;\n\t\t\telse yield block;\n\t\t}\n\t}\n\treturn Array.from(iterateContent());\n}\n/**\n* Converts an Anthropic AI message to an array of v1 standard content blocks.\n*\n* This function processes an AI message containing Anthropic-specific content blocks\n* and converts them to the standardized v1 content block format.\n*\n* @param message - The AI message containing Anthropic-formatted content blocks\n* @returns Array of content blocks in v1 standard format\n*\n* @example\n* ```typescript\n* const message = new AIMessage([\n* { type: \"text\", text: \"Hello world\" },\n* { type: \"thinking\", text: \"Let me think about this...\" },\n* { type: \"tool_use\", id: \"123\", name: \"calculator\", input: { a: 1, b: 2 } }\n* ]);\n*\n* const standardBlocks = convertToV1FromAnthropicMessage(message);\n* // Returns:\n* // [\n* // { type: \"text\", text: \"Hello world\" },\n* // { type: \"reasoning\", reasoning: \"Let me think about this...\" },\n* // { type: \"tool_call\", id: \"123\", name: \"calculator\", args: { a: 1, b: 2 } }\n* // ]\n* ```\n*/\nfunction convertToV1FromAnthropicMessage(message) {\n\tfunction* iterateContent() {\n\t\tconst content = typeof message.content === \"string\" ? [{\n\t\t\ttype: \"text\",\n\t\t\ttext: message.content\n\t\t}] : message.content;\n\t\tfor (const block of content) {\n\t\t\tif (_isContentBlock(block, \"text\") && _isString(block.text)) {\n\t\t\t\tconst { text, citations,...rest } = block;\n\t\t\t\tif (_isArray(citations) && citations.length) {\n\t\t\t\t\tconst _citations = citations.reduce((acc, item) => {\n\t\t\t\t\t\tconst citation = convertAnthropicAnnotation(item);\n\t\t\t\t\t\tif (citation) return [...acc, citation];\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, []);\n\t\t\t\t\tyield {\n\t\t\t\t\t\t...rest,\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext,\n\t\t\t\t\t\tannotations: _citations\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t} else {\n\t\t\t\t\tyield {\n\t\t\t\t\t\t...rest,\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else if (_isContentBlock(block, \"thinking\") && _isString(block.thinking)) {\n\t\t\t\tconst { thinking, signature,...rest } = block;\n\t\t\t\tyield {\n\t\t\t\t\t...rest,\n\t\t\t\t\ttype: \"reasoning\",\n\t\t\t\t\treasoning: thinking,\n\t\t\t\t\tsignature\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"redacted_thinking\")) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"non_standard\",\n\t\t\t\t\tvalue: block\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"tool_use\") && _isString(block.name) && _isString(block.id)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"tool_call\",\n\t\t\t\t\tid: block.id,\n\t\t\t\t\tname: block.name,\n\t\t\t\t\targs: block.input\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"input_json_delta\")) {\n\t\t\t\tif (_isAIMessageChunk(message) && message.tool_call_chunks?.length) {\n\t\t\t\t\tconst tool_call_chunk = message.tool_call_chunks[0];\n\t\t\t\t\tyield {\n\t\t\t\t\t\ttype: \"tool_call_chunk\",\n\t\t\t\t\t\tid: tool_call_chunk.id,\n\t\t\t\t\t\tname: tool_call_chunk.name,\n\t\t\t\t\t\targs: tool_call_chunk.args,\n\t\t\t\t\t\tindex: tool_call_chunk.index\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else if (_isContentBlock(block, \"server_tool_use\") && _isString(block.name) && _isString(block.id)) {\n\t\t\t\tconst { name, id } = block;\n\t\t\t\tif (name === \"web_search\") {\n\t\t\t\t\tconst query = iife(() => {\n\t\t\t\t\t\tif (typeof block.input === \"string\") return block.input;\n\t\t\t\t\t\telse if (_isObject(block.input) && _isString(block.input.query)) return block.input.query;\n\t\t\t\t\t\telse if (_isString(block.partial_json)) {\n\t\t\t\t\t\t\tconst json = safeParseJson(block.partial_json);\n\t\t\t\t\t\t\tif (json?.query) return json.query;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn \"\";\n\t\t\t\t\t});\n\t\t\t\t\tyield {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\ttype: \"server_tool_call\",\n\t\t\t\t\t\tname: \"web_search\",\n\t\t\t\t\t\targs: { query }\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (block.name === \"code_execution\") {\n\t\t\t\t\tconst code = iife(() => {\n\t\t\t\t\t\tif (typeof block.input === \"string\") return block.input;\n\t\t\t\t\t\telse if (_isObject(block.input) && _isString(block.input.code)) return block.input.code;\n\t\t\t\t\t\telse if (_isString(block.partial_json)) {\n\t\t\t\t\t\t\tconst json = safeParseJson(block.partial_json);\n\t\t\t\t\t\t\tif (json?.code) return json.code;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn \"\";\n\t\t\t\t\t});\n\t\t\t\t\tyield {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\ttype: \"server_tool_call\",\n\t\t\t\t\t\tname: \"code_execution\",\n\t\t\t\t\t\targs: { code }\n\t\t\t\t\t};\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else if (_isContentBlock(block, \"web_search_tool_result\") && _isString(block.tool_use_id) && _isArray(block.content)) {\n\t\t\t\tconst { content: content$1, tool_use_id } = block;\n\t\t\t\tconst urls = content$1.reduce((acc, content$2) => {\n\t\t\t\t\tif (_isContentBlock(content$2, \"web_search_result\")) return [...acc, content$2.url];\n\t\t\t\t\treturn acc;\n\t\t\t\t}, []);\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"server_tool_call_result\",\n\t\t\t\t\tname: \"web_search\",\n\t\t\t\t\ttoolCallId: tool_use_id,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\toutput: { urls }\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"code_execution_tool_result\") && _isString(block.tool_use_id) && _isObject(block.content)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"server_tool_call_result\",\n\t\t\t\t\tname: \"code_execution\",\n\t\t\t\t\ttoolCallId: block.tool_use_id,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\toutput: block.content\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"mcp_tool_use\")) {\n\t\t\t\tyield {\n\t\t\t\t\tid: block.id,\n\t\t\t\t\ttype: \"server_tool_call\",\n\t\t\t\t\tname: \"mcp_tool_use\",\n\t\t\t\t\targs: block.input\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"mcp_tool_result\") && _isString(block.tool_use_id) && _isObject(block.content)) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"server_tool_call_result\",\n\t\t\t\t\tname: \"mcp_tool_use\",\n\t\t\t\t\ttoolCallId: block.tool_use_id,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\toutput: block.content\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"container_upload\")) {\n\t\t\t\tyield {\n\t\t\t\t\ttype: \"server_tool_call\",\n\t\t\t\t\tname: \"container_upload\",\n\t\t\t\t\targs: block.input\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"search_result\")) {\n\t\t\t\tyield {\n\t\t\t\t\tid: block.id,\n\t\t\t\t\ttype: \"non_standard\",\n\t\t\t\t\tvalue: block\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else if (_isContentBlock(block, \"tool_result\")) {\n\t\t\t\tyield {\n\t\t\t\t\tid: block.id,\n\t\t\t\t\ttype: \"non_standard\",\n\t\t\t\t\tvalue: block\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tconst stdBlock = convertToV1FromAnthropicContentBlock(block);\n\t\t\t\tif (stdBlock) {\n\t\t\t\t\tyield stdBlock;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield {\n\t\t\t\ttype: \"non_standard\",\n\t\t\t\tvalue: block\n\t\t\t};\n\t\t}\n\t}\n\treturn Array.from(iterateContent());\n}\nconst ChatAnthropicTranslator = {\n\ttranslateContent: convertToV1FromAnthropicMessage,\n\ttranslateContentChunk: convertToV1FromAnthropicMessage\n};\nfunction _isAIMessageChunk(message) {\n\treturn typeof message?._getType === \"function\" && typeof message.concat === \"function\" && message._getType() === \"ai\";\n}\n\n//#endregion\nexport { ChatAnthropicTranslator, convertToV1FromAnthropicInput };\n//# sourceMappingURL=anthropic.js.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