veryfront 0.1.342 → 0.1.343

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.
Files changed (38) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/agent/runtime/index.js +3 -3
  3. package/esm/src/agent/runtime/runtime-tool-types.d.ts +2 -2
  4. package/esm/src/agent/runtime/runtime-tool-types.d.ts.map +1 -1
  5. package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts +19 -0
  6. package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts.map +1 -0
  7. package/esm/src/agent/runtime/{model-message-converter.js → text-generation-runtime-message-converter.js} +18 -15
  8. package/esm/src/agent/runtime/text-generation-runtime-message-types.d.ts +44 -0
  9. package/esm/src/agent/runtime/text-generation-runtime-message-types.d.ts.map +1 -0
  10. package/esm/src/agent/runtime/{model-runtime-types.js → text-generation-runtime-message-types.js} +1 -1
  11. package/esm/src/chat/conversation.d.ts +7 -3
  12. package/esm/src/chat/conversation.d.ts.map +1 -1
  13. package/esm/src/chat/conversation.js +5 -1
  14. package/esm/src/chat/message-prep.d.ts +19 -12
  15. package/esm/src/chat/message-prep.d.ts.map +1 -1
  16. package/esm/src/chat/message-prep.js +14 -7
  17. package/esm/src/chat/types.d.ts +3 -0
  18. package/esm/src/chat/types.d.ts.map +1 -1
  19. package/esm/src/runtime/runtime-bridge.d.ts +3 -3
  20. package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
  21. package/esm/src/utils/version-constant.d.ts +1 -1
  22. package/esm/src/utils/version-constant.js +1 -1
  23. package/package.json +1 -1
  24. package/src/deno.js +1 -1
  25. package/src/src/agent/runtime/index.ts +3 -3
  26. package/src/src/agent/runtime/runtime-tool-types.ts +2 -2
  27. package/src/src/agent/runtime/{model-message-converter.ts → text-generation-runtime-message-converter.ts} +33 -25
  28. package/src/src/agent/runtime/text-generation-runtime-message-types.ts +55 -0
  29. package/src/src/chat/conversation.ts +14 -7
  30. package/src/src/chat/message-prep.ts +39 -27
  31. package/src/src/chat/types.ts +3 -0
  32. package/src/src/runtime/runtime-bridge.ts +4 -4
  33. package/src/src/utils/version-constant.ts +1 -1
  34. package/esm/src/agent/runtime/model-message-converter.d.ts +0 -19
  35. package/esm/src/agent/runtime/model-message-converter.d.ts.map +0 -1
  36. package/esm/src/agent/runtime/model-runtime-types.d.ts +0 -44
  37. package/esm/src/agent/runtime/model-runtime-types.d.ts.map +0 -1
  38. package/src/src/agent/runtime/model-runtime-types.ts +0 -55
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.342",
3
+ "version": "0.1.343",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -17,7 +17,7 @@ import { detectPlatform, getPlatformCapabilities } from "../../platform/core-pla
17
17
  import { createMemory } from "../memory/index.js";
18
18
  import { serverLogger } from "../../utils/index.js";
19
19
  import { addSpanEvent, setSpanAttributes, withSpan, } from "../../observability/tracing/index.js";
20
- import { convertToModelMessages } from "./model-message-converter.js";
20
+ import { convertToTextGenerationRuntimeMessages } from "./text-generation-runtime-message-converter.js";
21
21
  import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
22
22
  import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
23
23
  import { createStreamState, processStream, } from "./chat-stream-handler.js";
@@ -494,7 +494,7 @@ export class AgentRuntime {
494
494
  return generateText({
495
495
  model: languageModel,
496
496
  system: currentSystemPrompt,
497
- messages: convertToModelMessages(currentMessages),
497
+ messages: convertToTextGenerationRuntimeMessages(currentMessages),
498
498
  tools: convertToolsToRuntimeTools(tools, {
499
499
  model: effectiveModel,
500
500
  allowedToolNames: allowedRemoteToolNames,
@@ -696,7 +696,7 @@ export class AgentRuntime {
696
696
  const result = streamText({
697
697
  model: languageModel,
698
698
  system: currentSystemPrompt,
699
- messages: convertToModelMessages(currentMessages),
699
+ messages: convertToTextGenerationRuntimeMessages(currentMessages),
700
700
  tools: convertToolsToRuntimeTools(tools, {
701
701
  model: effectiveModel,
702
702
  allowedToolNames: allowedRemoteToolNames,
@@ -4,7 +4,7 @@
4
4
  * Framework-owned types for the current tool-calling and streaming runtime
5
5
  * boundary. These cover only the shapes the framework consumes today.
6
6
  */
7
- import type { ModelRuntimeMessage } from "./model-runtime-types.js";
7
+ import type { TextGenerationRuntimeMessage } from "./text-generation-runtime-message-types.js";
8
8
  export type RuntimeToolSet = Record<string, unknown>;
9
9
  export interface RuntimeGenerateToolCall {
10
10
  toolCallId: string;
@@ -39,7 +39,7 @@ export interface RuntimeRepairToolCall {
39
39
  export interface RuntimeToolCallRepairContext {
40
40
  error: unknown;
41
41
  inputSchema: (...args: unknown[]) => unknown;
42
- messages: ModelRuntimeMessage[];
42
+ messages: TextGenerationRuntimeMessage[];
43
43
  system?: string;
44
44
  toolCall: RuntimeRepairToolCall;
45
45
  tools: RuntimeToolSet;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-tool-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/runtime-tool-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACt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AAO,CAAC;CACnB,GACC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV,GACC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACnC"}
1
+ {"version":3,"file":"runtime-tool-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/runtime-tool-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE/F,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACtC,WAAW,CAAC,EAAE,yBAAyB,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,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;CACV,GACC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACnC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Text-Generation Runtime Message Converter
3
+ *
4
+ * Converts between veryfront's internal Message format and the current
5
+ * text-generation runtime message format.
6
+ *
7
+ * @module ai/agent/runtime/text-generation-runtime-message-converter
8
+ */
9
+ import type { TextGenerationRuntimeMessage } from "./text-generation-runtime-message-types.js";
10
+ import { type Message } from "../types.js";
11
+ /**
12
+ * Convert a veryfront Message to the current text-generation runtime message format.
13
+ */
14
+ export declare function convertToTextGenerationRuntimeMessage(msg: Message): TextGenerationRuntimeMessage;
15
+ /**
16
+ * Convert an array of veryfront Messages to the current text-generation runtime message format.
17
+ */
18
+ export declare function convertToTextGenerationRuntimeMessages(messages: Message[]): TextGenerationRuntimeMessage[];
19
+ //# sourceMappingURL=text-generation-runtime-message-converter.d.ts.map
@@ -0,0 +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;AACpD,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AAErB;;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"}
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Model Message Converter
2
+ * Text-Generation Runtime Message Converter
3
3
  *
4
4
  * Converts between veryfront's internal Message format and the current
5
- * model-runtime message format.
5
+ * text-generation runtime message format.
6
6
  *
7
- * @module ai/agent/runtime/model-message-converter
7
+ * @module ai/agent/runtime/text-generation-runtime-message-converter
8
8
  */
9
9
  import { getTextFromParts, getToolArguments, } from "../types.js";
10
10
  /**
11
- * Convert a veryfront Message to the current model-runtime message format.
11
+ * Convert a veryfront Message to the current text-generation runtime message format.
12
12
  */
13
- export function convertToModelMessage(msg) {
13
+ export function convertToTextGenerationRuntimeMessage(msg) {
14
14
  switch (msg.role) {
15
15
  case "system": {
16
16
  const text = getTextFromParts(msg.parts);
@@ -43,7 +43,10 @@ export function convertToModelMessage(msg) {
43
43
  if (content.length === 0) {
44
44
  content.push({ type: "text", text: "" });
45
45
  }
46
- const assistantMessage = { role: "assistant", content };
46
+ const assistantMessage = {
47
+ role: "assistant",
48
+ content,
49
+ };
47
50
  return assistantMessage;
48
51
  }
49
52
  case "tool": {
@@ -81,31 +84,31 @@ function convertToolResultPart(part) {
81
84
  };
82
85
  }
83
86
  /**
84
- * Convert an array of veryfront Messages to the current model-runtime message format.
87
+ * Convert an array of veryfront Messages to the current text-generation runtime message format.
85
88
  */
86
- export function convertToModelMessages(messages) {
87
- const modelMessages = [];
89
+ export function convertToTextGenerationRuntimeMessages(messages) {
90
+ const textGenerationRuntimeMessages = [];
88
91
  const toolResultMessageIndexes = new Map();
89
92
  for (const message of messages) {
90
93
  if (message.role !== "tool") {
91
- modelMessages.push(convertToModelMessage(message));
94
+ textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
92
95
  continue;
93
96
  }
94
97
  const toolResultParts = message.parts.filter((part) => part.type === "tool-result");
95
98
  if (toolResultParts.length === 0) {
96
- modelMessages.push(convertToModelMessage(message));
99
+ textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
97
100
  continue;
98
101
  }
99
102
  for (const toolResultPart of toolResultParts) {
100
103
  const toolResultMessage = convertToolResultPart(toolResultPart);
101
104
  const existingIndex = toolResultMessageIndexes.get(toolResultPart.toolCallId);
102
105
  if (existingIndex === undefined) {
103
- toolResultMessageIndexes.set(toolResultPart.toolCallId, modelMessages.length);
104
- modelMessages.push(toolResultMessage);
106
+ toolResultMessageIndexes.set(toolResultPart.toolCallId, textGenerationRuntimeMessages.length);
107
+ textGenerationRuntimeMessages.push(toolResultMessage);
105
108
  continue;
106
109
  }
107
- modelMessages[existingIndex] = toolResultMessage;
110
+ textGenerationRuntimeMessages[existingIndex] = toolResultMessage;
108
111
  }
109
112
  }
110
- return modelMessages;
113
+ return textGenerationRuntimeMessages;
111
114
  }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Text-Generation Runtime Message Types
3
+ *
4
+ * Framework-owned message types for the current text-generation runtime
5
+ * boundary. These describe the subset of message shapes the runtime uses
6
+ * today without exposing SDK-owned message contracts upward.
7
+ */
8
+ export interface TextGenerationRuntimeTextPart {
9
+ type: "text";
10
+ text: string;
11
+ }
12
+ export interface TextGenerationRuntimeToolCallPart {
13
+ type: "tool-call";
14
+ toolCallId: string;
15
+ toolName: string;
16
+ input: Record<string, unknown>;
17
+ }
18
+ export interface TextGenerationRuntimeToolResultPart {
19
+ type: "tool-result";
20
+ toolCallId: string;
21
+ toolName: string;
22
+ output: {
23
+ type: "json";
24
+ value: unknown;
25
+ };
26
+ }
27
+ export interface TextGenerationRuntimeSystemMessage {
28
+ role: "system";
29
+ content: string;
30
+ }
31
+ export interface TextGenerationRuntimeUserMessage {
32
+ role: "user";
33
+ content: string;
34
+ }
35
+ export interface TextGenerationRuntimeAssistantMessage {
36
+ role: "assistant";
37
+ content: Array<TextGenerationRuntimeTextPart | TextGenerationRuntimeToolCallPart>;
38
+ }
39
+ export interface TextGenerationRuntimeToolMessage {
40
+ role: "tool";
41
+ content: TextGenerationRuntimeToolResultPart[];
42
+ }
43
+ export type TextGenerationRuntimeMessage = TextGenerationRuntimeSystemMessage | TextGenerationRuntimeUserMessage | TextGenerationRuntimeAssistantMessage | TextGenerationRuntimeToolMessage;
44
+ //# sourceMappingURL=text-generation-runtime-message-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-generation-runtime-message-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/text-generation-runtime-message-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iCAAiC;IAChD,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,mCAAmC;IAClD,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qCAAqC;IACpD,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,6BAA6B,GAAG,iCAAiC,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,mCAAmC,EAAE,CAAC;CAChD;AAED,MAAM,MAAM,4BAA4B,GACpC,kCAAkC,GAClC,gCAAgC,GAChC,qCAAqC,GACrC,gCAAgC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Model Runtime Types
2
+ * Text-Generation Runtime Message Types
3
3
  *
4
4
  * Framework-owned message types for the current text-generation runtime
5
5
  * boundary. These describe the subset of message shapes the runtime uses
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { ChatModelMessage, ChatUiMessage, ChatUiMessagePart } from "./types.js";
2
+ import type { ChatUiMessage, ChatUiMessagePart, ProviderModelMessage } from "./types.js";
3
3
  export declare const messagePartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
4
  type: z.ZodLiteral<"text">;
5
5
  text: z.ZodString;
@@ -234,7 +234,11 @@ export declare function isToolCallPart(value: unknown): value is ToolCallLike;
234
234
  export declare function isToolResultPart(value: unknown): value is ToolResultLike;
235
235
  export declare function isTextPart(value: unknown): value is TextPartLike;
236
236
  export declare function isReasoningPart(value: unknown): value is ReasoningPartLike;
237
- export declare function extractTextFromMessage(message: ChatModelMessage): string;
238
- export declare function convertUiMessagesToModelMessages(messages: ChatUiMessage[]): ChatModelMessage[];
237
+ export declare function extractTextFromMessage(message: ProviderModelMessage): string;
238
+ export declare function convertUiMessagesToProviderModelMessages(messages: ChatUiMessage[]): ProviderModelMessage[];
239
+ /**
240
+ * @deprecated Use convertUiMessagesToProviderModelMessages for provider-facing model payloads.
241
+ */
242
+ export declare const convertUiMessagesToModelMessages: typeof convertUiMessagesToProviderModelMessages;
239
243
  export {};
240
244
  //# sourceMappingURL=conversation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/src/chat/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAiDrF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAE;IACJ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACA,IAAI,CAiCN;AA2BD,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,EAAE,CAiEtF;AAOD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAEtE;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAEtF;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,GAChB,aAAa,CAaf;AA8BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAOpE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAOxE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEhE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAE1E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAoB5E;AAyaD,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,aAAa,EAAE,GACxB,oBAAoB,EAAE,CAaxB;AAED;;GAEG;AACH,eAAO,MAAM,gCAAgC,iDAA2C,CAAC"}
@@ -653,7 +653,7 @@ function convertAssistantMessage(message) {
653
653
  flushAssistantMessage(deferredAssistantContent);
654
654
  return messages;
655
655
  }
656
- export function convertUiMessagesToModelMessages(messages) {
656
+ export function convertUiMessagesToProviderModelMessages(messages) {
657
657
  return messages.flatMap((message) => {
658
658
  switch (message.role) {
659
659
  case "system":
@@ -667,3 +667,7 @@ export function convertUiMessagesToModelMessages(messages) {
667
667
  }
668
668
  });
669
669
  }
670
+ /**
671
+ * @deprecated Use convertUiMessagesToProviderModelMessages for provider-facing model payloads.
672
+ */
673
+ export const convertUiMessagesToModelMessages = convertUiMessagesToProviderModelMessages;
@@ -1,19 +1,26 @@
1
- import { type ChatModelMessage, type ChatUiMessage } from "./types.js";
1
+ import { type ChatUiMessage, type ProviderModelMessage } from "./types.js";
2
2
  export declare function estimateTokens(value: unknown): number;
3
- export declare function compressTurn(messages: ChatModelMessage[], startIdx: number, endIdx: number): ChatModelMessage[];
4
- export declare function enforceTokenBudgetWithTurnCompression(messages: ChatModelMessage[], budget: number, overhead: number): ChatModelMessage[];
3
+ export declare function compressTurn(messages: ProviderModelMessage[], startIdx: number, endIdx: number): ProviderModelMessage[];
4
+ export declare function enforceTokenBudgetWithTurnCompression(messages: ProviderModelMessage[], budget: number, overhead: number): ProviderModelMessage[];
5
5
  export declare function isModelSupportedFileMediaType(mediaType: string): boolean;
6
6
  export declare function normalizeMessageFilePartMediaTypes(messages: ChatUiMessage[]): ChatUiMessage[];
7
7
  export declare function rewriteUnsupportedFilePartsAsAnnotations(messages: ChatUiMessage[]): ChatUiMessage[];
8
8
  export declare function stripPendingToolParts(messages: ChatUiMessage[]): ChatUiMessage[];
9
- export declare function sanitizeModelMessages(messages: ChatModelMessage[]): ChatModelMessage[];
10
- export declare function prepareModelMessagesFromUiMessages(messages: ChatUiMessage[]): ChatModelMessage[];
11
- export declare function maskOldToolOutputs(messages: ChatModelMessage[]): ChatModelMessage[];
12
- export declare function repairToolPairs(messages: ChatModelMessage[]): ChatModelMessage[];
9
+ export declare function sanitizeProviderModelMessages(messages: ProviderModelMessage[]): ProviderModelMessage[];
10
+ /**
11
+ * @deprecated Use sanitizeProviderModelMessages for provider-facing model payloads.
12
+ */
13
+ export declare const sanitizeModelMessages: typeof sanitizeProviderModelMessages;
14
+ export declare function prepareProviderModelMessagesFromUiMessages(messages: ChatUiMessage[]): ProviderModelMessage[];
15
+ export declare function maskOldToolOutputs(messages: ProviderModelMessage[]): ProviderModelMessage[];
16
+ export declare function repairToolPairs(messages: ProviderModelMessage[]): ProviderModelMessage[];
13
17
  export declare function estimateOverhead(instructions: unknown, toolCount: number): number;
14
- export declare function ensureToolCallInputs(messages: ChatModelMessage[]): ChatModelMessage[];
15
- export declare function compactForStep(messages: ChatModelMessage[], overhead?: number): ChatModelMessage[];
16
- export declare function dedupeToolHistory(messages: ChatModelMessage[]): ChatModelMessage[];
17
- export declare function enforceTokenBudget(messages: ChatModelMessage[], budget?: number, overhead?: number): ChatModelMessage[];
18
- export declare const prepareProviderModelMessagesFromUiMessages: typeof prepareModelMessagesFromUiMessages;
18
+ export declare function ensureToolCallInputs(messages: ProviderModelMessage[]): ProviderModelMessage[];
19
+ export declare function compactForStep(messages: ProviderModelMessage[], overhead?: number): ProviderModelMessage[];
20
+ export declare function dedupeToolHistory(messages: ProviderModelMessage[]): ProviderModelMessage[];
21
+ export declare function enforceTokenBudget(messages: ProviderModelMessage[], budget?: number, overhead?: number): ProviderModelMessage[];
22
+ /**
23
+ * @deprecated Use prepareProviderModelMessagesFromUiMessages for provider-facing model payloads.
24
+ */
25
+ export declare const prepareModelMessagesFromUiMessages: typeof prepareProviderModelMessagesFromUiMessages;
19
26
  //# sourceMappingURL=message-prep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message-prep.d.ts","sourceRoot":"","sources":["../../../src/src/chat/message-prep.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAQjC,OAAO,EAEL,KAAK,gBAAgB,EAGrB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AAIpB,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD;AAOD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,gBAAgB,EAAE,CA+BpB;AAkCD,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,MAAM,E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;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGjF;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CA4B7F;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,oBAAoB,EAAE,EAChC,QAAQ,GAAE,MAAU,GACnB,oBAAoB,EAAE,CAexB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CA0D1F;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,MAAM,GAAE,MAA6B,EACrC,QAAQ,GAAE,MAAU,GACnB,oBAAoB,EAAE,CAMxB;AAED;;GAEG;AACH,eAAO,MAAM,kCAAkC,mDAA6C,CAAC"}
@@ -1,4 +1,4 @@
1
- import { convertUiMessagesToModelMessages, getStringField, isReasoningPart, isToolCallPart, isToolResultPart, } from "./conversation.js";
1
+ import { convertUiMessagesToProviderModelMessages, getStringField, isReasoningPart, isToolCallPart, isToolResultPart, } from "./conversation.js";
2
2
  import { buildDataFileAnnotation, normalizeInlineAttachmentMediaType, } from "./types.js";
3
3
  const CHARS_PER_TOKEN = 4;
4
4
  export function estimateTokens(value) {
@@ -271,7 +271,7 @@ function cleanContent(content) {
271
271
  const hasSubstantiveContent = content.some((part) => isKeepableModelPart(part, false));
272
272
  return content.filter((part) => isKeepableModelPart(part, hasSubstantiveContent));
273
273
  }
274
- export function sanitizeModelMessages(messages) {
274
+ export function sanitizeProviderModelMessages(messages) {
275
275
  const result = [];
276
276
  for (const message of messages) {
277
277
  if (Array.isArray(message.content)) {
@@ -298,6 +298,10 @@ export function sanitizeModelMessages(messages) {
298
298
  }
299
299
  return result;
300
300
  }
301
+ /**
302
+ * @deprecated Use sanitizeProviderModelMessages for provider-facing model payloads.
303
+ */
304
+ export const sanitizeModelMessages = sanitizeProviderModelMessages;
301
305
  function filterValidMessages(messages) {
302
306
  return messages.filter((message) => {
303
307
  const content = message.content;
@@ -310,14 +314,14 @@ function filterValidMessages(messages) {
310
314
  return true;
311
315
  });
312
316
  }
313
- export function prepareModelMessagesFromUiMessages(messages) {
317
+ export function prepareProviderModelMessagesFromUiMessages(messages) {
314
318
  const validMessages = messages.filter((message) => message && typeof message === "object" && "role" in message);
315
319
  const normalizedMessages = normalizeMessageFilePartMediaTypes(validMessages);
316
320
  const strippedPendingToolMessages = stripPendingToolParts(normalizedMessages);
317
321
  const rewrittenMessages = rewriteUnsupportedFilePartsAsAnnotations(strippedPendingToolMessages);
318
- const modelMessages = convertUiMessagesToModelMessages(rewrittenMessages);
319
- const patchedMessages = ensureToolCallInputs(dedupeToolHistory(modelMessages));
320
- const sanitized = sanitizeModelMessages(patchedMessages);
322
+ const providerModelMessages = convertUiMessagesToProviderModelMessages(rewrittenMessages);
323
+ const patchedMessages = ensureToolCallInputs(dedupeToolHistory(providerModelMessages));
324
+ const sanitized = sanitizeProviderModelMessages(patchedMessages);
321
325
  const masked = maskOldToolOutputs(sanitized);
322
326
  const compacted = enforceTokenBudget(masked);
323
327
  const filtered = filterValidMessages(compacted);
@@ -681,4 +685,7 @@ export function enforceTokenBudget(messages, budget = DEFAULT_TOKEN_BUDGET, over
681
685
  }
682
686
  return enforceTokenBudgetWithTurnCompression(messages, budget, overhead);
683
687
  }
684
- export const prepareProviderModelMessagesFromUiMessages = prepareModelMessagesFromUiMessages;
688
+ /**
689
+ * @deprecated Use prepareProviderModelMessagesFromUiMessages for provider-facing model payloads.
690
+ */
691
+ export const prepareModelMessagesFromUiMessages = prepareProviderModelMessagesFromUiMessages;
@@ -134,6 +134,9 @@ export type ChatToolMessage = {
134
134
  content: ChatToolResultPart[];
135
135
  };
136
136
  export type ProviderModelMessage = ChatSystemMessage | ChatUserMessage | ChatAssistantMessage | ChatToolMessage;
137
+ /**
138
+ * @deprecated Use ProviderModelMessage for provider-facing model payloads.
139
+ */
137
140
  export type ChatModelMessage = ProviderModelMessage;
138
141
  export interface DurableRootRunDescriptor {
139
142
  runId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuCxB,eAAO,MAAM,kBAAkB,gSAA0D,CAAC;AAE1F,eAAO,MAAM,cAAc,yGAQjB,CAAC;AAMX,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CA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AI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,WAEnF;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,UAW9B;AASD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAmB7E;AAED,YAAY,EACV,mBAAmB,EACnB,mBAAmB,IAAI,eAAe,EACtC,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,GACxB,CAAC"}
@@ -5,13 +5,13 @@
5
5
  * module. Higher-level framework code imports framework-owned runtime
6
6
  * types and calls into this bridge at the edge.
7
7
  */
8
- import type { ModelRuntimeMessage } from "../agent/runtime/model-runtime-types.js";
8
+ import type { TextGenerationRuntimeMessage } from "../agent/runtime/text-generation-runtime-message-types.js";
9
9
  import type { RuntimeGenerateTextResult, RuntimeStreamResult, RuntimeToolCallRepairFunction, RuntimeToolSet } from "../agent/runtime/runtime-tool-types.js";
10
10
  import type { EmbeddingRuntime, ModelRuntime } from "../provider/types.js";
11
11
  type GenerateTextOptions = {
12
12
  model: ModelRuntime;
13
13
  system?: unknown;
14
- messages: ModelRuntimeMessage[];
14
+ messages: TextGenerationRuntimeMessage[];
15
15
  tools?: RuntimeToolSet;
16
16
  experimental_repairToolCall?: RuntimeToolCallRepairFunction;
17
17
  maxOutputTokens?: number;
@@ -30,7 +30,7 @@ type GenerateTextOptions = {
30
30
  type StreamTextOptions = {
31
31
  model: ModelRuntime;
32
32
  system?: unknown;
33
- messages: ModelRuntimeMessage[];
33
+ messages: TextGenerationRuntimeMessage[];
34
34
  tools?: RuntimeToolSet;
35
35
  experimental_repairToolCall?: RuntimeToolCallRepairFunction;
36
36
  maxOutputTokens?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-bridge.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/runtime-bridge.ts"],"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ACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAsaF,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAuBjG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,mBAAmB,CAsC1E;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY;;;;;;;;GAW1C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;;;;;;;GAUlD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAsBjE"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.342";
1
+ export declare const VERSION = "0.1.343";
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.342";
3
+ export const VERSION = "0.1.343";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.342",
3
+ "version": "0.1.343",
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.342",
3
+ "version": "0.1.343",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -33,7 +33,7 @@ import {
33
33
  setSpanAttributes,
34
34
  withSpan,
35
35
  } from "../../observability/tracing/index.js";
36
- import { convertToModelMessages } from "./model-message-converter.js";
36
+ import { convertToTextGenerationRuntimeMessages } from "./text-generation-runtime-message-converter.js";
37
37
  import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
38
38
  import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
39
39
  import {
@@ -789,7 +789,7 @@ export class AgentRuntime {
789
789
  return generateText({
790
790
  model: languageModel,
791
791
  system: currentSystemPrompt,
792
- messages: convertToModelMessages(currentMessages),
792
+ messages: convertToTextGenerationRuntimeMessages(currentMessages),
793
793
  tools: convertToolsToRuntimeTools(tools, {
794
794
  model: effectiveModel,
795
795
  allowedToolNames: allowedRemoteToolNames,
@@ -1069,7 +1069,7 @@ export class AgentRuntime {
1069
1069
  const result = streamText({
1070
1070
  model: languageModel,
1071
1071
  system: currentSystemPrompt,
1072
- messages: convertToModelMessages(currentMessages),
1072
+ messages: convertToTextGenerationRuntimeMessages(currentMessages),
1073
1073
  tools: convertToolsToRuntimeTools(tools, {
1074
1074
  model: effectiveModel,
1075
1075
  allowedToolNames: allowedRemoteToolNames,
@@ -5,7 +5,7 @@
5
5
  * boundary. These cover only the shapes the framework consumes today.
6
6
  */
7
7
 
8
- import type { ModelRuntimeMessage } from "./model-runtime-types.js";
8
+ import type { TextGenerationRuntimeMessage } from "./text-generation-runtime-message-types.js";
9
9
 
10
10
  export type RuntimeToolSet = Record<string, unknown>;
11
11
 
@@ -47,7 +47,7 @@ export interface RuntimeRepairToolCall {
47
47
  export interface RuntimeToolCallRepairContext {
48
48
  error: unknown;
49
49
  inputSchema: (...args: unknown[]) => unknown;
50
- messages: ModelRuntimeMessage[];
50
+ messages: TextGenerationRuntimeMessage[];
51
51
  system?: string;
52
52
  toolCall: RuntimeRepairToolCall;
53
53
  tools: RuntimeToolSet;
@@ -1,19 +1,19 @@
1
1
  /**
2
- * Model Message Converter
2
+ * Text-Generation Runtime Message Converter
3
3
  *
4
4
  * Converts between veryfront's internal Message format and the current
5
- * model-runtime message format.
5
+ * text-generation runtime message format.
6
6
  *
7
- * @module ai/agent/runtime/model-message-converter
7
+ * @module ai/agent/runtime/text-generation-runtime-message-converter
8
8
  */
9
9
 
10
10
  import type {
11
- ModelRuntimeAssistantMessage,
12
- ModelRuntimeMessage,
13
- ModelRuntimeTextPart,
14
- ModelRuntimeToolCallPart,
15
- ModelRuntimeToolMessage,
16
- } from "./model-runtime-types.js";
11
+ TextGenerationRuntimeAssistantMessage,
12
+ TextGenerationRuntimeMessage,
13
+ TextGenerationRuntimeTextPart,
14
+ TextGenerationRuntimeToolCallPart,
15
+ TextGenerationRuntimeToolMessage,
16
+ } from "./text-generation-runtime-message-types.js";
17
17
  import {
18
18
  getTextFromParts,
19
19
  getToolArguments,
@@ -23,9 +23,9 @@ import {
23
23
  } from "../types.js";
24
24
 
25
25
  /**
26
- * Convert a veryfront Message to the current model-runtime message format.
26
+ * Convert a veryfront Message to the current text-generation runtime message format.
27
27
  */
28
- export function convertToModelMessage(msg: Message): ModelRuntimeMessage {
28
+ export function convertToTextGenerationRuntimeMessage(msg: Message): TextGenerationRuntimeMessage {
29
29
  switch (msg.role) {
30
30
  case "system": {
31
31
  const text = getTextFromParts(msg.parts);
@@ -38,7 +38,7 @@ export function convertToModelMessage(msg: Message): ModelRuntimeMessage {
38
38
  }
39
39
 
40
40
  case "assistant": {
41
- const content: Array<ModelRuntimeTextPart | ModelRuntimeToolCallPart> = [];
41
+ const content: Array<TextGenerationRuntimeTextPart | TextGenerationRuntimeToolCallPart> = [];
42
42
 
43
43
  for (const part of msg.parts) {
44
44
  if (part.type === "text" && "text" in part) {
@@ -66,12 +66,15 @@ export function convertToModelMessage(msg: Message): ModelRuntimeMessage {
66
66
  content.push({ type: "text", text: "" });
67
67
  }
68
68
 
69
- const assistantMessage: ModelRuntimeAssistantMessage = { role: "assistant", content };
69
+ const assistantMessage: TextGenerationRuntimeAssistantMessage = {
70
+ role: "assistant",
71
+ content,
72
+ };
70
73
  return assistantMessage;
71
74
  }
72
75
 
73
76
  case "tool": {
74
- const content: ModelRuntimeToolMessage["content"] = [];
77
+ const content: TextGenerationRuntimeToolMessage["content"] = [];
75
78
 
76
79
  for (const part of msg.parts) {
77
80
  if (part.type !== "tool-result") continue;
@@ -85,7 +88,7 @@ export function convertToModelMessage(msg: Message): ModelRuntimeMessage {
85
88
  });
86
89
  }
87
90
 
88
- const toolMessage: ModelRuntimeToolMessage = { role: "tool", content };
91
+ const toolMessage: TextGenerationRuntimeToolMessage = { role: "tool", content };
89
92
  return toolMessage;
90
93
  }
91
94
 
@@ -99,7 +102,7 @@ export function convertToModelMessage(msg: Message): ModelRuntimeMessage {
99
102
 
100
103
  function convertToolResultPart(
101
104
  part: ToolResultPart,
102
- ): ModelRuntimeToolMessage {
105
+ ): TextGenerationRuntimeToolMessage {
103
106
  return {
104
107
  role: "tool",
105
108
  content: [{
@@ -112,15 +115,17 @@ function convertToolResultPart(
112
115
  }
113
116
 
114
117
  /**
115
- * Convert an array of veryfront Messages to the current model-runtime message format.
118
+ * Convert an array of veryfront Messages to the current text-generation runtime message format.
116
119
  */
117
- export function convertToModelMessages(messages: Message[]): ModelRuntimeMessage[] {
118
- const modelMessages: ModelRuntimeMessage[] = [];
120
+ export function convertToTextGenerationRuntimeMessages(
121
+ messages: Message[],
122
+ ): TextGenerationRuntimeMessage[] {
123
+ const textGenerationRuntimeMessages: TextGenerationRuntimeMessage[] = [];
119
124
  const toolResultMessageIndexes = new Map<string, number>();
120
125
 
121
126
  for (const message of messages) {
122
127
  if (message.role !== "tool") {
123
- modelMessages.push(convertToModelMessage(message));
128
+ textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
124
129
  continue;
125
130
  }
126
131
 
@@ -129,7 +134,7 @@ export function convertToModelMessages(messages: Message[]): ModelRuntimeMessage
129
134
  );
130
135
 
131
136
  if (toolResultParts.length === 0) {
132
- modelMessages.push(convertToModelMessage(message));
137
+ textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
133
138
  continue;
134
139
  }
135
140
 
@@ -138,14 +143,17 @@ export function convertToModelMessages(messages: Message[]): ModelRuntimeMessage
138
143
  const existingIndex = toolResultMessageIndexes.get(toolResultPart.toolCallId);
139
144
 
140
145
  if (existingIndex === undefined) {
141
- toolResultMessageIndexes.set(toolResultPart.toolCallId, modelMessages.length);
142
- modelMessages.push(toolResultMessage);
146
+ toolResultMessageIndexes.set(
147
+ toolResultPart.toolCallId,
148
+ textGenerationRuntimeMessages.length,
149
+ );
150
+ textGenerationRuntimeMessages.push(toolResultMessage);
143
151
  continue;
144
152
  }
145
153
 
146
- modelMessages[existingIndex] = toolResultMessage;
154
+ textGenerationRuntimeMessages[existingIndex] = toolResultMessage;
147
155
  }
148
156
  }
149
157
 
150
- return modelMessages;
158
+ return textGenerationRuntimeMessages;
151
159
  }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Text-Generation Runtime Message Types
3
+ *
4
+ * Framework-owned message types for the current text-generation runtime
5
+ * boundary. These describe the subset of message shapes the runtime uses
6
+ * today without exposing SDK-owned message contracts upward.
7
+ */
8
+
9
+ export interface TextGenerationRuntimeTextPart {
10
+ type: "text";
11
+ text: string;
12
+ }
13
+
14
+ export interface TextGenerationRuntimeToolCallPart {
15
+ type: "tool-call";
16
+ toolCallId: string;
17
+ toolName: string;
18
+ input: Record<string, unknown>;
19
+ }
20
+
21
+ export interface TextGenerationRuntimeToolResultPart {
22
+ type: "tool-result";
23
+ toolCallId: string;
24
+ toolName: string;
25
+ output: {
26
+ type: "json";
27
+ value: unknown;
28
+ };
29
+ }
30
+
31
+ export interface TextGenerationRuntimeSystemMessage {
32
+ role: "system";
33
+ content: string;
34
+ }
35
+
36
+ export interface TextGenerationRuntimeUserMessage {
37
+ role: "user";
38
+ content: string;
39
+ }
40
+
41
+ export interface TextGenerationRuntimeAssistantMessage {
42
+ role: "assistant";
43
+ content: Array<TextGenerationRuntimeTextPart | TextGenerationRuntimeToolCallPart>;
44
+ }
45
+
46
+ export interface TextGenerationRuntimeToolMessage {
47
+ role: "tool";
48
+ content: TextGenerationRuntimeToolResultPart[];
49
+ }
50
+
51
+ export type TextGenerationRuntimeMessage =
52
+ | TextGenerationRuntimeSystemMessage
53
+ | TextGenerationRuntimeUserMessage
54
+ | TextGenerationRuntimeAssistantMessage
55
+ | TextGenerationRuntimeToolMessage;
@@ -1,6 +1,6 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  import { z } from "zod";
3
- import type { ChatModelMessage, ChatUiMessage, ChatUiMessagePart } from "./types.js";
3
+ import type { ChatUiMessage, ChatUiMessagePart, ProviderModelMessage } from "./types.js";
4
4
 
5
5
  const textPartSchema = z.object({ type: z.literal("text"), text: z.string() });
6
6
  const imagePartSchema = z.object({
@@ -470,7 +470,7 @@ export function isReasoningPart(value: unknown): value is ReasoningPartLike {
470
470
  return isRecord(value) && value.type === "reasoning" && typeof value.text === "string";
471
471
  }
472
472
 
473
- export function extractTextFromMessage(message: ChatModelMessage): string {
473
+ export function extractTextFromMessage(message: ProviderModelMessage): string {
474
474
  if (!message || !message.content) return "";
475
475
 
476
476
  const { content } = message;
@@ -704,7 +704,7 @@ function buildToolResultOutput(toolPart: { state: string; output?: unknown; erro
704
704
  return null;
705
705
  }
706
706
 
707
- function convertSystemMessage(message: ChatUiMessage): ChatModelMessage[] {
707
+ function convertSystemMessage(message: ChatUiMessage): ProviderModelMessage[] {
708
708
  const content = message.parts.flatMap((part) => (isTextPart(part) ? [part.text] : [])).join("");
709
709
  if (content.length === 0) {
710
710
  return [];
@@ -718,7 +718,7 @@ function convertSystemMessage(message: ChatUiMessage): ChatModelMessage[] {
718
718
  ];
719
719
  }
720
720
 
721
- function convertUserMessage(message: ChatUiMessage): ChatModelMessage[] {
721
+ function convertUserMessage(message: ChatUiMessage): ProviderModelMessage[] {
722
722
  const content: Array<
723
723
  { type: "text"; text: string } | {
724
724
  type: "file";
@@ -752,7 +752,7 @@ function convertUserMessage(message: ChatUiMessage): ChatModelMessage[] {
752
752
  ];
753
753
  }
754
754
 
755
- function convertAssistantMessage(message: ChatUiMessage): ChatModelMessage[] {
755
+ function convertAssistantMessage(message: ChatUiMessage): ProviderModelMessage[] {
756
756
  const rawToolNamesById = buildRawToolNameMap(message.parts);
757
757
  const assistantContent: Array<
758
758
  | { type: "text"; text: string }
@@ -776,7 +776,7 @@ function convertAssistantMessage(message: ChatUiMessage): ChatModelMessage[] {
776
776
  };
777
777
  }> = [];
778
778
  const pendingToolCallIds = new Set<string>();
779
- const messages: ChatModelMessage[] = [];
779
+ const messages: ProviderModelMessage[] = [];
780
780
 
781
781
  const flushAssistantMessage = (content: typeof assistantContent) => {
782
782
  if (content.length === 0) {
@@ -915,7 +915,9 @@ function convertAssistantMessage(message: ChatUiMessage): ChatModelMessage[] {
915
915
  return messages;
916
916
  }
917
917
 
918
- export function convertUiMessagesToModelMessages(messages: ChatUiMessage[]): ChatModelMessage[] {
918
+ export function convertUiMessagesToProviderModelMessages(
919
+ messages: ChatUiMessage[],
920
+ ): ProviderModelMessage[] {
919
921
  return messages.flatMap((message) => {
920
922
  switch (message.role) {
921
923
  case "system":
@@ -929,3 +931,8 @@ export function convertUiMessagesToModelMessages(messages: ChatUiMessage[]): Cha
929
931
  }
930
932
  });
931
933
  }
934
+
935
+ /**
936
+ * @deprecated Use convertUiMessagesToProviderModelMessages for provider-facing model payloads.
937
+ */
938
+ export const convertUiMessagesToModelMessages = convertUiMessagesToProviderModelMessages;
@@ -1,6 +1,6 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  import {
3
- convertUiMessagesToModelMessages,
3
+ convertUiMessagesToProviderModelMessages,
4
4
  getStringField,
5
5
  isReasoningPart,
6
6
  isToolCallPart,
@@ -8,12 +8,12 @@ import {
8
8
  } from "./conversation.js";
9
9
  import {
10
10
  buildDataFileAnnotation,
11
- type ChatModelMessage,
12
11
  type ChatToolResultOutput,
13
12
  type ChatToolResultPart,
14
13
  type ChatUiMessage,
15
14
  type ChatUiMessagePart,
16
15
  normalizeInlineAttachmentMediaType,
16
+ type ProviderModelMessage,
17
17
  type UploadedFileReference,
18
18
  } from "./types.js";
19
19
 
@@ -29,10 +29,10 @@ function truncate(text: string, maxLen: number): string {
29
29
  }
30
30
 
31
31
  export function compressTurn(
32
- messages: ChatModelMessage[],
32
+ messages: ProviderModelMessage[],
33
33
  startIdx: number,
34
34
  endIdx: number,
35
- ): ChatModelMessage[] {
35
+ ): ProviderModelMessage[] {
36
36
  let userQuery = "";
37
37
  const toolNames: string[] = [];
38
38
  let assistantConclusion = "";
@@ -72,7 +72,7 @@ interface TurnWindow {
72
72
  compressed?: boolean;
73
73
  }
74
74
 
75
- function collectTurns(messages: ChatModelMessage[]): TurnWindow[] {
75
+ function collectTurns(messages: ProviderModelMessage[]): TurnWindow[] {
76
76
  const turns: TurnWindow[] = [];
77
77
  let currentTurn: TurnWindow | null = null;
78
78
 
@@ -98,10 +98,10 @@ function collectTurns(messages: ChatModelMessage[]): TurnWindow[] {
98
98
  }
99
99
 
100
100
  export function enforceTokenBudgetWithTurnCompression(
101
- messages: ChatModelMessage[],
101
+ messages: ProviderModelMessage[],
102
102
  budget: number,
103
103
  overhead: number,
104
- ): ChatModelMessage[] {
104
+ ): ProviderModelMessage[] {
105
105
  const effectiveBudget = budget - overhead;
106
106
  let totalTokens = messages.reduce((sum, message) => sum + estimateTokens(message.content), 0);
107
107
  if (totalTokens <= effectiveBudget) return messages;
@@ -337,7 +337,7 @@ function isKeepableModelPart(part: unknown, includeReasoning: boolean): boolean
337
337
  }
338
338
  }
339
339
 
340
- function hasValidContent(message: ChatModelMessage): boolean {
340
+ function hasValidContent(message: ProviderModelMessage): boolean {
341
341
  const content = message.content;
342
342
 
343
343
  if (content === undefined || content === null) return false;
@@ -351,8 +351,10 @@ function cleanContent<T>(content: T[]): T[] {
351
351
  return content.filter((part) => isKeepableModelPart(part, hasSubstantiveContent));
352
352
  }
353
353
 
354
- export function sanitizeModelMessages(messages: ChatModelMessage[]): ChatModelMessage[] {
355
- const result: ChatModelMessage[] = [];
354
+ export function sanitizeProviderModelMessages(
355
+ messages: ProviderModelMessage[],
356
+ ): ProviderModelMessage[] {
357
+ const result: ProviderModelMessage[] = [];
356
358
 
357
359
  for (const message of messages) {
358
360
  if (Array.isArray(message.content)) {
@@ -377,7 +379,12 @@ export function sanitizeModelMessages(messages: ChatModelMessage[]): ChatModelMe
377
379
  return result;
378
380
  }
379
381
 
380
- function filterValidMessages(messages: ChatModelMessage[]): ChatModelMessage[] {
382
+ /**
383
+ * @deprecated Use sanitizeProviderModelMessages for provider-facing model payloads.
384
+ */
385
+ export const sanitizeModelMessages = sanitizeProviderModelMessages;
386
+
387
+ function filterValidMessages(messages: ProviderModelMessage[]): ProviderModelMessage[] {
381
388
  return messages.filter((message) => {
382
389
  const content = message.content;
383
390
  if (content === undefined || content === null) return false;
@@ -387,23 +394,25 @@ function filterValidMessages(messages: ChatModelMessage[]): ChatModelMessage[] {
387
394
  });
388
395
  }
389
396
 
390
- export function prepareModelMessagesFromUiMessages(messages: ChatUiMessage[]): ChatModelMessage[] {
397
+ export function prepareProviderModelMessagesFromUiMessages(
398
+ messages: ChatUiMessage[],
399
+ ): ProviderModelMessage[] {
391
400
  const validMessages = messages.filter((message) =>
392
401
  message && typeof message === "object" && "role" in message
393
402
  );
394
403
  const normalizedMessages = normalizeMessageFilePartMediaTypes(validMessages);
395
404
  const strippedPendingToolMessages = stripPendingToolParts(normalizedMessages);
396
405
  const rewrittenMessages = rewriteUnsupportedFilePartsAsAnnotations(strippedPendingToolMessages);
397
- const modelMessages = convertUiMessagesToModelMessages(rewrittenMessages);
398
- const patchedMessages = ensureToolCallInputs(dedupeToolHistory(modelMessages));
399
- const sanitized = sanitizeModelMessages(patchedMessages);
406
+ const providerModelMessages = convertUiMessagesToProviderModelMessages(rewrittenMessages);
407
+ const patchedMessages = ensureToolCallInputs(dedupeToolHistory(providerModelMessages));
408
+ const sanitized = sanitizeProviderModelMessages(patchedMessages);
400
409
  const masked = maskOldToolOutputs(sanitized);
401
410
  const compacted = enforceTokenBudget(masked);
402
411
  const filtered = filterValidMessages(compacted);
403
412
  return repairToolPairs(filtered);
404
413
  }
405
414
 
406
- function buildToolCallMap(messages: ChatModelMessage[]): Map<string, ToolCallInfo> {
415
+ function buildToolCallMap(messages: ProviderModelMessage[]): Map<string, ToolCallInfo> {
407
416
  const map = new Map<string, ToolCallInfo>();
408
417
 
409
418
  for (const msg of messages) {
@@ -493,7 +502,7 @@ function wrapToolResultOutput(
493
502
  return original;
494
503
  }
495
504
 
496
- export function maskOldToolOutputs(messages: ChatModelMessage[]): ChatModelMessage[] {
505
+ export function maskOldToolOutputs(messages: ProviderModelMessage[]): ProviderModelMessage[] {
497
506
  let lastUserIdx = -1;
498
507
  for (let i = messages.length - 1; i >= 0; i--) {
499
508
  if (messages[i].role === "user") {
@@ -573,7 +582,7 @@ function createSyntheticToolResult(toolCallId: string, toolName: string): ChatTo
573
582
  };
574
583
  }
575
584
 
576
- export function repairToolPairs(messages: ChatModelMessage[]): ChatModelMessage[] {
585
+ export function repairToolPairs(messages: ProviderModelMessage[]): ProviderModelMessage[] {
577
586
  const result = [...messages];
578
587
  let mutated = false;
579
588
 
@@ -702,7 +711,7 @@ export function repairToolPairs(messages: ChatModelMessage[]): ChatModelMessage[
702
711
  content: [...repairedResults, ...nextMessage.content],
703
712
  };
704
713
  } else {
705
- const toolMessage: ChatModelMessage = {
714
+ const toolMessage: ProviderModelMessage = {
706
715
  role: "tool",
707
716
  content: repairedResults,
708
717
  };
@@ -719,7 +728,7 @@ export function estimateOverhead(instructions: unknown, toolCount: number): numb
719
728
  return instructionTokens + toolCount * TOKENS_PER_TOOL;
720
729
  }
721
730
 
722
- export function ensureToolCallInputs(messages: ChatModelMessage[]): ChatModelMessage[] {
731
+ export function ensureToolCallInputs(messages: ProviderModelMessage[]): ProviderModelMessage[] {
723
732
  let mutated = false;
724
733
 
725
734
  const result = messages.map((msg) => {
@@ -750,9 +759,9 @@ export function ensureToolCallInputs(messages: ChatModelMessage[]): ChatModelMes
750
759
  }
751
760
 
752
761
  export function compactForStep(
753
- messages: ChatModelMessage[],
762
+ messages: ProviderModelMessage[],
754
763
  overhead: number = 0,
755
- ): ChatModelMessage[] {
764
+ ): ProviderModelMessage[] {
756
765
  const compacted = enforceTokenBudget(
757
766
  maskOldToolOutputs(messages),
758
767
  DEFAULT_TOKEN_BUDGET,
@@ -769,12 +778,12 @@ export function compactForStep(
769
778
  return ensureToolCallInputs(repairToolPairs(dedupeToolHistory(trimmed)));
770
779
  }
771
780
 
772
- export function dedupeToolHistory(messages: ChatModelMessage[]): ChatModelMessage[] {
781
+ export function dedupeToolHistory(messages: ProviderModelMessage[]): ProviderModelMessage[] {
773
782
  const seenToolCallIds = new Set<string>();
774
783
  const seenToolResultIds = new Set<string>();
775
784
  let mutated = false;
776
785
 
777
- const deduped: ChatModelMessage[] = [];
786
+ const deduped: ProviderModelMessage[] = [];
778
787
 
779
788
  const filterParts = <T>(parts: T[]): { filtered: T[]; changed: boolean } => {
780
789
  const filtered = parts.filter((part) => {
@@ -830,10 +839,10 @@ export function dedupeToolHistory(messages: ChatModelMessage[]): ChatModelMessag
830
839
  }
831
840
 
832
841
  export function enforceTokenBudget(
833
- messages: ChatModelMessage[],
842
+ messages: ProviderModelMessage[],
834
843
  budget: number = DEFAULT_TOKEN_BUDGET,
835
844
  overhead: number = 0,
836
- ): ChatModelMessage[] {
845
+ ): ProviderModelMessage[] {
837
846
  if (messages.length === 0) {
838
847
  return messages;
839
848
  }
@@ -841,4 +850,7 @@ export function enforceTokenBudget(
841
850
  return enforceTokenBudgetWithTurnCompression(messages, budget, overhead);
842
851
  }
843
852
 
844
- export const prepareProviderModelMessagesFromUiMessages = prepareModelMessagesFromUiMessages;
853
+ /**
854
+ * @deprecated Use prepareProviderModelMessagesFromUiMessages for provider-facing model payloads.
855
+ */
856
+ export const prepareModelMessagesFromUiMessages = prepareProviderModelMessagesFromUiMessages;
@@ -251,6 +251,9 @@ export type ProviderModelMessage =
251
251
  | ChatAssistantMessage
252
252
  | ChatToolMessage;
253
253
 
254
+ /**
255
+ * @deprecated Use ProviderModelMessage for provider-facing model payloads.
256
+ */
254
257
  export type ChatModelMessage = ProviderModelMessage;
255
258
 
256
259
  export interface DurableRootRunDescriptor {
@@ -5,7 +5,7 @@
5
5
  * module. Higher-level framework code imports framework-owned runtime
6
6
  * types and calls into this bridge at the edge.
7
7
  */
8
- import type { ModelRuntimeMessage } from "../agent/runtime/model-runtime-types.js";
8
+ import type { TextGenerationRuntimeMessage } from "../agent/runtime/text-generation-runtime-message-types.js";
9
9
  import type {
10
10
  RuntimeGenerateTextResult,
11
11
  RuntimeStreamResult,
@@ -21,7 +21,7 @@ import type {
21
21
  type GenerateTextOptions = {
22
22
  model: ModelRuntime;
23
23
  system?: unknown;
24
- messages: ModelRuntimeMessage[];
24
+ messages: TextGenerationRuntimeMessage[];
25
25
  tools?: RuntimeToolSet;
26
26
  experimental_repairToolCall?: RuntimeToolCallRepairFunction;
27
27
  maxOutputTokens?: number;
@@ -41,7 +41,7 @@ type GenerateTextOptions = {
41
41
  type StreamTextOptions = {
42
42
  model: ModelRuntime;
43
43
  system?: unknown;
44
- messages: ModelRuntimeMessage[];
44
+ messages: TextGenerationRuntimeMessage[];
45
45
  tools?: RuntimeToolSet;
46
46
  experimental_repairToolCall?: RuntimeToolCallRepairFunction;
47
47
  maxOutputTokens?: number;
@@ -165,7 +165,7 @@ function normalizeSystemPrompt(system: GenerateTextOptions["system"]): string |
165
165
 
166
166
  function toRuntimePrompt(
167
167
  system: string | undefined,
168
- messages: ModelRuntimeMessage[],
168
+ messages: TextGenerationRuntimeMessage[],
169
169
  ): RuntimePromptMessage[] {
170
170
  const prompt: RuntimePromptMessage[] = [];
171
171
 
@@ -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.342";
3
+ export const VERSION = "0.1.343";
@@ -1,19 +0,0 @@
1
- /**
2
- * Model Message Converter
3
- *
4
- * Converts between veryfront's internal Message format and the current
5
- * model-runtime message format.
6
- *
7
- * @module ai/agent/runtime/model-message-converter
8
- */
9
- import type { ModelRuntimeMessage } from "./model-runtime-types.js";
10
- import { type Message } from "../types.js";
11
- /**
12
- * Convert a veryfront Message to the current model-runtime message format.
13
- */
14
- export declare function convertToModelMessage(msg: Message): ModelRuntimeMessage;
15
- /**
16
- * Convert an array of veryfront Messages to the current model-runtime message format.
17
- */
18
- export declare function convertToModelMessages(messages: Message[]): ModelRuntimeMessage[];
19
- //# sourceMappingURL=model-message-converter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAEV,mBAAmB,EAIpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAsEvE;AAgBD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAkCjF"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Model Runtime Types
3
- *
4
- * Framework-owned message types for the current text-generation runtime
5
- * boundary. These describe the subset of message shapes the runtime uses
6
- * today without exposing SDK-owned message contracts upward.
7
- */
8
- export interface ModelRuntimeTextPart {
9
- type: "text";
10
- text: string;
11
- }
12
- export interface ModelRuntimeToolCallPart {
13
- type: "tool-call";
14
- toolCallId: string;
15
- toolName: string;
16
- input: Record<string, unknown>;
17
- }
18
- export interface ModelRuntimeToolResultPart {
19
- type: "tool-result";
20
- toolCallId: string;
21
- toolName: string;
22
- output: {
23
- type: "json";
24
- value: unknown;
25
- };
26
- }
27
- export interface ModelRuntimeSystemMessage {
28
- role: "system";
29
- content: string;
30
- }
31
- export interface ModelRuntimeUserMessage {
32
- role: "user";
33
- content: string;
34
- }
35
- export interface ModelRuntimeAssistantMessage {
36
- role: "assistant";
37
- content: Array<ModelRuntimeTextPart | ModelRuntimeToolCallPart>;
38
- }
39
- export interface ModelRuntimeToolMessage {
40
- role: "tool";
41
- content: ModelRuntimeToolResultPart[];
42
- }
43
- export type ModelRuntimeMessage = ModelRuntimeSystemMessage | ModelRuntimeUserMessage | ModelRuntimeAssistantMessage | ModelRuntimeToolMessage;
44
- //# sourceMappingURL=model-runtime-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-runtime-types.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-runtime-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,KAAK,CAAC,oBAAoB,GAAG,wBAAwB,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,0BAA0B,EAAE,CAAC;CACvC;AAED,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,uBAAuB,GACvB,4BAA4B,GAC5B,uBAAuB,CAAC"}
@@ -1,55 +0,0 @@
1
- /**
2
- * Model Runtime Types
3
- *
4
- * Framework-owned message types for the current text-generation runtime
5
- * boundary. These describe the subset of message shapes the runtime uses
6
- * today without exposing SDK-owned message contracts upward.
7
- */
8
-
9
- export interface ModelRuntimeTextPart {
10
- type: "text";
11
- text: string;
12
- }
13
-
14
- export interface ModelRuntimeToolCallPart {
15
- type: "tool-call";
16
- toolCallId: string;
17
- toolName: string;
18
- input: Record<string, unknown>;
19
- }
20
-
21
- export interface ModelRuntimeToolResultPart {
22
- type: "tool-result";
23
- toolCallId: string;
24
- toolName: string;
25
- output: {
26
- type: "json";
27
- value: unknown;
28
- };
29
- }
30
-
31
- export interface ModelRuntimeSystemMessage {
32
- role: "system";
33
- content: string;
34
- }
35
-
36
- export interface ModelRuntimeUserMessage {
37
- role: "user";
38
- content: string;
39
- }
40
-
41
- export interface ModelRuntimeAssistantMessage {
42
- role: "assistant";
43
- content: Array<ModelRuntimeTextPart | ModelRuntimeToolCallPart>;
44
- }
45
-
46
- export interface ModelRuntimeToolMessage {
47
- role: "tool";
48
- content: ModelRuntimeToolResultPart[];
49
- }
50
-
51
- export type ModelRuntimeMessage =
52
- | ModelRuntimeSystemMessage
53
- | ModelRuntimeUserMessage
54
- | ModelRuntimeAssistantMessage
55
- | ModelRuntimeToolMessage;