@voltagent/core 2.6.7 → 2.6.10

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/dist/index.d.mts CHANGED
@@ -8796,6 +8796,7 @@ declare class Memory {
8796
8796
  * Get messages by their IDs
8797
8797
  */
8798
8798
  private getMessagesByIds;
8799
+ private getMessageVectorIdsForClear;
8799
8800
  /**
8800
8801
  * Merge two arrays of messages, removing duplicates
8801
8802
  */
@@ -9369,6 +9370,7 @@ declare class Agent {
9369
9370
  */
9370
9371
  private prepareExecution;
9371
9372
  private collectToolDataFromResult;
9373
+ private ensureStructuredOutputGenerated;
9372
9374
  /**
9373
9375
  * Create execution context
9374
9376
  */
@@ -9404,6 +9406,7 @@ declare class Agent {
9404
9406
  private createLLMSpanFinalizer;
9405
9407
  private buildLLMSpanAttributes;
9406
9408
  private recordLLMUsage;
9409
+ private recordProviderCost;
9407
9410
  private createEvalHost;
9408
9411
  /**
9409
9412
  * Get observability instance (lazy initialization)
@@ -9682,6 +9685,7 @@ declare class Agent {
9682
9685
  * Maps AI SDK's LanguageModelUsage to trace context format
9683
9686
  */
9684
9687
  private setTraceContextUsage;
9688
+ private recordRootSpanUsageAndProviderCost;
9685
9689
  /**
9686
9690
  * Create working memory tools if configured
9687
9691
  */
package/dist/index.d.ts CHANGED
@@ -8796,6 +8796,7 @@ declare class Memory {
8796
8796
  * Get messages by their IDs
8797
8797
  */
8798
8798
  private getMessagesByIds;
8799
+ private getMessageVectorIdsForClear;
8799
8800
  /**
8800
8801
  * Merge two arrays of messages, removing duplicates
8801
8802
  */
@@ -9369,6 +9370,7 @@ declare class Agent {
9369
9370
  */
9370
9371
  private prepareExecution;
9371
9372
  private collectToolDataFromResult;
9373
+ private ensureStructuredOutputGenerated;
9372
9374
  /**
9373
9375
  * Create execution context
9374
9376
  */
@@ -9404,6 +9406,7 @@ declare class Agent {
9404
9406
  private createLLMSpanFinalizer;
9405
9407
  private buildLLMSpanAttributes;
9406
9408
  private recordLLMUsage;
9409
+ private recordProviderCost;
9407
9410
  private createEvalHost;
9408
9411
  /**
9409
9412
  * Get observability instance (lazy initialization)
@@ -9682,6 +9685,7 @@ declare class Agent {
9682
9685
  * Maps AI SDK's LanguageModelUsage to trace context format
9683
9686
  */
9684
9687
  private setTraceContextUsage;
9688
+ private recordRootSpanUsageAndProviderCost;
9685
9689
  /**
9686
9690
  * Create working memory tools if configured
9687
9691
  */
package/dist/index.js CHANGED
@@ -352,7 +352,7 @@ __export(index_exports, {
352
352
  hasFilePart: () => hasFilePart,
353
353
  hasImagePart: () => hasImagePart,
354
354
  hasTextPart: () => hasTextPart,
355
- hasToolCall: () => import_ai8.hasToolCall,
355
+ hasToolCall: () => import_ai9.hasToolCall,
356
356
  isAbortError: () => isAbortError,
357
357
  isMiddlewareAbortError: () => isMiddlewareAbortError,
358
358
  isNodeRuntime: () => isNodeRuntime,
@@ -375,7 +375,7 @@ __export(index_exports, {
375
375
  serializeValueForDebug: () => serializeValueForDebug,
376
376
  setWaitUntil: () => setWaitUntil,
377
377
  shouldSample: () => shouldSample,
378
- stepCountIs: () => import_ai8.stepCountIs,
378
+ stepCountIs: () => import_ai9.stepCountIs,
379
379
  tool: () => tool,
380
380
  trace: () => import_api9.trace,
381
381
  transformTextContent: () => transformTextContent,
@@ -5248,6 +5248,7 @@ __name(cosineSimilarity, "cosineSimilarity");
5248
5248
  // src/memory/index.ts
5249
5249
  var isEmbeddingAdapter = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && "embed" in value && typeof value.embed === "function" && "embedBatch" in value && typeof value.embedBatch === "function", "isEmbeddingAdapter");
5250
5250
  var isEmbeddingAdapterConfig = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && "model" in value && !isEmbeddingAdapter(value), "isEmbeddingAdapterConfig");
5251
+ var VECTOR_CLEAR_CONVERSATION_PAGE_SIZE = 200;
5251
5252
  var resolveEmbeddingAdapter = /* @__PURE__ */ __name((embedding) => {
5252
5253
  if (!embedding) {
5253
5254
  return void 0;
@@ -5333,6 +5334,19 @@ var Memory = class {
5333
5334
  * Clear messages for a user
5334
5335
  */
5335
5336
  async clearMessages(userId, conversationId, context8) {
5337
+ if (this.vector) {
5338
+ try {
5339
+ const vectorIds = await this.getMessageVectorIdsForClear(userId, conversationId);
5340
+ if (vectorIds.length > 0) {
5341
+ await this.vector.deleteBatch(vectorIds);
5342
+ }
5343
+ } catch (error) {
5344
+ console.warn(
5345
+ `Failed to delete vectors while clearing messages for user ${userId}${conversationId ? ` conversation ${conversationId}` : ""}:`,
5346
+ error
5347
+ );
5348
+ }
5349
+ }
5336
5350
  return this.storage.clearMessages(userId, conversationId, context8);
5337
5351
  }
5338
5352
  /**
@@ -5469,6 +5483,36 @@ var Memory = class {
5469
5483
  const ordered = messageIds.map((id) => byId.get(id)).filter((m) => Boolean(m));
5470
5484
  return ordered;
5471
5485
  }
5486
+ async getMessageVectorIdsForClear(userId, conversationId) {
5487
+ const vectorIds = /* @__PURE__ */ new Set();
5488
+ if (conversationId) {
5489
+ const messages = await this.storage.getMessages(userId, conversationId);
5490
+ for (const message of messages) {
5491
+ vectorIds.add(`msg_${conversationId}_${message.id}`);
5492
+ }
5493
+ return Array.from(vectorIds);
5494
+ }
5495
+ const totalConversations = await this.storage.countConversations({ userId });
5496
+ let offset = 0;
5497
+ while (offset < totalConversations) {
5498
+ const conversations = await this.storage.queryConversations({
5499
+ userId,
5500
+ limit: VECTOR_CLEAR_CONVERSATION_PAGE_SIZE,
5501
+ offset
5502
+ });
5503
+ for (const conversation of conversations) {
5504
+ const messages = await this.storage.getMessages(userId, conversation.id);
5505
+ for (const message of messages) {
5506
+ vectorIds.add(`msg_${conversation.id}_${message.id}`);
5507
+ }
5508
+ }
5509
+ if (conversations.length === 0) {
5510
+ break;
5511
+ }
5512
+ offset += conversations.length;
5513
+ }
5514
+ return Array.from(vectorIds);
5515
+ }
5472
5516
  /**
5473
5517
  * Merge two arrays of messages, removing duplicates
5474
5518
  */
@@ -26315,6 +26359,10 @@ var AgentTraceContext = class {
26315
26359
  function addModelAttributesToSpan(span, modelName, options, defaultMaxOutputTokens, defaultTemperature) {
26316
26360
  if (!span) return;
26317
26361
  span.setAttribute("ai.model.name", modelName);
26362
+ const provider = typeof modelName === "string" && modelName.includes("/") ? modelName.split("/")[0] : void 0;
26363
+ if (provider) {
26364
+ span.setAttribute("ai.model.provider", provider);
26365
+ }
26318
26366
  const temperature = options?.temperature ?? options?.providerOptions?.temperature ?? defaultTemperature;
26319
26367
  if (temperature !== void 0 && typeof temperature === "number") {
26320
26368
  span.setAttribute("ai.model.temperature", temperature);
@@ -30028,6 +30076,7 @@ var DEFAULT_CONVERSATION_PERSISTENCE_OPTIONS = {
30028
30076
  flushOnToolResult: true
30029
30077
  };
30030
30078
  var isRecord4 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null, "isRecord");
30079
+ var isPlainObject = /* @__PURE__ */ __name((value) => isRecord4(value) && !Array.isArray(value), "isPlainObject");
30031
30080
  var hasNonEmptyString2 = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim().length > 0, "hasNonEmptyString");
30032
30081
  var firstNonBlank = /* @__PURE__ */ __name((...values) => {
30033
30082
  for (const value of values) {
@@ -30045,6 +30094,58 @@ var firstDefined = /* @__PURE__ */ __name((...values) => {
30045
30094
  }
30046
30095
  return void 0;
30047
30096
  }, "firstDefined");
30097
+ var toFiniteNumber = /* @__PURE__ */ __name((value) => {
30098
+ if (typeof value === "number") {
30099
+ return Number.isFinite(value) ? value : void 0;
30100
+ }
30101
+ if (typeof value === "string") {
30102
+ const parsed = Number(value);
30103
+ return Number.isFinite(parsed) ? parsed : void 0;
30104
+ }
30105
+ return void 0;
30106
+ }, "toFiniteNumber");
30107
+ var toBoolean = /* @__PURE__ */ __name((value) => {
30108
+ if (typeof value === "boolean") {
30109
+ return value;
30110
+ }
30111
+ if (typeof value === "string") {
30112
+ const normalized = value.trim().toLowerCase();
30113
+ if (normalized === "true") return true;
30114
+ if (normalized === "false") return false;
30115
+ }
30116
+ return void 0;
30117
+ }, "toBoolean");
30118
+ var extractOpenRouterUsageCost = /* @__PURE__ */ __name((providerMetadata) => {
30119
+ if (!isPlainObject(providerMetadata)) {
30120
+ return void 0;
30121
+ }
30122
+ const openRouterMetadata = isPlainObject(providerMetadata.openrouter) ? providerMetadata.openrouter : void 0;
30123
+ const usage = openRouterMetadata && isPlainObject(openRouterMetadata.usage) ? openRouterMetadata.usage : void 0;
30124
+ if (!usage) {
30125
+ return void 0;
30126
+ }
30127
+ const costDetails = firstDefined(
30128
+ isPlainObject(usage.costDetails) ? usage.costDetails : void 0,
30129
+ isPlainObject(usage.cost_details) ? usage.cost_details : void 0
30130
+ );
30131
+ const result = {
30132
+ cost: toFiniteNumber(usage.cost),
30133
+ isByok: firstDefined(toBoolean(usage.isByok), toBoolean(usage.is_byok)),
30134
+ upstreamInferenceCost: firstDefined(
30135
+ toFiniteNumber(costDetails?.upstreamInferenceCost),
30136
+ toFiniteNumber(costDetails?.upstream_inference_cost)
30137
+ ),
30138
+ upstreamInferenceInputCost: firstDefined(
30139
+ toFiniteNumber(costDetails?.upstreamInferenceInputCost),
30140
+ toFiniteNumber(costDetails?.upstream_inference_input_cost)
30141
+ ),
30142
+ upstreamInferenceOutputCost: firstDefined(
30143
+ toFiniteNumber(costDetails?.upstreamInferenceOutputCost),
30144
+ toFiniteNumber(costDetails?.upstream_inference_output_cost)
30145
+ )
30146
+ };
30147
+ return Object.values(result).some((value) => value !== void 0) ? result : void 0;
30148
+ }, "extractOpenRouterUsageCost");
30048
30149
  var isAssistantContentPart = /* @__PURE__ */ __name((value) => {
30049
30150
  if (!isRecord4(value)) {
30050
30151
  return false;
@@ -30604,10 +30705,17 @@ var Agent = class {
30604
30705
  onStepFinish: this.createStepHandler(oc, options)
30605
30706
  })
30606
30707
  );
30708
+ this.ensureStructuredOutputGenerated({
30709
+ result: response,
30710
+ output,
30711
+ tools,
30712
+ maxSteps
30713
+ });
30607
30714
  const resolvedProviderUsage = response.usage ? await Promise.resolve(response.usage) : void 0;
30608
30715
  finalizeLLMSpan(import_api16.SpanStatusCode.OK, {
30609
30716
  usage: resolvedProviderUsage,
30610
- finishReason: response.finishReason
30717
+ finishReason: response.finishReason,
30718
+ providerMetadata: response.providerMetadata
30611
30719
  });
30612
30720
  return response;
30613
30721
  } catch (error) {
@@ -30629,6 +30737,11 @@ var Agent = class {
30629
30737
  usage: providerUsage,
30630
30738
  totalUsage: result.totalUsage
30631
30739
  });
30740
+ this.recordRootSpanUsageAndProviderCost(
30741
+ oc.traceContext,
30742
+ usageForFinish,
30743
+ result.providerMetadata
30744
+ );
30632
30745
  const { toolCalls: aggregatedToolCalls, toolResults: aggregatedToolResults } = this.collectToolDataFromResult(result);
30633
30746
  const usageInfo = convertUsage(usageForFinish);
30634
30747
  const middlewareText = await runOutputMiddlewares(
@@ -30690,7 +30803,6 @@ var Agent = class {
30690
30803
  text: finalText
30691
30804
  }
30692
30805
  );
30693
- this.setTraceContextUsage(oc.traceContext, usageForFinish);
30694
30806
  oc.traceContext.setOutput(finalText);
30695
30807
  oc.traceContext.setFinishReason(result.finishReason);
30696
30808
  if (result.steps && result.steps.length >= maxSteps) {
@@ -31164,14 +31276,19 @@ var Agent = class {
31164
31276
  usage: providerUsage,
31165
31277
  totalUsage: finalResult.totalUsage
31166
31278
  });
31279
+ this.recordRootSpanUsageAndProviderCost(
31280
+ oc.traceContext,
31281
+ usageForFinish,
31282
+ finalResult.providerMetadata
31283
+ );
31167
31284
  finalizeLLMSpan(import_api16.SpanStatusCode.OK, {
31168
31285
  usage: providerUsage,
31169
- finishReason: finalResult.finishReason
31286
+ finishReason: finalResult.finishReason,
31287
+ providerMetadata: finalResult.providerMetadata
31170
31288
  });
31171
31289
  if (!shouldDeferPersist && shouldPersistMemory) {
31172
31290
  await persistQueue.flush(buffer, oc);
31173
31291
  }
31174
- this.setTraceContextUsage(oc.traceContext, usageForFinish);
31175
31292
  const usage = convertUsage(usageForFinish);
31176
31293
  let finalText;
31177
31294
  const bailedResult = oc.systemContext.get("bailedResult");
@@ -31273,7 +31390,8 @@ var Agent = class {
31273
31390
  });
31274
31391
  finalizeLLMSpan(import_api16.SpanStatusCode.OK, {
31275
31392
  usage: usageForFinish,
31276
- finishReason: finalResult.finishReason
31393
+ finishReason: finalResult.finishReason,
31394
+ providerMetadata: finalResult.providerMetadata
31277
31395
  });
31278
31396
  oc.traceContext.end("completed");
31279
31397
  feedbackFinalizeRequested = true;
@@ -31729,6 +31847,11 @@ var Agent = class {
31729
31847
  usage: providerUsage,
31730
31848
  totalUsage: result.totalUsage
31731
31849
  });
31850
+ this.recordRootSpanUsageAndProviderCost(
31851
+ oc.traceContext,
31852
+ usageForFinish,
31853
+ result.providerMetadata
31854
+ );
31732
31855
  const usageInfo = convertUsage(usageForFinish);
31733
31856
  const middlewareObject = await runOutputMiddlewares(
31734
31857
  result.object,
@@ -31776,7 +31899,6 @@ var Agent = class {
31776
31899
  };
31777
31900
  this.addStepToHistory(step, oc);
31778
31901
  }
31779
- this.setTraceContextUsage(oc.traceContext, usageForFinish);
31780
31902
  oc.traceContext.setOutput(finalObject);
31781
31903
  oc.output = finalObject;
31782
31904
  this.enqueueEvalScoring({
@@ -32084,6 +32206,11 @@ var Agent = class {
32084
32206
  usage: providerUsage,
32085
32207
  totalUsage: finalResult.totalUsage
32086
32208
  });
32209
+ this.recordRootSpanUsageAndProviderCost(
32210
+ oc.traceContext,
32211
+ usageForFinish,
32212
+ finalResult.providerMetadata
32213
+ );
32087
32214
  const usageInfo = convertUsage(usageForFinish);
32088
32215
  let finalObject = finalResult.object;
32089
32216
  if (guardrailSet.output.length > 0) {
@@ -32122,7 +32249,6 @@ var Agent = class {
32122
32249
  };
32123
32250
  this.addStepToHistory(step, oc);
32124
32251
  }
32125
- this.setTraceContextUsage(oc.traceContext, usageForFinish);
32126
32252
  oc.traceContext.setOutput(finalObject);
32127
32253
  oc.output = finalObject;
32128
32254
  await this.getMergedHooks(options).onEnd?.({
@@ -32345,6 +32471,42 @@ Metadata: ${(0, import_utils33.safeStringify)(metadata)}`;
32345
32471
  toolResults: stepToolResults.length > 0 ? stepToolResults : result.toolResults ?? []
32346
32472
  };
32347
32473
  }
32474
+ ensureStructuredOutputGenerated(params) {
32475
+ const { result, output, tools, maxSteps } = params;
32476
+ if (!output) {
32477
+ return;
32478
+ }
32479
+ try {
32480
+ void result.output;
32481
+ } catch (error) {
32482
+ const isNoOutputGeneratedError = error instanceof import_ai7.NoOutputGeneratedError || error instanceof Error && error.name === "AI_NoOutputGeneratedError";
32483
+ if (!isNoOutputGeneratedError) {
32484
+ throw error;
32485
+ }
32486
+ const { toolCalls } = this.collectToolDataFromResult(result);
32487
+ const configuredToolCount = Object.keys(tools ?? {}).length;
32488
+ const stepCount = result.steps?.length ?? 0;
32489
+ const finishReason = result.finishReason ?? "unknown";
32490
+ const reachedMaxSteps = stepCount >= maxSteps;
32491
+ const guidance = configuredToolCount > 0 || toolCalls.length > 0 ? "When tools are enabled, ensure the model emits a final non-tool response that matches the output schema, or split this into two calls (tools first, schema formatting second)." : "Ensure the model emits a final response that matches the requested output schema.";
32492
+ const maxStepHint = reachedMaxSteps ? ` Generation stopped after ${stepCount} steps (maxSteps=${maxSteps}).` : "";
32493
+ throw createVoltAgentError(
32494
+ `Structured output was requested but no final output was generated (finishReason: ${finishReason}). ${guidance}${maxStepHint}`,
32495
+ {
32496
+ stage: "response_parsing",
32497
+ code: "STRUCTURED_OUTPUT_NOT_GENERATED",
32498
+ originalError: error,
32499
+ metadata: {
32500
+ finishReason,
32501
+ stepCount,
32502
+ maxSteps,
32503
+ configuredToolCount,
32504
+ toolCallCount: toolCalls.length
32505
+ }
32506
+ }
32507
+ );
32508
+ }
32509
+ }
32348
32510
  /**
32349
32511
  * Create execution context
32350
32512
  */
@@ -32693,6 +32855,9 @@ Metadata: ${(0, import_utils33.safeStringify)(metadata)}`;
32693
32855
  if (details?.usage) {
32694
32856
  this.recordLLMUsage(span, details.usage);
32695
32857
  }
32858
+ if (details?.providerMetadata !== void 0) {
32859
+ this.recordProviderCost(span, details.providerMetadata);
32860
+ }
32696
32861
  if (details?.finishReason) {
32697
32862
  span.setAttribute("llm.finish_reason", String(details.finishReason));
32698
32863
  }
@@ -32798,6 +32963,36 @@ Metadata: ${(0, import_utils33.safeStringify)(metadata)}`;
32798
32963
  span.setAttribute("llm.usage.total_tokens", totalTokens);
32799
32964
  }
32800
32965
  }
32966
+ recordProviderCost(span, providerMetadata) {
32967
+ const openRouterUsageCost = extractOpenRouterUsageCost(providerMetadata);
32968
+ if (!openRouterUsageCost) {
32969
+ return;
32970
+ }
32971
+ if (openRouterUsageCost.cost !== void 0) {
32972
+ span.setAttribute("usage.cost", openRouterUsageCost.cost);
32973
+ }
32974
+ if (openRouterUsageCost.isByok !== void 0) {
32975
+ span.setAttribute("usage.is_byok", openRouterUsageCost.isByok);
32976
+ }
32977
+ if (openRouterUsageCost.upstreamInferenceCost !== void 0) {
32978
+ span.setAttribute(
32979
+ "usage.cost_details.upstream_inference_cost",
32980
+ openRouterUsageCost.upstreamInferenceCost
32981
+ );
32982
+ }
32983
+ if (openRouterUsageCost.upstreamInferenceInputCost !== void 0) {
32984
+ span.setAttribute(
32985
+ "usage.cost_details.upstream_inference_input_cost",
32986
+ openRouterUsageCost.upstreamInferenceInputCost
32987
+ );
32988
+ }
32989
+ if (openRouterUsageCost.upstreamInferenceOutputCost !== void 0) {
32990
+ span.setAttribute(
32991
+ "usage.cost_details.upstream_inference_output_cost",
32992
+ openRouterUsageCost.upstreamInferenceOutputCost
32993
+ );
32994
+ }
32995
+ }
32801
32996
  createEvalHost() {
32802
32997
  return {
32803
32998
  id: this.id,
@@ -33002,7 +33197,8 @@ Metadata: ${(0, import_utils33.safeStringify)(metadata)}`;
33002
33197
  }
33003
33198
  finalizeLLMSpan(import_api16.SpanStatusCode.OK, {
33004
33199
  usage: resolvedUsage,
33005
- finishReason: result.finishReason
33200
+ finishReason: result.finishReason,
33201
+ providerMetadata: result.providerMetadata
33006
33202
  });
33007
33203
  return title || null;
33008
33204
  } catch (error) {
@@ -33651,6 +33847,9 @@ ${retrieverContext}`;
33651
33847
  return true;
33652
33848
  }
33653
33849
  isRetryableError(error) {
33850
+ if (isVoltAgentError(error) && error.code === "STRUCTURED_OUTPUT_NOT_GENERATED") {
33851
+ return true;
33852
+ }
33654
33853
  const retryable = error?.isRetryable;
33655
33854
  if (typeof retryable === "boolean") {
33656
33855
  return retryable;
@@ -34779,7 +34978,8 @@ ${retrieverContext}`;
34779
34978
  const resolvedUsage = response.usage ? await Promise.resolve(response.usage) : void 0;
34780
34979
  finalizeLLMSpan(import_api16.SpanStatusCode.OK, {
34781
34980
  usage: resolvedUsage,
34782
- finishReason: response.finishReason
34981
+ finishReason: response.finishReason,
34982
+ providerMetadata: response.providerMetadata
34783
34983
  });
34784
34984
  return response;
34785
34985
  } catch (error) {
@@ -35796,6 +35996,10 @@ ${retrieverContext}`;
35796
35996
  reasoningTokens: resolvedUsage.reasoningTokens
35797
35997
  });
35798
35998
  }
35999
+ recordRootSpanUsageAndProviderCost(traceContext, usage, providerMetadata) {
36000
+ this.setTraceContextUsage(traceContext, usage);
36001
+ this.recordProviderCost(traceContext.getRootSpan(), providerMetadata);
36002
+ }
35799
36003
  /**
35800
36004
  * Create working memory tools if configured
35801
36005
  */
@@ -41315,6 +41519,9 @@ var TriggerRegistry = class _TriggerRegistry {
41315
41519
  }
41316
41520
  };
41317
41521
 
41522
+ // src/voltagent.ts
41523
+ var import_ai8 = require("ai");
41524
+
41318
41525
  // src/utils/voltops-validation.ts
41319
41526
  function isValidVoltOpsKeys(publicKey, secretKey) {
41320
41527
  if (!publicKey || !secretKey) {
@@ -41635,9 +41842,12 @@ var VoltAgent = class {
41635
41842
  process.once("SIGTERM", () => handleSignal("SIGTERM"));
41636
41843
  process.once("SIGINT", () => handleSignal("SIGINT"));
41637
41844
  process.on("unhandledRejection", (reason) => {
41845
+ const isStructuredOutputWrapperError = isVoltAgentError(reason) && reason.code === "STRUCTURED_OUTPUT_NOT_GENERATED";
41846
+ const isNoOutputGeneratedError = isStructuredOutputWrapperError || reason instanceof import_ai8.NoOutputGeneratedError || reason instanceof Error && reason.name === "AI_NoOutputGeneratedError";
41638
41847
  this.logger.error("[VoltAgent] Unhandled Promise Rejection:", {
41639
41848
  reason: reason instanceof Error ? reason.message : reason,
41640
- stack: reason instanceof Error ? reason.stack : void 0
41849
+ stack: reason instanceof Error ? reason.stack : void 0,
41850
+ hint: isNoOutputGeneratedError ? "Structured output was requested but no final output was generated. If tools are enabled, ensure a final schema-matching response or split into two calls." : void 0
41641
41851
  });
41642
41852
  });
41643
41853
  }
@@ -41943,7 +42153,7 @@ var VoltAgent = class {
41943
42153
 
41944
42154
  // src/index.ts
41945
42155
  var import_utils40 = require("@voltagent/internal/utils");
41946
- var import_ai8 = require("ai");
42156
+ var import_ai9 = require("ai");
41947
42157
  // Annotate the CommonJS export names for ESM import in node:
41948
42158
  0 && (module.exports = {
41949
42159
  A2AServerRegistry,