@mastra/core 0.9.4-alpha.2 → 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-Ds8Er4RI.d.ts → base-BCfssGt6.d.ts} +52 -14
- package/dist/{base-BH9nLjiE.d.cts → base-CAEcd6q2.d.cts} +52 -14
- package/dist/{chunk-MT4MRB64.cjs → chunk-24TNYZQE.cjs} +4 -4
- package/dist/{chunk-2TW4KTAP.cjs → chunk-3CTNBAF2.cjs} +23 -7
- package/dist/{chunk-4OTKXCGD.js → chunk-4WABQORE.js} +48 -6
- package/dist/{chunk-U6I2YTXP.js → chunk-4XNJMH4A.js} +1 -1
- package/dist/{chunk-7BYKMXS2.js → chunk-6DIL4BTD.js} +1 -1
- package/dist/{chunk-CLQS5YQO.js → chunk-76ALCM2W.js} +22 -13
- package/dist/{chunk-NW6LO3QH.js → chunk-D5PCSVU5.js} +23 -7
- package/dist/{chunk-7FV65Q6G.cjs → chunk-HAENAPIH.cjs} +2 -2
- package/dist/{chunk-MUCBDM7Y.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-OH4OCBZW.cjs → chunk-SA3SFBY5.cjs} +33 -24
- package/dist/{chunk-IIK2DDET.cjs → chunk-TO4ZBWI2.cjs} +2 -2
- package/dist/{chunk-6YUKY7NG.js → chunk-WKFKO3Q2.js} +2 -2
- package/dist/{chunk-2GXSTMD7.cjs → chunk-WQKOM7XM.cjs} +1 -7
- package/dist/{chunk-EK3WKXRL.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,11 @@ 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 {
|
|
117
119
|
/**
|
|
118
120
|
* Incoming HTTP request
|
|
119
121
|
*/
|
|
@@ -123,6 +125,37 @@ interface MCPServerSSEOptions {
|
|
|
123
125
|
*/
|
|
124
126
|
res: http.ServerResponse<http.IncomingMessage>;
|
|
125
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;
|
|
146
|
+
/**
|
|
147
|
+
* Incoming HTTP request
|
|
148
|
+
*/
|
|
149
|
+
req: http.IncomingMessage;
|
|
150
|
+
/**
|
|
151
|
+
* HTTP response (must support .write/.end)
|
|
152
|
+
*/
|
|
153
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
154
|
+
/**
|
|
155
|
+
* Optional options to pass to the transport (e.g. sessionIdGenerator)
|
|
156
|
+
*/
|
|
157
|
+
options?: any;
|
|
158
|
+
}
|
|
126
159
|
|
|
127
160
|
/**
|
|
128
161
|
* Abstract base class for MCP server implementations
|
|
@@ -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
|
*/
|
|
@@ -2560,13 +2597,14 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2560
2597
|
threadId: string;
|
|
2561
2598
|
thread: StorageThreadType | null | undefined;
|
|
2562
2599
|
}>;
|
|
2563
|
-
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, }: {
|
|
2600
|
+
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, experimental_generateMessageId, }: {
|
|
2564
2601
|
runId: string;
|
|
2565
2602
|
result: Record<string, any>;
|
|
2566
2603
|
thread: StorageThreadType | null | undefined;
|
|
2567
2604
|
threadId: string;
|
|
2568
2605
|
memoryConfig: MemoryConfig | undefined;
|
|
2569
2606
|
outputText: string;
|
|
2607
|
+
experimental_generateMessageId: any;
|
|
2570
2608
|
}) => Promise<void>;
|
|
2571
2609
|
};
|
|
2572
2610
|
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
|
|
@@ -2839,4 +2877,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2839
2877
|
}): Promise<WorkflowRun | null>;
|
|
2840
2878
|
}
|
|
2841
2879
|
|
|
2842
|
-
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type
|
|
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,11 @@ 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 {
|
|
117
119
|
/**
|
|
118
120
|
* Incoming HTTP request
|
|
119
121
|
*/
|
|
@@ -123,6 +125,37 @@ interface MCPServerSSEOptions {
|
|
|
123
125
|
*/
|
|
124
126
|
res: http.ServerResponse<http.IncomingMessage>;
|
|
125
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;
|
|
146
|
+
/**
|
|
147
|
+
* Incoming HTTP request
|
|
148
|
+
*/
|
|
149
|
+
req: http.IncomingMessage;
|
|
150
|
+
/**
|
|
151
|
+
* HTTP response (must support .write/.end)
|
|
152
|
+
*/
|
|
153
|
+
res: http.ServerResponse<http.IncomingMessage>;
|
|
154
|
+
/**
|
|
155
|
+
* Optional options to pass to the transport (e.g. sessionIdGenerator)
|
|
156
|
+
*/
|
|
157
|
+
options?: any;
|
|
158
|
+
}
|
|
126
159
|
|
|
127
160
|
/**
|
|
128
161
|
* Abstract base class for MCP server implementations
|
|
@@ -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
|
*/
|
|
@@ -2560,13 +2597,14 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
|
|
|
2560
2597
|
threadId: string;
|
|
2561
2598
|
thread: StorageThreadType | null | undefined;
|
|
2562
2599
|
}>;
|
|
2563
|
-
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, }: {
|
|
2600
|
+
after: ({ result, thread: threadAfter, threadId, memoryConfig, outputText, runId, experimental_generateMessageId, }: {
|
|
2564
2601
|
runId: string;
|
|
2565
2602
|
result: Record<string, any>;
|
|
2566
2603
|
thread: StorageThreadType | null | undefined;
|
|
2567
2604
|
threadId: string;
|
|
2568
2605
|
memoryConfig: MemoryConfig | undefined;
|
|
2569
2606
|
outputText: string;
|
|
2607
|
+
experimental_generateMessageId: any;
|
|
2570
2608
|
}) => Promise<void>;
|
|
2571
2609
|
};
|
|
2572
2610
|
generate<Z extends ZodSchema | JSONSchema7 | undefined = undefined>(messages: string | string[] | CoreMessage$1[] | Message[], args?: AgentGenerateOptions<Z> & {
|
|
@@ -2839,4 +2877,4 @@ declare abstract class MastraStorage extends MastraBase {
|
|
|
2839
2877
|
}): Promise<WorkflowRun | null>;
|
|
2840
2878
|
}
|
|
2841
2879
|
|
|
2842
|
-
export { type CoreToolMessage as $, type ApiRoute as A, type WatchEvent as B, type ToolAction as C, type DynamicMapping as D, type EvalRow as E, Agent as F, type AgentConfig as G, MastraMemory as H, type ToolExecutionContext as I, Tool as J, Step as K, Workflow as L, type Methods as M, type NewStep as N, type WorkflowOptions as O, type PathsToStringProps as P, type LanguageModel as Q, Run as R, type StorageColumn as S, type TABLE_NAMES as T, type CoreMessage as U, type VariableReference as V, type WorkflowRuns as W, type CoreSystemMessage as X, type CoreAssistantMessage as Y, type ZodPathType as Z, type CoreUserMessage as _, Mastra as a, type PathsToStringProps$1 as a$, type EmbedResult as a0, type EmbedManyResult as a1, type BaseStructuredOutputType as a2, type StructuredOutputType as a3, type StructuredOutputArrayItem as a4, type StructuredOutput as a5, type GenerateReturn as a6, type StreamReturn as a7, type OutputType as a8, type DefaultLLMTextOptions as a9, type VariableReference$1 as aA, type BaseCondition as aB, type ActionContext as aC, WhenConditionReturnValue as aD, type StepDef as aE, type StepCondition as aF, type StepConfig as aG, type StepResult$1 as aH, type StepsRecord$1 as aI, type WorkflowRunResult as aJ, type WorkflowContext as aK, type WorkflowLogMessage as aL, type WorkflowEvent as aM, type ResolverFunctionInput as aN, type ResolverFunctionOutput as aO, type SubscriberFunctionOutput as aP, type DependencyCheckOutput as aQ, type StepResolverOutput as aR, type WorkflowActors as aS, type WorkflowActionParams as aT, type WorkflowActions as aU, type WorkflowState as aV, type StepId as aW, type ExtractSchemaFromStep$1 as aX, type ExtractStepResult as aY, type StepInputType as aZ, type ExtractSchemaType$1 as a_, type DefaultLLMTextObjectOptions as aa, type DefaultLLMStreamOptions as ab, type DefaultLLMStreamObjectOptions as ac, type LLMTextOptions as ad, type LLMTextObjectOptions as ae, type LLMStreamOptions as af, type LLMInnerStreamOptions as ag, type LLMStreamObjectOptions as ah, createMockModel as ai, type Config as aj, type MessageResponse as ak, type MemoryConfig as al, type SharedMemoryConfig as am, type MemoryProcessorOpts as an, MemoryProcessor as ao, memoryDefaultOptions as ap, createTool as aq, type VercelTool as ar, type CoreTool as as, type InternalCoreTool as at, type StepExecutionContext as au, type StepAction as av, type StepVariableType as aw, type StepNode as ax, type StepGraph as ay, type RetryConfig as az, MastraStorage as b, type WorkflowRunState as b0, type WorkflowResumeResult as b1, type MastraLanguageModel as b2, type MastraPrimitives as b3, type ToolsInput as b4, AgentNetwork as b5, MCPServerBase as b6, type MCPServerConfig as b7, type ConvertedTool as b8, type MCPServerSSEOptions as b9, type
|
|
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 }; }
|
|
@@ -552,18 +553,33 @@ function convertVercelToolParameters(tool) {
|
|
|
552
553
|
if (isZodType(schema)) {
|
|
553
554
|
return schema;
|
|
554
555
|
} else {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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"));
|
|
560
565
|
}
|
|
561
|
-
return resolveSerializedZodOutput(jsonSchemaToZod__default.default(schemaToUse));
|
|
562
566
|
}
|
|
563
567
|
}
|
|
564
568
|
function convertInputSchema(tool) {
|
|
565
569
|
const schema = tool.inputSchema ?? zod.z.object({});
|
|
566
|
-
|
|
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
|
+
}
|
|
567
583
|
}
|
|
568
584
|
var CoreToolBuilder = class extends chunkEG74VBSP_cjs.MastraBase {
|
|
569
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';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DefaultVoice } from './chunk-NOPY74PV.js';
|
|
2
2
|
import { executeHook } from './chunk-BB4KXGBU.js';
|
|
3
|
-
import { MastraLLM } from './chunk-
|
|
3
|
+
import { MastraLLM } from './chunk-6DIL4BTD.js';
|
|
4
4
|
import { InstrumentClass } from './chunk-BFNYQFG2.js';
|
|
5
|
-
import { ensureToolProperties, ensureAllMessagesAreCoreMessages, makeCoreTool, createMastraProxy } from './chunk-
|
|
5
|
+
import { ensureToolProperties, ensureAllMessagesAreCoreMessages, makeCoreTool, createMastraProxy } from './chunk-D5PCSVU5.js';
|
|
6
6
|
import { MastraBase } from './chunk-235X76GC.js';
|
|
7
7
|
import { RegisteredLogger } from './chunk-CMPPXW4U.js';
|
|
8
8
|
import { RuntimeContext } from './chunk-SGGPJWRQ.js';
|
|
@@ -435,12 +435,13 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
435
435
|
messages,
|
|
436
436
|
threadId,
|
|
437
437
|
resourceId,
|
|
438
|
-
now
|
|
438
|
+
now,
|
|
439
|
+
experimental_generateMessageId
|
|
439
440
|
}) {
|
|
440
441
|
if (!messages) return [];
|
|
441
442
|
const messagesArray = Array.isArray(messages) ? messages : [messages];
|
|
442
443
|
return this.sanitizeResponseMessages(messagesArray).map((message, index) => {
|
|
443
|
-
const messageId = randomUUID();
|
|
444
|
+
const messageId = `id` in message && message.id || experimental_generateMessageId?.() || randomUUID();
|
|
444
445
|
let toolCallIds;
|
|
445
446
|
let toolCallArgs;
|
|
446
447
|
let toolNames;
|
|
@@ -953,7 +954,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
953
954
|
threadId: threadId2,
|
|
954
955
|
memoryConfig: memoryConfig2,
|
|
955
956
|
outputText,
|
|
956
|
-
runId: runId2
|
|
957
|
+
runId: runId2,
|
|
958
|
+
experimental_generateMessageId
|
|
957
959
|
}) => {
|
|
958
960
|
const resToLog = {
|
|
959
961
|
text: result?.text,
|
|
@@ -987,7 +989,7 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
987
989
|
const now = Date.now();
|
|
988
990
|
const threadMessages = this.sanitizeResponseMessages(ensureAllMessagesAreCoreMessages(messages)).map((u, index) => {
|
|
989
991
|
return {
|
|
990
|
-
id: this.getMemory()?.generateId(),
|
|
992
|
+
id: `id` in u && u.id || experimental_generateMessageId ? experimental_generateMessageId() : this.getMemory()?.generateId(),
|
|
991
993
|
createdAt: new Date(now + index),
|
|
992
994
|
threadId: thread.id,
|
|
993
995
|
resourceId,
|
|
@@ -1030,7 +1032,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1030
1032
|
threadId: threadId2,
|
|
1031
1033
|
resourceId,
|
|
1032
1034
|
messages: responseMessages,
|
|
1033
|
-
now: dateResponseMessagesFrom
|
|
1035
|
+
now: dateResponseMessagesFrom,
|
|
1036
|
+
experimental_generateMessageId
|
|
1034
1037
|
})],
|
|
1035
1038
|
memoryConfig: memoryConfig2
|
|
1036
1039
|
});
|
|
@@ -1153,7 +1156,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1153
1156
|
thread,
|
|
1154
1157
|
memoryConfig: memoryOptions,
|
|
1155
1158
|
outputText: outputText2,
|
|
1156
|
-
runId: runIdToUse
|
|
1159
|
+
runId: runIdToUse,
|
|
1160
|
+
experimental_generateMessageId: `experimental_generateMessageId` in rest ? rest.experimental_generateMessageId : void 0
|
|
1157
1161
|
});
|
|
1158
1162
|
const newResult = result2;
|
|
1159
1163
|
newResult.object = result2.experimental_output;
|
|
@@ -1184,7 +1188,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1184
1188
|
threadId,
|
|
1185
1189
|
memoryConfig: memoryOptions,
|
|
1186
1190
|
outputText: outputText2,
|
|
1187
|
-
runId: runIdToUse
|
|
1191
|
+
runId: runIdToUse,
|
|
1192
|
+
experimental_generateMessageId: `experimental_generateMessageId` in rest ? rest.experimental_generateMessageId : void 0
|
|
1188
1193
|
});
|
|
1189
1194
|
return result2;
|
|
1190
1195
|
}
|
|
@@ -1211,7 +1216,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1211
1216
|
threadId,
|
|
1212
1217
|
memoryConfig: memoryOptions,
|
|
1213
1218
|
outputText,
|
|
1214
|
-
runId: runIdToUse
|
|
1219
|
+
runId: runIdToUse,
|
|
1220
|
+
experimental_generateMessageId: `experimental_generateMessageId` in rest ? rest.experimental_generateMessageId : void 0
|
|
1215
1221
|
});
|
|
1216
1222
|
return result;
|
|
1217
1223
|
}
|
|
@@ -1301,7 +1307,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1301
1307
|
threadId,
|
|
1302
1308
|
memoryConfig: memoryOptions,
|
|
1303
1309
|
outputText,
|
|
1304
|
-
runId: runIdToUse
|
|
1310
|
+
runId: runIdToUse,
|
|
1311
|
+
experimental_generateMessageId: `experimental_generateMessageId` in rest ? rest.experimental_generateMessageId : void 0
|
|
1305
1312
|
});
|
|
1306
1313
|
} catch (e) {
|
|
1307
1314
|
this.logger.error("Error saving memory on finish", {
|
|
@@ -1342,7 +1349,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1342
1349
|
threadId,
|
|
1343
1350
|
memoryConfig: memoryOptions,
|
|
1344
1351
|
outputText,
|
|
1345
|
-
runId: runIdToUse
|
|
1352
|
+
runId: runIdToUse,
|
|
1353
|
+
experimental_generateMessageId: `experimental_generateMessageId` in rest ? rest.experimental_generateMessageId : void 0
|
|
1346
1354
|
});
|
|
1347
1355
|
} catch (e) {
|
|
1348
1356
|
this.logger.error("Error saving memory on finish", {
|
|
@@ -1381,7 +1389,8 @@ var Agent = class extends (_a = MastraBase) {
|
|
|
1381
1389
|
threadId,
|
|
1382
1390
|
memoryConfig: memoryOptions,
|
|
1383
1391
|
outputText,
|
|
1384
|
-
runId: runIdToUse
|
|
1392
|
+
runId: runIdToUse,
|
|
1393
|
+
experimental_generateMessageId: `experimental_generateMessageId` in rest ? rest.experimental_generateMessageId : void 0
|
|
1385
1394
|
});
|
|
1386
1395
|
} catch (e) {
|
|
1387
1396
|
this.logger.error("Error saving memory on finish", {
|