@mastra/core 0.7.0 → 0.8.0-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/README.md +76 -74
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +5 -3
- package/dist/agent/index.d.ts +5 -3
- package/dist/agent/index.js +1 -1
- package/dist/{base-Cmunaaxb.d.ts → base-BA_in99t.d.ts} +4 -1
- package/dist/{base-Cyl73WbV.d.ts → base-CQuRWXAH.d.ts} +985 -913
- package/dist/{base-ObPJ-w8K.d.cts → base-CvQbEqGB.d.cts} +4 -1
- package/dist/{base-C0wILuA9.d.cts → base-Dpt4tO56.d.cts} +985 -913
- package/dist/base.cjs +2 -2
- package/dist/base.d.cts +1 -1
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.d.cts +1 -1
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-L7CR75HA.js → chunk-2BVZNKLX.js} +1 -1
- package/dist/{chunk-V5ORZPFW.cjs → chunk-3C6V2FEP.cjs} +1 -1
- package/dist/chunk-3HE5CJBG.cjs +4604 -0
- package/dist/{chunk-PNZK456O.js → chunk-4RMSGSQN.js} +4 -4
- package/dist/{chunk-WESJ2ZY7.cjs → chunk-57LXIDIK.cjs} +2 -2
- package/dist/chunk-5RRJEWMA.cjs +107 -0
- package/dist/{chunk-3CNO7YB5.js → chunk-5TFGORLG.js} +1 -1
- package/dist/{chunk-5FAJ6HUC.cjs → chunk-64VPB7ZD.cjs} +23 -2
- package/dist/chunk-6XLV4KSD.js +100 -0
- package/dist/{chunk-XLSROQ26.cjs → chunk-7I7AKQH3.cjs} +5 -5
- package/dist/{chunk-RUA6BSB6.cjs → chunk-7JBINHJX.cjs} +2 -2
- package/dist/chunk-A6MBM56X.js +268 -0
- package/dist/{chunk-2YF5JYTJ.js → chunk-BC5B4EGI.js} +21 -2
- package/dist/chunk-BF7ZLRGO.cjs +271 -0
- package/dist/{chunk-SMBKF6K5.js → chunk-BRBHQ6KS.js} +10 -1
- package/dist/{chunk-VN4M67DA.js → chunk-CLJQYXNM.js} +1 -1
- package/dist/{chunk-PL7PVTGF.cjs → chunk-D63P5O4Q.cjs} +4 -4
- package/dist/chunk-DCGLGWHI.cjs +141 -0
- package/dist/{chunk-YXJQFZOW.cjs → chunk-DL4QPJKI.cjs} +24 -10
- package/dist/{chunk-ZABXT2MN.js → chunk-FY57LEMC.js} +1 -1
- package/dist/{chunk-XLXJUYKH.js → chunk-GHK3HBWN.js} +1 -1
- package/dist/{chunk-ONDCHP6G.cjs → chunk-GO2D7FEK.cjs} +2 -2
- package/dist/{chunk-7VTZI3YN.js → chunk-H6ZU5N2C.js} +1 -1
- package/dist/{chunk-WBE5RTFI.js → chunk-HAWAUEWK.js} +2 -2
- package/dist/chunk-HCDXBSMK.js +4577 -0
- package/dist/{chunk-RU7CSPAV.js → chunk-JGJMVCJ4.js} +7 -84
- package/dist/{chunk-W5HVJX45.js → chunk-N5ZYOQBL.js} +46 -5
- package/dist/{chunk-NPOKIPWC.cjs → chunk-O7IW545H.cjs} +1 -1
- package/dist/{chunk-XB2TJ7LX.cjs → chunk-PHWEC4VD.cjs} +47 -6
- package/dist/{chunk-NUDAZEOG.js → chunk-PK5QRKSG.js} +1 -1
- package/dist/{chunk-43SD5CUE.js → chunk-QDHRRKQ5.js} +63 -9
- package/dist/{chunk-ZBKJDQPM.js → chunk-RBWBJC6D.js} +17 -3
- package/dist/{chunk-4PYORXWM.cjs → chunk-RXDLSCBA.cjs} +4 -4
- package/dist/{chunk-IQLRSKED.cjs → chunk-RZCYBC7D.cjs} +2 -2
- package/dist/{chunk-ASFUEC75.cjs → chunk-TNNHN4ZY.cjs} +67 -12
- package/dist/{chunk-QM6WIIPM.js → chunk-UF4LZV3D.js} +1 -1
- package/dist/{chunk-JJ4YQTFT.cjs → chunk-WAW7QBY4.cjs} +2 -2
- package/dist/{chunk-U7ONOIBO.cjs → chunk-YZDUZFVZ.cjs} +11 -2
- package/dist/deployer/index.cjs +2 -2
- package/dist/deployer/index.d.cts +1 -1
- package/dist/deployer/index.d.ts +1 -1
- package/dist/deployer/index.js +1 -1
- package/dist/eval/index.cjs +3 -3
- package/dist/eval/index.d.cts +8 -5
- package/dist/eval/index.d.ts +8 -5
- package/dist/eval/index.js +1 -1
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index.cjs +102 -92
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +18 -19
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +5 -3
- package/dist/integration/index.d.ts +5 -3
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +5 -3
- package/dist/llm/index.d.ts +5 -3
- package/dist/logger/index.cjs +9 -9
- package/dist/logger/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.cts +5 -3
- package/dist/mastra/index.d.ts +5 -3
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +6 -2
- package/dist/memory/index.d.cts +5 -3
- package/dist/memory/index.d.ts +5 -3
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +8 -8
- package/dist/network/index.d.cts +5 -3
- package/dist/network/index.d.ts +5 -3
- package/dist/network/index.js +4 -4
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +10 -8
- package/dist/relevance/index.d.ts +10 -8
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.cjs +17 -0
- package/dist/server/index.d.cts +37 -0
- package/dist/server/index.d.ts +37 -0
- package/dist/server/index.js +15 -0
- package/dist/storage/index.cjs +12 -8
- package/dist/storage/index.d.cts +5 -3
- package/dist/storage/index.d.ts +5 -3
- package/dist/storage/index.js +2 -2
- package/dist/storage/libsql/index.cjs +24 -24
- package/dist/storage/libsql/index.d.cts +5 -3
- package/dist/storage/libsql/index.d.ts +5 -3
- package/dist/storage/libsql/index.js +12 -12
- package/dist/telemetry/index.cjs +6 -6
- package/dist/telemetry/index.d.cts +5 -3
- package/dist/telemetry/index.d.ts +5 -3
- package/dist/telemetry/index.js +1 -1
- package/dist/tools/index.cjs +7 -3
- package/dist/tools/index.d.cts +6 -3
- package/dist/tools/index.d.ts +6 -3
- package/dist/tools/index.js +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.d.cts +1 -1
- package/dist/tts/index.d.ts +1 -1
- package/dist/tts/index.js +1 -1
- package/dist/{types-CwTG2XyQ.d.cts → types-BtMyV38I.d.cts} +4 -1
- package/dist/{types-CwTG2XyQ.d.ts → types-BtMyV38I.d.ts} +4 -1
- package/dist/utils.cjs +13 -13
- package/dist/utils.d.cts +7 -5
- package/dist/utils.d.ts +7 -5
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/vector/libsql/index.cjs +3 -3
- package/dist/vector/libsql/index.d.cts +1 -1
- package/dist/vector/libsql/index.d.ts +1 -1
- package/dist/vector/libsql/index.js +1 -1
- package/dist/voice/index.cjs +13 -249
- package/dist/voice/index.d.cts +22 -8
- package/dist/voice/index.d.ts +22 -8
- package/dist/voice/index.js +1 -252
- package/dist/workflows/index.cjs +28 -20
- package/dist/workflows/index.d.cts +18 -7
- package/dist/workflows/index.d.ts +18 -7
- package/dist/workflows/index.js +1 -1
- package/package.json +5 -3
- package/dist/chunk-2W2GYEYQ.cjs +0 -25
- package/dist/chunk-C6BBAS4I.cjs +0 -1715
- package/dist/chunk-F5UYWPV4.cjs +0 -14
- package/dist/chunk-GG6TEAMJ.cjs +0 -2289
- package/dist/chunk-R2M5CZ5U.js +0 -2264
- package/dist/chunk-RG66XEJT.js +0 -8
- package/dist/chunk-VNQRLYIA.js +0 -1715
- package/dist/chunk-WVVKLIUW.cjs +0 -218
- package/dist/chunk-ZINPRHAN.js +0 -22
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTool } from './chunk-
|
|
1
|
+
import { createTool } from './chunk-BC5B4EGI.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
// src/integration/integration.ts
|
|
@@ -60,7 +60,7 @@ var OpenAPIToolset = class {
|
|
|
60
60
|
throw new Error("API not implemented");
|
|
61
61
|
}
|
|
62
62
|
_generateIntegrationTools() {
|
|
63
|
-
const { client, ...clientMethods } = this.baseClient;
|
|
63
|
+
const { client: _client, ...clientMethods } = this.baseClient;
|
|
64
64
|
const schemas = this.toolSchemas;
|
|
65
65
|
const documentations = this.toolDocumentations;
|
|
66
66
|
const tools = Object.keys(clientMethods).reduce((acc, key) => {
|
|
@@ -72,8 +72,8 @@ var OpenAPIToolset = class {
|
|
|
72
72
|
description: comment || fallbackComment,
|
|
73
73
|
// documentation: doc || fallbackComment,
|
|
74
74
|
execute: async ({ context }) => {
|
|
75
|
-
const
|
|
76
|
-
const value =
|
|
75
|
+
const client = await this.getApiClient();
|
|
76
|
+
const value = client[key];
|
|
77
77
|
return value({
|
|
78
78
|
...context
|
|
79
79
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3HE5CJBG_cjs = require('./chunk-3HE5CJBG.cjs');
|
|
4
4
|
var cohereAi = require('cohere-ai');
|
|
5
5
|
|
|
6
6
|
var CohereRelevanceScorer = class {
|
|
@@ -38,7 +38,7 @@ Relevance score (0-1):`;
|
|
|
38
38
|
var MastraAgentRelevanceScorer = class {
|
|
39
39
|
agent;
|
|
40
40
|
constructor(name, model) {
|
|
41
|
-
this.agent = new
|
|
41
|
+
this.agent = new chunk3HE5CJBG_cjs.Agent({
|
|
42
42
|
name: `Relevance Scorer ${name}`,
|
|
43
43
|
instructions: `You are a specialized agent for evaluating the relevance of text to queries.
|
|
44
44
|
Your task is to rate how well a text passage answers a given query.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/storage/constants.ts
|
|
4
|
+
var TABLE_WORKFLOW_SNAPSHOT = "mastra_workflow_snapshot";
|
|
5
|
+
var TABLE_EVALS = "mastra_evals";
|
|
6
|
+
var TABLE_MESSAGES = "mastra_messages";
|
|
7
|
+
var TABLE_THREADS = "mastra_threads";
|
|
8
|
+
var TABLE_TRACES = "mastra_traces";
|
|
9
|
+
var TABLE_SCHEMAS = {
|
|
10
|
+
[TABLE_WORKFLOW_SNAPSHOT]: {
|
|
11
|
+
workflow_name: {
|
|
12
|
+
type: "text"
|
|
13
|
+
},
|
|
14
|
+
run_id: {
|
|
15
|
+
type: "text"
|
|
16
|
+
},
|
|
17
|
+
snapshot: {
|
|
18
|
+
type: "text"
|
|
19
|
+
},
|
|
20
|
+
createdAt: {
|
|
21
|
+
type: "timestamp"
|
|
22
|
+
},
|
|
23
|
+
updatedAt: {
|
|
24
|
+
type: "timestamp"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[TABLE_EVALS]: {
|
|
28
|
+
id: {
|
|
29
|
+
type: "text",
|
|
30
|
+
nullable: false,
|
|
31
|
+
primaryKey: true
|
|
32
|
+
},
|
|
33
|
+
input: {
|
|
34
|
+
type: "text"
|
|
35
|
+
},
|
|
36
|
+
output: {
|
|
37
|
+
type: "text"
|
|
38
|
+
},
|
|
39
|
+
result: {
|
|
40
|
+
type: "jsonb"
|
|
41
|
+
},
|
|
42
|
+
agent_name: {
|
|
43
|
+
type: "text"
|
|
44
|
+
},
|
|
45
|
+
metric_name: {
|
|
46
|
+
type: "text"
|
|
47
|
+
},
|
|
48
|
+
instructions: {
|
|
49
|
+
type: "text"
|
|
50
|
+
},
|
|
51
|
+
test_info: {
|
|
52
|
+
type: "jsonb",
|
|
53
|
+
nullable: true
|
|
54
|
+
},
|
|
55
|
+
global_run_id: {
|
|
56
|
+
type: "text"
|
|
57
|
+
},
|
|
58
|
+
run_id: {
|
|
59
|
+
type: "text"
|
|
60
|
+
},
|
|
61
|
+
created_at: {
|
|
62
|
+
type: "timestamp"
|
|
63
|
+
},
|
|
64
|
+
createdAt: {
|
|
65
|
+
type: "timestamp"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[TABLE_THREADS]: {
|
|
69
|
+
id: { type: "text", nullable: false, primaryKey: true },
|
|
70
|
+
resourceId: { type: "text", nullable: false },
|
|
71
|
+
title: { type: "text", nullable: false },
|
|
72
|
+
metadata: { type: "text", nullable: true },
|
|
73
|
+
createdAt: { type: "timestamp", nullable: false },
|
|
74
|
+
updatedAt: { type: "timestamp", nullable: false }
|
|
75
|
+
},
|
|
76
|
+
[TABLE_MESSAGES]: {
|
|
77
|
+
id: { type: "text", nullable: false, primaryKey: true },
|
|
78
|
+
thread_id: { type: "text", nullable: false },
|
|
79
|
+
content: { type: "text", nullable: false },
|
|
80
|
+
role: { type: "text", nullable: false },
|
|
81
|
+
type: { type: "text", nullable: false },
|
|
82
|
+
createdAt: { type: "timestamp", nullable: false }
|
|
83
|
+
},
|
|
84
|
+
[TABLE_TRACES]: {
|
|
85
|
+
id: { type: "text", nullable: false, primaryKey: true },
|
|
86
|
+
parentSpanId: { type: "text", nullable: true },
|
|
87
|
+
name: { type: "text", nullable: false },
|
|
88
|
+
traceId: { type: "text", nullable: false },
|
|
89
|
+
scope: { type: "text", nullable: false },
|
|
90
|
+
kind: { type: "integer", nullable: false },
|
|
91
|
+
attributes: { type: "jsonb", nullable: true },
|
|
92
|
+
status: { type: "jsonb", nullable: true },
|
|
93
|
+
events: { type: "jsonb", nullable: true },
|
|
94
|
+
links: { type: "jsonb", nullable: true },
|
|
95
|
+
other: { type: "text", nullable: true },
|
|
96
|
+
startTime: { type: "bigint", nullable: false },
|
|
97
|
+
endTime: { type: "bigint", nullable: false },
|
|
98
|
+
createdAt: { type: "timestamp", nullable: false }
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.TABLE_EVALS = TABLE_EVALS;
|
|
103
|
+
exports.TABLE_MESSAGES = TABLE_MESSAGES;
|
|
104
|
+
exports.TABLE_SCHEMAS = TABLE_SCHEMAS;
|
|
105
|
+
exports.TABLE_THREADS = TABLE_THREADS;
|
|
106
|
+
exports.TABLE_TRACES = TABLE_TRACES;
|
|
107
|
+
exports.TABLE_WORKFLOW_SNAPSHOT = TABLE_WORKFLOW_SNAPSHOT;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunk2W2GYEYQ_cjs = require('./chunk-2W2GYEYQ.cjs');
|
|
4
3
|
var crypto = require('crypto');
|
|
5
4
|
var ai = require('ai');
|
|
6
5
|
var jsonSchemaToZod = require('json-schema-to-zod');
|
|
@@ -10,6 +9,26 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
9
|
|
|
11
10
|
var jsonSchemaToZod__default = /*#__PURE__*/_interopDefault(jsonSchemaToZod);
|
|
12
11
|
|
|
12
|
+
// src/tools/tool.ts
|
|
13
|
+
var Tool = class {
|
|
14
|
+
id;
|
|
15
|
+
description;
|
|
16
|
+
inputSchema;
|
|
17
|
+
outputSchema;
|
|
18
|
+
execute;
|
|
19
|
+
mastra;
|
|
20
|
+
constructor(opts) {
|
|
21
|
+
this.id = opts.id;
|
|
22
|
+
this.description = opts.description;
|
|
23
|
+
this.inputSchema = opts.inputSchema;
|
|
24
|
+
this.outputSchema = opts.outputSchema;
|
|
25
|
+
this.execute = opts.execute;
|
|
26
|
+
this.mastra = opts.mastra;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function createTool(opts) {
|
|
30
|
+
return new Tool(opts);
|
|
31
|
+
}
|
|
13
32
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
14
33
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
15
34
|
if (!value.type) {
|
|
@@ -190,7 +209,7 @@ function resolveSerializedZodOutput(schema) {
|
|
|
190
209
|
return Function("z", `"use strict";return (${schema});`)(zod.z);
|
|
191
210
|
}
|
|
192
211
|
function isVercelTool(tool) {
|
|
193
|
-
return !(tool instanceof
|
|
212
|
+
return !(tool instanceof Tool);
|
|
194
213
|
}
|
|
195
214
|
function createLogMessageOptions({ agentName, toolName, tool, type }) {
|
|
196
215
|
if (!agentName) {
|
|
@@ -410,8 +429,10 @@ ${JSON.stringify(message, null, 2)}
|
|
|
410
429
|
}).flat();
|
|
411
430
|
}
|
|
412
431
|
|
|
432
|
+
exports.Tool = Tool;
|
|
413
433
|
exports.checkEvalStorageFields = checkEvalStorageFields;
|
|
414
434
|
exports.createMastraProxy = createMastraProxy;
|
|
435
|
+
exports.createTool = createTool;
|
|
415
436
|
exports.deepMerge = deepMerge;
|
|
416
437
|
exports.delay = delay;
|
|
417
438
|
exports.ensureAllMessagesAreCoreMessages = ensureAllMessagesAreCoreMessages;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/storage/constants.ts
|
|
2
|
+
var TABLE_WORKFLOW_SNAPSHOT = "mastra_workflow_snapshot";
|
|
3
|
+
var TABLE_EVALS = "mastra_evals";
|
|
4
|
+
var TABLE_MESSAGES = "mastra_messages";
|
|
5
|
+
var TABLE_THREADS = "mastra_threads";
|
|
6
|
+
var TABLE_TRACES = "mastra_traces";
|
|
7
|
+
var TABLE_SCHEMAS = {
|
|
8
|
+
[TABLE_WORKFLOW_SNAPSHOT]: {
|
|
9
|
+
workflow_name: {
|
|
10
|
+
type: "text"
|
|
11
|
+
},
|
|
12
|
+
run_id: {
|
|
13
|
+
type: "text"
|
|
14
|
+
},
|
|
15
|
+
snapshot: {
|
|
16
|
+
type: "text"
|
|
17
|
+
},
|
|
18
|
+
createdAt: {
|
|
19
|
+
type: "timestamp"
|
|
20
|
+
},
|
|
21
|
+
updatedAt: {
|
|
22
|
+
type: "timestamp"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
[TABLE_EVALS]: {
|
|
26
|
+
id: {
|
|
27
|
+
type: "text",
|
|
28
|
+
nullable: false,
|
|
29
|
+
primaryKey: true
|
|
30
|
+
},
|
|
31
|
+
input: {
|
|
32
|
+
type: "text"
|
|
33
|
+
},
|
|
34
|
+
output: {
|
|
35
|
+
type: "text"
|
|
36
|
+
},
|
|
37
|
+
result: {
|
|
38
|
+
type: "jsonb"
|
|
39
|
+
},
|
|
40
|
+
agent_name: {
|
|
41
|
+
type: "text"
|
|
42
|
+
},
|
|
43
|
+
metric_name: {
|
|
44
|
+
type: "text"
|
|
45
|
+
},
|
|
46
|
+
instructions: {
|
|
47
|
+
type: "text"
|
|
48
|
+
},
|
|
49
|
+
test_info: {
|
|
50
|
+
type: "jsonb",
|
|
51
|
+
nullable: true
|
|
52
|
+
},
|
|
53
|
+
global_run_id: {
|
|
54
|
+
type: "text"
|
|
55
|
+
},
|
|
56
|
+
run_id: {
|
|
57
|
+
type: "text"
|
|
58
|
+
},
|
|
59
|
+
created_at: {
|
|
60
|
+
type: "timestamp"
|
|
61
|
+
},
|
|
62
|
+
createdAt: {
|
|
63
|
+
type: "timestamp"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
[TABLE_THREADS]: {
|
|
67
|
+
id: { type: "text", nullable: false, primaryKey: true },
|
|
68
|
+
resourceId: { type: "text", nullable: false },
|
|
69
|
+
title: { type: "text", nullable: false },
|
|
70
|
+
metadata: { type: "text", nullable: true },
|
|
71
|
+
createdAt: { type: "timestamp", nullable: false },
|
|
72
|
+
updatedAt: { type: "timestamp", nullable: false }
|
|
73
|
+
},
|
|
74
|
+
[TABLE_MESSAGES]: {
|
|
75
|
+
id: { type: "text", nullable: false, primaryKey: true },
|
|
76
|
+
thread_id: { type: "text", nullable: false },
|
|
77
|
+
content: { type: "text", nullable: false },
|
|
78
|
+
role: { type: "text", nullable: false },
|
|
79
|
+
type: { type: "text", nullable: false },
|
|
80
|
+
createdAt: { type: "timestamp", nullable: false }
|
|
81
|
+
},
|
|
82
|
+
[TABLE_TRACES]: {
|
|
83
|
+
id: { type: "text", nullable: false, primaryKey: true },
|
|
84
|
+
parentSpanId: { type: "text", nullable: true },
|
|
85
|
+
name: { type: "text", nullable: false },
|
|
86
|
+
traceId: { type: "text", nullable: false },
|
|
87
|
+
scope: { type: "text", nullable: false },
|
|
88
|
+
kind: { type: "integer", nullable: false },
|
|
89
|
+
attributes: { type: "jsonb", nullable: true },
|
|
90
|
+
status: { type: "jsonb", nullable: true },
|
|
91
|
+
events: { type: "jsonb", nullable: true },
|
|
92
|
+
links: { type: "jsonb", nullable: true },
|
|
93
|
+
other: { type: "text", nullable: true },
|
|
94
|
+
startTime: { type: "bigint", nullable: false },
|
|
95
|
+
endTime: { type: "bigint", nullable: false },
|
|
96
|
+
createdAt: { type: "timestamp", nullable: false }
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { TABLE_EVALS, TABLE_MESSAGES, TABLE_SCHEMAS, TABLE_THREADS, TABLE_TRACES, TABLE_WORKFLOW_SNAPSHOT };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk64VPB7ZD_cjs = require('./chunk-64VPB7ZD.cjs');
|
|
4
4
|
var zod = require('zod');
|
|
5
5
|
|
|
6
6
|
// src/integration/integration.ts
|
|
@@ -62,20 +62,20 @@ var OpenAPIToolset = class {
|
|
|
62
62
|
throw new Error("API not implemented");
|
|
63
63
|
}
|
|
64
64
|
_generateIntegrationTools() {
|
|
65
|
-
const { client, ...clientMethods } = this.baseClient;
|
|
65
|
+
const { client: _client, ...clientMethods } = this.baseClient;
|
|
66
66
|
const schemas = this.toolSchemas;
|
|
67
67
|
const documentations = this.toolDocumentations;
|
|
68
68
|
const tools = Object.keys(clientMethods).reduce((acc, key) => {
|
|
69
69
|
const comment = documentations[key]?.comment;
|
|
70
70
|
const fallbackComment = `Execute ${key}`;
|
|
71
|
-
const tool =
|
|
71
|
+
const tool = chunk64VPB7ZD_cjs.createTool({
|
|
72
72
|
id: key,
|
|
73
73
|
inputSchema: schemas[key] || zod.z.object({}),
|
|
74
74
|
description: comment || fallbackComment,
|
|
75
75
|
// documentation: doc || fallbackComment,
|
|
76
76
|
execute: async ({ context }) => {
|
|
77
|
-
const
|
|
78
|
-
const value =
|
|
77
|
+
const client = await this.getApiClient();
|
|
78
|
+
const value = client[key];
|
|
79
79
|
return value({
|
|
80
80
|
...context
|
|
81
81
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
|
|
4
4
|
|
|
5
5
|
// src/vector/vector.ts
|
|
6
|
-
var MastraVector = class extends
|
|
6
|
+
var MastraVector = class extends chunkD63P5O4Q_cjs.MastraBase {
|
|
7
7
|
constructor() {
|
|
8
8
|
super({ name: "MastraVector", component: "VECTOR" });
|
|
9
9
|
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { InstrumentClass } from './chunk-N5ZYOQBL.js';
|
|
2
|
+
import { MastraBase } from './chunk-CLJQYXNM.js';
|
|
3
|
+
import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
|
|
4
|
+
|
|
5
|
+
// src/voice/voice.ts
|
|
6
|
+
var _MastraVoice_decorators, _init, _a;
|
|
7
|
+
_MastraVoice_decorators = [InstrumentClass({
|
|
8
|
+
prefix: "voice",
|
|
9
|
+
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
10
|
+
})];
|
|
11
|
+
var MastraVoice = class extends (_a = MastraBase) {
|
|
12
|
+
listeningModel;
|
|
13
|
+
speechModel;
|
|
14
|
+
speaker;
|
|
15
|
+
realtimeConfig;
|
|
16
|
+
constructor({
|
|
17
|
+
listeningModel,
|
|
18
|
+
speechModel,
|
|
19
|
+
speaker,
|
|
20
|
+
realtimeConfig,
|
|
21
|
+
name
|
|
22
|
+
} = {}) {
|
|
23
|
+
super({
|
|
24
|
+
component: "VOICE",
|
|
25
|
+
name
|
|
26
|
+
});
|
|
27
|
+
this.listeningModel = listeningModel;
|
|
28
|
+
this.speechModel = speechModel;
|
|
29
|
+
this.speaker = speaker;
|
|
30
|
+
this.realtimeConfig = realtimeConfig;
|
|
31
|
+
}
|
|
32
|
+
traced(method, methodName) {
|
|
33
|
+
return this.telemetry?.traceMethod(method, {
|
|
34
|
+
spanName: `voice.${methodName}`,
|
|
35
|
+
attributes: {
|
|
36
|
+
"voice.type": this.speechModel?.name || this.listeningModel?.name || "unknown"
|
|
37
|
+
}
|
|
38
|
+
}) ?? method;
|
|
39
|
+
}
|
|
40
|
+
updateConfig(_options) {
|
|
41
|
+
this.logger.warn("updateConfig not implemented by this voice provider");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
45
|
+
* @returns Promise that resolves when the connection is established
|
|
46
|
+
*/
|
|
47
|
+
connect(_options) {
|
|
48
|
+
this.logger.warn("connect not implemented by this voice provider");
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Relay audio data to the voice provider for real-time processing
|
|
53
|
+
* @param audioData Audio data to relay
|
|
54
|
+
*/
|
|
55
|
+
send(_audioData) {
|
|
56
|
+
this.logger.warn("relay not implemented by this voice provider");
|
|
57
|
+
return Promise.resolve();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Trigger voice providers to respond
|
|
61
|
+
*/
|
|
62
|
+
answer(_options) {
|
|
63
|
+
this.logger.warn("answer not implemented by this voice provider");
|
|
64
|
+
return Promise.resolve();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Equip the voice provider with instructions
|
|
68
|
+
* @param instructions Instructions to add
|
|
69
|
+
*/
|
|
70
|
+
addInstructions(_instructions) {
|
|
71
|
+
this.logger.warn("addInstructions not implemented by this voice provider");
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Equip the voice provider with tools
|
|
75
|
+
* @param tools Array of tools to add
|
|
76
|
+
*/
|
|
77
|
+
addTools(_tools) {
|
|
78
|
+
this.logger.warn("addTools not implemented by this voice provider");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
82
|
+
*/
|
|
83
|
+
close() {
|
|
84
|
+
this.logger.warn("close not implemented by this voice provider");
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Register an event listener
|
|
88
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
89
|
+
* @param callback Callback function that receives event data
|
|
90
|
+
*/
|
|
91
|
+
on(_event, _callback) {
|
|
92
|
+
this.logger.warn("on not implemented by this voice provider");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Remove an event listener
|
|
96
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
97
|
+
* @param callback Callback function to remove
|
|
98
|
+
*/
|
|
99
|
+
off(_event, _callback) {
|
|
100
|
+
this.logger.warn("off not implemented by this voice provider");
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get available speakers/voices
|
|
104
|
+
* @returns Array of available voice IDs and their metadata
|
|
105
|
+
*/
|
|
106
|
+
getSpeakers() {
|
|
107
|
+
this.logger.warn("getSpeakers not implemented by this voice provider");
|
|
108
|
+
return Promise.resolve([]);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
MastraVoice = /*@__PURE__*/(_ => {
|
|
112
|
+
_init = __decoratorStart(_a);
|
|
113
|
+
MastraVoice = __decorateElement(_init, 0, "MastraVoice", _MastraVoice_decorators, MastraVoice);
|
|
114
|
+
__runInitializers(_init, 1, MastraVoice);
|
|
115
|
+
|
|
116
|
+
// src/voice/composite-voice.ts
|
|
117
|
+
return MastraVoice;
|
|
118
|
+
})();
|
|
119
|
+
// src/voice/composite-voice.ts
|
|
120
|
+
var CompositeVoice = class extends MastraVoice {
|
|
121
|
+
speakProvider;
|
|
122
|
+
listenProvider;
|
|
123
|
+
realtimeProvider;
|
|
124
|
+
constructor({
|
|
125
|
+
speakProvider,
|
|
126
|
+
listenProvider,
|
|
127
|
+
realtimeProvider
|
|
128
|
+
}) {
|
|
129
|
+
super();
|
|
130
|
+
this.speakProvider = speakProvider;
|
|
131
|
+
this.listenProvider = listenProvider;
|
|
132
|
+
this.realtimeProvider = realtimeProvider;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Convert text to speech using the configured provider
|
|
136
|
+
* @param input Text or text stream to convert to speech
|
|
137
|
+
* @param options Speech options including speaker and provider-specific options
|
|
138
|
+
* @returns Audio stream or void if in realtime mode
|
|
139
|
+
*/
|
|
140
|
+
async speak(input, options) {
|
|
141
|
+
if (this.realtimeProvider) {
|
|
142
|
+
return this.realtimeProvider.speak(input, options);
|
|
143
|
+
} else if (this.speakProvider) {
|
|
144
|
+
return this.speakProvider.speak(input, options);
|
|
145
|
+
}
|
|
146
|
+
throw new Error("No speak provider or realtime provider configured");
|
|
147
|
+
}
|
|
148
|
+
async listen(audioStream, options) {
|
|
149
|
+
if (this.realtimeProvider) {
|
|
150
|
+
return await this.realtimeProvider.listen(audioStream, options);
|
|
151
|
+
} else if (this.listenProvider) {
|
|
152
|
+
return await this.listenProvider.listen(audioStream, options);
|
|
153
|
+
}
|
|
154
|
+
throw new Error("No listen provider or realtime provider configured");
|
|
155
|
+
}
|
|
156
|
+
async getSpeakers() {
|
|
157
|
+
if (this.realtimeProvider) {
|
|
158
|
+
return this.realtimeProvider.getSpeakers();
|
|
159
|
+
} else if (this.speakProvider) {
|
|
160
|
+
return this.speakProvider.getSpeakers();
|
|
161
|
+
}
|
|
162
|
+
throw new Error("No speak provider or realtime provider configured");
|
|
163
|
+
}
|
|
164
|
+
updateConfig(options) {
|
|
165
|
+
if (!this.realtimeProvider) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.realtimeProvider.updateConfig(options);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Initializes a WebSocket or WebRTC connection for real-time communication
|
|
172
|
+
* @returns Promise that resolves when the connection is established
|
|
173
|
+
*/
|
|
174
|
+
connect(options) {
|
|
175
|
+
if (!this.realtimeProvider) {
|
|
176
|
+
throw new Error("No realtime provider configured");
|
|
177
|
+
}
|
|
178
|
+
return this.realtimeProvider.connect(options);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Relay audio data to the voice provider for real-time processing
|
|
182
|
+
* @param audioData Audio data to send
|
|
183
|
+
*/
|
|
184
|
+
send(audioData) {
|
|
185
|
+
if (!this.realtimeProvider) {
|
|
186
|
+
throw new Error("No realtime provider configured");
|
|
187
|
+
}
|
|
188
|
+
return this.realtimeProvider.send(audioData);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Trigger voice providers to respond
|
|
192
|
+
*/
|
|
193
|
+
answer(options) {
|
|
194
|
+
if (!this.realtimeProvider) {
|
|
195
|
+
throw new Error("No realtime provider configured");
|
|
196
|
+
}
|
|
197
|
+
return this.realtimeProvider.answer(options);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Equip the voice provider with instructions
|
|
201
|
+
* @param instructions Instructions to add
|
|
202
|
+
*/
|
|
203
|
+
addInstructions(instructions) {
|
|
204
|
+
if (!this.realtimeProvider) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this.realtimeProvider.addInstructions(instructions);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Equip the voice provider with tools
|
|
211
|
+
* @param tools Array of tools to add
|
|
212
|
+
*/
|
|
213
|
+
addTools(tools) {
|
|
214
|
+
if (!this.realtimeProvider) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
this.realtimeProvider.addTools(tools);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Disconnect from the WebSocket or WebRTC connection
|
|
221
|
+
*/
|
|
222
|
+
close() {
|
|
223
|
+
if (!this.realtimeProvider) {
|
|
224
|
+
throw new Error("No realtime provider configured");
|
|
225
|
+
}
|
|
226
|
+
this.realtimeProvider.close();
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Register an event listener
|
|
230
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
231
|
+
* @param callback Callback function that receives event data
|
|
232
|
+
*/
|
|
233
|
+
on(event, callback) {
|
|
234
|
+
if (!this.realtimeProvider) {
|
|
235
|
+
throw new Error("No realtime provider configured");
|
|
236
|
+
}
|
|
237
|
+
this.realtimeProvider.on(event, callback);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Remove an event listener
|
|
241
|
+
* @param event Event name (e.g., 'speaking', 'writing', 'error')
|
|
242
|
+
* @param callback Callback function to remove
|
|
243
|
+
*/
|
|
244
|
+
off(event, callback) {
|
|
245
|
+
if (!this.realtimeProvider) {
|
|
246
|
+
throw new Error("No realtime provider configured");
|
|
247
|
+
}
|
|
248
|
+
this.realtimeProvider.off(event, callback);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// src/voice/default-voice.ts
|
|
253
|
+
var DefaultVoice = class extends MastraVoice {
|
|
254
|
+
constructor() {
|
|
255
|
+
super();
|
|
256
|
+
}
|
|
257
|
+
async speak(_input) {
|
|
258
|
+
throw new Error("No voice provider configured");
|
|
259
|
+
}
|
|
260
|
+
async listen(_input) {
|
|
261
|
+
throw new Error("No voice provider configured");
|
|
262
|
+
}
|
|
263
|
+
async getSpeakers() {
|
|
264
|
+
throw new Error("No voice provider configured");
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export { CompositeVoice, DefaultVoice, MastraVoice };
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import { Tool } from './chunk-ZINPRHAN.js';
|
|
2
1
|
import { createHash } from 'crypto';
|
|
3
2
|
import { convertToCoreMessages } from 'ai';
|
|
4
3
|
import jsonSchemaToZod from 'json-schema-to-zod';
|
|
5
4
|
import { z } from 'zod';
|
|
6
5
|
|
|
6
|
+
// src/tools/tool.ts
|
|
7
|
+
var Tool = class {
|
|
8
|
+
id;
|
|
9
|
+
description;
|
|
10
|
+
inputSchema;
|
|
11
|
+
outputSchema;
|
|
12
|
+
execute;
|
|
13
|
+
mastra;
|
|
14
|
+
constructor(opts) {
|
|
15
|
+
this.id = opts.id;
|
|
16
|
+
this.description = opts.description;
|
|
17
|
+
this.inputSchema = opts.inputSchema;
|
|
18
|
+
this.outputSchema = opts.outputSchema;
|
|
19
|
+
this.execute = opts.execute;
|
|
20
|
+
this.mastra = opts.mastra;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function createTool(opts) {
|
|
24
|
+
return new Tool(opts);
|
|
25
|
+
}
|
|
7
26
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
8
27
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
9
28
|
if (!value.type) {
|
|
@@ -404,4 +423,4 @@ ${JSON.stringify(message, null, 2)}
|
|
|
404
423
|
}).flat();
|
|
405
424
|
}
|
|
406
425
|
|
|
407
|
-
export { checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
|
|
426
|
+
export { Tool, checkEvalStorageFields, createMastraProxy, createTool, deepMerge, delay, ensureAllMessagesAreCoreMessages, ensureToolProperties, isVercelTool, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, makeCoreTool, maskStreamTags, resolveSerializedZodOutput };
|