@mastra/core 0.1.27-alpha.22 → 0.1.27-alpha.24

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,4 +1,5 @@
1
1
  import { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage, UserContent } from 'ai';
2
+ import { ZodSchema } from 'zod';
2
3
  import { Integration } from '../integration';
3
4
  import { LLM } from '../llm';
4
5
  import { ModelConfig, StructuredOutput } from '../llm/types';
@@ -52,8 +53,8 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
52
53
  threadId: string;
53
54
  messages: CoreMessage[];
54
55
  }>;
55
- saveMemoryOnFinish({ result, threadId }: {
56
- result: string;
56
+ saveResponse({ result, threadId }: {
57
+ result: Record<string, any>;
57
58
  threadId: string;
58
59
  }): Promise<void>;
59
60
  sanitizeResponseMessages(messages: Array<CoreToolMessage | CoreAssistantMessage>): Array<CoreToolMessage | CoreAssistantMessage>;
@@ -62,34 +63,64 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
62
63
  threadId: string;
63
64
  runId?: string;
64
65
  }): Record<TKeys, CoreTool>;
65
- text({ messages, onStepFinish, maxSteps, threadId, resourceid, runId, }: {
66
+ preExecute({ resourceid, runId, threadId, messages, }: {
67
+ runId?: string;
68
+ threadId?: string;
69
+ messages: CoreMessage[];
70
+ resourceid: string;
71
+ }): Promise<{
72
+ coreMessages: CoreMessage[];
73
+ threadIdToUse: string;
74
+ }>;
75
+ __primitive({ messages, context, threadId, resourceid, runId, }: {
76
+ resourceid?: string;
77
+ threadId?: string;
78
+ context?: CoreMessage[];
79
+ runId?: string;
80
+ messages: UserContent[];
81
+ }): {
82
+ before: () => Promise<{
83
+ messageObjects: CoreMessage[];
84
+ convertedTools: Record<TKeys, CoreTool> | undefined;
85
+ threadId: string;
86
+ }>;
87
+ after: ({ result, threadId }: {
88
+ result: Record<string, any>;
89
+ threadId: string;
90
+ }) => Promise<void>;
91
+ };
92
+ text({ messages, context, onStepFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, }: {
66
93
  resourceid?: string;
67
94
  threadId?: string;
95
+ context?: CoreMessage[];
68
96
  messages: UserContent[];
69
97
  onStepFinish?: (step: string) => void;
70
98
  maxSteps?: number;
71
99
  } & Run): Promise<import("ai").GenerateTextResult<{}, never>>;
72
- textObject({ messages, structuredOutput, onStepFinish, maxSteps, threadId, resourceid, runId, }: {
100
+ textObject({ messages, context, structuredOutput, onStepFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, }: {
101
+ context?: CoreMessage[];
73
102
  resourceid?: string;
74
103
  threadId?: string;
75
104
  messages: UserContent[];
76
- structuredOutput: StructuredOutput;
105
+ structuredOutput: StructuredOutput | ZodSchema;
77
106
  onStepFinish?: (step: string) => void;
78
107
  maxSteps?: number;
79
108
  } & Run): Promise<import("ai").GenerateObjectResult<any>>;
80
- stream({ messages, onStepFinish, onFinish, maxSteps, threadId, resourceid, runId, }: {
109
+ stream({ messages, context, onStepFinish, onFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, }: {
81
110
  resourceid?: string;
82
111
  threadId?: string;
83
112
  messages: UserContent[];
113
+ context?: CoreMessage[];
84
114
  onStepFinish?: (step: string) => void;
85
115
  onFinish?: (result: string) => Promise<void> | void;
86
116
  maxSteps?: number;
87
117
  } & Run): Promise<import("ai").StreamTextResult<{}>>;
88
- streamObject({ messages, structuredOutput, onStepFinish, onFinish, maxSteps, threadId, resourceid, runId, }: {
118
+ streamObject({ messages, context, structuredOutput, onStepFinish, onFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, }: {
89
119
  resourceid?: string;
90
120
  threadId?: string;
91
121
  messages: UserContent[];
92
- structuredOutput: StructuredOutput;
122
+ context?: CoreMessage[];
123
+ structuredOutput: StructuredOutput | ZodSchema;
93
124
  onStepFinish?: (step: string) => void;
94
125
  onFinish?: (result: string) => Promise<void> | void;
95
126
  maxSteps?: number;