veryfront 0.1.426 → 0.1.427
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/esm/deno.js +1 -1
- package/esm/src/agent/agent-runtime-message-adapter.d.ts.map +1 -1
- package/esm/src/agent/agent-runtime-message-adapter.js +6 -2
- package/esm/src/agent/conversation-run-context.d.ts +1 -1
- package/esm/src/agent/durable.d.ts +5 -5
- package/esm/src/agent/invoke-agent-child-runs.d.ts +3 -3
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.js +46 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/schemas/workflow.schema.d.ts +3 -3
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +1 -1
- package/src/deps/esm.sh/@types/{react@19.2.14 → react@19.2.3}/global.d.ts +0 -1
- package/src/deps/esm.sh/@types/{react@19.2.14 → react@19.2.3}/index.d.ts +24 -93
- package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +1 -1
- package/src/src/agent/agent-runtime-message-adapter.ts +7 -2
- package/src/src/agent/runtime/text-generation-runtime-message-converter.ts +54 -1
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-runtime-message-adapter.d.ts","sourceRoot":"","sources":["../../../src/src/agent/agent-runtime-message-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAO1B,KAAK,2BAA2B,GAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IACA,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CA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jD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB;AAkBD,qBAAa,kCAAmC,SAAQ,KAAK;gBAC/C,OAAO,EAAE,MAAM;CAI5B;
|
|
1
|
+
{"version":3,"file":"agent-runtime-message-adapter.d.ts","sourceRoot":"","sources":["../../../src/src/agent/agent-runtime-message-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,kBAAkB,EAEvB,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAO1B,KAAK,2BAA2B,GAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IACA,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GACC;IACA,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,GACC;IACA,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,GACC;IACA,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,GACC;I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AAE,OAAO,GACZ;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,CAoBjF;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,OAAO,GACZ;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAgBlE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,kBAAkB,CAOrB;AAuHD,wBAAgB,6CAA6C,CAC3D,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GACxC,mBAAmB,EAAE,CAOvB;AAED,wBAAgB,6CAA6C,CAC3D,QAAQ,EAAE,aAAa,CACrB,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,GAAG;IAAE,KAAK,EAAE,aAAa,CAAC,2BAA2B,CAAC,CAAA;CAAE,CAC1F,GACA,oBAAoB,EAAE,CAWxB"}
|
|
@@ -89,6 +89,9 @@ function buildAttachmentContextPart(attachmentReferences) {
|
|
|
89
89
|
text: `Attached files from earlier conversation context:${buildDataFileAnnotation(attachmentReferences)}`,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
+
function hasUploadedFilesAnnotation(parts) {
|
|
93
|
+
return parts.some((part) => part.type === "text" && part.text.includes("<uploaded_files>"));
|
|
94
|
+
}
|
|
92
95
|
function convertContentToAgentRuntimeParts(message) {
|
|
93
96
|
if (typeof message.content === "string") {
|
|
94
97
|
const textPart = createTextAgentRuntimePart(message.content);
|
|
@@ -100,7 +103,6 @@ function convertContentToAgentRuntimeParts(message) {
|
|
|
100
103
|
const convertedPart = convertStructuredPart(part);
|
|
101
104
|
if (convertedPart) {
|
|
102
105
|
parts.push(convertedPart);
|
|
103
|
-
continue;
|
|
104
106
|
}
|
|
105
107
|
if (part.type === "image" || part.type === "file") {
|
|
106
108
|
const attachmentReference = createAttachmentReference(part);
|
|
@@ -110,7 +112,9 @@ function convertContentToAgentRuntimeParts(message) {
|
|
|
110
112
|
continue;
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
|
-
const attachmentContextPart =
|
|
115
|
+
const attachmentContextPart = hasUploadedFilesAnnotation(message.content)
|
|
116
|
+
? null
|
|
117
|
+
: buildAttachmentContextPart(attachmentReferences);
|
|
114
118
|
if (attachmentContextPart) {
|
|
115
119
|
parts.push(attachmentContextPart);
|
|
116
120
|
}
|
|
@@ -19,7 +19,7 @@ export declare function createConversationRunContext(input: {
|
|
|
19
19
|
latestExternalEventSequence: number;
|
|
20
20
|
waitingToolCallId: string | null;
|
|
21
21
|
waitingToolName: string | null;
|
|
22
|
-
status: "failed" | "pending" | "completed" | "
|
|
22
|
+
status: "failed" | "pending" | "completed" | "cancelled" | "running" | "waiting_for_tool";
|
|
23
23
|
} | null;
|
|
24
24
|
effectiveParentRunId: string | undefined;
|
|
25
25
|
effectiveParentMessageId: string | undefined;
|
|
@@ -20,8 +20,8 @@ export declare const ConversationRunStatusSchema: z.ZodEnum<{
|
|
|
20
20
|
failed: "failed";
|
|
21
21
|
pending: "pending";
|
|
22
22
|
completed: "completed";
|
|
23
|
-
running: "running";
|
|
24
23
|
cancelled: "cancelled";
|
|
24
|
+
running: "running";
|
|
25
25
|
waiting_for_tool: "waiting_for_tool";
|
|
26
26
|
}>;
|
|
27
27
|
export declare const ConversationRunProjectionSchema: z.ZodPipe<z.ZodObject<{
|
|
@@ -43,8 +43,8 @@ export declare const ConversationRunProjectionSchema: z.ZodPipe<z.ZodObject<{
|
|
|
43
43
|
failed: "failed";
|
|
44
44
|
pending: "pending";
|
|
45
45
|
completed: "completed";
|
|
46
|
-
running: "running";
|
|
47
46
|
cancelled: "cancelled";
|
|
47
|
+
running: "running";
|
|
48
48
|
waiting_for_tool: "waiting_for_tool";
|
|
49
49
|
}>;
|
|
50
50
|
}, z.core.$loose>, z.ZodTransform<{
|
|
@@ -55,10 +55,10 @@ export declare const ConversationRunProjectionSchema: z.ZodPipe<z.ZodObject<{
|
|
|
55
55
|
latestExternalEventSequence: number;
|
|
56
56
|
waitingToolCallId: string | null;
|
|
57
57
|
waitingToolName: string | null;
|
|
58
|
-
status: "failed" | "pending" | "completed" | "
|
|
58
|
+
status: "failed" | "pending" | "completed" | "cancelled" | "running" | "waiting_for_tool";
|
|
59
59
|
}, {
|
|
60
60
|
[x: string]: unknown;
|
|
61
|
-
status: "failed" | "pending" | "completed" | "
|
|
61
|
+
status: "failed" | "pending" | "completed" | "cancelled" | "running" | "waiting_for_tool";
|
|
62
62
|
runId?: string | undefined;
|
|
63
63
|
run_id?: string | undefined;
|
|
64
64
|
conversationId?: string | undefined;
|
|
@@ -142,8 +142,8 @@ export declare const CompleteConversationRunResponseSchema: z.ZodObject<{
|
|
|
142
142
|
failed: "failed";
|
|
143
143
|
pending: "pending";
|
|
144
144
|
completed: "completed";
|
|
145
|
-
running: "running";
|
|
146
145
|
cancelled: "cancelled";
|
|
146
|
+
running: "running";
|
|
147
147
|
}>;
|
|
148
148
|
}, z.core.$loose>;
|
|
149
149
|
}, z.core.$loose>;
|
|
@@ -11,8 +11,8 @@ export declare const InvokeAgentChildRunLifecycleValueSchema: z.ZodObject<{
|
|
|
11
11
|
failed: "failed";
|
|
12
12
|
pending: "pending";
|
|
13
13
|
completed: "completed";
|
|
14
|
-
running: "running";
|
|
15
14
|
cancelled: "cancelled";
|
|
15
|
+
running: "running";
|
|
16
16
|
waiting_for_tool: "waiting_for_tool";
|
|
17
17
|
}>;
|
|
18
18
|
sourceTargetKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
@@ -49,8 +49,8 @@ export declare const InvokeAgentChildRunStateDeltaSchema: z.ZodObject<{
|
|
|
49
49
|
failed: "failed";
|
|
50
50
|
pending: "pending";
|
|
51
51
|
completed: "completed";
|
|
52
|
-
running: "running";
|
|
53
52
|
cancelled: "cancelled";
|
|
53
|
+
running: "running";
|
|
54
54
|
waiting_for_tool: "waiting_for_tool";
|
|
55
55
|
}>;
|
|
56
56
|
sourceTargetKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
@@ -84,8 +84,8 @@ export declare const InvokeAgentChildRunLifecycleCustomEventSchema: z.ZodObject<
|
|
|
84
84
|
failed: "failed";
|
|
85
85
|
pending: "pending";
|
|
86
86
|
completed: "completed";
|
|
87
|
-
running: "running";
|
|
88
87
|
cancelled: "cancelled";
|
|
88
|
+
running: "running";
|
|
89
89
|
waiting_for_tool: "waiting_for_tool";
|
|
90
90
|
}>;
|
|
91
91
|
sourceTargetKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-generation-runtime-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/text-generation-runtime-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAEV,4BAA4B,EAI7B,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"text-generation-runtime-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/text-generation-runtime-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAEV,4BAA4B,EAI7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AAsDrB;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,OAAO,GAAG,4BAA4B,CAyEhG;AAgBD;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,OAAO,EAAE,GAClB,4BAA4B,EAAE,CAqChC"}
|
|
@@ -6,7 +6,52 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module ai/agent/runtime/text-generation-runtime-message-converter
|
|
8
8
|
*/
|
|
9
|
+
import { buildDataFileAnnotation } from "../../chat/types.js";
|
|
9
10
|
import { getTextFromParts, getToolArguments, } from "../types.js";
|
|
11
|
+
function getStringPartField(part, key) {
|
|
12
|
+
if (!part || typeof part !== "object" || Array.isArray(part))
|
|
13
|
+
return undefined;
|
|
14
|
+
const value = part[key];
|
|
15
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
16
|
+
}
|
|
17
|
+
function buildAttachmentContextFromParts(parts) {
|
|
18
|
+
const refs = parts.flatMap((part) => {
|
|
19
|
+
const type = getStringPartField(part, "type");
|
|
20
|
+
if (type !== "file" && type !== "image")
|
|
21
|
+
return [];
|
|
22
|
+
const mediaType = getStringPartField(part, "mediaType");
|
|
23
|
+
if (!mediaType)
|
|
24
|
+
return [];
|
|
25
|
+
const uploadId = getStringPartField(part, "uploadId");
|
|
26
|
+
const uploadPath = getStringPartField(part, "uploadPath");
|
|
27
|
+
const url = getStringPartField(part, "url");
|
|
28
|
+
return [{
|
|
29
|
+
name: getStringPartField(part, "filename") ?? (type === "image" ? "image" : "file"),
|
|
30
|
+
mediaType,
|
|
31
|
+
...(uploadId ? { uploadId } : {}),
|
|
32
|
+
...(uploadPath ? { path: uploadPath } : {}),
|
|
33
|
+
...(url ? { url } : {}),
|
|
34
|
+
}];
|
|
35
|
+
});
|
|
36
|
+
return refs.length > 0 ? buildDataFileAnnotation(refs) : "";
|
|
37
|
+
}
|
|
38
|
+
function appendReadableAttachmentContext(text, attachmentContext) {
|
|
39
|
+
const normalizedContext = attachmentContext.trimStart();
|
|
40
|
+
if (!normalizedContext) {
|
|
41
|
+
return text;
|
|
42
|
+
}
|
|
43
|
+
if (text.length === 0) {
|
|
44
|
+
return normalizedContext;
|
|
45
|
+
}
|
|
46
|
+
const separator = text.endsWith("\n\n") ? "" : text.endsWith("\n") ? "\n" : "\n\n";
|
|
47
|
+
return `${text}${separator}${normalizedContext}`;
|
|
48
|
+
}
|
|
49
|
+
function getUserTextWithAttachmentContext(parts) {
|
|
50
|
+
const text = getTextFromParts(parts);
|
|
51
|
+
return text.includes("<uploaded_files>")
|
|
52
|
+
? text
|
|
53
|
+
: appendReadableAttachmentContext(text, buildAttachmentContextFromParts(parts));
|
|
54
|
+
}
|
|
10
55
|
/**
|
|
11
56
|
* Convert a veryfront Message to the current text-generation runtime message format.
|
|
12
57
|
*/
|
|
@@ -17,7 +62,7 @@ export function convertToTextGenerationRuntimeMessage(msg) {
|
|
|
17
62
|
return { role: "system", content: text };
|
|
18
63
|
}
|
|
19
64
|
case "user": {
|
|
20
|
-
const text =
|
|
65
|
+
const text = getUserTextWithAttachmentContext(msg.parts);
|
|
21
66
|
return { role: "user", content: text };
|
|
22
67
|
}
|
|
23
68
|
case "assistant": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.427";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
|
@@ -12,8 +12,8 @@ export declare const WorkflowStatusSchema: z.ZodEnum<{
|
|
|
12
12
|
failed: "failed";
|
|
13
13
|
pending: "pending";
|
|
14
14
|
completed: "completed";
|
|
15
|
-
running: "running";
|
|
16
15
|
cancelled: "cancelled";
|
|
16
|
+
running: "running";
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
19
19
|
* Node status schema
|
|
@@ -186,15 +186,15 @@ export declare const RunFilterSchema: z.ZodObject<{
|
|
|
186
186
|
failed: "failed";
|
|
187
187
|
pending: "pending";
|
|
188
188
|
completed: "completed";
|
|
189
|
-
running: "running";
|
|
190
189
|
cancelled: "cancelled";
|
|
190
|
+
running: "running";
|
|
191
191
|
}>, z.ZodArray<z.ZodEnum<{
|
|
192
192
|
waiting: "waiting";
|
|
193
193
|
failed: "failed";
|
|
194
194
|
pending: "pending";
|
|
195
195
|
completed: "completed";
|
|
196
|
-
running: "running";
|
|
197
196
|
cancelled: "cancelled";
|
|
197
|
+
running: "running";
|
|
198
198
|
}>>]>>;
|
|
199
199
|
createdAfter: z.ZodOptional<z.ZodDate>;
|
|
200
200
|
createdBefore: z.ZodOptional<z.ZodDate>;
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared,
|
|
6
6
|
|
|
7
|
-
import React = require("https://esm.sh/@types/react@19.2.
|
|
7
|
+
import React = require("https://esm.sh/@types/react@19.2.3/index.d.ts");
|
|
8
8
|
|
|
9
9
|
export {};
|
|
10
10
|
|
|
@@ -18,7 +18,6 @@ interface KeyboardEvent extends Event {}
|
|
|
18
18
|
interface MouseEvent extends Event {}
|
|
19
19
|
interface TouchEvent extends Event {}
|
|
20
20
|
interface PointerEvent extends Event {}
|
|
21
|
-
interface SubmitEvent extends Event {}
|
|
22
21
|
interface ToggleEvent extends Event {}
|
|
23
22
|
interface TransitionEvent extends Event {}
|
|
24
23
|
interface UIEvent extends Event {}
|
|
@@ -16,7 +16,6 @@ type NativeKeyboardEvent = KeyboardEvent;
|
|
|
16
16
|
type NativeMouseEvent = MouseEvent;
|
|
17
17
|
type NativeTouchEvent = TouchEvent;
|
|
18
18
|
type NativePointerEvent = PointerEvent;
|
|
19
|
-
type NativeSubmitEvent = SubmitEvent;
|
|
20
19
|
type NativeToggleEvent = ToggleEvent;
|
|
21
20
|
type NativeTransitionEvent = TransitionEvent;
|
|
22
21
|
type NativeUIEvent = UIEvent;
|
|
@@ -226,20 +225,12 @@ declare namespace React {
|
|
|
226
225
|
|
|
227
226
|
type ComponentState = any;
|
|
228
227
|
|
|
229
|
-
interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {}
|
|
230
|
-
|
|
231
228
|
/**
|
|
232
229
|
* A value which uniquely identifies a node among items in an array.
|
|
233
230
|
*
|
|
234
231
|
* @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
|
|
235
232
|
*/
|
|
236
|
-
type Key =
|
|
237
|
-
| string
|
|
238
|
-
| number
|
|
239
|
-
| bigint
|
|
240
|
-
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES[
|
|
241
|
-
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES
|
|
242
|
-
];
|
|
233
|
+
type Key = string | number | bigint;
|
|
243
234
|
|
|
244
235
|
/**
|
|
245
236
|
* @internal The props any component can receive.
|
|
@@ -1893,7 +1884,7 @@ declare namespace React {
|
|
|
1893
1884
|
*
|
|
1894
1885
|
* @param callback A synchronous, void callback that will execute as a single, complete React commit.
|
|
1895
1886
|
*
|
|
1896
|
-
* @see
|
|
1887
|
+
* @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
|
|
1897
1888
|
*/
|
|
1898
1889
|
// NOTES
|
|
1899
1890
|
// - the order of these signatures matters - typescript will check the signatures in source order.
|
|
@@ -1935,31 +1926,7 @@ declare namespace React {
|
|
|
1935
1926
|
reducer: (state: State, action: Action) => State,
|
|
1936
1927
|
): [State, (action: Action) => void];
|
|
1937
1928
|
|
|
1938
|
-
|
|
1939
|
-
status?: void;
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
export interface PendingReactPromise<T> extends PromiseLike<T> {
|
|
1943
|
-
status: "pending";
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
export interface FulfilledReactPromise<T> extends PromiseLike<T> {
|
|
1947
|
-
status: "fulfilled";
|
|
1948
|
-
value: T;
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
export interface RejectedReactPromise<T> extends PromiseLike<T> {
|
|
1952
|
-
status: "rejected";
|
|
1953
|
-
reason: unknown;
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
export type ReactPromise<T> =
|
|
1957
|
-
| UntrackedReactPromise<T>
|
|
1958
|
-
| PendingReactPromise<T>
|
|
1959
|
-
| FulfilledReactPromise<T>
|
|
1960
|
-
| RejectedReactPromise<T>;
|
|
1961
|
-
|
|
1962
|
-
export type Usable<T> = ReactPromise<T> | Context<T>;
|
|
1929
|
+
export type Usable<T> = PromiseLike<T> | Context<T>;
|
|
1963
1930
|
|
|
1964
1931
|
export function use<T>(usable: Usable<T>): T;
|
|
1965
1932
|
|
|
@@ -2074,28 +2041,15 @@ declare namespace React {
|
|
|
2074
2041
|
target: EventTarget & Target;
|
|
2075
2042
|
}
|
|
2076
2043
|
|
|
2077
|
-
/**
|
|
2078
|
-
* @deprecated FormEvent doesn't actually exist.
|
|
2079
|
-
* You probably meant to use {@link ChangeEvent}, {@link InputEvent}, {@link SubmitEvent}, or just {@link SyntheticEvent} instead
|
|
2080
|
-
* depending on the event type.
|
|
2081
|
-
*/
|
|
2082
2044
|
interface FormEvent<T = Element> extends SyntheticEvent<T> {
|
|
2083
2045
|
}
|
|
2084
2046
|
|
|
2085
2047
|
interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
|
|
2048
|
+
target: EventTarget & T;
|
|
2086
2049
|
}
|
|
2087
2050
|
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
* Only for form elements we know their target type because form events can't
|
|
2091
|
-
* be nested.
|
|
2092
|
-
* This type exists purely to narrow `target` for form elements. It doesn't
|
|
2093
|
-
* reflect a DOM event. Change events are just fired as standard {@link SyntheticEvent}.
|
|
2094
|
-
*/
|
|
2095
|
-
interface ChangeEvent<CurrentTarget = Element, Target = Element> extends SyntheticEvent<CurrentTarget> {
|
|
2096
|
-
// TODO: This is wrong for change event handlers on arbitrary. Should
|
|
2097
|
-
// be EventTarget & Target, but kept for backward compatibility until React 20.
|
|
2098
|
-
target: EventTarget & CurrentTarget;
|
|
2051
|
+
interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
|
|
2052
|
+
target: EventTarget & T;
|
|
2099
2053
|
}
|
|
2100
2054
|
|
|
2101
2055
|
interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
|
|
@@ -2165,13 +2119,6 @@ declare namespace React {
|
|
|
2165
2119
|
shiftKey: boolean;
|
|
2166
2120
|
}
|
|
2167
2121
|
|
|
2168
|
-
interface SubmitEvent<T = Element> extends SyntheticEvent<T, NativeSubmitEvent> {
|
|
2169
|
-
// `submitter` is available in react@canary
|
|
2170
|
-
// submitter: HTMLElement | null;
|
|
2171
|
-
// SubmitEvents are always targetted at HTMLFormElements.
|
|
2172
|
-
target: EventTarget & HTMLFormElement;
|
|
2173
|
-
}
|
|
2174
|
-
|
|
2175
2122
|
interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
|
|
2176
2123
|
altKey: boolean;
|
|
2177
2124
|
changedTouches: TouchList;
|
|
@@ -2227,19 +2174,11 @@ declare namespace React {
|
|
|
2227
2174
|
type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
|
|
2228
2175
|
type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
|
|
2229
2176
|
type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
|
|
2230
|
-
/**
|
|
2231
|
-
* @deprecated FormEventHandler doesn't actually exist.
|
|
2232
|
-
* You probably meant to use {@link ChangeEventHandler}, {@link InputEventHandler}, {@link SubmitEventHandler}, or just {@link EventHandler} instead
|
|
2233
|
-
* depending on the event type.
|
|
2234
|
-
*/
|
|
2235
2177
|
type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
|
|
2236
|
-
type ChangeEventHandler<
|
|
2237
|
-
ChangeEvent<CurrentTarget, Target>
|
|
2238
|
-
>;
|
|
2178
|
+
type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
|
|
2239
2179
|
type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
|
|
2240
2180
|
type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
|
|
2241
2181
|
type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
|
|
2242
|
-
type SubmitEventHandler<T = Element> = EventHandler<SubmitEvent<T>>;
|
|
2243
2182
|
type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
|
|
2244
2183
|
type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
|
|
2245
2184
|
type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
|
|
@@ -2293,19 +2232,19 @@ declare namespace React {
|
|
|
2293
2232
|
onBlur?: FocusEventHandler<T> | undefined;
|
|
2294
2233
|
onBlurCapture?: FocusEventHandler<T> | undefined;
|
|
2295
2234
|
|
|
2296
|
-
//
|
|
2297
|
-
onChange?:
|
|
2298
|
-
onChangeCapture?:
|
|
2235
|
+
// Form Events
|
|
2236
|
+
onChange?: FormEventHandler<T> | undefined;
|
|
2237
|
+
onChangeCapture?: FormEventHandler<T> | undefined;
|
|
2299
2238
|
onBeforeInput?: InputEventHandler<T> | undefined;
|
|
2300
|
-
onBeforeInputCapture?:
|
|
2301
|
-
onInput?:
|
|
2302
|
-
onInputCapture?:
|
|
2303
|
-
onReset?:
|
|
2304
|
-
onResetCapture?:
|
|
2305
|
-
onSubmit?:
|
|
2306
|
-
onSubmitCapture?:
|
|
2307
|
-
onInvalid?:
|
|
2308
|
-
onInvalidCapture?:
|
|
2239
|
+
onBeforeInputCapture?: FormEventHandler<T> | undefined;
|
|
2240
|
+
onInput?: FormEventHandler<T> | undefined;
|
|
2241
|
+
onInputCapture?: FormEventHandler<T> | undefined;
|
|
2242
|
+
onReset?: FormEventHandler<T> | undefined;
|
|
2243
|
+
onResetCapture?: FormEventHandler<T> | undefined;
|
|
2244
|
+
onSubmit?: FormEventHandler<T> | undefined;
|
|
2245
|
+
onSubmitCapture?: FormEventHandler<T> | undefined;
|
|
2246
|
+
onInvalid?: FormEventHandler<T> | undefined;
|
|
2247
|
+
onInvalidCapture?: FormEventHandler<T> | undefined;
|
|
2309
2248
|
|
|
2310
2249
|
// Image Events
|
|
2311
2250
|
onLoad?: ReactEventHandler<T> | undefined;
|
|
@@ -2849,7 +2788,7 @@ declare namespace React {
|
|
|
2849
2788
|
|
|
2850
2789
|
// Living Standard
|
|
2851
2790
|
/**
|
|
2852
|
-
* @see
|
|
2791
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
|
|
2853
2792
|
*/
|
|
2854
2793
|
inert?: boolean | undefined;
|
|
2855
2794
|
/**
|
|
@@ -3312,9 +3251,7 @@ declare namespace React {
|
|
|
3312
3251
|
value?: string | readonly string[] | number | undefined;
|
|
3313
3252
|
width?: number | string | undefined;
|
|
3314
3253
|
|
|
3315
|
-
|
|
3316
|
-
// so we know the target will be a HTMLInputElement.
|
|
3317
|
-
onChange?: ChangeEventHandler<T, HTMLInputElement> | undefined;
|
|
3254
|
+
onChange?: ChangeEventHandler<T> | undefined;
|
|
3318
3255
|
}
|
|
3319
3256
|
|
|
3320
3257
|
interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3479,9 +3416,7 @@ declare namespace React {
|
|
|
3479
3416
|
required?: boolean | undefined;
|
|
3480
3417
|
size?: number | undefined;
|
|
3481
3418
|
value?: string | readonly string[] | number | undefined;
|
|
3482
|
-
|
|
3483
|
-
// so we know the target will be a HTMLSelectElement.
|
|
3484
|
-
onChange?: ChangeEventHandler<T, HTMLSelectElement> | undefined;
|
|
3419
|
+
onChange?: ChangeEventHandler<T> | undefined;
|
|
3485
3420
|
}
|
|
3486
3421
|
|
|
3487
3422
|
interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3533,9 +3468,7 @@ declare namespace React {
|
|
|
3533
3468
|
value?: string | readonly string[] | number | undefined;
|
|
3534
3469
|
wrap?: string | undefined;
|
|
3535
3470
|
|
|
3536
|
-
|
|
3537
|
-
// so we know the target will be a HTMLTextAreaElement.
|
|
3538
|
-
onChange?: ChangeEventHandler<T, HTMLTextAreaElement> | undefined;
|
|
3471
|
+
onChange?: ChangeEventHandler<T> | undefined;
|
|
3539
3472
|
}
|
|
3540
3473
|
|
|
3541
3474
|
interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -3607,9 +3540,6 @@ declare namespace React {
|
|
|
3607
3540
|
method?: string | undefined;
|
|
3608
3541
|
min?: number | string | undefined;
|
|
3609
3542
|
name?: string | undefined;
|
|
3610
|
-
nonce?: string | undefined;
|
|
3611
|
-
part?: string | undefined;
|
|
3612
|
-
slot?: string | undefined;
|
|
3613
3543
|
style?: CSSProperties | undefined;
|
|
3614
3544
|
target?: string | undefined;
|
|
3615
3545
|
type?: string | undefined;
|
|
@@ -4127,6 +4057,7 @@ declare namespace React {
|
|
|
4127
4057
|
* Captures which component contained the exception, and its ancestors.
|
|
4128
4058
|
*/
|
|
4129
4059
|
componentStack?: string | null;
|
|
4060
|
+
digest?: string | null;
|
|
4130
4061
|
}
|
|
4131
4062
|
|
|
4132
4063
|
// Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared,
|
|
6
6
|
|
|
7
|
-
import React = require("https://esm.sh/@types/react@19.2.
|
|
7
|
+
import React = require("https://esm.sh/@types/react@19.2.3/index.d.ts");
|
|
8
8
|
|
|
9
9
|
export {};
|
|
10
10
|
|
|
@@ -202,6 +202,10 @@ function buildAttachmentContextPart(
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
function hasUploadedFilesAnnotation(parts: StructuredProviderPart[]): boolean {
|
|
206
|
+
return parts.some((part) => part.type === "text" && part.text.includes("<uploaded_files>"));
|
|
207
|
+
}
|
|
208
|
+
|
|
205
209
|
function convertContentToAgentRuntimeParts(
|
|
206
210
|
message: ProviderModelMessage,
|
|
207
211
|
): AgentRuntimeMessage["parts"] {
|
|
@@ -217,7 +221,6 @@ function convertContentToAgentRuntimeParts(
|
|
|
217
221
|
const convertedPart = convertStructuredPart(part);
|
|
218
222
|
if (convertedPart) {
|
|
219
223
|
parts.push(convertedPart);
|
|
220
|
-
continue;
|
|
221
224
|
}
|
|
222
225
|
|
|
223
226
|
if (part.type === "image" || part.type === "file") {
|
|
@@ -229,7 +232,9 @@ function convertContentToAgentRuntimeParts(
|
|
|
229
232
|
}
|
|
230
233
|
}
|
|
231
234
|
|
|
232
|
-
const attachmentContextPart =
|
|
235
|
+
const attachmentContextPart = hasUploadedFilesAnnotation(message.content)
|
|
236
|
+
? null
|
|
237
|
+
: buildAttachmentContextPart(attachmentReferences);
|
|
233
238
|
if (attachmentContextPart) {
|
|
234
239
|
parts.push(attachmentContextPart);
|
|
235
240
|
}
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
TextGenerationRuntimeToolCallPart,
|
|
15
15
|
TextGenerationRuntimeToolMessage,
|
|
16
16
|
} from "./text-generation-runtime-message-types.js";
|
|
17
|
+
import { buildDataFileAnnotation } from "../../chat/types.js";
|
|
17
18
|
import {
|
|
18
19
|
getTextFromParts,
|
|
19
20
|
getToolArguments,
|
|
@@ -22,6 +23,58 @@ import {
|
|
|
22
23
|
type ToolResultPart,
|
|
23
24
|
} from "../types.js";
|
|
24
25
|
|
|
26
|
+
function getStringPartField(part: unknown, key: string): string | undefined {
|
|
27
|
+
if (!part || typeof part !== "object" || Array.isArray(part)) return undefined;
|
|
28
|
+
|
|
29
|
+
const value = (part as Record<string, unknown>)[key];
|
|
30
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function buildAttachmentContextFromParts(parts: Message["parts"]): string {
|
|
34
|
+
const refs = parts.flatMap((part) => {
|
|
35
|
+
const type = getStringPartField(part, "type");
|
|
36
|
+
if (type !== "file" && type !== "image") return [];
|
|
37
|
+
|
|
38
|
+
const mediaType = getStringPartField(part, "mediaType");
|
|
39
|
+
if (!mediaType) return [];
|
|
40
|
+
|
|
41
|
+
const uploadId = getStringPartField(part, "uploadId");
|
|
42
|
+
const uploadPath = getStringPartField(part, "uploadPath");
|
|
43
|
+
const url = getStringPartField(part, "url");
|
|
44
|
+
|
|
45
|
+
return [{
|
|
46
|
+
name: getStringPartField(part, "filename") ?? (type === "image" ? "image" : "file"),
|
|
47
|
+
mediaType,
|
|
48
|
+
...(uploadId ? { uploadId } : {}),
|
|
49
|
+
...(uploadPath ? { path: uploadPath } : {}),
|
|
50
|
+
...(url ? { url } : {}),
|
|
51
|
+
}];
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return refs.length > 0 ? buildDataFileAnnotation(refs) : "";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function appendReadableAttachmentContext(text: string, attachmentContext: string): string {
|
|
58
|
+
const normalizedContext = attachmentContext.trimStart();
|
|
59
|
+
if (!normalizedContext) {
|
|
60
|
+
return text;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (text.length === 0) {
|
|
64
|
+
return normalizedContext;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const separator = text.endsWith("\n\n") ? "" : text.endsWith("\n") ? "\n" : "\n\n";
|
|
68
|
+
return `${text}${separator}${normalizedContext}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function getUserTextWithAttachmentContext(parts: Message["parts"]): string {
|
|
72
|
+
const text = getTextFromParts(parts);
|
|
73
|
+
return text.includes("<uploaded_files>")
|
|
74
|
+
? text
|
|
75
|
+
: appendReadableAttachmentContext(text, buildAttachmentContextFromParts(parts));
|
|
76
|
+
}
|
|
77
|
+
|
|
25
78
|
/**
|
|
26
79
|
* Convert a veryfront Message to the current text-generation runtime message format.
|
|
27
80
|
*/
|
|
@@ -33,7 +86,7 @@ export function convertToTextGenerationRuntimeMessage(msg: Message): TextGenerat
|
|
|
33
86
|
}
|
|
34
87
|
|
|
35
88
|
case "user": {
|
|
36
|
-
const text =
|
|
89
|
+
const text = getUserTextWithAttachmentContext(msg.parts);
|
|
37
90
|
return { role: "user", content: text };
|
|
38
91
|
}
|
|
39
92
|
|