veryfront 0.1.537 → 0.1.539

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.537",
3
+ "version": "0.1.539",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -1 +1 @@
1
- {"version":3,"file":"text-generation-runtime-message-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/text-generation-runtime-message-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAGV,4BAA4B,EAI7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AA0ErB;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,OAAO,GAAG,4BAA4B,CA2FhG;AAgBD;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,OAAO,EAAE,GAClB,4BAA4B,EAAE,CAqChC"}
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,EAGV,4BAA4B,EAI7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAGL,KAAK,OAAO,EAGb,MAAM,aAAa,CAAC;AA0ErB;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,GAAG,EAAE,OAAO,GAAG,4BAA4B,CA2FhG;AA8BD;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,OAAO,EAAE,GAClB,4BAA4B,EAAE,CAyChC"}
@@ -164,6 +164,18 @@ function convertToolResultPart(part) {
164
164
  }],
165
165
  };
166
166
  }
167
+ function hasProviderSendableAssistantContent(message) {
168
+ if (message.role !== "assistant")
169
+ return true;
170
+ return message.parts.some((part) => {
171
+ if (part.type === "text" && "text" in part) {
172
+ return typeof part.text === "string" &&
173
+ part.text.length > 0;
174
+ }
175
+ return part.type === "tool-call" ||
176
+ (part.type.startsWith("tool-") && part.type !== "tool-result");
177
+ });
178
+ }
167
179
  /**
168
180
  * Convert an array of veryfront Messages to the current text-generation runtime message format.
169
181
  */
@@ -171,6 +183,9 @@ export function convertToTextGenerationRuntimeMessages(messages) {
171
183
  const textGenerationRuntimeMessages = [];
172
184
  const toolResultMessageIndexes = new Map();
173
185
  for (const message of messages) {
186
+ if (!hasProviderSendableAssistantContent(message)) {
187
+ continue;
188
+ }
174
189
  if (message.role !== "tool") {
175
190
  textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
176
191
  continue;
@@ -83,6 +83,8 @@ async function callRemoteTool(baseUrl, token, toolName, args, endUserId) {
83
83
  // If MCP CallToolResult format, extract content
84
84
  if (result?.content && Array.isArray(result.content)) {
85
85
  const text = joinCallToolText(result.content);
86
+ if (result.structuredContent)
87
+ return result.structuredContent;
86
88
  if (result.isError) {
87
89
  // Try to preserve structured error data (e.g., authentication_required with connectUrl)
88
90
  const parsed = parseJsonText(text);
@@ -90,8 +92,6 @@ async function callRemoteTool(baseUrl, token, toolName, args, endUserId) {
90
92
  return parsed;
91
93
  return { error: "tool_error", message: text };
92
94
  }
93
- if (result.structuredContent)
94
- return result.structuredContent;
95
95
  return parseJsonText(text) ?? text;
96
96
  }
97
97
  return result;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.537";
1
+ export declare const VERSION = "0.1.539";
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.537";
3
+ export const VERSION = "0.1.539";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.537",
3
+ "version": "0.1.539",
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.537",
3
+ "version": "0.1.539",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -206,6 +206,20 @@ function convertToolResultPart(
206
206
  };
207
207
  }
208
208
 
209
+ function hasProviderSendableAssistantContent(message: Message): boolean {
210
+ if (message.role !== "assistant") return true;
211
+
212
+ return message.parts.some((part) => {
213
+ if (part.type === "text" && "text" in part) {
214
+ return typeof (part as { text?: unknown }).text === "string" &&
215
+ (part as { text: string }).text.length > 0;
216
+ }
217
+
218
+ return part.type === "tool-call" ||
219
+ (part.type.startsWith("tool-") && part.type !== "tool-result");
220
+ });
221
+ }
222
+
209
223
  /**
210
224
  * Convert an array of veryfront Messages to the current text-generation runtime message format.
211
225
  */
@@ -216,6 +230,10 @@ export function convertToTextGenerationRuntimeMessages(
216
230
  const toolResultMessageIndexes = new Map<string, number>();
217
231
 
218
232
  for (const message of messages) {
233
+ if (!hasProviderSendableAssistantContent(message)) {
234
+ continue;
235
+ }
236
+
219
237
  if (message.role !== "tool") {
220
238
  textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
221
239
  continue;
@@ -124,6 +124,8 @@ async function callRemoteTool(
124
124
  if (result?.content && Array.isArray(result.content)) {
125
125
  const text = joinCallToolText(result.content as CallToolTextContent[]);
126
126
 
127
+ if (result.structuredContent) return result.structuredContent;
128
+
127
129
  if (result.isError) {
128
130
  // Try to preserve structured error data (e.g., authentication_required with connectUrl)
129
131
  const parsed = parseJsonText(text);
@@ -131,8 +133,6 @@ async function callRemoteTool(
131
133
  return { error: "tool_error", message: text };
132
134
  }
133
135
 
134
- if (result.structuredContent) return result.structuredContent;
135
-
136
136
  return parseJsonText(text) ?? text;
137
137
  }
138
138
 
@@ -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.537";
3
+ export const VERSION = "0.1.539";