@mastra/core 0.9.4-alpha.1 → 0.9.4-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.d.cts +2 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/{base-4hc3EYVz.d.ts → base-BCfssGt6.d.ts} +68 -21
- package/dist/{base-DvwYl4To.d.cts → base-CAEcd6q2.d.cts} +68 -21
- package/dist/{chunk-W3FGUGQZ.cjs → chunk-24TNYZQE.cjs} +4 -4
- package/dist/{chunk-IETVW7QJ.cjs → chunk-3CTNBAF2.cjs} +29 -3
- package/dist/{chunk-4OTKXCGD.js → chunk-4WABQORE.js} +48 -6
- package/dist/{chunk-62M2N34A.js → chunk-4XNJMH4A.js} +1 -1
- package/dist/{chunk-R2JX75H2.js → chunk-6DIL4BTD.js} +1 -1
- package/dist/{chunk-VG2VXLOG.js → chunk-76ALCM2W.js} +231 -64
- package/dist/{chunk-GFFVEANU.js → chunk-D5PCSVU5.js} +29 -3
- package/dist/{chunk-KSCPMPZT.cjs → chunk-HAENAPIH.cjs} +2 -2
- package/dist/{chunk-DFZXG6NK.cjs → chunk-JA7Y3KJH.cjs} +5 -5
- package/dist/{chunk-2OC4YT6C.js → chunk-NZV4OA6P.js} +1 -7
- package/dist/{chunk-ZPFKNO6J.cjs → chunk-QDAMIZY3.cjs} +49 -7
- package/dist/{chunk-OYK2RU6Y.cjs → chunk-SA3SFBY5.cjs} +240 -73
- package/dist/{chunk-7EXZJ7KS.cjs → chunk-TO4ZBWI2.cjs} +2 -2
- package/dist/{chunk-EGZ7J727.js → chunk-WKFKO3Q2.js} +2 -2
- package/dist/{chunk-2GXSTMD7.cjs → chunk-WQKOM7XM.cjs} +1 -7
- package/dist/{chunk-D6GO3MBG.js → chunk-XR75VNNH.js} +1 -1
- package/dist/eval/index.d.cts +2 -2
- package/dist/eval/index.d.ts +2 -2
- package/dist/index.cjs +50 -50
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/integration/index.cjs +3 -3
- package/dist/integration/index.d.cts +2 -2
- package/dist/integration/index.d.ts +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.d.cts +2 -2
- package/dist/llm/index.d.ts +2 -2
- package/dist/mastra/index.d.cts +2 -2
- package/dist/mastra/index.d.ts +2 -2
- package/dist/mcp/index.d.cts +3 -3
- package/dist/mcp/index.d.ts +3 -3
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +2 -2
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.js +1 -1
- package/dist/network/index.cjs +4 -4
- package/dist/network/index.d.cts +2 -2
- package/dist/network/index.d.ts +2 -2
- package/dist/network/index.js +2 -2
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.d.cts +2 -2
- package/dist/relevance/index.d.ts +2 -2
- package/dist/relevance/index.js +1 -1
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/libsql/index.d.cts +2 -2
- package/dist/storage/libsql/index.d.ts +2 -2
- package/dist/telemetry/index.d.cts +2 -2
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.d.cts +2 -2
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +1 -1
- package/dist/utils.cjs +12 -12
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.d.cts +2 -2
- package/dist/vector/index.d.ts +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/vector/libsql/index.cjs +3 -3
- package/dist/vector/libsql/index.d.cts +36 -3
- package/dist/vector/libsql/index.d.ts +36 -3
- package/dist/vector/libsql/index.js +1 -1
- package/dist/voice/index.d.cts +2 -2
- package/dist/voice/index.d.ts +2 -2
- package/dist/workflows/index.cjs +22 -22
- package/dist/workflows/index.d.cts +3 -3
- package/dist/workflows/index.d.ts +3 -3
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/vNext/index.cjs +4 -4
- package/dist/workflows/vNext/index.d.cts +3 -3
- package/dist/workflows/vNext/index.d.ts +3 -3
- package/dist/workflows/vNext/index.js +2 -2
- package/package.json +2 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSA3SFBY5_cjs = require('../chunk-SA3SFBY5.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Agent", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkSA3SFBY5_cjs.Agent; }
|
|
10
10
|
});
|
package/dist/agent/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { F as Agent, G as AgentConfig,
|
|
4
|
+
export { F as Agent, G as AgentConfig, bl as AgentGenerateOptions, bm as AgentStreamOptions, bk as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bj as ToolsetsInput } from '../base-CAEcd6q2.cjs';
|
|
5
5
|
import '../base-H7siSAfu.cjs';
|
|
6
6
|
import '../types-BtMyV38I.cjs';
|
|
7
7
|
import '../runtime-context/index.cjs';
|
|
@@ -17,10 +17,10 @@ import '../vector/filter/index.cjs';
|
|
|
17
17
|
import '@opentelemetry/sdk-trace-base';
|
|
18
18
|
import '../tts/index.cjs';
|
|
19
19
|
import 'node:http';
|
|
20
|
+
import 'hono';
|
|
20
21
|
import 'events';
|
|
21
22
|
import '../deployer/index.cjs';
|
|
22
23
|
import '../bundler/index.cjs';
|
|
23
|
-
import 'hono';
|
|
24
24
|
import 'hono/cors';
|
|
25
25
|
import 'hono-openapi';
|
|
26
26
|
import 'ai/test';
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Message as AiMessageType } from 'ai';
|
|
2
2
|
import 'json-schema';
|
|
3
3
|
import 'zod';
|
|
4
|
-
export { F as Agent, G as AgentConfig,
|
|
4
|
+
export { F as Agent, G as AgentConfig, bl as AgentGenerateOptions, bm as AgentStreamOptions, bk as DynamicArgument, b2 as MastraLanguageModel, b4 as ToolsInput, bj as ToolsetsInput } from '../base-BCfssGt6.js';
|
|
5
5
|
import '../base-4Z34GQL8.js';
|
|
6
6
|
import '../types-BtMyV38I.js';
|
|
7
7
|
import '../runtime-context/index.js';
|
|
@@ -17,10 +17,10 @@ import '../vector/filter/index.js';
|
|
|
17
17
|
import '@opentelemetry/sdk-trace-base';
|
|
18
18
|
import '../tts/index.js';
|
|
19
19
|
import 'node:http';
|
|
20
|
+
import 'hono';
|
|
20
21
|
import 'events';
|
|
21
22
|
import '../deployer/index.js';
|
|
22
23
|
import '../bundler/index.js';
|
|
23
|
-
import 'hono';
|
|
24
24
|
import 'hono/cors';
|
|
25
25
|
import 'hono-openapi';
|
|
26
26
|
import 'ai/test';
|
package/dist/agent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Agent } from '../chunk-
|
|
1
|
+
export { Agent } from '../chunk-76ALCM2W.js';
|
|
@@ -14,9 +14,9 @@ import EventEmitter from 'node:events';
|
|
|
14
14
|
import { MastraVector } from './vector/index.js';
|
|
15
15
|
import { MastraTTS } from './tts/index.js';
|
|
16
16
|
import * as http from 'node:http';
|
|
17
|
+
import { Context, Handler, MiddlewareHandler } from 'hono';
|
|
17
18
|
import EventEmitter$1 from 'events';
|
|
18
19
|
import { MastraDeployer } from './deployer/index.js';
|
|
19
|
-
import { Handler, MiddlewareHandler } from 'hono';
|
|
20
20
|
import { cors } from 'hono/cors';
|
|
21
21
|
import { DescribeRouteOptions } from 'hono-openapi';
|
|
22
22
|
import { MockLanguageModelV1 } from 'ai/test';
|
|
@@ -98,10 +98,7 @@ type ConvertedTool = {
|
|
|
98
98
|
parameters: InternalCoreTool['parameters'];
|
|
99
99
|
execute: InternalCoreTool['execute'];
|
|
100
100
|
};
|
|
101
|
-
|
|
102
|
-
* Options for starting an MCP server with SSE transport
|
|
103
|
-
*/
|
|
104
|
-
interface MCPServerSSEOptions {
|
|
101
|
+
interface MCPServerSSEOptionsBase {
|
|
105
102
|
/**
|
|
106
103
|
* Parsed URL of the incoming request
|
|
107
104
|
*/
|
|
@@ -114,6 +111,38 @@ interface MCPServerSSEOptions {
|
|
|
114
111
|
* Path for POSTing client messages (e.g. '/message')
|
|
115
112
|
*/
|
|
116
113
|
messagePath: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Options for starting an MCP server with SSE transport
|
|
117
|
+
*/
|
|
118
|
+
interface MCPServerSSEOptions extends MCPServerSSEOptionsBase {
|
|
119
|
+
/**
|
|
120
|
+
* Incoming HTTP request
|
|
121
|
+
*/
|
|
122
|
+
req: http.IncomingMessage;
|
|
123
|
+
/**
|
|
124
|
+
* HTTP response (must support .write/.end)
|
|
125
|
+
*/
|
|
126
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Options for starting an MCP server with Hono SSE transport
|
|
130
|
+
*/
|
|
131
|
+
interface MCPServerHonoSSEOptions extends MCPServerSSEOptionsBase {
|
|
132
|
+
/**
|
|
133
|
+
* Incoming Hono context
|
|
134
|
+
*/
|
|
135
|
+
context: Context;
|
|
136
|
+
}
|
|
137
|
+
interface MCPServerHTTPOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Parsed URL of the incoming request
|
|
140
|
+
*/
|
|
141
|
+
url: URL;
|
|
142
|
+
/**
|
|
143
|
+
* Path for establishing the HTTP connection (e.g. '/mcp')
|
|
144
|
+
*/
|
|
145
|
+
httpPath: string;
|
|
117
146
|
/**
|
|
118
147
|
* Incoming HTTP request
|
|
119
148
|
*/
|
|
@@ -122,6 +151,10 @@ interface MCPServerSSEOptions {
|
|
|
122
151
|
* HTTP response (must support .write/.end)
|
|
123
152
|
*/
|
|
124
153
|
res: http.ServerResponse<http.IncomingMessage>;
|
|
154
|
+
/**
|
|
155
|
+
* Optional options to pass to the transport (e.g. sessionIdGenerator)
|
|
156
|
+
*/
|
|
157
|
+
options?: any;
|
|
125
158
|
}
|
|
126
159
|
|
|
127
160
|
/**
|
|
@@ -164,13 +197,17 @@ declare abstract class MCPServerBase extends MastraBase {
|
|
|
164
197
|
* @param options Options for the SSE transport
|
|
165
198
|
*/
|
|
166
199
|
abstract startSSE(options: MCPServerSSEOptions): Promise<void>;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Start the MCP server using Hono SSE transport
|
|
202
|
+
* Used for Hono servers
|
|
203
|
+
* @param options Options for the SSE transport
|
|
204
|
+
*/
|
|
205
|
+
abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;
|
|
206
|
+
/**
|
|
207
|
+
* Start the MCP server using HTTP transport
|
|
208
|
+
* @param options Options for the HTTP transport
|
|
209
|
+
*/
|
|
210
|
+
abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;
|
|
174
211
|
/**
|
|
175
212
|
* Close the MCP server and all its connections
|
|
176
213
|
*/
|
|
@@ -1027,11 +1064,6 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
1027
1064
|
}, xstate.AnyEventObject>;
|
|
1028
1065
|
}) => {
|
|
1029
1066
|
mastra?: MastraUnion | undefined;
|
|
1030
|
-
triggerData: any;
|
|
1031
|
-
isResume?: {
|
|
1032
|
-
runId: string;
|
|
1033
|
-
stepId: string;
|
|
1034
|
-
} | undefined;
|
|
1035
1067
|
steps: {
|
|
1036
1068
|
[x: string]: {
|
|
1037
1069
|
status: "failed";
|
|
@@ -1056,8 +1088,13 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
1056
1088
|
output?: any;
|
|
1057
1089
|
};
|
|
1058
1090
|
};
|
|
1059
|
-
inputData: Record<string, any>;
|
|
1060
1091
|
attempts: Record<string, number>;
|
|
1092
|
+
inputData: Record<string, any>;
|
|
1093
|
+
triggerData: any;
|
|
1094
|
+
isResume?: {
|
|
1095
|
+
runId: string;
|
|
1096
|
+
stepId: string;
|
|
1097
|
+
} | undefined;
|
|
1061
1098
|
};
|
|
1062
1099
|
readonly states: any;
|
|
1063
1100
|
}> | undefined;
|
|
@@ -1203,7 +1240,7 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1203
1240
|
* @param runId - ID of the run to retrieve
|
|
1204
1241
|
* @returns The workflow run instance if found, undefined otherwise
|
|
1205
1242
|
*/
|
|
1206
|
-
getRun(runId: string): Promise<WorkflowInstance<TSteps, TTriggerSchema, any> |
|
|
1243
|
+
getRun(runId: string): Promise<WorkflowRun | WorkflowInstance<TSteps, TTriggerSchema, any> | null>;
|
|
1207
1244
|
/**
|
|
1208
1245
|
* Gets a workflow run instance by ID, from memory
|
|
1209
1246
|
* @param runId - ID of the run to retrieve
|
|
@@ -2159,6 +2196,7 @@ interface AgentConfig<TAgentId extends string = string, TTools extends ToolsInpu
|
|
|
2159
2196
|
instructions: DynamicArgument<string>;
|
|
2160
2197
|
model: DynamicArgument<MastraLanguageModel>;
|
|
2161
2198
|
tools?: DynamicArgument<TTools>;
|
|
2199
|
+
workflows?: DynamicArgument<Record<string, NewWorkflow>>;
|
|
2162
2200
|
defaultGenerateOptions?: AgentGenerateOptions;
|
|
2163
2201
|
defaultStreamOptions?: AgentStreamOptions;
|
|
2164
2202
|
mastra?: Mastra;
|
|
@@ -2462,6 +2500,9 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2462
2500
|
hasOwnMemory(): boolean;
|
|
2463
2501
|
getMemory(): MastraMemory | undefined;
|
|
2464
2502
|
get voice(): CompositeVoice;
|
|
2503
|
+
getWorkflows({ runtimeContext, }?: {
|
|
2504
|
+
runtimeContext?: RuntimeContext;
|
|
2505
|
+
}): Promise<Record<string, NewWorkflow>>;
|
|
2465
2506
|
getVoice({ runtimeContext }?: {
|
|
2466
2507
|
runtimeContext?: RuntimeContext;
|
|
2467
2508
|
}): Promise<CompositeVoice | DefaultVoice>;
|
|
@@ -2520,6 +2561,11 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2520
2561
|
}>;
|
|
2521
2562
|
private getResponseMessages;
|
|
2522
2563
|
sanitizeResponseMessages(messages: Array<CoreMessage$1>): Array<CoreMessage$1>;
|
|
2564
|
+
private getMemoryTools;
|
|
2565
|
+
private getAssignedTools;
|
|
2566
|
+
private getToolsets;
|
|
2567
|
+
private getClientTools;
|
|
2568
|
+
private getWorkflowTools;
|
|
2523
2569
|
private convertTools;
|
|
2524
2570
|
preExecute({ resourceId, runId, threadId, thread, memoryConfig, messages, systemMessage, }: {
|
|
2525
2571
|
runId?: string;
|
|
@@ -2551,13 +2597,14 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2551
2597
|
threadId: string;
|
|
2552
2598
|
thread: StorageThreadType | null | undefined;
|
|
2553
2599
|
}>;
|
|
2554
|
-
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, }: {
|
|
2600
|
+
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, experimental_generateMessageId, }: {
|
|
2555
2601
|
runId: string;
|
|
2556
2602
|
result: Record<string, any>;
|
|
2557
2603
|
thread: StorageThreadType | null | undefined;
|
|
2558
2604
|
threadId: string;
|
|
2559
2605
|
memoryConfig: MemoryConfig | undefined;
|
|
2560
2606
|
outputText: string;
|
|
2607
|
+
experimental_generateMessageId: any;
|
|
2561
2608
|
}) => Promise<void>;
|
|
2562
2609
|
};
|
|
2563
2610
|
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
|
|
@@ -2830,4 +2877,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2830
2877
|
}): Promise<WorkflowRun | null>;
|
|
2831
2878
|
}
|
|
2832
2879
|
|
|
2833
|
-
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type
|
|
2880
|
+
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type MCPServerHonoSSEOptions as ba, type MCPServerHTTPOptions as bb, type AgentNetworkConfig as bc, type VoiceEventType as bd, type VoiceEventMap as be, type VoiceConfig as bf, MastraVoice as bg, CompositeVoice as bh, DefaultVoice as bi, type ToolsetsInput as bj, type DynamicArgument as bk, type AgentGenerateOptions as bl, type AgentStreamOptions as bm, TABLE_WORKFLOW_SNAPSHOT as bn, TABLE_EVALS as bo, TABLE_MESSAGES as bp, TABLE_THREADS as bq, TABLE_TRACES as br, TABLE_SCHEMAS as bs, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
|
|
@@ -14,9 +14,9 @@ import EventEmitter from 'node:events';
|
|
|
14
14
|
import { MastraVector } from './vector/index.cjs';
|
|
15
15
|
import { MastraTTS } from './tts/index.cjs';
|
|
16
16
|
import * as http from 'node:http';
|
|
17
|
+
import { Context, Handler, MiddlewareHandler } from 'hono';
|
|
17
18
|
import EventEmitter$1 from 'events';
|
|
18
19
|
import { MastraDeployer } from './deployer/index.cjs';
|
|
19
|
-
import { Handler, MiddlewareHandler } from 'hono';
|
|
20
20
|
import { cors } from 'hono/cors';
|
|
21
21
|
import { DescribeRouteOptions } from 'hono-openapi';
|
|
22
22
|
import { MockLanguageModelV1 } from 'ai/test';
|
|
@@ -98,10 +98,7 @@ type ConvertedTool = {
|
|
|
98
98
|
parameters: InternalCoreTool['parameters'];
|
|
99
99
|
execute: InternalCoreTool['execute'];
|
|
100
100
|
};
|
|
101
|
-
|
|
102
|
-
* Options for starting an MCP server with SSE transport
|
|
103
|
-
*/
|
|
104
|
-
interface MCPServerSSEOptions {
|
|
101
|
+
interface MCPServerSSEOptionsBase {
|
|
105
102
|
/**
|
|
106
103
|
* Parsed URL of the incoming request
|
|
107
104
|
*/
|
|
@@ -114,6 +111,38 @@ interface MCPServerSSEOptions {
|
|
|
114
111
|
* Path for POSTing client messages (e.g. '/message')
|
|
115
112
|
*/
|
|
116
113
|
messagePath: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Options for starting an MCP server with SSE transport
|
|
117
|
+
*/
|
|
118
|
+
interface MCPServerSSEOptions extends MCPServerSSEOptionsBase {
|
|
119
|
+
/**
|
|
120
|
+
* Incoming HTTP request
|
|
121
|
+
*/
|
|
122
|
+
req: http.IncomingMessage;
|
|
123
|
+
/**
|
|
124
|
+
* HTTP response (must support .write/.end)
|
|
125
|
+
*/
|
|
126
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Options for starting an MCP server with Hono SSE transport
|
|
130
|
+
*/
|
|
131
|
+
interface MCPServerHonoSSEOptions extends MCPServerSSEOptionsBase {
|
|
132
|
+
/**
|
|
133
|
+
* Incoming Hono context
|
|
134
|
+
*/
|
|
135
|
+
context: Context;
|
|
136
|
+
}
|
|
137
|
+
interface MCPServerHTTPOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Parsed URL of the incoming request
|
|
140
|
+
*/
|
|
141
|
+
url: URL;
|
|
142
|
+
/**
|
|
143
|
+
* Path for establishing the HTTP connection (e.g. '/mcp')
|
|
144
|
+
*/
|
|
145
|
+
httpPath: string;
|
|
117
146
|
/**
|
|
118
147
|
* Incoming HTTP request
|
|
119
148
|
*/
|
|
@@ -122,6 +151,10 @@ interface MCPServerSSEOptions {
|
|
|
122
151
|
* HTTP response (must support .write/.end)
|
|
123
152
|
*/
|
|
124
153
|
res: http.ServerResponse<http.IncomingMessage>;
|
|
154
|
+
/**
|
|
155
|
+
* Optional options to pass to the transport (e.g. sessionIdGenerator)
|
|
156
|
+
*/
|
|
157
|
+
options?: any;
|
|
125
158
|
}
|
|
126
159
|
|
|
127
160
|
/**
|
|
@@ -164,13 +197,17 @@ declare abstract class MCPServerBase extends MastraBase {
|
|
|
164
197
|
* @param options Options for the SSE transport
|
|
165
198
|
*/
|
|
166
199
|
abstract startSSE(options: MCPServerSSEOptions): Promise<void>;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Start the MCP server using Hono SSE transport
|
|
202
|
+
* Used for Hono servers
|
|
203
|
+
* @param options Options for the SSE transport
|
|
204
|
+
*/
|
|
205
|
+
abstract startHonoSSE(options: MCPServerHonoSSEOptions): Promise<Response | undefined>;
|
|
206
|
+
/**
|
|
207
|
+
* Start the MCP server using HTTP transport
|
|
208
|
+
* @param options Options for the HTTP transport
|
|
209
|
+
*/
|
|
210
|
+
abstract startHTTP(options: MCPServerHTTPOptions): Promise<void>;
|
|
174
211
|
/**
|
|
175
212
|
* Close the MCP server and all its connections
|
|
176
213
|
*/
|
|
@@ -1027,11 +1064,6 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
1027
1064
|
}, xstate.AnyEventObject>;
|
|
1028
1065
|
}) => {
|
|
1029
1066
|
mastra?: MastraUnion | undefined;
|
|
1030
|
-
triggerData: any;
|
|
1031
|
-
isResume?: {
|
|
1032
|
-
runId: string;
|
|
1033
|
-
stepId: string;
|
|
1034
|
-
} | undefined;
|
|
1035
1067
|
steps: {
|
|
1036
1068
|
[x: string]: {
|
|
1037
1069
|
status: "failed";
|
|
@@ -1056,8 +1088,13 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
|
|
|
1056
1088
|
output?: any;
|
|
1057
1089
|
};
|
|
1058
1090
|
};
|
|
1059
|
-
inputData: Record<string, any>;
|
|
1060
1091
|
attempts: Record<string, number>;
|
|
1092
|
+
inputData: Record<string, any>;
|
|
1093
|
+
triggerData: any;
|
|
1094
|
+
isResume?: {
|
|
1095
|
+
runId: string;
|
|
1096
|
+
stepId: string;
|
|
1097
|
+
} | undefined;
|
|
1061
1098
|
};
|
|
1062
1099
|
readonly states: any;
|
|
1063
1100
|
}> | undefined;
|
|
@@ -1203,7 +1240,7 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
|
|
|
1203
1240
|
* @param runId - ID of the run to retrieve
|
|
1204
1241
|
* @returns The workflow run instance if found, undefined otherwise
|
|
1205
1242
|
*/
|
|
1206
|
-
getRun(runId: string): Promise<WorkflowInstance<TSteps, TTriggerSchema, any> |
|
|
1243
|
+
getRun(runId: string): Promise<WorkflowRun | WorkflowInstance<TSteps, TTriggerSchema, any> | null>;
|
|
1207
1244
|
/**
|
|
1208
1245
|
* Gets a workflow run instance by ID, from memory
|
|
1209
1246
|
* @param runId - ID of the run to retrieve
|
|
@@ -2159,6 +2196,7 @@ interface AgentConfig<TAgentId extends string = string, TTools extends ToolsInpu
|
|
|
2159
2196
|
instructions: DynamicArgument<string>;
|
|
2160
2197
|
model: DynamicArgument<MastraLanguageModel>;
|
|
2161
2198
|
tools?: DynamicArgument<TTools>;
|
|
2199
|
+
workflows?: DynamicArgument<Record<string, NewWorkflow>>;
|
|
2162
2200
|
defaultGenerateOptions?: AgentGenerateOptions;
|
|
2163
2201
|
defaultStreamOptions?: AgentStreamOptions;
|
|
2164
2202
|
mastra?: Mastra;
|
|
@@ -2462,6 +2500,9 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2462
2500
|
hasOwnMemory(): boolean;
|
|
2463
2501
|
getMemory(): MastraMemory | undefined;
|
|
2464
2502
|
get voice(): CompositeVoice;
|
|
2503
|
+
getWorkflows({ runtimeContext, }?: {
|
|
2504
|
+
runtimeContext?: RuntimeContext;
|
|
2505
|
+
}): Promise<Record<string, NewWorkflow>>;
|
|
2465
2506
|
getVoice({ runtimeContext }?: {
|
|
2466
2507
|
runtimeContext?: RuntimeContext;
|
|
2467
2508
|
}): Promise<CompositeVoice | DefaultVoice>;
|
|
@@ -2520,6 +2561,11 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2520
2561
|
}>;
|
|
2521
2562
|
private getResponseMessages;
|
|
2522
2563
|
sanitizeResponseMessages(messages: Array<CoreMessage$1>): Array<CoreMessage$1>;
|
|
2564
|
+
private getMemoryTools;
|
|
2565
|
+
private getAssignedTools;
|
|
2566
|
+
private getToolsets;
|
|
2567
|
+
private getClientTools;
|
|
2568
|
+
private getWorkflowTools;
|
|
2523
2569
|
private convertTools;
|
|
2524
2570
|
preExecute({ resourceId, runId, threadId, thread, memoryConfig, messages, systemMessage, }: {
|
|
2525
2571
|
runId?: string;
|
|
@@ -2551,13 +2597,14 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2551
2597
|
threadId: string;
|
|
2552
2598
|
thread: StorageThreadType | null | undefined;
|
|
2553
2599
|
}>;
|
|
2554
|
-
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, }: {
|
|
2600
|
+
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, experimental_generateMessageId, }: {
|
|
2555
2601
|
runId: string;
|
|
2556
2602
|
result: Record<string, any>;
|
|
2557
2603
|
thread: StorageThreadType | null | undefined;
|
|
2558
2604
|
threadId: string;
|
|
2559
2605
|
memoryConfig: MemoryConfig | undefined;
|
|
2560
2606
|
outputText: string;
|
|
2607
|
+
experimental_generateMessageId: any;
|
|
2561
2608
|
}) => Promise<void>;
|
|
2562
2609
|
};
|
|
2563
2610
|
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
|
|
@@ -2830,4 +2877,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2830
2877
|
}): Promise<WorkflowRun | null>;
|
|
2831
2878
|
}
|
|
2832
2879
|
|
|
2833
|
-
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type
|
|
2880
|
+
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type MCPServerHonoSSEOptions as ba, type MCPServerHTTPOptions as bb, type AgentNetworkConfig as bc, type VoiceEventType as bd, type VoiceEventMap as be, type VoiceConfig as bf, MastraVoice as bg, CompositeVoice as bh, DefaultVoice as bi, type ToolsetsInput as bj, type DynamicArgument as bk, type AgentGenerateOptions as bl, type AgentStreamOptions as bm, TABLE_WORKFLOW_SNAPSHOT as bn, TABLE_EVALS as bo, TABLE_MESSAGES as bp, TABLE_THREADS as bq, TABLE_TRACES as br, TABLE_SCHEMAS as bs, type StorageThreadType as c, type MessageType as d, type StorageGetMessagesArg as e, type WorkflowRun as f, ExecutionEngine as g, type StepResult as h, type ExecutionGraph as i, type StepFlowEntry as j, type ExecuteFunction as k, type SerializedStep as l, type SerializedStepFlowEntry as m, createStep as n, cloneStep as o, createWorkflow as p, cloneWorkflow as q, type WorkflowResult as r, type NewWorkflowConfig as s, NewWorkflow as t, type StepSuccess as u, type StepFailure as v, type StepSuspended as w, type StepsRecord as x, type ExtractSchemaType as y, type ExtractSchemaFromStep as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQDAMIZY3_cjs = require('./chunk-QDAMIZY3.cjs');
|
|
4
4
|
var chunkRAQBTCIR_cjs = require('./chunk-RAQBTCIR.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk3CTNBAF2_cjs = require('./chunk-3CTNBAF2.cjs');
|
|
6
6
|
var chunkEG74VBSP_cjs = require('./chunk-EG74VBSP.cjs');
|
|
7
7
|
var fs = require('fs');
|
|
8
8
|
var path = require('path');
|
|
@@ -279,7 +279,7 @@ export const agent = new Agent({
|
|
|
279
279
|
})
|
|
280
280
|
})
|
|
281
281
|
`);
|
|
282
|
-
this.vector = new
|
|
282
|
+
this.vector = new chunkQDAMIZY3_cjs.LibSQLVector({
|
|
283
283
|
// TODO: MAY 20th BREAKING CHANGE: remove this default and throw an error if semantic recall is enabled but there's no vector db
|
|
284
284
|
connectionUrl: hasOldDb ? `file:${oldDb}` : `file:${newDb}`
|
|
285
285
|
});
|
|
@@ -472,7 +472,7 @@ Do:
|
|
|
472
472
|
return { indexName };
|
|
473
473
|
}
|
|
474
474
|
getMergedThreadConfig(config) {
|
|
475
|
-
return
|
|
475
|
+
return chunk3CTNBAF2_cjs.deepMerge(this.threadConfig, config || {});
|
|
476
476
|
}
|
|
477
477
|
/**
|
|
478
478
|
* Apply all configured message processors to a list of messages.
|
|
@@ -6,6 +6,7 @@ var crypto = require('crypto');
|
|
|
6
6
|
var ai = require('ai');
|
|
7
7
|
var jsonSchemaToZod = require('json-schema-to-zod');
|
|
8
8
|
var zod = require('zod');
|
|
9
|
+
var zodFromJsonSchema = require('zod-from-json-schema');
|
|
9
10
|
var zodToJsonSchema = require('zod-to-json-schema');
|
|
10
11
|
|
|
11
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -53,7 +54,7 @@ var ToolCompatibility = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
|
53
54
|
}
|
|
54
55
|
applyZodSchemaCompatibility(zodSchema2) {
|
|
55
56
|
const newSchema = zod.z.object(
|
|
56
|
-
Object.entries(zodSchema2.shape).reduce(
|
|
57
|
+
Object.entries(zodSchema2.shape || {}).reduce(
|
|
57
58
|
(acc, [key, value]) => ({
|
|
58
59
|
...acc,
|
|
59
60
|
[key]: this.processZodType(value)
|
|
@@ -549,11 +550,36 @@ function convertZodSchemaToAISDKSchema(zodSchema2, target = "jsonSchema7") {
|
|
|
549
550
|
}
|
|
550
551
|
function convertVercelToolParameters(tool) {
|
|
551
552
|
const schema = tool.parameters ?? zod.z.object({});
|
|
552
|
-
|
|
553
|
+
if (isZodType(schema)) {
|
|
554
|
+
return schema;
|
|
555
|
+
} else {
|
|
556
|
+
const jsonSchemaToConvert = "jsonSchema" in schema ? schema.jsonSchema : schema;
|
|
557
|
+
try {
|
|
558
|
+
const rawShape = zodFromJsonSchema.jsonSchemaObjectToZodRawShape(jsonSchemaToConvert);
|
|
559
|
+
return zod.z.object(rawShape);
|
|
560
|
+
} catch (e) {
|
|
561
|
+
const errorMessage = `[CoreToolBuilder] Failed to convert Vercel tool JSON schema parameters to Zod. Original schema: ${JSON.stringify(jsonSchemaToConvert)}`;
|
|
562
|
+
console.error(errorMessage, e);
|
|
563
|
+
throw new Error(errorMessage + (e instanceof Error ? `
|
|
564
|
+
${e.stack}` : "\nUnknown error object"));
|
|
565
|
+
}
|
|
566
|
+
}
|
|
553
567
|
}
|
|
554
568
|
function convertInputSchema(tool) {
|
|
555
569
|
const schema = tool.inputSchema ?? zod.z.object({});
|
|
556
|
-
|
|
570
|
+
if (isZodType(schema)) {
|
|
571
|
+
return schema;
|
|
572
|
+
} else {
|
|
573
|
+
try {
|
|
574
|
+
const rawShape = zodFromJsonSchema.jsonSchemaObjectToZodRawShape(schema);
|
|
575
|
+
return zod.z.object(rawShape);
|
|
576
|
+
} catch (e) {
|
|
577
|
+
const errorMessage = `[CoreToolBuilder] Failed to convert tool input JSON schema to Zod. Original schema: ${JSON.stringify(schema)}`;
|
|
578
|
+
console.error(errorMessage, e);
|
|
579
|
+
throw new Error(errorMessage + (e instanceof Error ? `
|
|
580
|
+
${e.stack}` : "\nUnknown error object"));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
557
583
|
}
|
|
558
584
|
var CoreToolBuilder = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
559
585
|
originalTool;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MastraVector } from './chunk-
|
|
1
|
+
import { MastraVector } from './chunk-NZV4OA6P.js';
|
|
2
2
|
import { BaseFilterTranslator } from './chunk-LGERQTJM.js';
|
|
3
3
|
import { isAbsolute, join, resolve } from 'path';
|
|
4
4
|
import { createClient } from '@libsql/client';
|
|
@@ -679,10 +679,11 @@ var LibSQLVector = class extends MastraVector {
|
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
681
|
/**
|
|
682
|
-
*
|
|
682
|
+
* @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
|
|
683
683
|
*
|
|
684
|
-
*
|
|
685
|
-
* @param
|
|
684
|
+
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
685
|
+
* @param indexName - The name of the index containing the vector.
|
|
686
|
+
* @param id - The ID of the vector to update.
|
|
686
687
|
* @param update - An object containing the vector and/or metadata to update.
|
|
687
688
|
* @param update.vector - An optional array of numbers representing the new vector.
|
|
688
689
|
* @param update.metadata - An optional record containing the new metadata.
|
|
@@ -690,6 +691,23 @@ var LibSQLVector = class extends MastraVector {
|
|
|
690
691
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
691
692
|
*/
|
|
692
693
|
async updateIndexById(indexName, id, update) {
|
|
694
|
+
this.logger.warn(
|
|
695
|
+
`Deprecation Warning: updateIndexById() is deprecated. Please use updateVector() instead. updateIndexById() will be removed on May 20th, 2025.`
|
|
696
|
+
);
|
|
697
|
+
await this.updateVector(indexName, id, update);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
701
|
+
*
|
|
702
|
+
* @param indexName - The name of the index containing the vector.
|
|
703
|
+
* @param id - The ID of the vector to update.
|
|
704
|
+
* @param update - An object containing the vector and/or metadata to update.
|
|
705
|
+
* @param update.vector - An optional array of numbers representing the new vector.
|
|
706
|
+
* @param update.metadata - An optional record containing the new metadata.
|
|
707
|
+
* @returns A promise that resolves when the update is complete.
|
|
708
|
+
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
709
|
+
*/
|
|
710
|
+
async updateVector(indexName, id, update) {
|
|
693
711
|
try {
|
|
694
712
|
const updates = [];
|
|
695
713
|
const args = [];
|
|
@@ -715,17 +733,41 @@ var LibSQLVector = class extends MastraVector {
|
|
|
715
733
|
args
|
|
716
734
|
});
|
|
717
735
|
} catch (error) {
|
|
718
|
-
throw new Error(`Failed to update
|
|
736
|
+
throw new Error(`Failed to update vector by id: ${id} for index: ${indexName}: ${error.message}`);
|
|
719
737
|
}
|
|
720
738
|
}
|
|
739
|
+
/**
|
|
740
|
+
* @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
|
|
741
|
+
*
|
|
742
|
+
* Deletes a vector by its ID.
|
|
743
|
+
* @param indexName - The name of the index containing the vector.
|
|
744
|
+
* @param id - The ID of the vector to delete.
|
|
745
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
746
|
+
* @throws Will throw an error if the deletion operation fails.
|
|
747
|
+
*/
|
|
721
748
|
async deleteIndexById(indexName, id) {
|
|
749
|
+
this.logger.warn(
|
|
750
|
+
`Deprecation Warning: deleteIndexById() is deprecated.
|
|
751
|
+
Please use deleteVector() instead.
|
|
752
|
+
deleteIndexById() will be removed on May 20th, 2025.`
|
|
753
|
+
);
|
|
754
|
+
await this.deleteVector(indexName, id);
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Deletes a vector by its ID.
|
|
758
|
+
* @param indexName - The name of the index containing the vector.
|
|
759
|
+
* @param id - The ID of the vector to delete.
|
|
760
|
+
* @returns A promise that resolves when the deletion is complete.
|
|
761
|
+
* @throws Will throw an error if the deletion operation fails.
|
|
762
|
+
*/
|
|
763
|
+
async deleteVector(indexName, id) {
|
|
722
764
|
try {
|
|
723
765
|
await this.turso.execute({
|
|
724
766
|
sql: `DELETE FROM ${indexName} WHERE vector_id = ?`,
|
|
725
767
|
args: [id]
|
|
726
768
|
});
|
|
727
769
|
} catch (error) {
|
|
728
|
-
throw new Error(`Failed to delete
|
|
770
|
+
throw new Error(`Failed to delete vector by id: ${id} for index: ${indexName}: ${error.message}`);
|
|
729
771
|
}
|
|
730
772
|
}
|
|
731
773
|
async truncateIndex(indexName) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delay } from './chunk-
|
|
1
|
+
import { delay } from './chunk-D5PCSVU5.js';
|
|
2
2
|
import { MastraBase } from './chunk-235X76GC.js';
|
|
3
3
|
import { RegisteredLogger } from './chunk-CMPPXW4U.js';
|
|
4
4
|
import { jsonSchema, generateText, Output, generateObject, streamText, streamObject } from 'ai';
|