@mastra/core 0.10.7-alpha.2 → 0.10.7-alpha.4

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 (65) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +1 -1
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-CMxzr6xS.d.ts → base-DVaOuGyL.d.ts} +17 -17
  6. package/dist/{base-Iuc13_Xi.d.cts → base-D_hcRjcY.d.cts} +17 -17
  7. package/dist/{chunk-BORK5RLV.cjs → chunk-42FURHI4.cjs} +61 -2
  8. package/dist/{chunk-O6I3DMFJ.cjs → chunk-GF7LQBIM.cjs} +2 -2
  9. package/dist/{chunk-RTAJP2CD.cjs → chunk-I27AAGKV.cjs} +38 -19
  10. package/dist/{chunk-4IRVLBOR.js → chunk-JQ7TNWEG.js} +1 -1
  11. package/dist/{chunk-B7J2G7T6.js → chunk-LVQUY7BQ.js} +0 -8
  12. package/dist/{chunk-LHICPZJH.cjs → chunk-RG3R4Z7I.cjs} +0 -8
  13. package/dist/{chunk-VG7ARQXY.js → chunk-RJWOQVNO.js} +60 -1
  14. package/dist/{chunk-LDESW23C.js → chunk-SSDOXKZK.js} +38 -19
  15. package/dist/eval/index.d.cts +1 -1
  16. package/dist/eval/index.d.ts +1 -1
  17. package/dist/index.cjs +20 -20
  18. package/dist/index.d.cts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +6 -6
  21. package/dist/integration/index.d.cts +1 -1
  22. package/dist/integration/index.d.ts +1 -1
  23. package/dist/llm/index.d.cts +1 -1
  24. package/dist/llm/index.d.ts +1 -1
  25. package/dist/mastra/index.d.cts +1 -1
  26. package/dist/mastra/index.d.ts +1 -1
  27. package/dist/mcp/index.d.cts +1 -1
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/memory/index.cjs +4 -4
  30. package/dist/memory/index.d.cts +1 -1
  31. package/dist/memory/index.d.ts +1 -1
  32. package/dist/memory/index.js +1 -1
  33. package/dist/network/index.cjs +2 -2
  34. package/dist/network/index.d.cts +1 -1
  35. package/dist/network/index.d.ts +1 -1
  36. package/dist/network/index.js +1 -1
  37. package/dist/network/vNext/index.cjs +13 -13
  38. package/dist/network/vNext/index.d.cts +1 -1
  39. package/dist/network/vNext/index.d.ts +1 -1
  40. package/dist/network/vNext/index.js +2 -2
  41. package/dist/relevance/index.cjs +4 -4
  42. package/dist/relevance/index.d.cts +1 -1
  43. package/dist/relevance/index.d.ts +1 -1
  44. package/dist/relevance/index.js +1 -1
  45. package/dist/server/index.d.cts +2 -2
  46. package/dist/server/index.d.ts +2 -2
  47. package/dist/storage/index.d.cts +2 -2
  48. package/dist/storage/index.d.ts +2 -2
  49. package/dist/telemetry/index.d.cts +1 -1
  50. package/dist/telemetry/index.d.ts +1 -1
  51. package/dist/tools/index.d.cts +2 -2
  52. package/dist/tools/index.d.ts +2 -2
  53. package/dist/utils.d.cts +1 -1
  54. package/dist/utils.d.ts +1 -1
  55. package/dist/voice/index.d.cts +1 -1
  56. package/dist/voice/index.d.ts +1 -1
  57. package/dist/workflows/index.cjs +10 -10
  58. package/dist/workflows/index.d.cts +2 -2
  59. package/dist/workflows/index.d.ts +2 -2
  60. package/dist/workflows/index.js +1 -1
  61. package/dist/workflows/legacy/index.cjs +22 -22
  62. package/dist/workflows/legacy/index.d.cts +2 -2
  63. package/dist/workflows/legacy/index.d.ts +2 -2
  64. package/dist/workflows/legacy/index.js +1 -1
  65. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkRTAJP2CD_cjs = require('../chunk-RTAJP2CD.cjs');
3
+ var chunkI27AAGKV_cjs = require('../chunk-I27AAGKV.cjs');
4
4
  var chunkYNZWZHUB_cjs = require('../chunk-YNZWZHUB.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "Agent", {
9
9
  enumerable: true,
10
- get: function () { return chunkRTAJP2CD_cjs.Agent; }
10
+ get: function () { return chunkI27AAGKV_cjs.Agent; }
11
11
  });
12
12
  Object.defineProperty(exports, "MessageList", {
13
13
  enumerable: true,
@@ -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, c4 as AgentGenerateOptions, c3 as AgentMemoryOption, c5 as AgentStreamOptions, c2 as DynamicArgument, bC as MastraLanguageModel, c6 as MastraMessageContentV2, t as MastraMessageV2, c0 as MessageList, T as ToolsInput, c1 as ToolsetsInput } from '../base-Iuc13_Xi.cjs';
4
+ export { A as Agent, av as AgentConfig, c5 as AgentGenerateOptions, c4 as AgentMemoryOption, c6 as AgentStreamOptions, c3 as DynamicArgument, bD as MastraLanguageModel, c7 as MastraMessageContentV2, t as MastraMessageV2, c1 as MessageList, T as ToolsInput, c2 as ToolsetsInput } from '../base-D_hcRjcY.cjs';
5
5
  import '../base-DVVTzIQy.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, c4 as AgentGenerateOptions, c3 as AgentMemoryOption, c5 as AgentStreamOptions, c2 as DynamicArgument, bC as MastraLanguageModel, c6 as MastraMessageContentV2, t as MastraMessageV2, c0 as MessageList, T as ToolsInput, c1 as ToolsetsInput } from '../base-CMxzr6xS.js';
4
+ export { A as Agent, av as AgentConfig, c5 as AgentGenerateOptions, c4 as AgentMemoryOption, c6 as AgentStreamOptions, c3 as DynamicArgument, bD as MastraLanguageModel, c7 as MastraMessageContentV2, t as MastraMessageV2, c1 as MessageList, T as ToolsInput, c2 as ToolsetsInput } from '../base-DVaOuGyL.js';
5
5
  import '../base-BbdvunNJ.js';
6
6
  import '../types-Bo1uigWx.js';
7
7
  import '../runtime-context/index.js';
@@ -1,2 +1,2 @@
1
- export { Agent } from '../chunk-LDESW23C.js';
1
+ export { Agent } from '../chunk-SSDOXKZK.js';
2
2
  export { MessageList } from '../chunk-ZAWJEWYW.js';
@@ -1170,7 +1170,8 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, Eng
1170
1170
  getInitData<T extends z.ZodType<any>>(): z.infer<T>;
1171
1171
  getInitData<T extends Workflow<any, any, any, any, any>>(): T extends undefined ? unknown : z.infer<NonNullable<T['inputSchema']>>;
1172
1172
  getStepResult<T extends Step<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
1173
- suspend(suspendPayload: TSuspendSchema): Promise<void>;
1173
+ suspend(suspendPayload: TSuspendSchema): Promise<any>;
1174
+ bail(result: any): any;
1174
1175
  resume?: {
1175
1176
  steps: string[];
1176
1177
  resumePayload: any;
@@ -1271,21 +1272,22 @@ type StreamEvent = TextStreamPart<any> | {
1271
1272
  payload: any;
1272
1273
  id: string;
1273
1274
  };
1275
+ type WorkflowRunStatus = 'running' | 'success' | 'failed' | 'suspended' | 'waiting' | 'pending';
1274
1276
  type WatchEvent = {
1275
1277
  type: 'watch';
1276
1278
  payload: {
1277
1279
  currentStep?: {
1278
1280
  id: string;
1279
- status: 'running' | 'success' | 'failed' | 'suspended' | 'waiting';
1281
+ status: WorkflowRunStatus;
1280
1282
  output?: Record<string, any>;
1281
1283
  resumePayload?: Record<string, any>;
1282
1284
  payload?: Record<string, any>;
1283
1285
  error?: string | Error;
1284
1286
  };
1285
1287
  workflowState: {
1286
- status: 'running' | 'success' | 'failed' | 'suspended' | 'waiting';
1288
+ status: WorkflowRunStatus;
1287
1289
  steps: Record<string, {
1288
- status: 'running' | 'success' | 'failed' | 'suspended' | 'waiting';
1290
+ status: WorkflowRunStatus;
1289
1291
  output?: Record<string, any>;
1290
1292
  payload?: Record<string, any>;
1291
1293
  resumePayload?: Record<string, any>;
@@ -1305,7 +1307,7 @@ type WatchEvent = {
1305
1307
  type ZodPathType<T extends z.ZodTypeAny, P extends string> = T extends z.ZodObject<infer Shape> ? P extends `${infer Key}.${infer Rest}` ? Key extends keyof Shape ? Shape[Key] extends z.ZodTypeAny ? ZodPathType<Shape[Key], Rest> : never : never : P extends keyof Shape ? Shape[P] : never : never;
1306
1308
  interface WorkflowRunState {
1307
1309
  runId: string;
1308
- status: 'success' | 'failed' | 'suspended' | 'running' | 'waiting';
1310
+ status: WorkflowRunStatus;
1309
1311
  result?: Record<string, any>;
1310
1312
  error?: string | Error;
1311
1313
  value: Record<string, string>;
@@ -1623,11 +1625,19 @@ declare class Workflow<TEngineType = any, TSteps extends Step<string, any, any,
1623
1625
  createRun(options?: {
1624
1626
  runId?: string;
1625
1627
  }): Run<TEngineType, TSteps, TInput, TOutput>;
1628
+ /**
1629
+ * Creates a new workflow run instance and stores a snapshot of the workflow in the storage
1630
+ * @param options Optional configuration for the run
1631
+ * @returns A Run instance that can be used to execute the workflow
1632
+ */
1633
+ createRunAsync(options?: {
1634
+ runId?: string;
1635
+ }): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
1626
1636
  execute({ inputData, resumeData, suspend, resume, [EMITTER_SYMBOL]: emitter, mastra, runtimeContext, }: {
1627
1637
  inputData: z.infer<TInput>;
1628
1638
  resumeData?: any;
1629
1639
  getStepResult<T extends Step<any, any, any, any, any, TEngineType>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
1630
- suspend: (suspendPayload: any) => Promise<void>;
1640
+ suspend: (suspendPayload: any) => Promise<any>;
1631
1641
  resume?: {
1632
1642
  steps: string[];
1633
1643
  resumePayload: any;
@@ -2085,16 +2095,6 @@ declare abstract class MastraMemory extends MastraBase {
2085
2095
  resourceId?: string;
2086
2096
  memoryConfig?: MemoryConfig;
2087
2097
  }): Promise<string | null>;
2088
- /**
2089
- * Get a user context message to inject into the conversation.
2090
- * This will be called before each conversation turn.
2091
- * Implementations can override this to inject custom system messages.
2092
- */
2093
- getUserContextMessage(_input: {
2094
- threadId: string;
2095
- resourceId?: string;
2096
- memoryConfig?: MemoryConfig;
2097
- }): Promise<string | null>;
2098
2098
  /**
2099
2099
  * Get tools that should be available to the agent.
2100
2100
  * This will be called when converting tools for the agent.
@@ -3946,4 +3946,4 @@ declare abstract class MastraStorage extends MastraBase {
3946
3946
  }>;
3947
3947
  }
3948
3948
 
3949
- export { type StepGraph as $, Agent as A, type PaginationArgs as B, type CoreTool as C, type StorageGetTracesArg as D, type EvalRow as E, TABLE_WORKFLOW_SNAPSHOT as F, TABLE_EVALS as G, TABLE_MESSAGES as H, TABLE_THREADS as I, TABLE_TRACES as J, TABLE_RESOURCES as K, LegacyWorkflow as L, Mastra as M, NewAgentNetwork as N, TABLE_SCHEMAS as O, type PaginationInfo as P, type VariableReference$1 as Q, type StepResult$1 as R, type StepExecutionContext as S, type ToolsInput as T, type StepAction as U, type VercelTool as V, type WorkflowContext as W, type LegacyWorkflowRunResult as X, type WorkflowOptions as Y, type StepVariableType as Z, type StepNode as _, type MastraPrimitives as a, type MemoryConfig as a$, type RetryConfig as a0, type BaseCondition as a1, type ActionContext as a2, WhenConditionReturnValue as a3, type StepDef as a4, type StepCondition as a5, type StepConfig as a6, type StepsRecord$1 as a7, type WorkflowLogMessage as a8, type WorkflowEvent as a9, type CoreSystemMessage as aA, type CoreAssistantMessage as aB, type CoreUserMessage as aC, type CoreToolMessage as aD, type EmbedResult as aE, type EmbedManyResult as aF, type BaseStructuredOutputType as aG, type StructuredOutputType as aH, type StructuredOutputArrayItem as aI, type StructuredOutput as aJ, type GenerateReturn as aK, type StreamReturn as aL, type OutputType as aM, type DefaultLLMTextOptions as aN, type DefaultLLMTextObjectOptions as aO, type DefaultLLMStreamOptions as aP, type DefaultLLMStreamObjectOptions as aQ, type LLMTextOptions as aR, type LLMTextObjectOptions as aS, type LLMStreamOptions as aT, type LLMInnerStreamOptions as aU, type LLMStreamObjectOptions as aV, createMockModel as aW, type Config as aX, type MessageType as aY, type MessageResponse as aZ, type WorkingMemory as a_, type ResolverFunctionInput as aa, type ResolverFunctionOutput as ab, type SubscriberFunctionOutput as ac, type DependencyCheckOutput as ad, type StepResolverOutput as ae, type WorkflowActors as af, type WorkflowActionParams as ag, type WorkflowActions as ah, type LegacyWorkflowState as ai, type StepId as aj, type ExtractSchemaFromStep$1 as ak, type ExtractStepResult as al, type StepInputType as am, type ExtractSchemaType$1 as an, type PathsToStringProps$1 as ao, type LegacyWorkflowRunState as ap, type WorkflowResumeResult as aq, Tool$1 as ar, createTool as as, type InternalCoreTool as at, type ToolExecutionContext as au, type AgentConfig as av, type DefaultEngineType as aw, type WorkflowConfig as ax, type LanguageModel as ay, type CoreMessage as az, MastraMemory as b, type MCPToolType as b$, type SharedMemoryConfig as b0, type TraceType as b1, type WorkingMemoryFormat as b2, type WorkingMemoryTemplate as b3, type MemoryProcessorOpts as b4, MemoryProcessor as b5, memoryDefaultOptions as b6, Tool as b7, type StepFlowEntry as b8, type SerializedStep as b9, type ZodPathType as bA, type WorkflowRunState as bB, type MastraLanguageModel as bC, type AgentNetworkConfig as bD, type VoiceEventType as bE, type VoiceEventMap as bF, type VoiceConfig as bG, MastraVoice as bH, CompositeVoice as bI, DefaultVoice as bJ, type ConvertedTool as bK, type MCPServerSSEOptions as bL, type MCPServerHonoSSEOptions as bM, type MCPServerHTTPOptions as bN, type Repository as bO, type VersionDetail as bP, type ArgumentInfo as bQ, type PositionalArgumentInfo as bR, type NamedArgumentInfo as bS, type SubcommandInfo as bT, type CommandInfo as bU, type EnvironmentVariableInfo as bV, type PackageInfo as bW, type RemoteInfo as bX, type MCPServerConfig as bY, type ServerInfo as bZ, type ServerDetailInfo as b_, type SerializedStepFlowEntry as ba, mapVariable as bb, createStep as bc, cloneStep as bd, createWorkflow as be, cloneWorkflow as bf, type WorkflowResult as bg, Run as bh, type ExecutionGraph as bi, ExecutionEngine as bj, type ExecuteFunction as bk, type Emitter as bl, type StepSuccess as bm, type StepFailure as bn, type StepSuspended as bo, type StepRunning as bp, type StepWaiting as bq, type StepResult as br, type StepsRecord as bs, type DynamicMapping as bt, type PathsToStringProps as bu, type ExtractSchemaType as bv, type ExtractSchemaFromStep as bw, type VariableReference as bx, type StreamEvent as by, type WatchEvent as bz, type ToolAction as c, MessageList as c0, type ToolsetsInput as c1, type DynamicArgument as c2, type AgentMemoryOption as c3, type AgentGenerateOptions as c4, type AgentStreamOptions as c5, type MastraMessageContentV2 as c6, LegacyStep as d, Workflow as e, type Step as f, AgentNetwork as g, MCPServerBase as h, type Methods as i, type ApiRoute as j, type MastraAuthConfig as k, type ContextWithMastra as l, MastraAuthProvider as m, type MastraAuthProviderOptions as n, MastraStorage as o, type TABLE_NAMES as p, type StorageColumn as q, type StorageThreadType as r, type StorageResourceType as s, type MastraMessageV2 as t, type StorageGetMessagesArg as u, type MastraMessageV1 as v, type WorkflowRuns as w, type WorkflowRun as x, type LegacyWorkflowRuns as y, type LegacyWorkflowRun as z };
3949
+ export { type StepGraph as $, Agent as A, type PaginationArgs as B, type CoreTool as C, type StorageGetTracesArg as D, type EvalRow as E, TABLE_WORKFLOW_SNAPSHOT as F, TABLE_EVALS as G, TABLE_MESSAGES as H, TABLE_THREADS as I, TABLE_TRACES as J, TABLE_RESOURCES as K, LegacyWorkflow as L, Mastra as M, NewAgentNetwork as N, TABLE_SCHEMAS as O, type PaginationInfo as P, type VariableReference$1 as Q, type StepResult$1 as R, type StepExecutionContext as S, type ToolsInput as T, type StepAction as U, type VercelTool as V, type WorkflowContext as W, type LegacyWorkflowRunResult as X, type WorkflowOptions as Y, type StepVariableType as Z, type StepNode as _, type MastraPrimitives as a, type MemoryConfig as a$, type RetryConfig as a0, type BaseCondition as a1, type ActionContext as a2, WhenConditionReturnValue as a3, type StepDef as a4, type StepCondition as a5, type StepConfig as a6, type StepsRecord$1 as a7, type WorkflowLogMessage as a8, type WorkflowEvent as a9, type CoreSystemMessage as aA, type CoreAssistantMessage as aB, type CoreUserMessage as aC, type CoreToolMessage as aD, type EmbedResult as aE, type EmbedManyResult as aF, type BaseStructuredOutputType as aG, type StructuredOutputType as aH, type StructuredOutputArrayItem as aI, type StructuredOutput as aJ, type GenerateReturn as aK, type StreamReturn as aL, type OutputType as aM, type DefaultLLMTextOptions as aN, type DefaultLLMTextObjectOptions as aO, type DefaultLLMStreamOptions as aP, type DefaultLLMStreamObjectOptions as aQ, type LLMTextOptions as aR, type LLMTextObjectOptions as aS, type LLMStreamOptions as aT, type LLMInnerStreamOptions as aU, type LLMStreamObjectOptions as aV, createMockModel as aW, type Config as aX, type MessageType as aY, type MessageResponse as aZ, type WorkingMemory as a_, type ResolverFunctionInput as aa, type ResolverFunctionOutput as ab, type SubscriberFunctionOutput as ac, type DependencyCheckOutput as ad, type StepResolverOutput as ae, type WorkflowActors as af, type WorkflowActionParams as ag, type WorkflowActions as ah, type LegacyWorkflowState as ai, type StepId as aj, type ExtractSchemaFromStep$1 as ak, type ExtractStepResult as al, type StepInputType as am, type ExtractSchemaType$1 as an, type PathsToStringProps$1 as ao, type LegacyWorkflowRunState as ap, type WorkflowResumeResult as aq, Tool$1 as ar, createTool as as, type InternalCoreTool as at, type ToolExecutionContext as au, type AgentConfig as av, type DefaultEngineType as aw, type WorkflowConfig as ax, type LanguageModel as ay, type CoreMessage as az, MastraMemory as b, type ServerDetailInfo as b$, type SharedMemoryConfig as b0, type TraceType as b1, type WorkingMemoryFormat as b2, type WorkingMemoryTemplate as b3, type MemoryProcessorOpts as b4, MemoryProcessor as b5, memoryDefaultOptions as b6, Tool as b7, type StepFlowEntry as b8, type SerializedStep as b9, type WatchEvent as bA, type ZodPathType as bB, type WorkflowRunState as bC, type MastraLanguageModel as bD, type AgentNetworkConfig as bE, type VoiceEventType as bF, type VoiceEventMap as bG, type VoiceConfig as bH, MastraVoice as bI, CompositeVoice as bJ, DefaultVoice as bK, type ConvertedTool as bL, type MCPServerSSEOptions as bM, type MCPServerHonoSSEOptions as bN, type MCPServerHTTPOptions as bO, type Repository as bP, type VersionDetail as bQ, type ArgumentInfo as bR, type PositionalArgumentInfo as bS, type NamedArgumentInfo as bT, type SubcommandInfo as bU, type CommandInfo as bV, type EnvironmentVariableInfo as bW, type PackageInfo as bX, type RemoteInfo as bY, type MCPServerConfig as bZ, type ServerInfo as b_, type SerializedStepFlowEntry as ba, mapVariable as bb, createStep as bc, cloneStep as bd, createWorkflow as be, cloneWorkflow as bf, type WorkflowResult as bg, Run as bh, type ExecutionGraph as bi, ExecutionEngine as bj, type ExecuteFunction as bk, type Emitter as bl, type StepSuccess as bm, type StepFailure as bn, type StepSuspended as bo, type StepRunning as bp, type StepWaiting as bq, type StepResult as br, type StepsRecord as bs, type DynamicMapping as bt, type PathsToStringProps as bu, type ExtractSchemaType as bv, type ExtractSchemaFromStep as bw, type VariableReference as bx, type StreamEvent as by, type WorkflowRunStatus as bz, type ToolAction as c, type MCPToolType as c0, MessageList as c1, type ToolsetsInput as c2, type DynamicArgument as c3, type AgentMemoryOption as c4, type AgentGenerateOptions as c5, type AgentStreamOptions as c6, type MastraMessageContentV2 as c7, LegacyStep as d, Workflow as e, type Step as f, AgentNetwork as g, MCPServerBase as h, type Methods as i, type ApiRoute as j, type MastraAuthConfig as k, type ContextWithMastra as l, MastraAuthProvider as m, type MastraAuthProviderOptions as n, MastraStorage as o, type TABLE_NAMES as p, type StorageColumn as q, type StorageThreadType as r, type StorageResourceType as s, type MastraMessageV2 as t, type StorageGetMessagesArg as u, type MastraMessageV1 as v, type WorkflowRuns as w, type WorkflowRun as x, type LegacyWorkflowRuns as y, type LegacyWorkflowRun as z };
@@ -1170,7 +1170,8 @@ type ExecuteFunction<TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, Eng
1170
1170
  getInitData<T extends z.ZodType<any>>(): z.infer<T>;
1171
1171
  getInitData<T extends Workflow<any, any, any, any, any>>(): T extends undefined ? unknown : z.infer<NonNullable<T['inputSchema']>>;
1172
1172
  getStepResult<T extends Step<any, any, any>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
1173
- suspend(suspendPayload: TSuspendSchema): Promise<void>;
1173
+ suspend(suspendPayload: TSuspendSchema): Promise<any>;
1174
+ bail(result: any): any;
1174
1175
  resume?: {
1175
1176
  steps: string[];
1176
1177
  resumePayload: any;
@@ -1271,21 +1272,22 @@ type StreamEvent = TextStreamPart<any> | {
1271
1272
  payload: any;
1272
1273
  id: string;
1273
1274
  };
1275
+ type WorkflowRunStatus = 'running' | 'success' | 'failed' | 'suspended' | 'waiting' | 'pending';
1274
1276
  type WatchEvent = {
1275
1277
  type: 'watch';
1276
1278
  payload: {
1277
1279
  currentStep?: {
1278
1280
  id: string;
1279
- status: 'running' | 'success' | 'failed' | 'suspended' | 'waiting';
1281
+ status: WorkflowRunStatus;
1280
1282
  output?: Record<string, any>;
1281
1283
  resumePayload?: Record<string, any>;
1282
1284
  payload?: Record<string, any>;
1283
1285
  error?: string | Error;
1284
1286
  };
1285
1287
  workflowState: {
1286
- status: 'running' | 'success' | 'failed' | 'suspended' | 'waiting';
1288
+ status: WorkflowRunStatus;
1287
1289
  steps: Record<string, {
1288
- status: 'running' | 'success' | 'failed' | 'suspended' | 'waiting';
1290
+ status: WorkflowRunStatus;
1289
1291
  output?: Record<string, any>;
1290
1292
  payload?: Record<string, any>;
1291
1293
  resumePayload?: Record<string, any>;
@@ -1305,7 +1307,7 @@ type WatchEvent = {
1305
1307
  type ZodPathType<T extends z.ZodTypeAny, P extends string> = T extends z.ZodObject<infer Shape> ? P extends `${infer Key}.${infer Rest}` ? Key extends keyof Shape ? Shape[Key] extends z.ZodTypeAny ? ZodPathType<Shape[Key], Rest> : never : never : P extends keyof Shape ? Shape[P] : never : never;
1306
1308
  interface WorkflowRunState {
1307
1309
  runId: string;
1308
- status: 'success' | 'failed' | 'suspended' | 'running' | 'waiting';
1310
+ status: WorkflowRunStatus;
1309
1311
  result?: Record<string, any>;
1310
1312
  error?: string | Error;
1311
1313
  value: Record<string, string>;
@@ -1623,11 +1625,19 @@ declare class Workflow<TEngineType = any, TSteps extends Step<string, any, any,
1623
1625
  createRun(options?: {
1624
1626
  runId?: string;
1625
1627
  }): Run<TEngineType, TSteps, TInput, TOutput>;
1628
+ /**
1629
+ * Creates a new workflow run instance and stores a snapshot of the workflow in the storage
1630
+ * @param options Optional configuration for the run
1631
+ * @returns A Run instance that can be used to execute the workflow
1632
+ */
1633
+ createRunAsync(options?: {
1634
+ runId?: string;
1635
+ }): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
1626
1636
  execute({ inputData, resumeData, suspend, resume, [EMITTER_SYMBOL]: emitter, mastra, runtimeContext, }: {
1627
1637
  inputData: z.infer<TInput>;
1628
1638
  resumeData?: any;
1629
1639
  getStepResult<T extends Step<any, any, any, any, any, TEngineType>>(stepId: T): T['outputSchema'] extends undefined ? unknown : z.infer<NonNullable<T['outputSchema']>>;
1630
- suspend: (suspendPayload: any) => Promise<void>;
1640
+ suspend: (suspendPayload: any) => Promise<any>;
1631
1641
  resume?: {
1632
1642
  steps: string[];
1633
1643
  resumePayload: any;
@@ -2085,16 +2095,6 @@ declare abstract class MastraMemory extends MastraBase {
2085
2095
  resourceId?: string;
2086
2096
  memoryConfig?: MemoryConfig;
2087
2097
  }): Promise<string | null>;
2088
- /**
2089
- * Get a user context message to inject into the conversation.
2090
- * This will be called before each conversation turn.
2091
- * Implementations can override this to inject custom system messages.
2092
- */
2093
- getUserContextMessage(_input: {
2094
- threadId: string;
2095
- resourceId?: string;
2096
- memoryConfig?: MemoryConfig;
2097
- }): Promise<string | null>;
2098
2098
  /**
2099
2099
  * Get tools that should be available to the agent.
2100
2100
  * This will be called when converting tools for the agent.
@@ -3946,4 +3946,4 @@ declare abstract class MastraStorage extends MastraBase {
3946
3946
  }>;
3947
3947
  }
3948
3948
 
3949
- export { type StepGraph as $, Agent as A, type PaginationArgs as B, type CoreTool as C, type StorageGetTracesArg as D, type EvalRow as E, TABLE_WORKFLOW_SNAPSHOT as F, TABLE_EVALS as G, TABLE_MESSAGES as H, TABLE_THREADS as I, TABLE_TRACES as J, TABLE_RESOURCES as K, LegacyWorkflow as L, Mastra as M, NewAgentNetwork as N, TABLE_SCHEMAS as O, type PaginationInfo as P, type VariableReference$1 as Q, type StepResult$1 as R, type StepExecutionContext as S, type ToolsInput as T, type StepAction as U, type VercelTool as V, type WorkflowContext as W, type LegacyWorkflowRunResult as X, type WorkflowOptions as Y, type StepVariableType as Z, type StepNode as _, type MastraPrimitives as a, type MemoryConfig as a$, type RetryConfig as a0, type BaseCondition as a1, type ActionContext as a2, WhenConditionReturnValue as a3, type StepDef as a4, type StepCondition as a5, type StepConfig as a6, type StepsRecord$1 as a7, type WorkflowLogMessage as a8, type WorkflowEvent as a9, type CoreSystemMessage as aA, type CoreAssistantMessage as aB, type CoreUserMessage as aC, type CoreToolMessage as aD, type EmbedResult as aE, type EmbedManyResult as aF, type BaseStructuredOutputType as aG, type StructuredOutputType as aH, type StructuredOutputArrayItem as aI, type StructuredOutput as aJ, type GenerateReturn as aK, type StreamReturn as aL, type OutputType as aM, type DefaultLLMTextOptions as aN, type DefaultLLMTextObjectOptions as aO, type DefaultLLMStreamOptions as aP, type DefaultLLMStreamObjectOptions as aQ, type LLMTextOptions as aR, type LLMTextObjectOptions as aS, type LLMStreamOptions as aT, type LLMInnerStreamOptions as aU, type LLMStreamObjectOptions as aV, createMockModel as aW, type Config as aX, type MessageType as aY, type MessageResponse as aZ, type WorkingMemory as a_, type ResolverFunctionInput as aa, type ResolverFunctionOutput as ab, type SubscriberFunctionOutput as ac, type DependencyCheckOutput as ad, type StepResolverOutput as ae, type WorkflowActors as af, type WorkflowActionParams as ag, type WorkflowActions as ah, type LegacyWorkflowState as ai, type StepId as aj, type ExtractSchemaFromStep$1 as ak, type ExtractStepResult as al, type StepInputType as am, type ExtractSchemaType$1 as an, type PathsToStringProps$1 as ao, type LegacyWorkflowRunState as ap, type WorkflowResumeResult as aq, Tool$1 as ar, createTool as as, type InternalCoreTool as at, type ToolExecutionContext as au, type AgentConfig as av, type DefaultEngineType as aw, type WorkflowConfig as ax, type LanguageModel as ay, type CoreMessage as az, MastraMemory as b, type MCPToolType as b$, type SharedMemoryConfig as b0, type TraceType as b1, type WorkingMemoryFormat as b2, type WorkingMemoryTemplate as b3, type MemoryProcessorOpts as b4, MemoryProcessor as b5, memoryDefaultOptions as b6, Tool as b7, type StepFlowEntry as b8, type SerializedStep as b9, type ZodPathType as bA, type WorkflowRunState as bB, type MastraLanguageModel as bC, type AgentNetworkConfig as bD, type VoiceEventType as bE, type VoiceEventMap as bF, type VoiceConfig as bG, MastraVoice as bH, CompositeVoice as bI, DefaultVoice as bJ, type ConvertedTool as bK, type MCPServerSSEOptions as bL, type MCPServerHonoSSEOptions as bM, type MCPServerHTTPOptions as bN, type Repository as bO, type VersionDetail as bP, type ArgumentInfo as bQ, type PositionalArgumentInfo as bR, type NamedArgumentInfo as bS, type SubcommandInfo as bT, type CommandInfo as bU, type EnvironmentVariableInfo as bV, type PackageInfo as bW, type RemoteInfo as bX, type MCPServerConfig as bY, type ServerInfo as bZ, type ServerDetailInfo as b_, type SerializedStepFlowEntry as ba, mapVariable as bb, createStep as bc, cloneStep as bd, createWorkflow as be, cloneWorkflow as bf, type WorkflowResult as bg, Run as bh, type ExecutionGraph as bi, ExecutionEngine as bj, type ExecuteFunction as bk, type Emitter as bl, type StepSuccess as bm, type StepFailure as bn, type StepSuspended as bo, type StepRunning as bp, type StepWaiting as bq, type StepResult as br, type StepsRecord as bs, type DynamicMapping as bt, type PathsToStringProps as bu, type ExtractSchemaType as bv, type ExtractSchemaFromStep as bw, type VariableReference as bx, type StreamEvent as by, type WatchEvent as bz, type ToolAction as c, MessageList as c0, type ToolsetsInput as c1, type DynamicArgument as c2, type AgentMemoryOption as c3, type AgentGenerateOptions as c4, type AgentStreamOptions as c5, type MastraMessageContentV2 as c6, LegacyStep as d, Workflow as e, type Step as f, AgentNetwork as g, MCPServerBase as h, type Methods as i, type ApiRoute as j, type MastraAuthConfig as k, type ContextWithMastra as l, MastraAuthProvider as m, type MastraAuthProviderOptions as n, MastraStorage as o, type TABLE_NAMES as p, type StorageColumn as q, type StorageThreadType as r, type StorageResourceType as s, type MastraMessageV2 as t, type StorageGetMessagesArg as u, type MastraMessageV1 as v, type WorkflowRuns as w, type WorkflowRun as x, type LegacyWorkflowRuns as y, type LegacyWorkflowRun as z };
3949
+ export { type StepGraph as $, Agent as A, type PaginationArgs as B, type CoreTool as C, type StorageGetTracesArg as D, type EvalRow as E, TABLE_WORKFLOW_SNAPSHOT as F, TABLE_EVALS as G, TABLE_MESSAGES as H, TABLE_THREADS as I, TABLE_TRACES as J, TABLE_RESOURCES as K, LegacyWorkflow as L, Mastra as M, NewAgentNetwork as N, TABLE_SCHEMAS as O, type PaginationInfo as P, type VariableReference$1 as Q, type StepResult$1 as R, type StepExecutionContext as S, type ToolsInput as T, type StepAction as U, type VercelTool as V, type WorkflowContext as W, type LegacyWorkflowRunResult as X, type WorkflowOptions as Y, type StepVariableType as Z, type StepNode as _, type MastraPrimitives as a, type MemoryConfig as a$, type RetryConfig as a0, type BaseCondition as a1, type ActionContext as a2, WhenConditionReturnValue as a3, type StepDef as a4, type StepCondition as a5, type StepConfig as a6, type StepsRecord$1 as a7, type WorkflowLogMessage as a8, type WorkflowEvent as a9, type CoreSystemMessage as aA, type CoreAssistantMessage as aB, type CoreUserMessage as aC, type CoreToolMessage as aD, type EmbedResult as aE, type EmbedManyResult as aF, type BaseStructuredOutputType as aG, type StructuredOutputType as aH, type StructuredOutputArrayItem as aI, type StructuredOutput as aJ, type GenerateReturn as aK, type StreamReturn as aL, type OutputType as aM, type DefaultLLMTextOptions as aN, type DefaultLLMTextObjectOptions as aO, type DefaultLLMStreamOptions as aP, type DefaultLLMStreamObjectOptions as aQ, type LLMTextOptions as aR, type LLMTextObjectOptions as aS, type LLMStreamOptions as aT, type LLMInnerStreamOptions as aU, type LLMStreamObjectOptions as aV, createMockModel as aW, type Config as aX, type MessageType as aY, type MessageResponse as aZ, type WorkingMemory as a_, type ResolverFunctionInput as aa, type ResolverFunctionOutput as ab, type SubscriberFunctionOutput as ac, type DependencyCheckOutput as ad, type StepResolverOutput as ae, type WorkflowActors as af, type WorkflowActionParams as ag, type WorkflowActions as ah, type LegacyWorkflowState as ai, type StepId as aj, type ExtractSchemaFromStep$1 as ak, type ExtractStepResult as al, type StepInputType as am, type ExtractSchemaType$1 as an, type PathsToStringProps$1 as ao, type LegacyWorkflowRunState as ap, type WorkflowResumeResult as aq, Tool$1 as ar, createTool as as, type InternalCoreTool as at, type ToolExecutionContext as au, type AgentConfig as av, type DefaultEngineType as aw, type WorkflowConfig as ax, type LanguageModel as ay, type CoreMessage as az, MastraMemory as b, type ServerDetailInfo as b$, type SharedMemoryConfig as b0, type TraceType as b1, type WorkingMemoryFormat as b2, type WorkingMemoryTemplate as b3, type MemoryProcessorOpts as b4, MemoryProcessor as b5, memoryDefaultOptions as b6, Tool as b7, type StepFlowEntry as b8, type SerializedStep as b9, type WatchEvent as bA, type ZodPathType as bB, type WorkflowRunState as bC, type MastraLanguageModel as bD, type AgentNetworkConfig as bE, type VoiceEventType as bF, type VoiceEventMap as bG, type VoiceConfig as bH, MastraVoice as bI, CompositeVoice as bJ, DefaultVoice as bK, type ConvertedTool as bL, type MCPServerSSEOptions as bM, type MCPServerHonoSSEOptions as bN, type MCPServerHTTPOptions as bO, type Repository as bP, type VersionDetail as bQ, type ArgumentInfo as bR, type PositionalArgumentInfo as bS, type NamedArgumentInfo as bT, type SubcommandInfo as bU, type CommandInfo as bV, type EnvironmentVariableInfo as bW, type PackageInfo as bX, type RemoteInfo as bY, type MCPServerConfig as bZ, type ServerInfo as b_, type SerializedStepFlowEntry as ba, mapVariable as bb, createStep as bc, cloneStep as bd, createWorkflow as be, cloneWorkflow as bf, type WorkflowResult as bg, Run as bh, type ExecutionGraph as bi, ExecutionEngine as bj, type ExecuteFunction as bk, type Emitter as bl, type StepSuccess as bm, type StepFailure as bn, type StepSuspended as bo, type StepRunning as bp, type StepWaiting as bq, type StepResult as br, type StepsRecord as bs, type DynamicMapping as bt, type PathsToStringProps as bu, type ExtractSchemaType as bv, type ExtractSchemaFromStep as bw, type VariableReference as bx, type StreamEvent as by, type WorkflowRunStatus as bz, type ToolAction as c, type MCPToolType as c0, MessageList as c1, type ToolsetsInput as c2, type DynamicArgument as c3, type AgentMemoryOption as c4, type AgentGenerateOptions as c5, type AgentStreamOptions as c6, type MastraMessageContentV2 as c7, LegacyStep as d, Workflow as e, type Step as f, AgentNetwork as g, MCPServerBase as h, type Methods as i, type ApiRoute as j, type MastraAuthConfig as k, type ContextWithMastra as l, MastraAuthProvider as m, type MastraAuthProviderOptions as n, MastraStorage as o, type TABLE_NAMES as p, type StorageColumn as q, type StorageThreadType as r, type StorageResourceType as s, type MastraMessageV2 as t, type StorageGetMessagesArg as u, type MastraMessageV1 as v, type WorkflowRuns as w, type WorkflowRun as x, type LegacyWorkflowRuns as y, type LegacyWorkflowRun as z };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkBB6DPGIV_cjs = require('./chunk-BB6DPGIV.cjs');
4
- var chunkRTAJP2CD_cjs = require('./chunk-RTAJP2CD.cjs');
4
+ var chunkI27AAGKV_cjs = require('./chunk-I27AAGKV.cjs');
5
5
  var chunk4Z3OU5RY_cjs = require('./chunk-4Z3OU5RY.cjs');
6
6
  var chunkB6TOBUS6_cjs = require('./chunk-B6TOBUS6.cjs');
7
7
  var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
@@ -137,6 +137,9 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
137
137
  runtimeContext: params.runtimeContext
138
138
  });
139
139
  if (lastOutput.result.status !== "success") {
140
+ if (lastOutput.result.status === "bailed") {
141
+ lastOutput.result.status = "success";
142
+ }
140
143
  const result2 = await this.fmtReturnValue(
141
144
  executionSpan,
142
145
  params.emitter,
@@ -326,6 +329,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
326
329
  for (let i = 0; i < retries + 1; i++) {
327
330
  try {
328
331
  let suspended;
332
+ let bailed;
329
333
  const result = await runStep({
330
334
  runId,
331
335
  mastra: this.mastra,
@@ -347,6 +351,9 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
347
351
  executionContext.suspendedPaths[step.id] = executionContext.executionPath;
348
352
  suspended = { payload: suspendPayload };
349
353
  },
354
+ bail: (result2) => {
355
+ bailed = { payload: result2 };
356
+ },
350
357
  resume: {
351
358
  steps: resume?.steps?.slice(1) || [],
352
359
  resumePayload: resume?.resumePayload,
@@ -358,6 +365,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
358
365
  });
359
366
  if (suspended) {
360
367
  execResults = { status: "suspended", suspendPayload: suspended.payload, suspendedAt: Date.now() };
368
+ } else if (bailed) {
369
+ execResults = { status: "bailed", output: bailed.payload, endedAt: Date.now() };
361
370
  } else {
362
371
  execResults = { status: "success", output: result, endedAt: Date.now() };
363
372
  }
@@ -522,6 +531,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
522
531
  // TODO: this function shouldn't have suspend probably?
523
532
  suspend: async (_suspendPayload) => {
524
533
  },
534
+ bail: () => {
535
+ },
525
536
  [chunkBB6DPGIV_cjs.EMITTER_SYMBOL]: emitter,
526
537
  engine: {}
527
538
  });
@@ -629,6 +640,8 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
629
640
  },
630
641
  suspend: async (_suspendPayload) => {
631
642
  },
643
+ bail: () => {
644
+ },
632
645
  [chunkBB6DPGIV_cjs.EMITTER_SYMBOL]: emitter,
633
646
  engine: {}
634
647
  });
@@ -1031,7 +1044,7 @@ function mapVariable(config) {
1031
1044
  return config;
1032
1045
  }
1033
1046
  function createStep(params) {
1034
- if (params instanceof chunkRTAJP2CD_cjs.Agent) {
1047
+ if (params instanceof chunkI27AAGKV_cjs.Agent) {
1035
1048
  return {
1036
1049
  id: params.name,
1037
1050
  // @ts-ignore
@@ -1543,6 +1556,52 @@ var Workflow = class extends chunkP3Q73CAW_cjs.MastraBase {
1543
1556
  cleanup: () => this.#runs.delete(runIdToUse)
1544
1557
  });
1545
1558
  this.#runs.set(runIdToUse, run);
1559
+ this.mastra?.getLogger().warn("createRun() is deprecated. Use createRunAsync() instead.");
1560
+ return run;
1561
+ }
1562
+ /**
1563
+ * Creates a new workflow run instance and stores a snapshot of the workflow in the storage
1564
+ * @param options Optional configuration for the run
1565
+ * @returns A Run instance that can be used to execute the workflow
1566
+ */
1567
+ async createRunAsync(options) {
1568
+ if (this.stepFlow.length === 0) {
1569
+ throw new Error(
1570
+ "Execution flow of workflow is not defined. Add steps to the workflow via .then(), .branch(), etc."
1571
+ );
1572
+ }
1573
+ if (!this.executionGraph.steps) {
1574
+ throw new Error("Uncommitted step flow changes detected. Call .commit() to register the steps.");
1575
+ }
1576
+ const runIdToUse = options?.runId || crypto.randomUUID();
1577
+ const run = this.#runs.get(runIdToUse) ?? new Run({
1578
+ workflowId: this.id,
1579
+ runId: runIdToUse,
1580
+ executionEngine: this.executionEngine,
1581
+ executionGraph: this.executionGraph,
1582
+ mastra: this.#mastra,
1583
+ retryConfig: this.retryConfig,
1584
+ serializedStepGraph: this.serializedStepGraph,
1585
+ cleanup: () => this.#runs.delete(runIdToUse)
1586
+ });
1587
+ this.#runs.set(runIdToUse, run);
1588
+ await this.mastra?.getStorage()?.persistWorkflowSnapshot({
1589
+ workflowName: this.id,
1590
+ runId: runIdToUse,
1591
+ snapshot: {
1592
+ runId: runIdToUse,
1593
+ status: "pending",
1594
+ value: {},
1595
+ context: {},
1596
+ activePaths: [],
1597
+ serializedStepGraph: this.serializedStepGraph,
1598
+ suspendedPaths: {},
1599
+ result: void 0,
1600
+ error: void 0,
1601
+ // @ts-ignore
1602
+ timestamp: Date.now()
1603
+ }
1604
+ });
1546
1605
  return run;
1547
1606
  }
1548
1607
  async execute({
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkRTAJP2CD_cjs = require('./chunk-RTAJP2CD.cjs');
3
+ var chunkI27AAGKV_cjs = require('./chunk-I27AAGKV.cjs');
4
4
  var cohereAi = require('cohere-ai');
5
5
 
6
6
  var CohereRelevanceScorer = class {
@@ -38,7 +38,7 @@ Relevance score (0-1):`;
38
38
  var MastraAgentRelevanceScorer = class {
39
39
  agent;
40
40
  constructor(name, model) {
41
- this.agent = new chunkRTAJP2CD_cjs.Agent({
41
+ this.agent = new chunkI27AAGKV_cjs.Agent({
42
42
  name: `Relevance Scorer ${name}`,
43
43
  instructions: `You are a specialized agent for evaluating the relevance of text to queries.
44
44
  Your task is to rate how well a text passage answers a given query.
@@ -1080,7 +1080,7 @@ exports.Agent = class Agent extends (_a = chunkP3Q73CAW_cjs.MastraBase) {
1080
1080
  resourceId
1081
1081
  });
1082
1082
  }
1083
- let [memoryMessages, memorySystemMessage, userContextMessage] = thread.id && memory ? await Promise.all([memory.rememberMessages({
1083
+ let [memoryMessages, memorySystemMessage] = thread.id && memory ? await Promise.all([memory.rememberMessages({
1084
1084
  threadId: threadObject.id,
1085
1085
  resourceId,
1086
1086
  config: memoryConfig,
@@ -1088,11 +1088,6 @@ exports.Agent = class Agent extends (_a = chunkP3Q73CAW_cjs.MastraBase) {
1088
1088
  vectorMessageSearch: new chunkYNZWZHUB_cjs.MessageList().add(messages, `user`).getLatestUserContent() || ""
1089
1089
  }).then(r => r.messagesV2), memory.getSystemMessage({
1090
1090
  threadId: threadObject.id,
1091
- resourceId,
1092
- memoryConfig
1093
- }), memory.getUserContextMessage({
1094
- threadId: threadObject.id,
1095
- resourceId,
1096
1091
  memoryConfig
1097
1092
  })]) : [[], null, null];
1098
1093
  this.logger.debug("Fetched messages from memory", {
@@ -1116,9 +1111,6 @@ ${JSON.stringify(
1116
1111
  if (memorySystemMessage) {
1117
1112
  messageList.addSystem(memorySystemMessage, "memory");
1118
1113
  }
1119
- if (userContextMessage) {
1120
- messageList.add(userContextMessage, "context");
1121
- }
1122
1114
  messageList.add(memoryMessages.filter(m => m.threadId === threadObject.id),
1123
1115
  // filter out messages from other threads. those are added to system message above
1124
1116
  "memory").add(messages, "user");
@@ -1136,7 +1128,7 @@ ${JSON.stringify(
1136
1128
  const processedList = new chunkYNZWZHUB_cjs.MessageList({
1137
1129
  threadId: threadObject.id,
1138
1130
  resourceId
1139
- }).addSystem(instructions || `${this.instructions}.`).addSystem(memorySystemMessage).add(context || [], "context").add(userContextMessage || [], "context").add(processedMemoryMessages, "memory").add(messageList.get.input.v2(), "user").get.all.prompt();
1131
+ }).addSystem(instructions || `${this.instructions}.`).addSystem(memorySystemMessage).add(context || [], "context").add(processedMemoryMessages, "memory").add(messageList.get.input.v2(), "user").get.all.prompt();
1140
1132
  return {
1141
1133
  convertedTools,
1142
1134
  thread: threadObject,
@@ -1318,7 +1310,10 @@ ${JSON.stringify(
1318
1310
  messages: messageObjects,
1319
1311
  tools: convertedTools,
1320
1312
  onStepFinish: result3 => {
1321
- return onStepFinish?.(result3);
1313
+ return onStepFinish?.({
1314
+ ...result3,
1315
+ runId
1316
+ });
1322
1317
  },
1323
1318
  maxSteps,
1324
1319
  runId,
@@ -1351,7 +1346,10 @@ ${JSON.stringify(
1351
1346
  messages: messageObjects,
1352
1347
  tools: convertedTools,
1353
1348
  onStepFinish: result3 => {
1354
- return onStepFinish?.(result3);
1349
+ return onStepFinish?.({
1350
+ ...result3,
1351
+ runId
1352
+ });
1355
1353
  },
1356
1354
  maxSteps,
1357
1355
  runId,
@@ -1381,7 +1379,10 @@ ${JSON.stringify(
1381
1379
  tools: convertedTools,
1382
1380
  structuredOutput: output,
1383
1381
  onStepFinish: result2 => {
1384
- return onStepFinish?.(result2);
1382
+ return onStepFinish?.({
1383
+ ...result2,
1384
+ runId
1385
+ });
1385
1386
  },
1386
1387
  maxSteps,
1387
1388
  runId,
@@ -1471,7 +1472,10 @@ ${JSON.stringify(
1471
1472
  temperature,
1472
1473
  tools: convertedTools,
1473
1474
  onStepFinish: result => {
1474
- return onStepFinish?.(result);
1475
+ return onStepFinish?.({
1476
+ ...result,
1477
+ runId
1478
+ });
1475
1479
  },
1476
1480
  onFinish: async result => {
1477
1481
  try {
@@ -1491,7 +1495,10 @@ ${JSON.stringify(
1491
1495
  runId
1492
1496
  });
1493
1497
  }
1494
- await onFinish?.(result);
1498
+ await onFinish?.({
1499
+ ...result,
1500
+ runId
1501
+ });
1495
1502
  },
1496
1503
  maxSteps,
1497
1504
  runId,
@@ -1516,7 +1523,10 @@ ${JSON.stringify(
1516
1523
  temperature,
1517
1524
  tools: convertedTools,
1518
1525
  onStepFinish: result => {
1519
- return onStepFinish?.(result);
1526
+ return onStepFinish?.({
1527
+ ...result,
1528
+ runId
1529
+ });
1520
1530
  },
1521
1531
  onFinish: async result => {
1522
1532
  try {
@@ -1536,7 +1546,10 @@ ${JSON.stringify(
1536
1546
  runId
1537
1547
  });
1538
1548
  }
1539
- await onFinish?.(result);
1549
+ await onFinish?.({
1550
+ ...result,
1551
+ runId
1552
+ });
1540
1553
  },
1541
1554
  maxSteps,
1542
1555
  runId,
@@ -1558,7 +1571,10 @@ ${JSON.stringify(
1558
1571
  temperature,
1559
1572
  structuredOutput: output,
1560
1573
  onStepFinish: result => {
1561
- return onStepFinish?.(result);
1574
+ return onStepFinish?.({
1575
+ ...result,
1576
+ runId
1577
+ });
1562
1578
  },
1563
1579
  onFinish: async result => {
1564
1580
  try {
@@ -1578,7 +1594,10 @@ ${JSON.stringify(
1578
1594
  runId
1579
1595
  });
1580
1596
  }
1581
- await onFinish?.(result);
1597
+ await onFinish?.({
1598
+ ...result,
1599
+ runId
1600
+ });
1582
1601
  },
1583
1602
  runId,
1584
1603
  toolChoice,
@@ -1,4 +1,4 @@
1
- import { Agent } from './chunk-LDESW23C.js';
1
+ import { Agent } from './chunk-SSDOXKZK.js';
2
2
  import { CohereClient } from 'cohere-ai';
3
3
 
4
4
  var CohereRelevanceScorer = class {
@@ -101,14 +101,6 @@ https://mastra.ai/en/docs/memory/overview`
101
101
  async getSystemMessage(_input) {
102
102
  return null;
103
103
  }
104
- /**
105
- * Get a user context message to inject into the conversation.
106
- * This will be called before each conversation turn.
107
- * Implementations can override this to inject custom system messages.
108
- */
109
- async getUserContextMessage(_input) {
110
- return null;
111
- }
112
104
  /**
113
105
  * Get tools that should be available to the agent.
114
106
  * This will be called when converting tools for the agent.
@@ -103,14 +103,6 @@ https://mastra.ai/en/docs/memory/overview`
103
103
  async getSystemMessage(_input) {
104
104
  return null;
105
105
  }
106
- /**
107
- * Get a user context message to inject into the conversation.
108
- * This will be called before each conversation turn.
109
- * Implementations can override this to inject custom system messages.
110
- */
111
- async getUserContextMessage(_input) {
112
- return null;
113
- }
114
106
  /**
115
107
  * Get tools that should be available to the agent.
116
108
  * This will be called when converting tools for the agent.