@mastra/memory 1.20.0-alpha.2 → 1.20.1-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 (32) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/{chunk-BCWFD5J7.js → chunk-LXU26UVM.js} +18 -5
  3. package/dist/chunk-LXU26UVM.js.map +1 -0
  4. package/dist/{chunk-SMKIROLC.cjs → chunk-R2H7SJS2.cjs} +18 -5
  5. package/dist/chunk-R2H7SJS2.cjs.map +1 -0
  6. package/dist/docs/SKILL.md +1 -1
  7. package/dist/docs/assets/SOURCE_MAP.json +39 -39
  8. package/dist/docs/references/docs-memory-observational-memory.md +19 -0
  9. package/dist/docs/references/reference-memory-observational-memory.md +2 -0
  10. package/dist/index.cjs +14 -13
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +5 -4
  14. package/dist/index.js.map +1 -1
  15. package/dist/{observational-memory-E6F7NKJP.js → observational-memory-GE5MP6W7.js} +3 -3
  16. package/dist/{observational-memory-E6F7NKJP.js.map → observational-memory-GE5MP6W7.js.map} +1 -1
  17. package/dist/{observational-memory-LGCWMUEM.cjs → observational-memory-L32TPJ5J.cjs} +26 -26
  18. package/dist/{observational-memory-LGCWMUEM.cjs.map → observational-memory-L32TPJ5J.cjs.map} +1 -1
  19. package/dist/processors/index.cjs +24 -24
  20. package/dist/processors/index.js +1 -1
  21. package/dist/processors/observational-memory/observation-strategies/types.d.ts +4 -2
  22. package/dist/processors/observational-memory/observation-strategies/types.d.ts.map +1 -1
  23. package/dist/processors/observational-memory/observation-turn/turn.d.ts +5 -1
  24. package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -1
  25. package/dist/processors/observational-memory/observational-memory.d.ts +5 -1
  26. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  27. package/dist/processors/observational-memory/processor.d.ts.map +1 -1
  28. package/dist/processors/observational-memory/types.d.ts +11 -0
  29. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  30. package/package.json +7 -7
  31. package/dist/chunk-BCWFD5J7.js.map +0 -1
  32. package/dist/chunk-SMKIROLC.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.20.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Added `observation.bufferOnIdle` to opt idle turns into background observation buffering and carry the signal sender needed for background notifications. ([#17181](https://github.com/mastra-ai/mastra/pull/17181))
8
+
9
+ - Updated dependencies [[`d779de3`](https://github.com/mastra-ai/mastra/commit/d779de3cd9d2e7ed8110547190e2f15e786a0e41), [`1750c97`](https://github.com/mastra-ai/mastra/commit/1750c975d6179fbf6db2813b15229d4f8f23fc55), [`0e32507`](https://github.com/mastra-ai/mastra/commit/0e32507962cdfa5569b7bda5bc6fb3dd34e40b03), [`3a081c1`](https://github.com/mastra-ai/mastra/commit/3a081c1255c5ae8c99f6dad91cc612934ef6f2bd), [`fe9eacd`](https://github.com/mastra-ai/mastra/commit/fe9eacd9545a0a9d64aad31c9fa90294a425289e), [`db79c86`](https://github.com/mastra-ai/mastra/commit/db79c86c60723d57e02f9636ca2611bd4515f194)]:
10
+ - @mastra/core@1.38.0-alpha.2
11
+
12
+ ## 1.20.0
13
+
14
+ ### Minor Changes
15
+
16
+ - Add per-provider capability files and `auto` mode for `observeAttachments` ([#16922](https://github.com/mastra-ai/mastra/pull/16922))
17
+ - Generate per-provider capability files (e.g. `capabilities/openai.json`) alongside the model router registry, sourced from models.dev API
18
+ - Export `modelSupportsAttachments(modelRouterId)` from `@mastra/core/llm` to check whether a model supports image/file attachments
19
+ - Extend `observeAttachments` config to accept `'auto'` in addition to `boolean | string[]`
20
+ - When set to `'auto'`, the observer resolves the model (including function-based models) and checks the capability registry before deciding to forward or drop attachment parts
21
+
22
+ ### Patch Changes
23
+
24
+ - Fixed observational memory so in-progress messages are not removed during observation cleanup. ([#16913](https://github.com/mastra-ai/mastra/pull/16913))
25
+
26
+ - Removed zod as a required peer dependency. Internal schemas now use plain JSON Schema objects instead of zod runtime. ([#16726](https://github.com/mastra-ai/mastra/pull/16726))
27
+
28
+ - Fixed processor workflow steps so `sendSignal` is available when processors inject Agent signals, and updated Observational Memory temporal gap markers to use Agent signals. ([#16927](https://github.com/mastra-ai/mastra/pull/16927))
29
+
30
+ - Updated dependencies [[`cfa2e3a`](https://github.com/mastra-ai/mastra/commit/cfa2e3a5292322f48bb28b4d257d631da7f9d3cc), [`0cbece9`](https://github.com/mastra-ai/mastra/commit/0cbece9d832cb134a74cdbf3682d390a058215a4), [`2f5f58a`](https://github.com/mastra-ai/mastra/commit/2f5f58a9a8bb13bcdc6789db221eef7c9bf1ff02), [`7dfe1bc`](https://github.com/mastra-ai/mastra/commit/7dfe1bcfe71d261a6fd6bbf29b1dec49d78fb98f), [`ac442a4`](https://github.com/mastra-ai/mastra/commit/ac442a42fda0354ac2bcea772bf6691cb3e9dbb3), [`b7286f4`](https://github.com/mastra-ai/mastra/commit/b7286f4308267f5fd70e6bfee10dba9472640906), [`6096445`](https://github.com/mastra-ai/mastra/commit/60964459733f0ab384584d95e19c36607ffdf7b0), [`d72dc4b`](https://github.com/mastra-ai/mastra/commit/d72dc4b12d832546c05c20255fa96fe4eb515900), [`a481027`](https://github.com/mastra-ai/mastra/commit/a481027b549ba1018414990c8f045eaee7b9f413), [`1e5c067`](https://github.com/mastra-ai/mastra/commit/1e5c067d2e20a781af670578180d1ee249806d41), [`168fa09`](https://github.com/mastra-ai/mastra/commit/168fa09d6b39114cb8c13bd06f1dccb9bc81c6cd), [`df1947a`](https://github.com/mastra-ai/mastra/commit/df1947affa40f742067542251fac7ca759492ef4), [`ee59b74`](https://github.com/mastra-ai/mastra/commit/ee59b743ce73ad11784b4d9c6fbba8568edee1c8), [`a97b1a0`](https://github.com/mastra-ai/mastra/commit/a97b1a0abaed83946c3519d1e0f680d0815b8a67), [`008baaf`](https://github.com/mastra-ai/mastra/commit/008baafd8d851f831407045aebead5a2e3342eff), [`801baa0`](https://github.com/mastra-ai/mastra/commit/801baa07cccdbaec1d00942a92bdc831111744a2), [`8116436`](https://github.com/mastra-ai/mastra/commit/81164363eb225d774e41ff27da6a5ea611406688), [`c35b962`](https://github.com/mastra-ai/mastra/commit/c35b9625c7e854fcfdeee226a3338a750d0ff211), [`c27c4b9`](https://github.com/mastra-ai/mastra/commit/c27c4b9f137df5414fca4e45896aceccff6b0ed5), [`08b3b59`](https://github.com/mastra-ai/mastra/commit/08b3b590dd960dee6c9a6e39272f8927d803db6e), [`b3c3b18`](https://github.com/mastra-ai/mastra/commit/b3c3b189121489a3a51a8fd8204b569be9a89fe5), [`4084113`](https://github.com/mastra-ai/mastra/commit/408411370fc48a822e8b616b3b63f9409774e0e9), [`70cb714`](https://github.com/mastra-ai/mastra/commit/70cb7149c8f16f478e15b58498254a53181750a4), [`91cf0e0`](https://github.com/mastra-ai/mastra/commit/91cf0e027e511b871481a8576b56b7af83b15afd), [`7f9da22`](https://github.com/mastra-ai/mastra/commit/7f9da22efd5aa595e138a31de55a5f0f2f28b33d)]:
31
+ - @mastra/core@1.37.0
32
+
3
33
  ## 1.20.0-alpha.2
4
34
 
5
35
  ### Patch Changes
@@ -2404,6 +2404,8 @@ var ObservationTurn = class {
2404
2404
  requestContext;
2405
2405
  /** Optional observability context for nested OM spans. */
2406
2406
  observabilityContext;
2407
+ /** Optional signal sender for processor-originated notifications. */
2408
+ sendSignal;
2407
2409
  /** Current actor model for this step. Updated by the processor before prepare(). */
2408
2410
  actorModelContext;
2409
2411
  /** Processor-provided hooks for turn/step lifecycle integration. */
@@ -2413,6 +2415,8 @@ var ObservationTurn = class {
2413
2415
  this.threadId = opts.threadId;
2414
2416
  this.resourceId = opts.resourceId;
2415
2417
  this.messageList = opts.messageList;
2418
+ this.sendSignal = opts.sendSignal;
2419
+ this.requestContext = opts.requestContext;
2416
2420
  this.observabilityContext = opts.observabilityContext;
2417
2421
  this.hooks = opts.hooks ?? {};
2418
2422
  }
@@ -2502,7 +2506,9 @@ var ObservationTurn = class {
2502
2506
  if (unsavedMessages.length > 0) {
2503
2507
  await this.om.persistMessages(unsavedMessages, this.threadId, this.resourceId);
2504
2508
  }
2505
- if (this.om.buffering.isAsyncObservationEnabled()) {
2509
+ const asyncObservationEnabled = this.om.buffering.isAsyncObservationEnabled();
2510
+ const bufferOnIdle = this.om.getObservationConfig().bufferOnIdle;
2511
+ if (asyncObservationEnabled && bufferOnIdle) {
2506
2512
  const allMessages = this.messageList.get.all.db();
2507
2513
  const record = this._record;
2508
2514
  const unobservedMessages = this.om.getUnobservedMessages(allMessages, record);
@@ -2513,8 +2519,11 @@ var ObservationTurn = class {
2513
2519
  messages: unobservedMessages,
2514
2520
  record,
2515
2521
  writer: this.writer,
2522
+ sendSignal: this.sendSignal,
2516
2523
  requestContext: this.requestContext,
2517
- observabilityContext: this.observabilityContext
2524
+ currentModel: this.actorModelContext,
2525
+ observabilityContext: this.observabilityContext,
2526
+ skipMinimumTokenCheck: true
2518
2527
  }).catch((err) => {
2519
2528
  omDebug(`[OM:turn.end] idle buffer failed: ${err?.message}`);
2520
2529
  });
@@ -7186,6 +7195,7 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
7186
7195
  config.observation?.bufferTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferTokens,
7187
7196
  config.observation?.messageTokens ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.messageTokens
7188
7197
  ),
7198
+ bufferOnIdle: config.observation?.bufferOnIdle ?? false,
7189
7199
  bufferActivation: asyncBufferingDisabled ? void 0 : config.observation?.bufferActivation ?? OBSERVATIONAL_MEMORY_DEFAULTS.observation.bufferActivation,
7190
7200
  activateAfterIdle: parseActivationTTL(observationActivateAfterIdle, observationActivateAfterIdlePath),
7191
7201
  activateOnProviderChange: config.observation?.activateOnProviderChange ?? config.activateOnProviderChange ?? false,
@@ -8997,7 +9007,7 @@ ${grouped}` : grouped;
8997
9007
  const bufferTokens = this.observationConfig.bufferTokens ?? 5e3;
8998
9008
  const minNewTokens = bufferTokens / 2;
8999
9009
  const newTokens = await this.tokenCounter.countMessagesAsync(candidateMessages);
9000
- if (newTokens < minNewTokens || candidateMessages.length === 0) {
9010
+ if (candidateMessages.length === 0 || !opts.skipMinimumTokenCheck && newTokens < minNewTokens) {
9001
9011
  return { buffered: false, record };
9002
9012
  }
9003
9013
  if (opts.beforeBuffer) {
@@ -9030,7 +9040,9 @@ ${grouped}` : grouped;
9030
9040
  cycleId,
9031
9041
  startedAt,
9032
9042
  writer,
9043
+ sendSignal: opts.sendSignal,
9033
9044
  requestContext,
9045
+ currentModel: opts.currentModel,
9034
9046
  observabilityContext
9035
9047
  }).run();
9036
9048
  if (isOmReproCaptureEnabled()) {
@@ -9716,6 +9728,7 @@ var ObservationalMemoryProcessor = class {
9716
9728
  }
9717
9729
  });
9718
9730
  this.turn.writer = writer;
9731
+ this.turn.sendSignal = args.sendSignal;
9719
9732
  this.turn.requestContext = requestContext;
9720
9733
  await this.turn.start(this.memory);
9721
9734
  if (stepNumber === 0 && this.temporalMarkers) {
@@ -9851,5 +9864,5 @@ function getObservationsAsOf(activeObservations, asOf) {
9851
9864
  }
9852
9865
 
9853
9866
  export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, formatToolResultForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, resolveToolResultValue, stripEphemeralAnchorIds, stripObservationGroups, truncateStringByTokens, wrapInObservationGroup };
9854
- //# sourceMappingURL=chunk-BCWFD5J7.js.map
9855
- //# sourceMappingURL=chunk-BCWFD5J7.js.map
9867
+ //# sourceMappingURL=chunk-LXU26UVM.js.map
9868
+ //# sourceMappingURL=chunk-LXU26UVM.js.map