@mastra/core 0.10.14 → 0.10.15-alpha.0

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.
Files changed (75) hide show
  1. package/dist/agent/index.cjs +4 -4
  2. package/dist/agent/index.d.cts +1 -1
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +2 -2
  5. package/dist/{base-CS5eSXbL.d.cts → base-CTj7ESwt.d.cts} +24 -9
  6. package/dist/{base-DBhKcre4.d.ts → base-qVqAnB-c.d.ts} +24 -9
  7. package/dist/{chunk-2HDFKWFU.js → chunk-AOWJUV2N.js} +260 -94
  8. package/dist/{chunk-2GRYVZ2O.cjs → chunk-BVD7NVAR.cjs} +4 -4
  9. package/dist/{chunk-4UBOJFSL.js → chunk-DR4JS662.js} +1 -1
  10. package/dist/{chunk-DFFVEKIG.js → chunk-IBKM5CLQ.js} +22 -1
  11. package/dist/{chunk-E7AX3U6M.cjs → chunk-ID5LG5CQ.cjs} +5 -5
  12. package/dist/{chunk-VG4OPO2R.js → chunk-J62R4M7K.js} +2 -2
  13. package/dist/{chunk-7F6BQXE2.cjs → chunk-LBUQ6YNU.cjs} +22 -0
  14. package/dist/{chunk-EWCOOO3H.js → chunk-MVCHTRVB.js} +37 -6
  15. package/dist/{chunk-UX3B6S2I.cjs → chunk-Q33INUG2.cjs} +29 -13
  16. package/dist/{chunk-PA2YIVIT.js → chunk-RVFWMGGR.js} +28 -12
  17. package/dist/{chunk-YJEHXYK5.js → chunk-TTMYHBQM.js} +1 -1
  18. package/dist/{chunk-FBKJ3652.cjs → chunk-ULZ6MRTN.cjs} +54 -23
  19. package/dist/{chunk-7MZNOW6W.cjs → chunk-ZCU3PLIL.cjs} +261 -95
  20. package/dist/{chunk-QUSEDVYI.cjs → chunk-ZTPPDHQK.cjs} +3 -3
  21. package/dist/eval/index.d.cts +2 -2
  22. package/dist/eval/index.d.ts +2 -2
  23. package/dist/index.cjs +38 -34
  24. package/dist/index.d.cts +3 -3
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +7 -7
  27. package/dist/integration/index.d.cts +2 -2
  28. package/dist/integration/index.d.ts +2 -2
  29. package/dist/llm/index.d.cts +1 -1
  30. package/dist/llm/index.d.ts +1 -1
  31. package/dist/mastra/index.d.cts +2 -2
  32. package/dist/mastra/index.d.ts +2 -2
  33. package/dist/mcp/index.d.cts +2 -2
  34. package/dist/mcp/index.d.ts +2 -2
  35. package/dist/memory/index.cjs +4 -4
  36. package/dist/memory/index.d.cts +2 -2
  37. package/dist/memory/index.d.ts +2 -2
  38. package/dist/memory/index.js +1 -1
  39. package/dist/network/index.cjs +2 -2
  40. package/dist/network/index.d.cts +2 -2
  41. package/dist/network/index.d.ts +2 -2
  42. package/dist/network/index.js +1 -1
  43. package/dist/network/vNext/index.cjs +70 -63
  44. package/dist/network/vNext/index.d.cts +2 -2
  45. package/dist/network/vNext/index.d.ts +2 -2
  46. package/dist/network/vNext/index.js +59 -52
  47. package/dist/relevance/index.cjs +4 -4
  48. package/dist/relevance/index.d.cts +4 -3
  49. package/dist/relevance/index.d.ts +4 -3
  50. package/dist/relevance/index.js +1 -1
  51. package/dist/server/index.d.cts +3 -3
  52. package/dist/server/index.d.ts +3 -3
  53. package/dist/storage/index.cjs +2 -2
  54. package/dist/storage/index.d.cts +3 -3
  55. package/dist/storage/index.d.ts +3 -3
  56. package/dist/storage/index.js +1 -1
  57. package/dist/telemetry/index.d.cts +2 -2
  58. package/dist/telemetry/index.d.ts +2 -2
  59. package/dist/tools/index.d.cts +3 -3
  60. package/dist/tools/index.d.ts +3 -3
  61. package/dist/utils.cjs +18 -14
  62. package/dist/utils.d.cts +3 -2
  63. package/dist/utils.d.ts +3 -2
  64. package/dist/utils.js +1 -1
  65. package/dist/voice/index.d.cts +2 -2
  66. package/dist/voice/index.d.ts +2 -2
  67. package/dist/workflows/index.cjs +10 -10
  68. package/dist/workflows/index.d.cts +7 -4
  69. package/dist/workflows/index.d.ts +7 -4
  70. package/dist/workflows/index.js +1 -1
  71. package/dist/workflows/legacy/index.cjs +22 -22
  72. package/dist/workflows/legacy/index.d.cts +2 -2
  73. package/dist/workflows/legacy/index.d.ts +2 -2
  74. package/dist/workflows/legacy/index.js +1 -1
  75. package/package.json +2 -3
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var chunkFBKJ3652_cjs = require('../chunk-FBKJ3652.cjs');
4
- var chunkQUSEDVYI_cjs = require('../chunk-QUSEDVYI.cjs');
3
+ var chunkULZ6MRTN_cjs = require('../chunk-ULZ6MRTN.cjs');
4
+ var chunkZTPPDHQK_cjs = require('../chunk-ZTPPDHQK.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "Agent", {
9
9
  enumerable: true,
10
- get: function () { return chunkFBKJ3652_cjs.Agent; }
10
+ get: function () { return chunkULZ6MRTN_cjs.Agent; }
11
11
  });
12
12
  Object.defineProperty(exports, "MessageList", {
13
13
  enumerable: true,
14
- get: function () { return chunkQUSEDVYI_cjs.MessageList; }
14
+ get: function () { return chunkZTPPDHQK_cjs.MessageList; }
15
15
  });
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-CS5eSXbL.cjs';
4
+ export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-CTj7ESwt.cjs';
5
5
  import '../base-B_y9sMg0.cjs';
6
6
  import '../types-Bo1uigWx.cjs';
7
7
  import '../runtime-context/index.cjs';
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-DBhKcre4.js';
4
+ export { A as Agent, av as AgentConfig, c6 as AgentGenerateOptions, c5 as AgentMemoryOption, c7 as AgentStreamOptions, aZ as DynamicArgument, aY as MastraLanguageModel, c8 as MastraMessageContentV2, t as MastraMessageV2, c3 as MessageList, T as ToolsInput, c4 as ToolsetsInput } from '../base-qVqAnB-c.js';
5
5
  import '../base-ClrXcCRx.js';
6
6
  import '../types-Bo1uigWx.js';
7
7
  import '../runtime-context/index.js';
@@ -1,2 +1,2 @@
1
- export { Agent } from '../chunk-EWCOOO3H.js';
2
- export { MessageList } from '../chunk-4UBOJFSL.js';
1
+ export { Agent } from '../chunk-MVCHTRVB.js';
2
+ export { MessageList } from '../chunk-DR4JS662.js';
@@ -1,8 +1,8 @@
1
1
  import { Tool as Tool$2, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, TextStreamPart, UserContent, AssistantContent, ToolContent, EmbeddingModel, UIMessage, Message, IDGenerator as IDGenerator$1, CoreSystemMessage as CoreSystemMessage$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback } from 'ai';
2
2
  import { M as MastraBase, a as Telemetry, O as OtelConfig, T as Trace } from './base-B_y9sMg0.cjs';
3
+ import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
3
4
  import { z, ZodSchema, ZodObject } from 'zod';
4
5
  import { B as BaseLogMessage, R as RegisteredLogger, I as IMastraLogger, a as LogLevel } from './logger-B8XXh6ya.cjs';
5
- import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
6
6
  import { M as Metric, a as MetricResult, T as TestInfo } from './types-Bo1uigWx.cjs';
7
7
  import { Query } from 'sift';
8
8
  import { RuntimeContext } from './runtime-context/index.cjs';
@@ -1312,6 +1312,7 @@ interface WorkflowRunState {
1312
1312
  status: WorkflowRunStatus;
1313
1313
  result?: Record<string, any>;
1314
1314
  error?: string | Error;
1315
+ runtimeContext?: Record<string, any>;
1315
1316
  value: Record<string, string>;
1316
1317
  context: {
1317
1318
  input?: Record<string, any>;
@@ -1356,6 +1357,7 @@ declare abstract class ExecutionEngine extends MastraBase {
1356
1357
  stepResults: Record<string, StepResult<any, any, any, any>>;
1357
1358
  resumePayload: any;
1358
1359
  resumePath: number[];
1360
+ snapshotRuntimeContext?: Record<string, any>;
1359
1361
  };
1360
1362
  emitter: Emitter;
1361
1363
  runtimeContext: RuntimeContext;
@@ -1645,7 +1647,7 @@ declare class Workflow<TEngineType = any, TSteps extends Step<string, any, any,
1645
1647
  createRunAsync(options?: {
1646
1648
  runId?: string;
1647
1649
  }): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
1648
- execute({ inputData, resumeData, suspend, resume, [EMITTER_SYMBOL]: emitter, mastra, runtimeContext, abort, abortSignal, }: {
1650
+ execute({ inputData, resumeData, suspend, resume, [EMITTER_SYMBOL]: emitter, mastra, runtimeContext, abort, abortSignal, runCount, }: {
1649
1651
  inputData: z.infer<TInput>;
1650
1652
  resumeData?: any;
1651
1653
  getStepResult<T extends Step<any, any, any, any, any, TEngineType>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
@@ -1664,6 +1666,7 @@ declare class Workflow<TEngineType = any, TSteps extends Step<string, any, any,
1664
1666
  abortSignal: AbortSignal;
1665
1667
  bail: (result: any) => any;
1666
1668
  abort: () => any;
1669
+ runCount?: number;
1667
1670
  }): Promise<z.infer<TOutput>>;
1668
1671
  getWorkflowRuns(args?: {
1669
1672
  fromDate?: Date;
@@ -1757,6 +1760,7 @@ declare class Run<TEngineType = any, TSteps extends Step<string, any, any, any,
1757
1760
  resumeData?: z.infer<TResumeSchema>;
1758
1761
  step: Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[];
1759
1762
  runtimeContext?: RuntimeContext;
1763
+ runCount?: number;
1760
1764
  }): Promise<WorkflowResult<TOutput, TSteps>>;
1761
1765
  /**
1762
1766
  * Returns the current state of the workflow run
@@ -1908,7 +1912,7 @@ type TemplateWorkingMemory = BaseWorkingMemory & {
1908
1912
  schema?: never;
1909
1913
  };
1910
1914
  type SchemaWorkingMemory = BaseWorkingMemory & {
1911
- schema: ZodObject<any>;
1915
+ schema: ZodObject<any> | JSONSchema7;
1912
1916
  template?: never;
1913
1917
  };
1914
1918
  type WorkingMemoryNone = BaseWorkingMemory & {
@@ -2249,19 +2253,29 @@ declare abstract class MastraMemory extends MastraBase {
2249
2253
  /**
2250
2254
  * Retrieves working memory for a specific thread
2251
2255
  * @param threadId - The unique identifier of the thread
2252
- * @param format - Optional format for the returned data ('json' or 'markdown')
2256
+ * @param resourceId - The unique identifier of the resource
2257
+ * @param memoryConfig - Optional memory configuration
2253
2258
  * @returns Promise resolving to working memory data or null if not found
2254
2259
  */
2255
- abstract getWorkingMemory({ threadId, }: {
2260
+ abstract getWorkingMemory({ threadId, resourceId, memoryConfig, }: {
2256
2261
  threadId: string;
2257
- format?: 'json' | 'markdown';
2258
- }): Promise<Record<string, any> | string | null>;
2262
+ resourceId?: string;
2263
+ memoryConfig?: MemoryConfig;
2264
+ }): Promise<string | null>;
2259
2265
  /**
2260
2266
  * Retrieves working memory template for a specific thread
2261
- * @param threadId - The unique identifier of the thread
2267
+ * @param memoryConfig - Optional memory configuration
2262
2268
  * @returns Promise resolving to working memory template or null if not found
2263
2269
  */
2264
- abstract getWorkingMemoryTemplate(): Promise<WorkingMemoryTemplate | null>;
2270
+ abstract getWorkingMemoryTemplate({ memoryConfig, }?: {
2271
+ memoryConfig?: MemoryConfig;
2272
+ }): Promise<WorkingMemoryTemplate | null>;
2273
+ abstract updateWorkingMemory({ threadId, resourceId, workingMemory, memoryConfig, }: {
2274
+ threadId: string;
2275
+ resourceId?: string;
2276
+ workingMemory: string;
2277
+ memoryConfig?: MemoryConfig;
2278
+ }): Promise<void>;
2265
2279
  }
2266
2280
 
2267
2281
  declare abstract class MastraLLMBase extends MastraBase {
@@ -2748,6 +2762,7 @@ declare class NewAgentNetwork extends MastraBase {
2748
2762
  name: string;
2749
2763
  constructor({ id, name, instructions, model, agents, workflows, memory, tools, defaultAgent, }: NewAgentNetworkConfig);
2750
2764
  __registerMastra(mastra: Mastra): void;
2765
+ private beforeRun;
2751
2766
  getAgents({ runtimeContext }: {
2752
2767
  runtimeContext?: RuntimeContext;
2753
2768
  }): Promise<Record<string, Agent<string, ToolsInput, Record<string, Metric>>>>;
@@ -1,8 +1,8 @@
1
1
  import { Tool as Tool$2, Schema, ToolExecutionOptions, LanguageModelV1, CoreMessage as CoreMessage$1, GenerateTextResult, GenerateObjectResult, StreamTextResult, StreamObjectResult, TextStreamPart, UserContent, AssistantContent, ToolContent, EmbeddingModel, UIMessage, Message, IDGenerator as IDGenerator$1, CoreSystemMessage as CoreSystemMessage$1, DeepPartial, generateText, generateObject, streamText, streamObject, TelemetrySettings, CoreAssistantMessage as CoreAssistantMessage$1, CoreUserMessage as CoreUserMessage$1, CoreToolMessage as CoreToolMessage$1, EmbedResult as EmbedResult$1, EmbedManyResult as EmbedManyResult$1, GenerateTextOnStepFinishCallback, StreamTextOnFinishCallback, StreamObjectOnFinishCallback, StreamTextOnStepFinishCallback } from 'ai';
2
2
  import { M as MastraBase, a as Telemetry, O as OtelConfig, T as Trace } from './base-ClrXcCRx.js';
3
+ import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
3
4
  import { z, ZodSchema, ZodObject } from 'zod';
4
5
  import { B as BaseLogMessage, R as RegisteredLogger, I as IMastraLogger, a as LogLevel } from './logger-Bpa2oLL4.js';
5
- import { JSONSchema7Type, JSONSchema7 } from 'json-schema';
6
6
  import { M as Metric, a as MetricResult, T as TestInfo } from './types-Bo1uigWx.js';
7
7
  import { Query } from 'sift';
8
8
  import { RuntimeContext } from './runtime-context/index.js';
@@ -1312,6 +1312,7 @@ interface WorkflowRunState {
1312
1312
  status: WorkflowRunStatus;
1313
1313
  result?: Record<string, any>;
1314
1314
  error?: string | Error;
1315
+ runtimeContext?: Record<string, any>;
1315
1316
  value: Record<string, string>;
1316
1317
  context: {
1317
1318
  input?: Record<string, any>;
@@ -1356,6 +1357,7 @@ declare abstract class ExecutionEngine extends MastraBase {
1356
1357
  stepResults: Record<string, StepResult<any, any, any, any>>;
1357
1358
  resumePayload: any;
1358
1359
  resumePath: number[];
1360
+ snapshotRuntimeContext?: Record<string, any>;
1359
1361
  };
1360
1362
  emitter: Emitter;
1361
1363
  runtimeContext: RuntimeContext;
@@ -1645,7 +1647,7 @@ declare class Workflow<TEngineType = any, TSteps extends Step<string, any, any,
1645
1647
  createRunAsync(options?: {
1646
1648
  runId?: string;
1647
1649
  }): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
1648
- execute({ inputData, resumeData, suspend, resume, [EMITTER_SYMBOL]: emitter, mastra, runtimeContext, abort, abortSignal, }: {
1650
+ execute({ inputData, resumeData, suspend, resume, [EMITTER_SYMBOL]: emitter, mastra, runtimeContext, abort, abortSignal, runCount, }: {
1649
1651
  inputData: z.infer<TInput>;
1650
1652
  resumeData?: any;
1651
1653
  getStepResult<T extends Step<any, any, any, any, any, TEngineType>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
@@ -1664,6 +1666,7 @@ declare class Workflow<TEngineType = any, TSteps extends Step<string, any, any,
1664
1666
  abortSignal: AbortSignal;
1665
1667
  bail: (result: any) => any;
1666
1668
  abort: () => any;
1669
+ runCount?: number;
1667
1670
  }): Promise<z.infer<TOutput>>;
1668
1671
  getWorkflowRuns(args?: {
1669
1672
  fromDate?: Date;
@@ -1757,6 +1760,7 @@ declare class Run<TEngineType = any, TSteps extends Step<string, any, any, any,
1757
1760
  resumeData?: z.infer<TResumeSchema>;
1758
1761
  step: Step<string, any, any, TResumeSchema, any, TEngineType> | [...Step<string, any, any, any, any, TEngineType>[], Step<string, any, any, TResumeSchema, any, TEngineType>] | string | string[];
1759
1762
  runtimeContext?: RuntimeContext;
1763
+ runCount?: number;
1760
1764
  }): Promise<WorkflowResult<TOutput, TSteps>>;
1761
1765
  /**
1762
1766
  * Returns the current state of the workflow run
@@ -1908,7 +1912,7 @@ type TemplateWorkingMemory = BaseWorkingMemory & {
1908
1912
  schema?: never;
1909
1913
  };
1910
1914
  type SchemaWorkingMemory = BaseWorkingMemory & {
1911
- schema: ZodObject<any>;
1915
+ schema: ZodObject<any> | JSONSchema7;
1912
1916
  template?: never;
1913
1917
  };
1914
1918
  type WorkingMemoryNone = BaseWorkingMemory & {
@@ -2249,19 +2253,29 @@ declare abstract class MastraMemory extends MastraBase {
2249
2253
  /**
2250
2254
  * Retrieves working memory for a specific thread
2251
2255
  * @param threadId - The unique identifier of the thread
2252
- * @param format - Optional format for the returned data ('json' or 'markdown')
2256
+ * @param resourceId - The unique identifier of the resource
2257
+ * @param memoryConfig - Optional memory configuration
2253
2258
  * @returns Promise resolving to working memory data or null if not found
2254
2259
  */
2255
- abstract getWorkingMemory({ threadId, }: {
2260
+ abstract getWorkingMemory({ threadId, resourceId, memoryConfig, }: {
2256
2261
  threadId: string;
2257
- format?: 'json' | 'markdown';
2258
- }): Promise<Record<string, any> | string | null>;
2262
+ resourceId?: string;
2263
+ memoryConfig?: MemoryConfig;
2264
+ }): Promise<string | null>;
2259
2265
  /**
2260
2266
  * Retrieves working memory template for a specific thread
2261
- * @param threadId - The unique identifier of the thread
2267
+ * @param memoryConfig - Optional memory configuration
2262
2268
  * @returns Promise resolving to working memory template or null if not found
2263
2269
  */
2264
- abstract getWorkingMemoryTemplate(): Promise<WorkingMemoryTemplate | null>;
2270
+ abstract getWorkingMemoryTemplate({ memoryConfig, }?: {
2271
+ memoryConfig?: MemoryConfig;
2272
+ }): Promise<WorkingMemoryTemplate | null>;
2273
+ abstract updateWorkingMemory({ threadId, resourceId, workingMemory, memoryConfig, }: {
2274
+ threadId: string;
2275
+ resourceId?: string;
2276
+ workingMemory: string;
2277
+ memoryConfig?: MemoryConfig;
2278
+ }): Promise<void>;
2265
2279
  }
2266
2280
 
2267
2281
  declare abstract class MastraLLMBase extends MastraBase {
@@ -2748,6 +2762,7 @@ declare class NewAgentNetwork extends MastraBase {
2748
2762
  name: string;
2749
2763
  constructor({ id, name, instructions, model, agents, workflows, memory, tools, defaultAgent, }: NewAgentNetworkConfig);
2750
2764
  __registerMastra(mastra: Mastra): void;
2765
+ private beforeRun;
2751
2766
  getAgents({ runtimeContext }: {
2752
2767
  runtimeContext?: RuntimeContext;
2753
2768
  }): Promise<Record<string, Agent<string, ToolsInput, Record<string, Metric>>>>;