@mastra/memory 1.19.0-alpha.1 → 1.19.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.
- package/CHANGELOG.md +58 -0
- package/dist/{chunk-NZXH5WER.js → chunk-BCYGTJF2.js} +22 -34
- package/dist/chunk-BCYGTJF2.js.map +1 -0
- package/dist/{chunk-5IJQOXJM.cjs → chunk-IRMLP4QH.cjs} +22 -34
- package/dist/chunk-IRMLP4QH.cjs.map +1 -0
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +27 -27
- package/dist/docs/references/docs-agents-agent-approval.md +2 -0
- package/dist/docs/references/docs-agents-background-tasks.md +9 -6
- package/dist/docs/references/docs-memory-multi-user-threads.md +206 -0
- package/dist/docs/references/docs-memory-observational-memory.md +1 -0
- package/dist/docs/references/docs-memory-overview.md +1 -0
- package/dist/docs/references/docs-memory-working-memory.md +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/{observational-memory-KFKHBTCB.js → observational-memory-CSI3OZXQ.js} +3 -3
- package/dist/{observational-memory-KFKHBTCB.js.map → observational-memory-CSI3OZXQ.js.map} +1 -1
- package/dist/{observational-memory-V2APY3TO.cjs → observational-memory-RWXMKXJP.cjs} +26 -26
- package/dist/{observational-memory-V2APY3TO.cjs.map → observational-memory-RWXMKXJP.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/temporal-markers.d.ts +1 -1
- package/dist/processors/observational-memory/temporal-markers.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-5IJQOXJM.cjs.map +0 -1
- package/dist/chunk-NZXH5WER.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.19.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`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)]:
|
|
10
|
+
- @mastra/core@1.37.0-alpha.2
|
|
11
|
+
|
|
12
|
+
## 1.19.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Added `activateAfterIdle: "auto"` for Observational Memory early activation. ([#16663](https://github.com/mastra-ai/mastra/pull/16663))
|
|
17
|
+
|
|
18
|
+
Mastra can now choose an idle activation timeout from the active model provider's prompt cache behavior. OpenAI also respects `providerOptions.openai.promptCacheRetention` when available.
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
const memory = new Memory({
|
|
22
|
+
options: {
|
|
23
|
+
observationalMemory: {
|
|
24
|
+
model: 'google/gemini-2.5-flash',
|
|
25
|
+
activateAfterIdle: 'auto',
|
|
26
|
+
activateOnProviderChange: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Add `observeAttachments` to `ObservationConfig` for Observational Memory. Use it to control whether image/file parts on observed messages are forwarded to the Observer model alongside their placeholder text lines. ([#16671](https://github.com/mastra-ai/mastra/pull/16671))
|
|
33
|
+
- `true` (default) — forward all attachments (existing behavior).
|
|
34
|
+
- `false` — drop all attachments; placeholders still appear in the observer transcript.
|
|
35
|
+
- `string[]` — allowlist of mimeType patterns, e.g. `['image/*']` or `['application/pdf']`. Matching is case-insensitive and supports exact, `type/*`, and `*` patterns.
|
|
36
|
+
|
|
37
|
+
Useful when the Observer model is text-only (some DeepSeek endpoints, etc.) while the main agent uses a multimodal model. Tool-result attachments are filtered with the same rule.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
new Memory({
|
|
41
|
+
options: {
|
|
42
|
+
observationalMemory: {
|
|
43
|
+
observation: {
|
|
44
|
+
model: 'deepseek/deepseek-chat', // text-only observer
|
|
45
|
+
observeAttachments: false, // or e.g. ['image/*', 'application/pdf']
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- feat(memory): start background buffering of unobserved messages when agent goes idle ([#16694](https://github.com/mastra-ai/mastra/pull/16694))
|
|
55
|
+
|
|
56
|
+
In OM buffering mode, when the agent goes idle (turn.end()), any unobserved messages are now buffered in the background via a fire-and-forget buffer() call. This ensures observations are computed proactively rather than waiting for the next turn's step.prepare().
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [[`452036a`](https://github.com/mastra-ai/mastra/commit/452036a0d965b4f4c1efd93606e4f03b50b807a5), [`c272d50`](https://github.com/mastra-ai/mastra/commit/c272d50610a54496b6b6d92ccd4d37b333a2613a), [`27fd1b7`](https://github.com/mastra-ai/mastra/commit/27fd1b79ac62eb7694f92587eb7d1be05b59be01), [`5ba7253`](https://github.com/mastra-ai/mastra/commit/5ba7253745c85e8df8012a76d954c640ffa336f7), [`5556cc1`](https://github.com/mastra-ai/mastra/commit/5556cc1befec71518d84f826b3bfe3a079a9daf7), [`f73980d`](https://github.com/mastra-ai/mastra/commit/f73980d651eb5f7f1ab20582de4615a1b6f10fce), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`a702009`](https://github.com/mastra-ai/mastra/commit/a702009d3cfaa745120f501e21c783ed4d6a3072), [`9aee493`](https://github.com/mastra-ai/mastra/commit/9aee493ed6089b5133472623dcce49934bf2d509), [`d8692af`](https://github.com/mastra-ai/mastra/commit/d8692afa253028e39cdce2aafa0ac414071a762e), [`1a9cc60`](https://github.com/mastra-ai/mastra/commit/1a9cc6069f9910fc3d59e4953ac8cd95d89ad6f5), [`8cdb86c`](https://github.com/mastra-ai/mastra/commit/8cdb86ceed1137bc2768e147dce85a0692b9fb26), [`8534d79`](https://github.com/mastra-ai/mastra/commit/8534d791fa1cb70fe1c19e2604c4b63cc10dd051), [`eda90c5`](https://github.com/mastra-ai/mastra/commit/eda90c5bfd7de11805ecc9f4552716c895fbaf78), [`a935b0a`](https://github.com/mastra-ai/mastra/commit/a935b0a0977ae3f196b33ec7621f528069c82db0), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`c78f8cd`](https://github.com/mastra-ai/mastra/commit/c78f8cd6222a86e6c60ae5210b6929ad5221b6fb), [`e146aad`](https://github.com/mastra-ai/mastra/commit/e146aadbba66c410ba0e74bac4c50135495cb8dd), [`ac79462`](https://github.com/mastra-ai/mastra/commit/ac79462b98f1062394c45093aa515b0766f27ee2), [`1a0ec78`](https://github.com/mastra-ai/mastra/commit/1a0ec789a26cae443744e9abbd62ed6ee676af39), [`e47bca7`](https://github.com/mastra-ai/mastra/commit/e47bca7b72866d3abd173b9f530ac4318113a8ff), [`afc004f`](https://github.com/mastra-ai/mastra/commit/afc004f5cc7e30697809e7021820b9f5881e6719), [`0031d0f`](https://github.com/mastra-ai/mastra/commit/0031d0f13831d7843ac5d498734a7d92862e2ce3), [`841a222`](https://github.com/mastra-ai/mastra/commit/841a222560d8c19238f8213713f30535cdd82284), [`64c1e0b`](https://github.com/mastra-ai/mastra/commit/64c1e0b35165c96b659818bd0177aa18794ef11f), [`40d83a9`](https://github.com/mastra-ai/mastra/commit/40d83a90d9be31a1b83e04649edb703eb7753e33), [`4e88dc6`](https://github.com/mastra-ai/mastra/commit/4e88dc6b89f154c0eae37221c8126be0c23c569f), [`19018f0`](https://github.com/mastra-ai/mastra/commit/19018f05722af74a5978781a7731a654b26f7f2a), [`19281c7`](https://github.com/mastra-ai/mastra/commit/19281c70424f757219782de16c2699743c5e04d0), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`d52b6fe`](https://github.com/mastra-ai/mastra/commit/d52b6fe1c56853eb38864baae0bbfa75cc739ccb), [`408be73`](https://github.com/mastra-ai/mastra/commit/408be73449dfab92b51eab8c6623b6c443debc25), [`359439b`](https://github.com/mastra-ai/mastra/commit/359439bb8c635e048176306828195f8297f50021), [`71a820b`](https://github.com/mastra-ai/mastra/commit/71a820b2353fa1406772c50760a3732058a8b337), [`1698f5e`](https://github.com/mastra-ai/mastra/commit/1698f5ec141d34f22a873efdb145ce3cdf848a5e)]:
|
|
59
|
+
- @mastra/core@1.36.0
|
|
60
|
+
|
|
3
61
|
## 1.19.0-alpha.1
|
|
4
62
|
|
|
5
63
|
### Minor Changes
|
|
@@ -9466,6 +9466,16 @@ function getTemporalGapReminderMetadata(message, gapText, gapMs, timestamp) {
|
|
|
9466
9466
|
}
|
|
9467
9467
|
};
|
|
9468
9468
|
}
|
|
9469
|
+
function getTemporalGapReminderAttributes(message, gapText, gapMs, timestamp) {
|
|
9470
|
+
return {
|
|
9471
|
+
type: TEMPORAL_GAP_REMINDER_TYPE,
|
|
9472
|
+
gapText,
|
|
9473
|
+
gapMs,
|
|
9474
|
+
timestamp: formatTemporalTimestamp(new Date(timestamp)),
|
|
9475
|
+
timestampMs: timestamp,
|
|
9476
|
+
precedesMessageId: message.id
|
|
9477
|
+
};
|
|
9478
|
+
}
|
|
9469
9479
|
function isTemporalGapMarkerForMessage(message, targetMessageId) {
|
|
9470
9480
|
if (!isTemporalGapMarker(message)) {
|
|
9471
9481
|
return false;
|
|
@@ -9476,29 +9486,9 @@ function isTemporalGapMarkerForMessage(message, targetMessageId) {
|
|
|
9476
9486
|
}
|
|
9477
9487
|
return metadata?.systemReminder?.type === TEMPORAL_GAP_REMINDER_TYPE && metadata.systemReminder.precedesMessageId === targetMessageId;
|
|
9478
9488
|
}
|
|
9479
|
-
function createTemporalGapMarker(message, gapText, gapMs, timestamp) {
|
|
9480
|
-
const metadata = getTemporalGapReminderMetadata(message, gapText, gapMs, timestamp);
|
|
9481
|
-
return {
|
|
9482
|
-
id: `__temporal_gap_${crypto.randomUUID()}`,
|
|
9483
|
-
role: "user",
|
|
9484
|
-
createdAt: new Date(timestamp - 1),
|
|
9485
|
-
threadId: message.threadId,
|
|
9486
|
-
resourceId: message.resourceId,
|
|
9487
|
-
content: {
|
|
9488
|
-
format: 2,
|
|
9489
|
-
parts: [
|
|
9490
|
-
{
|
|
9491
|
-
type: "text",
|
|
9492
|
-
text: `<system-reminder type="${TEMPORAL_GAP_REMINDER_TYPE}" precedesMessageId="${message.id}">${getTemporalGapReminderText(gapText, timestamp)}</system-reminder>`
|
|
9493
|
-
}
|
|
9494
|
-
],
|
|
9495
|
-
metadata
|
|
9496
|
-
}
|
|
9497
|
-
};
|
|
9498
|
-
}
|
|
9499
9489
|
async function insertTemporalGapMarkers({
|
|
9500
9490
|
messageList,
|
|
9501
|
-
|
|
9491
|
+
sendSignal
|
|
9502
9492
|
}) {
|
|
9503
9493
|
const inputMessages = messageList.get.input.db().filter((message) => Boolean(message));
|
|
9504
9494
|
const latestInputMessage = inputMessages.at(-1);
|
|
@@ -9530,17 +9520,15 @@ async function insertTemporalGapMarkers({
|
|
|
9530
9520
|
if (!gapText) {
|
|
9531
9521
|
return;
|
|
9532
9522
|
}
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
type: "
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9523
|
+
await sendSignal?.({
|
|
9524
|
+
id: `__temporal_gap_${crypto.randomUUID()}`,
|
|
9525
|
+
type: "system-reminder",
|
|
9526
|
+
contents: getTemporalGapReminderText(gapText, timestamp),
|
|
9527
|
+
createdAt: new Date(timestamp - 1),
|
|
9528
|
+
acceptedAt: new Date(timestamp),
|
|
9529
|
+
attributes: getTemporalGapReminderAttributes(latestInputMessage, gapText, gapMs, timestamp),
|
|
9530
|
+
metadata: getTemporalGapReminderMetadata(latestInputMessage, gapText, gapMs, timestamp)
|
|
9541
9531
|
});
|
|
9542
|
-
const marker = createTemporalGapMarker(latestInputMessage, gapText, gapMs, timestamp);
|
|
9543
|
-
messageList.add(marker, "input");
|
|
9544
9532
|
}
|
|
9545
9533
|
|
|
9546
9534
|
// src/processors/observational-memory/processor.ts
|
|
@@ -9689,7 +9677,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
9689
9677
|
this.turn.requestContext = requestContext;
|
|
9690
9678
|
await this.turn.start(this.memory);
|
|
9691
9679
|
if (stepNumber === 0 && this.temporalMarkers) {
|
|
9692
|
-
await insertTemporalGapMarkers({ messageList,
|
|
9680
|
+
await insertTemporalGapMarkers({ messageList, sendSignal: args.sendSignal });
|
|
9693
9681
|
}
|
|
9694
9682
|
state.__omTurn = this.turn;
|
|
9695
9683
|
}
|
|
@@ -9821,5 +9809,5 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
9821
9809
|
}
|
|
9822
9810
|
|
|
9823
9811
|
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 };
|
|
9824
|
-
//# sourceMappingURL=chunk-
|
|
9825
|
-
//# sourceMappingURL=chunk-
|
|
9812
|
+
//# sourceMappingURL=chunk-BCYGTJF2.js.map
|
|
9813
|
+
//# sourceMappingURL=chunk-BCYGTJF2.js.map
|