@mastra/core 0.10.13 → 0.10.14
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/a2a.d.ts +1 -0
- package/agent.d.ts +1 -0
- package/base.d.ts +1 -0
- package/bundler.d.ts +1 -0
- package/deployer.d.ts +1 -0
- package/di.d.ts +1 -0
- package/dist/a2a/index.cjs +79 -0
- package/dist/a2a/index.d.cts +780 -0
- package/dist/a2a/index.d.ts +780 -0
- package/dist/a2a/index.js +68 -0
- package/dist/agent/index.cjs +15 -0
- package/dist/agent/index.d.cts +29 -0
- package/dist/agent/index.d.ts +29 -0
- package/dist/agent/index.js +2 -0
- package/dist/base-B_y9sMg0.d.cts +162 -0
- package/dist/base-CS5eSXbL.d.cts +4117 -0
- package/dist/base-ClrXcCRx.d.ts +162 -0
- package/dist/base-DBhKcre4.d.ts +4117 -0
- package/dist/base.cjs +10 -0
- package/dist/base.d.cts +6 -0
- package/dist/base.d.ts +6 -0
- package/dist/base.js +1 -0
- package/dist/bundler/index.cjs +10 -0
- package/dist/bundler/index.d.cts +30 -0
- package/dist/bundler/index.d.ts +30 -0
- package/dist/bundler/index.js +1 -0
- package/dist/chunk-2GRYVZ2O.cjs +244 -0
- package/dist/chunk-2HDFKWFU.js +2249 -0
- package/dist/chunk-32C7JDIZ.js +1 -0
- package/dist/chunk-4UBOJFSL.js +989 -0
- package/dist/chunk-4UWPFBC6.js +88 -0
- package/dist/chunk-4Z3OU5RY.cjs +31 -0
- package/dist/chunk-5HTMDAXP.js +359 -0
- package/dist/chunk-5IEKR756.js +53 -0
- package/dist/chunk-5YDTZN2X.js +114 -0
- package/dist/chunk-6UNGH46J.js +75 -0
- package/dist/chunk-6Y4UL5Z6.cjs +94 -0
- package/dist/chunk-7F6BQXE2.cjs +425 -0
- package/dist/chunk-7H2GET5Z.cjs +668 -0
- package/dist/chunk-7HZ6NIAF.cjs +2 -0
- package/dist/chunk-7MZNOW6W.cjs +2263 -0
- package/dist/chunk-7XQIPES3.js +668 -0
- package/dist/chunk-AKYTYALY.js +70 -0
- package/dist/chunk-ATXBSEFT.js +22 -0
- package/dist/chunk-B6TOBUS6.cjs +80 -0
- package/dist/chunk-B7SQOKEC.cjs +91 -0
- package/dist/chunk-BB4KXGBU.js +83 -0
- package/dist/chunk-BB6DPGIV.cjs +6 -0
- package/dist/chunk-C4LMN2IR.js +27 -0
- package/dist/chunk-DFFVEKIG.js +407 -0
- package/dist/chunk-E7AX3U6M.cjs +659 -0
- package/dist/chunk-EWCOOO3H.js +5007 -0
- package/dist/chunk-F2WMR75C.cjs +183 -0
- package/dist/chunk-FBKJ3652.cjs +5034 -0
- package/dist/chunk-FEYYOBBG.cjs +24 -0
- package/dist/chunk-FL5SZ2XU.js +181 -0
- package/dist/chunk-GH2KM66J.js +37 -0
- package/dist/chunk-GWFS5DAR.cjs +37 -0
- package/dist/chunk-HNEE7IF4.js +60 -0
- package/dist/chunk-HSVOEWAM.cjs +2 -0
- package/dist/chunk-J52TXHZV.cjs +73 -0
- package/dist/chunk-JNMQKJH4.js +10 -0
- package/dist/chunk-JQOMTERC.js +89 -0
- package/dist/chunk-LABUWBKX.cjs +71 -0
- package/dist/chunk-LXFZUKP3.cjs +34 -0
- package/dist/chunk-MP2QBLUJ.cjs +70 -0
- package/dist/chunk-MUNFCOMB.cjs +62 -0
- package/dist/chunk-NH5WJNNS.js +1 -0
- package/dist/chunk-P3Q73CAW.cjs +55 -0
- package/dist/chunk-PA2YIVIT.js +61 -0
- package/dist/chunk-QFTBW7ZZ.cjs +2 -0
- package/dist/chunk-QQ5K5TZE.cjs +619 -0
- package/dist/chunk-QUSEDVYI.cjs +991 -0
- package/dist/chunk-R4V75T7J.js +1 -0
- package/dist/chunk-SGGPJWRQ.js +69 -0
- package/dist/chunk-ST5RMVLG.cjs +87 -0
- package/dist/chunk-TC2SCOTE.js +605 -0
- package/dist/chunk-U64IJDC5.cjs +109 -0
- package/dist/chunk-UX3B6S2I.cjs +65 -0
- package/dist/chunk-V5D2LIF5.js +68 -0
- package/dist/chunk-VG4OPO2R.js +240 -0
- package/dist/chunk-WQNOATKB.js +103 -0
- package/dist/chunk-Y7D2JLKS.js +4 -0
- package/dist/chunk-YJEHXYK5.js +657 -0
- package/dist/chunk-YOQP5T77.js +32 -0
- package/dist/chunk-ZIZ3CVHN.cjs +120 -0
- package/dist/chunk-ZPOUMTTH.cjs +362 -0
- package/dist/chunk-ZZLBNB3U.cjs +12 -0
- package/dist/deployer/index.cjs +10 -0
- package/dist/deployer/index.d.cts +19 -0
- package/dist/deployer/index.d.ts +19 -0
- package/dist/deployer/index.js +1 -0
- package/dist/di/index.cjs +10 -0
- package/dist/di/index.d.cts +1 -0
- package/dist/di/index.d.ts +1 -0
- package/dist/di/index.js +1 -0
- package/dist/error/index.cjs +22 -0
- package/dist/error/index.d.cts +86 -0
- package/dist/error/index.d.ts +86 -0
- package/dist/error/index.js +1 -0
- package/dist/eval/index.cjs +14 -0
- package/dist/eval/index.d.cts +43 -0
- package/dist/eval/index.d.ts +43 -0
- package/dist/eval/index.js +1 -0
- package/dist/hooks/index.cjs +18 -0
- package/dist/hooks/index.d.cts +33 -0
- package/dist/hooks/index.d.ts +33 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index.cjs +281 -0
- package/dist/index.d.cts +92 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +112 -0
- package/dist/integration/index.cjs +14 -0
- package/dist/integration/index.d.cts +65 -0
- package/dist/integration/index.d.ts +65 -0
- package/dist/integration/index.js +1 -0
- package/dist/llm/index.cjs +10 -0
- package/dist/llm/index.d.cts +29 -0
- package/dist/llm/index.d.ts +29 -0
- package/dist/llm/index.js +1 -0
- package/dist/logger/index.cjs +43 -0
- package/dist/logger/index.d.cts +96 -0
- package/dist/logger/index.d.ts +96 -0
- package/dist/logger/index.js +2 -0
- package/dist/logger-B8XXh6ya.d.cts +159 -0
- package/dist/logger-Bpa2oLL4.d.ts +159 -0
- package/dist/mastra/index.cjs +10 -0
- package/dist/mastra/index.d.cts +29 -0
- package/dist/mastra/index.d.ts +29 -0
- package/dist/mastra/index.js +1 -0
- package/dist/mcp/index.cjs +106 -0
- package/dist/mcp/index.d.cts +29 -0
- package/dist/mcp/index.d.ts +29 -0
- package/dist/mcp/index.js +100 -0
- package/dist/memory/index.cjs +18 -0
- package/dist/memory/index.d.cts +29 -0
- package/dist/memory/index.d.ts +29 -0
- package/dist/memory/index.js +1 -0
- package/dist/network/index.cjs +311 -0
- package/dist/network/index.d.cts +29 -0
- package/dist/network/index.d.ts +29 -0
- package/dist/network/index.js +309 -0
- package/dist/network/vNext/index.cjs +873 -0
- package/dist/network/vNext/index.d.cts +29 -0
- package/dist/network/vNext/index.d.ts +29 -0
- package/dist/network/vNext/index.js +871 -0
- package/dist/relevance/index.cjs +18 -0
- package/dist/relevance/index.d.cts +49 -0
- package/dist/relevance/index.d.ts +49 -0
- package/dist/relevance/index.js +1 -0
- package/dist/runtime-context/index.cjs +10 -0
- package/dist/runtime-context/index.d.cts +52 -0
- package/dist/runtime-context/index.d.ts +52 -0
- package/dist/runtime-context/index.js +1 -0
- package/dist/server/index.cjs +62 -0
- package/dist/server/index.d.cts +52 -0
- package/dist/server/index.d.ts +52 -0
- package/dist/server/index.js +59 -0
- package/dist/storage/index.cjs +336 -0
- package/dist/storage/index.d.cts +149 -0
- package/dist/storage/index.d.ts +149 -0
- package/dist/storage/index.js +303 -0
- package/dist/telemetry/index.cjs +30 -0
- package/dist/telemetry/index.d.cts +75 -0
- package/dist/telemetry/index.d.ts +75 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/otel-vendor.cjs +103 -0
- package/dist/telemetry/otel-vendor.d.cts +20 -0
- package/dist/telemetry/otel-vendor.d.ts +20 -0
- package/dist/telemetry/otel-vendor.js +57 -0
- package/dist/tools/index.cjs +18 -0
- package/dist/tools/index.d.cts +41 -0
- package/dist/tools/index.d.ts +41 -0
- package/dist/tools/index.js +1 -0
- package/dist/tts/index.cjs +10 -0
- package/dist/tts/index.d.cts +28 -0
- package/dist/tts/index.d.ts +28 -0
- package/dist/tts/index.js +1 -0
- package/dist/types-Bo1uigWx.d.cts +17 -0
- package/dist/types-Bo1uigWx.d.ts +17 -0
- package/dist/utils.cjs +58 -0
- package/dist/utils.d.cts +149 -0
- package/dist/utils.d.ts +149 -0
- package/dist/utils.js +1 -0
- package/dist/vector/filter/index.cjs +192 -0
- package/dist/vector/filter/index.d.cts +128 -0
- package/dist/vector/filter/index.d.ts +128 -0
- package/dist/vector/filter/index.js +190 -0
- package/dist/vector/index.cjs +10 -0
- package/dist/vector/index.d.cts +77 -0
- package/dist/vector/index.d.ts +77 -0
- package/dist/vector/index.js +1 -0
- package/dist/voice/index.cjs +18 -0
- package/dist/voice/index.d.cts +29 -0
- package/dist/voice/index.d.ts +29 -0
- package/dist/voice/index.js +1 -0
- package/dist/workflows/constants.cjs +10 -0
- package/dist/workflows/constants.d.cts +3 -0
- package/dist/workflows/constants.d.ts +3 -0
- package/dist/workflows/constants.js +1 -0
- package/dist/workflows/index.cjs +42 -0
- package/dist/workflows/index.d.cts +282 -0
- package/dist/workflows/index.d.ts +282 -0
- package/dist/workflows/index.js +1 -0
- package/dist/workflows/legacy/index.cjs +90 -0
- package/dist/workflows/legacy/index.d.cts +91 -0
- package/dist/workflows/legacy/index.d.ts +91 -0
- package/dist/workflows/legacy/index.js +1 -0
- package/error.d.ts +1 -0
- package/eval.d.ts +1 -0
- package/hooks.d.ts +1 -0
- package/integration.d.ts +1 -0
- package/llm.d.ts +1 -0
- package/logger.d.ts +1 -0
- package/mastra.d.ts +1 -0
- package/mcp.d.ts +1 -0
- package/memory.d.ts +1 -0
- package/network/vNext.d.ts +1 -0
- package/network.d.ts +1 -0
- package/package.json +1 -1
- package/relevance.d.ts +1 -0
- package/runtime-context.d.ts +1 -0
- package/server.d.ts +1 -0
- package/storage.d.ts +1 -0
- package/telemetry/otel-vendor.d.ts +1 -0
- package/telemetry.d.ts +1 -0
- package/tools.d.ts +1 -0
- package/tts.d.ts +1 -0
- package/utils.d.ts +1 -0
- package/vector/filter.d.ts +1 -0
- package/vector.d.ts +1 -0
- package/voice.d.ts +1 -0
- package/workflows/_constants.d.ts +1 -0
- package/workflows/legacy.d.ts +1 -0
- package/workflows.d.ts +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/logger/constants.ts
|
|
4
|
+
var RegisteredLogger = {
|
|
5
|
+
AGENT: "AGENT",
|
|
6
|
+
AUTH: "AUTH",
|
|
7
|
+
NETWORK: "NETWORK",
|
|
8
|
+
WORKFLOW: "WORKFLOW",
|
|
9
|
+
LLM: "LLM",
|
|
10
|
+
TTS: "TTS",
|
|
11
|
+
VOICE: "VOICE",
|
|
12
|
+
VECTOR: "VECTOR",
|
|
13
|
+
BUNDLER: "BUNDLER",
|
|
14
|
+
DEPLOYER: "DEPLOYER",
|
|
15
|
+
MEMORY: "MEMORY",
|
|
16
|
+
STORAGE: "STORAGE",
|
|
17
|
+
EMBEDDINGS: "EMBEDDINGS",
|
|
18
|
+
MCP_SERVER: "MCP_SERVER"
|
|
19
|
+
};
|
|
20
|
+
var LogLevel = {
|
|
21
|
+
DEBUG: "debug",
|
|
22
|
+
INFO: "info",
|
|
23
|
+
WARN: "warn",
|
|
24
|
+
ERROR: "error",
|
|
25
|
+
NONE: "silent"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/logger/logger.ts
|
|
29
|
+
var MastraLogger = class {
|
|
30
|
+
name;
|
|
31
|
+
level;
|
|
32
|
+
transports;
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.name = options.name || "Mastra";
|
|
35
|
+
this.level = options.level || LogLevel.ERROR;
|
|
36
|
+
this.transports = new Map(Object.entries(options.transports || {}));
|
|
37
|
+
}
|
|
38
|
+
getTransports() {
|
|
39
|
+
return this.transports;
|
|
40
|
+
}
|
|
41
|
+
trackException(_error) {
|
|
42
|
+
}
|
|
43
|
+
async getLogs(transportId, params) {
|
|
44
|
+
if (!transportId || !this.transports.has(transportId)) {
|
|
45
|
+
return { logs: [], total: 0, page: params?.page ?? 1, perPage: params?.perPage ?? 100, hasMore: false };
|
|
46
|
+
}
|
|
47
|
+
return this.transports.get(transportId).getLogs(params) ?? {
|
|
48
|
+
logs: [],
|
|
49
|
+
total: 0,
|
|
50
|
+
page: params?.page ?? 1,
|
|
51
|
+
perPage: params?.perPage ?? 100,
|
|
52
|
+
hasMore: false
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async getLogsByRunId({
|
|
56
|
+
transportId,
|
|
57
|
+
runId,
|
|
58
|
+
fromDate,
|
|
59
|
+
toDate,
|
|
60
|
+
logLevel,
|
|
61
|
+
filters,
|
|
62
|
+
page,
|
|
63
|
+
perPage
|
|
64
|
+
}) {
|
|
65
|
+
if (!transportId || !this.transports.has(transportId) || !runId) {
|
|
66
|
+
return { logs: [], total: 0, page: page ?? 1, perPage: perPage ?? 100, hasMore: false };
|
|
67
|
+
}
|
|
68
|
+
return this.transports.get(transportId).getLogsByRunId({ runId, fromDate, toDate, logLevel, filters, page, perPage }) ?? {
|
|
69
|
+
logs: [],
|
|
70
|
+
total: 0,
|
|
71
|
+
page: page ?? 1,
|
|
72
|
+
perPage: perPage ?? 100,
|
|
73
|
+
hasMore: false
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/logger/default-logger.ts
|
|
79
|
+
var createLogger = (options) => {
|
|
80
|
+
const logger = new ConsoleLogger(options);
|
|
81
|
+
logger.warn(`createLogger is deprecated. Please use "new ConsoleLogger()" from "@mastra/core/logger" instead.`);
|
|
82
|
+
return logger;
|
|
83
|
+
};
|
|
84
|
+
var ConsoleLogger = class extends MastraLogger {
|
|
85
|
+
constructor(options = {}) {
|
|
86
|
+
super(options);
|
|
87
|
+
}
|
|
88
|
+
debug(message, ...args) {
|
|
89
|
+
if (this.level === LogLevel.DEBUG) {
|
|
90
|
+
console.debug(message, ...args);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
info(message, ...args) {
|
|
94
|
+
if (this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) {
|
|
95
|
+
console.info(message, ...args);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
warn(message, ...args) {
|
|
99
|
+
if (this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) {
|
|
100
|
+
console.warn(message, ...args);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
error(message, ...args) {
|
|
104
|
+
if (this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) {
|
|
105
|
+
console.error(message, ...args);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async getLogs(_transportId, _params) {
|
|
109
|
+
return { logs: [], total: 0, page: _params?.page ?? 1, perPage: _params?.perPage ?? 100, hasMore: false };
|
|
110
|
+
}
|
|
111
|
+
async getLogsByRunId(_args) {
|
|
112
|
+
return { logs: [], total: 0, page: _args.page ?? 1, perPage: _args.perPage ?? 100, hasMore: false };
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
117
|
+
exports.LogLevel = LogLevel;
|
|
118
|
+
exports.MastraLogger = MastraLogger;
|
|
119
|
+
exports.RegisteredLogger = RegisteredLogger;
|
|
120
|
+
exports.createLogger = createLogger;
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQQ5K5TZE_cjs = require('./chunk-QQ5K5TZE.cjs');
|
|
4
|
+
var chunkB6TOBUS6_cjs = require('./chunk-B6TOBUS6.cjs');
|
|
5
|
+
var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
|
|
6
|
+
var chunkU64IJDC5_cjs = require('./chunk-U64IJDC5.cjs');
|
|
7
|
+
|
|
8
|
+
// src/voice/voice.ts
|
|
9
|
+
var _MastraVoice_decorators, _init, _a;
|
|
10
|
+
_MastraVoice_decorators = [chunkQQ5K5TZE_cjs.InstrumentClass({
|
|
11
|
+
prefix: "voice",
|
|
12
|
+
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
13
|
+
})];
|
|
14
|
+
exports.MastraVoice = class MastraVoice extends (_a = chunkP3Q73CAW_cjs.MastraBase) {
|
|
15
|
+
listeningModel;
|
|
16
|
+
speechModel;
|
|
17
|
+
speaker;
|
|
18
|
+
realtimeConfig;
|
|
19
|
+
constructor({
|
|
20
|
+
listeningModel,
|
|
21
|
+
speechModel,
|
|
22
|
+
speaker,
|
|
23
|
+
realtimeConfig,
|
|
24
|
+
name
|
|
25
|
+
} = {}) {
|
|
26
|
+
super({
|
|
27
|
+
component: "VOICE",
|
|
28
|
+
name
|
|
29
|
+
});
|
|
30
|
+
this.listeningModel = listeningModel;
|
|
31
|
+
this.speechModel = speechModel;
|
|
32
|
+
this.speaker = speaker;
|
|
33
|
+
this.realtimeConfig = realtimeConfig;
|
|
34
|
+
}
|
|
35
|
+
traced(method, methodName) {
|
|
36
|
+
return this.telemetry?.traceMethod(method, {
|
|
37
|
+
spanName: `voice.${methodName}`,
|
|
38
|
+
attributes: {
|
|
39
|
+
"voice.type": this.speechModel?.name || this.listeningModel?.name || "unknown"
|
|
40
|
+
}
|
|
41
|
+
}) ?? method;
|
|
42
|
+
}
|
|
43
|
+
updateConfig(_options) {
|
|
44
|
+
this.logger.warn("updateConfig not implemented by this voice provider");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
48
|
+
* @returns Promise that resolves when the connection is established
|
|
49
|
+
*/
|
|
50
|
+
connect(_options) {
|
|
51
|
+
this.logger.warn("connect not implemented by this voice provider");
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Relay audio data to the voice provider for real-time processing
|
|
56
|
+
* @param audioData Audio data to relay
|
|
57
|
+
*/
|
|
58
|
+
send(_audioData) {
|
|
59
|
+
this.logger.warn("relay not implemented by this voice provider");
|
|
60
|
+
return Promise.resolve();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Trigger voice providers to respond
|
|
64
|
+
*/
|
|
65
|
+
answer(_options) {
|
|
66
|
+
this.logger.warn("answer not implemented by this voice provider");
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Equip the voice provider with instructions
|
|
71
|
+
* @param instructions Instructions to add
|
|
72
|
+
*/
|
|
73
|
+
addInstructions(_instructions) {}
|
|
74
|
+
/**
|
|
75
|
+
* Equip the voice provider with tools
|
|
76
|
+
* @param tools Array of tools to add
|
|
77
|
+
*/
|
|
78
|
+
addTools(_tools) {}
|
|
79
|
+
/**
|
|
80
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
81
|
+
*/
|
|
82
|
+
close() {
|
|
83
|
+
this.logger.warn("close not implemented by this voice provider");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Register an event listener
|
|
87
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
88
|
+
* @param callback Callback function that receives event data
|
|
89
|
+
*/
|
|
90
|
+
on(_event, _callback) {
|
|
91
|
+
this.logger.warn("on not implemented by this voice provider");
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Remove an event listener
|
|
95
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
96
|
+
* @param callback Callback function to remove
|
|
97
|
+
*/
|
|
98
|
+
off(_event, _callback) {
|
|
99
|
+
this.logger.warn("off not implemented by this voice provider");
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get available speakers/voices
|
|
103
|
+
* @returns Array of available voice IDs and their metadata
|
|
104
|
+
*/
|
|
105
|
+
getSpeakers() {
|
|
106
|
+
this.logger.warn("getSpeakers not implemented by this voice provider");
|
|
107
|
+
return Promise.resolve([]);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get available speakers/voices
|
|
111
|
+
* @returns Array of available voice IDs and their metadata
|
|
112
|
+
*/
|
|
113
|
+
getListener() {
|
|
114
|
+
this.logger.warn("getListener not implemented by this voice provider");
|
|
115
|
+
return Promise.resolve({
|
|
116
|
+
enabled: false
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
exports.MastraVoice = /*@__PURE__*/(_ => {
|
|
121
|
+
_init = chunkU64IJDC5_cjs.__decoratorStart(_a);
|
|
122
|
+
exports.MastraVoice = chunkU64IJDC5_cjs.__decorateElement(_init, 0, "MastraVoice", _MastraVoice_decorators, exports.MastraVoice);
|
|
123
|
+
chunkU64IJDC5_cjs.__runInitializers(_init, 1, exports.MastraVoice);
|
|
124
|
+
|
|
125
|
+
// src/voice/composite-voice.ts
|
|
126
|
+
return exports.MastraVoice;
|
|
127
|
+
})();
|
|
128
|
+
// src/voice/composite-voice.ts
|
|
129
|
+
var CompositeVoice = class extends exports.MastraVoice {
|
|
130
|
+
speakProvider;
|
|
131
|
+
listenProvider;
|
|
132
|
+
realtimeProvider;
|
|
133
|
+
constructor({
|
|
134
|
+
input,
|
|
135
|
+
output,
|
|
136
|
+
realtime,
|
|
137
|
+
speakProvider,
|
|
138
|
+
listenProvider,
|
|
139
|
+
realtimeProvider
|
|
140
|
+
}) {
|
|
141
|
+
super();
|
|
142
|
+
this.speakProvider = output || speakProvider;
|
|
143
|
+
this.listenProvider = input || listenProvider;
|
|
144
|
+
this.realtimeProvider = realtime || realtimeProvider;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Convert text to speech using the configured provider
|
|
148
|
+
* @param input Text or text stream to convert to speech
|
|
149
|
+
* @param options Speech options including speaker and provider-specific options
|
|
150
|
+
* @returns Audio stream or void if in realtime mode
|
|
151
|
+
*/
|
|
152
|
+
async speak(input, options) {
|
|
153
|
+
if (this.realtimeProvider) {
|
|
154
|
+
return this.realtimeProvider.speak(input, options);
|
|
155
|
+
} else if (this.speakProvider) {
|
|
156
|
+
return this.speakProvider.speak(input, options);
|
|
157
|
+
}
|
|
158
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
159
|
+
id: "VOICE_COMPOSITE_NO_SPEAK_PROVIDER",
|
|
160
|
+
text: "No speak provider or realtime provider configured",
|
|
161
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
162
|
+
category: "USER" /* USER */
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async listen(audioStream, options) {
|
|
166
|
+
if (this.realtimeProvider) {
|
|
167
|
+
return await this.realtimeProvider.listen(audioStream, options);
|
|
168
|
+
} else if (this.listenProvider) {
|
|
169
|
+
return await this.listenProvider.listen(audioStream, options);
|
|
170
|
+
}
|
|
171
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
172
|
+
id: "VOICE_COMPOSITE_NO_LISTEN_PROVIDER",
|
|
173
|
+
text: "No listen provider or realtime provider configured",
|
|
174
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
175
|
+
category: "USER" /* USER */
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
async getSpeakers() {
|
|
179
|
+
if (this.realtimeProvider) {
|
|
180
|
+
return this.realtimeProvider.getSpeakers();
|
|
181
|
+
} else if (this.speakProvider) {
|
|
182
|
+
return this.speakProvider.getSpeakers();
|
|
183
|
+
}
|
|
184
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
185
|
+
id: "VOICE_COMPOSITE_NO_SPEAKERS_PROVIDER",
|
|
186
|
+
text: "No speak provider or realtime provider configured",
|
|
187
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
188
|
+
category: "USER" /* USER */
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async getListener() {
|
|
192
|
+
if (this.realtimeProvider) {
|
|
193
|
+
return this.realtimeProvider.getListener();
|
|
194
|
+
} else if (this.listenProvider) {
|
|
195
|
+
return this.listenProvider.getListener();
|
|
196
|
+
}
|
|
197
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
198
|
+
id: "VOICE_COMPOSITE_NO_LISTENER_PROVIDER",
|
|
199
|
+
text: "No listener provider or realtime provider configured",
|
|
200
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
201
|
+
category: "USER" /* USER */
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
updateConfig(options) {
|
|
205
|
+
if (!this.realtimeProvider) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
this.realtimeProvider.updateConfig(options);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
212
|
+
* @returns Promise that resolves when the connection is established
|
|
213
|
+
*/
|
|
214
|
+
connect(options) {
|
|
215
|
+
if (!this.realtimeProvider) {
|
|
216
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
217
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_CONNECT",
|
|
218
|
+
text: "No realtime provider configured",
|
|
219
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
220
|
+
category: "USER" /* USER */
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return this.realtimeProvider.connect(options);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Relay audio data to the voice provider for real-time processing
|
|
227
|
+
* @param audioData Audio data to send
|
|
228
|
+
*/
|
|
229
|
+
send(audioData) {
|
|
230
|
+
if (!this.realtimeProvider) {
|
|
231
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
232
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_SEND",
|
|
233
|
+
text: "No realtime provider configured",
|
|
234
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
235
|
+
category: "USER" /* USER */
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return this.realtimeProvider.send(audioData);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Trigger voice providers to respond
|
|
242
|
+
*/
|
|
243
|
+
answer(options) {
|
|
244
|
+
if (!this.realtimeProvider) {
|
|
245
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
246
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_ANSWER",
|
|
247
|
+
text: "No realtime provider configured",
|
|
248
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
249
|
+
category: "USER" /* USER */
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return this.realtimeProvider.answer(options);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Equip the voice provider with instructions
|
|
256
|
+
* @param instructions Instructions to add
|
|
257
|
+
*/
|
|
258
|
+
addInstructions(instructions) {
|
|
259
|
+
if (!this.realtimeProvider) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.realtimeProvider.addInstructions(instructions);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Equip the voice provider with tools
|
|
266
|
+
* @param tools Array of tools to add
|
|
267
|
+
*/
|
|
268
|
+
addTools(tools) {
|
|
269
|
+
if (!this.realtimeProvider) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
this.realtimeProvider.addTools(tools);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
276
|
+
*/
|
|
277
|
+
close() {
|
|
278
|
+
if (!this.realtimeProvider) {
|
|
279
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
280
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_CLOSE",
|
|
281
|
+
text: "No realtime provider configured",
|
|
282
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
283
|
+
category: "USER" /* USER */
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
this.realtimeProvider.close();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Register an event listener
|
|
290
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
291
|
+
* @param callback Callback function that receives event data
|
|
292
|
+
*/
|
|
293
|
+
on(event, callback) {
|
|
294
|
+
if (!this.realtimeProvider) {
|
|
295
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
296
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_ON",
|
|
297
|
+
text: "No realtime provider configured",
|
|
298
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
299
|
+
category: "USER" /* USER */
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
this.realtimeProvider.on(event, callback);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Remove an event listener
|
|
306
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
307
|
+
* @param callback Callback function to remove
|
|
308
|
+
*/
|
|
309
|
+
off(event, callback) {
|
|
310
|
+
if (!this.realtimeProvider) {
|
|
311
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
312
|
+
id: "VOICE_COMPOSITE_NO_REALTIME_PROVIDER_OFF",
|
|
313
|
+
text: "No realtime provider configured",
|
|
314
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
315
|
+
category: "USER" /* USER */
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
this.realtimeProvider.off(event, callback);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/voice/default-voice.ts
|
|
323
|
+
var DefaultVoice = class extends exports.MastraVoice {
|
|
324
|
+
constructor() {
|
|
325
|
+
super();
|
|
326
|
+
}
|
|
327
|
+
async speak(_input) {
|
|
328
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
329
|
+
id: "VOICE_DEFAULT_NO_SPEAK_PROVIDER",
|
|
330
|
+
text: "No voice provider configured",
|
|
331
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
332
|
+
category: "USER" /* USER */
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
async listen(_input) {
|
|
336
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
337
|
+
id: "VOICE_DEFAULT_NO_LISTEN_PROVIDER",
|
|
338
|
+
text: "No voice provider configured",
|
|
339
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
340
|
+
category: "USER" /* USER */
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
async getSpeakers() {
|
|
344
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
345
|
+
id: "VOICE_DEFAULT_NO_SPEAKERS_PROVIDER",
|
|
346
|
+
text: "No voice provider configured",
|
|
347
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
348
|
+
category: "USER" /* USER */
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
async getListener() {
|
|
352
|
+
throw new chunkB6TOBUS6_cjs.MastraError({
|
|
353
|
+
id: "VOICE_DEFAULT_NO_LISTENER_PROVIDER",
|
|
354
|
+
text: "No voice provider configured",
|
|
355
|
+
domain: "MASTRA_VOICE" /* MASTRA_VOICE */,
|
|
356
|
+
category: "USER" /* USER */
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
exports.CompositeVoice = CompositeVoice;
|
|
362
|
+
exports.DefaultVoice = DefaultVoice;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkFEYYOBBG_cjs = require('./chunk-FEYYOBBG.cjs');
|
|
4
|
+
|
|
5
|
+
// src/deployer/index.ts
|
|
6
|
+
var MastraDeployer = class extends chunkFEYYOBBG_cjs.MastraBundler {
|
|
7
|
+
constructor({ name }) {
|
|
8
|
+
super({ component: "DEPLOYER", name });
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.MastraDeployer = MastraDeployer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MastraBundler, IBundler } from '../bundler/index.cjs';
|
|
2
|
+
import '../base-B_y9sMg0.cjs';
|
|
3
|
+
import '@opentelemetry/api';
|
|
4
|
+
import '../logger-B8XXh6ya.cjs';
|
|
5
|
+
import '../error/index.cjs';
|
|
6
|
+
import 'stream';
|
|
7
|
+
import '@opentelemetry/sdk-trace-base';
|
|
8
|
+
|
|
9
|
+
interface IDeployer extends IBundler {
|
|
10
|
+
deploy(outputDirectory: string): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
declare abstract class MastraDeployer extends MastraBundler implements IDeployer {
|
|
13
|
+
constructor({ name }: {
|
|
14
|
+
name: string;
|
|
15
|
+
});
|
|
16
|
+
abstract deploy(outputDirectory: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { type IDeployer, MastraDeployer };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MastraBundler, IBundler } from '../bundler/index.js';
|
|
2
|
+
import '../base-ClrXcCRx.js';
|
|
3
|
+
import '@opentelemetry/api';
|
|
4
|
+
import '../logger-Bpa2oLL4.js';
|
|
5
|
+
import '../error/index.js';
|
|
6
|
+
import 'stream';
|
|
7
|
+
import '@opentelemetry/sdk-trace-base';
|
|
8
|
+
|
|
9
|
+
interface IDeployer extends IBundler {
|
|
10
|
+
deploy(outputDirectory: string): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
declare abstract class MastraDeployer extends MastraBundler implements IDeployer {
|
|
13
|
+
constructor({ name }: {
|
|
14
|
+
name: string;
|
|
15
|
+
});
|
|
16
|
+
abstract deploy(outputDirectory: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { type IDeployer, MastraDeployer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MastraDeployer } from '../chunk-JNMQKJH4.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RuntimeContext } from '../runtime-context/index.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RuntimeContext } from '../runtime-context/index.js';
|
package/dist/di/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RuntimeContext } from '../chunk-SGGPJWRQ.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkB6TOBUS6_cjs = require('../chunk-B6TOBUS6.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "ErrorCategory", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkB6TOBUS6_cjs.ErrorCategory; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "ErrorDomain", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkB6TOBUS6_cjs.ErrorDomain; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "MastraBaseError", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkB6TOBUS6_cjs.MastraBaseError; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "MastraError", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkB6TOBUS6_cjs.MastraError; }
|
|
22
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
declare enum ErrorDomain {
|
|
2
|
+
TOOL = "TOOL",
|
|
3
|
+
AGENT = "AGENT",
|
|
4
|
+
MCP = "MCP",
|
|
5
|
+
AGENT_NETWORK = "AGENT_NETWORK",
|
|
6
|
+
MASTRA_SERVER = "MASTRA_SERVER",
|
|
7
|
+
MASTRA_TELEMETRY = "MASTRA_TELEMETRY",
|
|
8
|
+
MASTRA_WORKFLOW = "MASTRA_WORKFLOW",
|
|
9
|
+
MASTRA_VOICE = "MASTRA_VOICE",
|
|
10
|
+
MASTRA_VECTOR = "MASTRA_VECTOR",
|
|
11
|
+
LLM = "LLM",
|
|
12
|
+
EVAL = "EVAL",
|
|
13
|
+
A2A = "A2A",
|
|
14
|
+
MASTRA_INSTANCE = "MASTRA_INSTANCE",
|
|
15
|
+
MASTRA = "MASTRA",
|
|
16
|
+
DEPLOYER = "DEPLOYER",
|
|
17
|
+
STORAGE = "STORAGE"
|
|
18
|
+
}
|
|
19
|
+
declare enum ErrorCategory {
|
|
20
|
+
UNKNOWN = "UNKNOWN",
|
|
21
|
+
USER = "USER",
|
|
22
|
+
SYSTEM = "SYSTEM",
|
|
23
|
+
THIRD_PARTY = "THIRD_PARTY"
|
|
24
|
+
}
|
|
25
|
+
type Scalar = null | boolean | number | string;
|
|
26
|
+
type Json<T> = [T] extends [Scalar | undefined] ? Scalar : [T] extends [{
|
|
27
|
+
[x: number]: unknown;
|
|
28
|
+
}] ? {
|
|
29
|
+
[K in keyof T]: Json<T[K]>;
|
|
30
|
+
} : never;
|
|
31
|
+
/**
|
|
32
|
+
* Defines the structure for an error's metadata.
|
|
33
|
+
* This is used to create instances of MastraError.
|
|
34
|
+
*/
|
|
35
|
+
interface IErrorDefinition<D, C> {
|
|
36
|
+
/** Unique identifier for the error. */
|
|
37
|
+
id: Uppercase<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Optional custom error message that overrides the original error message.
|
|
40
|
+
* If not provided, the original error message will be used, or 'Unknown error' if no error is provided.
|
|
41
|
+
*/
|
|
42
|
+
text?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Functional domain of the error (e.g., CONFIG, BUILD, API).
|
|
45
|
+
*/
|
|
46
|
+
domain: D;
|
|
47
|
+
/** Broad category of the error (e.g., USER, SYSTEM, THIRD_PARTY). */
|
|
48
|
+
category: C;
|
|
49
|
+
details?: Record<string, Json<Scalar>>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Base error class for the Mastra ecosystem.
|
|
53
|
+
* It standardizes error reporting and can be extended for more specific error types.
|
|
54
|
+
*/
|
|
55
|
+
declare class MastraBaseError<D, C> extends Error {
|
|
56
|
+
readonly id: Uppercase<string>;
|
|
57
|
+
readonly domain: D;
|
|
58
|
+
readonly category: C;
|
|
59
|
+
readonly details?: Record<string, Json<Scalar>>;
|
|
60
|
+
readonly message: string;
|
|
61
|
+
constructor(errorDefinition: IErrorDefinition<D, C>, originalError?: string | Error | MastraBaseError<D, C> | unknown);
|
|
62
|
+
/**
|
|
63
|
+
* Returns a structured representation of the error, useful for logging or API responses.
|
|
64
|
+
*/
|
|
65
|
+
toJSONDetails(): {
|
|
66
|
+
message: string;
|
|
67
|
+
domain: D;
|
|
68
|
+
category: C;
|
|
69
|
+
details: Record<string, Scalar> | undefined;
|
|
70
|
+
};
|
|
71
|
+
toJSON(): {
|
|
72
|
+
message: string;
|
|
73
|
+
details: {
|
|
74
|
+
message: string;
|
|
75
|
+
domain: D;
|
|
76
|
+
category: C;
|
|
77
|
+
details: Record<string, Scalar> | undefined;
|
|
78
|
+
};
|
|
79
|
+
code: Uppercase<string>;
|
|
80
|
+
};
|
|
81
|
+
toString(): string;
|
|
82
|
+
}
|
|
83
|
+
declare class MastraError extends MastraBaseError<`${ErrorDomain}`, `${ErrorCategory}`> {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { ErrorCategory, ErrorDomain, type IErrorDefinition, MastraBaseError, MastraError };
|