@mastra/memory 1.15.0-alpha.2 → 1.15.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 +27 -0
- package/dist/{chunk-ERPFT635.js → chunk-42AZEBIK.js} +25 -9
- package/dist/chunk-42AZEBIK.js.map +1 -0
- package/dist/{chunk-LAYKIEDY.cjs → chunk-WNLRMAHY.cjs} +25 -9
- package/dist/chunk-WNLRMAHY.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +29 -29
- package/dist/index.cjs +13 -13
- package/dist/index.js +4 -4
- package/dist/{observational-memory-YLDJZ45Q.cjs → observational-memory-3RE2HCRV.cjs} +26 -26
- package/dist/{observational-memory-YLDJZ45Q.cjs.map → observational-memory-3RE2HCRV.cjs.map} +1 -1
- package/dist/{observational-memory-SIX6STZE.js → observational-memory-MBL257AG.js} +3 -3
- package/dist/{observational-memory-SIX6STZE.js.map → observational-memory-MBL257AG.js.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/reflector-runner.d.ts +7 -0
- package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-ERPFT635.js.map +0 -1
- package/dist/chunk-LAYKIEDY.cjs.map +0 -1
|
@@ -4131,13 +4131,29 @@ var ReflectorRunner = class {
|
|
|
4131
4131
|
model
|
|
4132
4132
|
});
|
|
4133
4133
|
}
|
|
4134
|
-
getObservationMarkerConfig() {
|
|
4134
|
+
getObservationMarkerConfig(record) {
|
|
4135
4135
|
return {
|
|
4136
4136
|
messageTokens: getMaxThreshold(this.observationConfig.messageTokens),
|
|
4137
|
-
observationTokens: getMaxThreshold(
|
|
4137
|
+
observationTokens: getMaxThreshold(
|
|
4138
|
+
record ? this.getEffectiveReflectionTokens(record) : this.reflectionConfig.observationTokens
|
|
4139
|
+
),
|
|
4138
4140
|
scope: this.scope
|
|
4139
4141
|
};
|
|
4140
4142
|
}
|
|
4143
|
+
/**
|
|
4144
|
+
* Resolve the effective reflection observationTokens for a record.
|
|
4145
|
+
* Only explicit per-record overrides (stored under `_overrides`) win;
|
|
4146
|
+
* the initial config snapshot is ignored so instance-level changes
|
|
4147
|
+
* still take effect for existing records.
|
|
4148
|
+
*/
|
|
4149
|
+
getEffectiveReflectionTokens(record) {
|
|
4150
|
+
const overrides = record.config?._overrides;
|
|
4151
|
+
const recordTokens = overrides?.reflection?.observationTokens;
|
|
4152
|
+
if (recordTokens) {
|
|
4153
|
+
return recordTokens;
|
|
4154
|
+
}
|
|
4155
|
+
return this.reflectionConfig.observationTokens;
|
|
4156
|
+
}
|
|
4141
4157
|
/**
|
|
4142
4158
|
* Call the Reflector agent with escalating compression levels.
|
|
4143
4159
|
*/
|
|
@@ -4326,7 +4342,7 @@ var ReflectorRunner = class {
|
|
|
4326
4342
|
const freshRecord = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
|
|
4327
4343
|
const currentRecord = freshRecord ?? record;
|
|
4328
4344
|
const observationTokens = currentRecord.observationTokenCount ?? 0;
|
|
4329
|
-
const reflectThreshold = getMaxThreshold(this.
|
|
4345
|
+
const reflectThreshold = getMaxThreshold(this.getEffectiveReflectionTokens(currentRecord));
|
|
4330
4346
|
const bufferActivation = this.reflectionConfig.bufferActivation ?? 0.5;
|
|
4331
4347
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4332
4348
|
const cycleId = `reflect-buf-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
|
|
@@ -4355,7 +4371,7 @@ var ReflectorRunner = class {
|
|
|
4355
4371
|
recordId: record.id,
|
|
4356
4372
|
threadId: record.threadId ?? "",
|
|
4357
4373
|
threadIds: record.threadId ? [record.threadId] : [],
|
|
4358
|
-
config: this.getObservationMarkerConfig()
|
|
4374
|
+
config: this.getObservationMarkerConfig(currentRecord)
|
|
4359
4375
|
});
|
|
4360
4376
|
void writer.custom(startMarker).catch(() => {
|
|
4361
4377
|
});
|
|
@@ -4467,7 +4483,7 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
|
|
|
4467
4483
|
threadId: freshRecord.threadId ?? "",
|
|
4468
4484
|
generationCount: afterRecord?.generationCount ?? freshRecord.generationCount ?? 0,
|
|
4469
4485
|
observations: afterRecord?.activeObservations,
|
|
4470
|
-
config: this.getObservationMarkerConfig()
|
|
4486
|
+
config: this.getObservationMarkerConfig(freshRecord)
|
|
4471
4487
|
});
|
|
4472
4488
|
void writer.custom(activationMarker).catch(() => {
|
|
4473
4489
|
});
|
|
@@ -4498,7 +4514,7 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
|
|
|
4498
4514
|
observabilityContext
|
|
4499
4515
|
} = opts;
|
|
4500
4516
|
const lockKey = this.buffering.getLockKey(record.threadId, record.resourceId);
|
|
4501
|
-
const reflectThreshold = getMaxThreshold(this.
|
|
4517
|
+
const reflectThreshold = getMaxThreshold(this.getEffectiveReflectionTokens(record));
|
|
4502
4518
|
if (this.buffering.isAsyncReflectionEnabled() && observationTokens < reflectThreshold) {
|
|
4503
4519
|
const shouldTrigger = (() => {
|
|
4504
4520
|
if (!this.buffering.isAsyncReflectionEnabled()) return false;
|
|
@@ -4577,7 +4593,7 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
|
|
|
4577
4593
|
recordId: record.id,
|
|
4578
4594
|
threadId,
|
|
4579
4595
|
threadIds: [threadId],
|
|
4580
|
-
config: this.getObservationMarkerConfig()
|
|
4596
|
+
config: this.getObservationMarkerConfig(record)
|
|
4581
4597
|
});
|
|
4582
4598
|
await writer.custom(startMarker).catch(() => {
|
|
4583
4599
|
});
|
|
@@ -8850,5 +8866,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
8850
8866
|
exports.stripObservationGroups = stripObservationGroups;
|
|
8851
8867
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
8852
8868
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
8853
|
-
//# sourceMappingURL=chunk-
|
|
8854
|
-
//# sourceMappingURL=chunk-
|
|
8869
|
+
//# sourceMappingURL=chunk-WNLRMAHY.cjs.map
|
|
8870
|
+
//# sourceMappingURL=chunk-WNLRMAHY.cjs.map
|