@mastra/core 0.5.0-alpha.7 → 0.5.0-alpha.9

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 (52) hide show
  1. package/dist/agent/index.cjs +45 -5
  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-DIn_km7X.d.ts → base-B78F6w8S.d.ts} +7 -11
  6. package/dist/{base-CTdONy0_.d.cts → base-CMEKtEnE.d.cts} +7 -11
  7. package/dist/{chunk-QABMKXI3.js → chunk-4AQBRUR2.js} +1 -1
  8. package/dist/{chunk-KBSR2LLT.js → chunk-6V737PR2.js} +11 -6
  9. package/dist/{chunk-WQP5UP2H.js → chunk-EWB556GS.js} +94 -94
  10. package/dist/{chunk-HBHPTMAC.js → chunk-IM7CM3DU.js} +45 -5
  11. package/dist/{chunk-ZI46WXW6.js → chunk-NR5T72G7.js} +2 -2
  12. package/dist/{chunk-PFWSWJT7.js → chunk-QAZ2ONKM.js} +4 -5
  13. package/dist/{chunk-SWDQYPJS.js → chunk-TWAIC2XA.js} +3 -2
  14. package/dist/eval/index.d.cts +1 -1
  15. package/dist/eval/index.d.ts +1 -1
  16. package/dist/index.cjs +153 -108
  17. package/dist/index.d.cts +3 -3
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +7 -7
  20. package/dist/integration/index.d.cts +1 -1
  21. package/dist/integration/index.d.ts +1 -1
  22. package/dist/llm/index.d.cts +1 -1
  23. package/dist/llm/index.d.ts +1 -1
  24. package/dist/mastra/index.cjs +97 -98
  25. package/dist/mastra/index.d.cts +1 -1
  26. package/dist/mastra/index.d.ts +1 -1
  27. package/dist/mastra/index.js +1 -1
  28. package/dist/memory/index.cjs +4 -5
  29. package/dist/memory/index.d.cts +1 -1
  30. package/dist/memory/index.d.ts +1 -1
  31. package/dist/memory/index.js +1 -1
  32. package/dist/relevance/index.cjs +45 -5
  33. package/dist/relevance/index.js +1 -1
  34. package/dist/storage/index.d.cts +1 -1
  35. package/dist/storage/index.d.ts +1 -1
  36. package/dist/storage/libsql/index.cjs +4 -5
  37. package/dist/storage/libsql/index.d.cts +1 -1
  38. package/dist/storage/libsql/index.d.ts +1 -1
  39. package/dist/storage/libsql/index.js +1 -1
  40. package/dist/telemetry/index.d.cts +1 -1
  41. package/dist/telemetry/index.d.ts +1 -1
  42. package/dist/tools/index.d.cts +2 -2
  43. package/dist/tools/index.d.ts +2 -2
  44. package/dist/utils.cjs +45 -4
  45. package/dist/utils.d.cts +8 -2
  46. package/dist/utils.d.ts +8 -2
  47. package/dist/utils.js +1 -1
  48. package/dist/workflows/index.cjs +18 -7
  49. package/dist/workflows/index.d.cts +2 -2
  50. package/dist/workflows/index.d.ts +2 -2
  51. package/dist/workflows/index.js +1 -1
  52. package/package.json +1 -1
@@ -454,12 +454,45 @@ function createExecute(tool, options, logType) {
454
454
  }
455
455
  };
456
456
  }
457
+ function isZodType(value) {
458
+ return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
459
+ }
460
+ function createDeterministicId(input) {
461
+ return crypto$1.createHash("sha256").update(input).digest("hex").slice(0, 8);
462
+ }
463
+ function setVercelToolProperties(tool) {
464
+ const inputSchema = convertVercelToolParameters(tool);
465
+ const toolId = !("id" in tool) ? tool.description ? `tool-${createDeterministicId(tool.description)}` : `tool-${Math.random().toString(36).substring(2, 9)}` : tool.id;
466
+ return {
467
+ ...tool,
468
+ id: toolId,
469
+ inputSchema
470
+ };
471
+ }
472
+ function ensureToolProperties(tools) {
473
+ const toolsWithProperties = Object.keys(tools).reduce((acc, key) => {
474
+ const tool = tools?.[key];
475
+ if (tool) {
476
+ if (isVercelTool(tool)) {
477
+ acc[key] = setVercelToolProperties(tool);
478
+ } else {
479
+ acc[key] = tool;
480
+ }
481
+ }
482
+ return acc;
483
+ }, {});
484
+ return toolsWithProperties;
485
+ }
486
+ function convertVercelToolParameters(tool) {
487
+ const schema = tool.parameters ?? zod.z.object({});
488
+ return isZodType(schema) ? schema : resolveSerializedZodOutput(jsonSchemaToZod__default.default(schema));
489
+ }
457
490
  function makeCoreTool(tool, options, logType) {
458
491
  const getParameters = () => {
459
492
  if (isVercelTool(tool)) {
460
- return tool.parameters instanceof zod.z.ZodType ? tool.parameters : resolveSerializedZodOutput(jsonSchemaToZod__default.default(tool.parameters));
493
+ return convertVercelToolParameters(tool);
461
494
  }
462
- return tool.inputSchema;
495
+ return tool.inputSchema ?? zod.z.object({});
463
496
  };
464
497
  return {
465
498
  description: tool.description,
@@ -476,8 +509,14 @@ function createMastraProxy({
476
509
  }) {
477
510
  return new Proxy(mastra, {
478
511
  get(target, prop) {
479
- if (Reflect.has(target, prop)) {
480
- return Reflect.get(target, prop);
512
+ const hasProp = Reflect.has(target, prop);
513
+ if (hasProp) {
514
+ const value = Reflect.get(target, prop);
515
+ const isFunction = typeof value === "function";
516
+ if (isFunction) {
517
+ return value.bind(target);
518
+ }
519
+ return value;
481
520
  }
482
521
  if (prop === "logger") {
483
522
  logger.warn(`Please use 'getLogger' instead, logger is deprecated`);
@@ -1157,7 +1196,7 @@ exports.Agent = class Agent extends (_a = MastraBase) {
1157
1196
  this.metrics = {};
1158
1197
  this.evals = {};
1159
1198
  if (config.tools) {
1160
- this.tools = config.tools;
1199
+ this.tools = ensureToolProperties(config.tools);
1161
1200
  }
1162
1201
  if (config.mastra) {
1163
1202
  this.__registerPrimitives({
@@ -1315,6 +1354,7 @@ exports.Agent = class Agent extends (_a = MastraBase) {
1315
1354
  });
1316
1355
  const memoryMessages = threadId && memory ? (await memory.rememberMessages({
1317
1356
  threadId,
1357
+ resourceId,
1318
1358
  config: memoryConfig,
1319
1359
  vectorMessageSearch: messages.slice(-1).map(m => {
1320
1360
  if (typeof m === `string`) {
@@ -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, h as AgentConfig, au as AgentGenerateOptions, av as AgentStreamOptions, as as ToolsInput, at as ToolsetsInput } from '../base-CTdONy0_.cjs';
4
+ export { A as Agent, i as AgentConfig, au as AgentGenerateOptions, av as AgentStreamOptions, a as ToolsInput, at as ToolsetsInput } from '../base-CMEKtEnE.cjs';
5
5
  import '../base-DboIg_Cd.cjs';
6
6
  import '../types-CwTG2XyQ.cjs';
7
7
  import '../voice/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, h as AgentConfig, au as AgentGenerateOptions, av as AgentStreamOptions, as as ToolsInput, at as ToolsetsInput } from '../base-DIn_km7X.js';
4
+ export { A as Agent, i as AgentConfig, au as AgentGenerateOptions, av as AgentStreamOptions, a as ToolsInput, at as ToolsetsInput } from '../base-B78F6w8S.js';
5
5
  import '../base-BZViaFTt.js';
6
6
  import '../types-CwTG2XyQ.js';
7
7
  import '../voice/index.js';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-SWDQYPJS.js';
1
+ export { Agent } from '../chunk-TWAIC2XA.js';
@@ -62,8 +62,9 @@ declare abstract class MastraMemory extends MastraBase {
62
62
  indexName: string;
63
63
  }>;
64
64
  getMergedThreadConfig(config?: MemoryConfig): MemoryConfig;
65
- abstract rememberMessages({ threadId, vectorMessageSearch, config, }: {
65
+ abstract rememberMessages({ threadId, resourceId, vectorMessageSearch, config, }: {
66
66
  threadId: string;
67
+ resourceId?: string;
67
68
  vectorMessageSearch?: string;
68
69
  config?: MemoryConfig;
69
70
  }): Promise<{
@@ -108,7 +109,7 @@ declare abstract class MastraMemory extends MastraBase {
108
109
  * @param threadId - The unique identifier of the thread
109
110
  * @returns Promise resolving to array of messages and uiMessages
110
111
  */
111
- abstract query({ threadId, selectBy, }: StorageGetMessagesArg): Promise<{
112
+ abstract query({ threadId, resourceId, selectBy, }: StorageGetMessagesArg): Promise<{
112
113
  messages: CoreMessage$1[];
113
114
  uiMessages: Message[];
114
115
  }>;
@@ -166,7 +167,7 @@ interface WorkflowOptions<TTriggerSchema extends z.ZodObject<any> = any> {
166
167
  }
167
168
  interface StepExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined, TContext extends WorkflowContext = WorkflowContext> extends IExecutionContext<TSchemaIn> {
168
169
  context: TSchemaIn extends z.ZodSchema ? z.infer<TSchemaIn> & TContext : TContext;
169
- suspend: () => Promise<void>;
170
+ suspend: (payload?: unknown) => Promise<void>;
170
171
  runId: string;
171
172
  mastra?: MastraUnion;
172
173
  }
@@ -572,13 +573,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
572
573
  memory?: MastraMemory;
573
574
  }
574
575
  declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger> {
575
- private vectors?;
576
- private agents;
577
- private logger;
578
- private workflows;
579
- private telemetry?;
580
- private tts?;
581
- private deployer?;
576
+ #private;
582
577
  storage?: MastraStorage;
583
578
  memory?: MastraMemory;
584
579
  constructor(config?: Config<TAgents, TWorkflows, TVectors, TTTS, TLogger>);
@@ -933,6 +928,7 @@ interface WorkflowRow {
933
928
  }
934
929
  type StorageGetMessagesArg = {
935
930
  threadId: string;
931
+ resourceId?: string;
936
932
  selectBy?: {
937
933
  vectorSearchString?: string;
938
934
  last?: number | false;
@@ -1120,4 +1116,4 @@ declare abstract class MastraStorage extends MastraBase {
1120
1116
  __getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
1121
1117
  }
1122
1118
 
1123
- export { type RetryConfig as $, Agent as A, type BaseStructuredOutputType as B, type CoreTool as C, type DefaultLLMTextOptions as D, type EvalRow as E, type LLMTextOptions as F, type GenerateReturn as G, type LLMTextObjectOptions as H, type LLMStreamOptions as I, type LLMInnerStreamOptions as J, type LLMStreamObjectOptions as K, type LanguageModel as L, Mastra as M, type Config as N, type OutputType as O, type MessageResponse as P, type MemoryConfig as Q, type SharedMemoryConfig as R, type StorageColumn as S, type ToolAction as T, type StepExecutionContext as U, type VercelTool as V, Workflow as W, type StepAction as X, type StepVariableType as Y, type StepNode as Z, type StepGraph as _, type MastraPrimitives as a, type VariableReference 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 StepResult as a7, type WorkflowContext as a8, type WorkflowLogMessage as a9, TABLE_TRACES as aA, type WorkflowEvent as aa, type ResolverFunctionInput as ab, type ResolverFunctionOutput as ac, type SubscriberFunctionOutput as ad, type DependencyCheckOutput as ae, type WorkflowActors as af, type WorkflowActionParams as ag, type WorkflowActions as ah, type WorkflowState as ai, type StepId as aj, type ExtractSchemaFromStep as ak, type ExtractStepResult as al, type StepInputType as am, type ExtractSchemaType as an, type PathsToStringProps as ao, type WorkflowRunState as ap, type WorkflowResumeResult as aq, createStep as ar, type ToolsInput as as, type ToolsetsInput as at, type AgentGenerateOptions as au, type AgentStreamOptions as av, TABLE_WORKFLOW_SNAPSHOT as aw, TABLE_EVALS as ax, TABLE_MESSAGES as ay, TABLE_THREADS as az, MastraMemory as b, MastraStorage as c, type TABLE_NAMES as d, type StorageThreadType as e, type MessageType as f, type StorageGetMessagesArg as g, type AgentConfig as h, type ToolExecutionContext as i, Step as j, type WorkflowOptions as k, type WorkflowRow as l, type CoreMessage as m, type CoreSystemMessage as n, type CoreAssistantMessage as o, type CoreUserMessage as p, type CoreToolMessage as q, type EmbedResult as r, type EmbedManyResult as s, type StructuredOutputType as t, type StructuredOutputArrayItem as u, type StructuredOutput as v, type StreamReturn as w, type DefaultLLMTextObjectOptions as x, type DefaultLLMStreamOptions as y, type DefaultLLMStreamObjectOptions as z };
1119
+ export { type StepGraph as $, Agent as A, type BaseStructuredOutputType as B, type CoreTool as C, type DefaultLLMTextOptions as D, type EvalRow as E, type DefaultLLMStreamObjectOptions as F, type GenerateReturn as G, type LLMTextOptions as H, type LLMTextObjectOptions as I, type LLMStreamOptions as J, type LLMInnerStreamOptions as K, type LanguageModel as L, Mastra as M, type LLMStreamObjectOptions as N, type OutputType as O, type Config as P, type MessageResponse as Q, type MemoryConfig as R, type StorageColumn as S, type ToolAction as T, type SharedMemoryConfig as U, type VercelTool as V, Workflow as W, type StepExecutionContext as X, type StepAction as Y, type StepVariableType as Z, type StepNode as _, type ToolsInput as a, type RetryConfig as a0, type VariableReference as a1, type BaseCondition as a2, type ActionContext as a3, WhenConditionReturnValue as a4, type StepDef as a5, type StepCondition as a6, type StepConfig as a7, type StepResult as a8, type WorkflowContext as a9, TABLE_TRACES as aA, type WorkflowLogMessage as aa, type WorkflowEvent as ab, type ResolverFunctionInput as ac, type ResolverFunctionOutput as ad, type SubscriberFunctionOutput as ae, type DependencyCheckOutput as af, type WorkflowActors as ag, type WorkflowActionParams as ah, type WorkflowActions as ai, type WorkflowState as aj, type StepId as ak, type ExtractSchemaFromStep as al, type ExtractStepResult as am, type StepInputType as an, type ExtractSchemaType as ao, type PathsToStringProps as ap, type WorkflowRunState as aq, type WorkflowResumeResult as ar, createStep as as, type ToolsetsInput as at, type AgentGenerateOptions as au, type AgentStreamOptions as av, TABLE_WORKFLOW_SNAPSHOT as aw, TABLE_EVALS as ax, TABLE_MESSAGES as ay, TABLE_THREADS as az, type MastraPrimitives as b, MastraMemory as c, MastraStorage as d, type TABLE_NAMES as e, type StorageThreadType as f, type MessageType as g, type StorageGetMessagesArg as h, type AgentConfig as i, type ToolExecutionContext as j, Step as k, type WorkflowOptions as l, type WorkflowRow as m, type CoreMessage as n, type CoreSystemMessage as o, type CoreAssistantMessage as p, type CoreUserMessage as q, type CoreToolMessage as r, type EmbedResult as s, type EmbedManyResult as t, type StructuredOutputType as u, type StructuredOutputArrayItem as v, type StructuredOutput as w, type StreamReturn as x, type DefaultLLMTextObjectOptions as y, type DefaultLLMStreamOptions as z };
@@ -62,8 +62,9 @@ declare abstract class MastraMemory extends MastraBase {
62
62
  indexName: string;
63
63
  }>;
64
64
  getMergedThreadConfig(config?: MemoryConfig): MemoryConfig;
65
- abstract rememberMessages({ threadId, vectorMessageSearch, config, }: {
65
+ abstract rememberMessages({ threadId, resourceId, vectorMessageSearch, config, }: {
66
66
  threadId: string;
67
+ resourceId?: string;
67
68
  vectorMessageSearch?: string;
68
69
  config?: MemoryConfig;
69
70
  }): Promise<{
@@ -108,7 +109,7 @@ declare abstract class MastraMemory extends MastraBase {
108
109
  * @param threadId - The unique identifier of the thread
109
110
  * @returns Promise resolving to array of messages and uiMessages
110
111
  */
111
- abstract query({ threadId, selectBy, }: StorageGetMessagesArg): Promise<{
112
+ abstract query({ threadId, resourceId, selectBy, }: StorageGetMessagesArg): Promise<{
112
113
  messages: CoreMessage$1[];
113
114
  uiMessages: Message[];
114
115
  }>;
@@ -166,7 +167,7 @@ interface WorkflowOptions<TTriggerSchema extends z.ZodObject<any> = any> {
166
167
  }
167
168
  interface StepExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined, TContext extends WorkflowContext = WorkflowContext> extends IExecutionContext<TSchemaIn> {
168
169
  context: TSchemaIn extends z.ZodSchema ? z.infer<TSchemaIn> & TContext : TContext;
169
- suspend: () => Promise<void>;
170
+ suspend: (payload?: unknown) => Promise<void>;
170
171
  runId: string;
171
172
  mastra?: MastraUnion;
172
173
  }
@@ -572,13 +573,7 @@ interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Age
572
573
  memory?: MastraMemory;
573
574
  }
574
575
  declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger> {
575
- private vectors?;
576
- private agents;
577
- private logger;
578
- private workflows;
579
- private telemetry?;
580
- private tts?;
581
- private deployer?;
576
+ #private;
582
577
  storage?: MastraStorage;
583
578
  memory?: MastraMemory;
584
579
  constructor(config?: Config<TAgents, TWorkflows, TVectors, TTTS, TLogger>);
@@ -933,6 +928,7 @@ interface WorkflowRow {
933
928
  }
934
929
  type StorageGetMessagesArg = {
935
930
  threadId: string;
931
+ resourceId?: string;
936
932
  selectBy?: {
937
933
  vectorSearchString?: string;
938
934
  last?: number | false;
@@ -1120,4 +1116,4 @@ declare abstract class MastraStorage extends MastraBase {
1120
1116
  __getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
1121
1117
  }
1122
1118
 
1123
- export { type RetryConfig as $, Agent as A, type BaseStructuredOutputType as B, type CoreTool as C, type DefaultLLMTextOptions as D, type EvalRow as E, type LLMTextOptions as F, type GenerateReturn as G, type LLMTextObjectOptions as H, type LLMStreamOptions as I, type LLMInnerStreamOptions as J, type LLMStreamObjectOptions as K, type LanguageModel as L, Mastra as M, type Config as N, type OutputType as O, type MessageResponse as P, type MemoryConfig as Q, type SharedMemoryConfig as R, type StorageColumn as S, type ToolAction as T, type StepExecutionContext as U, type VercelTool as V, Workflow as W, type StepAction as X, type StepVariableType as Y, type StepNode as Z, type StepGraph as _, type MastraPrimitives as a, type VariableReference 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 StepResult as a7, type WorkflowContext as a8, type WorkflowLogMessage as a9, TABLE_TRACES as aA, type WorkflowEvent as aa, type ResolverFunctionInput as ab, type ResolverFunctionOutput as ac, type SubscriberFunctionOutput as ad, type DependencyCheckOutput as ae, type WorkflowActors as af, type WorkflowActionParams as ag, type WorkflowActions as ah, type WorkflowState as ai, type StepId as aj, type ExtractSchemaFromStep as ak, type ExtractStepResult as al, type StepInputType as am, type ExtractSchemaType as an, type PathsToStringProps as ao, type WorkflowRunState as ap, type WorkflowResumeResult as aq, createStep as ar, type ToolsInput as as, type ToolsetsInput as at, type AgentGenerateOptions as au, type AgentStreamOptions as av, TABLE_WORKFLOW_SNAPSHOT as aw, TABLE_EVALS as ax, TABLE_MESSAGES as ay, TABLE_THREADS as az, MastraMemory as b, MastraStorage as c, type TABLE_NAMES as d, type StorageThreadType as e, type MessageType as f, type StorageGetMessagesArg as g, type AgentConfig as h, type ToolExecutionContext as i, Step as j, type WorkflowOptions as k, type WorkflowRow as l, type CoreMessage as m, type CoreSystemMessage as n, type CoreAssistantMessage as o, type CoreUserMessage as p, type CoreToolMessage as q, type EmbedResult as r, type EmbedManyResult as s, type StructuredOutputType as t, type StructuredOutputArrayItem as u, type StructuredOutput as v, type StreamReturn as w, type DefaultLLMTextObjectOptions as x, type DefaultLLMStreamOptions as y, type DefaultLLMStreamObjectOptions as z };
1119
+ export { type StepGraph as $, Agent as A, type BaseStructuredOutputType as B, type CoreTool as C, type DefaultLLMTextOptions as D, type EvalRow as E, type DefaultLLMStreamObjectOptions as F, type GenerateReturn as G, type LLMTextOptions as H, type LLMTextObjectOptions as I, type LLMStreamOptions as J, type LLMInnerStreamOptions as K, type LanguageModel as L, Mastra as M, type LLMStreamObjectOptions as N, type OutputType as O, type Config as P, type MessageResponse as Q, type MemoryConfig as R, type StorageColumn as S, type ToolAction as T, type SharedMemoryConfig as U, type VercelTool as V, Workflow as W, type StepExecutionContext as X, type StepAction as Y, type StepVariableType as Z, type StepNode as _, type ToolsInput as a, type RetryConfig as a0, type VariableReference as a1, type BaseCondition as a2, type ActionContext as a3, WhenConditionReturnValue as a4, type StepDef as a5, type StepCondition as a6, type StepConfig as a7, type StepResult as a8, type WorkflowContext as a9, TABLE_TRACES as aA, type WorkflowLogMessage as aa, type WorkflowEvent as ab, type ResolverFunctionInput as ac, type ResolverFunctionOutput as ad, type SubscriberFunctionOutput as ae, type DependencyCheckOutput as af, type WorkflowActors as ag, type WorkflowActionParams as ah, type WorkflowActions as ai, type WorkflowState as aj, type StepId as ak, type ExtractSchemaFromStep as al, type ExtractStepResult as am, type StepInputType as an, type ExtractSchemaType as ao, type PathsToStringProps as ap, type WorkflowRunState as aq, type WorkflowResumeResult as ar, createStep as as, type ToolsetsInput as at, type AgentGenerateOptions as au, type AgentStreamOptions as av, TABLE_WORKFLOW_SNAPSHOT as aw, TABLE_EVALS as ax, TABLE_MESSAGES as ay, TABLE_THREADS as az, type MastraPrimitives as b, MastraMemory as c, MastraStorage as d, type TABLE_NAMES as e, type StorageThreadType as f, type MessageType as g, type StorageGetMessagesArg as h, type AgentConfig as i, type ToolExecutionContext as j, Step as k, type WorkflowOptions as l, type WorkflowRow as m, type CoreMessage as n, type CoreSystemMessage as o, type CoreAssistantMessage as p, type CoreUserMessage as q, type CoreToolMessage as r, type EmbedResult as s, type EmbedManyResult as t, type StructuredOutputType as u, type StructuredOutputArrayItem as v, type StructuredOutput as w, type StreamReturn as x, type DefaultLLMTextObjectOptions as y, type DefaultLLMStreamOptions as z };
@@ -1,4 +1,4 @@
1
- import { Agent } from './chunk-SWDQYPJS.js';
1
+ import { Agent } from './chunk-TWAIC2XA.js';
2
2
  import { CohereClient } from 'cohere-ai';
3
3
 
4
4
  var CohereRelevanceScorer = class {
@@ -1,4 +1,4 @@
1
- import { createMastraProxy } from './chunk-HBHPTMAC.js';
1
+ import { createMastraProxy } from './chunk-IM7CM3DU.js';
2
2
  import { MastraBase } from './chunk-4VHCCQ7P.js';
3
3
  import { setTimeout } from 'node:timers/promises';
4
4
  import { context, trace } from '@opentelemetry/api';
@@ -1207,6 +1207,7 @@ var Workflow = class extends MastraBase {
1207
1207
  telemetry: mastra.getTelemetry(),
1208
1208
  logger: mastra.getLogger()
1209
1209
  });
1210
+ this.#mastra = mastra;
1210
1211
  }
1211
1212
  }
1212
1213
  step(step, config) {
@@ -1508,10 +1509,14 @@ var Workflow = class extends MastraBase {
1508
1509
  return await context.with(
1509
1510
  trace.setSpan(context.active(), this.getExecutionSpan(attributes?.runId ?? data?.runId)),
1510
1511
  async () => {
1511
- return this.#mastra.telemetry.traceMethod(handler2, {
1512
- spanName,
1513
- attributes
1514
- })(data);
1512
+ if (this?.telemetry) {
1513
+ return this.telemetry.traceMethod(handler2, {
1514
+ spanName,
1515
+ attributes
1516
+ })(data);
1517
+ } else {
1518
+ return handler2(data);
1519
+ }
1515
1520
  }
1516
1521
  );
1517
1522
  };
@@ -1525,7 +1530,7 @@ var Workflow = class extends MastraBase {
1525
1530
  ...payload,
1526
1531
  ...context
1527
1532
  };
1528
- const finalAction = this.#mastra?.getTelemetry() ? executeStep(execute, `workflow.${this.name}.action.${stepId}`, {
1533
+ const finalAction = this.telemetry ? executeStep(execute, `workflow.${this.name}.action.${stepId}`, {
1529
1534
  componentName: this.name,
1530
1535
  runId: rest.runId
1531
1536
  }) : execute;