@mastra/server 0.0.0-generate-message-id-20250512171942 → 0.0.0-http-transporter-20250702160118
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/_tsup-dts-rollup.d.cts +394 -128
- package/dist/_tsup-dts-rollup.d.ts +394 -128
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
- package/dist/chunk-4D66QEKC.js +81 -0
- package/dist/{chunk-EJO45KYT.js → chunk-5PQQ42EZ.js} +43 -43
- package/dist/{chunk-4YZ3U35L.cjs → chunk-7TP2LX5L.cjs} +18 -18
- package/dist/chunk-B2PAS2IB.cjs +514 -0
- package/dist/{chunk-Q6KMBIAN.js → chunk-BK4XT6EG.js} +93 -14
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
- package/dist/{chunk-24EGIVT7.cjs → chunk-DN7K6FJK.cjs} +91 -54
- package/dist/{chunk-ZE5AAC4I.cjs → chunk-FRVBFMO2.cjs} +26 -36
- package/dist/{chunk-MHKNLNAN.cjs → chunk-G7KH752Y.cjs} +10 -7
- package/dist/{chunk-P6SCPDYW.js → chunk-GHC4YV6R.js} +5 -1
- package/dist/chunk-H7DMHBKY.js +498 -0
- package/dist/chunk-JMLYCXMK.cjs +332 -0
- package/dist/{chunk-HFWCEP5S.js → chunk-KHZKYUNR.js} +33 -10
- package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/{chunk-YWLUOY3D.cjs → chunk-LI436ITD.cjs} +107 -69
- package/dist/{chunk-TJKLBTFB.js → chunk-LRCAAFUA.js} +10 -20
- package/dist/{chunk-3HQNCTZ2.cjs → chunk-LZ3VJXSO.cjs} +107 -28
- package/dist/{chunk-LIVAK2DM.js → chunk-MEGCYGBU.js} +108 -70
- package/dist/{chunk-X3ZDCS52.js → chunk-MKLYEKEF.js} +62 -25
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/chunk-QGX47B5D.cjs +86 -0
- package/dist/{chunk-OR3CIE2H.js → chunk-RG473F6Y.js} +7 -4
- package/dist/chunk-RHSWAXKB.cjs +118 -0
- package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/{chunk-5SN4U5AC.cjs → chunk-SDPGVWQJ.cjs} +5 -1
- package/dist/{chunk-IU5VO2I2.js → chunk-WNVFNNWN.js} +4 -4
- package/dist/server/handlers/a2a.cjs +7 -7
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +218 -0
- package/dist/server/handlers/vNextNetwork.d.cts +6 -0
- package/dist/server/handlers/vNextNetwork.d.ts +6 -0
- package/dist/server/handlers/vNextNetwork.js +211 -0
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +29 -13
- package/dist/server/handlers/workflows.d.cts +6 -2
- package/dist/server/handlers/workflows.d.ts +6 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +28 -28
- package/dist/server/handlers.d.cts +1 -1
- package/dist/server/handlers.d.ts +1 -1
- package/dist/server/handlers.js +11 -11
- package/package.json +12 -13
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-HWZVAG3H.js +0 -49
- package/dist/chunk-I2B73Y4I.cjs +0 -332
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MIQYDLLM.js +0 -329
- package/dist/chunk-OGCNNUHF.cjs +0 -54
- package/dist/chunk-UCTEMO2Q.cjs +0 -341
- package/dist/chunk-YBVOQN4M.cjs +0 -94
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
|
@@ -13,6 +13,7 @@ var HTTPException = class extends Error {
|
|
|
13
13
|
super(options?.message, { cause: options?.cause });
|
|
14
14
|
this.res = options?.res;
|
|
15
15
|
this.status = status;
|
|
16
|
+
this.stack = options?.stack || this.stack;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Returns the response object associated with the exception.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
|
|
4
|
+
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
5
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
6
6
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
7
|
|
|
8
8
|
// src/server/handlers/network.ts
|
|
@@ -47,7 +47,7 @@ async function getNetworksHandler({
|
|
|
47
47
|
);
|
|
48
48
|
return serializedNetworks;
|
|
49
49
|
} catch (error) {
|
|
50
|
-
return
|
|
50
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting networks");
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
async function getNetworkByIdHandler({
|
|
@@ -62,7 +62,7 @@ async function getNetworkByIdHandler({
|
|
|
62
62
|
return network2.formatAgentId(routingAgent2.name) === networkId;
|
|
63
63
|
});
|
|
64
64
|
if (!network) {
|
|
65
|
-
throw new
|
|
65
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
|
|
66
66
|
}
|
|
67
67
|
const routingAgent = network.getRoutingAgent();
|
|
68
68
|
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
@@ -88,7 +88,7 @@ async function getNetworkByIdHandler({
|
|
|
88
88
|
};
|
|
89
89
|
return serializedNetwork;
|
|
90
90
|
} catch (error) {
|
|
91
|
-
return
|
|
91
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting network by ID");
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
async function generateHandler({
|
|
@@ -100,14 +100,14 @@ async function generateHandler({
|
|
|
100
100
|
try {
|
|
101
101
|
const network = mastra.getNetwork(networkId);
|
|
102
102
|
if (!network) {
|
|
103
|
-
throw new
|
|
103
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages: body.messages });
|
|
106
106
|
const { messages, ...rest } = body;
|
|
107
107
|
const result = await network.generate(messages, { ...rest, runtimeContext });
|
|
108
108
|
return result;
|
|
109
109
|
} catch (error) {
|
|
110
|
-
return
|
|
110
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error generating from network");
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
async function streamGenerateHandler({
|
|
@@ -119,9 +119,9 @@ async function streamGenerateHandler({
|
|
|
119
119
|
try {
|
|
120
120
|
const network = mastra.getNetwork(networkId);
|
|
121
121
|
if (!network) {
|
|
122
|
-
throw new
|
|
122
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Network not found" });
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages: body.messages });
|
|
125
125
|
const { messages, output, ...rest } = body;
|
|
126
126
|
const streamResult = await network.stream(messages, {
|
|
127
127
|
output,
|
|
@@ -137,7 +137,7 @@ async function streamGenerateHandler({
|
|
|
137
137
|
});
|
|
138
138
|
return streamResponse;
|
|
139
139
|
} catch (error) {
|
|
140
|
-
return
|
|
140
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error streaming from network");
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { validateBody } from './chunk-RSEO4XPX.js';
|
|
2
|
+
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
4
|
+
|
|
5
|
+
// src/server/handlers/logs.ts
|
|
6
|
+
var logs_exports = {};
|
|
7
|
+
__export(logs_exports, {
|
|
8
|
+
getLogTransports: () => getLogTransports,
|
|
9
|
+
getLogsByRunIdHandler: () => getLogsByRunIdHandler,
|
|
10
|
+
getLogsHandler: () => getLogsHandler
|
|
11
|
+
});
|
|
12
|
+
async function getLogsHandler({
|
|
13
|
+
mastra,
|
|
14
|
+
transportId,
|
|
15
|
+
params
|
|
16
|
+
}) {
|
|
17
|
+
try {
|
|
18
|
+
validateBody({ transportId });
|
|
19
|
+
const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
|
|
20
|
+
const filters = _filters ? Object.fromEntries(
|
|
21
|
+
(Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
|
|
22
|
+
const [key, value] = attr.split(":");
|
|
23
|
+
return [key, value];
|
|
24
|
+
})
|
|
25
|
+
) : void 0;
|
|
26
|
+
const logs = await mastra.getLogs(transportId, {
|
|
27
|
+
fromDate,
|
|
28
|
+
toDate,
|
|
29
|
+
logLevel,
|
|
30
|
+
filters,
|
|
31
|
+
page: page ? Number(page) : void 0,
|
|
32
|
+
perPage: perPage ? Number(perPage) : void 0
|
|
33
|
+
});
|
|
34
|
+
return logs;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
return handleError(error, "Error getting logs");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function getLogsByRunIdHandler({
|
|
40
|
+
mastra,
|
|
41
|
+
runId,
|
|
42
|
+
transportId,
|
|
43
|
+
params
|
|
44
|
+
}) {
|
|
45
|
+
try {
|
|
46
|
+
validateBody({ runId, transportId });
|
|
47
|
+
const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
|
|
48
|
+
const filters = _filters ? Object.fromEntries(
|
|
49
|
+
(Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
|
|
50
|
+
const [key, value] = attr.split(":");
|
|
51
|
+
return [key, value];
|
|
52
|
+
})
|
|
53
|
+
) : void 0;
|
|
54
|
+
const logs = await mastra.getLogsByRunId({
|
|
55
|
+
runId,
|
|
56
|
+
transportId,
|
|
57
|
+
fromDate,
|
|
58
|
+
toDate,
|
|
59
|
+
logLevel,
|
|
60
|
+
filters,
|
|
61
|
+
page: page ? Number(page) : void 0,
|
|
62
|
+
perPage: perPage ? Number(perPage) : void 0
|
|
63
|
+
});
|
|
64
|
+
return logs;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
return handleError(error, "Error getting logs by run ID");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function getLogTransports({ mastra }) {
|
|
70
|
+
try {
|
|
71
|
+
const logger = mastra.getLogger();
|
|
72
|
+
const transports = logger.getTransports();
|
|
73
|
+
return {
|
|
74
|
+
transports: transports ? [...transports.keys()] : []
|
|
75
|
+
};
|
|
76
|
+
} catch (error) {
|
|
77
|
+
return handleError(error, "Error getting log Transports");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { getLogTransports, getLogsByRunIdHandler, getLogsHandler, logs_exports };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import { HTTPException } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-MEGCYGBU.js';
|
|
2
|
+
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
|
+
import { HTTPException } from './chunk-LCM566I4.js';
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
5
|
-
import { ReadableStream } from '
|
|
5
|
+
import { ReadableStream } from 'stream/web';
|
|
6
6
|
|
|
7
|
-
// src/server/handlers/
|
|
8
|
-
var
|
|
9
|
-
__export(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
// src/server/handlers/legacyWorkflows.ts
|
|
8
|
+
var legacyWorkflows_exports = {};
|
|
9
|
+
__export(legacyWorkflows_exports, {
|
|
10
|
+
createLegacyWorkflowRunHandler: () => createLegacyWorkflowRunHandler,
|
|
11
|
+
getLegacyWorkflowByIdHandler: () => getLegacyWorkflowByIdHandler,
|
|
12
|
+
getLegacyWorkflowRunHandler: () => getLegacyWorkflowRunHandler,
|
|
13
|
+
getLegacyWorkflowRunsHandler: () => getLegacyWorkflowRunsHandler,
|
|
14
|
+
getLegacyWorkflowsHandler: () => getLegacyWorkflowsHandler,
|
|
15
|
+
resumeAsyncLegacyWorkflowHandler: () => resumeAsyncLegacyWorkflowHandler,
|
|
16
|
+
resumeLegacyWorkflowHandler: () => resumeLegacyWorkflowHandler,
|
|
17
|
+
startAsyncLegacyWorkflowHandler: () => startAsyncLegacyWorkflowHandler,
|
|
18
|
+
startLegacyWorkflowRunHandler: () => startLegacyWorkflowRunHandler,
|
|
19
|
+
watchLegacyWorkflowHandler: () => watchLegacyWorkflowHandler
|
|
20
20
|
});
|
|
21
|
-
async function
|
|
21
|
+
async function getLegacyWorkflowsHandler({ mastra }) {
|
|
22
22
|
try {
|
|
23
|
-
const workflows = mastra.
|
|
23
|
+
const workflows = mastra.legacy_getWorkflows({ serialized: false });
|
|
24
24
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
25
25
|
if (workflow.isNested) return acc;
|
|
26
26
|
acc[key] = {
|
|
@@ -46,15 +46,15 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
46
46
|
}, {});
|
|
47
47
|
return _workflows;
|
|
48
48
|
} catch (error) {
|
|
49
|
-
|
|
49
|
+
return handleError(error, "error getting workflows");
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
|
|
53
53
|
try {
|
|
54
54
|
if (!workflowId) {
|
|
55
55
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
56
56
|
}
|
|
57
|
-
const workflow = mastra.
|
|
57
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
58
58
|
if (!workflow) {
|
|
59
59
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
60
60
|
}
|
|
@@ -78,10 +78,10 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
78
78
|
}, {})
|
|
79
79
|
};
|
|
80
80
|
} catch (error) {
|
|
81
|
-
|
|
81
|
+
return handleError(error, "error getting workflow by id");
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
async function
|
|
84
|
+
async function startAsyncLegacyWorkflowHandler({
|
|
85
85
|
mastra,
|
|
86
86
|
runtimeContext,
|
|
87
87
|
workflowId,
|
|
@@ -92,7 +92,7 @@ async function startAsyncWorkflowHandler({
|
|
|
92
92
|
if (!workflowId) {
|
|
93
93
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
94
94
|
}
|
|
95
|
-
const workflow = mastra.
|
|
95
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
96
96
|
if (!workflow) {
|
|
97
97
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
98
98
|
}
|
|
@@ -114,10 +114,10 @@ async function startAsyncWorkflowHandler({
|
|
|
114
114
|
});
|
|
115
115
|
return result;
|
|
116
116
|
} catch (error) {
|
|
117
|
-
|
|
117
|
+
return handleError(error, "error starting workflow");
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
async function
|
|
120
|
+
async function getLegacyWorkflowRunHandler({
|
|
121
121
|
mastra,
|
|
122
122
|
workflowId,
|
|
123
123
|
runId
|
|
@@ -129,7 +129,7 @@ async function getWorkflowRunHandler({
|
|
|
129
129
|
if (!runId) {
|
|
130
130
|
throw new HTTPException(400, { message: "Run ID is required" });
|
|
131
131
|
}
|
|
132
|
-
const workflow = mastra.
|
|
132
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
133
133
|
if (!workflow) {
|
|
134
134
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
135
135
|
}
|
|
@@ -139,10 +139,10 @@ async function getWorkflowRunHandler({
|
|
|
139
139
|
}
|
|
140
140
|
return run;
|
|
141
141
|
} catch (error) {
|
|
142
|
-
|
|
142
|
+
return handleError(error, "error getting workflow run");
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
145
|
+
async function createLegacyWorkflowRunHandler({
|
|
146
146
|
mastra,
|
|
147
147
|
workflowId,
|
|
148
148
|
runId: prevRunId
|
|
@@ -151,17 +151,17 @@ async function createRunHandler({
|
|
|
151
151
|
if (!workflowId) {
|
|
152
152
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
153
153
|
}
|
|
154
|
-
const workflow = mastra.
|
|
154
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
155
155
|
if (!workflow) {
|
|
156
156
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
157
157
|
}
|
|
158
158
|
const newRun = workflow.createRun({ runId: prevRunId });
|
|
159
159
|
return { runId: newRun.runId };
|
|
160
160
|
} catch (error) {
|
|
161
|
-
|
|
161
|
+
return handleError(error, "error creating workflow run");
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
async function
|
|
164
|
+
async function startLegacyWorkflowRunHandler({
|
|
165
165
|
mastra,
|
|
166
166
|
runtimeContext,
|
|
167
167
|
workflowId,
|
|
@@ -175,7 +175,7 @@ async function startWorkflowRunHandler({
|
|
|
175
175
|
if (!runId) {
|
|
176
176
|
throw new HTTPException(400, { message: "runId required to start run" });
|
|
177
177
|
}
|
|
178
|
-
const workflow = mastra.
|
|
178
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
179
179
|
const run = workflow.getMemoryRun(runId);
|
|
180
180
|
if (!run) {
|
|
181
181
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -189,7 +189,7 @@ async function startWorkflowRunHandler({
|
|
|
189
189
|
return handleError(e, "Error starting workflow run");
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function watchLegacyWorkflowHandler({
|
|
193
193
|
mastra,
|
|
194
194
|
workflowId,
|
|
195
195
|
runId
|
|
@@ -201,7 +201,7 @@ async function watchWorkflowHandler({
|
|
|
201
201
|
if (!runId) {
|
|
202
202
|
throw new HTTPException(400, { message: "runId required to watch workflow" });
|
|
203
203
|
}
|
|
204
|
-
const workflow = mastra.
|
|
204
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
205
205
|
const run = workflow.getMemoryRun(runId);
|
|
206
206
|
if (!run) {
|
|
207
207
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -235,7 +235,7 @@ async function watchWorkflowHandler({
|
|
|
235
235
|
return handleError(error, "Error watching workflow");
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
async function
|
|
238
|
+
async function resumeAsyncLegacyWorkflowHandler({
|
|
239
239
|
mastra,
|
|
240
240
|
workflowId,
|
|
241
241
|
runId,
|
|
@@ -249,7 +249,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
249
249
|
if (!runId) {
|
|
250
250
|
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
251
251
|
}
|
|
252
|
-
const workflow = mastra.
|
|
252
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
253
253
|
const run = workflow.getMemoryRun(runId);
|
|
254
254
|
if (!run) {
|
|
255
255
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -264,7 +264,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
264
264
|
return handleError(error, "Error resuming workflow step");
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
async function
|
|
267
|
+
async function resumeLegacyWorkflowHandler({
|
|
268
268
|
mastra,
|
|
269
269
|
workflowId,
|
|
270
270
|
runId,
|
|
@@ -278,7 +278,7 @@ async function resumeWorkflowHandler({
|
|
|
278
278
|
if (!runId) {
|
|
279
279
|
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
280
280
|
}
|
|
281
|
-
const workflow = mastra.
|
|
281
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
282
282
|
const run = workflow.getMemoryRun(runId);
|
|
283
283
|
if (!run) {
|
|
284
284
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
@@ -293,7 +293,7 @@ async function resumeWorkflowHandler({
|
|
|
293
293
|
return handleError(error, "Error resuming workflow");
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
async function
|
|
296
|
+
async function getLegacyWorkflowRunsHandler({
|
|
297
297
|
mastra,
|
|
298
298
|
workflowId,
|
|
299
299
|
fromDate,
|
|
@@ -306,7 +306,7 @@ async function getWorkflowRunsHandler({
|
|
|
306
306
|
if (!workflowId) {
|
|
307
307
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
308
308
|
}
|
|
309
|
-
const workflow = mastra.
|
|
309
|
+
const workflow = mastra.legacy_getWorkflow(workflowId);
|
|
310
310
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
311
311
|
runs: [],
|
|
312
312
|
total: 0
|
|
@@ -317,4 +317,4 @@ async function getWorkflowRunsHandler({
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
export {
|
|
320
|
+
export { createLegacyWorkflowRunHandler, getLegacyWorkflowByIdHandler, getLegacyWorkflowRunHandler, getLegacyWorkflowRunsHandler, getLegacyWorkflowsHandler, legacyWorkflows_exports, resumeAsyncLegacyWorkflowHandler, resumeLegacyWorkflowHandler, startAsyncLegacyWorkflowHandler, startLegacyWorkflowRunHandler, watchLegacyWorkflowHandler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
4
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
5
5
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
6
|
|
|
7
7
|
// src/server/handlers/vector.ts
|
|
@@ -16,24 +16,24 @@ chunk75ZPJI57_cjs.__export(vector_exports, {
|
|
|
16
16
|
});
|
|
17
17
|
function getVector(mastra, vectorName) {
|
|
18
18
|
if (!vectorName) {
|
|
19
|
-
throw new
|
|
19
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Vector name is required" });
|
|
20
20
|
}
|
|
21
21
|
const vector = mastra.getVector(vectorName);
|
|
22
22
|
if (!vector) {
|
|
23
|
-
throw new
|
|
23
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: `Vector store ${vectorName} not found` });
|
|
24
24
|
}
|
|
25
25
|
return vector;
|
|
26
26
|
}
|
|
27
27
|
async function upsertVectors({ mastra, vectorName, index }) {
|
|
28
28
|
try {
|
|
29
29
|
if (!index?.indexName || !index?.vectors || !Array.isArray(index.vectors)) {
|
|
30
|
-
throw new
|
|
30
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Invalid request index. indexName and vectors array are required." });
|
|
31
31
|
}
|
|
32
32
|
const vector = getVector(mastra, vectorName);
|
|
33
33
|
const result = await vector.upsert(index);
|
|
34
34
|
return { ids: result };
|
|
35
35
|
} catch (error) {
|
|
36
|
-
return
|
|
36
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error upserting vectors");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
async function createIndex({
|
|
@@ -44,18 +44,18 @@ async function createIndex({
|
|
|
44
44
|
try {
|
|
45
45
|
const { indexName, dimension, metric } = index;
|
|
46
46
|
if (!indexName || typeof dimension !== "number" || dimension <= 0) {
|
|
47
|
-
throw new
|
|
47
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, {
|
|
48
48
|
message: "Invalid request index, indexName and positive dimension number are required."
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
if (metric && !["cosine", "euclidean", "dotproduct"].includes(metric)) {
|
|
52
|
-
throw new
|
|
52
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Invalid metric. Must be one of: cosine, euclidean, dotproduct" });
|
|
53
53
|
}
|
|
54
54
|
const vector = getVector(mastra, vectorName);
|
|
55
55
|
await vector.createIndex({ indexName, dimension, metric });
|
|
56
56
|
return { success: true };
|
|
57
57
|
} catch (error) {
|
|
58
|
-
return
|
|
58
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error creating index");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
async function queryVectors({
|
|
@@ -65,13 +65,13 @@ async function queryVectors({
|
|
|
65
65
|
}) {
|
|
66
66
|
try {
|
|
67
67
|
if (!query?.indexName || !query?.queryVector || !Array.isArray(query.queryVector)) {
|
|
68
|
-
throw new
|
|
68
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Invalid request query. indexName and queryVector array are required." });
|
|
69
69
|
}
|
|
70
70
|
const vector = getVector(mastra, vectorName);
|
|
71
71
|
const results = await vector.query(query);
|
|
72
72
|
return results;
|
|
73
73
|
} catch (error) {
|
|
74
|
-
return
|
|
74
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error querying vectors");
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
async function listIndexes({ mastra, vectorName }) {
|
|
@@ -80,7 +80,7 @@ async function listIndexes({ mastra, vectorName }) {
|
|
|
80
80
|
const indexes = await vector.listIndexes();
|
|
81
81
|
return indexes.filter(Boolean);
|
|
82
82
|
} catch (error) {
|
|
83
|
-
return
|
|
83
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error listing indexes");
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
async function describeIndex({
|
|
@@ -90,17 +90,17 @@ async function describeIndex({
|
|
|
90
90
|
}) {
|
|
91
91
|
try {
|
|
92
92
|
if (!indexName) {
|
|
93
|
-
throw new
|
|
93
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Index name is required" });
|
|
94
94
|
}
|
|
95
95
|
const vector = getVector(mastra, vectorName);
|
|
96
|
-
const stats = await vector.describeIndex(indexName);
|
|
96
|
+
const stats = await vector.describeIndex({ indexName });
|
|
97
97
|
return {
|
|
98
98
|
dimension: stats.dimension,
|
|
99
99
|
count: stats.count,
|
|
100
100
|
metric: stats.metric?.toLowerCase()
|
|
101
101
|
};
|
|
102
102
|
} catch (error) {
|
|
103
|
-
return
|
|
103
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error describing index");
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
async function deleteIndex({
|
|
@@ -110,13 +110,13 @@ async function deleteIndex({
|
|
|
110
110
|
}) {
|
|
111
111
|
try {
|
|
112
112
|
if (!indexName) {
|
|
113
|
-
throw new
|
|
113
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Index name is required" });
|
|
114
114
|
}
|
|
115
115
|
const vector = getVector(mastra, vectorName);
|
|
116
|
-
await vector.deleteIndex(indexName);
|
|
116
|
+
await vector.deleteIndex({ indexName });
|
|
117
117
|
return { success: true };
|
|
118
118
|
} catch (error) {
|
|
119
|
-
return
|
|
119
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error deleting index");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|