@mastra/memory 1.16.0 → 1.17.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 +26 -0
- package/dist/{chunk-HAUWGR76.cjs → chunk-5MTY2UYL.cjs} +206 -10
- package/dist/chunk-5MTY2UYL.cjs.map +1 -0
- package/dist/{chunk-OOA4C7IX.js → chunk-MPBMHIAQ.js} +206 -10
- package/dist/chunk-MPBMHIAQ.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +47 -47
- package/dist/docs/references/docs-memory-observational-memory.md +31 -0
- package/dist/docs/references/reference-memory-observational-memory.md +2 -0
- package/dist/index.cjs +16 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-CIGODMXV.js → observational-memory-7YYZIIX4.js} +3 -3
- package/dist/{observational-memory-CIGODMXV.js.map → observational-memory-7YYZIIX4.js.map} +1 -1
- package/dist/{observational-memory-EWU3QFIE.cjs → observational-memory-UCFGVLVW.cjs} +26 -26
- package/dist/{observational-memory-EWU3QFIE.cjs.map → observational-memory-UCFGVLVW.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/date-utils.d.ts +6 -0
- package/dist/processors/observational-memory/date-utils.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts +5 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/string-utils.d.ts +13 -0
- package/dist/processors/observational-memory/string-utils.d.ts.map +1 -0
- package/dist/processors/observational-memory/temporal-markers.d.ts +4 -0
- package/dist/processors/observational-memory/temporal-markers.d.ts.map +1 -0
- package/dist/processors/observational-memory/tool-result-helpers.d.ts.map +1 -1
- package/dist/processors/observational-memory/types.d.ts +7 -0
- package/dist/processors/observational-memory/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-HAUWGR76.cjs.map +0 -1
- package/dist/chunk-OOA4C7IX.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added opt-in temporal-gap markers for observational memory. When enabled via `observationalMemory.temporalMarkers: true`, the agent receives a `<system-reminder type="temporal-gap">` before any user message that arrives more than 10 minutes after the previous one, so it can anchor responses in real elapsed time. Markers are persisted, surfaced to the observer, and rendered by the MastraCode TUI on reload. ([#15605](https://github.com/mastra-ai/mastra/pull/15605))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Fixed observer agent truncation that could cut UTF-16 surrogate pairs in half when formatting messages, tool results, or observation lines with emoji or other astral-plane characters. This produced lone surrogates that strict JSON parsers (including Anthropic's) reject with errors like `no low surrogate in string`, causing observer runs to fail. ([#15634](https://github.com/mastra-ai/mastra/pull/15634))
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`f112db1`](https://github.com/mastra-ai/mastra/commit/f112db179557ae9b5a0f1d25dc47f928d7d61cd9), [`21d9706`](https://github.com/mastra-ai/mastra/commit/21d970604d89eee970cbf8013d26d7551aff6ea5), [`0a0aa94`](https://github.com/mastra-ai/mastra/commit/0a0aa94729592e99885af2efb90c56aaada62247), [`ed07df3`](https://github.com/mastra-ai/mastra/commit/ed07df32a9d539c8261e892fc1bade783f5b41a6), [`01a7d51`](https://github.com/mastra-ai/mastra/commit/01a7d513493d21562f677f98550f7ceb165ba78c)]:
|
|
14
|
+
- @mastra/core@1.27.0
|
|
15
|
+
|
|
16
|
+
## 1.17.0-alpha.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- Added opt-in temporal-gap markers for observational memory. When enabled via `observationalMemory.temporalMarkers: true`, the agent receives a `<system-reminder type="temporal-gap">` before any user message that arrives more than 10 minutes after the previous one, so it can anchor responses in real elapsed time. Markers are persisted, surfaced to the observer, and rendered by the MastraCode TUI on reload. ([#15605](https://github.com/mastra-ai/mastra/pull/15605))
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Fixed observer agent truncation that could cut UTF-16 surrogate pairs in half when formatting messages, tool results, or observation lines with emoji or other astral-plane characters. This produced lone surrogates that strict JSON parsers (including Anthropic's) reject with errors like `no low surrogate in string`, causing observer runs to fail. ([#15634](https://github.com/mastra-ai/mastra/pull/15634))
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`0a0aa94`](https://github.com/mastra-ai/mastra/commit/0a0aa94729592e99885af2efb90c56aaada62247), [`01a7d51`](https://github.com/mastra-ai/mastra/commit/01a7d513493d21562f677f98550f7ceb165ba78c)]:
|
|
27
|
+
- @mastra/core@1.27.0-alpha.1
|
|
28
|
+
|
|
3
29
|
## 1.16.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -385,6 +385,67 @@ ${gap}
|
|
|
385
385
|
result += withInlineDates.slice(lastIndex);
|
|
386
386
|
return result;
|
|
387
387
|
}
|
|
388
|
+
var MIN_TEMPORAL_GAP_MS = 10 * 60 * 1e3;
|
|
389
|
+
function formatTemporalGap(diffMs) {
|
|
390
|
+
if (diffMs < MIN_TEMPORAL_GAP_MS) return null;
|
|
391
|
+
const minute = 60 * 1e3;
|
|
392
|
+
const hour = 60 * minute;
|
|
393
|
+
const day = 24 * hour;
|
|
394
|
+
const week = 7 * day;
|
|
395
|
+
const month = 30 * day;
|
|
396
|
+
const year = 365 * day;
|
|
397
|
+
const formatUnit = (value, unit) => `${value} ${unit}${value === 1 ? "" : "s"}`;
|
|
398
|
+
if (diffMs < hour) {
|
|
399
|
+
const minutes = Math.max(1, Math.round(diffMs / minute));
|
|
400
|
+
return `${formatUnit(minutes, "minute")} later`;
|
|
401
|
+
}
|
|
402
|
+
const formatTwoUnits = (primaryMs, primaryUnit, secondaryMs, secondaryUnit) => {
|
|
403
|
+
const primary = Math.floor(diffMs / primaryMs);
|
|
404
|
+
const remainder = diffMs - primary * primaryMs;
|
|
405
|
+
const secondary = Math.floor(remainder / secondaryMs);
|
|
406
|
+
const parts = [formatUnit(primary, primaryUnit)];
|
|
407
|
+
if (secondary > 0) {
|
|
408
|
+
parts.push(formatUnit(secondary, secondaryUnit));
|
|
409
|
+
}
|
|
410
|
+
return `${parts.join(" ")} later`;
|
|
411
|
+
};
|
|
412
|
+
if (diffMs < day) {
|
|
413
|
+
return formatTwoUnits(hour, "hour", minute, "minute");
|
|
414
|
+
}
|
|
415
|
+
if (diffMs < week) {
|
|
416
|
+
return formatTwoUnits(day, "day", hour, "hour");
|
|
417
|
+
}
|
|
418
|
+
if (diffMs < month) {
|
|
419
|
+
return formatTwoUnits(week, "week", day, "day");
|
|
420
|
+
}
|
|
421
|
+
if (diffMs < year) {
|
|
422
|
+
return formatTwoUnits(month, "month", week, "week");
|
|
423
|
+
}
|
|
424
|
+
return formatTwoUnits(year, "year", month, "month");
|
|
425
|
+
}
|
|
426
|
+
function formatTemporalTimestamp(date) {
|
|
427
|
+
return date.toLocaleString("en-US", {
|
|
428
|
+
year: "numeric",
|
|
429
|
+
month: "2-digit",
|
|
430
|
+
day: "2-digit",
|
|
431
|
+
hour: "numeric",
|
|
432
|
+
minute: "2-digit",
|
|
433
|
+
hour12: true,
|
|
434
|
+
timeZoneName: "short"
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
function getMessagePartTimestamp(msg, position) {
|
|
438
|
+
const timestamps = msg.content?.parts?.map((part) => "createdAt" in part ? part.createdAt : void 0).filter((timestamp) => typeof timestamp === "number");
|
|
439
|
+
if (timestamps && timestamps.length > 0) {
|
|
440
|
+
const index = position === "first" ? 0 : timestamps.length - 1;
|
|
441
|
+
const timestamp = timestamps[index];
|
|
442
|
+
if (timestamp !== void 0) return timestamp;
|
|
443
|
+
}
|
|
444
|
+
return new Date(msg.createdAt).getTime();
|
|
445
|
+
}
|
|
446
|
+
function isTemporalGapMarker(msg) {
|
|
447
|
+
return msg.id.startsWith("__temporal_");
|
|
448
|
+
}
|
|
388
449
|
|
|
389
450
|
// src/processors/observational-memory/markers.ts
|
|
390
451
|
function createObservationStartMarker(params) {
|
|
@@ -2439,6 +2500,15 @@ function stripEphemeralAnchorIds(observations) {
|
|
|
2439
2500
|
}
|
|
2440
2501
|
return observations.replace(/(^|\n)([^\S\n]*)\[(O\d+(?:-N\d+)?)\][^\S\n]*/g, "$1$2");
|
|
2441
2502
|
}
|
|
2503
|
+
|
|
2504
|
+
// src/processors/observational-memory/string-utils.ts
|
|
2505
|
+
function safeSlice(str, end) {
|
|
2506
|
+
if (end <= 0) return "";
|
|
2507
|
+
if (end >= str.length) return str;
|
|
2508
|
+
const code = str.charCodeAt(end - 1);
|
|
2509
|
+
const safeEnd = code >= 55296 && code <= 56319 ? end - 1 : end;
|
|
2510
|
+
return str.slice(0, safeEnd);
|
|
2511
|
+
}
|
|
2442
2512
|
var ENCRYPTED_CONTENT_KEY = "encryptedContent";
|
|
2443
2513
|
var ENCRYPTED_CONTENT_REDACTION_THRESHOLD = 256;
|
|
2444
2514
|
var DEFAULT_OBSERVER_TOOL_RESULT_MAX_TOKENS = 1e4;
|
|
@@ -2504,7 +2574,7 @@ function truncateStringByTokens(text, maxTokens) {
|
|
|
2504
2574
|
return text;
|
|
2505
2575
|
}
|
|
2506
2576
|
const buildCandidate = (sliceEnd) => {
|
|
2507
|
-
const visible = text
|
|
2577
|
+
const visible = safeSlice(text, sliceEnd);
|
|
2508
2578
|
return `${visible}
|
|
2509
2579
|
... [truncated ~${totalTokens - tokenx.estimateTokenCount(visible)} tokens]`;
|
|
2510
2580
|
};
|
|
@@ -3058,8 +3128,11 @@ function formatObserverAttachmentPlaceholder(part, counter) {
|
|
|
3058
3128
|
return label ? `[${attachmentType} #${attachmentId}: ${label}]` : `[${attachmentType} #${attachmentId}]`;
|
|
3059
3129
|
}
|
|
3060
3130
|
function formatObserverPartLine(title, body, time, previousTime) {
|
|
3061
|
-
const timeLabel = time && time !== previousTime ? `
|
|
3062
|
-
|
|
3131
|
+
const timeLabel = time && time !== previousTime ? `(${time})` : "";
|
|
3132
|
+
if (!title) {
|
|
3133
|
+
return timeLabel ? `${timeLabel}: ${body}` : body;
|
|
3134
|
+
}
|
|
3135
|
+
return `${title}${timeLabel ? ` ${timeLabel}` : ""}: ${body}`;
|
|
3063
3136
|
}
|
|
3064
3137
|
function normalizeObserverCreatedAt(createdAt) {
|
|
3065
3138
|
if (createdAt instanceof Date) {
|
|
@@ -3095,6 +3168,16 @@ function formatObserverLines(lines, context = {}) {
|
|
|
3095
3168
|
context: { previousDate, previousTime }
|
|
3096
3169
|
};
|
|
3097
3170
|
}
|
|
3171
|
+
function getTemporalGapMarkerText(msg) {
|
|
3172
|
+
const metadata = typeof msg.content === "object" && msg.content && "metadata" in msg.content ? msg.content.metadata : void 0;
|
|
3173
|
+
if (metadata?.reminderType === "temporal-gap" && typeof metadata.gapText === "string") {
|
|
3174
|
+
return metadata.gapText;
|
|
3175
|
+
}
|
|
3176
|
+
if (typeof metadata?.systemReminder === "object" && metadata.systemReminder && "type" in metadata.systemReminder && metadata.systemReminder.type === "temporal-gap" && "gapText" in metadata.systemReminder && typeof metadata.systemReminder.gapText === "string") {
|
|
3177
|
+
return metadata.systemReminder.gapText;
|
|
3178
|
+
}
|
|
3179
|
+
return void 0;
|
|
3180
|
+
}
|
|
3098
3181
|
function formatObserverMessage(msg, counter, options) {
|
|
3099
3182
|
const maxLen = options?.maxPartLength;
|
|
3100
3183
|
const maxToolResultTokens = options?.maxToolResultTokens ?? DEFAULT_OBSERVER_TOOL_RESULT_MAX_TOKENS;
|
|
@@ -3102,6 +3185,7 @@ function formatObserverMessage(msg, counter, options) {
|
|
|
3102
3185
|
const attachments = [];
|
|
3103
3186
|
const messageCreatedAt = normalizeObserverCreatedAt(msg.createdAt);
|
|
3104
3187
|
let lines = [];
|
|
3188
|
+
const temporalGapText = isTemporalGapMarker(msg) ? getTemporalGapMarkerText(msg) : void 0;
|
|
3105
3189
|
const pushLine = (title, body, createdAt) => {
|
|
3106
3190
|
if (!body) {
|
|
3107
3191
|
return;
|
|
@@ -3114,7 +3198,9 @@ function formatObserverMessage(msg, counter, options) {
|
|
|
3114
3198
|
body
|
|
3115
3199
|
});
|
|
3116
3200
|
};
|
|
3117
|
-
if (
|
|
3201
|
+
if (temporalGapText) {
|
|
3202
|
+
pushLine("", temporalGapText, messageCreatedAt);
|
|
3203
|
+
} else if (typeof msg.content === "string") {
|
|
3118
3204
|
pushLine(role, maybeTruncate(msg.content, maxLen), messageCreatedAt);
|
|
3119
3205
|
} else if (msg.content?.parts && Array.isArray(msg.content.parts) && msg.content.parts.length > 0) {
|
|
3120
3206
|
msg.content.parts.forEach((part) => {
|
|
@@ -3215,8 +3301,8 @@ function buildObserverHistoryMessage(messages, options) {
|
|
|
3215
3301
|
}
|
|
3216
3302
|
function maybeTruncate(str, maxLen) {
|
|
3217
3303
|
if (!maxLen || str.length <= maxLen) return str;
|
|
3218
|
-
const truncated = str
|
|
3219
|
-
const remaining = str.length -
|
|
3304
|
+
const truncated = safeSlice(str, maxLen);
|
|
3305
|
+
const remaining = str.length - truncated.length;
|
|
3220
3306
|
return `${truncated}
|
|
3221
3307
|
... [truncated ${remaining} characters]`;
|
|
3222
3308
|
}
|
|
@@ -3520,7 +3606,7 @@ function sanitizeObservationLines(observations) {
|
|
|
3520
3606
|
let changed = false;
|
|
3521
3607
|
for (let i = 0; i < lines.length; i++) {
|
|
3522
3608
|
if (lines[i].length > MAX_OBSERVATION_LINE_CHARS) {
|
|
3523
|
-
lines[i] = lines[i]
|
|
3609
|
+
lines[i] = safeSlice(lines[i], MAX_OBSERVATION_LINE_CHARS) + " \u2026 [truncated]";
|
|
3524
3610
|
changed = true;
|
|
3525
3611
|
}
|
|
3526
3612
|
}
|
|
@@ -8859,6 +8945,110 @@ ${grouped}` : grouped;
|
|
|
8859
8945
|
});
|
|
8860
8946
|
}
|
|
8861
8947
|
};
|
|
8948
|
+
|
|
8949
|
+
// src/processors/observational-memory/temporal-markers.ts
|
|
8950
|
+
var TEMPORAL_GAP_REMINDER_TYPE = "temporal-gap";
|
|
8951
|
+
function getTemporalGapReminderText(gapText, timestamp) {
|
|
8952
|
+
return `${gapText} \u2014 ${formatTemporalTimestamp(new Date(timestamp))}`;
|
|
8953
|
+
}
|
|
8954
|
+
function getTemporalGapReminderMetadata(message, gapText, gapMs, timestamp) {
|
|
8955
|
+
const formattedTimestamp = formatTemporalTimestamp(new Date(timestamp));
|
|
8956
|
+
return {
|
|
8957
|
+
reminderType: TEMPORAL_GAP_REMINDER_TYPE,
|
|
8958
|
+
gapText,
|
|
8959
|
+
gapMs,
|
|
8960
|
+
timestamp: formattedTimestamp,
|
|
8961
|
+
timestampMs: timestamp,
|
|
8962
|
+
precedesMessageId: message.id,
|
|
8963
|
+
systemReminder: {
|
|
8964
|
+
type: TEMPORAL_GAP_REMINDER_TYPE,
|
|
8965
|
+
message: getTemporalGapReminderText(gapText, timestamp),
|
|
8966
|
+
gapText,
|
|
8967
|
+
gapMs,
|
|
8968
|
+
timestamp: formattedTimestamp,
|
|
8969
|
+
timestampMs: timestamp,
|
|
8970
|
+
precedesMessageId: message.id
|
|
8971
|
+
}
|
|
8972
|
+
};
|
|
8973
|
+
}
|
|
8974
|
+
function isTemporalGapMarkerForMessage(message, targetMessageId) {
|
|
8975
|
+
if (!isTemporalGapMarker(message)) {
|
|
8976
|
+
return false;
|
|
8977
|
+
}
|
|
8978
|
+
const metadata = message.content.metadata;
|
|
8979
|
+
if (metadata?.precedesMessageId === targetMessageId) {
|
|
8980
|
+
return true;
|
|
8981
|
+
}
|
|
8982
|
+
return metadata?.systemReminder?.type === TEMPORAL_GAP_REMINDER_TYPE && metadata.systemReminder.precedesMessageId === targetMessageId;
|
|
8983
|
+
}
|
|
8984
|
+
function createTemporalGapMarker(message, gapText, gapMs, timestamp) {
|
|
8985
|
+
const metadata = getTemporalGapReminderMetadata(message, gapText, gapMs, timestamp);
|
|
8986
|
+
return {
|
|
8987
|
+
id: `__temporal_gap_${crypto.randomUUID()}`,
|
|
8988
|
+
role: "user",
|
|
8989
|
+
createdAt: new Date(timestamp - 1),
|
|
8990
|
+
threadId: message.threadId,
|
|
8991
|
+
resourceId: message.resourceId,
|
|
8992
|
+
content: {
|
|
8993
|
+
format: 2,
|
|
8994
|
+
parts: [
|
|
8995
|
+
{
|
|
8996
|
+
type: "text",
|
|
8997
|
+
text: `<system-reminder type="${TEMPORAL_GAP_REMINDER_TYPE}" precedesMessageId="${message.id}">${getTemporalGapReminderText(gapText, timestamp)}</system-reminder>`
|
|
8998
|
+
}
|
|
8999
|
+
],
|
|
9000
|
+
metadata
|
|
9001
|
+
}
|
|
9002
|
+
};
|
|
9003
|
+
}
|
|
9004
|
+
async function insertTemporalGapMarkers({
|
|
9005
|
+
messageList,
|
|
9006
|
+
writer
|
|
9007
|
+
}) {
|
|
9008
|
+
const inputMessages = messageList.get.input.db().filter((message) => Boolean(message));
|
|
9009
|
+
const latestInputMessage = inputMessages.at(-1);
|
|
9010
|
+
if (!latestInputMessage || isTemporalGapMarker(latestInputMessage)) {
|
|
9011
|
+
return;
|
|
9012
|
+
}
|
|
9013
|
+
const allMessages = messageList.get.all.db().filter((message) => Boolean(message));
|
|
9014
|
+
const latestInputIndex = allMessages.findIndex((message) => message.id === latestInputMessage.id);
|
|
9015
|
+
if (latestInputIndex <= 0) {
|
|
9016
|
+
return;
|
|
9017
|
+
}
|
|
9018
|
+
if (allMessages.some((message) => isTemporalGapMarkerForMessage(message, latestInputMessage.id))) {
|
|
9019
|
+
return;
|
|
9020
|
+
}
|
|
9021
|
+
let previousNonMarker;
|
|
9022
|
+
for (let index = latestInputIndex - 1; index >= 0; index--) {
|
|
9023
|
+
const candidate = allMessages[index];
|
|
9024
|
+
if (candidate && !isTemporalGapMarker(candidate)) {
|
|
9025
|
+
previousNonMarker = candidate;
|
|
9026
|
+
break;
|
|
9027
|
+
}
|
|
9028
|
+
}
|
|
9029
|
+
if (!previousNonMarker) {
|
|
9030
|
+
return;
|
|
9031
|
+
}
|
|
9032
|
+
const timestamp = getMessagePartTimestamp(latestInputMessage, "first");
|
|
9033
|
+
const gapMs = timestamp - getMessagePartTimestamp(previousNonMarker, "last");
|
|
9034
|
+
const gapText = formatTemporalGap(gapMs);
|
|
9035
|
+
if (!gapText) {
|
|
9036
|
+
return;
|
|
9037
|
+
}
|
|
9038
|
+
const reminderMetadata = getTemporalGapReminderMetadata(latestInputMessage, gapText, gapMs, timestamp);
|
|
9039
|
+
await writer?.custom({
|
|
9040
|
+
type: "data-system-reminder",
|
|
9041
|
+
data: {
|
|
9042
|
+
message: getTemporalGapReminderText(gapText, timestamp),
|
|
9043
|
+
...reminderMetadata
|
|
9044
|
+
},
|
|
9045
|
+
transient: true
|
|
9046
|
+
});
|
|
9047
|
+
const marker = createTemporalGapMarker(latestInputMessage, gapText, gapMs, timestamp);
|
|
9048
|
+
messageList.add(marker, "input");
|
|
9049
|
+
}
|
|
9050
|
+
|
|
9051
|
+
// src/processors/observational-memory/processor.ts
|
|
8862
9052
|
function getOmObservabilityContext(args) {
|
|
8863
9053
|
if (!args.tracing || !args.tracingContext || !args.loggerVNext || !args.metrics) {
|
|
8864
9054
|
return void 0;
|
|
@@ -8881,11 +9071,14 @@ var ObservationalMemoryProcessor = class {
|
|
|
8881
9071
|
engine;
|
|
8882
9072
|
/** Memory instance for loading context. */
|
|
8883
9073
|
memory;
|
|
9074
|
+
/** Whether temporal-gap reminder markers should be inserted. */
|
|
9075
|
+
temporalMarkers;
|
|
8884
9076
|
/** Active turn — created on first processInputStep, ended on processOutputResult. */
|
|
8885
9077
|
turn;
|
|
8886
|
-
constructor(engine, memory) {
|
|
9078
|
+
constructor(engine, memory, options) {
|
|
8887
9079
|
this.engine = engine;
|
|
8888
9080
|
this.memory = memory;
|
|
9081
|
+
this.temporalMarkers = options?.temporalMarkers ?? false;
|
|
8889
9082
|
}
|
|
8890
9083
|
// ─── Processor lifecycle hooks ──────────────────────────────────────────
|
|
8891
9084
|
async processInputStep(args) {
|
|
@@ -8944,6 +9137,9 @@ var ObservationalMemoryProcessor = class {
|
|
|
8944
9137
|
this.turn.writer = writer;
|
|
8945
9138
|
this.turn.requestContext = requestContext;
|
|
8946
9139
|
await this.turn.start(this.memory);
|
|
9140
|
+
if (stepNumber === 0 && this.temporalMarkers) {
|
|
9141
|
+
await insertTemporalGapMarkers({ messageList, writer });
|
|
9142
|
+
}
|
|
8947
9143
|
state.__omTurn = this.turn;
|
|
8948
9144
|
}
|
|
8949
9145
|
const observabilityContext = getOmObservabilityContext(args);
|
|
@@ -9108,5 +9304,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
9108
9304
|
exports.stripObservationGroups = stripObservationGroups;
|
|
9109
9305
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
9110
9306
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
9111
|
-
//# sourceMappingURL=chunk-
|
|
9112
|
-
//# sourceMappingURL=chunk-
|
|
9307
|
+
//# sourceMappingURL=chunk-5MTY2UYL.cjs.map
|
|
9308
|
+
//# sourceMappingURL=chunk-5MTY2UYL.cjs.map
|