@mastra/core 0.4.3-alpha.3 → 0.4.3-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 (37) hide show
  1. package/dist/agent/index.cjs +73 -20
  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-BhXOsdEx.d.cts → base-CbCmDLUb.d.cts} +6 -1
  6. package/dist/{base-CZA3AlwW.d.ts → base-DqRXkxCw.d.ts} +6 -1
  7. package/dist/{chunk-VRY5N2EB.js → chunk-E7K35ROR.js} +73 -20
  8. package/dist/{chunk-N4UKSVX4.js → chunk-JXEH6PBQ.js} +1 -1
  9. package/dist/eval/index.d.cts +1 -1
  10. package/dist/eval/index.d.ts +1 -1
  11. package/dist/index.cjs +73 -20
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +2 -2
  15. package/dist/integration/index.d.cts +2 -2
  16. package/dist/integration/index.d.ts +2 -2
  17. package/dist/llm/index.d.cts +1 -1
  18. package/dist/llm/index.d.ts +1 -1
  19. package/dist/mastra/index.d.cts +2 -2
  20. package/dist/mastra/index.d.ts +2 -2
  21. package/dist/memory/index.d.cts +1 -1
  22. package/dist/memory/index.d.ts +1 -1
  23. package/dist/relevance/index.cjs +73 -20
  24. package/dist/relevance/index.js +1 -1
  25. package/dist/storage/index.d.cts +1 -1
  26. package/dist/storage/index.d.ts +1 -1
  27. package/dist/storage/libsql/index.d.cts +1 -1
  28. package/dist/storage/libsql/index.d.ts +1 -1
  29. package/dist/telemetry/index.d.cts +1 -1
  30. package/dist/telemetry/index.d.ts +1 -1
  31. package/dist/tools/index.d.cts +2 -2
  32. package/dist/tools/index.d.ts +2 -2
  33. package/dist/{workflow-87-9uPHk.d.cts → workflow-DlRFMI4Q.d.cts} +1 -1
  34. package/dist/{workflow-BVt16qBd.d.ts → workflow-fGgxPZk4.d.ts} +1 -1
  35. package/dist/workflows/index.d.cts +3 -3
  36. package/dist/workflows/index.d.ts +3 -3
  37. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -646,7 +646,9 @@ var MastraLLM = class extends MastraLLMBase {
646
646
  }
647
647
  convertTools({
648
648
  tools,
649
- runId
649
+ runId,
650
+ threadId,
651
+ resourceId
650
652
  } = {}) {
651
653
  this.logger.debug("Starting tool conversion for LLM");
652
654
  const converted = Object.entries(tools || {}).reduce((memo, value) => {
@@ -664,6 +666,8 @@ var MastraLLM = class extends MastraLLMBase {
664
666
  });
665
667
  return tool?.execute?.({
666
668
  context: props,
669
+ threadId,
670
+ resourceId,
667
671
  mastra: this.#mastra,
668
672
  runId
669
673
  }, options) ?? void 0;
@@ -671,7 +675,10 @@ var MastraLLM = class extends MastraLLMBase {
671
675
  this.logger.error("Error executing tool", {
672
676
  tool: k,
673
677
  props,
674
- error
678
+ error,
679
+ runId,
680
+ threadId,
681
+ resourceId
675
682
  });
676
683
  throw error;
677
684
  }
@@ -694,6 +701,8 @@ var MastraLLM = class extends MastraLLMBase {
694
701
  onStepFinish,
695
702
  experimental_output,
696
703
  telemetry,
704
+ threadId,
705
+ resourceId,
697
706
  ...rest
698
707
  }) {
699
708
  const model = this.#model;
@@ -701,11 +710,15 @@ var MastraLLM = class extends MastraLLMBase {
701
710
  runId,
702
711
  messages,
703
712
  maxSteps,
713
+ threadId,
714
+ resourceId,
704
715
  tools: Object.keys(tools || convertedTools || {})
705
716
  });
706
717
  const finalTools = convertedTools || this.convertTools({
707
718
  tools,
708
- runId
719
+ runId,
720
+ threadId,
721
+ resourceId
709
722
  });
710
723
  const argsForExecute = {
711
724
  model,
@@ -771,6 +784,8 @@ var MastraLLM = class extends MastraLLMBase {
771
784
  temperature,
772
785
  toolChoice = "auto",
773
786
  telemetry,
787
+ threadId,
788
+ resourceId,
774
789
  ...rest
775
790
  }) {
776
791
  const model = this.#model;
@@ -779,7 +794,9 @@ var MastraLLM = class extends MastraLLMBase {
779
794
  });
780
795
  const finalTools = convertedTools || this.convertTools({
781
796
  tools,
782
- runId
797
+ runId,
798
+ threadId,
799
+ resourceId
783
800
  });
784
801
  const argsForExecute = {
785
802
  model,
@@ -842,18 +859,24 @@ var MastraLLM = class extends MastraLLMBase {
842
859
  toolChoice = "auto",
843
860
  experimental_output,
844
861
  telemetry,
862
+ threadId,
863
+ resourceId,
845
864
  ...rest
846
865
  }) {
847
866
  const model = this.#model;
848
867
  this.logger.debug(`[LLM] - Streaming text`, {
849
868
  runId,
869
+ threadId,
870
+ resourceId,
850
871
  messages,
851
872
  maxSteps,
852
873
  tools: Object.keys(tools || convertedTools || {})
853
874
  });
854
875
  const finalTools = convertedTools || this.convertTools({
855
876
  tools,
856
- runId
877
+ runId,
878
+ threadId,
879
+ resourceId
857
880
  });
858
881
  const argsForExecute = {
859
882
  model,
@@ -888,7 +911,9 @@ var MastraLLM = class extends MastraLLMBase {
888
911
  toolResults: props?.toolResults,
889
912
  finishReason: props?.finishReason,
890
913
  usage: props?.usage,
891
- runId
914
+ runId,
915
+ threadId,
916
+ resourceId
892
917
  });
893
918
  },
894
919
  ...rest
@@ -931,6 +956,8 @@ var MastraLLM = class extends MastraLLMBase {
931
956
  temperature,
932
957
  toolChoice = "auto",
933
958
  telemetry,
959
+ threadId,
960
+ resourceId,
934
961
  ...rest
935
962
  }) {
936
963
  const model = this.#model;
@@ -942,7 +969,9 @@ var MastraLLM = class extends MastraLLMBase {
942
969
  });
943
970
  const finalTools = convertedTools || this.convertTools({
944
971
  tools,
945
- runId
972
+ runId,
973
+ threadId,
974
+ resourceId
946
975
  });
947
976
  const argsForExecute = {
948
977
  model,
@@ -960,7 +989,9 @@ var MastraLLM = class extends MastraLLMBase {
960
989
  toolResults: props?.toolResults,
961
990
  finishReason: props?.finishReason,
962
991
  usage: props?.usage,
963
- runId
992
+ runId,
993
+ threadId,
994
+ resourceId
964
995
  });
965
996
  if (props?.response?.headers?.["x-ratelimit-remaining-tokens"] && parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"], 10) < 2e3) {
966
997
  this.logger.warn("Rate limit approaching, waiting 10 seconds", {
@@ -977,7 +1008,9 @@ var MastraLLM = class extends MastraLLMBase {
977
1008
  toolResults: props?.toolResults,
978
1009
  finishReason: props?.finishReason,
979
1010
  usage: props?.usage,
980
- runId
1011
+ runId,
1012
+ threadId,
1013
+ resourceId
981
1014
  });
982
1015
  },
983
1016
  ...rest
@@ -1864,11 +1897,14 @@ var Agent = class extends (_a = MastraBase) {
1864
1897
  }
1865
1898
  convertTools({
1866
1899
  toolsets,
1867
- // threadId,
1900
+ threadId,
1901
+ resourceId,
1868
1902
  runId
1869
1903
  }) {
1870
1904
  this.logger.debug(`[Agents:${this.name}] - Assigning tools`, {
1871
- runId
1905
+ runId,
1906
+ threadId,
1907
+ resourceId
1872
1908
  });
1873
1909
  const converted = Object.entries(this.tools || {}).reduce((memo, value) => {
1874
1910
  const k = value[0];
@@ -1883,17 +1919,23 @@ var Agent = class extends (_a = MastraBase) {
1883
1919
  name: k,
1884
1920
  description: tool.description,
1885
1921
  args,
1886
- runId
1922
+ runId,
1923
+ threadId,
1924
+ resourceId
1887
1925
  });
1888
1926
  return tool?.execute?.({
1889
1927
  context: args,
1890
1928
  mastra: this.#mastra,
1891
- runId
1929
+ runId,
1930
+ threadId,
1931
+ resourceId
1892
1932
  }, options) ?? void 0;
1893
1933
  } catch (err) {
1894
1934
  this.logger.error(`[Agent:${this.name}] - Failed execution`, {
1895
1935
  error: err,
1896
- runId
1936
+ runId,
1937
+ threadId,
1938
+ resourceId
1897
1939
  });
1898
1940
  throw err;
1899
1941
  }
@@ -1922,18 +1964,24 @@ var Agent = class extends (_a = MastraBase) {
1922
1964
  name: toolName,
1923
1965
  description: toolObj.description,
1924
1966
  args,
1925
- runId
1967
+ runId,
1968
+ threadId,
1969
+ resourceId
1926
1970
  });
1927
1971
  return toolObj?.execute?.({
1928
1972
  context: args,
1929
- runId
1973
+ runId,
1974
+ threadId,
1975
+ resourceId
1930
1976
  }, options) ?? void 0;
1931
- } catch (err) {
1977
+ } catch (error) {
1932
1978
  this.logger.error(`[Agent:${this.name}] - Failed toolset execution`, {
1933
- error: err,
1934
- runId
1979
+ error,
1980
+ runId,
1981
+ threadId,
1982
+ resourceId
1935
1983
  });
1936
- throw err;
1984
+ throw error;
1937
1985
  }
1938
1986
  } : void 0
1939
1987
  };
@@ -2028,6 +2076,7 @@ var Agent = class extends (_a = MastraBase) {
2028
2076
  convertedTools = this.convertTools({
2029
2077
  toolsets,
2030
2078
  threadId: threadIdToUse,
2079
+ resourceId,
2031
2080
  runId
2032
2081
  });
2033
2082
  }
@@ -2164,6 +2213,8 @@ var Agent = class extends (_a = MastraBase) {
2164
2213
  temperature,
2165
2214
  toolChoice: toolChoice || "auto",
2166
2215
  experimental_output,
2216
+ threadId,
2217
+ resourceId,
2167
2218
  ...rest
2168
2219
  });
2169
2220
  const outputText2 = result2.text;
@@ -2189,6 +2240,8 @@ var Agent = class extends (_a = MastraBase) {
2189
2240
  temperature,
2190
2241
  toolChoice,
2191
2242
  telemetry,
2243
+ threadId,
2244
+ resourceId,
2192
2245
  ...rest
2193
2246
  });
2194
2247
  const outputText2 = result2.text;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as Metric } from './types-m9RryK9a.cjs';
2
2
  export { M as MetricResult, T as TestInfo } from './types-m9RryK9a.cjs';
3
- import { m as ToolAction, A as Agent$1, n as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, o as ToolExecutionContext, W as WorkflowOptions } from './base-BhXOsdEx.cjs';
4
- export { a1 as ActionContext, a0 as BaseCondition, B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, Z as CoreTool, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, aa as DependencyCheckOutput, v as EmbedManyResult, u as EmbedResult, E as EvalRow, ag as ExtractSchemaFromStep, aj as ExtractSchemaType, ah as ExtractStepResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, X as MemoryConfig, V as MessageResponse, c as MessageType, O as OutputType, ak as PathsToStringProps, a7 as ResolverFunctionInput, a8 as ResolverFunctionOutput, R as RetryConfig, Y as SharedMemoryConfig, f as StepAction, a3 as StepCondition, j as StepConfig, a2 as StepDef, e as StepExecutionContext, l as StepGraph, af as StepId, ai as StepInputType, _ as StepNode, h as StepResult, i as StepVariableType, S as StorageColumn, d as StorageGetMessagesArg, b as StorageThreadType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType, a9 as SubscriberFunctionOutput, $ as VariableReference, ac as WorkflowActionParams, ad as WorkflowActions, ab as WorkflowActors, a4 as WorkflowContext, a6 as WorkflowEvent, a5 as WorkflowLogMessage, al as WorkflowResumeResult, p as WorkflowRow, k as WorkflowRunState, ae as WorkflowState } from './base-BhXOsdEx.cjs';
3
+ import { m as ToolAction, A as Agent$1, n as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, o as ToolExecutionContext, W as WorkflowOptions } from './base-CbCmDLUb.cjs';
4
+ export { a1 as ActionContext, a0 as BaseCondition, B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, Z as CoreTool, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, aa as DependencyCheckOutput, v as EmbedManyResult, u as EmbedResult, E as EvalRow, ag as ExtractSchemaFromStep, aj as ExtractSchemaType, ah as ExtractStepResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, X as MemoryConfig, V as MessageResponse, c as MessageType, O as OutputType, ak as PathsToStringProps, a7 as ResolverFunctionInput, a8 as ResolverFunctionOutput, R as RetryConfig, Y as SharedMemoryConfig, f as StepAction, a3 as StepCondition, j as StepConfig, a2 as StepDef, e as StepExecutionContext, l as StepGraph, af as StepId, ai as StepInputType, _ as StepNode, h as StepResult, i as StepVariableType, S as StorageColumn, d as StorageGetMessagesArg, b as StorageThreadType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType, a9 as SubscriberFunctionOutput, $ as VariableReference, ac as WorkflowActionParams, ad as WorkflowActions, ab as WorkflowActors, a4 as WorkflowContext, a6 as WorkflowEvent, a5 as WorkflowLogMessage, al as WorkflowResumeResult, p as WorkflowRow, k as WorkflowRunState, ae as WorkflowState } from './base-CbCmDLUb.cjs';
5
5
  import { M as MastraBase$1 } from './base-hs9NDAZ2.cjs';
6
6
  export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from './base-hs9NDAZ2.cjs';
7
7
  import { R as RegisteredLogger, a as LogLevel, T as TransportMap, L as Logger } from './index-mKY1XrpK.cjs';
@@ -19,8 +19,8 @@ import { MastraTTS as MastraTTS$1, TTSConfig } from './tts/index.cjs';
19
19
  export { TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './utils.cjs';
20
20
  import { MastraVector as MastraVector$1 } from './vector/index.cjs';
21
21
  export { CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorParams, UpsertVectorParams } from './vector/index.cjs';
22
- import { S as Step, W as Workflow$1 } from './workflow-87-9uPHk.cjs';
23
- export { c as createStep } from './workflow-87-9uPHk.cjs';
22
+ import { S as Step, W as Workflow$1 } from './workflow-DlRFMI4Q.cjs';
23
+ export { c as createStep } from './workflow-DlRFMI4Q.cjs';
24
24
  export { getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isErrorEvent, isFinalState, isTransitionEvent, isVariableReference, mergeChildValue, recursivelyCheckForFinalState, updateStepInHierarchy } from './workflows/index.cjs';
25
25
  export { AvailableHooks, executeHook, registerHook } from './hooks/index.cjs';
26
26
  export { Message as AiMessageType } from 'ai';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as Metric } from './types-m9RryK9a.js';
2
2
  export { M as MetricResult, T as TestInfo } from './types-m9RryK9a.js';
3
- import { m as ToolAction, A as Agent$1, n as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, o as ToolExecutionContext, W as WorkflowOptions } from './base-CZA3AlwW.js';
4
- export { a1 as ActionContext, a0 as BaseCondition, B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, Z as CoreTool, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, aa as DependencyCheckOutput, v as EmbedManyResult, u as EmbedResult, E as EvalRow, ag as ExtractSchemaFromStep, aj as ExtractSchemaType, ah as ExtractStepResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, X as MemoryConfig, V as MessageResponse, c as MessageType, O as OutputType, ak as PathsToStringProps, a7 as ResolverFunctionInput, a8 as ResolverFunctionOutput, R as RetryConfig, Y as SharedMemoryConfig, f as StepAction, a3 as StepCondition, j as StepConfig, a2 as StepDef, e as StepExecutionContext, l as StepGraph, af as StepId, ai as StepInputType, _ as StepNode, h as StepResult, i as StepVariableType, S as StorageColumn, d as StorageGetMessagesArg, b as StorageThreadType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType, a9 as SubscriberFunctionOutput, $ as VariableReference, ac as WorkflowActionParams, ad as WorkflowActions, ab as WorkflowActors, a4 as WorkflowContext, a6 as WorkflowEvent, a5 as WorkflowLogMessage, al as WorkflowResumeResult, p as WorkflowRow, k as WorkflowRunState, ae as WorkflowState } from './base-CZA3AlwW.js';
3
+ import { m as ToolAction, A as Agent$1, n as AgentConfig, M as MastraStorage$1, a as MastraMemory$1, o as ToolExecutionContext, W as WorkflowOptions } from './base-DqRXkxCw.js';
4
+ export { a1 as ActionContext, a0 as BaseCondition, B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, Z as CoreTool, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, aa as DependencyCheckOutput, v as EmbedManyResult, u as EmbedResult, E as EvalRow, ag as ExtractSchemaFromStep, aj as ExtractSchemaType, ah as ExtractStepResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, X as MemoryConfig, V as MessageResponse, c as MessageType, O as OutputType, ak as PathsToStringProps, a7 as ResolverFunctionInput, a8 as ResolverFunctionOutput, R as RetryConfig, Y as SharedMemoryConfig, f as StepAction, a3 as StepCondition, j as StepConfig, a2 as StepDef, e as StepExecutionContext, l as StepGraph, af as StepId, ai as StepInputType, _ as StepNode, h as StepResult, i as StepVariableType, S as StorageColumn, d as StorageGetMessagesArg, b as StorageThreadType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType, a9 as SubscriberFunctionOutput, $ as VariableReference, ac as WorkflowActionParams, ad as WorkflowActions, ab as WorkflowActors, a4 as WorkflowContext, a6 as WorkflowEvent, a5 as WorkflowLogMessage, al as WorkflowResumeResult, p as WorkflowRow, k as WorkflowRunState, ae as WorkflowState } from './base-DqRXkxCw.js';
5
5
  import { M as MastraBase$1 } from './base-D90KQ4XI.js';
6
6
  export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from './base-D90KQ4XI.js';
7
7
  import { R as RegisteredLogger, a as LogLevel, T as TransportMap, L as Logger } from './index-mKY1XrpK.js';
@@ -19,8 +19,8 @@ import { MastraTTS as MastraTTS$1, TTSConfig } from './tts/index.js';
19
19
  export { TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './utils.js';
20
20
  import { MastraVector as MastraVector$1 } from './vector/index.js';
21
21
  export { CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorParams, UpsertVectorParams } from './vector/index.js';
22
- import { S as Step, W as Workflow$1 } from './workflow-BVt16qBd.js';
23
- export { c as createStep } from './workflow-BVt16qBd.js';
22
+ import { S as Step, W as Workflow$1 } from './workflow-fGgxPZk4.js';
23
+ export { c as createStep } from './workflow-fGgxPZk4.js';
24
24
  export { getActivePathsAndStatus, getResultActivePaths, getStepResult, getSuspendedPaths, isErrorEvent, isFinalState, isTransitionEvent, isVariableReference, mergeChildValue, recursivelyCheckForFinalState, updateStepInHierarchy } from './workflows/index.js';
25
25
  export { AvailableHooks, executeHook, registerHook } from './hooks/index.js';
26
26
  export { Message as AiMessageType } from 'ai';
package/dist/index.js CHANGED
@@ -7,9 +7,9 @@ export { createTool } from './chunk-ZINPRHAN.js';
7
7
  export { Mastra } from './chunk-NGD2HQYW.js';
8
8
  import { MastraMemory } from './chunk-5NRHVENG.js';
9
9
  import { MastraVector } from './chunk-I5KM37BN.js';
10
- export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-N4UKSVX4.js';
10
+ export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-JXEH6PBQ.js';
11
11
  import { MastraStorage } from './chunk-5XPCMNGW.js';
12
- import { Agent } from './chunk-VRY5N2EB.js';
12
+ import { Agent } from './chunk-E7K35ROR.js';
13
13
  export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, Telemetry, hasActiveTelemetry, withSpan } from './chunk-W5HVJX45.js';
14
14
  export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-WIBGG4X6.js';
15
15
  import { MastraDeployer } from './chunk-4YRYBCOZ.js';
@@ -1,6 +1,6 @@
1
- import { W as Workflow } from '../workflow-87-9uPHk.cjs';
1
+ import { W as Workflow } from '../workflow-DlRFMI4Q.cjs';
2
2
  import '../base-hs9NDAZ2.cjs';
3
- import { m as ToolAction } from '../base-BhXOsdEx.cjs';
3
+ import { m as ToolAction } from '../base-CbCmDLUb.cjs';
4
4
  import '@opentelemetry/api';
5
5
  import 'zod';
6
6
  import '../index-mKY1XrpK.cjs';
@@ -1,6 +1,6 @@
1
- import { W as Workflow } from '../workflow-BVt16qBd.js';
1
+ import { W as Workflow } from '../workflow-fGgxPZk4.js';
2
2
  import '../base-D90KQ4XI.js';
3
- import { m as ToolAction } from '../base-CZA3AlwW.js';
3
+ import { m as ToolAction } from '../base-DqRXkxCw.js';
4
4
  import '@opentelemetry/api';
5
5
  import 'zod';
6
6
  import '../index-mKY1XrpK.js';
@@ -1,7 +1,7 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, v as EmbedManyResult, u as EmbedResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, O as OutputType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType } from '../base-BhXOsdEx.cjs';
4
+ export { B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, v as EmbedManyResult, u as EmbedResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, O as OutputType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType } from '../base-CbCmDLUb.cjs';
5
5
  import '../index-mKY1XrpK.cjs';
6
6
  import '../base-hs9NDAZ2.cjs';
7
7
  import '@opentelemetry/api';
@@ -1,7 +1,7 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, v as EmbedManyResult, u as EmbedResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, O as OutputType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType } from '../base-CZA3AlwW.js';
4
+ export { B as BaseStructuredOutputType, r as CoreAssistantMessage, C as CoreMessage, q as CoreSystemMessage, t as CoreToolMessage, s as CoreUserMessage, J as DefaultLLMStreamObjectOptions, H as DefaultLLMStreamOptions, F as DefaultLLMTextObjectOptions, D as DefaultLLMTextOptions, v as EmbedManyResult, u as EmbedResult, G as GenerateReturn, Q as LLMInnerStreamOptions, U as LLMStreamObjectOptions, P as LLMStreamOptions, N as LLMTextObjectOptions, K as LLMTextOptions, L as LanguageModel, O as OutputType, z as StreamReturn, y as StructuredOutput, x as StructuredOutputArrayItem, w as StructuredOutputType } from '../base-DqRXkxCw.js';
5
5
  import '../index-mKY1XrpK.js';
6
6
  import '../base-D90KQ4XI.js';
7
7
  import '@opentelemetry/api';
@@ -1,6 +1,6 @@
1
- import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-BhXOsdEx.cjs';
1
+ import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-CbCmDLUb.cjs';
2
2
  import { L as Logger, B as BaseLogMessage } from '../index-mKY1XrpK.cjs';
3
- import { W as Workflow } from '../workflow-87-9uPHk.cjs';
3
+ import { W as Workflow } from '../workflow-DlRFMI4Q.cjs';
4
4
  import { MastraVector } from '../vector/index.cjs';
5
5
  import { O as OtelConfig, T as Telemetry } from '../base-hs9NDAZ2.cjs';
6
6
  import { MastraTTS } from '../tts/index.cjs';
@@ -1,6 +1,6 @@
1
- import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-CZA3AlwW.js';
1
+ import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-DqRXkxCw.js';
2
2
  import { L as Logger, B as BaseLogMessage } from '../index-mKY1XrpK.js';
3
- import { W as Workflow } from '../workflow-BVt16qBd.js';
3
+ import { W as Workflow } from '../workflow-fGgxPZk4.js';
4
4
  import { MastraVector } from '../vector/index.js';
5
5
  import { O as OtelConfig, T as Telemetry } from '../base-D90KQ4XI.js';
6
6
  import { MastraTTS } from '../tts/index.js';
@@ -1,4 +1,4 @@
1
- export { a as MastraMemory, X as MemoryConfig, V as MessageResponse, c as MessageType, Y as SharedMemoryConfig, b as StorageThreadType } from '../base-BhXOsdEx.cjs';
1
+ export { a as MastraMemory, X as MemoryConfig, V as MessageResponse, c as MessageType, Y as SharedMemoryConfig, b as StorageThreadType } from '../base-CbCmDLUb.cjs';
2
2
  export { Message as AiMessageType } from 'ai';
3
3
  import '../base-hs9NDAZ2.cjs';
4
4
  import '@opentelemetry/api';
@@ -1,4 +1,4 @@
1
- export { a as MastraMemory, X as MemoryConfig, V as MessageResponse, c as MessageType, Y as SharedMemoryConfig, b as StorageThreadType } from '../base-CZA3AlwW.js';
1
+ export { a as MastraMemory, X as MemoryConfig, V as MessageResponse, c as MessageType, Y as SharedMemoryConfig, b as StorageThreadType } from '../base-DqRXkxCw.js';
2
2
  export { Message as AiMessageType } from 'ai';
3
3
  import '../base-D90KQ4XI.js';
4
4
  import '@opentelemetry/api';
@@ -416,7 +416,9 @@ var MastraLLM = class extends MastraLLMBase {
416
416
  }
417
417
  convertTools({
418
418
  tools,
419
- runId
419
+ runId,
420
+ threadId,
421
+ resourceId
420
422
  } = {}) {
421
423
  this.logger.debug("Starting tool conversion for LLM");
422
424
  const converted = Object.entries(tools || {}).reduce((memo, value) => {
@@ -434,6 +436,8 @@ var MastraLLM = class extends MastraLLMBase {
434
436
  });
435
437
  return tool?.execute?.({
436
438
  context: props,
439
+ threadId,
440
+ resourceId,
437
441
  mastra: this.#mastra,
438
442
  runId
439
443
  }, options) ?? void 0;
@@ -441,7 +445,10 @@ var MastraLLM = class extends MastraLLMBase {
441
445
  this.logger.error("Error executing tool", {
442
446
  tool: k,
443
447
  props,
444
- error
448
+ error,
449
+ runId,
450
+ threadId,
451
+ resourceId
445
452
  });
446
453
  throw error;
447
454
  }
@@ -464,6 +471,8 @@ var MastraLLM = class extends MastraLLMBase {
464
471
  onStepFinish,
465
472
  experimental_output,
466
473
  telemetry,
474
+ threadId,
475
+ resourceId,
467
476
  ...rest
468
477
  }) {
469
478
  const model = this.#model;
@@ -471,11 +480,15 @@ var MastraLLM = class extends MastraLLMBase {
471
480
  runId,
472
481
  messages,
473
482
  maxSteps,
483
+ threadId,
484
+ resourceId,
474
485
  tools: Object.keys(tools || convertedTools || {})
475
486
  });
476
487
  const finalTools = convertedTools || this.convertTools({
477
488
  tools,
478
- runId
489
+ runId,
490
+ threadId,
491
+ resourceId
479
492
  });
480
493
  const argsForExecute = {
481
494
  model,
@@ -541,6 +554,8 @@ var MastraLLM = class extends MastraLLMBase {
541
554
  temperature,
542
555
  toolChoice = "auto",
543
556
  telemetry,
557
+ threadId,
558
+ resourceId,
544
559
  ...rest
545
560
  }) {
546
561
  const model = this.#model;
@@ -549,7 +564,9 @@ var MastraLLM = class extends MastraLLMBase {
549
564
  });
550
565
  const finalTools = convertedTools || this.convertTools({
551
566
  tools,
552
- runId
567
+ runId,
568
+ threadId,
569
+ resourceId
553
570
  });
554
571
  const argsForExecute = {
555
572
  model,
@@ -612,18 +629,24 @@ var MastraLLM = class extends MastraLLMBase {
612
629
  toolChoice = "auto",
613
630
  experimental_output,
614
631
  telemetry,
632
+ threadId,
633
+ resourceId,
615
634
  ...rest
616
635
  }) {
617
636
  const model = this.#model;
618
637
  this.logger.debug(`[LLM] - Streaming text`, {
619
638
  runId,
639
+ threadId,
640
+ resourceId,
620
641
  messages,
621
642
  maxSteps,
622
643
  tools: Object.keys(tools || convertedTools || {})
623
644
  });
624
645
  const finalTools = convertedTools || this.convertTools({
625
646
  tools,
626
- runId
647
+ runId,
648
+ threadId,
649
+ resourceId
627
650
  });
628
651
  const argsForExecute = {
629
652
  model,
@@ -658,7 +681,9 @@ var MastraLLM = class extends MastraLLMBase {
658
681
  toolResults: props?.toolResults,
659
682
  finishReason: props?.finishReason,
660
683
  usage: props?.usage,
661
- runId
684
+ runId,
685
+ threadId,
686
+ resourceId
662
687
  });
663
688
  },
664
689
  ...rest
@@ -701,6 +726,8 @@ var MastraLLM = class extends MastraLLMBase {
701
726
  temperature,
702
727
  toolChoice = "auto",
703
728
  telemetry,
729
+ threadId,
730
+ resourceId,
704
731
  ...rest
705
732
  }) {
706
733
  const model = this.#model;
@@ -712,7 +739,9 @@ var MastraLLM = class extends MastraLLMBase {
712
739
  });
713
740
  const finalTools = convertedTools || this.convertTools({
714
741
  tools,
715
- runId
742
+ runId,
743
+ threadId,
744
+ resourceId
716
745
  });
717
746
  const argsForExecute = {
718
747
  model,
@@ -730,7 +759,9 @@ var MastraLLM = class extends MastraLLMBase {
730
759
  toolResults: props?.toolResults,
731
760
  finishReason: props?.finishReason,
732
761
  usage: props?.usage,
733
- runId
762
+ runId,
763
+ threadId,
764
+ resourceId
734
765
  });
735
766
  if (props?.response?.headers?.["x-ratelimit-remaining-tokens"] && parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"], 10) < 2e3) {
736
767
  this.logger.warn("Rate limit approaching, waiting 10 seconds", {
@@ -747,7 +778,9 @@ var MastraLLM = class extends MastraLLMBase {
747
778
  toolResults: props?.toolResults,
748
779
  finishReason: props?.finishReason,
749
780
  usage: props?.usage,
750
- runId
781
+ runId,
782
+ threadId,
783
+ resourceId
751
784
  });
752
785
  },
753
786
  ...rest
@@ -1320,11 +1353,14 @@ var Agent = class extends (_a = MastraBase) {
1320
1353
  }
1321
1354
  convertTools({
1322
1355
  toolsets,
1323
- // threadId,
1356
+ threadId,
1357
+ resourceId,
1324
1358
  runId
1325
1359
  }) {
1326
1360
  this.logger.debug(`[Agents:${this.name}] - Assigning tools`, {
1327
- runId
1361
+ runId,
1362
+ threadId,
1363
+ resourceId
1328
1364
  });
1329
1365
  const converted = Object.entries(this.tools || {}).reduce((memo, value) => {
1330
1366
  const k = value[0];
@@ -1339,17 +1375,23 @@ var Agent = class extends (_a = MastraBase) {
1339
1375
  name: k,
1340
1376
  description: tool.description,
1341
1377
  args,
1342
- runId
1378
+ runId,
1379
+ threadId,
1380
+ resourceId
1343
1381
  });
1344
1382
  return tool?.execute?.({
1345
1383
  context: args,
1346
1384
  mastra: this.#mastra,
1347
- runId
1385
+ runId,
1386
+ threadId,
1387
+ resourceId
1348
1388
  }, options) ?? void 0;
1349
1389
  } catch (err) {
1350
1390
  this.logger.error(`[Agent:${this.name}] - Failed execution`, {
1351
1391
  error: err,
1352
- runId
1392
+ runId,
1393
+ threadId,
1394
+ resourceId
1353
1395
  });
1354
1396
  throw err;
1355
1397
  }
@@ -1378,18 +1420,24 @@ var Agent = class extends (_a = MastraBase) {
1378
1420
  name: toolName,
1379
1421
  description: toolObj.description,
1380
1422
  args,
1381
- runId
1423
+ runId,
1424
+ threadId,
1425
+ resourceId
1382
1426
  });
1383
1427
  return toolObj?.execute?.({
1384
1428
  context: args,
1385
- runId
1429
+ runId,
1430
+ threadId,
1431
+ resourceId
1386
1432
  }, options) ?? void 0;
1387
- } catch (err) {
1433
+ } catch (error) {
1388
1434
  this.logger.error(`[Agent:${this.name}] - Failed toolset execution`, {
1389
- error: err,
1390
- runId
1435
+ error,
1436
+ runId,
1437
+ threadId,
1438
+ resourceId
1391
1439
  });
1392
- throw err;
1440
+ throw error;
1393
1441
  }
1394
1442
  } : void 0
1395
1443
  };
@@ -1484,6 +1532,7 @@ var Agent = class extends (_a = MastraBase) {
1484
1532
  convertedTools = this.convertTools({
1485
1533
  toolsets,
1486
1534
  threadId: threadIdToUse,
1535
+ resourceId,
1487
1536
  runId
1488
1537
  });
1489
1538
  }
@@ -1620,6 +1669,8 @@ var Agent = class extends (_a = MastraBase) {
1620
1669
  temperature,
1621
1670
  toolChoice: toolChoice || "auto",
1622
1671
  experimental_output,
1672
+ threadId,
1673
+ resourceId,
1623
1674
  ...rest
1624
1675
  });
1625
1676
  const outputText2 = result2.text;
@@ -1645,6 +1696,8 @@ var Agent = class extends (_a = MastraBase) {
1645
1696
  temperature,
1646
1697
  toolChoice,
1647
1698
  telemetry,
1699
+ threadId,
1700
+ resourceId,
1648
1701
  ...rest
1649
1702
  });
1650
1703
  const outputText2 = result2.text;
@@ -1 +1 @@
1
- export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-N4UKSVX4.js';
1
+ export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from '../chunk-JXEH6PBQ.js';
@@ -1,4 +1,4 @@
1
- export { E as EvalRow, M as MastraStorage, S as StorageColumn, d as StorageGetMessagesArg, ar as TABLE_EVALS, as as TABLE_MESSAGES, T as TABLE_NAMES, at as TABLE_THREADS, au as TABLE_TRACES, aq as TABLE_WORKFLOW_SNAPSHOT, p as WorkflowRow } from '../base-BhXOsdEx.cjs';
1
+ export { E as EvalRow, M as MastraStorage, S as StorageColumn, d as StorageGetMessagesArg, ar as TABLE_EVALS, as as TABLE_MESSAGES, T as TABLE_NAMES, at as TABLE_THREADS, au as TABLE_TRACES, aq as TABLE_WORKFLOW_SNAPSHOT, p as WorkflowRow } from '../base-CbCmDLUb.cjs';
2
2
  import 'ai';
3
3
  import '../base-hs9NDAZ2.cjs';
4
4
  import '@opentelemetry/api';
@@ -1,4 +1,4 @@
1
- export { E as EvalRow, M as MastraStorage, S as StorageColumn, d as StorageGetMessagesArg, ar as TABLE_EVALS, as as TABLE_MESSAGES, T as TABLE_NAMES, at as TABLE_THREADS, au as TABLE_TRACES, aq as TABLE_WORKFLOW_SNAPSHOT, p as WorkflowRow } from '../base-CZA3AlwW.js';
1
+ export { E as EvalRow, M as MastraStorage, S as StorageColumn, d as StorageGetMessagesArg, ar as TABLE_EVALS, as as TABLE_MESSAGES, T as TABLE_NAMES, at as TABLE_THREADS, au as TABLE_TRACES, aq as TABLE_WORKFLOW_SNAPSHOT, p as WorkflowRow } from '../base-DqRXkxCw.js';
2
2
  import 'ai';
3
3
  import '../base-D90KQ4XI.js';
4
4
  import '@opentelemetry/api';