@mastra/core 0.2.0-alpha.89 → 0.2.0-alpha.91

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 (149) hide show
  1. package/README.md +1 -2
  2. package/dist/action/index.d.ts +3 -3
  3. package/dist/agent/index.d.ts +4 -4
  4. package/dist/agent/index.js +4 -4
  5. package/dist/base.d.ts +1 -1
  6. package/dist/base.js +2 -2
  7. package/dist/bundler/index.d.ts +1 -1
  8. package/dist/bundler/index.js +3 -3
  9. package/dist/{chunk-D6SEHWUL.js → chunk-4LJFWC2Q.js} +1 -1
  10. package/dist/chunk-5DYJZVB7.js +66 -0
  11. package/dist/chunk-AD6IIOCI.js +11 -0
  12. package/dist/chunk-CQU72KBX.js +54 -0
  13. package/dist/{chunk-FFZKACHZ.js → chunk-E3TBVBIO.js} +12 -84
  14. package/dist/{chunk-ADU6ZLCT.js → chunk-ECUVL2G5.js} +1 -1
  15. package/dist/{chunk-KHPTZCPA.js → chunk-ECXV3EAT.js} +3 -25
  16. package/dist/{chunk-J556NL2S.js → chunk-FD4KOA4T.js} +1 -1
  17. package/dist/{chunk-WLG2YHOZ.js → chunk-G4MCO7XF.js} +1 -1
  18. package/dist/{chunk-IO3KMCXV.js → chunk-ICMEXHKD.js} +0 -1
  19. package/dist/{chunk-HILJW64N.js → chunk-IE37CBXB.js} +20 -9
  20. package/dist/chunk-IEFQZ3IL.js +78 -0
  21. package/dist/{chunk-GTJIVA2D.js → chunk-IJ55HGH4.js} +1 -1
  22. package/dist/{chunk-SKEBFXFK.js → chunk-MMJCCJNP.js} +5 -9
  23. package/dist/chunk-NNNAWW2H.js +66 -0
  24. package/dist/{chunk-T5ZUXYWC.js → chunk-NYBGZL6Z.js} +1 -1
  25. package/dist/{chunk-654VMNVR.js → chunk-QX2CHXA7.js} +12 -5
  26. package/dist/chunk-RAR7V3E3.js +66 -0
  27. package/dist/{chunk-RIATJJC3.js → chunk-RDEXABVY.js} +1 -1
  28. package/dist/chunk-VPSYTVWP.js +66 -0
  29. package/dist/{chunk-SMVXLIV7.js → chunk-WGUGRCAP.js} +1 -1
  30. package/dist/{chunk-Z2KRB7Z4.js → chunk-XDXRDRTQ.js} +1 -1
  31. package/dist/{chunk-BCNHUSA6.js → chunk-YKASGA6R.js} +1 -1
  32. package/dist/{chunk-Y7YCQUOD.js → chunk-YPMAHKBC.js} +2 -2
  33. package/dist/chunk-ZA7MIXNW.js +66 -0
  34. package/dist/deployer/index.d.ts +1 -1
  35. package/dist/deployer/index.js +4 -4
  36. package/dist/embeddings/model/providers/bedrock.d.ts +42 -0
  37. package/dist/embeddings/model/providers/bedrock.js +3 -0
  38. package/dist/embeddings/model/providers/bedrock.test.d.ts +2 -0
  39. package/dist/embeddings/model/providers/bedrock.test.js +37 -0
  40. package/dist/embeddings/model/providers/cohere.d.ts +34 -0
  41. package/dist/embeddings/model/providers/cohere.js +3 -0
  42. package/dist/embeddings/model/providers/cohere.test.d.ts +2 -0
  43. package/dist/embeddings/model/providers/cohere.test.js +37 -0
  44. package/dist/embeddings/model/providers/embedder.d.ts +28 -0
  45. package/dist/embeddings/model/providers/embedder.js +2 -0
  46. package/dist/embeddings/model/providers/google.d.ts +34 -0
  47. package/dist/embeddings/model/providers/google.js +3 -0
  48. package/dist/embeddings/model/providers/google.test.d.ts +2 -0
  49. package/dist/embeddings/model/providers/google.test.js +37 -0
  50. package/dist/embeddings/model/providers/mistral.d.ts +34 -0
  51. package/dist/embeddings/model/providers/mistral.js +3 -0
  52. package/dist/embeddings/model/providers/mistral.test.d.ts +2 -0
  53. package/dist/embeddings/model/providers/mistral.test.js +37 -0
  54. package/dist/embeddings/model/providers/mock.d.ts +20 -0
  55. package/dist/embeddings/model/providers/mock.js +3 -0
  56. package/dist/embeddings/model/providers/mock.test.d.ts +2 -0
  57. package/dist/embeddings/model/providers/mock.test.js +29 -0
  58. package/dist/embeddings/model/providers/openai.d.ts +34 -0
  59. package/dist/embeddings/model/providers/openai.js +3 -0
  60. package/dist/embeddings/model/providers/openai.test.d.ts +2 -0
  61. package/dist/embeddings/model/providers/openai.test.js +37 -0
  62. package/dist/embeddings/model/providers/voyage.d.ts +34 -0
  63. package/dist/embeddings/model/providers/voyage.js +3 -0
  64. package/dist/embeddings/model/providers/voyage.test.d.ts +2 -0
  65. package/dist/embeddings/model/providers/voyage.test.js +37 -0
  66. package/dist/eval/index.d.ts +4 -4
  67. package/dist/filter/index.d.ts +1 -1
  68. package/dist/filter/index.js +1 -1
  69. package/dist/{index-D-mqcYwN.d.ts → index-B48181D5.d.ts} +6 -13
  70. package/dist/{index-Cktbxvxx.d.ts → index-CBZ2mk2H.d.ts} +0 -1
  71. package/dist/index.d.ts +7 -8
  72. package/dist/index.js +17 -18
  73. package/dist/integration/index.d.ts +5 -5
  74. package/dist/llm/index.d.ts +4 -4
  75. package/dist/llm/index.js +3 -3
  76. package/dist/{model-CD0nIpJn.d.ts → llm/model/index.d.ts} +17 -3
  77. package/dist/llm/model/index.js +5 -0
  78. package/dist/llm/model/providers/anthropic-vertex.d.ts +5 -5
  79. package/dist/llm/model/providers/anthropic-vertex.js +3 -3
  80. package/dist/llm/model/providers/anthropic.d.ts +5 -5
  81. package/dist/llm/model/providers/anthropic.js +3 -3
  82. package/dist/llm/model/providers/azure.d.ts +5 -5
  83. package/dist/llm/model/providers/azure.js +3 -3
  84. package/dist/llm/model/providers/baseten.d.ts +5 -5
  85. package/dist/llm/model/providers/baseten.js +4 -4
  86. package/dist/llm/model/providers/bedrock.d.ts +5 -5
  87. package/dist/llm/model/providers/bedrock.js +3 -3
  88. package/dist/llm/model/providers/cerebras.d.ts +5 -5
  89. package/dist/llm/model/providers/cerebras.js +3 -3
  90. package/dist/llm/model/providers/cohere.d.ts +5 -5
  91. package/dist/llm/model/providers/cohere.js +3 -3
  92. package/dist/llm/model/providers/deepinfra.d.ts +5 -5
  93. package/dist/llm/model/providers/deepinfra.js +3 -3
  94. package/dist/llm/model/providers/deepseek.d.ts +5 -5
  95. package/dist/llm/model/providers/deepseek.js +3 -3
  96. package/dist/llm/model/providers/fireworks.d.ts +5 -5
  97. package/dist/llm/model/providers/fireworks.js +3 -3
  98. package/dist/llm/model/providers/google-vertex.d.ts +5 -5
  99. package/dist/llm/model/providers/google-vertex.js +3 -3
  100. package/dist/llm/model/providers/google.d.ts +5 -5
  101. package/dist/llm/model/providers/google.js +3 -3
  102. package/dist/llm/model/providers/grok.d.ts +5 -5
  103. package/dist/llm/model/providers/grok.js +3 -3
  104. package/dist/llm/model/providers/groq.d.ts +5 -5
  105. package/dist/llm/model/providers/groq.js +3 -3
  106. package/dist/llm/model/providers/lmstudio.d.ts +5 -5
  107. package/dist/llm/model/providers/lmstudio.js +4 -4
  108. package/dist/llm/model/providers/mistral.d.ts +5 -5
  109. package/dist/llm/model/providers/mistral.js +3 -3
  110. package/dist/llm/model/providers/mock.d.ts +5 -5
  111. package/dist/llm/model/providers/mock.js +3 -3
  112. package/dist/llm/model/providers/ollama.d.ts +5 -5
  113. package/dist/llm/model/providers/ollama.js +3 -3
  114. package/dist/llm/model/providers/openai-compat.d.ts +5 -5
  115. package/dist/llm/model/providers/openai-compat.js +4 -4
  116. package/dist/llm/model/providers/openai.d.ts +5 -5
  117. package/dist/llm/model/providers/openai.js +4 -4
  118. package/dist/llm/model/providers/openai.test.js +4 -4
  119. package/dist/llm/model/providers/perplexity.d.ts +5 -5
  120. package/dist/llm/model/providers/perplexity.js +3 -3
  121. package/dist/llm/model/providers/portkey.d.ts +5 -5
  122. package/dist/llm/model/providers/portkey.js +3 -3
  123. package/dist/llm/model/providers/togetherai.d.ts +5 -5
  124. package/dist/llm/model/providers/togetherai.js +3 -3
  125. package/dist/logger/index.d.ts +1 -1
  126. package/dist/logger/index.js +1 -1
  127. package/dist/mastra/index.d.ts +5 -7
  128. package/dist/mastra/index.js +4 -4
  129. package/dist/memory/index.d.ts +4 -4
  130. package/dist/memory/index.js +3 -3
  131. package/dist/relevance/index.d.ts +4 -4
  132. package/dist/relevance/index.js +5 -5
  133. package/dist/storage/index.d.ts +5 -5
  134. package/dist/storage/index.js +3 -3
  135. package/dist/tools/index.d.ts +5 -5
  136. package/dist/tts/index.d.ts +1 -1
  137. package/dist/tts/index.js +3 -3
  138. package/dist/vector/index.d.ts +1 -1
  139. package/dist/vector/index.js +3 -3
  140. package/dist/vector/libsql/index.d.ts +31 -0
  141. package/dist/vector/libsql/index.js +662 -0
  142. package/dist/{workflow-4u4hE9mG.d.ts → workflow-CSwxE-4q.d.ts} +1 -19
  143. package/dist/workflows/index.d.ts +6 -6
  144. package/dist/workflows/index.js +3 -3
  145. package/package.json +14 -8
  146. package/dist/chunk-NIYVERVP.js +0 -199
  147. package/dist/engine/index.d.ts +0 -59
  148. package/dist/engine/index.js +0 -4
  149. package/dist/engine-EwEG-4Iv.d.ts +0 -127
package/README.md CHANGED
@@ -49,10 +49,9 @@ const agent = new Agent({
49
49
  The embeddings module provides a unified interface for converting text into vector representations across multiple AI providers. These vectors are essential for semantic search, similarity comparisons, and other NLP tasks.
50
50
 
51
51
  ```typescript
52
- import { embed, EmbeddingOptions } from '@mastra/core';
52
+ import { embed } from '@mastra/core/embeddings/openai';
53
53
 
54
54
  const embeddings = await embed('text to embed', {
55
- provider: 'OPEN_AI',
56
55
  model: 'text-embedding-3-small',
57
56
  });
58
57
  ```
@@ -1,7 +1,6 @@
1
1
  import 'zod';
2
- export { I as IAction, aT as IExecutionContext, d as MastraPrimitives } from '../index-D-mqcYwN.js';
3
- import '../engine-EwEG-4Iv.js';
4
- import '../index-Cktbxvxx.js';
2
+ export { I as IAction, aT as IExecutionContext, d as MastraPrimitives } from '../index-B48181D5.js';
3
+ import '../index-CBZ2mk2H.js';
5
4
  import '../telemetry-oCUM52DG.js';
6
5
  import '../tts/index.js';
7
6
  import '../vector/index.js';
@@ -15,4 +14,5 @@ import '@opentelemetry/sdk-node';
15
14
  import '@opentelemetry/sdk-trace-base';
16
15
  import '../metric-D2V4CR8D.js';
17
16
  import 'sift';
17
+ import '../embeddings/model/providers/embedder.js';
18
18
  import '../types-M16hSruO.js';
@@ -1,18 +1,18 @@
1
1
  import 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { A as Agent } from '../index-D-mqcYwN.js';
4
+ export { A as Agent } from '../index-B48181D5.js';
5
5
  import '../base.js';
6
6
  import '../metric-D2V4CR8D.js';
7
7
  import '../telemetry-oCUM52DG.js';
8
- import '../index-Cktbxvxx.js';
8
+ import '../index-CBZ2mk2H.js';
9
9
  import 'pino';
10
10
  import 'stream';
11
11
  import 'sift';
12
- import '../types-M16hSruO.js';
12
+ import '../embeddings/model/providers/embedder.js';
13
13
  import '../vector/index.js';
14
+ import '../types-M16hSruO.js';
14
15
  import '@opentelemetry/api';
15
16
  import '@opentelemetry/sdk-node';
16
17
  import '@opentelemetry/sdk-trace-base';
17
- import '../engine-EwEG-4Iv.js';
18
18
  import '../tts/index.js';
@@ -1,9 +1,9 @@
1
- export { Agent } from '../chunk-SKEBFXFK.js';
1
+ export { Agent } from '../chunk-MMJCCJNP.js';
2
2
  import '../chunk-HBTQNIAX.js';
3
3
  import '../chunk-SDKEPBBH.js';
4
- import '../chunk-Y7YCQUOD.js';
4
+ import '../chunk-YPMAHKBC.js';
5
5
  import '../chunk-6ZVFVYLE.js';
6
6
  import '../chunk-KNPBNSJ7.js';
7
- import '../chunk-WLG2YHOZ.js';
8
- import '../chunk-IO3KMCXV.js';
7
+ import '../chunk-G4MCO7XF.js';
8
+ import '../chunk-ICMEXHKD.js';
9
9
  import '../chunk-AJJZUHB4.js';
package/dist/base.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _opentelemetry_api from '@opentelemetry/api';
2
- import { R as RegisteredLogger, L as Logger, a as LogLevel } from './index-Cktbxvxx.js';
2
+ import { R as RegisteredLogger, L as Logger, a as LogLevel } from './index-CBZ2mk2H.js';
3
3
  import { T as Telemetry } from './telemetry-oCUM52DG.js';
4
4
  import 'pino';
5
5
  import 'stream';
package/dist/base.js CHANGED
@@ -1,3 +1,3 @@
1
- export { MastraBase } from './chunk-WLG2YHOZ.js';
2
- import './chunk-IO3KMCXV.js';
1
+ export { MastraBase } from './chunk-G4MCO7XF.js';
2
+ import './chunk-ICMEXHKD.js';
3
3
  import './chunk-AJJZUHB4.js';
@@ -1,6 +1,6 @@
1
1
  import { MastraBase } from '../base.js';
2
2
  import '@opentelemetry/api';
3
- import '../index-Cktbxvxx.js';
3
+ import '../index-CBZ2mk2H.js';
4
4
  import 'pino';
5
5
  import 'stream';
6
6
  import '../telemetry-oCUM52DG.js';
@@ -1,4 +1,4 @@
1
- export { MastraBundler } from '../chunk-RIATJJC3.js';
2
- import '../chunk-WLG2YHOZ.js';
3
- import '../chunk-IO3KMCXV.js';
1
+ export { MastraBundler } from '../chunk-RDEXABVY.js';
2
+ import '../chunk-G4MCO7XF.js';
3
+ import '../chunk-ICMEXHKD.js';
4
4
  import '../chunk-AJJZUHB4.js';
@@ -1,6 +1,6 @@
1
1
  import { __name, __publicField } from './chunk-AJJZUHB4.js';
2
2
 
3
- // src/filter/index.ts
3
+ // src/filter/base.ts
4
4
  var _a;
5
5
  var BaseFilterTranslator = (_a = class {
6
6
  /**
@@ -0,0 +1,66 @@
1
+ import { MastraEmbedder } from './chunk-AD6IIOCI.js';
2
+ import { __name, __publicField } from './chunk-AJJZUHB4.js';
3
+ import { createMistral } from '@ai-sdk/mistral';
4
+ import { embed as embed$1, embedMany as embedMany$1 } from 'ai';
5
+
6
+ async function embed(value, { apiKey = process.env.MISTRAL_API_KEY || "", model = "mistral-embed", baseURL, maxRetries = 3 }) {
7
+ const mistral = createMistral({
8
+ baseURL,
9
+ apiKey
10
+ });
11
+ const eModel = mistral.textEmbeddingModel(model);
12
+ return await embed$1({
13
+ model: eModel,
14
+ value,
15
+ maxRetries
16
+ });
17
+ }
18
+ __name(embed, "embed");
19
+ async function embedMany(values, { apiKey = process.env.MISTRAL_API_KEY || "", model = "mistral-embed", baseURL, maxRetries = 3 }) {
20
+ const mistral = createMistral({
21
+ baseURL,
22
+ apiKey
23
+ });
24
+ const eModel = mistral.textEmbeddingModel(model);
25
+ return await embedMany$1({
26
+ model: eModel,
27
+ values,
28
+ maxRetries
29
+ });
30
+ }
31
+ __name(embedMany, "embedMany");
32
+ var _MistralEmbedder = class _MistralEmbedder extends MastraEmbedder {
33
+ constructor({ apiKey = process.env.MISTRAL_API_KEY || "", model = "mistral-embed", baseURL }) {
34
+ super();
35
+ __publicField(this, "apiKey");
36
+ __publicField(this, "model");
37
+ __publicField(this, "baseURL");
38
+ this.apiKey = apiKey;
39
+ this.model = model;
40
+ this.baseURL = baseURL;
41
+ }
42
+ async embed(value, { maxRetries } = {
43
+ maxRetries: 3
44
+ }) {
45
+ return embed(value, {
46
+ apiKey: this.apiKey,
47
+ model: this.model,
48
+ baseURL: this.baseURL,
49
+ maxRetries
50
+ });
51
+ }
52
+ async embedMany(values, { maxRetries } = {
53
+ maxRetries: 3
54
+ }) {
55
+ return embedMany(values, {
56
+ apiKey: this.apiKey,
57
+ model: this.model,
58
+ baseURL: this.baseURL,
59
+ maxRetries
60
+ });
61
+ }
62
+ };
63
+ __name(_MistralEmbedder, "MistralEmbedder");
64
+ var MistralEmbedder = _MistralEmbedder;
65
+
66
+ export { MistralEmbedder, embed, embedMany };
@@ -0,0 +1,11 @@
1
+ import { __name } from './chunk-AJJZUHB4.js';
2
+
3
+ // src/embeddings/model/providers/embedder.ts
4
+ var _MastraEmbedder = class _MastraEmbedder {
5
+ constructor() {
6
+ }
7
+ };
8
+ __name(_MastraEmbedder, "MastraEmbedder");
9
+ var MastraEmbedder = _MastraEmbedder;
10
+
11
+ export { MastraEmbedder };
@@ -0,0 +1,54 @@
1
+ import { MastraEmbedder } from './chunk-AD6IIOCI.js';
2
+ import { __name } from './chunk-AJJZUHB4.js';
3
+ import { embed as embed$1, embedMany as embedMany$1 } from 'ai';
4
+ import { MockEmbeddingModelV1 } from 'ai/test';
5
+
6
+ var model = new MockEmbeddingModelV1({
7
+ doEmbed: /* @__PURE__ */ __name(() => Promise.resolve({
8
+ embeddings: [
9
+ [
10
+ 1,
11
+ 0
12
+ ]
13
+ ]
14
+ }), "doEmbed")
15
+ });
16
+ async function embed(value, { maxRetries = 3 } = {}) {
17
+ return await embed$1({
18
+ model,
19
+ value,
20
+ maxRetries
21
+ });
22
+ }
23
+ __name(embed, "embed");
24
+ async function embedMany(values, { maxRetries = 3 } = {}) {
25
+ return await embedMany$1({
26
+ model,
27
+ values,
28
+ maxRetries
29
+ });
30
+ }
31
+ __name(embedMany, "embedMany");
32
+ var _MockEmbedder = class _MockEmbedder extends MastraEmbedder {
33
+ constructor() {
34
+ super();
35
+ }
36
+ async embed(value, { maxRetries } = {
37
+ maxRetries: 3
38
+ }) {
39
+ return embed(value, {
40
+ maxRetries
41
+ });
42
+ }
43
+ async embedMany(values, { maxRetries } = {
44
+ maxRetries: 3
45
+ }) {
46
+ return embedMany(values, {
47
+ maxRetries
48
+ });
49
+ }
50
+ };
51
+ __name(_MockEmbedder, "MockEmbedder");
52
+ var MockEmbedder = _MockEmbedder;
53
+
54
+ export { MockEmbedder, embed, embedMany };
@@ -1,41 +1,9 @@
1
- import { MastraBase } from './chunk-WLG2YHOZ.js';
2
- import { __name, __publicField, __privateAdd, __privateSet, __privateGet, __privateMethod } from './chunk-AJJZUHB4.js';
1
+ import { MastraBase } from './chunk-G4MCO7XF.js';
2
+ import { __name, __privateAdd, __publicField, __privateSet, __privateMethod, __privateGet } from './chunk-AJJZUHB4.js';
3
3
  import { get } from 'radash';
4
4
  import sift from 'sift';
5
5
  import { setup, createActor, assign, fromPromise } from 'xstate';
6
6
 
7
- // src/workflows/snapshot.ts
8
- var _WorkflowSnapshot = class _WorkflowSnapshot {
9
- constructor(engine) {
10
- __publicField(this, "engine");
11
- this.engine = engine;
12
- }
13
- async persist({ entityName, connectionId, runId, snapshot }) {
14
- await this.engine.syncRecords({
15
- name: entityName,
16
- connectionId,
17
- records: [
18
- {
19
- externalId: runId,
20
- data: {
21
- snapshot: JSON.stringify(snapshot)
22
- }
23
- }
24
- ]
25
- });
26
- }
27
- async load({ runId, connectionId, entityName }) {
28
- const state = await this.engine.getRecordsByEntityNameAndExternalId({
29
- entityName,
30
- connectionId,
31
- externalId: runId
32
- });
33
- return state?.[0]?.data?.snapshot;
34
- }
35
- };
36
- __name(_WorkflowSnapshot, "WorkflowSnapshot");
37
- var WorkflowSnapshot = _WorkflowSnapshot;
38
-
39
7
  // src/workflows/utils.ts
40
8
  function isErrorEvent(stateEvent) {
41
9
  return stateEvent.type.startsWith("xstate.error.actor.");
@@ -56,7 +24,7 @@ function getStepResult(result) {
56
24
  __name(getStepResult, "getStepResult");
57
25
 
58
26
  // src/workflows/workflow.ts
59
- var _machine, _actor, _runId, _retryConfig, _mastra, _connectionId, _entityName, _afterStepStack, _lastStepStack, _stepGraph, _stepSubscriberGraph, _steps, _Workflow_instances, getSuspendedPaths_fn, isFinalState_fn, recursivelyCheckForFinalState_fn, buildBaseState_fn, makeStepKey_fn, buildStateHierarchy_fn, getDefaultActions_fn, getInjectables_fn, getDefaultActors_fn, persistWorkflowSnapshot_fn, loadWorkflowSnapshot_fn, resolveVariables_fn, evaluateCondition_fn, makeStepDef_fn, makeDelayMap_fn, cleanup_fn, getActivePathsAndStatus_fn, hasStateChanged_fn, getDeepestState_fn;
27
+ var _machine, _actor, _runId, _retryConfig, _mastra, _afterStepStack, _lastStepStack, _stepGraph, _stepSubscriberGraph, _steps, _Workflow_instances, getSuspendedPaths_fn, isFinalState_fn, recursivelyCheckForFinalState_fn, buildBaseState_fn, makeStepKey_fn, buildStateHierarchy_fn, getDefaultActions_fn, getInjectables_fn, getDefaultActors_fn, persistWorkflowSnapshot_fn, loadWorkflowSnapshot_fn, resolveVariables_fn, evaluateCondition_fn, makeStepDef_fn, makeDelayMap_fn, cleanup_fn, getActivePathsAndStatus_fn, hasStateChanged_fn, getDeepestState_fn;
60
28
  var _Workflow = class _Workflow extends MastraBase {
61
29
  /**
62
30
  * Creates a new Workflow instance
@@ -70,7 +38,6 @@ var _Workflow = class _Workflow extends MastraBase {
70
38
  });
71
39
  __privateAdd(this, _Workflow_instances);
72
40
  __publicField(this, "name");
73
- __publicField(this, "snapshot");
74
41
  __publicField(this, "triggerSchema");
75
42
  /** XState machine instance that orchestrates the workflow execution */
76
43
  __privateAdd(this, _machine);
@@ -79,8 +46,6 @@ var _Workflow = class _Workflow extends MastraBase {
79
46
  __privateAdd(this, _runId);
80
47
  __privateAdd(this, _retryConfig);
81
48
  __privateAdd(this, _mastra);
82
- __privateAdd(this, _connectionId, `WORKFLOWS`);
83
- __privateAdd(this, _entityName, `__workflows__`);
84
49
  // registers stepIds on `after` calls
85
50
  __privateAdd(this, _afterStepStack, []);
86
51
  __privateAdd(this, _lastStepStack, []);
@@ -94,9 +59,6 @@ var _Workflow = class _Workflow extends MastraBase {
94
59
  this.triggerSchema = triggerSchema;
95
60
  __privateSet(this, _runId, crypto.randomUUID());
96
61
  __privateSet(this, _mastra, mastra);
97
- if (__privateGet(this, _mastra)?.engine) {
98
- this.snapshot = new WorkflowSnapshot(__privateGet(this, _mastra).engine);
99
- }
100
62
  if (mastra?.logger) {
101
63
  this.logger = mastra?.logger;
102
64
  }
@@ -335,13 +297,12 @@ var _Workflow = class _Workflow extends MastraBase {
335
297
  timestamp: Date.now()
336
298
  };
337
299
  }
338
- const storedSnapshot = await this.snapshot?.load({
300
+ const storedSnapshot = await __privateGet(this, _mastra)?.storage?.loadWorkflowSnapshot({
339
301
  runId,
340
- entityName: __privateGet(this, _entityName),
341
- connectionId: __privateGet(this, _connectionId)
302
+ workflowName: this.name
342
303
  });
343
304
  if (storedSnapshot) {
344
- const parsed = JSON.parse(storedSnapshot);
305
+ const parsed = storedSnapshot;
345
306
  const m = __privateMethod(this, _Workflow_instances, getActivePathsAndStatus_fn).call(this, parsed.value);
346
307
  return {
347
308
  runId,
@@ -459,9 +420,6 @@ var _Workflow = class _Workflow extends MastraBase {
459
420
  if (p.logger) {
460
421
  this.__setLogger(p.logger);
461
422
  }
462
- if (p?.engine) {
463
- this.snapshot = new WorkflowSnapshot(p.engine);
464
- }
465
423
  __privateSet(this, _mastra, p);
466
424
  }
467
425
  get stepGraph() {
@@ -479,8 +437,6 @@ _actor = new WeakMap();
479
437
  _runId = new WeakMap();
480
438
  _retryConfig = new WeakMap();
481
439
  _mastra = new WeakMap();
482
- _connectionId = new WeakMap();
483
- _entityName = new WeakMap();
484
440
  _afterStepStack = new WeakMap();
485
441
  _lastStepStack = new WeakMap();
486
442
  _stepGraph = new WeakMap();
@@ -1047,7 +1003,7 @@ getDefaultActors_fn = /* @__PURE__ */ __name(function() {
1047
1003
  }, "#getDefaultActors");
1048
1004
  persistWorkflowSnapshot_fn = /* @__PURE__ */ __name(async function() {
1049
1005
  const snapshotFromActor = __privateGet(this, _actor)?.getPersistedSnapshot();
1050
- if (!this.snapshot) {
1006
+ if (!__privateGet(this, _mastra)?.storage) {
1051
1007
  this.logger.debug("Snapshot cannot be persisted. Mastra engine is not initialized", {
1052
1008
  runId: __privateGet(this, _runId)
1053
1009
  });
@@ -1065,48 +1021,20 @@ persistWorkflowSnapshot_fn = /* @__PURE__ */ __name(async function() {
1065
1021
  runId: __privateGet(this, _runId),
1066
1022
  snapshot: snapshotFromActor
1067
1023
  });
1068
- } else {
1069
- await this.snapshot.persist({
1070
- runId: __privateGet(this, _runId),
1071
- snapshot: snapshotFromActor,
1072
- entityName: __privateGet(this, _entityName),
1073
- connectionId: __privateGet(this, _connectionId)
1074
- });
1075
- this.logger.debug("Successfully persisted workflow snapshot", {
1076
- runId: __privateGet(this, _runId)
1077
- });
1078
1024
  }
1079
1025
  return __privateGet(this, _runId);
1080
1026
  }, "#persistWorkflowSnapshot");
1081
1027
  loadWorkflowSnapshot_fn = /* @__PURE__ */ __name(async function(runId) {
1082
- if (!this.snapshot) {
1028
+ if (!__privateGet(this, _mastra)?.storage) {
1083
1029
  this.logger.debug("Snapshot cannot be loaded. Mastra engine is not initialized", {
1084
1030
  runId
1085
1031
  });
1086
1032
  return;
1087
1033
  }
1088
- if (__privateGet(this, _mastra)?.storage) {
1089
- return __privateGet(this, _mastra).storage.loadWorkflowSnapshot({
1090
- runId,
1091
- workflowName: this.name
1092
- });
1093
- } else {
1094
- this.logger.debug("Loading workflow snapshot", {
1095
- runId,
1096
- entityName: __privateGet(this, _entityName),
1097
- connectionId: __privateGet(this, _connectionId)
1098
- });
1099
- const snapshotData = await this.snapshot.load({
1100
- runId,
1101
- entityName: __privateGet(this, _entityName),
1102
- connectionId: __privateGet(this, _connectionId)
1103
- });
1104
- this.logger.debug("Retrieved workflow state from storage", {
1105
- snapshot: snapshotData,
1106
- runId
1107
- });
1108
- return snapshotData;
1109
- }
1034
+ return __privateGet(this, _mastra).storage.loadWorkflowSnapshot({
1035
+ runId,
1036
+ workflowName: this.name
1037
+ });
1110
1038
  }, "#loadWorkflowSnapshot");
1111
1039
  /**
1112
1040
  * Resolves variables for a step from trigger data or previous step results
@@ -1,5 +1,5 @@
1
1
  import { InstrumentClass } from './chunk-6ZVFVYLE.js';
2
- import { MastraBase } from './chunk-WLG2YHOZ.js';
2
+ import { MastraBase } from './chunk-G4MCO7XF.js';
3
3
  import { __name, __publicField } from './chunk-AJJZUHB4.js';
4
4
 
5
5
  // src/tts/index.ts
@@ -1,7 +1,7 @@
1
1
  import { Telemetry } from './chunk-SDKEPBBH.js';
2
- import { LLM } from './chunk-Y7YCQUOD.js';
2
+ import { LLM } from './chunk-YPMAHKBC.js';
3
3
  import { InstrumentClass } from './chunk-6ZVFVYLE.js';
4
- import { LogLevel, createLogger, noopLogger } from './chunk-IO3KMCXV.js';
4
+ import { LogLevel, createLogger, noopLogger } from './chunk-ICMEXHKD.js';
5
5
  import { __name, __publicField } from './chunk-AJJZUHB4.js';
6
6
  import 'dotenv/config';
7
7
 
@@ -25,7 +25,6 @@ var _Mastra = class _Mastra {
25
25
  __publicField(this, "telemetry");
26
26
  __publicField(this, "tts");
27
27
  __publicField(this, "deployer");
28
- __publicField(this, "engine");
29
28
  __publicField(this, "storage");
30
29
  __publicField(this, "memory");
31
30
  let logger;
@@ -42,6 +41,7 @@ var _Mastra = class _Mastra {
42
41
  });
43
42
  }
44
43
  }
44
+ this.logger = logger;
45
45
  if (config?.telemetry) {
46
46
  this.telemetry = Telemetry.init(config.telemetry);
47
47
  }
@@ -57,19 +57,6 @@ var _Mastra = class _Mastra {
57
57
  this.deployer.__setTelemetry(this.telemetry);
58
58
  }
59
59
  }
60
- if (config?.engine) {
61
- if (this.telemetry) {
62
- this.engine = this.telemetry.traceClass(config.engine, {
63
- excludeMethods: [
64
- "__setTelemetry",
65
- "__getTelemetry"
66
- ]
67
- });
68
- this.engine.__setTelemetry(this.telemetry);
69
- } else {
70
- this.engine = config.engine;
71
- }
72
- }
73
60
  if (config?.storage) {
74
61
  if (this.telemetry) {
75
62
  this.storage = this.telemetry.traceClass(config.storage, {
@@ -100,9 +87,6 @@ var _Mastra = class _Mastra {
100
87
  });
101
88
  this.vectors = vectors;
102
89
  }
103
- if (config?.engine) {
104
- this.engine = config.engine;
105
- }
106
90
  if (config?.vectors) {
107
91
  this.vectors = config.vectors;
108
92
  }
@@ -143,7 +127,6 @@ var _Mastra = class _Mastra {
143
127
  agent.__registerPrimitives({
144
128
  logger: this.getLogger(),
145
129
  telemetry: this.telemetry,
146
- engine: this.engine,
147
130
  storage: this.storage,
148
131
  memory: this.memory,
149
132
  agents,
@@ -160,7 +143,6 @@ var _Mastra = class _Mastra {
160
143
  workflow.__registerPrimitives({
161
144
  logger: this.getLogger(),
162
145
  telemetry: this.telemetry,
163
- engine: this.engine,
164
146
  storage: this.storage,
165
147
  memory: this.memory,
166
148
  agents: this.agents,
@@ -171,7 +153,6 @@ var _Mastra = class _Mastra {
171
153
  this.workflows[key] = workflow;
172
154
  });
173
155
  }
174
- this.logger = logger;
175
156
  this.setLogger({
176
157
  logger
177
158
  });
@@ -268,9 +249,6 @@ var _Mastra = class _Mastra {
268
249
  this.tts?.[key]?.__setLogger(this.logger);
269
250
  });
270
251
  }
271
- if (this.engine) {
272
- this.engine.__setLogger(this.logger);
273
- }
274
252
  if (this.storage) {
275
253
  this.storage.__setLogger(this.logger);
276
254
  }
@@ -1,5 +1,5 @@
1
+ import { MastraBase } from './chunk-G4MCO7XF.js';
1
2
  import { embed, embedMany } from './chunk-5NQ3MEZM.js';
2
- import { MastraBase } from './chunk-WLG2YHOZ.js';
3
3
  import { __name } from './chunk-AJJZUHB4.js';
4
4
 
5
5
  // src/vector/index.ts
@@ -1,4 +1,4 @@
1
- import { RegisteredLogger, createLogger } from './chunk-IO3KMCXV.js';
1
+ import { RegisteredLogger, createLogger } from './chunk-ICMEXHKD.js';
2
2
  import { __name, __publicField } from './chunk-AJJZUHB4.js';
3
3
 
4
4
  // src/base.ts
@@ -11,7 +11,6 @@ var RegisteredLogger = {
11
11
  VECTOR: "VECTOR",
12
12
  BUNDLER: "BUNDLER",
13
13
  DEPLOYER: "DEPLOYER",
14
- ENGINE: "ENGINE",
15
14
  MEMORY: "MEMORY",
16
15
  STORAGE: "STORAGE",
17
16
  EMBEDDINGS: "EMBEDDINGS"
@@ -1,5 +1,5 @@
1
1
  import { deepMerge } from './chunk-KNPBNSJ7.js';
2
- import { MastraBase } from './chunk-WLG2YHOZ.js';
2
+ import { MastraBase } from './chunk-G4MCO7XF.js';
3
3
  import { __name, __publicField } from './chunk-AJJZUHB4.js';
4
4
 
5
5
  // src/memory/index.ts
@@ -12,7 +12,7 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
12
12
  __publicField(this, "MAX_CONTEXT_TOKENS");
13
13
  __publicField(this, "storage");
14
14
  __publicField(this, "vector");
15
- __publicField(this, "embedding");
15
+ __publicField(this, "embedder");
16
16
  __publicField(this, "threadConfig", {
17
17
  lastMessages: 40,
18
18
  semanticRecall: false
@@ -22,8 +22,8 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
22
22
  this.vector = config.vector;
23
23
  this.threadConfig.semanticRecall = true;
24
24
  }
25
- if (`embedding` in config) {
26
- this.embedding = config.embedding;
25
+ if (config.embedder) {
26
+ this.embedder = config.embedder;
27
27
  }
28
28
  if (config.options) {
29
29
  this.threadConfig = this.getMergedThreadConfig(config.options);
@@ -37,11 +37,22 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
37
37
  async getSystemMessage(_input) {
38
38
  return null;
39
39
  }
40
- parseEmbeddingOptions() {
41
- if (!this.embedding) {
42
- throw new Error(`Cannot use vector features without setting new Memory({ embedding: { ... } })`);
40
+ getEmbedder() {
41
+ if (!this.embedder) {
42
+ throw new Error(`Cannot use vector features without setting new Memory({ embedder: embedderInstance })
43
+
44
+ For example:
45
+
46
+ new Memory({
47
+ storage,
48
+ vector,
49
+ embedder: new OpenAIEmbedder({ // <- this is required
50
+ model: "text-embedding-3-small",
51
+ })
52
+ });
53
+ `);
43
54
  }
44
- return this.embedding;
55
+ return this.embedder;
45
56
  }
46
57
  getMergedThreadConfig(config) {
47
58
  return deepMerge(this.threadConfig, config || {});
@@ -136,7 +147,7 @@ var _MastraMemory = class _MastraMemory extends MastraBase {
136
147
  async createThread({ threadId, resourceId, title, metadata, memoryConfig }) {
137
148
  const thread = {
138
149
  id: threadId || this.generateId(),
139
- title,
150
+ title: title || "New Thread",
140
151
  resourceId,
141
152
  createdAt: /* @__PURE__ */ new Date(),
142
153
  updatedAt: /* @__PURE__ */ new Date(),