@anvia/core 0.12.1 → 0.12.2
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/agent/index.js +7 -7
- package/dist/{chunk-CO7YK4JZ.js → chunk-4NCRFQHS.js} +5 -5
- package/dist/{chunk-HF4KHHNM.js → chunk-J3ROUB3P.js} +2 -2
- package/dist/{chunk-JNO4AR7Q.js → chunk-LKLKEECY.js} +93 -5
- package/dist/chunk-LKLKEECY.js.map +1 -0
- package/dist/{chunk-IZM6FNCT.js → chunk-QKA6OQTH.js} +4 -4
- package/dist/{chunk-L62HQ5Y4.js → chunk-QNVLGAPV.js} +4 -4
- package/dist/{chunk-J4XZCE4A.js → chunk-TUDZBJGF.js} +4 -4
- package/dist/{chunk-MX6ATKGT.js → chunk-XUO3KR5T.js} +3 -3
- package/dist/{chunk-GISFLLNL.js → chunk-YVQBC3SJ.js} +5 -5
- package/dist/evals/index.js +9 -9
- package/dist/extractor/index.js +8 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/internal/agent.js +6 -6
- package/dist/request/index.js +5 -5
- package/dist/skills/index.js +5 -5
- package/dist/tool/index.js +4 -4
- package/dist/ui/index.d.ts +20 -2
- package/dist/ui/index.js +1 -1
- package/dist/vector-store/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-JNO4AR7Q.js.map +0 -1
- /package/dist/{chunk-CO7YK4JZ.js.map → chunk-4NCRFQHS.js.map} +0 -0
- /package/dist/{chunk-HF4KHHNM.js.map → chunk-J3ROUB3P.js.map} +0 -0
- /package/dist/{chunk-IZM6FNCT.js.map → chunk-QKA6OQTH.js.map} +0 -0
- /package/dist/{chunk-L62HQ5Y4.js.map → chunk-QNVLGAPV.js.map} +0 -0
- /package/dist/{chunk-J4XZCE4A.js.map → chunk-TUDZBJGF.js.map} +0 -0
- /package/dist/{chunk-MX6ATKGT.js.map → chunk-XUO3KR5T.js.map} +0 -0
- /package/dist/{chunk-GISFLLNL.js.map → chunk-YVQBC3SJ.js.map} +0 -0
package/dist/agent/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentBuilder
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-XUO3KR5T.js";
|
|
4
|
+
import "../chunk-TUDZBJGF.js";
|
|
5
|
+
import "../chunk-4NCRFQHS.js";
|
|
6
6
|
import "../chunk-YK4WAAS4.js";
|
|
7
7
|
import "../chunk-XUUY2L2D.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-YVQBC3SJ.js";
|
|
9
|
+
import "../chunk-QKA6OQTH.js";
|
|
10
10
|
import "../chunk-NPZDYOE6.js";
|
|
11
11
|
import "../chunk-MMHG7WAM.js";
|
|
12
12
|
import "../chunk-M6RPFHG7.js";
|
|
13
|
-
import "../chunk-JS5MGVNM.js";
|
|
14
|
-
import "../chunk-OIMLU4SF.js";
|
|
15
13
|
import "../chunk-SRBW3LD7.js";
|
|
16
14
|
import "../chunk-5LFGEMIW.js";
|
|
17
15
|
import "../chunk-WQKHFADH.js";
|
|
16
|
+
import "../chunk-JS5MGVNM.js";
|
|
17
|
+
import "../chunk-OIMLU4SF.js";
|
|
18
18
|
import "../chunk-CWUJUSOS.js";
|
|
19
19
|
export {
|
|
20
20
|
AgentBuilder
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
parseToolArgs,
|
|
6
6
|
toolResultContentToText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YVQBC3SJ.js";
|
|
8
8
|
import {
|
|
9
9
|
runControl,
|
|
10
10
|
toolCallControl
|
|
@@ -12,9 +12,6 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
compact
|
|
14
14
|
} from "./chunk-MMHG7WAM.js";
|
|
15
|
-
import {
|
|
16
|
-
mapWithConcurrency
|
|
17
|
-
} from "./chunk-OIMLU4SF.js";
|
|
18
15
|
import {
|
|
19
16
|
CompletionRequestBuilder,
|
|
20
17
|
isStreamingCompletionModel
|
|
@@ -27,6 +24,9 @@ import {
|
|
|
27
24
|
assertCompletionRequestSupported,
|
|
28
25
|
textFromAssistantContent
|
|
29
26
|
} from "./chunk-5LFGEMIW.js";
|
|
27
|
+
import {
|
|
28
|
+
mapWithConcurrency
|
|
29
|
+
} from "./chunk-OIMLU4SF.js";
|
|
30
30
|
import {
|
|
31
31
|
appendGuardrailPolicies,
|
|
32
32
|
hasEnforcedOutputGuardrails,
|
|
@@ -2014,4 +2014,4 @@ export {
|
|
|
2014
2014
|
extractRagText,
|
|
2015
2015
|
PromptRequest
|
|
2016
2016
|
};
|
|
2017
|
-
//# sourceMappingURL=chunk-
|
|
2017
|
+
//# sourceMappingURL=chunk-4NCRFQHS.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YK4WAAS4.js";
|
|
4
4
|
import {
|
|
5
5
|
createTool
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QKA6OQTH.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-MMHG7WAM.js";
|
|
@@ -395,4 +395,4 @@ export {
|
|
|
395
395
|
SkillValidationError,
|
|
396
396
|
skill
|
|
397
397
|
};
|
|
398
|
-
//# sourceMappingURL=chunk-
|
|
398
|
+
//# sourceMappingURL=chunk-J3ROUB3P.js.map
|
|
@@ -25,12 +25,16 @@ function uiMessagesToCoreMessages(messages) {
|
|
|
25
25
|
content.push(UserContent.text(part.text));
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
+
if (part.type === "attachment") {
|
|
29
|
+
content.push(attachmentToUserContent(part.attachment));
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
28
32
|
if (part.type === "data" && isUserContent(part.data)) {
|
|
29
33
|
content.push(part.data);
|
|
30
34
|
continue;
|
|
31
35
|
}
|
|
32
36
|
throw new TypeError(
|
|
33
|
-
"User UI messages can only be converted from text
|
|
37
|
+
"User UI messages can only be converted from text, attachment, or image/document data parts."
|
|
34
38
|
);
|
|
35
39
|
}
|
|
36
40
|
if (content.length > 0) {
|
|
@@ -116,9 +120,8 @@ function coreMessagesToUIMessages(messages) {
|
|
|
116
120
|
} else {
|
|
117
121
|
parts2.push({
|
|
118
122
|
id: createId("part"),
|
|
119
|
-
type: "
|
|
120
|
-
|
|
121
|
-
data: content
|
|
123
|
+
type: "attachment",
|
|
124
|
+
attachment: userContentToAttachment(content)
|
|
122
125
|
});
|
|
123
126
|
}
|
|
124
127
|
}
|
|
@@ -194,6 +197,91 @@ function textFromUIParts(parts) {
|
|
|
194
197
|
function outputToToolResultContent(output) {
|
|
195
198
|
return [{ type: "text", text: serializeToolResultOutput(output ?? null) }];
|
|
196
199
|
}
|
|
200
|
+
function attachmentToUserContent(attachment) {
|
|
201
|
+
if (attachment.type === "image" || isImageFileAttachment(attachment)) {
|
|
202
|
+
if (attachment.url !== void 0) {
|
|
203
|
+
return UserContent.imageUrl(attachment.url, imageOptions(attachment));
|
|
204
|
+
}
|
|
205
|
+
if (attachment.data !== void 0 && attachment.mediaType !== void 0) {
|
|
206
|
+
return UserContent.imageBase64(
|
|
207
|
+
attachment.data,
|
|
208
|
+
attachment.mediaType,
|
|
209
|
+
imageOptions(attachment)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
throw new TypeError("Image attachments require a url or base64 data with mediaType.");
|
|
213
|
+
}
|
|
214
|
+
if (attachment.text !== void 0) {
|
|
215
|
+
return {
|
|
216
|
+
type: "document",
|
|
217
|
+
source: {
|
|
218
|
+
type: "text",
|
|
219
|
+
text: attachment.text,
|
|
220
|
+
...attachment.mediaType === void 0 ? {} : { mediaType: attachment.mediaType },
|
|
221
|
+
...attachment.name === void 0 ? {} : { filename: attachment.name }
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const mediaType = attachment.mediaType ?? "application/octet-stream";
|
|
226
|
+
if (attachment.url !== void 0) {
|
|
227
|
+
return UserContent.documentUrl(attachment.url, mediaType, documentOptions(attachment));
|
|
228
|
+
}
|
|
229
|
+
if (attachment.data !== void 0) {
|
|
230
|
+
return UserContent.documentBase64(attachment.data, mediaType, documentOptions(attachment));
|
|
231
|
+
}
|
|
232
|
+
throw new TypeError("Document attachments require a url, base64 data, or text.");
|
|
233
|
+
}
|
|
234
|
+
function userContentToAttachment(content) {
|
|
235
|
+
if (content.type === "image") {
|
|
236
|
+
const attachment2 = {
|
|
237
|
+
id: createId("attachment"),
|
|
238
|
+
type: "image",
|
|
239
|
+
...content.detail === void 0 ? {} : { detail: content.detail }
|
|
240
|
+
};
|
|
241
|
+
if (content.source.type === "url") {
|
|
242
|
+
attachment2.url = content.source.url;
|
|
243
|
+
} else {
|
|
244
|
+
attachment2.data = content.source.data;
|
|
245
|
+
attachment2.mediaType = content.source.mediaType;
|
|
246
|
+
}
|
|
247
|
+
return attachment2;
|
|
248
|
+
}
|
|
249
|
+
const attachment = {
|
|
250
|
+
id: createId("attachment"),
|
|
251
|
+
type: "document"
|
|
252
|
+
};
|
|
253
|
+
if (content.source.type === "url") {
|
|
254
|
+
attachment.url = content.source.url;
|
|
255
|
+
attachment.mediaType = content.source.mediaType;
|
|
256
|
+
if (content.source.filename !== void 0) {
|
|
257
|
+
attachment.name = content.source.filename;
|
|
258
|
+
}
|
|
259
|
+
} else if (content.source.type === "base64") {
|
|
260
|
+
attachment.data = content.source.data;
|
|
261
|
+
attachment.mediaType = content.source.mediaType;
|
|
262
|
+
if (content.source.filename !== void 0) {
|
|
263
|
+
attachment.name = content.source.filename;
|
|
264
|
+
}
|
|
265
|
+
} else {
|
|
266
|
+
attachment.text = content.source.text;
|
|
267
|
+
if (content.source.mediaType !== void 0) {
|
|
268
|
+
attachment.mediaType = content.source.mediaType;
|
|
269
|
+
}
|
|
270
|
+
if (content.source.filename !== void 0) {
|
|
271
|
+
attachment.name = content.source.filename;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return attachment;
|
|
275
|
+
}
|
|
276
|
+
function isImageFileAttachment(attachment) {
|
|
277
|
+
return attachment.type === "file" && attachment.mediaType?.startsWith("image/") === true;
|
|
278
|
+
}
|
|
279
|
+
function imageOptions(attachment) {
|
|
280
|
+
return attachment.detail === void 0 ? {} : { detail: attachment.detail };
|
|
281
|
+
}
|
|
282
|
+
function documentOptions(attachment) {
|
|
283
|
+
return attachment.name === void 0 ? {} : { filename: attachment.name };
|
|
284
|
+
}
|
|
197
285
|
function toolResultContentToJson(content) {
|
|
198
286
|
if (content.length === 1 && content[0]?.type === "text") {
|
|
199
287
|
return content[0].text;
|
|
@@ -262,4 +350,4 @@ export {
|
|
|
262
350
|
uiMessagesToCoreMessages,
|
|
263
351
|
coreMessagesToUIMessages
|
|
264
352
|
};
|
|
265
|
-
//# sourceMappingURL=chunk-
|
|
353
|
+
//# sourceMappingURL=chunk-LKLKEECY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/messages.ts"],"sourcesContent":["import {\n AssistantContent,\n type AssistantContent as AssistantContentType,\n type Message as CoreMessage,\n type DocumentContent,\n type ImageContent,\n type ImageDetail,\n type JsonValue,\n Message,\n reasoningDisplayText,\n serializeToolResultOutput,\n ToolContent,\n type ToolContent as ToolContentType,\n type ToolResultContent,\n UserContent,\n type UserContent as UserContentType,\n} from \"../completion/types\";\nimport type { UIAttachment, UIMessage, UIMessagePart } from \"./types\";\n\nexport function uiMessagesToCoreMessages(messages: UIMessage[]): CoreMessage[] {\n const coreMessages: CoreMessage[] = [];\n\n for (const message of messages) {\n const text = textFromUIParts(message.parts);\n\n if (message.role === \"system\") {\n if (text.length > 0) {\n coreMessages.push(Message.system(text));\n }\n continue;\n }\n\n if (message.role === \"user\") {\n const content: UserContentType[] = [];\n for (const part of message.parts) {\n if (part.type === \"text\") {\n content.push(UserContent.text(part.text));\n continue;\n }\n if (part.type === \"attachment\") {\n content.push(attachmentToUserContent(part.attachment));\n continue;\n }\n if (part.type === \"data\" && isUserContent(part.data)) {\n content.push(part.data);\n continue;\n }\n throw new TypeError(\n \"User UI messages can only be converted from text, attachment, or image/document data parts.\",\n );\n }\n if (content.length > 0) {\n coreMessages.push(Message.user(content));\n }\n continue;\n }\n\n if (message.role === \"assistant\") {\n const content: AssistantContentType[] = [];\n const toolResults: ToolContentType[] = [];\n for (const part of message.parts) {\n if (part.type === \"text\" && part.text.length > 0) {\n content.push(AssistantContent.text(part.text));\n continue;\n }\n if (part.type === \"reasoning\" && part.text.length > 0) {\n content.push(AssistantContent.reasoning(part.text, part.reasoningId));\n continue;\n }\n if (\n part.type === \"tool\" &&\n (part.state === \"input-streaming\" ||\n part.state === \"input-available\" ||\n part.state === \"output-available\")\n ) {\n content.push(\n AssistantContent.toolCall(\n part.toolCallId,\n part.toolName,\n part.input ?? {},\n part.callId,\n ),\n );\n if (part.state === \"output-available\") {\n toolResults.push(\n ToolContent.toolResult(\n part.toolCallId,\n outputToToolResultContent(part.output),\n part.callId,\n ),\n );\n }\n }\n }\n if (content.length > 0) {\n coreMessages.push(Message.assistant(content, message.id));\n }\n if (toolResults.length > 0) {\n coreMessages.push(Message.tool(toolResults));\n }\n continue;\n }\n\n const toolResults: ToolContentType[] = [];\n for (const part of message.parts) {\n if (part.type !== \"tool\" || part.state !== \"output-available\") {\n continue;\n }\n toolResults.push(\n ToolContent.toolResult(\n part.toolCallId,\n outputToToolResultContent(part.output),\n part.callId,\n ),\n );\n }\n if (toolResults.length > 0) {\n coreMessages.push(Message.tool(toolResults));\n }\n }\n\n return coreMessages;\n}\n\nexport function coreMessagesToUIMessages(messages: CoreMessage[]): UIMessage[] {\n const uiMessages: UIMessage[] = [];\n\n for (const message of messages) {\n if (message.role === \"system\") {\n uiMessages.push({\n id: createId(\"msg\"),\n role: \"system\",\n parts: [{ id: createId(\"part\"), type: \"text\", text: message.content }],\n });\n continue;\n }\n\n if (message.role === \"user\") {\n const parts: UIMessagePart[] = [];\n for (const content of message.content) {\n if (content.type === \"text\") {\n parts.push({ id: createId(\"part\"), type: \"text\", text: content.text });\n } else {\n parts.push({\n id: createId(\"part\"),\n type: \"attachment\",\n attachment: userContentToAttachment(content),\n });\n }\n }\n uiMessages.push({ id: createId(\"msg\"), role: \"user\", parts });\n continue;\n }\n\n if (message.role === \"assistant\") {\n const parts: UIMessagePart[] = [];\n for (const content of message.content) {\n if (content.type === \"text\") {\n parts.push({ id: createId(\"part\"), type: \"text\", text: content.text });\n continue;\n }\n if (content.type === \"reasoning\") {\n const part: UIMessagePart = {\n id: createId(\"part\"),\n type: \"reasoning\",\n text: reasoningDisplayText(content),\n };\n if (content.id !== undefined) {\n part.reasoningId = content.id;\n }\n parts.push(part);\n continue;\n }\n if (content.type === \"tool_call\") {\n const part: UIMessagePart = {\n id: toolPartId(content.id),\n type: \"tool\",\n toolName: content.function.name,\n toolCallId: content.id,\n state: \"input-available\",\n input: content.function.arguments,\n };\n if (content.callId !== undefined) {\n part.callId = content.callId;\n }\n parts.push(part);\n continue;\n }\n parts.push({\n id: createId(\"part\"),\n type: \"data\",\n name: content.type,\n data: content as JsonValue,\n });\n }\n uiMessages.push({ id: message.id ?? createId(\"msg\"), role: \"assistant\", parts });\n continue;\n }\n\n const parts: UIMessagePart[] = [];\n for (const content of message.content) {\n const part: UIMessagePart = {\n id: toolPartId(content.id),\n type: \"tool\",\n toolName: \"tool\",\n toolCallId: content.id,\n state: \"output-available\",\n output: toolResultContentToJson(content.content),\n };\n if (content.callId !== undefined) {\n part.callId = content.callId;\n }\n parts.push(part);\n }\n uiMessages.push({ id: createId(\"msg\"), role: \"tool\", parts });\n }\n\n return uiMessages;\n}\n\nexport function isUIMessage(value: unknown): value is UIMessage {\n return (\n isRecord(value) &&\n typeof value.id === \"string\" &&\n isUIMessageRole(value.role) &&\n Array.isArray(value.parts)\n );\n}\n\nexport function isUIMessageArray(value: unknown): value is UIMessage[] {\n return Array.isArray(value) && value.every(isUIMessage);\n}\n\nfunction textFromUIParts(parts: UIMessagePart[]): string {\n return parts.flatMap((part) => (part.type === \"text\" ? [part.text] : [])).join(\"\");\n}\n\nfunction outputToToolResultContent(output: JsonValue | undefined): ToolResultContent[] {\n return [{ type: \"text\", text: serializeToolResultOutput(output ?? null) }];\n}\n\nfunction attachmentToUserContent(attachment: UIAttachment): UserContentType {\n if (attachment.type === \"image\" || isImageFileAttachment(attachment)) {\n if (attachment.url !== undefined) {\n return UserContent.imageUrl(attachment.url, imageOptions(attachment));\n }\n if (attachment.data !== undefined && attachment.mediaType !== undefined) {\n return UserContent.imageBase64(\n attachment.data,\n attachment.mediaType,\n imageOptions(attachment),\n );\n }\n throw new TypeError(\"Image attachments require a url or base64 data with mediaType.\");\n }\n\n if (attachment.text !== undefined) {\n return {\n type: \"document\",\n source: {\n type: \"text\",\n text: attachment.text,\n ...(attachment.mediaType === undefined ? {} : { mediaType: attachment.mediaType }),\n ...(attachment.name === undefined ? {} : { filename: attachment.name }),\n },\n };\n }\n\n const mediaType = attachment.mediaType ?? \"application/octet-stream\";\n if (attachment.url !== undefined) {\n return UserContent.documentUrl(attachment.url, mediaType, documentOptions(attachment));\n }\n if (attachment.data !== undefined) {\n return UserContent.documentBase64(attachment.data, mediaType, documentOptions(attachment));\n }\n\n throw new TypeError(\"Document attachments require a url, base64 data, or text.\");\n}\n\nfunction userContentToAttachment(content: ImageContent | DocumentContent): UIAttachment {\n if (content.type === \"image\") {\n const attachment: UIAttachment = {\n id: createId(\"attachment\"),\n type: \"image\",\n ...(content.detail === undefined ? {} : { detail: content.detail }),\n };\n if (content.source.type === \"url\") {\n attachment.url = content.source.url;\n } else {\n attachment.data = content.source.data;\n attachment.mediaType = content.source.mediaType;\n }\n return attachment;\n }\n\n const attachment: UIAttachment = {\n id: createId(\"attachment\"),\n type: \"document\",\n };\n if (content.source.type === \"url\") {\n attachment.url = content.source.url;\n attachment.mediaType = content.source.mediaType;\n if (content.source.filename !== undefined) {\n attachment.name = content.source.filename;\n }\n } else if (content.source.type === \"base64\") {\n attachment.data = content.source.data;\n attachment.mediaType = content.source.mediaType;\n if (content.source.filename !== undefined) {\n attachment.name = content.source.filename;\n }\n } else {\n attachment.text = content.source.text;\n if (content.source.mediaType !== undefined) {\n attachment.mediaType = content.source.mediaType;\n }\n if (content.source.filename !== undefined) {\n attachment.name = content.source.filename;\n }\n }\n return attachment;\n}\n\nfunction isImageFileAttachment(attachment: UIAttachment): boolean {\n return attachment.type === \"file\" && attachment.mediaType?.startsWith(\"image/\") === true;\n}\n\nfunction imageOptions(attachment: UIAttachment): { detail?: ImageDetail } {\n return attachment.detail === undefined ? {} : { detail: attachment.detail };\n}\n\nfunction documentOptions(attachment: UIAttachment): { filename?: string } {\n return attachment.name === undefined ? {} : { filename: attachment.name };\n}\n\nfunction toolResultContentToJson(content: ToolResultContent[]): JsonValue {\n if (content.length === 1 && content[0]?.type === \"text\") {\n return content[0].text;\n }\n return content as JsonValue;\n}\n\nfunction isUserContent(value: unknown): value is UserContentType {\n if (!isRecord(value)) {\n return false;\n }\n\n if (value.type === \"text\") {\n return typeof value.text === \"string\";\n }\n\n if (value.type === \"image\") {\n return isImageContent(value);\n }\n\n if (value.type === \"document\") {\n return isDocumentContent(value);\n }\n\n return false;\n}\n\nfunction isImageContent(value: Record<string, unknown>): boolean {\n if (!isRecord(value.source)) {\n return false;\n }\n\n if (value.source.type === \"url\") {\n return typeof value.source.url === \"string\";\n }\n\n if (value.source.type === \"base64\") {\n return typeof value.source.data === \"string\" && typeof value.source.mediaType === \"string\";\n }\n\n return false;\n}\n\nfunction isDocumentContent(value: Record<string, unknown>): boolean {\n if (!isRecord(value.source)) {\n return false;\n }\n\n if (value.source.type === \"url\") {\n return typeof value.source.url === \"string\" && typeof value.source.mediaType === \"string\";\n }\n\n if (value.source.type === \"base64\") {\n return typeof value.source.data === \"string\" && typeof value.source.mediaType === \"string\";\n }\n\n if (value.source.type === \"text\") {\n return (\n typeof value.source.text === \"string\" &&\n (value.source.mediaType === undefined || typeof value.source.mediaType === \"string\")\n );\n }\n\n return false;\n}\n\nfunction toolPartId(toolCallId: string): string {\n return `tool_${toolCallId}`;\n}\n\nlet nextId = 0;\n\nfunction createId(prefix: string): string {\n const random = globalThis.crypto?.randomUUID?.();\n if (random !== undefined) {\n return `${prefix}_${random}`;\n }\n nextId += 1;\n return `${prefix}_${nextId.toString(36)}`;\n}\n\nfunction isUIMessageRole(value: unknown): value is UIMessage[\"role\"] {\n return value === \"system\" || value === \"user\" || value === \"assistant\" || value === \"tool\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n"],"mappings":";;;;;;;;;;AAmBO,SAAS,yBAAyB,UAAsC;AAC7E,QAAM,eAA8B,CAAC;AAErC,aAAW,WAAW,UAAU;AAC9B,UAAM,OAAO,gBAAgB,QAAQ,KAAK;AAE1C,QAAI,QAAQ,SAAS,UAAU;AAC7B,UAAI,KAAK,SAAS,GAAG;AACnB,qBAAa,KAAK,QAAQ,OAAO,IAAI,CAAC;AAAA,MACxC;AACA;AAAA,IACF;AAEA,QAAI,QAAQ,SAAS,QAAQ;AAC3B,YAAM,UAA6B,CAAC;AACpC,iBAAW,QAAQ,QAAQ,OAAO;AAChC,YAAI,KAAK,SAAS,QAAQ;AACxB,kBAAQ,KAAK,YAAY,KAAK,KAAK,IAAI,CAAC;AACxC;AAAA,QACF;AACA,YAAI,KAAK,SAAS,cAAc;AAC9B,kBAAQ,KAAK,wBAAwB,KAAK,UAAU,CAAC;AACrD;AAAA,QACF;AACA,YAAI,KAAK,SAAS,UAAU,cAAc,KAAK,IAAI,GAAG;AACpD,kBAAQ,KAAK,KAAK,IAAI;AACtB;AAAA,QACF;AACA,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AACA,UAAI,QAAQ,SAAS,GAAG;AACtB,qBAAa,KAAK,QAAQ,KAAK,OAAO,CAAC;AAAA,M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;AAEA,MAAI,MAAM,OAAO,SAAS,QAAQ;AAChC,WACE,OAAO,MAAM,OAAO,SAAS,aAC5B,MAAM,OAAO,cAAc,UAAa,OAAO,MAAM,OAAO,cAAc;AAAA,EAE/E;AAEA,SAAO;AACT;AAEA,SAAS,WAAW,YAA4B;AAC9C,SAAO,QAAQ,UAAU;AAC3B;AAEA,IAAI,SAAS;AAEb,SAAS,SAAS,QAAwB;AACxC,QAAM,SAAS,WAAW,QAAQ,aAAa;AAC/C,MAAI,WAAW,QAAW;AACxB,WAAO,GAAG,MAAM,IAAI,MAAM;AAAA,EAC5B;AACA,YAAU;AACV,SAAO,GAAG,MAAM,IAAI,OAAO,SAAS,EAAE,CAAC;AACzC;AAMA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;","names":["toolResults","parts","attachment"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compact
|
|
3
3
|
} from "./chunk-MMHG7WAM.js";
|
|
4
|
+
import {
|
|
5
|
+
toProviderJsonSchema
|
|
6
|
+
} from "./chunk-WQKHFADH.js";
|
|
4
7
|
import {
|
|
5
8
|
cosineSimilarity,
|
|
6
9
|
embedText
|
|
7
10
|
} from "./chunk-JS5MGVNM.js";
|
|
8
|
-
import {
|
|
9
|
-
toProviderJsonSchema
|
|
10
|
-
} from "./chunk-WQKHFADH.js";
|
|
11
11
|
|
|
12
12
|
// src/vector-store/index.ts
|
|
13
13
|
import { z } from "zod";
|
|
@@ -328,4 +328,4 @@ export {
|
|
|
328
328
|
InMemoryVectorIndex,
|
|
329
329
|
createVectorSearchTool
|
|
330
330
|
};
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
331
|
+
//# sourceMappingURL=chunk-QKA6OQTH.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentBuilder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XUO3KR5T.js";
|
|
4
4
|
import {
|
|
5
5
|
extractRagText
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4NCRFQHS.js";
|
|
7
7
|
import {
|
|
8
8
|
createTool
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QKA6OQTH.js";
|
|
10
10
|
import {
|
|
11
11
|
CompletionRequestBuilder
|
|
12
12
|
} from "./chunk-SRBW3LD7.js";
|
|
@@ -138,4 +138,4 @@ export {
|
|
|
138
138
|
Extractor,
|
|
139
139
|
ExtractorBuilder
|
|
140
140
|
};
|
|
141
|
-
//# sourceMappingURL=chunk-
|
|
141
|
+
//# sourceMappingURL=chunk-QNVLGAPV.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromptRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4NCRFQHS.js";
|
|
4
4
|
import {
|
|
5
5
|
isSkillTool
|
|
6
6
|
} from "./chunk-YK4WAAS4.js";
|
|
7
7
|
import {
|
|
8
8
|
ToolSet
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YVQBC3SJ.js";
|
|
10
10
|
import {
|
|
11
11
|
createTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QKA6OQTH.js";
|
|
13
13
|
import {
|
|
14
14
|
compact
|
|
15
15
|
} from "./chunk-MMHG7WAM.js";
|
|
@@ -204,4 +204,4 @@ export {
|
|
|
204
204
|
Agent,
|
|
205
205
|
AgentSession
|
|
206
206
|
};
|
|
207
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-TUDZBJGF.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
normalizeAgentId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TUDZBJGF.js";
|
|
5
5
|
import {
|
|
6
6
|
ToolSet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YVQBC3SJ.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveMemoryOptions
|
|
10
10
|
} from "./chunk-M6RPFHG7.js";
|
|
@@ -212,4 +212,4 @@ var AgentBuilder = class {
|
|
|
212
212
|
export {
|
|
213
213
|
AgentBuilder
|
|
214
214
|
};
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
215
|
+
//# sourceMappingURL=chunk-XUO3KR5T.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InMemoryVectorStore,
|
|
3
3
|
createTool
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QKA6OQTH.js";
|
|
5
5
|
import {
|
|
6
6
|
compact
|
|
7
7
|
} from "./chunk-MMHG7WAM.js";
|
|
8
|
-
import {
|
|
9
|
-
embedDocuments
|
|
10
|
-
} from "./chunk-JS5MGVNM.js";
|
|
11
8
|
import {
|
|
12
9
|
isToolResultContentArray,
|
|
13
10
|
serializeToolResultOutput
|
|
14
11
|
} from "./chunk-5LFGEMIW.js";
|
|
12
|
+
import {
|
|
13
|
+
embedDocuments
|
|
14
|
+
} from "./chunk-JS5MGVNM.js";
|
|
15
15
|
|
|
16
16
|
// src/tool/errors.ts
|
|
17
17
|
var ToolCallError = class extends Error {
|
|
@@ -225,4 +225,4 @@ export {
|
|
|
225
225
|
createToolMiddleware,
|
|
226
226
|
createThinkTool
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-YVQBC3SJ.js.map
|
package/dist/evals/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ExtractorBuilder
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-QNVLGAPV.js";
|
|
4
|
+
import "../chunk-XUO3KR5T.js";
|
|
5
|
+
import "../chunk-TUDZBJGF.js";
|
|
6
|
+
import "../chunk-4NCRFQHS.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
8
|
import "../chunk-XUUY2L2D.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-YVQBC3SJ.js";
|
|
10
|
+
import "../chunk-QKA6OQTH.js";
|
|
11
11
|
import "../chunk-NPZDYOE6.js";
|
|
12
12
|
import {
|
|
13
13
|
compact
|
|
14
14
|
} from "../chunk-MMHG7WAM.js";
|
|
15
15
|
import "../chunk-M6RPFHG7.js";
|
|
16
|
+
import "../chunk-SRBW3LD7.js";
|
|
17
|
+
import "../chunk-5LFGEMIW.js";
|
|
18
|
+
import "../chunk-WQKHFADH.js";
|
|
16
19
|
import {
|
|
17
20
|
cosineSimilarity,
|
|
18
21
|
embedText
|
|
@@ -20,9 +23,6 @@ import {
|
|
|
20
23
|
import {
|
|
21
24
|
mapWithConcurrency
|
|
22
25
|
} from "../chunk-OIMLU4SF.js";
|
|
23
|
-
import "../chunk-SRBW3LD7.js";
|
|
24
|
-
import "../chunk-5LFGEMIW.js";
|
|
25
|
-
import "../chunk-WQKHFADH.js";
|
|
26
26
|
import "../chunk-CWUJUSOS.js";
|
|
27
27
|
|
|
28
28
|
// src/evals/agent-target.ts
|
package/dist/extractor/index.js
CHANGED
|
@@ -2,22 +2,22 @@ import {
|
|
|
2
2
|
ExtractionError,
|
|
3
3
|
Extractor,
|
|
4
4
|
ExtractorBuilder
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-QNVLGAPV.js";
|
|
6
|
+
import "../chunk-XUO3KR5T.js";
|
|
7
|
+
import "../chunk-TUDZBJGF.js";
|
|
8
|
+
import "../chunk-4NCRFQHS.js";
|
|
9
9
|
import "../chunk-YK4WAAS4.js";
|
|
10
10
|
import "../chunk-XUUY2L2D.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-YVQBC3SJ.js";
|
|
12
|
+
import "../chunk-QKA6OQTH.js";
|
|
13
13
|
import "../chunk-NPZDYOE6.js";
|
|
14
14
|
import "../chunk-MMHG7WAM.js";
|
|
15
15
|
import "../chunk-M6RPFHG7.js";
|
|
16
|
-
import "../chunk-JS5MGVNM.js";
|
|
17
|
-
import "../chunk-OIMLU4SF.js";
|
|
18
16
|
import "../chunk-SRBW3LD7.js";
|
|
19
17
|
import "../chunk-5LFGEMIW.js";
|
|
20
18
|
import "../chunk-WQKHFADH.js";
|
|
19
|
+
import "../chunk-JS5MGVNM.js";
|
|
20
|
+
import "../chunk-OIMLU4SF.js";
|
|
21
21
|
import "../chunk-CWUJUSOS.js";
|
|
22
22
|
export {
|
|
23
23
|
ExtractionError,
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { S as SkillValidationError } from './types-BzUuhjKr.js';
|
|
|
12
12
|
export { C as CreateToolOptions, c as createThinkTool, a as createTool } from './think-tool-B065hm73.js';
|
|
13
13
|
export { A as AnyTool, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent } from './tool-B8K543oQ.js';
|
|
14
14
|
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolMiddleware, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, i as createMiddleware, j as createToolMiddleware } from './middleware-ByyL6Rj0.js';
|
|
15
|
-
export { UIError, UIMessage, UIMessagePart, UIMessageRole, UIStreamEvent, UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages } from './ui/index.js';
|
|
15
|
+
export { CreateUIAttachment, UIAttachment, UIError, UIMessage, UIMessagePart, UIMessageRole, UIStreamEvent, UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages } from './ui/index.js';
|
|
16
16
|
import './agent-BBj3jvBi.js';
|
|
17
17
|
import './types-CGML74sE.js';
|
|
18
18
|
import './types-Pl4PFQWL.js';
|
package/dist/index.js
CHANGED
|
@@ -2,30 +2,30 @@ import {
|
|
|
2
2
|
SkillValidationError,
|
|
3
3
|
loadSkills,
|
|
4
4
|
skill
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J3ROUB3P.js";
|
|
6
6
|
import {
|
|
7
7
|
coreMessagesToUIMessages,
|
|
8
8
|
uiMessagesToCoreMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LKLKEECY.js";
|
|
10
10
|
import {
|
|
11
11
|
AgentBuilder
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-XUO3KR5T.js";
|
|
13
|
+
import "./chunk-TUDZBJGF.js";
|
|
14
14
|
import {
|
|
15
15
|
MaxTurnsError,
|
|
16
16
|
PromptCancelledError,
|
|
17
17
|
ToolApprovalRequiredError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4NCRFQHS.js";
|
|
19
19
|
import "./chunk-YK4WAAS4.js";
|
|
20
20
|
import "./chunk-XUUY2L2D.js";
|
|
21
21
|
import {
|
|
22
22
|
createMiddleware,
|
|
23
23
|
createThinkTool,
|
|
24
24
|
createToolMiddleware
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YVQBC3SJ.js";
|
|
26
26
|
import {
|
|
27
27
|
createTool
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QKA6OQTH.js";
|
|
29
29
|
import {
|
|
30
30
|
cancelPrompt,
|
|
31
31
|
createHook,
|
|
@@ -36,8 +36,6 @@ import {
|
|
|
36
36
|
} from "./chunk-NPZDYOE6.js";
|
|
37
37
|
import "./chunk-MMHG7WAM.js";
|
|
38
38
|
import "./chunk-M6RPFHG7.js";
|
|
39
|
-
import "./chunk-JS5MGVNM.js";
|
|
40
|
-
import "./chunk-OIMLU4SF.js";
|
|
41
39
|
import {
|
|
42
40
|
createCompletion,
|
|
43
41
|
createCompletionStream,
|
|
@@ -51,6 +49,8 @@ import {
|
|
|
51
49
|
UserContent
|
|
52
50
|
} from "./chunk-5LFGEMIW.js";
|
|
53
51
|
import "./chunk-WQKHFADH.js";
|
|
52
|
+
import "./chunk-JS5MGVNM.js";
|
|
53
|
+
import "./chunk-OIMLU4SF.js";
|
|
54
54
|
import {
|
|
55
55
|
allow,
|
|
56
56
|
block,
|
package/dist/internal/agent.js
CHANGED
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
Agent,
|
|
3
3
|
AgentSession,
|
|
4
4
|
DEFAULT_MAX_TURNS
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-TUDZBJGF.js";
|
|
6
|
+
import "../chunk-4NCRFQHS.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
8
|
import "../chunk-XUUY2L2D.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-YVQBC3SJ.js";
|
|
10
|
+
import "../chunk-QKA6OQTH.js";
|
|
11
11
|
import "../chunk-NPZDYOE6.js";
|
|
12
12
|
import "../chunk-MMHG7WAM.js";
|
|
13
|
-
import "../chunk-JS5MGVNM.js";
|
|
14
|
-
import "../chunk-OIMLU4SF.js";
|
|
15
13
|
import "../chunk-SRBW3LD7.js";
|
|
16
14
|
import "../chunk-5LFGEMIW.js";
|
|
17
15
|
import "../chunk-WQKHFADH.js";
|
|
16
|
+
import "../chunk-JS5MGVNM.js";
|
|
17
|
+
import "../chunk-OIMLU4SF.js";
|
|
18
18
|
import "../chunk-CWUJUSOS.js";
|
|
19
19
|
export {
|
|
20
20
|
Agent,
|
package/dist/request/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
PromptCancelledError,
|
|
4
4
|
PromptRequest,
|
|
5
5
|
ToolApprovalRequiredError
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-4NCRFQHS.js";
|
|
7
7
|
import "../chunk-XUUY2L2D.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-YVQBC3SJ.js";
|
|
9
|
+
import "../chunk-QKA6OQTH.js";
|
|
10
10
|
import "../chunk-NPZDYOE6.js";
|
|
11
11
|
import "../chunk-MMHG7WAM.js";
|
|
12
|
-
import "../chunk-JS5MGVNM.js";
|
|
13
|
-
import "../chunk-OIMLU4SF.js";
|
|
14
12
|
import "../chunk-SRBW3LD7.js";
|
|
15
13
|
import "../chunk-5LFGEMIW.js";
|
|
16
14
|
import "../chunk-WQKHFADH.js";
|
|
15
|
+
import "../chunk-JS5MGVNM.js";
|
|
16
|
+
import "../chunk-OIMLU4SF.js";
|
|
17
17
|
import "../chunk-CWUJUSOS.js";
|
|
18
18
|
export {
|
|
19
19
|
MaxTurnsError,
|
package/dist/skills/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
SkillValidationError,
|
|
3
3
|
loadSkills,
|
|
4
4
|
skill
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-J3ROUB3P.js";
|
|
6
6
|
import "../chunk-YK4WAAS4.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-YVQBC3SJ.js";
|
|
8
|
+
import "../chunk-QKA6OQTH.js";
|
|
9
9
|
import "../chunk-MMHG7WAM.js";
|
|
10
|
-
import "../chunk-JS5MGVNM.js";
|
|
11
|
-
import "../chunk-OIMLU4SF.js";
|
|
12
10
|
import "../chunk-5LFGEMIW.js";
|
|
13
11
|
import "../chunk-WQKHFADH.js";
|
|
12
|
+
import "../chunk-JS5MGVNM.js";
|
|
13
|
+
import "../chunk-OIMLU4SF.js";
|
|
14
14
|
export {
|
|
15
15
|
SkillValidationError,
|
|
16
16
|
loadSkills,
|
package/dist/tool/index.js
CHANGED
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
normalizeToolResultOutput,
|
|
14
14
|
parseToolArgs,
|
|
15
15
|
toolResultContentToText
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-YVQBC3SJ.js";
|
|
17
17
|
import {
|
|
18
18
|
createTool
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-QKA6OQTH.js";
|
|
20
20
|
import "../chunk-MMHG7WAM.js";
|
|
21
|
-
import "../chunk-JS5MGVNM.js";
|
|
22
|
-
import "../chunk-OIMLU4SF.js";
|
|
23
21
|
import {
|
|
24
22
|
isToolResultContentArray,
|
|
25
23
|
serializeToolResultOutput
|
|
26
24
|
} from "../chunk-5LFGEMIW.js";
|
|
27
25
|
import "../chunk-WQKHFADH.js";
|
|
26
|
+
import "../chunk-JS5MGVNM.js";
|
|
27
|
+
import "../chunk-OIMLU4SF.js";
|
|
28
28
|
export {
|
|
29
29
|
ToolCallError,
|
|
30
30
|
ToolJsonError,
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as JsonValue, U as Usage, M as Message } from '../types-q9G7Bvwl.js';
|
|
1
|
+
import { v as ImageDetail, e as JsonValue, U as Usage, M as Message } from '../types-q9G7Bvwl.js';
|
|
2
2
|
|
|
3
3
|
type UIMessageRole = "system" | "user" | "assistant" | "tool";
|
|
4
4
|
type UIError = {
|
|
@@ -11,6 +11,20 @@ type UIMessage = {
|
|
|
11
11
|
parts: UIMessagePart[];
|
|
12
12
|
metadata?: JsonValue;
|
|
13
13
|
};
|
|
14
|
+
type UIAttachment = {
|
|
15
|
+
id: string;
|
|
16
|
+
type: "image" | "document" | "file";
|
|
17
|
+
name?: string;
|
|
18
|
+
mediaType?: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
data?: string;
|
|
21
|
+
text?: string;
|
|
22
|
+
detail?: ImageDetail;
|
|
23
|
+
metadata?: JsonValue;
|
|
24
|
+
};
|
|
25
|
+
type CreateUIAttachment = Omit<UIAttachment, "id"> & {
|
|
26
|
+
id?: string;
|
|
27
|
+
};
|
|
14
28
|
type UIMessagePart = {
|
|
15
29
|
id: string;
|
|
16
30
|
type: "text";
|
|
@@ -35,6 +49,10 @@ type UIMessagePart = {
|
|
|
35
49
|
type: "data";
|
|
36
50
|
name: string;
|
|
37
51
|
data: JsonValue;
|
|
52
|
+
} | {
|
|
53
|
+
id: string;
|
|
54
|
+
type: "attachment";
|
|
55
|
+
attachment: UIAttachment;
|
|
38
56
|
} | {
|
|
39
57
|
id: string;
|
|
40
58
|
type: "error";
|
|
@@ -79,4 +97,4 @@ type UIStreamEvent = {
|
|
|
79
97
|
declare function uiMessagesToCoreMessages(messages: UIMessage[]): Message[];
|
|
80
98
|
declare function coreMessagesToUIMessages(messages: Message[]): UIMessage[];
|
|
81
99
|
|
|
82
|
-
export { type UIError, type UIMessage, type UIMessagePart, type UIMessageRole, type UIStreamEvent, type UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages };
|
|
100
|
+
export { type CreateUIAttachment, type UIAttachment, type UIError, type UIMessage, type UIMessagePart, type UIMessageRole, type UIStreamEvent, type UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages };
|
package/dist/ui/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
InMemoryVectorStore,
|
|
4
4
|
createVectorSearchTool,
|
|
5
5
|
vectorFilter
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-QKA6OQTH.js";
|
|
7
7
|
import "../chunk-MMHG7WAM.js";
|
|
8
|
+
import "../chunk-WQKHFADH.js";
|
|
8
9
|
import "../chunk-JS5MGVNM.js";
|
|
9
10
|
import "../chunk-OIMLU4SF.js";
|
|
10
|
-
import "../chunk-WQKHFADH.js";
|
|
11
11
|
export {
|
|
12
12
|
InMemoryVectorIndex,
|
|
13
13
|
InMemoryVectorStore,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/messages.ts"],"sourcesContent":["import {\n AssistantContent,\n type AssistantContent as AssistantContentType,\n type Message as CoreMessage,\n type JsonValue,\n Message,\n reasoningDisplayText,\n serializeToolResultOutput,\n ToolContent,\n type ToolContent as ToolContentType,\n type ToolResultContent,\n UserContent,\n type UserContent as UserContentType,\n} from \"../completion/types\";\nimport type { UIMessage, UIMessagePart } from \"./types\";\n\nexport function uiMessagesToCoreMessages(messages: UIMessage[]): CoreMessage[] {\n const coreMessages: CoreMessage[] = [];\n\n for (const message of messages) {\n const text = textFromUIParts(message.parts);\n\n if (message.role === \"system\") {\n if (text.length > 0) {\n coreMessages.push(Message.system(text));\n }\n continue;\n }\n\n if (message.role === \"user\") {\n const content: UserContentType[] = [];\n for (const part of message.parts) {\n if (part.type === \"text\") {\n content.push(UserContent.text(part.text));\n continue;\n }\n if (part.type === \"data\" && isUserContent(part.data)) {\n content.push(part.data);\n continue;\n }\n throw new TypeError(\n \"User UI messages can only be converted from text parts or image/document data parts.\",\n );\n }\n if (content.length > 0) {\n coreMessages.push(Message.user(content));\n }\n continue;\n }\n\n if (message.role === \"assistant\") {\n const content: AssistantContentType[] = [];\n const toolResults: ToolContentType[] = [];\n for (const part of message.parts) {\n if (part.type === \"text\" && part.text.length > 0) {\n content.push(AssistantContent.text(part.text));\n continue;\n }\n if (part.type === \"reasoning\" && part.text.length > 0) {\n content.push(AssistantContent.reasoning(part.text, part.reasoningId));\n continue;\n }\n if (\n part.type === \"tool\" &&\n (part.state === \"input-streaming\" ||\n part.state === \"input-available\" ||\n part.state === \"output-available\")\n ) {\n content.push(\n AssistantContent.toolCall(\n part.toolCallId,\n part.toolName,\n part.input ?? {},\n part.callId,\n ),\n );\n if (part.state === \"output-available\") {\n toolResults.push(\n ToolContent.toolResult(\n part.toolCallId,\n outputToToolResultContent(part.output),\n part.callId,\n ),\n );\n }\n }\n }\n if (content.length > 0) {\n coreMessages.push(Message.assistant(content, message.id));\n }\n if (toolResults.length > 0) {\n coreMessages.push(Message.tool(toolResults));\n }\n continue;\n }\n\n const toolResults: ToolContentType[] = [];\n for (const part of message.parts) {\n if (part.type !== \"tool\" || part.state !== \"output-available\") {\n continue;\n }\n toolResults.push(\n ToolContent.toolResult(\n part.toolCallId,\n outputToToolResultContent(part.output),\n part.callId,\n ),\n );\n }\n if (toolResults.length > 0) {\n coreMessages.push(Message.tool(toolResults));\n }\n }\n\n return coreMessages;\n}\n\nexport function coreMessagesToUIMessages(messages: CoreMessage[]): UIMessage[] {\n const uiMessages: UIMessage[] = [];\n\n for (const message of messages) {\n if (message.role === \"system\") {\n uiMessages.push({\n id: createId(\"msg\"),\n role: \"system\",\n parts: [{ id: createId(\"part\"), type: \"text\", text: message.content }],\n });\n continue;\n }\n\n if (message.role === \"user\") {\n const parts: UIMessagePart[] = [];\n for (const content of message.content) {\n if (content.type === \"text\") {\n parts.push({ id: createId(\"part\"), type: \"text\", text: content.text });\n } else {\n parts.push({\n id: createId(\"part\"),\n type: \"data\",\n name: content.type,\n data: content as JsonValue,\n });\n }\n }\n uiMessages.push({ id: createId(\"msg\"), role: \"user\", parts });\n continue;\n }\n\n if (message.role === \"assistant\") {\n const parts: UIMessagePart[] = [];\n for (const content of message.content) {\n if (content.type === \"text\") {\n parts.push({ id: createId(\"part\"), type: \"text\", text: content.text });\n continue;\n }\n if (content.type === \"reasoning\") {\n const part: UIMessagePart = {\n id: createId(\"part\"),\n type: \"reasoning\",\n text: reasoningDisplayText(content),\n };\n if (content.id !== undefined) {\n part.reasoningId = content.id;\n }\n parts.push(part);\n continue;\n }\n if (content.type === \"tool_call\") {\n const part: UIMessagePart = {\n id: toolPartId(content.id),\n type: \"tool\",\n toolName: content.function.name,\n toolCallId: content.id,\n state: \"input-available\",\n input: content.function.arguments,\n };\n if (content.callId !== undefined) {\n part.callId = content.callId;\n }\n parts.push(part);\n continue;\n }\n parts.push({\n id: createId(\"part\"),\n type: \"data\",\n name: content.type,\n data: content as JsonValue,\n });\n }\n uiMessages.push({ id: message.id ?? createId(\"msg\"), role: \"assistant\", parts });\n continue;\n }\n\n const parts: UIMessagePart[] = [];\n for (const content of message.content) {\n const part: UIMessagePart = {\n id: toolPartId(content.id),\n type: \"tool\",\n toolName: \"tool\",\n toolCallId: content.id,\n state: \"output-available\",\n output: toolResultContentToJson(content.content),\n };\n if (content.callId !== undefined) {\n part.callId = content.callId;\n }\n parts.push(part);\n }\n uiMessages.push({ id: createId(\"msg\"), role: \"tool\", parts });\n }\n\n return uiMessages;\n}\n\nexport function isUIMessage(value: unknown): value is UIMessage {\n return (\n isRecord(value) &&\n typeof value.id === \"string\" &&\n isUIMessageRole(value.role) &&\n Array.isArray(value.parts)\n );\n}\n\nexport function isUIMessageArray(value: unknown): value is UIMessage[] {\n return Array.isArray(value) && value.every(isUIMessage);\n}\n\nfunction textFromUIParts(parts: UIMessagePart[]): string {\n return parts.flatMap((part) => (part.type === \"text\" ? [part.text] : [])).join(\"\");\n}\n\nfunction outputToToolResultContent(output: JsonValue | undefined): ToolResultContent[] {\n return [{ type: \"text\", text: serializeToolResultOutput(output ?? null) }];\n}\n\nfunction toolResultContentToJson(content: ToolResultContent[]): JsonValue {\n if (content.length === 1 && content[0]?.type === \"text\") {\n return content[0].text;\n }\n return content as JsonValue;\n}\n\nfunction isUserContent(value: unknown): value is UserContentType {\n if (!isRecord(value)) {\n return false;\n }\n\n if (value.type === \"text\") {\n return typeof value.text === \"string\";\n }\n\n if (value.type === \"image\") {\n return isImageContent(value);\n }\n\n if (value.type === \"document\") {\n return isDocumentContent(value);\n }\n\n return false;\n}\n\nfunction isImageContent(value: Record<string, unknown>): boolean {\n if (!isRecord(value.source)) {\n return false;\n }\n\n if (value.source.type === \"url\") {\n return typeof value.source.url === \"string\";\n }\n\n if (value.source.type === \"base64\") {\n return typeof value.source.data === \"string\" && typeof value.source.mediaType === \"string\";\n }\n\n return false;\n}\n\nfunction isDocumentContent(value: Record<string, unknown>): boolean {\n if (!isRecord(value.source)) {\n return false;\n }\n\n if (value.source.type === \"url\") {\n return typeof value.source.url === \"string\" && typeof value.source.mediaType === \"string\";\n }\n\n if (value.source.type === \"base64\") {\n return typeof value.source.data === \"string\" && typeof value.source.mediaType === \"string\";\n }\n\n if (value.source.type === \"text\") {\n return (\n typeof value.source.text === \"string\" &&\n (value.source.mediaType === undefined || typeof value.source.mediaType === \"string\")\n );\n }\n\n return false;\n}\n\nfunction toolPartId(toolCallId: string): string {\n return `tool_${toolCallId}`;\n}\n\nlet nextId = 0;\n\nfunction createId(prefix: string): string {\n const random = globalThis.crypto?.randomUUID?.();\n if (random !== undefined) {\n return `${prefix}_${random}`;\n }\n nextId += 1;\n return `${prefix}_${nextId.toString(36)}`;\n}\n\nfunction isUIMessageRole(value: unknown): value is UIMessage[\"role\"] {\n return value === \"system\" || value === \"user\" || value === \"assistant\" || value === \"tool\";\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n"],"mappings":";;;;;;;;;;AAgBO,SAAS,yBAAyB,UAAsC;AAC7E,QAAM,eAA8B,CAAC;AAErC,aAAW,WAAW,UAAU;AAC9B,UAAM,OAAO,gBAAgB,QAAQ,KAAK;AAE1C,QAAI,QAAQ,SAAS,UAAU;AAC7B,UAAI,KAAK,SAAS,GAAG;AACnB,qBAAa,KAAK,QAAQ,OAAO,IAAI,CAAC;AAAA,MACxC;AACA;AAAA,IACF;AAEA,QAAI,QAAQ,SAAS,QAAQ;AAC3B,YAAM,UAA6B,CAAC;AACpC,iBAAW,QAAQ,QAAQ,OAAO;AAChC,YAAI,KAAK,SAAS,QAAQ;AACxB,kBAAQ,KAAK,YAAY,KAAK,KAAK,IAAI,CAAC;AACxC;AAA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MAAM,OAAO,cAAc;AAAA,EACpF;AAEA,SAAO;AACT;AAEA,SAAS,kBAAkB,OAAyC;AAClE,MAAI,CAAC,SAAS,MAAM,MAAM,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,OAAO,SAAS,OAAO;AAC/B,WAAO,OAAO,MAAM,OAAO,QAAQ,YAAY,OAAO,MAAM,OAAO,cAAc;AAAA,EACnF;AAEA,MAAI,MAAM,OAAO,SAAS,UAAU;AAClC,WAAO,OAAO,MAAM,OAAO,SAAS,YAAY,OAAO,MAAM,OAAO,cAAc;AAAA,EACpF;AAEA,MAAI,MAAM,OAAO,SAAS,QAAQ;AAChC,WACE,OAAO,MAAM,OAAO,SAAS,aAC5B,MAAM,OAAO,cAAc,UAAa,OAAO,MAAM,OAAO,cAAc;AAAA,EAE/E;AAEA,SAAO;AACT;AAEA,SAAS,WAAW,YAA4B;AAC9C,SAAO,QAAQ,UAAU;AAC3B;AAEA,IAAI,SAAS;AAEb,SAAS,SAAS,QAAwB;AACxC,QAAM,SAAS,WAAW,QAAQ,aAAa;AAC/C,MAAI,WAAW,QAAW;AACxB,WAAO,GAAG,MAAM,IAAI,MAAM;AAAA,EAC5B;AACA,YAAU;AACV,SAAO,GAAG,MAAM,IAAI,OAAO,SAAS,EAAE,CAAC;AACzC;AAMA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;","names":["toolResults","parts"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|