@mastra/memory 1.12.1-alpha.0 → 1.13.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.
- package/CHANGELOG.md +31 -0
- package/dist/{chunk-HLGFIN4J.cjs → chunk-O3KNDDJV.cjs} +27 -6
- package/dist/chunk-O3KNDDJV.cjs.map +1 -0
- package/dist/{chunk-DDQHE4NV.js → chunk-ZVRY34YB.js} +27 -6
- package/dist/chunk-ZVRY34YB.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +27 -27
- package/dist/index.cjs +12 -12
- package/dist/index.js +4 -4
- package/dist/{observational-memory-34W4S4I5.cjs → observational-memory-HBQCXPBU.cjs} +26 -26
- package/dist/{observational-memory-34W4S4I5.cjs.map → observational-memory-HBQCXPBU.cjs.map} +1 -1
- package/dist/{observational-memory-B25SASRW.js → observational-memory-WOEVNCG4.js} +3 -3
- package/dist/{observational-memory-B25SASRW.js.map → observational-memory-WOEVNCG4.js.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts +16 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-DDQHE4NV.js.map +0 -1
- package/dist/chunk-HLGFIN4J.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.13.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added `loadUnobservedMessages({ threadId, resourceId? })` as a public method on `ObservationalMemory`. ([#14921](https://github.com/mastra-ai/mastra/pull/14921))
|
|
8
|
+
|
|
9
|
+
This lets external consumers (e.g. the Mastra gateway proxy) load previously-stored messages that haven't been observed yet, without having to reimplement the internal storage query and part-level filtering logic. The method fetches the OM record, queries storage for messages after the `lastObservedAt` cursor, and applies part-level filtering so partially-observed messages only return their unobserved parts.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const unobserved = await om.loadUnobservedMessages({
|
|
13
|
+
threadId: 'thread-123',
|
|
14
|
+
resourceId: 'user-456',
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`13f4327`](https://github.com/mastra-ai/mastra/commit/13f4327f052faebe199cefbe906d33bf90238767)]:
|
|
21
|
+
- @mastra/core@1.21.0-alpha.1
|
|
22
|
+
|
|
23
|
+
## 1.12.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Standardized all logger calls across the codebase to use static string messages with structured data objects. Dynamic values are now passed as key-value pairs in the second argument instead of being interpolated into template literal strings. This improves log filterability and searchability in observability storage. ([#14899](https://github.com/mastra-ai/mastra/pull/14899))
|
|
28
|
+
|
|
29
|
+
Removed ~150 redundant or noisy log calls including duplicate error logging after trackException and verbose in-memory storage CRUD traces.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`cbeec24`](https://github.com/mastra-ai/mastra/commit/cbeec24b3c97a1a296e7e461e66cc7f7d215dc50), [`cee146b`](https://github.com/mastra-ai/mastra/commit/cee146b5d858212e1df2b2730fc36d3ceda0e08d), [`aa0aeff`](https://github.com/mastra-ai/mastra/commit/aa0aeffa11efbef5e219fbd97bf43d263cfe3afe), [`2bcec65`](https://github.com/mastra-ai/mastra/commit/2bcec652d62b07eab15e9eb9822f70184526eede), [`ad9bded`](https://github.com/mastra-ai/mastra/commit/ad9bdedf86a824801f49928a8d40f6e31ff5450f), [`cbeec24`](https://github.com/mastra-ai/mastra/commit/cbeec24b3c97a1a296e7e461e66cc7f7d215dc50), [`208c0bb`](https://github.com/mastra-ai/mastra/commit/208c0bbacbf5a1da6318f2a0e0c544390e542ddc), [`f566ee7`](https://github.com/mastra-ai/mastra/commit/f566ee7d53a3da33a01103e2a5ac2070ddefe6b0)]:
|
|
32
|
+
- @mastra/core@1.20.0
|
|
33
|
+
|
|
3
34
|
## 1.12.1-alpha.0
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -6715,7 +6715,7 @@ ${suggestedResponse}
|
|
|
6715
6715
|
* In resource scope mode, loads messages for the entire resource (all threads).
|
|
6716
6716
|
* In thread scope mode, loads messages for just the current thread.
|
|
6717
6717
|
*/
|
|
6718
|
-
async
|
|
6718
|
+
async loadMessagesFromStorage(threadId, resourceId, lastObservedAt) {
|
|
6719
6719
|
const startDate = lastObservedAt ? new Date(lastObservedAt.getTime() + 1) : void 0;
|
|
6720
6720
|
let result;
|
|
6721
6721
|
if (this.scope === "resource" && resourceId) {
|
|
@@ -7403,7 +7403,7 @@ ${grouped}` : grouped;
|
|
|
7403
7403
|
if (opts.messages) {
|
|
7404
7404
|
unobservedMessages = this.getUnobservedMessages(opts.messages, record);
|
|
7405
7405
|
} else {
|
|
7406
|
-
const rawMessages = await this.
|
|
7406
|
+
const rawMessages = await this.loadMessagesFromStorage(
|
|
7407
7407
|
threadId,
|
|
7408
7408
|
resourceId,
|
|
7409
7409
|
record.lastObservedAt ? new Date(record.lastObservedAt) : void 0
|
|
@@ -7516,6 +7516,27 @@ ${grouped}` : grouped;
|
|
|
7516
7516
|
const record = await this.getOrCreateRecord(threadId, resourceId);
|
|
7517
7517
|
return this.getUnobservedMessages(messages, record);
|
|
7518
7518
|
}
|
|
7519
|
+
/**
|
|
7520
|
+
* Load unobserved messages from storage for a thread/resource.
|
|
7521
|
+
*
|
|
7522
|
+
* Fetches the OM record, queries storage for messages after the
|
|
7523
|
+
* lastObservedAt cursor, then applies part-level filtering so
|
|
7524
|
+
* partially-observed messages only include their unobserved parts.
|
|
7525
|
+
*
|
|
7526
|
+
* Use this when you need to load stored conversation history that
|
|
7527
|
+
* hasn't been observed yet (e.g. in a stateless gateway proxy that
|
|
7528
|
+
* only receives the latest message from the HTTP request).
|
|
7529
|
+
*/
|
|
7530
|
+
async loadUnobservedMessages(opts) {
|
|
7531
|
+
const { threadId, resourceId } = opts;
|
|
7532
|
+
const record = await this.getOrCreateRecord(threadId, resourceId);
|
|
7533
|
+
const rawMessages = await this.loadMessagesFromStorage(
|
|
7534
|
+
threadId,
|
|
7535
|
+
resourceId,
|
|
7536
|
+
record.lastObservedAt ? new Date(record.lastObservedAt) : void 0
|
|
7537
|
+
);
|
|
7538
|
+
return this.getUnobservedMessages(rawMessages, record);
|
|
7539
|
+
}
|
|
7519
7540
|
/**
|
|
7520
7541
|
* Create a buffered observation chunk without merging into active observations.
|
|
7521
7542
|
*
|
|
@@ -7577,7 +7598,7 @@ ${grouped}` : grouped;
|
|
|
7577
7598
|
if (opts.messages) {
|
|
7578
7599
|
candidateMessages = this.getUnobservedMessages(opts.messages, record, { excludeBuffered: true });
|
|
7579
7600
|
} else {
|
|
7580
|
-
const rawMessages = await this.
|
|
7601
|
+
const rawMessages = await this.loadMessagesFromStorage(
|
|
7581
7602
|
threadId,
|
|
7582
7603
|
resourceId,
|
|
7583
7604
|
record.lastObservedAt ? new Date(record.lastObservedAt) : void 0
|
|
@@ -7819,7 +7840,7 @@ ${grouped}` : grouped;
|
|
|
7819
7840
|
await this.withLock(lockKey, async () => {
|
|
7820
7841
|
const freshRecord = await this.getOrCreateRecord(threadId, resourceId);
|
|
7821
7842
|
generationBefore = freshRecord.generationCount;
|
|
7822
|
-
const unobservedMessages = messages ? this.getUnobservedMessages(messages, freshRecord) : await this.
|
|
7843
|
+
const unobservedMessages = messages ? this.getUnobservedMessages(messages, freshRecord) : await this.loadMessagesFromStorage(
|
|
7823
7844
|
threadId,
|
|
7824
7845
|
resourceId,
|
|
7825
7846
|
freshRecord.lastObservedAt ? new Date(freshRecord.lastObservedAt) : void 0
|
|
@@ -8475,5 +8496,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
8475
8496
|
exports.stripObservationGroups = stripObservationGroups;
|
|
8476
8497
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
8477
8498
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
8478
|
-
//# sourceMappingURL=chunk-
|
|
8479
|
-
//# sourceMappingURL=chunk-
|
|
8499
|
+
//# sourceMappingURL=chunk-O3KNDDJV.cjs.map
|
|
8500
|
+
//# sourceMappingURL=chunk-O3KNDDJV.cjs.map
|