veryfront 0.1.537 → 0.1.538

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.538",
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;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.537";
1
+ export declare const VERSION = "0.1.538";
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.538";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.537",
3
+ "version": "0.1.538",
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.538",
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;
@@ -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.538";