@mastra/memory 1.33.0-alpha.2 → 1.33.0-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.
@@ -3,7 +3,7 @@ name: mastra-memory
3
3
  description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/memory"
6
- version: "1.33.0-alpha.2"
6
+ version: "1.33.0-alpha.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.33.0-alpha.2",
2
+ "version": "1.33.0-alpha.4",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {},
5
5
  "modules": {
@@ -120,12 +120,14 @@ The function can be asynchronous. For decisions that depend on the tool name and
120
120
 
121
121
  ```typescript
122
122
  import { Classifier } from '@mastra/core/classifier'
123
- import { model } from '../models/evaluation-model'
123
+ import { createTypeSafeAi } from '@ai-sdk/typesafe-ai'
124
124
  import { agent } from './agent'
125
125
 
126
126
  const approvalClassifier = new Classifier({
127
127
  id: 'tool-approval-classifier',
128
- model,
128
+ model: createTypeSafeAi({ apiKey: process.env.TYPESAFE_AI_API_KEY }).evaluationModel(
129
+ 'jev-latest',
130
+ ),
129
131
  questions: {
130
132
  requiresApproval: {
131
133
  type: 'boolean',
@@ -10,15 +10,16 @@ Agents that use memory in `thread` scope, including observational memory, requir
10
10
  ObservationalMemory (scope: 'thread') requires a threadId, but none was found in RequestContext or MessageList.
11
11
  ```
12
12
 
13
- This page covers the three working patterns for running Mastra evals against memory-enabled agents, what each path supports, and which one to pick. A complete runnable repro for all three approaches lives in [`examples/evals-with-memory`](https://github.com/mastra-ai/mastra/tree/main/examples/evals-with-memory).
13
+ Choose an approach based on how you want to share memory across eval items. For runnable examples, see [`examples/evals-with-memory`](https://github.com/mastra-ai/mastra/tree/main/examples/evals-with-memory).
14
14
 
15
15
  ## When to use which approach
16
16
 
17
- | Goal | Approach |
18
- | ------------------------------------------------ | ----------------------------------------------------------------------------------------- |
19
- | One shared conversation across every item | [`runEvals` with global `targetOptions.memory`](#shared-thread-with-runevals) |
20
- | One independent thread per item, focused CI loop | [`runEvals` per item](#per-item-threads-with-runevals) |
21
- | Per-item threads driven by a stored `Dataset` | [`dataset.startExperiment` with an inline task](#dataset-experiments-with-an-inline-task) |
17
+ | Goal | Approach |
18
+ | -------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
19
+ | One shared conversation across every item | [`runEvals` with global `targetOptions.memory`](#shared-thread-with-runevals) |
20
+ | One independent thread per item, focused CI loop | [`runEvals` per item](#per-item-threads-with-runevals) |
21
+ | Fresh thread per item in a stored `Dataset` | [`dataset.startExperiment` with a registered agent](https://mastra.ai/docs/evals/experiments) |
22
+ | Explicit thread selection per item in a stored `Dataset` | [`dataset.startExperiment` with an inline task](#dataset-experiments-with-an-inline-task) |
22
23
 
23
24
  Pre-seeding `RequestContext` with `MastraMemory` **isn't** a supported way to drive memory into an agent. Thread resolution reads `args.memory.thread`, `RequestContext.MastraMemory` is populated by `prepare-memory-step` after the agent has already resolved its thread.
24
25
 
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-CeFdO1YZ.cjs");
2
+ const require_src = require("./src-CjK4q2uy.cjs");
3
3
  let _mastra_core_processors = require("@mastra/core/processors");
4
4
  exports.Extractor = require_src.Extractor;
5
5
  exports.KnowledgeSemanticIndexCoordinator = require_src.KnowledgeSemanticIndexCoordinator;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as SUMMARIZE_THREAD_DEFAULTS, G as StaleKnowledgeSemanticIndexError, Q as Extractor, S as deepMergeWorkingMemory, U as Subconscious, W as KnowledgeSemanticIndexCoordinator, a as extractWorkingMemoryContent, b as WorkingMemoryStateProcessor, c as getObservationsAsOf, i as WorkingMemory, n as MessageHistory, o as extractWorkingMemoryTags, q as ModelByInputTokens, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, v as WORKING_MEMORY_STATE_ID, w as summarizeConversation, x as WorkingMemoryExtractor, y as WORKING_MEMORY_STATE_PROCESSOR_ID } from "./src-BikfoIdS.js";
1
+ import { C as SUMMARIZE_THREAD_DEFAULTS, G as StaleKnowledgeSemanticIndexError, Q as Extractor, S as deepMergeWorkingMemory, U as Subconscious, W as KnowledgeSemanticIndexCoordinator, a as extractWorkingMemoryContent, b as WorkingMemoryStateProcessor, c as getObservationsAsOf, i as WorkingMemory, n as MessageHistory, o as extractWorkingMemoryTags, q as ModelByInputTokens, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, v as WORKING_MEMORY_STATE_ID, w as summarizeConversation, x as WorkingMemoryExtractor, y as WORKING_MEMORY_STATE_PROCESSOR_ID } from "./src-CynTAk-_.js";
2
2
  export { Extractor, KnowledgeSemanticIndexCoordinator, Memory, MessageHistory, ModelByInputTokens, SUMMARIZE_THREAD_DEFAULTS, SemanticRecall, StaleKnowledgeSemanticIndexError, Subconscious, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemory, WorkingMemoryExtractor, WorkingMemoryStateProcessor, deepMergeWorkingMemory, extractWorkingMemoryContent, extractWorkingMemoryTags, getObservationsAsOf, removeWorkingMemoryTags, summarizeConversation };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("../src-CeFdO1YZ.cjs");
2
+ const require_src = require("../src-CjK4q2uy.cjs");
3
3
  exports.Extractor = require_src.Extractor;
4
4
  exports.KnowledgeSemanticIndexCoordinator = require_src.KnowledgeSemanticIndexCoordinator;
5
5
  exports.ModelByInputTokens = require_src.ModelByInputTokens;
@@ -1,2 +1,2 @@
1
- import { A as formatMessagesForObserver, B as OBSERVATION_CONTEXT_PROMPT_THREAD, D as buildObserverPrompt, E as OBSERVER_SYSTEM_PROMPT, F as parseAnchorId, G as StaleKnowledgeSemanticIndexError, H as getObservationContextPrompt, I as stripEphemeralAnchorIds, J as SUBCONSCIOUS_ACTIVITY_STATE_ID, K as SubconsciousRemindExtractor, L as OBSERVATIONAL_MEMORY_DEFAULTS, M as optimizeObservationsForContext, N as parseObserverOutput, O as buildObserverSystemPrompt, P as injectAnchorIds, Q as Extractor, R as OBSERVATION_CONTEXT_INSTRUCTIONS, T as TokenCounter, U as Subconscious, V as OBSERVATION_CONTINUATION_HINT, W as KnowledgeSemanticIndexCoordinator, X as publishSubconsciousActivity, Y as buildSubconsciousActivitySnapshot, Z as renderSubconsciousActivity, _ as wrapInObservationGroup, c as getObservationsAsOf, d as combineObservationGroupRanges, f as deriveObservationGroupProvenance, g as stripObservationGroups, h as renderObservationGroupsForReflection, j as hasCurrentTaskSection, k as extractCurrentTask, l as ObservationalMemoryProcessor, m as reconcileObservationGroupsFromReflection, p as parseObservationGroups, q as ModelByInputTokens, u as ObservationalMemory, w as summarizeConversation, x as WorkingMemoryExtractor, z as OBSERVATION_CONTEXT_PROMPT } from "../src-BikfoIdS.js";
1
+ import { A as formatMessagesForObserver, B as OBSERVATION_CONTEXT_PROMPT_THREAD, D as buildObserverPrompt, E as OBSERVER_SYSTEM_PROMPT, F as parseAnchorId, G as StaleKnowledgeSemanticIndexError, H as getObservationContextPrompt, I as stripEphemeralAnchorIds, J as SUBCONSCIOUS_ACTIVITY_STATE_ID, K as SubconsciousRemindExtractor, L as OBSERVATIONAL_MEMORY_DEFAULTS, M as optimizeObservationsForContext, N as parseObserverOutput, O as buildObserverSystemPrompt, P as injectAnchorIds, Q as Extractor, R as OBSERVATION_CONTEXT_INSTRUCTIONS, T as TokenCounter, U as Subconscious, V as OBSERVATION_CONTINUATION_HINT, W as KnowledgeSemanticIndexCoordinator, X as publishSubconsciousActivity, Y as buildSubconsciousActivitySnapshot, Z as renderSubconsciousActivity, _ as wrapInObservationGroup, c as getObservationsAsOf, d as combineObservationGroupRanges, f as deriveObservationGroupProvenance, g as stripObservationGroups, h as renderObservationGroupsForReflection, j as hasCurrentTaskSection, k as extractCurrentTask, l as ObservationalMemoryProcessor, m as reconcileObservationGroupsFromReflection, p as parseObservationGroups, q as ModelByInputTokens, u as ObservationalMemory, w as summarizeConversation, x as WorkingMemoryExtractor, z as OBSERVATION_CONTEXT_PROMPT } from "../src-CynTAk-_.js";
2
2
  export { Extractor, KnowledgeSemanticIndexCoordinator, ModelByInputTokens, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_PROMPT_THREAD, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, SUBCONSCIOUS_ACTIVITY_STATE_ID, StaleKnowledgeSemanticIndexError, Subconscious, SubconsciousRemindExtractor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, buildSubconsciousActivitySnapshot, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationContextPrompt, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, publishSubconsciousActivity, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, renderSubconsciousActivity, stripEphemeralAnchorIds, stripObservationGroups, summarizeConversation, wrapInObservationGroup };
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/error.ts"],"names":[],"mappings":"AAQA,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqBjE;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,CAAC;AACnD,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,KAAK;IAE5C,QAAQ,CAAC,WAAW,EAAE,aAAa;gBAA1B,WAAW,EAAE,aAAa,EACnC,KAAK,EAAE,OAAO;CAKjB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAMtF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe;;;EAKlF;AAED,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA4CpD"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/error.ts"],"names":[],"mappings":"AAQA,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqBjE;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,UAAU,CAAC;AACnD,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,KAAK;IAE5C,QAAQ,CAAC,WAAW,EAAE,aAAa;gBAA1B,WAAW,EAAE,aAAa,EACnC,KAAK,EAAE,OAAO;CAKjB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAMtF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe;;;EAKlF;AAED,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAiDpD"}
@@ -3734,7 +3734,7 @@ function trimStartOfStream() {
3734
3734
  };
3735
3735
  }
3736
3736
  //#endregion
3737
- //#region ../_vendored/ai_v5/dist/dist-DeQB2Mal.js
3737
+ //#region ../_vendored/ai_v5/dist/dist-BmDRJJMS.js
3738
3738
  var marker$2$4 = "vercel.ai.error";
3739
3739
  var symbol$2$4 = Symbol.for(marker$2$4);
3740
3740
  var _a$2$4;
@@ -9021,7 +9021,7 @@ var object$1 = ({ schema: inputSchema }) => {
9021
9021
  };
9022
9022
  };
9023
9023
  //#endregion
9024
- //#region ../_vendored/ai_v6/dist/dist--V1K8YWk.js
9024
+ //#region ../_vendored/ai_v6/dist/dist-BBy3PDi4.js
9025
9025
  var marker$2 = "vercel.ai.error";
9026
9026
  var symbol$2 = Symbol.for(marker$2);
9027
9027
  var _a$2;
@@ -11566,7 +11566,7 @@ var _b14;
11566
11566
  }
11567
11567
  });
11568
11568
  //#endregion
11569
- //#region ../_vendored/ai_v6/dist/dist-CWofJnzt.js
11569
+ //#region ../_vendored/ai_v6/dist/dist-CM5SoUT8.js
11570
11570
  function getContext() {
11571
11571
  return { headers: {} };
11572
11572
  }
@@ -18954,6 +18954,7 @@ function formatOmError(error) {
18954
18954
  }
18955
18955
  if (visited.has(value)) return;
18956
18956
  visited.add(value);
18957
+ if (typeof value.id === "string" && typeof value.domain === "string" && typeof value.category === "string") add(value.id);
18957
18958
  add(value.message);
18958
18959
  if (typeof value.statusCode === "number") add(`HTTP ${value.statusCode}`);
18959
18960
  if (typeof value.responseBody === "string") try {
@@ -34773,4 +34774,4 @@ Object.defineProperty(exports, "wrapInObservationGroup", {
34773
34774
  }
34774
34775
  });
34775
34776
 
34776
- //# sourceMappingURL=src-CeFdO1YZ.cjs.map
34777
+ //# sourceMappingURL=src-CjK4q2uy.cjs.map