@mastra/core 0.1.27-alpha.32 → 0.1.27-alpha.35
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.
- package/dist/action/index.d.ts +16 -0
- package/dist/agent/index.d.ts +17 -30
- package/dist/agent/types.d.ts +3 -0
- package/dist/base.d.ts +31 -0
- package/dist/core.cjs.development.js +774 -854
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +769 -855
- package/dist/core.esm.js.map +1 -1
- package/dist/embeddings/index.d.ts +3 -0
- package/dist/embeddings/types.d.ts +43 -0
- package/dist/index.d.ts +2 -0
- package/dist/integration/index.d.ts +2 -16
- package/dist/integration/integration.d.ts +25 -0
- package/dist/integration/openapi-toolset.d.ts +15 -0
- package/dist/integration/openapi-toolset.mock.d.ts +16 -0
- package/dist/llm/index.d.ts +20 -46
- package/dist/logger/index.d.ts +1 -0
- package/dist/mastra/index.d.ts +11 -34
- package/dist/mastra/types.d.ts +16 -0
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/sync.d.ts +12 -0
- package/dist/sync/types.d.ts +6 -30
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/tool.d.ts +11 -0
- package/dist/tools/types.d.ts +9 -32
- package/dist/utils.d.ts +3 -0
- package/dist/workflows/step.d.ts +7 -11
- package/dist/workflows/types.d.ts +19 -25
- package/dist/workflows/workflow.d.ts +6 -3
- package/package.json +1 -1
- package/dist/integration/integration.mock.d.ts +0 -12
- package/dist/llm/embeddings.d.ts +0 -35
- package/dist/tools/create-tool.d.ts +0 -2
- package/dist/tools/toolset.d.ts +0 -8
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export interface IExecutionContext<TPayload, TContext> {
|
|
3
|
+
context: TPayload & {
|
|
4
|
+
machineContext?: TContext;
|
|
5
|
+
};
|
|
6
|
+
runId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IAction<TId extends string, TSchemaIn extends z.ZodSchema, TSchemaOut extends z.ZodSchema, TContext extends IExecutionContext<z.infer<TSchemaIn>, any>> {
|
|
9
|
+
id: TId;
|
|
10
|
+
description?: string;
|
|
11
|
+
inputSchema?: TSchemaIn;
|
|
12
|
+
outputSchema?: TSchemaOut;
|
|
13
|
+
payload?: Partial<z.infer<TSchemaIn>>;
|
|
14
|
+
execute: (context: TContext) => Promise<z.infer<TSchemaOut>>;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
import { CoreAssistantMessage, CoreMessage, CoreToolMessage, CoreUserMessage, UserContent } from 'ai';
|
|
2
2
|
import { ZodSchema } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { MastraBase } from '../base';
|
|
4
4
|
import { LLM } from '../llm';
|
|
5
5
|
import { GenerateReturn, ModelConfig, StructuredOutput } from '../llm/types';
|
|
6
|
-
import { Logger } from '../logger';
|
|
7
6
|
import { MastraMemory } from '../memory';
|
|
8
7
|
import { Run } from '../run/types';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
export declare class Agent<TTools
|
|
8
|
+
import { CoreTool, ToolAction } from '../tools/types';
|
|
9
|
+
import { ToolsetsInput } from './types';
|
|
10
|
+
export declare class Agent<TTools extends Record<string, ToolAction<any, any, any, any>> = Record<string, ToolAction<any, any, any, any>>> extends MastraBase {
|
|
12
11
|
#private;
|
|
13
12
|
name: string;
|
|
14
13
|
private memory?;
|
|
15
|
-
readonly llm: LLM
|
|
14
|
+
readonly llm: LLM;
|
|
16
15
|
readonly instructions: string;
|
|
17
16
|
readonly model: ModelConfig;
|
|
18
|
-
readonly enabledTools: Partial<Record<TKeys, boolean>>;
|
|
19
17
|
constructor(config: {
|
|
20
18
|
name: string;
|
|
21
19
|
instructions: string;
|
|
22
20
|
model: ModelConfig;
|
|
23
|
-
|
|
21
|
+
tools?: TTools;
|
|
24
22
|
});
|
|
25
23
|
/**
|
|
26
24
|
* Set the concrete tools for the agent
|
|
27
25
|
* @param tools
|
|
28
26
|
*/
|
|
29
|
-
__setTools(tools:
|
|
30
|
-
/**
|
|
31
|
-
* Set the logger for the agent
|
|
32
|
-
* @param logger
|
|
33
|
-
*/
|
|
34
|
-
__setLogger(logger: Logger): void;
|
|
27
|
+
__setTools(tools: TTools): void;
|
|
35
28
|
__setMemory(memory: MastraMemory): void;
|
|
36
|
-
/**
|
|
37
|
-
* Set the telemetry for the agent
|
|
38
|
-
* @param telemetry
|
|
39
|
-
*/
|
|
40
|
-
__setTelemetry(telemetry: Telemetry): void;
|
|
41
29
|
generateTitleFromUserMessage({ message }: {
|
|
42
30
|
message: CoreUserMessage;
|
|
43
31
|
}): Promise<any>;
|
|
@@ -58,12 +46,11 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
58
46
|
threadId: string;
|
|
59
47
|
}): Promise<void>;
|
|
60
48
|
sanitizeResponseMessages(messages: Array<CoreToolMessage | CoreAssistantMessage>): Array<CoreToolMessage | CoreAssistantMessage>;
|
|
61
|
-
convertTools({
|
|
62
|
-
toolsets?:
|
|
63
|
-
enabledTools?: Partial<Record<TKeys, boolean>>;
|
|
49
|
+
convertTools({ toolsets, threadId, runId, }: {
|
|
50
|
+
toolsets?: ToolsetsInput;
|
|
64
51
|
threadId?: string;
|
|
65
52
|
runId?: string;
|
|
66
|
-
}): Record<
|
|
53
|
+
}): Record<string, CoreTool>;
|
|
67
54
|
preExecute({ resourceid, runId, threadId, messages, }: {
|
|
68
55
|
runId?: string;
|
|
69
56
|
threadId?: string;
|
|
@@ -74,7 +61,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
74
61
|
threadIdToUse: string;
|
|
75
62
|
}>;
|
|
76
63
|
__primitive({ messages, context, threadId, resourceid, runId, toolsets, }: {
|
|
77
|
-
toolsets?:
|
|
64
|
+
toolsets?: ToolsetsInput;
|
|
78
65
|
resourceid?: string;
|
|
79
66
|
threadId?: string;
|
|
80
67
|
context?: CoreMessage[];
|
|
@@ -83,7 +70,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
83
70
|
}): {
|
|
84
71
|
before: () => Promise<{
|
|
85
72
|
messageObjects: CoreMessage[];
|
|
86
|
-
convertedTools: Record<
|
|
73
|
+
convertedTools: Record<string, CoreTool> | undefined;
|
|
87
74
|
threadId: string;
|
|
88
75
|
}>;
|
|
89
76
|
after: ({ result, threadId }: {
|
|
@@ -92,7 +79,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
92
79
|
}) => Promise<void>;
|
|
93
80
|
};
|
|
94
81
|
generate<S extends boolean = false, Z extends ZodSchema | undefined = undefined>(messages: string | string[] | CoreMessage[], { schema, stream, context, threadId: threadIdInFn, resourceid, maxSteps, onFinish, onStepFinish, runId, toolsets, }?: {
|
|
95
|
-
toolsets?:
|
|
82
|
+
toolsets?: ToolsetsInput;
|
|
96
83
|
resourceid?: string;
|
|
97
84
|
context?: CoreMessage[];
|
|
98
85
|
threadId?: string;
|
|
@@ -104,7 +91,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
104
91
|
maxSteps?: number;
|
|
105
92
|
}): Promise<GenerateReturn<S, Z>>;
|
|
106
93
|
text({ messages, context, onStepFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, toolsets, }: {
|
|
107
|
-
toolsets?:
|
|
94
|
+
toolsets?: ToolsetsInput;
|
|
108
95
|
resourceid?: string;
|
|
109
96
|
threadId?: string;
|
|
110
97
|
context?: CoreMessage[];
|
|
@@ -113,7 +100,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
113
100
|
maxSteps?: number;
|
|
114
101
|
} & Run): Promise<import("ai").GenerateTextResult<{}, never>>;
|
|
115
102
|
textObject({ messages, context, structuredOutput, onStepFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, toolsets, }: {
|
|
116
|
-
toolsets?:
|
|
103
|
+
toolsets?: ToolsetsInput;
|
|
117
104
|
context?: CoreMessage[];
|
|
118
105
|
resourceid?: string;
|
|
119
106
|
threadId?: string;
|
|
@@ -123,7 +110,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
123
110
|
maxSteps?: number;
|
|
124
111
|
} & Run): Promise<import("ai").GenerateObjectResult<any>>;
|
|
125
112
|
stream({ messages, context, onStepFinish, onFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, toolsets, }: {
|
|
126
|
-
toolsets?:
|
|
113
|
+
toolsets?: ToolsetsInput;
|
|
127
114
|
resourceid?: string;
|
|
128
115
|
threadId?: string;
|
|
129
116
|
messages: UserContent[];
|
|
@@ -133,7 +120,7 @@ export declare class Agent<TTools, TIntegrations extends Integration[] | undefin
|
|
|
133
120
|
maxSteps?: number;
|
|
134
121
|
} & Run): Promise<import("ai").StreamTextResult<{}>>;
|
|
135
122
|
streamObject({ messages, context, structuredOutput, onStepFinish, onFinish, maxSteps, threadId: threadIdInFn, resourceid, runId, toolsets, }: {
|
|
136
|
-
toolsets?:
|
|
123
|
+
toolsets?: ToolsetsInput;
|
|
137
124
|
resourceid?: string;
|
|
138
125
|
threadId?: string;
|
|
139
126
|
messages: UserContent[];
|
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Logger, LogLevel, RegisteredLogger } from './logger';
|
|
2
|
+
import { Telemetry } from './telemetry';
|
|
3
|
+
export declare class MastraBase {
|
|
4
|
+
component: RegisteredLogger;
|
|
5
|
+
logger: Logger;
|
|
6
|
+
telemetry?: Telemetry;
|
|
7
|
+
constructor({ component }: {
|
|
8
|
+
component: RegisteredLogger;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Set the logger for the agent
|
|
12
|
+
* @param logger
|
|
13
|
+
*/
|
|
14
|
+
__setLogger(logger: Logger): void;
|
|
15
|
+
/**
|
|
16
|
+
* Internal logging helper that formats and sends logs to the configured logger
|
|
17
|
+
* @param level - Severity level of the log
|
|
18
|
+
* @param message - Main log message
|
|
19
|
+
* @param runId - Optional runId for the log
|
|
20
|
+
*/
|
|
21
|
+
log(level: LogLevel, message: string, runId?: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Set the telemetry for the agent
|
|
24
|
+
* @param telemetry
|
|
25
|
+
*/
|
|
26
|
+
__setTelemetry(telemetry: Telemetry): void;
|
|
27
|
+
get experimental_telemetry(): {
|
|
28
|
+
tracer: import("@opentelemetry/api").Tracer;
|
|
29
|
+
isEnabled: boolean;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}
|