@mastra/core 0.7.0-alpha.1 → 0.7.0-alpha.3

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 (61) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +1 -1
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-6TZjD_gW.d.cts → base-C0wILuA9.d.cts} +65 -16
  6. package/dist/{base-DYeWJ7uK.d.ts → base-Cyl73WbV.d.ts} +65 -16
  7. package/dist/{chunk-5YT3KIH3.js → chunk-2YF5JYTJ.js} +43 -2
  8. package/dist/{chunk-QMSSRQVR.js → chunk-43SD5CUE.js} +3 -2
  9. package/dist/{chunk-5T43A3YE.cjs → chunk-5FAJ6HUC.cjs} +43 -1
  10. package/dist/{chunk-G5HHCEH3.cjs → chunk-ASFUEC75.cjs} +4 -3
  11. package/dist/{chunk-LOPB4SHX.cjs → chunk-C6BBAS4I.cjs} +50 -44
  12. package/dist/{chunk-ZLSEJA42.cjs → chunk-GG6TEAMJ.cjs} +2 -2
  13. package/dist/{chunk-3PWZCDYW.js → chunk-QM6WIIPM.js} +1 -1
  14. package/dist/{chunk-X4JHAQSU.js → chunk-R2M5CZ5U.js} +1 -1
  15. package/dist/{chunk-MLWSGLXY.js → chunk-VNQRLYIA.js} +40 -34
  16. package/dist/{chunk-6ZCLYB53.cjs → chunk-WESJ2ZY7.cjs} +2 -2
  17. package/dist/eval/index.d.cts +1 -1
  18. package/dist/eval/index.d.ts +1 -1
  19. package/dist/index.cjs +44 -40
  20. package/dist/index.d.cts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +6 -6
  23. package/dist/integration/index.d.cts +1 -1
  24. package/dist/integration/index.d.ts +1 -1
  25. package/dist/llm/index.d.cts +1 -1
  26. package/dist/llm/index.d.ts +1 -1
  27. package/dist/mastra/index.d.cts +1 -1
  28. package/dist/mastra/index.d.ts +1 -1
  29. package/dist/memory/index.cjs +2 -2
  30. package/dist/memory/index.d.cts +1 -1
  31. package/dist/memory/index.d.ts +1 -1
  32. package/dist/memory/index.js +1 -1
  33. package/dist/network/index.cjs +2 -2
  34. package/dist/network/index.d.cts +1 -1
  35. package/dist/network/index.d.ts +1 -1
  36. package/dist/network/index.js +1 -1
  37. package/dist/relevance/index.cjs +4 -4
  38. package/dist/relevance/index.d.cts +1 -1
  39. package/dist/relevance/index.d.ts +1 -1
  40. package/dist/relevance/index.js +1 -1
  41. package/dist/storage/index.d.cts +1 -1
  42. package/dist/storage/index.d.ts +1 -1
  43. package/dist/storage/libsql/index.d.cts +1 -1
  44. package/dist/storage/libsql/index.d.ts +1 -1
  45. package/dist/telemetry/index.d.cts +1 -1
  46. package/dist/telemetry/index.d.ts +1 -1
  47. package/dist/tools/index.d.cts +1 -1
  48. package/dist/tools/index.d.ts +1 -1
  49. package/dist/utils.cjs +16 -12
  50. package/dist/utils.d.cts +4 -3
  51. package/dist/utils.d.ts +4 -3
  52. package/dist/utils.js +1 -1
  53. package/dist/voice/index.cjs +17 -0
  54. package/dist/voice/index.d.cts +1 -1
  55. package/dist/voice/index.d.ts +1 -1
  56. package/dist/voice/index.js +17 -0
  57. package/dist/workflows/index.cjs +20 -20
  58. package/dist/workflows/index.d.cts +2 -2
  59. package/dist/workflows/index.d.ts +2 -2
  60. package/dist/workflows/index.js +1 -1
  61. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkLOPB4SHX_cjs = require('../chunk-LOPB4SHX.cjs');
3
+ var chunkC6BBAS4I_cjs = require('../chunk-C6BBAS4I.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Agent", {
8
8
  enumerable: true,
9
- get: function () { return chunkLOPB4SHX_cjs.Agent; }
9
+ get: function () { return chunkC6BBAS4I_cjs.Agent; }
10
10
  });
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent, m as AgentConfig, aH as AgentGenerateOptions, aI as AgentStreamOptions, az as MastraLanguageModel, a as ToolsInput, aG as ToolsetsInput } from '../base-6TZjD_gW.cjs';
4
+ export { A as Agent, m as AgentConfig, aH as AgentGenerateOptions, aI as AgentStreamOptions, az as MastraLanguageModel, a as ToolsInput, aG as ToolsetsInput } from '../base-C0wILuA9.cjs';
5
5
  import '../base-ObPJ-w8K.cjs';
6
6
  import '../types-CwTG2XyQ.cjs';
7
7
  import 'sift';
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent, m as AgentConfig, aH as AgentGenerateOptions, aI as AgentStreamOptions, az as MastraLanguageModel, a as ToolsInput, aG as ToolsetsInput } from '../base-DYeWJ7uK.js';
4
+ export { A as Agent, m as AgentConfig, aH as AgentGenerateOptions, aI as AgentStreamOptions, az as MastraLanguageModel, a as ToolsInput, aG as ToolsetsInput } from '../base-Cyl73WbV.js';
5
5
  import '../base-Cmunaaxb.js';
6
6
  import '../types-CwTG2XyQ.js';
7
7
  import 'sift';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-MLWSGLXY.js';
1
+ export { Agent } from '../chunk-VNQRLYIA.js';
@@ -1,5 +1,5 @@
1
1
  import * as ai from 'ai';
2
- import { Tool as Tool$1, ToolExecutionOptions, CoreMessage as CoreMessage$1, TelemetrySettings, generateText, generateObject, streamText, GenerateTextResult, GenerateObjectResult, streamObject, StreamTextResult, StreamObjectResult, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModelV1, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
2
+ import { Tool as Tool$1, ToolExecutionOptions, CoreMessage as CoreMessage$1, TelemetrySettings, generateText, generateObject, streamText, GenerateTextResult, GenerateObjectResult, streamObject, StreamTextResult, StreamObjectResult, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModelV1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
3
3
  import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-ObPJ-w8K.cjs';
4
4
  import { M as Metric, a as MetricResult, T as TestInfo } from './types-CwTG2XyQ.cjs';
5
5
  import { Query } from 'sift';
@@ -90,7 +90,7 @@ type DefaultLLMStreamObjectOptions = Omit<StreamObjectOptions, MastraCustomLLMOp
90
90
  type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
91
91
  tools?: ToolsInput;
92
92
  convertedTools?: Record<string, CoreTool>;
93
- onStepFinish?: (step: string) => void;
93
+ onStepFinish?: (step: unknown) => void;
94
94
  experimental_output?: Z;
95
95
  telemetry?: TelemetrySettings;
96
96
  threadId?: string;
@@ -248,8 +248,9 @@ declare abstract class MastraMemory extends MastraBase {
248
248
 
249
249
  type VoiceEventType = 'speaking' | 'writing' | 'error' | string;
250
250
  interface VoiceEventMap {
251
+ speaker: NodeJS.ReadableStream;
251
252
  speaking: {
252
- audio?: NodeJS.ReadableStream;
253
+ audio?: string;
253
254
  };
254
255
  writing: {
255
256
  text: string;
@@ -332,6 +333,11 @@ declare abstract class MastraVoice<TOptions = unknown, TSpeakOptions = unknown,
332
333
  * Trigger voice providers to respond
333
334
  */
334
335
  answer(_options?: Record<string, unknown>): Promise<void>;
336
+ /**
337
+ * Equip the voice provider with instructions
338
+ * @param instructions Instructions to add
339
+ */
340
+ addInstructions(_instructions?: string): void;
335
341
  /**
336
342
  * Equip the voice provider with tools
337
343
  * @param tools Array of tools to add
@@ -399,6 +405,11 @@ declare class CompositeVoice extends MastraVoice<unknown, unknown, unknown, Tool
399
405
  * Trigger voice providers to respond
400
406
  */
401
407
  answer(options?: Record<string, unknown>): Promise<void>;
408
+ /**
409
+ * Equip the voice provider with instructions
410
+ * @param instructions Instructions to add
411
+ */
412
+ addInstructions(instructions: string): void;
402
413
  /**
403
414
  * Equip the voice provider with tools
404
415
  * @param tools Array of tools to add
@@ -437,20 +448,35 @@ interface AgentConfig<TTools extends ToolsInput = ToolsInput, TMetrics extends R
437
448
  memory?: MastraMemory;
438
449
  voice?: CompositeVoice;
439
450
  }
451
+ /**
452
+ * Options for generating responses with an agent
453
+ * @template Z - The schema type for structured output (Zod schema or JSON schema)
454
+ */
440
455
  type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
456
+ /** Optional instructions to override the agent's default instructions */
441
457
  instructions?: string;
458
+ /** Additional tool sets that can be used for this generation */
442
459
  toolsets?: ToolsetsInput;
460
+ /** Additional context messages to include */
443
461
  context?: CoreMessage[];
462
+ /** Memory configuration options */
444
463
  memoryOptions?: MemoryConfig;
464
+ /** Unique ID for this generation run */
445
465
  runId?: string;
446
- onStepFinish?: (step: string) => void;
466
+ /** Callback fired after each generation step completes */
467
+ onStepFinish?: Z extends undefined ? GenerateTextOnStepFinishCallback<any> : never;
468
+ /** Maximum number of steps allowed for generation */
447
469
  maxSteps?: number;
470
+ /** Schema for structured output, does not work with tools, use experimental_output instead */
448
471
  output?: OutputType | Z;
472
+ /** Schema for structured output generation alongside tool calls. */
449
473
  experimental_output?: Z;
474
+ /** Controls how tools are selected during generation */
450
475
  toolChoice?: 'auto' | 'none' | 'required' | {
451
476
  type: 'tool';
452
477
  toolName: string;
453
478
  };
479
+ /** Telemetry settings */
454
480
  telemetry?: TelemetrySettings;
455
481
  } & ({
456
482
  resourceId?: undefined;
@@ -459,22 +485,39 @@ type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefi
459
485
  resourceId: string;
460
486
  threadId: string;
461
487
  }) & (Z extends undefined ? DefaultLLMTextOptions : DefaultLLMTextObjectOptions);
488
+ /**
489
+ * Options for streaming responses with an agent
490
+ * @template Z - The schema type for structured output (Zod schema or JSON schema)
491
+ */
462
492
  type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
493
+ /** Optional instructions to override the agent's default instructions */
463
494
  instructions?: string;
495
+ /** Additional tool sets that can be used for this generation */
464
496
  toolsets?: ToolsetsInput;
497
+ /** Additional context messages to include */
465
498
  context?: CoreMessage[];
499
+ /** Memory configuration options */
466
500
  memoryOptions?: MemoryConfig;
501
+ /** Unique ID for this generation run */
467
502
  runId?: string;
468
- onFinish?: (result: string) => unknown;
469
- onStepFinish?: (step: string) => unknown;
503
+ /** Callback fired when streaming completes */
504
+ onFinish?: Z extends undefined ? StreamTextOnFinishCallback<any> : Z extends ZodSchema ? StreamObjectOnFinishCallback<z.infer<Z>> : StreamObjectOnFinishCallback<any>;
505
+ /** Callback fired after each generation step completes */
506
+ onStepFinish?: Z extends undefined ? StreamTextOnStepFinishCallback<any> : never;
507
+ /** Maximum number of steps allowed for generation */
470
508
  maxSteps?: number;
509
+ /** Schema for structured output */
471
510
  output?: OutputType | Z;
511
+ /** Temperature parameter for controlling randomness */
472
512
  temperature?: number;
513
+ /** Controls how tools are selected during generation */
473
514
  toolChoice?: 'auto' | 'none' | 'required' | {
474
515
  type: 'tool';
475
516
  toolName: string;
476
517
  };
518
+ /** Experimental schema for structured output */
477
519
  experimental_output?: Z;
520
+ /** Telemetry settings */
478
521
  telemetry?: TelemetrySettings;
479
522
  } & ({
480
523
  resourceId?: undefined;
@@ -1730,24 +1773,30 @@ declare class Agent<TTools extends ToolsInput = ToolsInput, TMetrics extends Rec
1730
1773
  output?: never;
1731
1774
  experimental_output?: never;
1732
1775
  }): Promise<GenerateTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>>;
1733
- generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & ({
1734
- output: Z;
1776
+ generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
1777
+ output?: Z;
1735
1778
  experimental_output?: never;
1736
- } | {
1737
- experimental_output: Z;
1779
+ }): Promise<GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>>;
1780
+ generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
1738
1781
  output?: never;
1739
- })): Promise<GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>>;
1782
+ experimental_output?: Z;
1783
+ }): Promise<GenerateTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown> & {
1784
+ object: Z extends ZodSchema ? z.infer<Z> : unknown;
1785
+ }>;
1740
1786
  stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & {
1741
1787
  output?: never;
1742
1788
  experimental_output?: never;
1743
1789
  }): Promise<StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>>;
1744
- stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & ({
1745
- output: Z;
1790
+ stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & {
1791
+ output?: Z;
1746
1792
  experimental_output?: never;
1747
- } | {
1748
- experimental_output: Z;
1793
+ }): Promise<StreamObjectResult<any, Z extends ZodSchema ? z.infer<Z> : unknown, any>>;
1794
+ stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & {
1749
1795
  output?: never;
1750
- })): Promise<StreamObjectResult<any, Z extends ZodSchema ? z.infer<Z> : unknown, any>>;
1796
+ experimental_output?: Z;
1797
+ }): Promise<StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown> & {
1798
+ partialObjectStream: StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>['experimental_partialOutputStream'];
1799
+ }>;
1751
1800
  /**
1752
1801
  * Convert text to speech using the configured voice provider
1753
1802
  * @param input Text or text stream to convert to speech
@@ -1,5 +1,5 @@
1
1
  import * as ai from 'ai';
2
- import { Tool as Tool$1, ToolExecutionOptions, CoreMessage as CoreMessage$1, TelemetrySettings, generateText, generateObject, streamText, GenerateTextResult, GenerateObjectResult, streamObject, StreamTextResult, StreamObjectResult, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModelV1, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
2
+ import { Tool as Tool$1, ToolExecutionOptions, CoreMessage as CoreMessage$1, TelemetrySettings, generateText, generateObject, streamText, GenerateTextResult, GenerateObjectResult, streamObject, StreamTextResult, StreamObjectResult, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModelV1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
3
3
  import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-Cmunaaxb.js';
4
4
  import { M as Metric, a as MetricResult, T as TestInfo } from './types-CwTG2XyQ.js';
5
5
  import { Query } from 'sift';
@@ -90,7 +90,7 @@ type DefaultLLMStreamObjectOptions = Omit<StreamObjectOptions, MastraCustomLLMOp
90
90
  type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
91
91
  tools?: ToolsInput;
92
92
  convertedTools?: Record<string, CoreTool>;
93
- onStepFinish?: (step: string) => void;
93
+ onStepFinish?: (step: unknown) => void;
94
94
  experimental_output?: Z;
95
95
  telemetry?: TelemetrySettings;
96
96
  threadId?: string;
@@ -248,8 +248,9 @@ declare abstract class MastraMemory extends MastraBase {
248
248
 
249
249
  type VoiceEventType = 'speaking' | 'writing' | 'error' | string;
250
250
  interface VoiceEventMap {
251
+ speaker: NodeJS.ReadableStream;
251
252
  speaking: {
252
- audio?: NodeJS.ReadableStream;
253
+ audio?: string;
253
254
  };
254
255
  writing: {
255
256
  text: string;
@@ -332,6 +333,11 @@ declare abstract class MastraVoice<TOptions = unknown, TSpeakOptions = unknown,
332
333
  * Trigger voice providers to respond
333
334
  */
334
335
  answer(_options?: Record<string, unknown>): Promise<void>;
336
+ /**
337
+ * Equip the voice provider with instructions
338
+ * @param instructions Instructions to add
339
+ */
340
+ addInstructions(_instructions?: string): void;
335
341
  /**
336
342
  * Equip the voice provider with tools
337
343
  * @param tools Array of tools to add
@@ -399,6 +405,11 @@ declare class CompositeVoice extends MastraVoice<unknown, unknown, unknown, Tool
399
405
  * Trigger voice providers to respond
400
406
  */
401
407
  answer(options?: Record<string, unknown>): Promise<void>;
408
+ /**
409
+ * Equip the voice provider with instructions
410
+ * @param instructions Instructions to add
411
+ */
412
+ addInstructions(instructions: string): void;
402
413
  /**
403
414
  * Equip the voice provider with tools
404
415
  * @param tools Array of tools to add
@@ -437,20 +448,35 @@ interface AgentConfig<TTools extends ToolsInput = ToolsInput, TMetrics extends R
437
448
  memory?: MastraMemory;
438
449
  voice?: CompositeVoice;
439
450
  }
451
+ /**
452
+ * Options for generating responses with an agent
453
+ * @template Z - The schema type for structured output (Zod schema or JSON schema)
454
+ */
440
455
  type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
456
+ /** Optional instructions to override the agent's default instructions */
441
457
  instructions?: string;
458
+ /** Additional tool sets that can be used for this generation */
442
459
  toolsets?: ToolsetsInput;
460
+ /** Additional context messages to include */
443
461
  context?: CoreMessage[];
462
+ /** Memory configuration options */
444
463
  memoryOptions?: MemoryConfig;
464
+ /** Unique ID for this generation run */
445
465
  runId?: string;
446
- onStepFinish?: (step: string) => void;
466
+ /** Callback fired after each generation step completes */
467
+ onStepFinish?: Z extends undefined ? GenerateTextOnStepFinishCallback<any> : never;
468
+ /** Maximum number of steps allowed for generation */
447
469
  maxSteps?: number;
470
+ /** Schema for structured output, does not work with tools, use experimental_output instead */
448
471
  output?: OutputType | Z;
472
+ /** Schema for structured output generation alongside tool calls. */
449
473
  experimental_output?: Z;
474
+ /** Controls how tools are selected during generation */
450
475
  toolChoice?: 'auto' | 'none' | 'required' | {
451
476
  type: 'tool';
452
477
  toolName: string;
453
478
  };
479
+ /** Telemetry settings */
454
480
  telemetry?: TelemetrySettings;
455
481
  } & ({
456
482
  resourceId?: undefined;
@@ -459,22 +485,39 @@ type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefi
459
485
  resourceId: string;
460
486
  threadId: string;
461
487
  }) & (Z extends undefined ? DefaultLLMTextOptions : DefaultLLMTextObjectOptions);
488
+ /**
489
+ * Options for streaming responses with an agent
490
+ * @template Z - The schema type for structured output (Zod schema or JSON schema)
491
+ */
462
492
  type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
493
+ /** Optional instructions to override the agent's default instructions */
463
494
  instructions?: string;
495
+ /** Additional tool sets that can be used for this generation */
464
496
  toolsets?: ToolsetsInput;
497
+ /** Additional context messages to include */
465
498
  context?: CoreMessage[];
499
+ /** Memory configuration options */
466
500
  memoryOptions?: MemoryConfig;
501
+ /** Unique ID for this generation run */
467
502
  runId?: string;
468
- onFinish?: (result: string) => unknown;
469
- onStepFinish?: (step: string) => unknown;
503
+ /** Callback fired when streaming completes */
504
+ onFinish?: Z extends undefined ? StreamTextOnFinishCallback<any> : Z extends ZodSchema ? StreamObjectOnFinishCallback<z.infer<Z>> : StreamObjectOnFinishCallback<any>;
505
+ /** Callback fired after each generation step completes */
506
+ onStepFinish?: Z extends undefined ? StreamTextOnStepFinishCallback<any> : never;
507
+ /** Maximum number of steps allowed for generation */
470
508
  maxSteps?: number;
509
+ /** Schema for structured output */
471
510
  output?: OutputType | Z;
511
+ /** Temperature parameter for controlling randomness */
472
512
  temperature?: number;
513
+ /** Controls how tools are selected during generation */
473
514
  toolChoice?: 'auto' | 'none' | 'required' | {
474
515
  type: 'tool';
475
516
  toolName: string;
476
517
  };
518
+ /** Experimental schema for structured output */
477
519
  experimental_output?: Z;
520
+ /** Telemetry settings */
478
521
  telemetry?: TelemetrySettings;
479
522
  } & ({
480
523
  resourceId?: undefined;
@@ -1730,24 +1773,30 @@ declare class Agent<TTools extends ToolsInput = ToolsInput, TMetrics extends Rec
1730
1773
  output?: never;
1731
1774
  experimental_output?: never;
1732
1775
  }): Promise<GenerateTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>>;
1733
- generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & ({
1734
- output: Z;
1776
+ generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
1777
+ output?: Z;
1735
1778
  experimental_output?: never;
1736
- } | {
1737
- experimental_output: Z;
1779
+ }): Promise<GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>>;
1780
+ generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
1738
1781
  output?: never;
1739
- })): Promise<GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>>;
1782
+ experimental_output?: Z;
1783
+ }): Promise<GenerateTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown> & {
1784
+ object: Z extends ZodSchema ? z.infer<Z> : unknown;
1785
+ }>;
1740
1786
  stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & {
1741
1787
  output?: never;
1742
1788
  experimental_output?: never;
1743
1789
  }): Promise<StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>>;
1744
- stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & ({
1745
- output: Z;
1790
+ stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & {
1791
+ output?: Z;
1746
1792
  experimental_output?: never;
1747
- } | {
1748
- experimental_output: Z;
1793
+ }): Promise<StreamObjectResult<any, Z extends ZodSchema ? z.infer<Z> : unknown, any>>;
1794
+ stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentStreamOptions<Z> & {
1749
1795
  output?: never;
1750
- })): Promise<StreamObjectResult<any, Z extends ZodSchema ? z.infer<Z> : unknown, any>>;
1796
+ experimental_output?: Z;
1797
+ }): Promise<StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown> & {
1798
+ partialObjectStream: StreamTextResult<any, Z extends ZodSchema ? z.infer<Z> : unknown>['experimental_partialOutputStream'];
1799
+ }>;
1751
1800
  /**
1752
1801
  * Convert text to speech using the configured voice provider
1753
1802
  * @param input Text or text stream to convert to speech
@@ -1,5 +1,6 @@
1
1
  import { Tool } from './chunk-ZINPRHAN.js';
2
2
  import { createHash } from 'crypto';
3
+ import { convertToCoreMessages } from 'ai';
3
4
  import jsonSchemaToZod from 'json-schema-to-zod';
4
5
  import { z } from 'zod';
5
6
 
@@ -81,7 +82,8 @@ Examples: ${value.examples.join(", ")}` : ""));
81
82
  if (value.description) {
82
83
  zodType = zodType.describe(value.description);
83
84
  }
84
- if (requiredFields.includes(key)) {
85
+ const isTypeRequired = value.type === "null";
86
+ if (requiredFields.includes(key) || isTypeRequired) {
85
87
  zodSchema[key] = zodType;
86
88
  } else {
87
89
  zodSchema[key] = zodType.nullable().optional();
@@ -362,5 +364,44 @@ function checkEvalStorageFields(traceObject, logger) {
362
364
  }
363
365
  return true;
364
366
  }
367
+ function detectSingleMessageCharacteristics(message) {
368
+ if (typeof message === "object" && message !== null && (message.role === "function" || // UI-only role
369
+ message.role === "data" || // UI-only role
370
+ "toolInvocations" in message || // UI-specific field
371
+ "parts" in message || // UI-specific field
372
+ "experimental_attachments" in message)) {
373
+ return "has-ui-specific-parts";
374
+ } else if (typeof message === "object" && message !== null && "content" in message && (Array.isArray(message.content) || // Core messages can have array content
375
+ "experimental_providerMetadata" in message || "providerOptions" in message)) {
376
+ return "has-core-specific-parts";
377
+ } else if (typeof message === "object" && message !== null && "role" in message && "content" in message && typeof message.content === "string" && ["system", "user", "assistant", "tool"].includes(message.role)) {
378
+ return "message";
379
+ } else {
380
+ return "other";
381
+ }
382
+ }
383
+ function isUiMessage(message) {
384
+ return detectSingleMessageCharacteristics(message) === `has-ui-specific-parts`;
385
+ }
386
+ function isCoreMessage(message) {
387
+ return [`has-core-specific-parts`, `message`].includes(detectSingleMessageCharacteristics(message));
388
+ }
389
+ function ensureAllMessagesAreCoreMessages(messages) {
390
+ return messages.map((message) => {
391
+ if (isUiMessage(message)) {
392
+ return convertToCoreMessages([message]);
393
+ }
394
+ if (isCoreMessage(message)) {
395
+ return message;
396
+ }
397
+ const characteristics = detectSingleMessageCharacteristics(message);
398
+ throw new Error(
399
+ `Message does not appear to be a core message or a UI message but must be one of the two, found "${characteristics}" type for message:
400
+
401
+ ${JSON.stringify(message, null, 2)}
402
+ `
403
+ );
404
+ }).flat();
405
+ }
365
406
 
366
- export { checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureToolProperties, isVercelTool, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
407
+ export { checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
@@ -1,6 +1,6 @@
1
1
  import { LibSQLVector } from './chunk-SMBKF6K5.js';
2
2
  import { DefaultProxyStorage } from './chunk-7VTZI3YN.js';
3
- import { deepMerge } from './chunk-5YT3KIH3.js';
3
+ import { deepMerge } from './chunk-2YF5JYTJ.js';
4
4
  import { MastraBase } from './chunk-VN4M67DA.js';
5
5
  import { existsSync } from 'fs';
6
6
  import { join } from 'path';
@@ -179,7 +179,8 @@ var MastraMemory = class extends MastraBase {
179
179
  const defaultDimensions = 1536;
180
180
  const dimensionsByModelId = {
181
181
  "bge-small-en-v1.5": 384,
182
- "bge-base-en-v1.5": 768
182
+ "bge-base-en-v1.5": 768,
183
+ "voyage-3-lite": 512
183
184
  };
184
185
  const dimensions = dimensionsByModelId[this.embedder.modelId] || defaultDimensions;
185
186
  const isDefault = dimensions === defaultDimensions;
@@ -2,6 +2,7 @@
2
2
 
3
3
  var chunk2W2GYEYQ_cjs = require('./chunk-2W2GYEYQ.cjs');
4
4
  var crypto = require('crypto');
5
+ var ai = require('ai');
5
6
  var jsonSchemaToZod = require('json-schema-to-zod');
6
7
  var zod = require('zod');
7
8
 
@@ -87,7 +88,8 @@ Examples: ${value.examples.join(", ")}` : ""));
87
88
  if (value.description) {
88
89
  zodType = zodType.describe(value.description);
89
90
  }
90
- if (requiredFields.includes(key)) {
91
+ const isTypeRequired = value.type === "null";
92
+ if (requiredFields.includes(key) || isTypeRequired) {
91
93
  zodSchema[key] = zodType;
92
94
  } else {
93
95
  zodSchema[key] = zodType.nullable().optional();
@@ -368,11 +370,51 @@ function checkEvalStorageFields(traceObject, logger) {
368
370
  }
369
371
  return true;
370
372
  }
373
+ function detectSingleMessageCharacteristics(message) {
374
+ if (typeof message === "object" && message !== null && (message.role === "function" || // UI-only role
375
+ message.role === "data" || // UI-only role
376
+ "toolInvocations" in message || // UI-specific field
377
+ "parts" in message || // UI-specific field
378
+ "experimental_attachments" in message)) {
379
+ return "has-ui-specific-parts";
380
+ } else if (typeof message === "object" && message !== null && "content" in message && (Array.isArray(message.content) || // Core messages can have array content
381
+ "experimental_providerMetadata" in message || "providerOptions" in message)) {
382
+ return "has-core-specific-parts";
383
+ } else if (typeof message === "object" && message !== null && "role" in message && "content" in message && typeof message.content === "string" && ["system", "user", "assistant", "tool"].includes(message.role)) {
384
+ return "message";
385
+ } else {
386
+ return "other";
387
+ }
388
+ }
389
+ function isUiMessage(message) {
390
+ return detectSingleMessageCharacteristics(message) === `has-ui-specific-parts`;
391
+ }
392
+ function isCoreMessage(message) {
393
+ return [`has-core-specific-parts`, `message`].includes(detectSingleMessageCharacteristics(message));
394
+ }
395
+ function ensureAllMessagesAreCoreMessages(messages) {
396
+ return messages.map((message) => {
397
+ if (isUiMessage(message)) {
398
+ return ai.convertToCoreMessages([message]);
399
+ }
400
+ if (isCoreMessage(message)) {
401
+ return message;
402
+ }
403
+ const characteristics = detectSingleMessageCharacteristics(message);
404
+ throw new Error(
405
+ `Message does not appear to be a core message or a UI message but must be one of the two, found "${characteristics}" type for message:
406
+
407
+ ${JSON.stringify(message, null, 2)}
408
+ `
409
+ );
410
+ }).flat();
411
+ }
371
412
 
372
413
  exports.checkEvalStorageFields = checkEvalStorageFields;
373
414
  exports.createMastraProxy = createMastraProxy;
374
415
  exports.deepMerge = deepMerge;
375
416
  exports.delay = delay;
417
+ exports.ensureAllMessagesAreCoreMessages = ensureAllMessagesAreCoreMessages;
376
418
  exports.ensureToolProperties = ensureToolProperties;
377
419
  exports.isVercelTool = isVercelTool;
378
420
  exports.jsonSchemaPropertiesToTSTypes = jsonSchemaPropertiesToTSTypes;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var chunkU7ONOIBO_cjs = require('./chunk-U7ONOIBO.cjs');
4
4
  var chunkONDCHP6G_cjs = require('./chunk-ONDCHP6G.cjs');
5
- var chunk5T43A3YE_cjs = require('./chunk-5T43A3YE.cjs');
5
+ var chunk5FAJ6HUC_cjs = require('./chunk-5FAJ6HUC.cjs');
6
6
  var chunkPL7PVTGF_cjs = require('./chunk-PL7PVTGF.cjs');
7
7
  var fs = require('fs');
8
8
  var path = require('path');
@@ -186,7 +186,8 @@ var MastraMemory = class extends chunkPL7PVTGF_cjs.MastraBase {
186
186
  const defaultDimensions = 1536;
187
187
  const dimensionsByModelId = {
188
188
  "bge-small-en-v1.5": 384,
189
- "bge-base-en-v1.5": 768
189
+ "bge-base-en-v1.5": 768,
190
+ "voyage-3-lite": 512
190
191
  };
191
192
  const dimensions = dimensionsByModelId[this.embedder.modelId] || defaultDimensions;
192
193
  const isDefault = dimensions === defaultDimensions;
@@ -195,7 +196,7 @@ var MastraMemory = class extends chunkPL7PVTGF_cjs.MastraBase {
195
196
  return { indexName };
196
197
  }
197
198
  getMergedThreadConfig(config) {
198
- return chunk5T43A3YE_cjs.deepMerge(this.threadConfig, config || {});
199
+ return chunk5FAJ6HUC_cjs.deepMerge(this.threadConfig, config || {});
199
200
  }
200
201
  estimateTokens(text) {
201
202
  return Math.ceil(text.split(" ").length * 1.3);