@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
|
@@ -9473,6 +9473,16 @@ function getTemporalGapReminderMetadata(message, gapText, gapMs, timestamp) {
|
|
|
9473
9473
|
}
|
|
9474
9474
|
};
|
|
9475
9475
|
}
|
|
9476
|
+
function getTemporalGapReminderAttributes(message, gapText, gapMs, timestamp) {
|
|
9477
|
+
return {
|
|
9478
|
+
type: TEMPORAL_GAP_REMINDER_TYPE,
|
|
9479
|
+
gapText,
|
|
9480
|
+
gapMs,
|
|
9481
|
+
timestamp: formatTemporalTimestamp(new Date(timestamp)),
|
|
9482
|
+
timestampMs: timestamp,
|
|
9483
|
+
precedesMessageId: message.id
|
|
9484
|
+
};
|
|
9485
|
+
}
|
|
9476
9486
|
function isTemporalGapMarkerForMessage(message, targetMessageId) {
|
|
9477
9487
|
if (!isTemporalGapMarker(message)) {
|
|
9478
9488
|
return false;
|
|
@@ -9483,29 +9493,9 @@ function isTemporalGapMarkerForMessage(message, targetMessageId) {
|
|
|
9483
9493
|
}
|
|
9484
9494
|
return metadata?.systemReminder?.type === TEMPORAL_GAP_REMINDER_TYPE && metadata.systemReminder.precedesMessageId === targetMessageId;
|
|
9485
9495
|
}
|
|
9486
|
-
function createTemporalGapMarker(message, gapText, gapMs, timestamp) {
|
|
9487
|
-
const metadata = getTemporalGapReminderMetadata(message, gapText, gapMs, timestamp);
|
|
9488
|
-
return {
|
|
9489
|
-
id: `__temporal_gap_${crypto.randomUUID()}`,
|
|
9490
|
-
role: "user",
|
|
9491
|
-
createdAt: new Date(timestamp - 1),
|
|
9492
|
-
threadId: message.threadId,
|
|
9493
|
-
resourceId: message.resourceId,
|
|
9494
|
-
content: {
|
|
9495
|
-
format: 2,
|
|
9496
|
-
parts: [
|
|
9497
|
-
{
|
|
9498
|
-
type: "text",
|
|
9499
|
-
text: `<system-reminder type="${TEMPORAL_GAP_REMINDER_TYPE}" precedesMessageId="${message.id}">${getTemporalGapReminderText(gapText, timestamp)}</system-reminder>`
|
|
9500
|
-
}
|
|
9501
|
-
],
|
|
9502
|
-
metadata
|
|
9503
|
-
}
|
|
9504
|
-
};
|
|
9505
|
-
}
|
|
9506
9496
|
async function insertTemporalGapMarkers({
|
|
9507
9497
|
messageList,
|
|
9508
|
-
|
|
9498
|
+
sendSignal
|
|
9509
9499
|
}) {
|
|
9510
9500
|
const inputMessages = messageList.get.input.db().filter((message) => Boolean(message));
|
|
9511
9501
|
const latestInputMessage = inputMessages.at(-1);
|
|
@@ -9537,17 +9527,15 @@ async function insertTemporalGapMarkers({
|
|
|
9537
9527
|
if (!gapText) {
|
|
9538
9528
|
return;
|
|
9539
9529
|
}
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
type: "
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9530
|
+
await sendSignal?.({
|
|
9531
|
+
id: `__temporal_gap_${crypto.randomUUID()}`,
|
|
9532
|
+
type: "system-reminder",
|
|
9533
|
+
contents: getTemporalGapReminderText(gapText, timestamp),
|
|
9534
|
+
createdAt: new Date(timestamp - 1),
|
|
9535
|
+
acceptedAt: new Date(timestamp),
|
|
9536
|
+
attributes: getTemporalGapReminderAttributes(latestInputMessage, gapText, gapMs, timestamp),
|
|
9537
|
+
metadata: getTemporalGapReminderMetadata(latestInputMessage, gapText, gapMs, timestamp)
|
|
9548
9538
|
});
|
|
9549
|
-
const marker = createTemporalGapMarker(latestInputMessage, gapText, gapMs, timestamp);
|
|
9550
|
-
messageList.add(marker, "input");
|
|
9551
9539
|
}
|
|
9552
9540
|
|
|
9553
9541
|
// src/processors/observational-memory/processor.ts
|
|
@@ -9696,7 +9684,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
9696
9684
|
this.turn.requestContext = requestContext;
|
|
9697
9685
|
await this.turn.start(this.memory);
|
|
9698
9686
|
if (stepNumber === 0 && this.temporalMarkers) {
|
|
9699
|
-
await insertTemporalGapMarkers({ messageList,
|
|
9687
|
+
await insertTemporalGapMarkers({ messageList, sendSignal: args.sendSignal });
|
|
9700
9688
|
}
|
|
9701
9689
|
state.__omTurn = this.turn;
|
|
9702
9690
|
}
|
|
@@ -9853,5 +9841,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
9853
9841
|
exports.stripObservationGroups = stripObservationGroups;
|
|
9854
9842
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
9855
9843
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
9856
|
-
//# sourceMappingURL=chunk-
|
|
9857
|
-
//# sourceMappingURL=chunk-
|
|
9844
|
+
//# sourceMappingURL=chunk-IRMLP4QH.cjs.map
|
|
9845
|
+
//# sourceMappingURL=chunk-IRMLP4QH.cjs.map
|