veryfront 0.1.407 → 0.1.408

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.407",
3
+ "version": "0.1.408",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -22,6 +22,14 @@ type AgentRuntimeMessageLikePart = {
22
22
  toolCallId: string;
23
23
  toolName: string;
24
24
  output: unknown;
25
+ } | {
26
+ type: "image";
27
+ url: string;
28
+ mediaType: string;
29
+ } | {
30
+ type: "file";
31
+ url: string;
32
+ mediaType: string;
25
33
  };
26
34
  export type AgentRuntimeMessagePart = {
27
35
  type: "text";
@@ -36,6 +44,14 @@ export type AgentRuntimeMessagePart = {
36
44
  toolCallId: string;
37
45
  toolName: string;
38
46
  result: unknown;
47
+ } | {
48
+ type: "image";
49
+ url: string;
50
+ mediaType: string;
51
+ } | {
52
+ type: "file";
53
+ url: string;
54
+ mediaType: string;
39
55
  };
40
56
  export interface AgentRuntimeMessage {
41
57
  id: string;
@@ -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,EAEL,KAAK,kBAAkB,EACvB,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,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24
24
  return hasTextContent(text) ? { type: "text", text } : null;
25
25
  }
26
+ function toNativeFilePart(type, part) {
27
+ const url = getOptionalStringField(part, "url");
28
+ const mediaType = getOptionalStringField(part, "mediaType");
29
+ if (!url || url.startsWith("data:") || !mediaType) {
30
+ return null;
31
+ }
32
+ return type === "file"
33
+ ? { type: "file", url, mediaType }
34
+ : { type: "image", url, mediaType };
35
+ }
26
36
  function convertStructuredPart(part) {
27
37
  switch (part.type) {
28
38
  case "text":
@@ -45,7 +55,7 @@ function convertStructuredPart(part) {
45
55
  };
46
56
  case "image":
47
57
  case "file":
48
- return null;
58
+ return toNativeFilePart(part.type, part);
49
59
  default: {
50
60
  const exhaustiveCheck = part;
51
61
  throw new AgentRuntimeMessageConversionError(`Unsupported agent runtime message part: ${String(exhaustiveCheck)}`);
@@ -87,6 +97,11 @@ function convertContentToAgentRuntimeParts(message) {
87
97
  const parts = [];
88
98
  const attachmentReferences = [];
89
99
  for (const part of message.content) {
100
+ const convertedPart = convertStructuredPart(part);
101
+ if (convertedPart) {
102
+ parts.push(convertedPart);
103
+ continue;
104
+ }
90
105
  if (part.type === "image" || part.type === "file") {
91
106
  const attachmentReference = createAttachmentReference(part);
92
107
  if (attachmentReference) {
@@ -94,10 +109,6 @@ function convertContentToAgentRuntimeParts(message) {
94
109
  }
95
110
  continue;
96
111
  }
97
- const convertedPart = convertStructuredPart(part);
98
- if (convertedPart) {
99
- parts.push(convertedPart);
100
- }
101
112
  }
102
113
  const attachmentContextPart = buildAttachmentContextPart(attachmentReferences);
103
114
  if (attachmentContextPart) {
@@ -179,12 +190,20 @@ function collectAgentRuntimeProviderContentParts(parts) {
179
190
  const textParts = [];
180
191
  const toolCallParts = [];
181
192
  const toolResultParts = [];
193
+ const fileParts = [];
182
194
  for (const part of parts) {
183
195
  const textPart = getAgentRuntimeTextPart(part);
184
196
  if (textPart) {
185
197
  textParts.push(textPart);
186
198
  continue;
187
199
  }
200
+ if (part.type === "image" || part.type === "file") {
201
+ const nativePart = toNativeFilePart(part.type, part);
202
+ if (nativePart) {
203
+ fileParts.push(nativePart);
204
+ continue;
205
+ }
206
+ }
188
207
  const toolResultPart = getAgentRuntimeToolResultPart(part);
189
208
  if (toolResultPart) {
190
209
  toolResultParts.push(createToolResultPart(toolResultPart));
@@ -200,10 +219,10 @@ function collectAgentRuntimeProviderContentParts(parts) {
200
219
  });
201
220
  }
202
221
  }
203
- return { textParts, toolCallParts, toolResultParts };
222
+ return { textParts, toolCallParts, toolResultParts, fileParts };
204
223
  }
205
224
  function createProviderMessageFromAgentRuntimeMessage(message) {
206
- const { textParts, toolCallParts, toolResultParts } = collectAgentRuntimeProviderContentParts(message.parts);
225
+ const { textParts, toolCallParts, toolResultParts, fileParts } = collectAgentRuntimeProviderContentParts(message.parts);
207
226
  switch (message.role) {
208
227
  case "assistant":
209
228
  if (textParts.length === 0 && toolCallParts.length === 0) {
@@ -222,12 +241,19 @@ function createProviderMessageFromAgentRuntimeMessage(message) {
222
241
  content: toolResultParts,
223
242
  };
224
243
  case "user": {
225
- if (textParts.length === 0) {
244
+ if (textParts.length === 0 && fileParts.length === 0) {
226
245
  return null;
227
246
  }
247
+ if (fileParts.length === 0) {
248
+ return {
249
+ role: "user",
250
+ content: joinTextParts(textParts),
251
+ };
252
+ }
253
+ const content = [...textParts, ...fileParts];
228
254
  return {
229
255
  role: "user",
230
- content: joinTextParts(textParts),
256
+ content,
231
257
  };
232
258
  }
233
259
  case "system": {
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-child-fork-step-message-preparation.d.ts","sourceRoot":"","sources":["../../../src/src/agent/hosted-child-fork-step-message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAe,MAAM,oBAAoB,CAAC;AAE/E,MAAM,MAAM,wCAAwC,GAAG,CAAC,KAAK,EAAE;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACpD,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhC,MAAM,MAAM,8CAA8C,GAAG;IAC3D,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,wCAAwC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA6BF,wBAAgB,0DAA0D,CACxE,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,GACjD,YAAY,EAAE,CAOhB;AAED,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,8CAA8C,GACpD,kCAAkC,CAepC"}
1
+ {"version":3,"file":"hosted-child-fork-step-message-preparation.d.ts","sourceRoot":"","sources":["../../../src/src/agent/hosted-child-fork-step-message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAe,MAAM,oBAAoB,CAAC;AAE/E,MAAM,MAAM,wCAAwC,GAAG,CAAC,KAAK,EAAE;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACpD,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhC,MAAM,MAAM,8CAA8C,GAAG;IAC3D,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,wCAAwC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAyCF,wBAAgB,0DAA0D,CACxE,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,GACjD,YAAY,EAAE,CAOhB;AAED,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,8CAA8C,GACpD,kCAAkC,CAepC"}
@@ -15,12 +15,20 @@ function convertAgentRuntimePartToChildForkMessagePart(part) {
15
15
  result: part.result,
16
16
  };
17
17
  }
18
- return {
19
- type: `tool-${part.toolName}`,
20
- toolCallId: part.toolCallId,
21
- toolName: part.toolName,
22
- args: part.args,
23
- };
18
+ if ("toolCallId" in part) {
19
+ return {
20
+ type: `tool-${part.toolName}`,
21
+ toolCallId: part.toolCallId,
22
+ toolName: part.toolName,
23
+ args: part.args,
24
+ };
25
+ }
26
+ // image/file parts have no equivalent in the child-fork AgentMessage schema — render as a placeholder
27
+ if (part.type === "image" || part.type === "file") {
28
+ return { type: "text", text: `[file: ${part.mediaType}]` };
29
+ }
30
+ const _exhaustive = part;
31
+ throw new Error(`Unhandled AgentRuntimeMessagePart type: ${String(_exhaustive.type)}`);
24
32
  }
25
33
  export function convertCompactedProviderMessagesToChildForkRuntimeMessages(compactedMessages) {
26
34
  return convertProviderMessagesToAgentRuntimeMessages(compactedMessages).map((message) => ({
@@ -87,6 +87,14 @@ export declare const MessagePartSchema: z.ZodUnion<readonly [z.ZodObject<{
87
87
  toolCallId: z.ZodString;
88
88
  toolName: z.ZodString;
89
89
  result: z.ZodUnknown;
90
+ }, z.core.$strip>, z.ZodObject<{
91
+ type: z.ZodLiteral<"image">;
92
+ url: z.ZodString;
93
+ mediaType: z.ZodString;
94
+ }, z.core.$strip>, z.ZodObject<{
95
+ type: z.ZodLiteral<"file">;
96
+ url: z.ZodString;
97
+ mediaType: z.ZodString;
90
98
  }, z.core.$strip>]>;
91
99
  export declare const MessageSchema: z.ZodObject<{
92
100
  id: z.ZodString;
@@ -121,6 +129,14 @@ export declare const MessageSchema: z.ZodObject<{
121
129
  toolCallId: z.ZodString;
122
130
  toolName: z.ZodString;
123
131
  result: z.ZodUnknown;
132
+ }, z.core.$strip>, z.ZodObject<{
133
+ type: z.ZodLiteral<"image">;
134
+ url: z.ZodString;
135
+ mediaType: z.ZodString;
136
+ }, z.core.$strip>, z.ZodObject<{
137
+ type: z.ZodLiteral<"file">;
138
+ url: z.ZodString;
139
+ mediaType: z.ZodString;
124
140
  }, z.core.$strip>]>>;
125
141
  timestamp: z.ZodOptional<z.ZodNumber>;
126
142
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -180,6 +196,14 @@ export declare const AgentResponseSchema: z.ZodObject<{
180
196
  toolCallId: z.ZodString;
181
197
  toolName: z.ZodString;
182
198
  result: z.ZodUnknown;
199
+ }, z.core.$strip>, z.ZodObject<{
200
+ type: z.ZodLiteral<"image">;
201
+ url: z.ZodString;
202
+ mediaType: z.ZodString;
203
+ }, z.core.$strip>, z.ZodObject<{
204
+ type: z.ZodLiteral<"file">;
205
+ url: z.ZodString;
206
+ mediaType: z.ZodString;
183
207
  }, z.core.$strip>]>>;
184
208
  timestamp: z.ZodOptional<z.ZodNumber>;
185
209
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -251,6 +275,14 @@ export declare const AgentContextSchema: z.ZodObject<{
251
275
  toolCallId: z.ZodString;
252
276
  toolName: z.ZodString;
253
277
  result: z.ZodUnknown;
278
+ }, z.core.$strip>, z.ZodObject<{
279
+ type: z.ZodLiteral<"image">;
280
+ url: z.ZodString;
281
+ mediaType: z.ZodString;
282
+ }, z.core.$strip>, z.ZodObject<{
283
+ type: z.ZodLiteral<"file">;
284
+ url: z.ZodString;
285
+ mediaType: z.ZodString;
254
286
  }, z.core.$strip>]>>;
255
287
  timestamp: z.ZodOptional<z.ZodNumber>;
256
288
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1 +1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AO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -56,6 +56,16 @@ export const MessagePartSchema = z.union([
56
56
  args: z.record(z.string(), z.unknown()),
57
57
  }),
58
58
  ToolResultPartSchema,
59
+ z.object({
60
+ type: z.literal("image"),
61
+ url: z.string(),
62
+ mediaType: z.string(),
63
+ }),
64
+ z.object({
65
+ type: z.literal("file"),
66
+ url: z.string(),
67
+ mediaType: z.string(),
68
+ }),
59
69
  ]);
60
70
  export const MessageSchema = z.object({
61
71
  id: z.string(),
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.407";
1
+ export declare const VERSION = "0.1.408";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.407";
3
+ export const VERSION = "0.1.408";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.407",
3
+ "version": "0.1.408",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.407",
3
+ "version": "0.1.408",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -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.3/index.d.ts");
7
+ import React = require("https://esm.sh/@types/react@19.2.14/index.d.ts");
8
8
 
9
9
  export {};
10
10
 
@@ -18,6 +18,7 @@ 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 {}
21
22
  interface ToggleEvent extends Event {}
22
23
  interface TransitionEvent extends Event {}
23
24
  interface UIEvent extends Event {}
@@ -16,6 +16,7 @@ type NativeKeyboardEvent = KeyboardEvent;
16
16
  type NativeMouseEvent = MouseEvent;
17
17
  type NativeTouchEvent = TouchEvent;
18
18
  type NativePointerEvent = PointerEvent;
19
+ type NativeSubmitEvent = SubmitEvent;
19
20
  type NativeToggleEvent = ToggleEvent;
20
21
  type NativeTransitionEvent = TransitionEvent;
21
22
  type NativeUIEvent = UIEvent;
@@ -225,12 +226,20 @@ declare namespace React {
225
226
 
226
227
  type ComponentState = any;
227
228
 
229
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {}
230
+
228
231
  /**
229
232
  * A value which uniquely identifies a node among items in an array.
230
233
  *
231
234
  * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs}
232
235
  */
233
- type Key = string | number | bigint;
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
+ ];
234
243
 
235
244
  /**
236
245
  * @internal The props any component can receive.
@@ -1884,7 +1893,7 @@ declare namespace React {
1884
1893
  *
1885
1894
  * @param callback A synchronous, void callback that will execute as a single, complete React commit.
1886
1895
  *
1887
- * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
1896
+ * @see {@link https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks}
1888
1897
  */
1889
1898
  // NOTES
1890
1899
  // - the order of these signatures matters - typescript will check the signatures in source order.
@@ -1926,7 +1935,31 @@ declare namespace React {
1926
1935
  reducer: (state: State, action: Action) => State,
1927
1936
  ): [State, (action: Action) => void];
1928
1937
 
1929
- export type Usable<T> = PromiseLike<T> | Context<T>;
1938
+ interface UntrackedReactPromise<T> extends PromiseLike<T> {
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>;
1930
1963
 
1931
1964
  export function use<T>(usable: Usable<T>): T;
1932
1965
 
@@ -2041,15 +2074,28 @@ declare namespace React {
2041
2074
  target: EventTarget & Target;
2042
2075
  }
2043
2076
 
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
+ */
2044
2082
  interface FormEvent<T = Element> extends SyntheticEvent<T> {
2045
2083
  }
2046
2084
 
2047
2085
  interface InvalidEvent<T = Element> extends SyntheticEvent<T> {
2048
- target: EventTarget & T;
2049
2086
  }
2050
2087
 
2051
- interface ChangeEvent<T = Element> extends SyntheticEvent<T> {
2052
- target: EventTarget & T;
2088
+ /**
2089
+ * change events bubble in React so their target is generally unknown.
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;
2053
2099
  }
2054
2100
 
2055
2101
  interface InputEvent<T = Element> extends SyntheticEvent<T, NativeInputEvent> {
@@ -2119,6 +2165,13 @@ declare namespace React {
2119
2165
  shiftKey: boolean;
2120
2166
  }
2121
2167
 
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
+
2122
2175
  interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> {
2123
2176
  altKey: boolean;
2124
2177
  changedTouches: TouchList;
@@ -2174,11 +2227,19 @@ declare namespace React {
2174
2227
  type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
2175
2228
  type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
2176
2229
  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
+ */
2177
2235
  type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
2178
- type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
2236
+ type ChangeEventHandler<CurrentTarget = Element, Target = Element> = EventHandler<
2237
+ ChangeEvent<CurrentTarget, Target>
2238
+ >;
2179
2239
  type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
2180
2240
  type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
2181
2241
  type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
2242
+ type SubmitEventHandler<T = Element> = EventHandler<SubmitEvent<T>>;
2182
2243
  type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
2183
2244
  type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
2184
2245
  type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
@@ -2232,19 +2293,19 @@ declare namespace React {
2232
2293
  onBlur?: FocusEventHandler<T> | undefined;
2233
2294
  onBlurCapture?: FocusEventHandler<T> | undefined;
2234
2295
 
2235
- // Form Events
2236
- onChange?: FormEventHandler<T> | undefined;
2237
- onChangeCapture?: FormEventHandler<T> | undefined;
2296
+ // form related Events
2297
+ onChange?: ChangeEventHandler<T> | undefined;
2298
+ onChangeCapture?: ChangeEventHandler<T> | undefined;
2238
2299
  onBeforeInput?: InputEventHandler<T> | undefined;
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;
2300
+ onBeforeInputCapture?: InputEventHandler<T> | undefined;
2301
+ onInput?: InputEventHandler<T> | undefined;
2302
+ onInputCapture?: InputEventHandler<T> | undefined;
2303
+ onReset?: ReactEventHandler<T> | undefined;
2304
+ onResetCapture?: ReactEventHandler<T> | undefined;
2305
+ onSubmit?: SubmitEventHandler<T> | undefined;
2306
+ onSubmitCapture?: SubmitEventHandler<T> | undefined;
2307
+ onInvalid?: ReactEventHandler<T> | undefined;
2308
+ onInvalidCapture?: ReactEventHandler<T> | undefined;
2248
2309
 
2249
2310
  // Image Events
2250
2311
  onLoad?: ReactEventHandler<T> | undefined;
@@ -2788,7 +2849,7 @@ declare namespace React {
2788
2849
 
2789
2850
  // Living Standard
2790
2851
  /**
2791
- * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
2852
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert}
2792
2853
  */
2793
2854
  inert?: boolean | undefined;
2794
2855
  /**
@@ -3251,7 +3312,9 @@ declare namespace React {
3251
3312
  value?: string | readonly string[] | number | undefined;
3252
3313
  width?: number | string | undefined;
3253
3314
 
3254
- onChange?: ChangeEventHandler<T> | undefined;
3315
+ // No other element dispatching change events can be nested in a <input>
3316
+ // so we know the target will be a HTMLInputElement.
3317
+ onChange?: ChangeEventHandler<T, HTMLInputElement> | undefined;
3255
3318
  }
3256
3319
 
3257
3320
  interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3416,7 +3479,9 @@ declare namespace React {
3416
3479
  required?: boolean | undefined;
3417
3480
  size?: number | undefined;
3418
3481
  value?: string | readonly string[] | number | undefined;
3419
- onChange?: ChangeEventHandler<T> | undefined;
3482
+ // No other element dispatching change events can be nested in a <select>
3483
+ // so we know the target will be a HTMLSelectElement.
3484
+ onChange?: ChangeEventHandler<T, HTMLSelectElement> | undefined;
3420
3485
  }
3421
3486
 
3422
3487
  interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3468,7 +3533,9 @@ declare namespace React {
3468
3533
  value?: string | readonly string[] | number | undefined;
3469
3534
  wrap?: string | undefined;
3470
3535
 
3471
- onChange?: ChangeEventHandler<T> | undefined;
3536
+ // No other element dispatching change events can be nested in a <textarea>
3537
+ // so we know the target will be a HTMLTextAreaElement.
3538
+ onChange?: ChangeEventHandler<T, HTMLTextAreaElement> | undefined;
3472
3539
  }
3473
3540
 
3474
3541
  interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -3540,6 +3607,9 @@ declare namespace React {
3540
3607
  method?: string | undefined;
3541
3608
  min?: number | string | undefined;
3542
3609
  name?: string | undefined;
3610
+ nonce?: string | undefined;
3611
+ part?: string | undefined;
3612
+ slot?: string | undefined;
3543
3613
  style?: CSSProperties | undefined;
3544
3614
  target?: string | undefined;
3545
3615
  type?: string | undefined;
@@ -4057,7 +4127,6 @@ declare namespace React {
4057
4127
  * Captures which component contained the exception, and its ancestors.
4058
4128
  */
4059
4129
  componentStack?: string | null;
4060
- digest?: string | null;
4061
4130
  }
4062
4131
 
4063
4132
  // 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.3/index.d.ts");
7
+ import React = require("https://esm.sh/@types/react@19.2.14/index.d.ts");
8
8
 
9
9
  export {};
10
10
 
@@ -1,7 +1,9 @@
1
1
  import { isRecord } from "../chat/conversation.js";
2
2
  import {
3
3
  buildDataFileAnnotation,
4
+ type ChatModelFilePart,
4
5
  type ChatToolResultPart,
6
+ type ChatUserContentPart,
5
7
  type ProviderModelMessage,
6
8
  type UploadedFileReference,
7
9
  } from "../chat/types.js";
@@ -36,7 +38,9 @@ type AgentRuntimeMessageLikePart =
36
38
  toolCallId: string;
37
39
  toolName: string;
38
40
  output: unknown;
39
- };
41
+ }
42
+ | { type: "image"; url: string; mediaType: string }
43
+ | { type: "file"; url: string; mediaType: string };
40
44
 
41
45
  export type AgentRuntimeMessagePart =
42
46
  | { type: "text"; text: string }
@@ -51,7 +55,9 @@ export type AgentRuntimeMessagePart =
51
55
  toolCallId: string;
52
56
  toolName: string;
53
57
  result: unknown;
54
- };
58
+ }
59
+ | { type: "image"; url: string; mediaType: string }
60
+ | { type: "file"; url: string; mediaType: string };
55
61
 
56
62
  export interface AgentRuntimeMessage {
57
63
  id: string;
@@ -64,6 +70,7 @@ interface AgentRuntimeProviderContentParts {
64
70
  textParts: ProviderTextPart[];
65
71
  toolCallParts: ProviderToolCallPart[];
66
72
  toolResultParts: ChatToolResultPart[];
73
+ fileParts: ChatModelFilePart[];
67
74
  }
68
75
 
69
76
  type ProviderTextPart = { type: "text"; text: string };
@@ -103,6 +110,24 @@ function createTextAgentRuntimePart(text: string): AgentRuntimeMessagePart | nul
103
110
  return hasTextContent(text) ? { type: "text", text } : null;
104
111
  }
105
112
 
113
+ function toNativeFilePart(
114
+ type: "image" | "file",
115
+ part: unknown,
116
+ ): { type: "image"; url: string; mediaType: string } | {
117
+ type: "file";
118
+ url: string;
119
+ mediaType: string;
120
+ } | null {
121
+ const url = getOptionalStringField(part, "url");
122
+ const mediaType = getOptionalStringField(part, "mediaType");
123
+ if (!url || url.startsWith("data:") || !mediaType) {
124
+ return null;
125
+ }
126
+ return type === "file"
127
+ ? { type: "file" as const, url, mediaType }
128
+ : { type: "image" as const, url, mediaType };
129
+ }
130
+
106
131
  function convertStructuredPart(part: StructuredProviderPart): AgentRuntimeMessagePart | null {
107
132
  switch (part.type) {
108
133
  case "text":
@@ -129,7 +154,7 @@ function convertStructuredPart(part: StructuredProviderPart): AgentRuntimeMessag
129
154
 
130
155
  case "image":
131
156
  case "file":
132
- return null;
157
+ return toNativeFilePart(part.type, part);
133
158
 
134
159
  default: {
135
160
  const exhaustiveCheck: never = part;
@@ -189,6 +214,12 @@ function convertContentToAgentRuntimeParts(
189
214
  const attachmentReferences: UploadedFileReference[] = [];
190
215
 
191
216
  for (const part of message.content) {
217
+ const convertedPart = convertStructuredPart(part);
218
+ if (convertedPart) {
219
+ parts.push(convertedPart);
220
+ continue;
221
+ }
222
+
192
223
  if (part.type === "image" || part.type === "file") {
193
224
  const attachmentReference = createAttachmentReference(part);
194
225
  if (attachmentReference) {
@@ -196,11 +227,6 @@ function convertContentToAgentRuntimeParts(
196
227
  }
197
228
  continue;
198
229
  }
199
-
200
- const convertedPart = convertStructuredPart(part);
201
- if (convertedPart) {
202
- parts.push(convertedPart);
203
- }
204
230
  }
205
231
 
206
232
  const attachmentContextPart = buildAttachmentContextPart(attachmentReferences);
@@ -313,6 +339,7 @@ function collectAgentRuntimeProviderContentParts(
313
339
  const textParts: ProviderTextPart[] = [];
314
340
  const toolCallParts: ProviderToolCallPart[] = [];
315
341
  const toolResultParts: ChatToolResultPart[] = [];
342
+ const fileParts: ChatModelFilePart[] = [];
316
343
 
317
344
  for (const part of parts) {
318
345
  const textPart = getAgentRuntimeTextPart(part);
@@ -321,6 +348,14 @@ function collectAgentRuntimeProviderContentParts(
321
348
  continue;
322
349
  }
323
350
 
351
+ if (part.type === "image" || part.type === "file") {
352
+ const nativePart = toNativeFilePart(part.type, part);
353
+ if (nativePart) {
354
+ fileParts.push(nativePart);
355
+ continue;
356
+ }
357
+ }
358
+
324
359
  const toolResultPart = getAgentRuntimeToolResultPart(part);
325
360
  if (toolResultPart) {
326
361
  toolResultParts.push(createToolResultPart(toolResultPart));
@@ -338,7 +373,7 @@ function collectAgentRuntimeProviderContentParts(
338
373
  }
339
374
  }
340
375
 
341
- return { textParts, toolCallParts, toolResultParts };
376
+ return { textParts, toolCallParts, toolResultParts, fileParts };
342
377
  }
343
378
 
344
379
  function createProviderMessageFromAgentRuntimeMessage(
@@ -346,9 +381,8 @@ function createProviderMessageFromAgentRuntimeMessage(
346
381
  parts: ReadonlyArray<AgentRuntimeMessageLikePart>;
347
382
  },
348
383
  ): ProviderModelMessage | null {
349
- const { textParts, toolCallParts, toolResultParts } = collectAgentRuntimeProviderContentParts(
350
- message.parts,
351
- );
384
+ const { textParts, toolCallParts, toolResultParts, fileParts } =
385
+ collectAgentRuntimeProviderContentParts(message.parts);
352
386
 
353
387
  switch (message.role) {
354
388
  case "assistant":
@@ -372,13 +406,21 @@ function createProviderMessageFromAgentRuntimeMessage(
372
406
  };
373
407
 
374
408
  case "user": {
375
- if (textParts.length === 0) {
409
+ if (textParts.length === 0 && fileParts.length === 0) {
376
410
  return null;
377
411
  }
378
412
 
413
+ if (fileParts.length === 0) {
414
+ return {
415
+ role: "user",
416
+ content: joinTextParts(textParts),
417
+ };
418
+ }
419
+
420
+ const content: ChatUserContentPart[] = [...textParts, ...fileParts];
379
421
  return {
380
422
  role: "user",
381
- content: joinTextParts(textParts),
423
+ content,
382
424
  };
383
425
  }
384
426
 
@@ -43,12 +43,24 @@ function convertAgentRuntimePartToChildForkMessagePart(
43
43
  };
44
44
  }
45
45
 
46
- return {
47
- type: `tool-${part.toolName}`,
48
- toolCallId: part.toolCallId,
49
- toolName: part.toolName,
50
- args: part.args,
51
- };
46
+ if ("toolCallId" in part) {
47
+ return {
48
+ type: `tool-${part.toolName}`,
49
+ toolCallId: part.toolCallId,
50
+ toolName: part.toolName,
51
+ args: part.args,
52
+ };
53
+ }
54
+
55
+ // image/file parts have no equivalent in the child-fork AgentMessage schema — render as a placeholder
56
+ if (part.type === "image" || part.type === "file") {
57
+ return { type: "text", text: `[file: ${part.mediaType}]` };
58
+ }
59
+
60
+ const _exhaustive: never = part;
61
+ throw new Error(
62
+ `Unhandled AgentRuntimeMessagePart type: ${String((_exhaustive as { type: unknown }).type)}`,
63
+ );
52
64
  }
53
65
 
54
66
  export function convertCompactedProviderMessagesToChildForkRuntimeMessages(
@@ -65,6 +65,16 @@ export const MessagePartSchema = z.union([
65
65
  args: z.record(z.string(), z.unknown()),
66
66
  }),
67
67
  ToolResultPartSchema,
68
+ z.object({
69
+ type: z.literal("image"),
70
+ url: z.string(),
71
+ mediaType: z.string(),
72
+ }),
73
+ z.object({
74
+ type: z.literal("file"),
75
+ url: z.string(),
76
+ mediaType: z.string(),
77
+ }),
68
78
  ]);
69
79
 
70
80
  export const MessageSchema = z.object({
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.407";
3
+ export const VERSION = "0.1.408";