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

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