@mastra/core 0.4.2 → 0.4.3-alpha.1

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.
@@ -1,7 +1,7 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent } from '../base-hk-xmLC1.js';
4
+ export { A as Agent } from '../base-JKlKFf5I.js';
5
5
  import '../base-D90KQ4XI.js';
6
6
  import '../types-m9RryK9a.js';
7
7
  import '../voice/index.js';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-7TG2Y45H.js';
1
+ export { Agent } from '../chunk-FZMBA5CV.js';
@@ -1,10 +1,10 @@
1
1
  import * as ai from 'ai';
2
- import { EmbeddingModel, CoreMessage as CoreMessage$1, Message, UserContent, AssistantContent, LanguageModelV1, GenerateTextResult, GenerateObjectResult, 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, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
2
+ import { EmbeddingModel, CoreMessage as CoreMessage$1, Message, UserContent, AssistantContent, LanguageModelV1, TelemetrySettings, GenerateTextResult, GenerateObjectResult, 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, LanguageModel as LanguageModel$1, DeepPartial, ToolContent } from 'ai';
3
3
  import { M as MastraBase, T as Telemetry } from './base-D90KQ4XI.js';
4
- import { a as Metric, M as MetricResult, T as TestInfo } from './types-m9RryK9a.js';
5
4
  import { Query } from 'sift';
6
5
  import { z, ZodSchema } from 'zod';
7
6
  import { JSONSchema7 } from 'json-schema';
7
+ import { a as Metric, M as MetricResult, T as TestInfo } from './types-m9RryK9a.js';
8
8
  import { MastraVector } from './vector/index.js';
9
9
  import { CompositeVoice } from './voice/index.js';
10
10
  import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run } from './index-mKY1XrpK.js';
@@ -413,7 +413,13 @@ interface WorkflowRunState {
413
413
  }>;
414
414
  runId: string;
415
415
  timestamp: number;
416
+ childStates?: Record<string, WorkflowRunState>;
417
+ suspendedSteps?: Record<string, string>;
416
418
  }
419
+ type WorkflowResumeResult<TTriggerSchema extends z.ZodType<any>> = {
420
+ triggerData?: z.infer<TTriggerSchema>;
421
+ results: Record<string, StepResult<any>>;
422
+ };
417
423
 
418
424
  type MastraPrimitives = {
419
425
  logger?: Logger;
@@ -465,11 +471,9 @@ interface AgentConfig<TTools extends Record<string, ToolAction<any, any, any, an
465
471
  memory?: MastraMemory;
466
472
  voice?: CompositeVoice;
467
473
  }
468
- interface AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> {
474
+ type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
469
475
  toolsets?: ToolsetsInput;
470
- resourceId?: string;
471
476
  context?: CoreMessage[];
472
- threadId?: string;
473
477
  memoryOptions?: MemoryConfig;
474
478
  runId?: string;
475
479
  onStepFinish?: (step: string) => void;
@@ -478,12 +482,17 @@ interface AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = u
478
482
  temperature?: number;
479
483
  toolChoice?: 'auto' | 'required';
480
484
  experimental_output?: Z;
481
- }
482
- interface AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> {
485
+ telemetry?: TelemetrySettings;
486
+ } & ({
487
+ resourceId?: undefined;
488
+ threadId?: undefined;
489
+ } | {
490
+ resourceId: string;
491
+ threadId: string;
492
+ });
493
+ type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
483
494
  toolsets?: ToolsetsInput;
484
- resourceId?: string;
485
495
  context?: CoreMessage[];
486
- threadId?: string;
487
496
  memoryOptions?: MemoryConfig;
488
497
  runId?: string;
489
498
  onFinish?: (result: string) => unknown;
@@ -493,7 +502,14 @@ interface AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = und
493
502
  temperature?: number;
494
503
  toolChoice?: 'auto' | 'required';
495
504
  experimental_output?: Z;
496
- }
505
+ telemetry?: TelemetrySettings;
506
+ } & ({
507
+ resourceId?: undefined;
508
+ threadId?: undefined;
509
+ } | {
510
+ resourceId: string;
511
+ threadId: string;
512
+ });
497
513
 
498
514
  type LanguageModel = LanguageModelV1;
499
515
  type CoreMessage = CoreMessage$1;
@@ -534,6 +550,7 @@ type LLMTextOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> =
534
550
  maxSteps?: number;
535
551
  temperature?: number;
536
552
  experimental_output?: Z;
553
+ telemetry?: TelemetrySettings;
537
554
  } & Run;
538
555
  type LLMTextObjectOptions<T> = LLMTextOptions & {
539
556
  structuredOutput: JSONSchema7 | z.ZodType<T> | StructuredOutput;
@@ -548,6 +565,7 @@ type LLMStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined>
548
565
  output?: OutputType | Z;
549
566
  temperature?: number;
550
567
  experimental_output?: Z;
568
+ telemetry?: TelemetrySettings;
551
569
  };
552
570
  type LLMInnerStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
553
571
  tools?: ToolsInput;
@@ -559,6 +577,7 @@ type LLMInnerStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undef
559
577
  temperature?: number;
560
578
  toolChoice?: 'auto' | 'required';
561
579
  experimental_output?: Z;
580
+ telemetry?: TelemetrySettings;
562
581
  } & Run;
563
582
  type LLMStreamObjectOptions<T> = LLMInnerStreamOptions & {
564
583
  structuredOutput: JSONSchema7 | z.ZodType<T> | StructuredOutput;
@@ -666,8 +685,18 @@ declare class Agent<TTools extends Record<string, ToolAction<any, any, any, any>
666
685
  outputText: string;
667
686
  }) => Promise<void>;
668
687
  };
669
- generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], { context, threadId: threadIdInFn, memoryOptions, resourceId, maxSteps, onStepFinish, runId, toolsets, output, temperature, toolChoice, experimental_output, }?: AgentGenerateOptions<Z>): Promise<GenerateReturn<Z>>;
670
- stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], { context, threadId: threadIdInFn, memoryOptions, resourceId, maxSteps, onFinish, onStepFinish, runId, toolsets, output, temperature, toolChoice, experimental_output, }?: AgentStreamOptions<Z>): Promise<StreamReturn<Z>>;
688
+ generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], args?: AgentGenerateOptions<Z> & {
689
+ output?: 'text';
690
+ experimental_output?: never;
691
+ }): Promise<GenerateTextResult<any, any>>;
692
+ generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], args?: AgentGenerateOptions<Z> & ({
693
+ output: Z;
694
+ experimental_output?: never;
695
+ } | {
696
+ experimental_output: Z;
697
+ output?: never;
698
+ })): Promise<GenerateObjectResult<Z extends ZodSchema ? z.infer<Z> : unknown>>;
699
+ stream<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[], { context, threadId: threadIdInFn, memoryOptions, resourceId, maxSteps, onFinish, onStepFinish, runId, toolsets, output, temperature, toolChoice, experimental_output, telemetry, }?: AgentStreamOptions<Z>): Promise<StreamReturn<Z>>;
671
700
  /**
672
701
  * Convert text to speech using the configured voice provider
673
702
  * @param input Text or text stream to convert to speech
@@ -898,4 +927,4 @@ declare abstract class MastraStorage extends MastraBase {
898
927
  __getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
899
928
  }
900
929
 
901
- export { type StepCondition as $, Agent as A, type BaseStructuredOutputType as B, type CoreMessage as C, type LLMTextOptions as D, type EvalRow as E, type LLMTextObjectOptions as F, type GenerateReturn as G, type LLMStreamOptions as H, type IAction as I, type LLMInnerStreamOptions as J, type LLMStreamObjectOptions as K, type LanguageModel as L, MastraStorage as M, type MessageResponse as N, type OutputType as O, type MemoryConfig as P, type SharedMemoryConfig as Q, type RetryConfig as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreTool as U, type StepNode as V, type WorkflowOptions as W, type VariableReference as X, type BaseCondition as Y, type ActionContext as Z, type StepDef as _, MastraMemory as a, type WorkflowContext as a0, type WorkflowLogMessage as a1, type WorkflowEvent as a2, type ResolverFunctionInput as a3, type ResolverFunctionOutput as a4, type SubscriberFunctionOutput as a5, type DependencyCheckOutput as a6, type WorkflowActors as a7, type WorkflowActionParams as a8, type WorkflowActions as a9, type WorkflowState as aa, type StepId as ab, type ExtractSchemaFromStep as ac, type ExtractStepResult as ad, type StepInputType as ae, type ExtractSchemaType as af, type PathsToStringProps as ag, TABLE_WORKFLOW_SNAPSHOT as ah, TABLE_EVALS as ai, TABLE_MESSAGES as aj, TABLE_THREADS as ak, TABLE_TRACES as al, type StorageThreadType as b, type MessageType as c, type StorageGetMessagesArg as d, type StepExecutionContext as e, type StepAction as f, type MastraPrimitives as g, type StepVariableType as h, type StepConfig as i, type StepResult as j, type WorkflowRunState as k, type StepGraph as l, type ToolAction as m, type AgentConfig as n, type ToolExecutionContext as o, type WorkflowRow as p, type CoreSystemMessage as q, type CoreAssistantMessage as r, type CoreUserMessage as s, type CoreToolMessage as t, type EmbedResult as u, type EmbedManyResult as v, type StructuredOutputType as w, type StructuredOutputArrayItem as x, type StructuredOutput as y, type StreamReturn as z };
930
+ export { type StepCondition as $, Agent as A, type BaseStructuredOutputType as B, type CoreMessage as C, type LLMTextOptions as D, type EvalRow as E, type LLMTextObjectOptions as F, type GenerateReturn as G, type LLMStreamOptions as H, type IAction as I, type LLMInnerStreamOptions as J, type LLMStreamObjectOptions as K, type LanguageModel as L, MastraStorage as M, type MessageResponse as N, type OutputType as O, type MemoryConfig as P, type SharedMemoryConfig as Q, type RetryConfig as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreTool as U, type StepNode as V, type WorkflowOptions as W, type VariableReference as X, type BaseCondition as Y, type ActionContext as Z, type StepDef as _, MastraMemory as a, type WorkflowContext as a0, type WorkflowLogMessage as a1, type WorkflowEvent as a2, type ResolverFunctionInput as a3, type ResolverFunctionOutput as a4, type SubscriberFunctionOutput as a5, type DependencyCheckOutput as a6, type WorkflowActors as a7, type WorkflowActionParams as a8, type WorkflowActions as a9, type WorkflowState as aa, type StepId as ab, type ExtractSchemaFromStep as ac, type ExtractStepResult as ad, type StepInputType as ae, type ExtractSchemaType as af, type PathsToStringProps as ag, type WorkflowResumeResult as ah, TABLE_WORKFLOW_SNAPSHOT as ai, TABLE_EVALS as aj, TABLE_MESSAGES as ak, TABLE_THREADS as al, TABLE_TRACES as am, type StorageThreadType as b, type MessageType as c, type StorageGetMessagesArg as d, type StepExecutionContext as e, type StepAction as f, type MastraPrimitives as g, type StepResult as h, type StepVariableType as i, type StepConfig as j, type WorkflowRunState as k, type StepGraph as l, type ToolAction as m, type AgentConfig as n, type ToolExecutionContext as o, type WorkflowRow as p, type CoreSystemMessage as q, type CoreAssistantMessage as r, type CoreUserMessage as s, type CoreToolMessage as t, type EmbedResult as u, type EmbedManyResult as v, type StructuredOutputType as w, type StructuredOutputArrayItem as x, type StructuredOutput as y, type StreamReturn as z };