@voltagent/core 2.0.7 → 2.0.8

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
@@ -6629,8 +6629,8 @@ type AgentConfig$1<SCHEMA extends z.ZodTypeAny, INPUT, DATA> = BaseGenerationOpt
6629
6629
  * ```
6630
6630
  *
6631
6631
  * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string
6632
- * @param agent - The agent to execute the task using `generateObject`
6633
- * @param config - The config for the agent (schema) `generateObject` call
6632
+ * @param agent - The agent to execute the task using `generateText`
6633
+ * @param config - The config for the agent (schema) `generateText` call
6634
6634
  * @returns A workflow step that executes the agent with the task
6635
6635
  */
6636
6636
  declare function andAgent<INPUT, DATA, SCHEMA extends z.ZodTypeAny>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc<INPUT, DATA, UIMessage[] | ModelMessage[] | string, any, any>, agent: Agent, config: AgentConfig$1<SCHEMA, INPUT, DATA>): {
@@ -7116,8 +7116,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7116
7116
  * ```
7117
7117
  *
7118
7118
  * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string
7119
- * @param agent - The agent to execute the task using `generateObject`
7120
- * @param config - The config for the agent (schema) `generateObject` call
7119
+ * @param agent - The agent to execute the task using `generateText`
7120
+ * @param config - The config for the agent (schema) `generateText` call
7121
7121
  * @returns A workflow step that executes the agent with the task
7122
7122
  */
7123
7123
  andAgent<SCHEMA extends z.ZodTypeAny>(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, string | UIMessage[] | ModelMessage[], any, any>, agent: Agent, config: AgentConfig<SCHEMA, INPUT_SCHEMA, CURRENT_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, z.infer<SCHEMA>, SUSPEND_SCHEMA, RESUME_SCHEMA>;
@@ -7314,11 +7314,11 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7314
7314
  * id: "process-pending",
7315
7315
  * condition: async ({ data }) => data.status === "pending",
7316
7316
  * execute: async ({ data }) => {
7317
- * const result = await agent.generateObject(
7317
+ * const result = await agent.generateText(
7318
7318
  * `Process pending request for ${data.userId}`,
7319
- * z.object({ processed: z.boolean() })
7319
+ * { output: Output.object({ schema: z.object({ processed: z.boolean() }) }) }
7320
7320
  * );
7321
- * return { ...data, ...result.object };
7321
+ * return { ...data, ...result.output };
7322
7322
  * }
7323
7323
  * });
7324
7324
  * ```
@@ -7447,11 +7447,11 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7447
7447
  * {
7448
7448
  * id: "generate-recommendations",
7449
7449
  * execute: async ({ data }) => {
7450
- * const result = await agent.generateObject(
7450
+ * const result = await agent.generateText(
7451
7451
  * `Generate recommendations for user ${data.userId}`,
7452
- * z.object({ recommendations: z.array(z.string()) })
7452
+ * { output: Output.object({ schema: z.object({ recommendations: z.array(z.string()) }) }) }
7453
7453
  * );
7454
- * return result.object;
7454
+ * return result.output;
7455
7455
  * }
7456
7456
  * }
7457
7457
  * ]
@@ -7497,11 +7497,15 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7497
7497
  * {
7498
7498
  * id: "ai-fallback",
7499
7499
  * execute: async ({ data }) => {
7500
- * const result = await agent.generateObject(
7500
+ * const result = await agent.generateText(
7501
7501
  * `Generate fallback response for: ${data.query}`,
7502
- * z.object({ source: z.literal("ai"), result: z.string() })
7502
+ * {
7503
+ * output: Output.object({
7504
+ * schema: z.object({ source: z.literal("ai"), result: z.string() }),
7505
+ * }),
7506
+ * }
7503
7507
  * );
7504
- * return result.object;
7508
+ * return result.output;
7505
7509
  * }
7506
7510
  * }
7507
7511
  * ]
package/dist/index.d.ts CHANGED
@@ -6629,8 +6629,8 @@ type AgentConfig$1<SCHEMA extends z.ZodTypeAny, INPUT, DATA> = BaseGenerationOpt
6629
6629
  * ```
6630
6630
  *
6631
6631
  * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string
6632
- * @param agent - The agent to execute the task using `generateObject`
6633
- * @param config - The config for the agent (schema) `generateObject` call
6632
+ * @param agent - The agent to execute the task using `generateText`
6633
+ * @param config - The config for the agent (schema) `generateText` call
6634
6634
  * @returns A workflow step that executes the agent with the task
6635
6635
  */
6636
6636
  declare function andAgent<INPUT, DATA, SCHEMA extends z.ZodTypeAny>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc<INPUT, DATA, UIMessage[] | ModelMessage[] | string, any, any>, agent: Agent, config: AgentConfig$1<SCHEMA, INPUT, DATA>): {
@@ -7116,8 +7116,8 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7116
7116
  * ```
7117
7117
  *
7118
7118
  * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string
7119
- * @param agent - The agent to execute the task using `generateObject`
7120
- * @param config - The config for the agent (schema) `generateObject` call
7119
+ * @param agent - The agent to execute the task using `generateText`
7120
+ * @param config - The config for the agent (schema) `generateText` call
7121
7121
  * @returns A workflow step that executes the agent with the task
7122
7122
  */
7123
7123
  andAgent<SCHEMA extends z.ZodTypeAny>(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, string | UIMessage[] | ModelMessage[], any, any>, agent: Agent, config: AgentConfig<SCHEMA, INPUT_SCHEMA, CURRENT_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, z.infer<SCHEMA>, SUSPEND_SCHEMA, RESUME_SCHEMA>;
@@ -7314,11 +7314,11 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7314
7314
  * id: "process-pending",
7315
7315
  * condition: async ({ data }) => data.status === "pending",
7316
7316
  * execute: async ({ data }) => {
7317
- * const result = await agent.generateObject(
7317
+ * const result = await agent.generateText(
7318
7318
  * `Process pending request for ${data.userId}`,
7319
- * z.object({ processed: z.boolean() })
7319
+ * { output: Output.object({ schema: z.object({ processed: z.boolean() }) }) }
7320
7320
  * );
7321
- * return { ...data, ...result.object };
7321
+ * return { ...data, ...result.output };
7322
7322
  * }
7323
7323
  * });
7324
7324
  * ```
@@ -7447,11 +7447,11 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7447
7447
  * {
7448
7448
  * id: "generate-recommendations",
7449
7449
  * execute: async ({ data }) => {
7450
- * const result = await agent.generateObject(
7450
+ * const result = await agent.generateText(
7451
7451
  * `Generate recommendations for user ${data.userId}`,
7452
- * z.object({ recommendations: z.array(z.string()) })
7452
+ * { output: Output.object({ schema: z.object({ recommendations: z.array(z.string()) }) }) }
7453
7453
  * );
7454
- * return result.object;
7454
+ * return result.output;
7455
7455
  * }
7456
7456
  * }
7457
7457
  * ]
@@ -7497,11 +7497,15 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
7497
7497
  * {
7498
7498
  * id: "ai-fallback",
7499
7499
  * execute: async ({ data }) => {
7500
- * const result = await agent.generateObject(
7500
+ * const result = await agent.generateText(
7501
7501
  * `Generate fallback response for: ${data.query}`,
7502
- * z.object({ source: z.literal("ai"), result: z.string() })
7502
+ * {
7503
+ * output: Output.object({
7504
+ * schema: z.object({ source: z.literal("ai"), result: z.string() }),
7505
+ * }),
7506
+ * }
7503
7507
  * );
7504
- * return result.object;
7508
+ * return result.output;
7505
7509
  * }
7506
7510
  * }
7507
7511
  * ]
package/dist/index.js CHANGED
@@ -328,7 +328,7 @@ __export(index_exports, {
328
328
  hasFilePart: () => hasFilePart,
329
329
  hasImagePart: () => hasImagePart,
330
330
  hasTextPart: () => hasTextPart,
331
- hasToolCall: () => import_ai7.hasToolCall,
331
+ hasToolCall: () => import_ai8.hasToolCall,
332
332
  isAbortError: () => isAbortError,
333
333
  isNodeRuntime: () => isNodeRuntime,
334
334
  isServerlessRuntime: () => isServerlessRuntime,
@@ -349,7 +349,7 @@ __export(index_exports, {
349
349
  serializeValueForDebug: () => serializeValueForDebug,
350
350
  setWaitUntil: () => setWaitUntil,
351
351
  shouldSample: () => shouldSample,
352
- stepCountIs: () => import_ai7.stepCountIs,
352
+ stepCountIs: () => import_ai8.stepCountIs,
353
353
  tool: () => tool,
354
354
  trace: () => import_api8.trace,
355
355
  transformTextContent: () => transformTextContent,
@@ -360,6 +360,9 @@ __export(index_exports, {
360
360
  });
361
361
  module.exports = __toCommonJS(index_exports);
362
362
 
363
+ // src/workflow/steps/and-agent.ts
364
+ var import_ai = require("ai");
365
+
363
366
  // src/utils/usage-converter.ts
364
367
  function convertUsage(usage) {
365
368
  if (!usage) return void 0;
@@ -400,13 +403,15 @@ function andAgent(task, agent, config) {
400
403
  const { schema, ...restConfig } = config;
401
404
  const finalTask = typeof task === "function" ? await task(context8) : task;
402
405
  const finalSchema = typeof schema === "function" ? await schema(context8) : schema;
406
+ const output = import_ai.Output.object({ schema: finalSchema });
403
407
  if (!state.workflowContext) {
404
- const result = await agent.generateObject(finalTask, finalSchema, {
408
+ const result = await agent.generateText(finalTask, {
405
409
  ...restConfig,
406
410
  context: restConfig.context ?? state.context,
407
411
  conversationId: restConfig.conversationId ?? state.conversationId,
408
- userId: restConfig.userId ?? state.userId
412
+ userId: restConfig.userId ?? state.userId,
409
413
  // No parentSpan when there's no workflow context
414
+ output
410
415
  });
411
416
  if (result.usage && state.usage) {
412
417
  const convertedUsage = convertUsage(result.usage);
@@ -420,16 +425,17 @@ function andAgent(task, agent, config) {
420
425
  }
421
426
  state.usage.totalTokens += convertedUsage?.totalTokens || 0;
422
427
  }
423
- return result.object;
428
+ return result.output;
424
429
  }
425
430
  try {
426
- const result = await agent.generateObject(finalTask, finalSchema, {
431
+ const result = await agent.generateText(finalTask, {
427
432
  ...restConfig,
428
433
  context: restConfig.context ?? state.context,
429
434
  conversationId: restConfig.conversationId ?? state.conversationId,
430
435
  userId: restConfig.userId ?? state.userId,
431
436
  // Pass the current step span as parent for proper span hierarchy
432
- parentSpan: state.workflowContext?.currentStepSpan
437
+ parentSpan: state.workflowContext?.currentStepSpan,
438
+ output
433
439
  });
434
440
  if (result.usage && state.usage) {
435
441
  const convertedUsage = convertUsage(result.usage);
@@ -443,7 +449,7 @@ function andAgent(task, agent, config) {
443
449
  }
444
450
  state.usage.totalTokens += convertedUsage?.totalTokens || 0;
445
451
  }
446
- return result.object;
452
+ return result.output;
447
453
  } catch (error) {
448
454
  if (error instanceof Error && (error.message === "WORKFLOW_SUSPENDED" || error.message === "WORKFLOW_CANCELLED")) {
449
455
  throw error;
@@ -456,7 +462,7 @@ function andAgent(task, agent, config) {
456
462
  __name(andAgent, "andAgent");
457
463
 
458
464
  // src/workflow/internal/utils.ts
459
- var import_ai = require("ai");
465
+ var import_ai2 = require("ai");
460
466
  function convertWorkflowStateToParam(state, executionContext, signal) {
461
467
  return {
462
468
  executionId: state.executionId,
@@ -503,7 +509,7 @@ var convertWorkflowStreamEventToUIMessage = /* @__PURE__ */ __name((message) =>
503
509
  }, "convertWorkflowStreamEventToUIMessage");
504
510
  function eventToUIMessageStreamResponse(streamController) {
505
511
  return (options) => {
506
- const uiStream = (0, import_ai.createUIMessageStream)({
512
+ const uiStream = (0, import_ai2.createUIMessageStream)({
507
513
  execute: /* @__PURE__ */ __name(async ({ writer }) => {
508
514
  for await (const event of streamController.getStream()) {
509
515
  const chunk = convertWorkflowStreamEventToUIMessage(event);
@@ -512,7 +518,7 @@ function eventToUIMessageStreamResponse(streamController) {
512
518
  }, "execute"),
513
519
  onError: /* @__PURE__ */ __name((error) => String(error), "onError")
514
520
  });
515
- return (0, import_ai.createUIMessageStreamResponse)({
521
+ return (0, import_ai2.createUIMessageStreamResponse)({
516
522
  stream: uiStream,
517
523
  ...options || {}
518
524
  });
@@ -7283,8 +7289,8 @@ var WorkflowChain = class {
7283
7289
  * ```
7284
7290
  *
7285
7291
  * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string
7286
- * @param agent - The agent to execute the task using `generateObject`
7287
- * @param config - The config for the agent (schema) `generateObject` call
7292
+ * @param agent - The agent to execute the task using `generateText`
7293
+ * @param config - The config for the agent (schema) `generateText` call
7288
7294
  * @returns A workflow step that executes the agent with the task
7289
7295
  */
7290
7296
  andAgent(task, agent, config) {
@@ -7357,11 +7363,11 @@ var WorkflowChain = class {
7357
7363
  * {
7358
7364
  * id: "generate-recommendations",
7359
7365
  * execute: async ({ data }) => {
7360
- * const result = await agent.generateObject(
7366
+ * const result = await agent.generateText(
7361
7367
  * `Generate recommendations for user ${data.userId}`,
7362
- * z.object({ recommendations: z.array(z.string()) })
7368
+ * { output: Output.object({ schema: z.object({ recommendations: z.array(z.string()) }) }) }
7363
7369
  * );
7364
- * return result.object;
7370
+ * return result.output;
7365
7371
  * }
7366
7372
  * }
7367
7373
  * ]
@@ -7413,11 +7419,15 @@ var WorkflowChain = class {
7413
7419
  * {
7414
7420
  * id: "ai-fallback",
7415
7421
  * execute: async ({ data }) => {
7416
- * const result = await agent.generateObject(
7422
+ * const result = await agent.generateText(
7417
7423
  * `Generate fallback response for: ${data.query}`,
7418
- * z.object({ source: z.literal("ai"), result: z.string() })
7424
+ * {
7425
+ * output: Output.object({
7426
+ * schema: z.object({ source: z.literal("ai"), result: z.string() }),
7427
+ * }),
7428
+ * }
7419
7429
  * );
7420
- * return result.object;
7430
+ * return result.output;
7421
7431
  * }
7422
7432
  * }
7423
7433
  * ]
@@ -7484,7 +7494,7 @@ __name(createWorkflowChain, "createWorkflowChain");
7484
7494
  // src/agent/agent.ts
7485
7495
  var import_api15 = require("@opentelemetry/api");
7486
7496
  var import_utils19 = require("@voltagent/internal/utils");
7487
- var import_ai5 = require("ai");
7497
+ var import_ai6 = require("ai");
7488
7498
  var import_zod3 = require("zod");
7489
7499
 
7490
7500
  // src/memory/manager/memory-manager.ts
@@ -14437,7 +14447,7 @@ var import_ts_pattern2 = require("ts-pattern");
14437
14447
 
14438
14448
  // src/agent/apply-summarization.ts
14439
14449
  var import_utils15 = require("@voltagent/internal/utils");
14440
- var import_ai2 = require("ai");
14450
+ var import_ai3 = require("ai");
14441
14451
  var SUMMARY_METADATA_KEY = "agent";
14442
14452
  var SUMMARY_STATE_CACHE_KEY = Symbol("agentSummaryState");
14443
14453
  var SUMMARY_SYSTEM_PROMPT = [
@@ -14528,7 +14538,7 @@ var applySummarization = /* @__PURE__ */ __name(async ({
14528
14538
  summaryMessages.push({ role: "user", content: summaryInput });
14529
14539
  const result = await oc.traceContext.withSpan(
14530
14540
  summarySpan,
14531
- async () => (0, import_ai2.generateText)({
14541
+ async () => (0, import_ai3.generateText)({
14532
14542
  model: resolvedModel,
14533
14543
  messages: summaryMessages,
14534
14544
  temperature: 0,
@@ -15162,7 +15172,7 @@ var ConversationBuffer = class {
15162
15172
  // src/agent/guardrail.ts
15163
15173
  var import_api12 = require("@opentelemetry/api");
15164
15174
  var import_utils16 = require("@voltagent/internal/utils");
15165
- var import_ai3 = require("ai");
15175
+ var import_ai4 = require("ai");
15166
15176
 
15167
15177
  // src/utils/message-helpers.ts
15168
15178
  function isTextContent(content) {
@@ -15588,7 +15598,7 @@ async function extractInputTextForGuardrail(value) {
15588
15598
  modelMessages = value;
15589
15599
  } else {
15590
15600
  try {
15591
- modelMessages = await (0, import_ai3.convertToModelMessages)(value);
15601
+ modelMessages = await (0, import_ai4.convertToModelMessages)(value);
15592
15602
  } catch {
15593
15603
  return "";
15594
15604
  }
@@ -16433,7 +16443,7 @@ var collapseRedundantStepStarts = /* @__PURE__ */ __name((parts) => {
16433
16443
  }, "collapseRedundantStepStarts");
16434
16444
 
16435
16445
  // src/agent/streaming/guardrail-stream.ts
16436
- var import_ai4 = require("ai");
16446
+ var import_ai5 = require("ai");
16437
16447
 
16438
16448
  // src/agent/streaming/output-guardrail-stream-runner.ts
16439
16449
  var import_api13 = require("@opentelemetry/api");
@@ -16857,7 +16867,7 @@ function createGuardrailPipeline(baseFullStream, _baseTextStream, context8, _fal
16857
16867
  const onError = streamOptions.onError ?? defaultUIStreamError;
16858
16868
  const [currentReadable, nextReadable] = uiReadable.tee();
16859
16869
  uiReadable = nextReadable;
16860
- const uiStream = (0, import_ai4.createUIMessageStream)({
16870
+ const uiStream = (0, import_ai5.createUIMessageStream)({
16861
16871
  originalMessages: streamOptions.originalMessages,
16862
16872
  onError,
16863
16873
  onFinish: streamOptions.onFinish,
@@ -18213,7 +18223,7 @@ var Agent = class {
18213
18223
  try {
18214
18224
  result = await oc.traceContext.withSpan(
18215
18225
  llmSpan,
18216
- () => (0, import_ai5.generateText)({
18226
+ () => (0, import_ai6.generateText)({
18217
18227
  model,
18218
18228
  messages,
18219
18229
  tools,
@@ -18221,7 +18231,7 @@ var Agent = class {
18221
18231
  temperature: this.temperature,
18222
18232
  maxOutputTokens: this.maxOutputTokens,
18223
18233
  maxRetries: 3,
18224
- stopWhen: options?.stopWhen ?? this.stopWhen ?? (0, import_ai5.stepCountIs)(maxSteps),
18234
+ stopWhen: options?.stopWhen ?? this.stopWhen ?? (0, import_ai6.stepCountIs)(maxSteps),
18225
18235
  // User overrides from AI SDK options
18226
18236
  ...aiSDKOptions,
18227
18237
  // Structured output if provided
@@ -18477,7 +18487,7 @@ var Agent = class {
18477
18487
  }
18478
18488
  });
18479
18489
  const finalizeLLMSpan = this.createLLMSpanFinalizer(llmSpan);
18480
- const result = (0, import_ai5.streamText)({
18490
+ const result = (0, import_ai6.streamText)({
18481
18491
  model,
18482
18492
  messages,
18483
18493
  tools,
@@ -18485,7 +18495,7 @@ var Agent = class {
18485
18495
  temperature: this.temperature,
18486
18496
  maxOutputTokens: this.maxOutputTokens,
18487
18497
  maxRetries: 3,
18488
- stopWhen: options?.stopWhen ?? this.stopWhen ?? (0, import_ai5.stepCountIs)(maxSteps),
18498
+ stopWhen: options?.stopWhen ?? this.stopWhen ?? (0, import_ai6.stepCountIs)(maxSteps),
18489
18499
  // User overrides from AI SDK options
18490
18500
  ...aiSDKOptions,
18491
18501
  // Structured output if provided
@@ -18758,7 +18768,7 @@ var Agent = class {
18758
18768
  return guardrailPipeline.createUIStream(streamOptions);
18759
18769
  }, "getGuardrailAwareUIStream");
18760
18770
  const createMergedUIStream = /* @__PURE__ */ __name((streamOptions) => {
18761
- const mergedStream = (0, import_ai5.createUIMessageStream)({
18771
+ const mergedStream = (0, import_ai6.createUIMessageStream)({
18762
18772
  execute: /* @__PURE__ */ __name(async ({ writer }) => {
18763
18773
  oc.systemContext.set("uiStreamWriter", writer);
18764
18774
  writer.merge(getGuardrailAwareUIStream(streamOptions));
@@ -18793,7 +18803,7 @@ var Agent = class {
18793
18803
  const streamOptions = options2;
18794
18804
  const stream = agent.subAgentManager.hasSubAgents() ? createMergedUIStream(streamOptions) : getGuardrailAwareUIStream(streamOptions);
18795
18805
  const responseInit = options2 ? { ...options2 } : {};
18796
- return (0, import_ai5.createUIMessageStreamResponse)({
18806
+ return (0, import_ai6.createUIMessageStreamResponse)({
18797
18807
  stream,
18798
18808
  ...responseInit
18799
18809
  });
@@ -18802,7 +18812,7 @@ var Agent = class {
18802
18812
  const streamOptions = init;
18803
18813
  const stream = agent.subAgentManager.hasSubAgents() ? createMergedUIStream(streamOptions) : getGuardrailAwareUIStream(streamOptions);
18804
18814
  const initOptions = init ? { ...init } : {};
18805
- (0, import_ai5.pipeUIMessageStreamToResponse)({
18815
+ (0, import_ai6.pipeUIMessageStreamToResponse)({
18806
18816
  response,
18807
18817
  stream,
18808
18818
  ...initOptions
@@ -18825,14 +18835,14 @@ var Agent = class {
18825
18835
  toUIMessageStreamResponse: toUIMessageStreamResponseSanitized,
18826
18836
  pipeUIMessageStreamToResponse: pipeUIMessageStreamToResponseSanitized,
18827
18837
  pipeTextStreamToResponse: /* @__PURE__ */ __name((response, init) => {
18828
- (0, import_ai5.pipeTextStreamToResponse)({
18838
+ (0, import_ai6.pipeTextStreamToResponse)({
18829
18839
  response,
18830
18840
  textStream: getGuardrailAwareTextStream(),
18831
18841
  ...init ?? {}
18832
18842
  });
18833
18843
  }, "pipeTextStreamToResponse"),
18834
18844
  toTextStreamResponse: /* @__PURE__ */ __name((init) => {
18835
- return (0, import_ai5.createTextStreamResponse)({
18845
+ return (0, import_ai6.createTextStreamResponse)({
18836
18846
  textStream: getGuardrailAwareTextStream(),
18837
18847
  ...init ?? {}
18838
18848
  });
@@ -18926,7 +18936,7 @@ var Agent = class {
18926
18936
  providerOptions,
18927
18937
  ...aiSDKOptions
18928
18938
  } = options || {};
18929
- const result = await (0, import_ai5.generateObject)({
18939
+ const result = await (0, import_ai6.generateObject)({
18930
18940
  model,
18931
18941
  messages,
18932
18942
  schema,
@@ -19114,7 +19124,7 @@ var Agent = class {
19114
19124
  let guardrailObjectPromise;
19115
19125
  let resolveGuardrailObject;
19116
19126
  let rejectGuardrailObject;
19117
- const result = (0, import_ai5.streamObject)({
19127
+ const result = (0, import_ai6.streamObject)({
19118
19128
  model,
19119
19129
  messages,
19120
19130
  schema,
@@ -19310,7 +19320,7 @@ var Agent = class {
19310
19320
  const buffer = this.getConversationBuffer(oc);
19311
19321
  const uiMessages = await this.prepareMessages(input, oc, options, buffer);
19312
19322
  const hooks = this.getMergedHooks(options);
19313
- let messages = await (0, import_ai5.convertToModelMessages)(uiMessages);
19323
+ let messages = await (0, import_ai6.convertToModelMessages)(uiMessages);
19314
19324
  if (hooks.onPrepareModelMessages) {
19315
19325
  const result = await hooks.onPrepareModelMessages({
19316
19326
  modelMessages: messages,
@@ -20089,7 +20099,7 @@ ${retrieverContext}`;
20089
20099
  }
20090
20100
  });
20091
20101
  try {
20092
- const retrieverInput = typeof input === "string" ? input : Array.isArray(input) && input[0]?.content !== void 0 ? input : await (0, import_ai5.convertToModelMessages)(input);
20102
+ const retrieverInput = typeof input === "string" ? input : Array.isArray(input) && input[0]?.content !== void 0 ? input : await (0, import_ai6.convertToModelMessages)(input);
20093
20103
  const retrievedContent = await oc.traceContext.withSpan(retrieverSpan, async () => {
20094
20104
  if (!this.retriever) return null;
20095
20105
  return await this.retriever.retrieve(retrieverInput, {
@@ -25132,7 +25142,7 @@ var InMemoryVectorAdapter = class {
25132
25142
  };
25133
25143
 
25134
25144
  // src/memory/adapters/embedding/ai-sdk.ts
25135
- var import_ai6 = require("ai");
25145
+ var import_ai7 = require("ai");
25136
25146
  var AiSdkEmbeddingAdapter = class {
25137
25147
  static {
25138
25148
  __name(this, "AiSdkEmbeddingAdapter");
@@ -25153,7 +25163,7 @@ var AiSdkEmbeddingAdapter = class {
25153
25163
  }
25154
25164
  async embed(text) {
25155
25165
  try {
25156
- const result = await (0, import_ai6.embed)({
25166
+ const result = await (0, import_ai7.embed)({
25157
25167
  model: this.model,
25158
25168
  value: text
25159
25169
  });
@@ -25180,7 +25190,7 @@ var AiSdkEmbeddingAdapter = class {
25180
25190
  for (let i = 0; i < texts.length; i += maxBatchSize) {
25181
25191
  const batch = texts.slice(i, i + maxBatchSize);
25182
25192
  try {
25183
- const result = await (0, import_ai6.embedMany)({
25193
+ const result = await (0, import_ai7.embedMany)({
25184
25194
  model: this.model,
25185
25195
  values: batch
25186
25196
  });
@@ -27816,7 +27826,7 @@ var VoltAgent = class {
27816
27826
 
27817
27827
  // src/index.ts
27818
27828
  var import_utils28 = require("@voltagent/internal/utils");
27819
- var import_ai7 = require("ai");
27829
+ var import_ai8 = require("ai");
27820
27830
  // Annotate the CommonJS export names for ESM import in node:
27821
27831
  0 && (module.exports = {
27822
27832
  A2AServerRegistry,