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

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,15 +1,16 @@
1
- import { UserContent } from 'ai';
2
- import { ZodSchema } from 'zod';
1
+ import { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage, UserContent } from 'ai';
3
2
  import { Integration } from '../integration';
4
3
  import { LLM } from '../llm';
5
4
  import { ModelConfig, StructuredOutput } from '../llm/types';
6
5
  import { Logger } from '../logger';
6
+ import { MastraMemory } from '../memory';
7
7
  import { Run } from '../run/types';
8
8
  import { Telemetry } from '../telemetry';
9
- import { AllTools, ToolApi } from '../tools/types';
9
+ import { AllTools, CoreTool, ToolApi } from '../tools/types';
10
10
  export declare class Agent<TTools, TIntegrations extends Integration[] | undefined = undefined, TKeys extends keyof AllTools<TTools, TIntegrations> = keyof AllTools<TTools, TIntegrations>> {
11
11
  #private;
12
12
  name: string;
13
+ private memory?;
13
14
  readonly llm: LLM<TTools, TIntegrations, TKeys>;
14
15
  readonly instructions: string;
15
16
  readonly model: ModelConfig;
@@ -30,31 +31,65 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
30
31
  * @param logger
31
32
  */
32
33
  __setLogger(logger: Logger): void;
34
+ __setMemory(memory: MastraMemory): void;
33
35
  /**
34
36
  * Set the telemetry for the agent
35
37
  * @param telemetry
36
38
  */
37
39
  __setTelemetry(telemetry: Telemetry): void;
38
- text({ messages, onStepFinish, maxSteps, runId, }: {
40
+ generateTitleFromUserMessage({ message }: {
41
+ message: CoreUserMessage;
42
+ }): Promise<string>;
43
+ getMostRecentUserMessage(messages: Array<CoreMessage>): CoreUserMessage | undefined;
44
+ genTitle(userMessage: CoreUserMessage | undefined): Promise<string>;
45
+ saveMemory({ threadId, resourceid, userMessages, }: {
46
+ resourceid: string;
47
+ threadId?: string;
48
+ userMessages: CoreMessage[];
49
+ time?: Date;
50
+ keyword?: string;
51
+ }): Promise<{
52
+ threadId: string;
53
+ messages: CoreMessage[];
54
+ }>;
55
+ saveMemoryOnFinish({ result, threadId }: {
56
+ result: string;
57
+ threadId: string;
58
+ }): Promise<void>;
59
+ sanitizeResponseMessages(messages: Array<CoreToolMessage | CoreAssistantMessage>): Array<CoreToolMessage | CoreAssistantMessage>;
60
+ convertTools({ enabledTools, threadId, runId, }: {
61
+ enabledTools?: Partial<Record<TKeys, boolean>>;
62
+ threadId: string;
63
+ runId?: string;
64
+ }): Record<TKeys, CoreTool>;
65
+ text({ messages, onStepFinish, maxSteps, threadId, resourceid, runId, }: {
66
+ resourceid?: string;
67
+ threadId?: string;
39
68
  messages: UserContent[];
40
69
  onStepFinish?: (step: string) => void;
41
70
  maxSteps?: number;
42
71
  } & Run): Promise<import("ai").GenerateTextResult<{}, never>>;
43
- textObject({ messages, structuredOutput, onStepFinish, maxSteps, runId, }: {
72
+ textObject({ messages, structuredOutput, onStepFinish, maxSteps, threadId, resourceid, runId, }: {
73
+ resourceid?: string;
74
+ threadId?: string;
44
75
  messages: UserContent[];
45
- structuredOutput: StructuredOutput | ZodSchema;
76
+ structuredOutput: StructuredOutput;
46
77
  onStepFinish?: (step: string) => void;
47
78
  maxSteps?: number;
48
79
  } & Run): Promise<import("ai").GenerateObjectResult<any>>;
49
- stream({ messages, onStepFinish, onFinish, maxSteps, runId, }: {
80
+ stream({ messages, onStepFinish, onFinish, maxSteps, threadId, resourceid, runId, }: {
81
+ resourceid?: string;
82
+ threadId?: string;
50
83
  messages: UserContent[];
51
84
  onStepFinish?: (step: string) => void;
52
85
  onFinish?: (result: string) => Promise<void> | void;
53
86
  maxSteps?: number;
54
87
  } & Run): Promise<import("ai").StreamTextResult<{}>>;
55
- streamObject({ messages, structuredOutput, onStepFinish, onFinish, maxSteps, runId, }: {
88
+ streamObject({ messages, structuredOutput, onStepFinish, onFinish, maxSteps, threadId, resourceid, runId, }: {
89
+ resourceid?: string;
90
+ threadId?: string;
56
91
  messages: UserContent[];
57
- structuredOutput: StructuredOutput | ZodSchema;
92
+ structuredOutput: StructuredOutput;
58
93
  onStepFinish?: (step: string) => void;
59
94
  onFinish?: (result: string) => Promise<void> | void;
60
95
  maxSteps?: number;