@mastra/core 0.9.4-alpha.0 → 0.9.4-alpha.2
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/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +4 -3
- package/dist/agent/index.d.ts +4 -3
- package/dist/agent/index.js +1 -1
- package/dist/{base-CeEVvwRi.d.ts → base-4Z34GQL8.d.ts} +1 -1
- package/dist/{base-VMWGZau0.d.cts → base-BH9nLjiE.d.cts} +159 -16
- package/dist/{base-BCnFhShR.d.ts → base-Ds8Er4RI.d.ts} +159 -16
- package/dist/{base-D9APQt4V.d.cts → base-H7siSAfu.d.cts} +1 -1
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +2 -2
- package/dist/base.d.ts +2 -2
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +2 -2
- package/dist/bundler/index.d.ts +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-NDAW47QQ.js → chunk-235X76GC.js} +1 -1
- package/dist/{chunk-BMSBIZKD.cjs → chunk-2GXSTMD7.cjs} +2 -2
- package/dist/{chunk-Q6ZDDQOB.js → chunk-2OC4YT6C.js} +1 -1
- package/dist/{chunk-FXAV2WYX.cjs → chunk-2TW4KTAP.cjs} +47 -26
- package/dist/{chunk-ZHCBQ7GF.js → chunk-4OTKXCGD.js} +1 -1
- package/dist/{chunk-OGNJRWRQ.cjs → chunk-5DUFC7TV.cjs} +2 -2
- package/dist/{chunk-S6OGHYA5.js → chunk-6YUKY7NG.js} +4 -4
- package/dist/{chunk-KPOUHZFJ.js → chunk-7BYKMXS2.js} +3 -3
- package/dist/{chunk-6YITFTRU.cjs → chunk-7FV65Q6G.cjs} +2 -2
- package/dist/{chunk-JIRLIXUC.js → chunk-CLQS5YQO.js} +240 -58
- package/dist/{chunk-2BVZNKLX.js → chunk-CMPPXW4U.js} +2 -1
- package/dist/{chunk-CPONI4EX.js → chunk-CTKNWYK2.js} +1 -1
- package/dist/{chunk-6NUAJ6AB.cjs → chunk-E4FAXBUV.cjs} +2 -2
- package/dist/{chunk-RO52JMKQ.cjs → chunk-EG74VBSP.cjs} +6 -6
- package/dist/{chunk-JCBDQUQY.js → chunk-EK3WKXRL.js} +1 -1
- package/dist/{chunk-5ENQX4BI.cjs → chunk-GXKODTLA.cjs} +42 -9
- package/dist/{chunk-UWRSG6F2.cjs → chunk-IIK2DDET.cjs} +2 -2
- package/dist/{chunk-QFJY3MEL.js → chunk-JBJ7KXN5.js} +1 -1
- package/dist/{chunk-25XLNT54.cjs → chunk-MT4MRB64.cjs} +11 -11
- package/dist/{chunk-ZMMZXEOL.cjs → chunk-MUCBDM7Y.cjs} +9 -9
- package/dist/{chunk-TCL7XDJL.js → chunk-NLBJOFNG.js} +1 -1
- package/dist/{chunk-FVYYXFPR.js → chunk-NOPY74PV.js} +1 -1
- package/dist/{chunk-ZQ7FXUGY.js → chunk-NW6LO3QH.js} +46 -24
- package/dist/{chunk-O7IW545H.cjs → chunk-O44MSFMZ.cjs} +2 -1
- package/dist/{chunk-6SEZATEX.cjs → chunk-OH4OCBZW.cjs} +254 -72
- package/dist/{chunk-RE5MNHDE.cjs → chunk-RAQBTCIR.cjs} +2 -2
- package/dist/{chunk-CRHH7KRS.cjs → chunk-RGE4UF6A.cjs} +2 -2
- package/dist/{chunk-KXWR3FNX.cjs → chunk-S7J63JOG.cjs} +2 -2
- package/dist/{chunk-IKZWOULI.js → chunk-SOLXHDNQ.js} +35 -2
- package/dist/{chunk-T5V4W7WU.js → chunk-TAFOICHR.js} +1 -1
- package/dist/{chunk-T5EDV4ZU.js → chunk-U6I2YTXP.js} +1 -1
- package/dist/{chunk-GUMHVPHG.cjs → chunk-V2Q2FEVO.cjs} +2 -2
- package/dist/{chunk-DWD7X4KB.js → chunk-W4BSLENO.js} +1 -1
- package/dist/{chunk-R2ABCCZR.cjs → chunk-ZPFKNO6J.cjs} +2 -2
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +2 -2
- package/dist/deployer/index.d.ts +2 -2
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.d.cts +4 -3
- package/dist/eval/index.d.ts +4 -3
- package/dist/{index-CquI0inB.d.ts → index-QV27jkxQ.d.cts} +1 -0
- package/dist/{index-CquI0inB.d.cts → index-QV27jkxQ.d.ts} +1 -0
- package/dist/index.cjs +69 -69
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +16 -16
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +4 -3
- package/dist/integration/index.d.ts +4 -3
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +4 -3
- package/dist/llm/index.d.ts +4 -3
- package/dist/logger/index.cjs +9 -9
- package/dist/logger/index.d.cts +1 -1
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +4 -3
- package/dist/mastra/index.d.ts +4 -3
- package/dist/mastra/index.js +1 -1
- package/dist/mcp/index.cjs +42 -0
- package/dist/mcp/index.d.cts +26 -0
- package/dist/mcp/index.d.ts +26 -0
- package/dist/mcp/index.js +40 -0
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +4 -3
- package/dist/memory/index.d.ts +4 -3
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +4 -3
- package/dist/network/index.d.ts +4 -3
- package/dist/network/index.js +4 -4
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +4 -3
- package/dist/relevance/index.d.ts +4 -3
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.d.cts +4 -3
- package/dist/server/index.d.ts +4 -3
- package/dist/storage/index.cjs +2 -2
- package/dist/storage/index.d.cts +4 -3
- package/dist/storage/index.d.ts +4 -3
- package/dist/storage/index.js +1 -1
- package/dist/storage/libsql/index.cjs +2 -2
- package/dist/storage/libsql/index.d.cts +4 -3
- package/dist/storage/libsql/index.d.ts +4 -3
- package/dist/storage/libsql/index.js +1 -1
- package/dist/telemetry/index.d.cts +4 -3
- package/dist/telemetry/index.d.ts +4 -3
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +4 -3
- package/dist/tools/index.d.ts +4 -3
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +2 -2
- package/dist/tts/index.d.ts +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/utils.cjs +12 -12
- package/dist/utils.d.cts +5 -4
- package/dist/utils.d.ts +5 -4
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +2 -2
- package/dist/vector/index.d.ts +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/vector/libsql/index.cjs +3 -3
- package/dist/vector/libsql/index.d.cts +2 -2
- package/dist/vector/libsql/index.d.ts +2 -2
- package/dist/vector/libsql/index.js +1 -1
- package/dist/voice/index.cjs +4 -4
- package/dist/voice/index.d.cts +4 -3
- package/dist/voice/index.d.ts +4 -3
- package/dist/voice/index.js +1 -1
- package/dist/workflows/index.cjs +22 -22
- package/dist/workflows/index.d.cts +5 -4
- package/dist/workflows/index.d.ts +5 -4
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/vNext/index.cjs +10 -10
- package/dist/workflows/vNext/index.d.cts +5 -4
- package/dist/workflows/vNext/index.d.ts +5 -4
- package/dist/workflows/vNext/index.js +4 -4
- package/mcp.d.ts +1 -0
- package/package.json +2 -2
package/dist/agent/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOH4OCBZW_cjs = require('../chunk-OH4OCBZW.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Agent", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkOH4OCBZW_cjs.Agent; }
|
|
10
10
|
});
|
package/dist/agent/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { F as Agent, G as AgentConfig,
|
|
5
|
-
import '../base-
|
|
4
|
+
export { F as Agent, G as AgentConfig, bj as AgentGenerateOptions, bk as AgentStreamOptions, bi as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bh as ToolsetsInput } from '../base-BH9nLjiE.cjs';
|
|
5
|
+
import '../base-H7siSAfu.cjs';
|
|
6
6
|
import '../types-BtMyV38I.cjs';
|
|
7
7
|
import '../runtime-context/index.cjs';
|
|
8
8
|
import 'sift';
|
|
9
|
-
import '../index-
|
|
9
|
+
import '../index-QV27jkxQ.cjs';
|
|
10
10
|
import 'stream';
|
|
11
11
|
import 'pino';
|
|
12
12
|
import '@opentelemetry/api';
|
|
@@ -16,6 +16,7 @@ import '../vector/index.cjs';
|
|
|
16
16
|
import '../vector/filter/index.cjs';
|
|
17
17
|
import '@opentelemetry/sdk-trace-base';
|
|
18
18
|
import '../tts/index.cjs';
|
|
19
|
+
import 'node:http';
|
|
19
20
|
import 'events';
|
|
20
21
|
import '../deployer/index.cjs';
|
|
21
22
|
import '../bundler/index.cjs';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { F as Agent, G as AgentConfig,
|
|
5
|
-
import '../base-
|
|
4
|
+
export { F as Agent, G as AgentConfig, bj as AgentGenerateOptions, bk as AgentStreamOptions, bi as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bh as ToolsetsInput } from '../base-Ds8Er4RI.js';
|
|
5
|
+
import '../base-4Z34GQL8.js';
|
|
6
6
|
import '../types-BtMyV38I.js';
|
|
7
7
|
import '../runtime-context/index.js';
|
|
8
8
|
import 'sift';
|
|
9
|
-
import '../index-
|
|
9
|
+
import '../index-QV27jkxQ.js';
|
|
10
10
|
import 'stream';
|
|
11
11
|
import 'pino';
|
|
12
12
|
import '@opentelemetry/api';
|
|
@@ -16,6 +16,7 @@ import '../vector/index.js';
|
|
|
16
16
|
import '../vector/filter/index.js';
|
|
17
17
|
import '@opentelemetry/sdk-trace-base';
|
|
18
18
|
import '../tts/index.js';
|
|
19
|
+
import 'node:http';
|
|
19
20
|
import 'events';
|
|
20
21
|
import '../deployer/index.js';
|
|
21
22
|
import '../bundler/index.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-CLQS5YQO.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _opentelemetry_api from '@opentelemetry/api';
|
|
2
2
|
import { Tracer, Span, BaggageEntry, Context } from '@opentelemetry/api';
|
|
3
|
-
import { R as RegisteredLogger, L as Logger } from './index-
|
|
3
|
+
import { R as RegisteredLogger, L as Logger } from './index-QV27jkxQ.js';
|
|
4
4
|
import { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
5
5
|
|
|
6
6
|
/** Sampling strategy configuration for OpenTelemetry */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
2
|
import { Tool as Tool$1, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, EmbeddingModel, Message, UserContent, AssistantContent, LanguageModel as LanguageModel$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreSystemMessage as CoreSystemMessage$1, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback, ToolContent } from 'ai';
|
|
3
|
-
import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-
|
|
3
|
+
import { M as MastraBase, T as Telemetry, O as OtelConfig } from './base-H7siSAfu.cjs';
|
|
4
4
|
import { a as Metric, M as MetricResult, T as TestInfo } from './types-BtMyV38I.cjs';
|
|
5
5
|
import { Query } from 'sift';
|
|
6
6
|
import { z, ZodSchema } from 'zod';
|
|
7
7
|
import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
|
|
8
|
-
import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run$1 } from './index-
|
|
8
|
+
import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run$1 } from './index-QV27jkxQ.cjs';
|
|
9
9
|
import { RuntimeContext } from './runtime-context/index.cjs';
|
|
10
10
|
import { Span } from '@opentelemetry/api';
|
|
11
11
|
import * as xstate from 'xstate';
|
|
@@ -13,6 +13,7 @@ import { Snapshot } from 'xstate';
|
|
|
13
13
|
import EventEmitter from 'node:events';
|
|
14
14
|
import { MastraVector } from './vector/index.cjs';
|
|
15
15
|
import { MastraTTS } from './tts/index.cjs';
|
|
16
|
+
import * as http from 'node:http';
|
|
16
17
|
import EventEmitter$1 from 'events';
|
|
17
18
|
import { MastraDeployer } from './deployer/index.cjs';
|
|
18
19
|
import { Handler, MiddlewareHandler } from 'hono';
|
|
@@ -34,6 +35,19 @@ type CoreTool = {
|
|
|
34
35
|
id: `${string}.${string}`;
|
|
35
36
|
args: Record<string, unknown>;
|
|
36
37
|
});
|
|
38
|
+
type InternalCoreTool = {
|
|
39
|
+
id?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
parameters: Schema;
|
|
42
|
+
execute?: (params: any, options: ToolExecutionOptions) => Promise<any>;
|
|
43
|
+
} & ({
|
|
44
|
+
type?: 'function' | undefined;
|
|
45
|
+
id?: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'provider-defined';
|
|
48
|
+
id: `${string}.${string}`;
|
|
49
|
+
args: Record<string, unknown>;
|
|
50
|
+
});
|
|
37
51
|
interface ToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> extends IExecutionContext<TSchemaIn> {
|
|
38
52
|
mastra?: MastraUnion;
|
|
39
53
|
runtimeContext: RuntimeContext;
|
|
@@ -61,6 +75,108 @@ declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefine
|
|
|
61
75
|
execute: (context: TContext) => Promise<any>;
|
|
62
76
|
} : Tool<TSchemaIn, TSchemaOut, TContext>;
|
|
63
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Configuration options for an MCP server
|
|
80
|
+
*/
|
|
81
|
+
interface MCPServerConfig {
|
|
82
|
+
/**
|
|
83
|
+
* Name of the MCP server
|
|
84
|
+
*/
|
|
85
|
+
name: string;
|
|
86
|
+
/**
|
|
87
|
+
* Version of the MCP server
|
|
88
|
+
*/
|
|
89
|
+
version: string;
|
|
90
|
+
/**
|
|
91
|
+
* Tools to register with the MCP server
|
|
92
|
+
*/
|
|
93
|
+
tools: ToolsInput;
|
|
94
|
+
}
|
|
95
|
+
type ConvertedTool = {
|
|
96
|
+
name: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
parameters: InternalCoreTool['parameters'];
|
|
99
|
+
execute: InternalCoreTool['execute'];
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Options for starting an MCP server with SSE transport
|
|
103
|
+
*/
|
|
104
|
+
interface MCPServerSSEOptions {
|
|
105
|
+
/**
|
|
106
|
+
* Parsed URL of the incoming request
|
|
107
|
+
*/
|
|
108
|
+
url: URL;
|
|
109
|
+
/**
|
|
110
|
+
* Path for establishing the SSE connection (e.g. '/sse')
|
|
111
|
+
*/
|
|
112
|
+
ssePath: string;
|
|
113
|
+
/**
|
|
114
|
+
* Path for POSTing client messages (e.g. '/message')
|
|
115
|
+
*/
|
|
116
|
+
messagePath: string;
|
|
117
|
+
/**
|
|
118
|
+
* Incoming HTTP request
|
|
119
|
+
*/
|
|
120
|
+
req: http.IncomingMessage;
|
|
121
|
+
/**
|
|
122
|
+
* HTTP response (must support .write/.end)
|
|
123
|
+
*/
|
|
124
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Abstract base class for MCP server implementations
|
|
129
|
+
* This provides a common interface for all MCP servers that can be registered with Mastra
|
|
130
|
+
*/
|
|
131
|
+
declare abstract class MCPServerBase extends MastraBase {
|
|
132
|
+
/**
|
|
133
|
+
* Name of the MCP server
|
|
134
|
+
*/
|
|
135
|
+
readonly name: string;
|
|
136
|
+
/**
|
|
137
|
+
* Version of the MCP server
|
|
138
|
+
*/
|
|
139
|
+
readonly version: string;
|
|
140
|
+
/**
|
|
141
|
+
* Tools registered with the MCP server
|
|
142
|
+
*/
|
|
143
|
+
readonly convertedTools: Record<string, ConvertedTool>;
|
|
144
|
+
mastra: Mastra | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Get a read-only view of the registered tools (for testing/introspection).
|
|
147
|
+
*/
|
|
148
|
+
tools(): Readonly<Record<string, ConvertedTool>>;
|
|
149
|
+
abstract convertTools(tools: ToolsInput): Record<string, ConvertedTool>;
|
|
150
|
+
__registerMastra(mastra: Mastra): void;
|
|
151
|
+
/**
|
|
152
|
+
* Constructor for the MCPServerBase
|
|
153
|
+
* @param config Configuration options for the MCP server
|
|
154
|
+
*/
|
|
155
|
+
constructor(config: MCPServerConfig);
|
|
156
|
+
/**
|
|
157
|
+
* Start the MCP server using stdio transport
|
|
158
|
+
* This is typically used for Windsurf integration
|
|
159
|
+
*/
|
|
160
|
+
abstract startStdio(): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Start the MCP server using SSE transport
|
|
163
|
+
* This is typically used for web integration
|
|
164
|
+
* @param options Options for the SSE transport
|
|
165
|
+
*/
|
|
166
|
+
abstract startSSE(options: MCPServerSSEOptions): Promise<void>;
|
|
167
|
+
abstract startHTTP(options: {
|
|
168
|
+
url: URL;
|
|
169
|
+
httpPath: string;
|
|
170
|
+
req: http.IncomingMessage;
|
|
171
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
172
|
+
options?: any;
|
|
173
|
+
}): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Close the MCP server and all its connections
|
|
176
|
+
*/
|
|
177
|
+
abstract close(): Promise<void>;
|
|
178
|
+
}
|
|
179
|
+
|
|
64
180
|
type AgentNetworkConfig = {
|
|
65
181
|
name: string;
|
|
66
182
|
agents: Agent[];
|
|
@@ -911,11 +1027,6 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
911
1027
|
}, xstate.AnyEventObject>;
|
|
912
1028
|
}) => {
|
|
913
1029
|
mastra?: MastraUnion | undefined;
|
|
914
|
-
triggerData: any;
|
|
915
|
-
isResume?: {
|
|
916
|
-
runId: string;
|
|
917
|
-
stepId: string;
|
|
918
|
-
} | undefined;
|
|
919
1030
|
steps: {
|
|
920
1031
|
[x: string]: {
|
|
921
1032
|
status: "failed";
|
|
@@ -940,8 +1051,13 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
940
1051
|
output?: any;
|
|
941
1052
|
};
|
|
942
1053
|
};
|
|
943
|
-
inputData: Record<string, any>;
|
|
944
1054
|
attempts: Record<string, number>;
|
|
1055
|
+
inputData: Record<string, any>;
|
|
1056
|
+
triggerData: any;
|
|
1057
|
+
isResume?: {
|
|
1058
|
+
runId: string;
|
|
1059
|
+
stepId: string;
|
|
1060
|
+
} | undefined;
|
|
945
1061
|
};
|
|
946
1062
|
readonly states: any;
|
|
947
1063
|
}> | undefined;
|
|
@@ -953,7 +1069,7 @@ interface WorkflowResultReturn<TResult extends z.ZodObject<any>, T extends z.Zod
|
|
|
953
1069
|
triggerData?: z.infer<T>;
|
|
954
1070
|
runtimeContext?: RuntimeContext;
|
|
955
1071
|
} | undefined) => Promise<WorkflowRunResult<T, TSteps, TResult>>;
|
|
956
|
-
watch: (onTransition: (state: Pick<WorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId'>) => void) => () => void;
|
|
1072
|
+
watch: (onTransition: (state: Pick<WorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void) => () => void;
|
|
957
1073
|
resume: (props: {
|
|
958
1074
|
stepId: string;
|
|
959
1075
|
context?: Record<string, any>;
|
|
@@ -996,8 +1112,8 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
|
|
|
996
1112
|
runtimeContext?: RuntimeContext;
|
|
997
1113
|
}): Promise<{
|
|
998
1114
|
runId: string;
|
|
999
|
-
timestamp: number;
|
|
1000
1115
|
result?: z.TypeOf<TResult> | undefined;
|
|
1116
|
+
timestamp: number;
|
|
1001
1117
|
triggerData?: z.TypeOf<TTriggerSchema> | undefined;
|
|
1002
1118
|
results: { [K in keyof StepsRecord$1<TSteps>]: StepsRecord$1<TSteps>[K]["outputSchema"] extends undefined ? StepResult$1<unknown> : StepResult$1<z.TypeOf<NonNullable<StepsRecord$1<TSteps>[K]["outputSchema"]>>>; };
|
|
1003
1119
|
activePaths: Map<TSteps[number]["id"], {
|
|
@@ -1087,7 +1203,13 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1087
1203
|
* @param runId - ID of the run to retrieve
|
|
1088
1204
|
* @returns The workflow run instance if found, undefined otherwise
|
|
1089
1205
|
*/
|
|
1090
|
-
getRun(runId: string): WorkflowInstance<TSteps, TTriggerSchema, any> |
|
|
1206
|
+
getRun(runId: string): Promise<WorkflowRun | WorkflowInstance<TSteps, TTriggerSchema, any> | null>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Gets a workflow run instance by ID, from memory
|
|
1209
|
+
* @param runId - ID of the run to retrieve
|
|
1210
|
+
* @returns The workflow run instance if found, undefined otherwise
|
|
1211
|
+
*/
|
|
1212
|
+
getMemoryRun(runId: string): WorkflowInstance<TSteps, TTriggerSchema, any> | undefined;
|
|
1091
1213
|
/**
|
|
1092
1214
|
* Rebuilds the machine with the current steps configuration and validates the workflow
|
|
1093
1215
|
*
|
|
@@ -1403,7 +1525,7 @@ declare class NewWorkflow<TSteps extends NewStep<string, any, any, any, any>[] =
|
|
|
1403
1525
|
};
|
|
1404
1526
|
constructor({ mastra, id, inputSchema, outputSchema, description, executionEngine, retryConfig, steps, }: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>);
|
|
1405
1527
|
get runs(): Map<string, Run<TSteps, TInput, TOutput>>;
|
|
1406
|
-
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, Logger, Record<string, AgentNetwork>> | undefined;
|
|
1528
|
+
get mastra(): Mastra<Record<string, Agent<any, ToolsInput, Record<string, Metric>>>, Record<string, Workflow<Step<string, any, any, StepExecutionContext<any, WorkflowContext<any, Step<string, any, any, any>[], Record<string, any>>>>[], string, any, any>>, Record<string, NewWorkflow<NewStep<string, any, any, any, any>[], string, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>>, Record<string, MastraVector>, Record<string, MastraTTS>, Logger, Record<string, AgentNetwork>, Record<string, MCPServerBase>> | undefined;
|
|
1407
1529
|
__registerMastra(mastra: Mastra): void;
|
|
1408
1530
|
__registerPrimitives(p: MastraPrimitives): void;
|
|
1409
1531
|
setStepFlow(stepFlow: StepFlowEntry[]): void;
|
|
@@ -2037,6 +2159,7 @@ interface AgentConfig<TAgentId extends string = string, TTools extends ToolsInpu
|
|
|
2037
2159
|
instructions: DynamicArgument<string>;
|
|
2038
2160
|
model: DynamicArgument<MastraLanguageModel>;
|
|
2039
2161
|
tools?: DynamicArgument<TTools>;
|
|
2162
|
+
workflows?: DynamicArgument<Record<string, NewWorkflow>>;
|
|
2040
2163
|
defaultGenerateOptions?: AgentGenerateOptions;
|
|
2041
2164
|
defaultStreamOptions?: AgentStreamOptions;
|
|
2042
2165
|
mastra?: Mastra;
|
|
@@ -2206,7 +2329,7 @@ type ServerConfig = {
|
|
|
2206
2329
|
bodySizeLimit?: number;
|
|
2207
2330
|
};
|
|
2208
2331
|
|
|
2209
|
-
interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
|
|
2332
|
+
interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>, TMCPServers extends Record<string, MCPServerBase> = Record<string, MCPServerBase>> {
|
|
2210
2333
|
agents?: TAgents;
|
|
2211
2334
|
networks?: TNetworks;
|
|
2212
2335
|
storage?: MastraStorage;
|
|
@@ -2218,6 +2341,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
|
|
|
2218
2341
|
telemetry?: OtelConfig;
|
|
2219
2342
|
deployer?: MastraDeployer;
|
|
2220
2343
|
server?: ServerConfig;
|
|
2344
|
+
mcpServers?: TMCPServers;
|
|
2221
2345
|
/**
|
|
2222
2346
|
* Server middleware functions to be applied to API routes
|
|
2223
2347
|
* Each middleware can specify a path pattern (defaults to '/api/*')
|
|
@@ -2229,7 +2353,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
|
|
|
2229
2353
|
}>;
|
|
2230
2354
|
memory?: MastraMemory;
|
|
2231
2355
|
}
|
|
2232
|
-
declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
|
|
2356
|
+
declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TNewWorkflows extends Record<string, NewWorkflow> = Record<string, NewWorkflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>, TMCPServers extends Record<string, MCPServerBase> = Record<string, MCPServerBase>> {
|
|
2233
2357
|
#private;
|
|
2234
2358
|
/**
|
|
2235
2359
|
* @deprecated use getTelemetry() instead
|
|
@@ -2243,7 +2367,7 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
2243
2367
|
* @deprecated use getMemory() instead
|
|
2244
2368
|
*/
|
|
2245
2369
|
get memory(): MastraMemory | undefined;
|
|
2246
|
-
constructor(config?: Config<TAgents, TWorkflows, TNewWorkflows, TVectors, TTTS, TLogger>);
|
|
2370
|
+
constructor(config?: Config<TAgents, TWorkflows, TNewWorkflows, TVectors, TTTS, TLogger, TNetworks, TMCPServers>);
|
|
2247
2371
|
getAgent<TAgentName extends keyof TAgents>(name: TAgentName): TAgents[TAgentName];
|
|
2248
2372
|
getAgents(): TAgents;
|
|
2249
2373
|
getVector<TVectorName extends keyof TVectors>(name: TVectorName): TVectors[TVectorName];
|
|
@@ -2288,6 +2412,17 @@ declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string,
|
|
|
2288
2412
|
transportId: string;
|
|
2289
2413
|
}): Promise<BaseLogMessage[] | undefined>;
|
|
2290
2414
|
getLogs(transportId: string): Promise<BaseLogMessage[]>;
|
|
2415
|
+
/**
|
|
2416
|
+
* Get a specific MCP server by ID
|
|
2417
|
+
* @param serverId - The ID of the MCP server to retrieve
|
|
2418
|
+
* @returns The MCP server with the specified ID, or undefined if not found
|
|
2419
|
+
*/
|
|
2420
|
+
getMCPServer(serverId: string): MCPServerBase | undefined;
|
|
2421
|
+
/**
|
|
2422
|
+
* Get all registered MCP servers as a Record, with keys being their IDs.
|
|
2423
|
+
* @returns Record of MCP server IDs to MCPServerBase instances, or undefined if none.
|
|
2424
|
+
*/
|
|
2425
|
+
getMCPServers(): TMCPServers | undefined;
|
|
2291
2426
|
}
|
|
2292
2427
|
|
|
2293
2428
|
type MastraPrimitives = {
|
|
@@ -2328,6 +2463,9 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2328
2463
|
hasOwnMemory(): boolean;
|
|
2329
2464
|
getMemory(): MastraMemory | undefined;
|
|
2330
2465
|
get voice(): CompositeVoice;
|
|
2466
|
+
getWorkflows({ runtimeContext, }?: {
|
|
2467
|
+
runtimeContext?: RuntimeContext;
|
|
2468
|
+
}): Promise<Record<string, NewWorkflow>>;
|
|
2331
2469
|
getVoice({ runtimeContext }?: {
|
|
2332
2470
|
runtimeContext?: RuntimeContext;
|
|
2333
2471
|
}): Promise<CompositeVoice | DefaultVoice>;
|
|
@@ -2386,6 +2524,11 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2386
2524
|
}>;
|
|
2387
2525
|
private getResponseMessages;
|
|
2388
2526
|
sanitizeResponseMessages(messages: Array<CoreMessage$1>): Array<CoreMessage$1>;
|
|
2527
|
+
private getMemoryTools;
|
|
2528
|
+
private getAssignedTools;
|
|
2529
|
+
private getToolsets;
|
|
2530
|
+
private getClientTools;
|
|
2531
|
+
private getWorkflowTools;
|
|
2389
2532
|
private convertTools;
|
|
2390
2533
|
preExecute({ resourceId, runId, threadId, thread, memoryConfig, messages, systemMessage, }: {
|
|
2391
2534
|
runId?: string;
|
|
@@ -2696,4 +2839,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2696
2839
|
}): Promise<WorkflowRun | null>;
|
|
2697
2840
|
}
|
|
2698
2841
|
|
|
2699
|
-
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type
|
|
2842
|
+
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type AgentNetworkConfig as ba, type VoiceEventType as bb, type VoiceEventMap as bc, type VoiceConfig as bd, MastraVoice as be, CompositeVoice as bf, DefaultVoice as bg, type ToolsetsInput as bh, type DynamicArgument as bi, type AgentGenerateOptions as bj, type AgentStreamOptions as bk, TABLE_WORKFLOW_SNAPSHOT as bl, TABLE_EVALS as bm, TABLE_MESSAGES as bn, TABLE_THREADS as bo, TABLE_TRACES as bp, TABLE_SCHEMAS as bq, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
|