@mastra/core 0.4.4 → 0.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/agent/index.cjs +64 -6
  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-CbCmDLUb.d.cts → base-BkCP97X_.d.cts} +13 -6
  6. package/dist/{base-DqRXkxCw.d.ts → base-Dx7g7r-P.d.ts} +13 -6
  7. package/dist/{chunk-WIBGG4X6.js → chunk-3GC7P4J6.js} +1 -1
  8. package/dist/{chunk-5NRHVENG.js → chunk-J77G455Q.js} +12 -4
  9. package/dist/{chunk-E7K35ROR.js → chunk-NWPCPTB7.js} +65 -7
  10. package/dist/{chunk-KNVTCZW7.js → chunk-OCOEPT5C.js} +2 -2
  11. package/dist/{chunk-NGD2HQYW.js → chunk-OL5NX3FT.js} +1 -1
  12. package/dist/{chunk-L7SWFW3L.js → chunk-P47D7HYO.js} +2 -2
  13. package/dist/{chunk-JXEH6PBQ.js → chunk-SH6KVX4B.js} +1 -1
  14. package/dist/eval/index.d.cts +1 -1
  15. package/dist/eval/index.d.ts +1 -1
  16. package/dist/index.cjs +78 -12
  17. package/dist/index.d.cts +4 -4
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +5 -5
  20. package/dist/integration/index.d.cts +2 -2
  21. package/dist/integration/index.d.ts +2 -2
  22. package/dist/llm/index.d.cts +1 -1
  23. package/dist/llm/index.d.ts +1 -1
  24. package/dist/mastra/index.cjs +2 -2
  25. package/dist/mastra/index.d.cts +2 -2
  26. package/dist/mastra/index.d.ts +2 -2
  27. package/dist/mastra/index.js +1 -1
  28. package/dist/memory/index.cjs +13 -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 +64 -6
  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 +2 -2
  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 +1 -1
  45. package/dist/utils.js +1 -1
  46. package/dist/vector/libsql/index.cjs +2 -2
  47. package/dist/vector/libsql/index.js +1 -1
  48. package/dist/{workflow-fGgxPZk4.d.ts → workflow-BQyXyWIe.d.ts} +1 -1
  49. package/dist/{workflow-DlRFMI4Q.d.cts → workflow-CLyzcn7-.d.cts} +1 -1
  50. package/dist/workflows/index.d.cts +3 -3
  51. package/dist/workflows/index.d.ts +3 -3
  52. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { a as Metric, T as TestInfo, M as MetricResult } from '../types-m9RryK9a.cjs';
2
- import { A as Agent } from '../base-CbCmDLUb.cjs';
2
+ import { A as Agent } from '../base-BkCP97X_.cjs';
3
3
  import 'ai';
4
4
  import '../base-hs9NDAZ2.cjs';
5
5
  import '@opentelemetry/api';
@@ -1,5 +1,5 @@
1
1
  import { a as Metric, T as TestInfo, M as MetricResult } from '../types-m9RryK9a.js';
2
- import { A as Agent } from '../base-DqRXkxCw.js';
2
+ import { A as Agent } from '../base-Dx7g7r-P.js';
3
3
  import 'ai';
4
4
  import '../base-D90KQ4XI.js';
5
5
  import '@opentelemetry/api';
package/dist/index.cjs CHANGED
@@ -505,7 +505,7 @@ Examples: ${value.examples.join(", ")}` : ""));
505
505
  if (requiredFields.includes(key)) {
506
506
  zodSchema[key] = zodType;
507
507
  } else {
508
- zodSchema[key] = zodType.nullable();
508
+ zodSchema[key] = zodType.nullable().optional();
509
509
  }
510
510
  }
511
511
  return zod.z.object(zodSchema);
@@ -648,7 +648,8 @@ var MastraLLM = class extends MastraLLMBase {
648
648
  tools,
649
649
  runId,
650
650
  threadId,
651
- resourceId
651
+ resourceId,
652
+ memory
652
653
  } = {}) {
653
654
  this.logger.debug("Starting tool conversion for LLM");
654
655
  const converted = Object.entries(tools || {}).reduce((memo, value) => {
@@ -669,6 +670,7 @@ var MastraLLM = class extends MastraLLMBase {
669
670
  threadId,
670
671
  resourceId,
671
672
  mastra: this.#mastra,
673
+ memory,
672
674
  runId
673
675
  }, options) ?? void 0;
674
676
  } catch (error) {
@@ -703,6 +705,7 @@ var MastraLLM = class extends MastraLLMBase {
703
705
  telemetry,
704
706
  threadId,
705
707
  resourceId,
708
+ memory,
706
709
  ...rest
707
710
  }) {
708
711
  const model = this.#model;
@@ -718,7 +721,8 @@ var MastraLLM = class extends MastraLLMBase {
718
721
  tools,
719
722
  runId,
720
723
  threadId,
721
- resourceId
724
+ resourceId,
725
+ memory
722
726
  });
723
727
  const argsForExecute = {
724
728
  model,
@@ -786,6 +790,7 @@ var MastraLLM = class extends MastraLLMBase {
786
790
  telemetry,
787
791
  threadId,
788
792
  resourceId,
793
+ memory,
789
794
  ...rest
790
795
  }) {
791
796
  const model = this.#model;
@@ -796,7 +801,8 @@ var MastraLLM = class extends MastraLLMBase {
796
801
  tools,
797
802
  runId,
798
803
  threadId,
799
- resourceId
804
+ resourceId,
805
+ memory
800
806
  });
801
807
  const argsForExecute = {
802
808
  model,
@@ -861,6 +867,7 @@ var MastraLLM = class extends MastraLLMBase {
861
867
  telemetry,
862
868
  threadId,
863
869
  resourceId,
870
+ memory,
864
871
  ...rest
865
872
  }) {
866
873
  const model = this.#model;
@@ -876,7 +883,8 @@ var MastraLLM = class extends MastraLLMBase {
876
883
  tools,
877
884
  runId,
878
885
  threadId,
879
- resourceId
886
+ resourceId,
887
+ memory
880
888
  });
881
889
  const argsForExecute = {
882
890
  model,
@@ -958,6 +966,7 @@ var MastraLLM = class extends MastraLLMBase {
958
966
  telemetry,
959
967
  threadId,
960
968
  resourceId,
969
+ memory,
961
970
  ...rest
962
971
  }) {
963
972
  const model = this.#model;
@@ -971,7 +980,8 @@ var MastraLLM = class extends MastraLLMBase {
971
980
  tools,
972
981
  runId,
973
982
  threadId,
974
- resourceId
983
+ resourceId,
984
+ memory
975
985
  });
976
986
  const argsForExecute = {
977
987
  model,
@@ -1046,6 +1056,7 @@ var MastraLLM = class extends MastraLLMBase {
1046
1056
  output,
1047
1057
  temperature,
1048
1058
  telemetry,
1059
+ memory,
1049
1060
  ...rest
1050
1061
  } = {}) {
1051
1062
  const msgs = this.convertToMessages(messages);
@@ -1058,6 +1069,7 @@ var MastraLLM = class extends MastraLLMBase {
1058
1069
  convertedTools,
1059
1070
  runId,
1060
1071
  temperature,
1072
+ memory,
1061
1073
  ...rest
1062
1074
  });
1063
1075
  }
@@ -1070,6 +1082,7 @@ var MastraLLM = class extends MastraLLMBase {
1070
1082
  convertedTools,
1071
1083
  runId,
1072
1084
  telemetry,
1085
+ memory,
1073
1086
  ...rest
1074
1087
  });
1075
1088
  }
@@ -1906,6 +1919,8 @@ var Agent = class extends (_a = MastraBase) {
1906
1919
  threadId,
1907
1920
  resourceId
1908
1921
  });
1922
+ const memory = this.getMemory();
1923
+ const memoryTools = memory?.getTools();
1909
1924
  const converted = Object.entries(this.tools || {}).reduce((memo, value) => {
1910
1925
  const k = value[0];
1911
1926
  const tool = this.tools[k];
@@ -1926,6 +1941,7 @@ var Agent = class extends (_a = MastraBase) {
1926
1941
  return tool?.execute?.({
1927
1942
  context: args,
1928
1943
  mastra: this.#mastra,
1944
+ memory,
1929
1945
  runId,
1930
1946
  threadId,
1931
1947
  resourceId
@@ -1944,8 +1960,44 @@ var Agent = class extends (_a = MastraBase) {
1944
1960
  }
1945
1961
  return memo;
1946
1962
  }, {});
1963
+ const convertedMemoryTools = memoryTools ? Object.entries(memoryTools).reduce((memo, [k, tool]) => {
1964
+ memo[k] = {
1965
+ description: tool.description,
1966
+ parameters: tool.parameters,
1967
+ execute: typeof tool?.execute === "function" ? async (args, options) => {
1968
+ try {
1969
+ this.logger.debug(`[Agent:${this.name}] - Executing memory tool ${k}`, {
1970
+ name: k,
1971
+ description: tool.description,
1972
+ args,
1973
+ runId,
1974
+ threadId,
1975
+ resourceId
1976
+ });
1977
+ return tool?.execute?.({
1978
+ context: args,
1979
+ mastra: this.#mastra,
1980
+ memory,
1981
+ runId,
1982
+ threadId,
1983
+ resourceId
1984
+ }, options) ?? void 0;
1985
+ } catch (err) {
1986
+ this.logger.error(`[Agent:${this.name}] - Failed memory tool execution`, {
1987
+ error: err,
1988
+ runId,
1989
+ threadId,
1990
+ resourceId
1991
+ });
1992
+ throw err;
1993
+ }
1994
+ } : void 0
1995
+ };
1996
+ return memo;
1997
+ }, {}) : {};
1947
1998
  const toolsFromToolsetsConverted = {
1948
- ...converted
1999
+ ...converted,
2000
+ ...convertedMemoryTools
1949
2001
  };
1950
2002
  const toolsFromToolsets = Object.values(toolsets || {});
1951
2003
  if (toolsFromToolsets.length > 0) {
@@ -2215,6 +2267,7 @@ var Agent = class extends (_a = MastraBase) {
2215
2267
  experimental_output,
2216
2268
  threadId,
2217
2269
  resourceId,
2270
+ memory: this.getMemory(),
2218
2271
  ...rest
2219
2272
  });
2220
2273
  const outputText2 = result2.text;
@@ -2242,6 +2295,7 @@ var Agent = class extends (_a = MastraBase) {
2242
2295
  telemetry,
2243
2296
  threadId,
2244
2297
  resourceId,
2298
+ memory: this.getMemory(),
2245
2299
  ...rest
2246
2300
  });
2247
2301
  const outputText2 = result2.text;
@@ -2265,6 +2319,7 @@ var Agent = class extends (_a = MastraBase) {
2265
2319
  temperature,
2266
2320
  toolChoice,
2267
2321
  telemetry,
2322
+ memory: this.getMemory(),
2268
2323
  ...rest
2269
2324
  });
2270
2325
  const outputText = JSON.stringify(result.object);
@@ -2362,6 +2417,7 @@ var Agent = class extends (_a = MastraBase) {
2362
2417
  runId: runIdToUse,
2363
2418
  toolChoice,
2364
2419
  experimental_output,
2420
+ memory: this.getMemory(),
2365
2421
  ...rest
2366
2422
  });
2367
2423
  const newStreamResult = streamResult;
@@ -2400,6 +2456,7 @@ var Agent = class extends (_a = MastraBase) {
2400
2456
  runId: runIdToUse,
2401
2457
  toolChoice,
2402
2458
  telemetry,
2459
+ memory: this.getMemory(),
2403
2460
  ...rest
2404
2461
  });
2405
2462
  }
@@ -2435,6 +2492,7 @@ var Agent = class extends (_a = MastraBase) {
2435
2492
  runId: runIdToUse,
2436
2493
  toolChoice,
2437
2494
  telemetry,
2495
+ memory: this.getMemory(),
2438
2496
  ...rest
2439
2497
  });
2440
2498
  }
@@ -3103,8 +3161,8 @@ var LibSQLStore = class extends MastraStorage {
3103
3161
  if (url.startsWith("file:") && !url.startsWith("file:/")) {
3104
3162
  const cwd = process.cwd();
3105
3163
  const relativePath = url.slice("file:".length);
3106
- if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
3107
- const baseDir = path.join(cwd, `..`);
3164
+ if (cwd.includes(".mastra") && (cwd.endsWith(`output`) || cwd.endsWith(`output/`) || cwd.endsWith(`output\\`))) {
3165
+ const baseDir = path.join(cwd, `..`, `..`);
3108
3166
  const fullPath = path.join(baseDir, relativePath);
3109
3167
  this.logger.debug(`Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`);
3110
3168
  return `file:${fullPath}`;
@@ -4654,8 +4712,8 @@ var LibSQLVector = class extends MastraVector {
4654
4712
  if (url.startsWith("file:") && !url.startsWith("file:/")) {
4655
4713
  const cwd = process.cwd();
4656
4714
  const relativePath = url.slice("file:".length);
4657
- if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
4658
- const baseDir = path.join(cwd, `..`);
4715
+ if (cwd.includes(".mastra") && (cwd.endsWith(`output`) || cwd.endsWith(`output/`) || cwd.endsWith(`output\\`))) {
4716
+ const baseDir = path.join(cwd, `..`, `..`);
4659
4717
  const fullPath = path.join(baseDir, relativePath);
4660
4718
  this.logger.debug(`Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`);
4661
4719
  return `file:${fullPath}`;
@@ -4881,7 +4939,7 @@ var MastraMemory = class extends MastraBase {
4881
4939
  } else {
4882
4940
  this.vector = new LibSQLVector({
4883
4941
  connectionUrl: "file:memory-vector.db"
4884
- // file name needs to be different than default storage or it wont work properly
4942
+ // this no longer needs to be a different db than file:memory.db above, but it's a breaking change that could result in data loss or corruption to change it
4885
4943
  });
4886
4944
  }
4887
4945
  if (config.embedder) {
@@ -4910,6 +4968,14 @@ var MastraMemory = class extends MastraBase {
4910
4968
  async getSystemMessage(_input) {
4911
4969
  return null;
4912
4970
  }
4971
+ /**
4972
+ * Get tools that should be available to the agent.
4973
+ * This will be called when converting tools for the agent.
4974
+ * Implementations can override this to provide additional tools.
4975
+ */
4976
+ getTools(config) {
4977
+ return {};
4978
+ }
4913
4979
  async createEmbeddingIndex() {
4914
4980
  const defaultDimensions = 1536;
4915
4981
  const dimensionsByModelId = {
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-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';
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-BkCP97X_.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-BkCP97X_.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 { CreateIndexArgs, CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorArgs, QueryVectorParams, UpsertVectorArgs, UpsertVectorParams } from './vector/index.cjs';
22
- import { S as Step, W as Workflow$1 } from './workflow-DlRFMI4Q.cjs';
23
- export { c as createStep } from './workflow-DlRFMI4Q.cjs';
22
+ import { S as Step, W as Workflow$1 } from './workflow-CLyzcn7-.cjs';
23
+ export { c as createStep } from './workflow-CLyzcn7-.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-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';
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-Dx7g7r-P.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-Dx7g7r-P.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 { CreateIndexArgs, CreateIndexParams, IndexStats, ParamsToArgs, QueryResult, QueryVectorArgs, QueryVectorParams, UpsertVectorArgs, UpsertVectorParams } from './vector/index.js';
22
- import { S as Step, W as Workflow$1 } from './workflow-fGgxPZk4.js';
23
- export { c as createStep } from './workflow-fGgxPZk4.js';
22
+ import { S as Step, W as Workflow$1 } from './workflow-BQyXyWIe.js';
23
+ export { c as createStep } from './workflow-BQyXyWIe.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
@@ -4,14 +4,14 @@ export { Step, createStep, getActivePathsAndStatus, getResultActivePaths, getSte
4
4
  import { Integration, OpenAPIToolset } from './chunk-PNZK456O.js';
5
5
  import { Tool } from './chunk-ZINPRHAN.js';
6
6
  export { createTool } from './chunk-ZINPRHAN.js';
7
- export { Mastra } from './chunk-NGD2HQYW.js';
8
- import { MastraMemory } from './chunk-5NRHVENG.js';
7
+ export { Mastra } from './chunk-OL5NX3FT.js';
8
+ import { MastraMemory } from './chunk-J77G455Q.js';
9
9
  import { MastraVector } from './chunk-I5KM37BN.js';
10
- export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-JXEH6PBQ.js';
10
+ export { CohereRelevanceScorer, MastraAgentRelevanceScorer, createSimilarityPrompt } from './chunk-SH6KVX4B.js';
11
11
  import { MastraStorage } from './chunk-5XPCMNGW.js';
12
- import { Agent } from './chunk-E7K35ROR.js';
12
+ import { Agent } from './chunk-NWPCPTB7.js';
13
13
  export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, Telemetry, hasActiveTelemetry, withSpan } from './chunk-W5HVJX45.js';
14
- export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-WIBGG4X6.js';
14
+ export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-3GC7P4J6.js';
15
15
  import { MastraDeployer } from './chunk-4YRYBCOZ.js';
16
16
  import { MastraBase } from './chunk-OZ4XVJ6F.js';
17
17
  import { createLogger } from './chunk-PHMSPCTC.js';
@@ -1,6 +1,6 @@
1
- import { W as Workflow } from '../workflow-DlRFMI4Q.cjs';
1
+ import { W as Workflow } from '../workflow-CLyzcn7-.cjs';
2
2
  import '../base-hs9NDAZ2.cjs';
3
- import { m as ToolAction } from '../base-CbCmDLUb.cjs';
3
+ import { m as ToolAction } from '../base-BkCP97X_.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-fGgxPZk4.js';
1
+ import { W as Workflow } from '../workflow-BQyXyWIe.js';
2
2
  import '../base-D90KQ4XI.js';
3
- import { m as ToolAction } from '../base-DqRXkxCw.js';
3
+ import { m as ToolAction } from '../base-Dx7g7r-P.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-CbCmDLUb.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-BkCP97X_.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-DqRXkxCw.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-Dx7g7r-P.js';
5
5
  import '../index-mKY1XrpK.js';
6
6
  import '../base-D90KQ4XI.js';
7
7
  import '@opentelemetry/api';
@@ -569,8 +569,8 @@ var LibSQLStore = class extends MastraStorage {
569
569
  if (url.startsWith("file:") && !url.startsWith("file:/")) {
570
570
  const cwd = process.cwd();
571
571
  const relativePath = url.slice("file:".length);
572
- if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
573
- const baseDir = path.join(cwd, `..`);
572
+ if (cwd.includes(".mastra") && (cwd.endsWith(`output`) || cwd.endsWith(`output/`) || cwd.endsWith(`output\\`))) {
573
+ const baseDir = path.join(cwd, `..`, `..`);
574
574
  const fullPath = path.join(baseDir, relativePath);
575
575
  this.logger.debug(`Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`);
576
576
  return `file:${fullPath}`;
@@ -1,6 +1,6 @@
1
- import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-CbCmDLUb.cjs';
1
+ import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-BkCP97X_.cjs';
2
2
  import { L as Logger, B as BaseLogMessage } from '../index-mKY1XrpK.cjs';
3
- import { W as Workflow } from '../workflow-DlRFMI4Q.cjs';
3
+ import { W as Workflow } from '../workflow-CLyzcn7-.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-DqRXkxCw.js';
1
+ import { A as Agent, M as MastraStorage, a as MastraMemory } from '../base-Dx7g7r-P.js';
2
2
  import { L as Logger, B as BaseLogMessage } from '../index-mKY1XrpK.js';
3
- import { W as Workflow } from '../workflow-fGgxPZk4.js';
3
+ import { W as Workflow } from '../workflow-BQyXyWIe.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 +1 @@
1
- export { Mastra } from '../chunk-NGD2HQYW.js';
1
+ export { Mastra } from '../chunk-OL5NX3FT.js';
@@ -380,8 +380,8 @@ var LibSQLStore = class extends MastraStorage {
380
380
  if (url.startsWith("file:") && !url.startsWith("file:/")) {
381
381
  const cwd = process.cwd();
382
382
  const relativePath = url.slice("file:".length);
383
- if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
384
- const baseDir = path.join(cwd, `..`);
383
+ if (cwd.includes(".mastra") && (cwd.endsWith(`output`) || cwd.endsWith(`output/`) || cwd.endsWith(`output\\`))) {
384
+ const baseDir = path.join(cwd, `..`, `..`);
385
385
  const fullPath = path.join(baseDir, relativePath);
386
386
  this.logger.debug(
387
387
  `Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`
@@ -1529,8 +1529,8 @@ var LibSQLVector = class extends MastraVector {
1529
1529
  if (url.startsWith("file:") && !url.startsWith("file:/")) {
1530
1530
  const cwd = process.cwd();
1531
1531
  const relativePath = url.slice("file:".length);
1532
- if (cwd.endsWith(".mastra") || cwd.endsWith(".mastra/")) {
1533
- const baseDir = path.join(cwd, `..`);
1532
+ if (cwd.includes(".mastra") && (cwd.endsWith(`output`) || cwd.endsWith(`output/`) || cwd.endsWith(`output\\`))) {
1533
+ const baseDir = path.join(cwd, `..`, `..`);
1534
1534
  const fullPath = path.join(baseDir, relativePath);
1535
1535
  this.logger.debug(
1536
1536
  `Initializing LibSQL db with url ${url} with relative file path from inside .mastra directory. Rewriting relative file url to "file:${fullPath}". This ensures it's outside the .mastra directory. If the db is stored inside .mastra it will be deleted when Mastra re-bundles code.`
@@ -1739,7 +1739,7 @@ var MastraMemory = class extends MastraBase {
1739
1739
  } else {
1740
1740
  this.vector = new LibSQLVector({
1741
1741
  connectionUrl: "file:memory-vector.db"
1742
- // file name needs to be different than default storage or it wont work properly
1742
+ // this no longer needs to be a different db than file:memory.db above, but it's a breaking change that could result in data loss or corruption to change it
1743
1743
  });
1744
1744
  }
1745
1745
  if (config.embedder) {
@@ -1768,6 +1768,14 @@ var MastraMemory = class extends MastraBase {
1768
1768
  async getSystemMessage(_input) {
1769
1769
  return null;
1770
1770
  }
1771
+ /**
1772
+ * Get tools that should be available to the agent.
1773
+ * This will be called when converting tools for the agent.
1774
+ * Implementations can override this to provide additional tools.
1775
+ */
1776
+ getTools(config) {
1777
+ return {};
1778
+ }
1771
1779
  async createEmbeddingIndex() {
1772
1780
  const defaultDimensions = 1536;
1773
1781
  const dimensionsByModelId = {
@@ -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-CbCmDLUb.cjs';
1
+ export { a as MastraMemory, X as MemoryConfig, V as MessageResponse, c as MessageType, Y as SharedMemoryConfig, b as StorageThreadType } from '../base-BkCP97X_.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-DqRXkxCw.js';
1
+ export { a as MastraMemory, X as MemoryConfig, V as MessageResponse, c as MessageType, Y as SharedMemoryConfig, b as StorageThreadType } from '../base-Dx7g7r-P.js';
2
2
  export { Message as AiMessageType } from 'ai';
3
3
  import '../base-D90KQ4XI.js';
4
4
  import '@opentelemetry/api';
@@ -1 +1 @@
1
- export { MastraMemory } from '../chunk-5NRHVENG.js';
1
+ export { MastraMemory } from '../chunk-J77G455Q.js';