@mastra/memory 1.20.1-alpha.1 → 1.20.2-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 +42 -0
- package/dist/chunk-43FJOLKM.cjs +108 -0
- package/dist/chunk-43FJOLKM.cjs.map +1 -0
- package/dist/{chunk-3Q3LOVQP.cjs → chunk-D4J4XPGM.cjs} +2 -9
- package/dist/chunk-D4J4XPGM.cjs.map +1 -0
- package/dist/{chunk-VKRZ3O5X.js → chunk-LSJJAJAF.js} +3 -9
- package/dist/chunk-LSJJAJAF.js.map +1 -0
- package/dist/{chunk-P4BYW7GY.cjs → chunk-PTCSCRB6.cjs} +27 -27
- package/dist/{chunk-P4BYW7GY.cjs.map → chunk-PTCSCRB6.cjs.map} +1 -1
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-KMJQDCCZ.js → chunk-SXFOZU7K.js} +3 -3
- package/dist/{chunk-KMJQDCCZ.js.map → chunk-SXFOZU7K.js.map} +1 -1
- package/dist/chunk-WCGXQIEN.js +103 -0
- package/dist/chunk-WCGXQIEN.js.map +1 -0
- package/dist/constants-DVRTNEGY.js +3 -0
- package/dist/{constants-SPS7MR4D.js.map → constants-DVRTNEGY.js.map} +1 -1
- package/dist/{constants-D6W7OWCP.cjs → constants-JS5SS7GS.cjs} +8 -8
- package/dist/{constants-D6W7OWCP.cjs.map → constants-JS5SS7GS.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +43 -30
- package/dist/docs/references/docs-agents-agent-approval.md +1 -1
- package/dist/docs/references/docs-agents-background-tasks.md +2 -2
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-agents-supervisor-agents.md +2 -2
- package/dist/docs/references/docs-memory-memory-processors.md +6 -6
- package/dist/docs/references/docs-memory-multi-user-threads.md +2 -2
- package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
- package/dist/docs/references/docs-memory-storage.md +2 -1
- package/dist/docs/references/docs-memory-working-memory.md +28 -1
- package/dist/docs/references/reference-memory-memory-class.md +3 -3
- package/dist/docs/references/reference-memory-observational-memory.md +4 -4
- package/dist/docs/references/reference-processors-token-limiter-processor.md +3 -3
- package/dist/docs/references/reference-storage-dsql.md +1 -1
- package/dist/docs/references/reference-storage-libsql.md +6 -0
- package/dist/docs/references/reference-storage-mongodb.md +4 -1
- package/dist/docs/references/reference-storage-postgresql.md +4 -1
- package/dist/docs/references/reference-storage-redis.md +1 -1
- package/dist/docs/references/reference-storage-upstash.md +1 -1
- package/dist/docs/references/reference-vectors-libsql.md +1 -1
- package/dist/docs/references/reference-vectors-mongodb.md +1 -1
- package/dist/docs/references/reference-vectors-pg.md +1 -1
- package/dist/docs/references/reference-vectors-upstash.md +1 -1
- package/dist/index.cjs +222 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +184 -72
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-TJFOX3YN.js → observational-memory-G52HNRHE.js} +4 -4
- package/dist/{observational-memory-TJFOX3YN.js.map → observational-memory-G52HNRHE.js.map} +1 -1
- package/dist/{observational-memory-CDLGZL67.cjs → observational-memory-SZF7GKTS.cjs} +31 -31
- package/dist/{observational-memory-CDLGZL67.cjs.map → observational-memory-SZF7GKTS.cjs.map} +1 -1
- package/dist/processors/index.cjs +29 -29
- package/dist/processors/index.js +2 -2
- package/dist/processors/observational-memory/index.d.ts +1 -1
- package/dist/processors/observational-memory/index.d.ts.map +1 -1
- package/dist/processors/working-memory-state/index.d.ts +2 -0
- package/dist/processors/working-memory-state/index.d.ts.map +1 -0
- package/dist/processors/working-memory-state/processor.d.ts +53 -0
- package/dist/processors/working-memory-state/processor.d.ts.map +1 -0
- package/dist/tools/working-memory.d.ts +22 -0
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/dist/working-memory-state-J7ASTNXX.js +3 -0
- package/dist/working-memory-state-J7ASTNXX.js.map +1 -0
- package/dist/working-memory-state-Y2SCKCNU.cjs +24 -0
- package/dist/working-memory-state-Y2SCKCNU.cjs.map +1 -0
- package/package.json +9 -8
- package/dist/chunk-3Q3LOVQP.cjs.map +0 -1
- package/dist/chunk-VKRZ3O5X.js.map +0 -1
- package/dist/constants-SPS7MR4D.js +0 -3
package/dist/index.d.ts
CHANGED
|
@@ -254,6 +254,7 @@ export declare class Memory extends MastraMemory {
|
|
|
254
254
|
data: string | null;
|
|
255
255
|
}): string;
|
|
256
256
|
private isVNextWorkingMemoryConfig;
|
|
257
|
+
private assertWorkingMemoryStateSignalsCompatibility;
|
|
257
258
|
private getObservationEmbeddingIndexName;
|
|
258
259
|
private createObservationEmbeddingIndex;
|
|
259
260
|
/**
|
|
@@ -515,8 +516,15 @@ export declare class Memory extends MastraMemory {
|
|
|
515
516
|
* in the user's configured processors.
|
|
516
517
|
*/
|
|
517
518
|
private createOMProcessor;
|
|
519
|
+
/**
|
|
520
|
+
* Creates a WorkingMemoryStateProcessor when working memory is enabled and the
|
|
521
|
+
* `useStateSignals` opt-in is set. Returns null otherwise or if the processor
|
|
522
|
+
* is already present in the user's configured processors.
|
|
523
|
+
*/
|
|
524
|
+
private createWorkingMemoryStateProcessor;
|
|
518
525
|
}
|
|
519
526
|
export { SemanticRecall, WorkingMemory, MessageHistory } from '@mastra/core/processors';
|
|
520
527
|
export type { StorageCloneThreadInput, StorageCloneThreadOutput, ThreadCloneMetadata } from '@mastra/core/storage';
|
|
521
528
|
export { getObservationsAsOf } from './processors/observational-memory/index.js';
|
|
529
|
+
export { WorkingMemoryStateProcessor, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, } from './processors/working-memory-state/index.js';
|
|
522
530
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAA6B,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAExG,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAq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AE,uBAAuB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,mCAAmC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { truncateStringByTokens, resolveToolResultValue, formatToolResultForObserver } from './chunk-
|
|
2
|
-
export { ModelByInputTokens, getObservationsAsOf } from './chunk-
|
|
3
|
-
|
|
1
|
+
import { truncateStringByTokens, resolveToolResultValue, formatToolResultForObserver } from './chunk-SXFOZU7K.js';
|
|
2
|
+
export { ModelByInputTokens, getObservationsAsOf } from './chunk-SXFOZU7K.js';
|
|
3
|
+
export { WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemoryStateProcessor } from './chunk-WCGXQIEN.js';
|
|
4
|
+
import { __export } from './chunk-PZ5AY32C.js';
|
|
4
5
|
import { MessageList } from '@mastra/core/agent';
|
|
5
6
|
import { coreFeatures } from '@mastra/core/features';
|
|
6
7
|
import { MastraMemory } from '@mastra/core/memory';
|
|
@@ -22912,7 +22913,7 @@ var ZodFirstPartyTypeKind3;
|
|
|
22912
22913
|
ZodFirstPartyTypeKind4["ZodReadonly"] = "ZodReadonly";
|
|
22913
22914
|
})(ZodFirstPartyTypeKind3 || (ZodFirstPartyTypeKind3 = {}));
|
|
22914
22915
|
|
|
22915
|
-
// ../_vendored/ai_v5/dist/chunk-
|
|
22916
|
+
// ../_vendored/ai_v5/dist/chunk-FJXUDWCB.js
|
|
22916
22917
|
var marker17 = "vercel.ai.error";
|
|
22917
22918
|
var symbol18 = Symbol.for(marker17);
|
|
22918
22919
|
var _a19;
|
|
@@ -23091,6 +23092,9 @@ var ParseError = class extends Error {
|
|
|
23091
23092
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
23092
23093
|
}
|
|
23093
23094
|
};
|
|
23095
|
+
var LF = 10;
|
|
23096
|
+
var CR = 13;
|
|
23097
|
+
var SPACE = 32;
|
|
23094
23098
|
function noop(_arg) {
|
|
23095
23099
|
}
|
|
23096
23100
|
function createParser(callbacks) {
|
|
@@ -23098,39 +23102,109 @@ function createParser(callbacks) {
|
|
|
23098
23102
|
throw new TypeError(
|
|
23099
23103
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
23100
23104
|
);
|
|
23101
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
23102
|
-
let
|
|
23103
|
-
function feed(
|
|
23104
|
-
|
|
23105
|
-
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
|
|
23110
|
-
|
|
23105
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
|
|
23106
|
+
let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
|
|
23107
|
+
function feed(chunk) {
|
|
23108
|
+
if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
|
|
23109
|
+
const trailing2 = processLines(chunk);
|
|
23110
|
+
trailing2 !== "" && pendingFragments.push(trailing2);
|
|
23111
|
+
return;
|
|
23112
|
+
}
|
|
23113
|
+
if (chunk.indexOf(`
|
|
23114
|
+
`) === -1 && chunk.indexOf("\r") === -1) {
|
|
23115
|
+
pendingFragments.push(chunk);
|
|
23116
|
+
return;
|
|
23117
|
+
}
|
|
23118
|
+
pendingFragments.push(chunk);
|
|
23119
|
+
const input = pendingFragments.join("");
|
|
23120
|
+
pendingFragments.length = 0;
|
|
23121
|
+
const trailing = processLines(input);
|
|
23122
|
+
trailing !== "" && pendingFragments.push(trailing);
|
|
23123
|
+
}
|
|
23124
|
+
function processLines(chunk) {
|
|
23125
|
+
let searchIndex = 0;
|
|
23126
|
+
if (chunk.indexOf("\r") === -1) {
|
|
23127
|
+
let lfIndex = chunk.indexOf(`
|
|
23128
|
+
`, searchIndex);
|
|
23129
|
+
for (; lfIndex !== -1; ) {
|
|
23130
|
+
if (searchIndex === lfIndex) {
|
|
23131
|
+
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
23132
|
+
`, searchIndex);
|
|
23133
|
+
continue;
|
|
23134
|
+
}
|
|
23135
|
+
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
23136
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
23137
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
23138
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
23139
|
+
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
23140
|
+
`, searchIndex);
|
|
23141
|
+
continue;
|
|
23142
|
+
}
|
|
23143
|
+
data = dataLines === 0 ? value : `${data}
|
|
23144
|
+
${value}`, dataLines++;
|
|
23145
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
23146
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
23147
|
+
lfIndex
|
|
23148
|
+
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
23149
|
+
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
23150
|
+
`, searchIndex);
|
|
23151
|
+
}
|
|
23152
|
+
return chunk.slice(searchIndex);
|
|
23153
|
+
}
|
|
23154
|
+
for (; searchIndex < chunk.length; ) {
|
|
23155
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
23156
|
+
`, searchIndex);
|
|
23157
|
+
let lineEnd = -1;
|
|
23158
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
23159
|
+
break;
|
|
23160
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
23161
|
+
}
|
|
23162
|
+
return chunk.slice(searchIndex);
|
|
23163
|
+
}
|
|
23164
|
+
function parseLine(chunk, start, end) {
|
|
23165
|
+
if (start === end) {
|
|
23111
23166
|
dispatchEvent();
|
|
23112
23167
|
return;
|
|
23113
23168
|
}
|
|
23114
|
-
|
|
23115
|
-
|
|
23169
|
+
const firstCharCode = chunk.charCodeAt(start);
|
|
23170
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
23171
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
23172
|
+
data = dataLines === 0 ? value2 : `${data}
|
|
23173
|
+
${value2}`, dataLines++;
|
|
23116
23174
|
return;
|
|
23117
23175
|
}
|
|
23118
|
-
|
|
23119
|
-
|
|
23120
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
23121
|
-
processField(field, value, line);
|
|
23176
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
23177
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
23122
23178
|
return;
|
|
23123
23179
|
}
|
|
23124
|
-
|
|
23180
|
+
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
23181
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
23182
|
+
id = value2.includes("\0") ? void 0 : value2;
|
|
23183
|
+
return;
|
|
23184
|
+
}
|
|
23185
|
+
if (firstCharCode === 58) {
|
|
23186
|
+
if (onComment) {
|
|
23187
|
+
const line2 = chunk.slice(start, end);
|
|
23188
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
23189
|
+
}
|
|
23190
|
+
return;
|
|
23191
|
+
}
|
|
23192
|
+
const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
|
|
23193
|
+
if (fieldSeparatorIndex === -1) {
|
|
23194
|
+
processField(line, "", line);
|
|
23195
|
+
return;
|
|
23196
|
+
}
|
|
23197
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
23198
|
+
processField(field, value, line);
|
|
23125
23199
|
}
|
|
23126
23200
|
function processField(field, value, line) {
|
|
23127
23201
|
switch (field) {
|
|
23128
23202
|
case "event":
|
|
23129
|
-
eventType = value;
|
|
23203
|
+
eventType = value || void 0;
|
|
23130
23204
|
break;
|
|
23131
23205
|
case "data":
|
|
23132
|
-
data = `${data}
|
|
23133
|
-
|
|
23206
|
+
data = dataLines === 0 ? value : `${data}
|
|
23207
|
+
${value}`, dataLines++;
|
|
23134
23208
|
break;
|
|
23135
23209
|
case "id":
|
|
23136
23210
|
id = value.includes("\0") ? void 0 : value;
|
|
@@ -23155,37 +23229,26 @@ function createParser(callbacks) {
|
|
|
23155
23229
|
}
|
|
23156
23230
|
}
|
|
23157
23231
|
function dispatchEvent() {
|
|
23158
|
-
|
|
23232
|
+
dataLines > 0 && onEvent({
|
|
23159
23233
|
id,
|
|
23160
|
-
event: eventType
|
|
23161
|
-
|
|
23162
|
-
|
|
23163
|
-
data: data.endsWith(`
|
|
23164
|
-
`) ? data.slice(0, -1) : data
|
|
23165
|
-
}), id = void 0, data = "", eventType = "";
|
|
23234
|
+
event: eventType,
|
|
23235
|
+
data
|
|
23236
|
+
}), id = void 0, data = "", dataLines = 0, eventType = void 0;
|
|
23166
23237
|
}
|
|
23167
23238
|
function reset(options = {}) {
|
|
23168
|
-
|
|
23239
|
+
if (options.consume && pendingFragments.length > 0) {
|
|
23240
|
+
const incompleteLine = pendingFragments.join("");
|
|
23241
|
+
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
23242
|
+
}
|
|
23243
|
+
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
|
|
23169
23244
|
}
|
|
23170
23245
|
return { feed, reset };
|
|
23171
23246
|
}
|
|
23172
|
-
function
|
|
23173
|
-
|
|
23174
|
-
|
|
23175
|
-
|
|
23176
|
-
|
|
23177
|
-
`, searchIndex);
|
|
23178
|
-
let lineEnd = -1;
|
|
23179
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
23180
|
-
incompleteLine = chunk.slice(searchIndex);
|
|
23181
|
-
break;
|
|
23182
|
-
} else {
|
|
23183
|
-
const line = chunk.slice(searchIndex, lineEnd);
|
|
23184
|
-
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
23185
|
-
` && searchIndex++;
|
|
23186
|
-
}
|
|
23187
|
-
}
|
|
23188
|
-
return [lines, incompleteLine];
|
|
23247
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
23248
|
+
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
23249
|
+
}
|
|
23250
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
23251
|
+
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
23189
23252
|
}
|
|
23190
23253
|
var EventSourceParserStream = class extends TransformStream {
|
|
23191
23254
|
constructor({ onError, onRetry, onComment } = {}) {
|
|
@@ -39606,9 +39669,9 @@ var ParseError2 = class extends Error {
|
|
|
39606
39669
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
39607
39670
|
}
|
|
39608
39671
|
};
|
|
39609
|
-
var
|
|
39610
|
-
var
|
|
39611
|
-
var
|
|
39672
|
+
var LF2 = 10;
|
|
39673
|
+
var CR2 = 13;
|
|
39674
|
+
var SPACE2 = 32;
|
|
39612
39675
|
function noop2(_arg) {
|
|
39613
39676
|
}
|
|
39614
39677
|
function createParser2(callbacks) {
|
|
@@ -39647,17 +39710,17 @@ function createParser2(callbacks) {
|
|
|
39647
39710
|
continue;
|
|
39648
39711
|
}
|
|
39649
39712
|
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
39650
|
-
if (
|
|
39651
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) ===
|
|
39652
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) ===
|
|
39713
|
+
if (isDataPrefix2(chunk, searchIndex, firstCharCode)) {
|
|
39714
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE2 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
39715
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF2) {
|
|
39653
39716
|
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
39654
39717
|
`, searchIndex);
|
|
39655
39718
|
continue;
|
|
39656
39719
|
}
|
|
39657
39720
|
data = dataLines === 0 ? value : `${data}
|
|
39658
39721
|
${value}`, dataLines++;
|
|
39659
|
-
} else
|
|
39660
|
-
chunk.charCodeAt(searchIndex + 6) ===
|
|
39722
|
+
} else isEventPrefix2(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
39723
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE2 ? searchIndex + 7 : searchIndex + 6,
|
|
39661
39724
|
lfIndex
|
|
39662
39725
|
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
39663
39726
|
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
@@ -39671,7 +39734,7 @@ ${value}`, dataLines++;
|
|
|
39671
39734
|
let lineEnd = -1;
|
|
39672
39735
|
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
39673
39736
|
break;
|
|
39674
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) ===
|
|
39737
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR2 && chunk.charCodeAt(searchIndex) === LF2 && searchIndex++;
|
|
39675
39738
|
}
|
|
39676
39739
|
return chunk.slice(searchIndex);
|
|
39677
39740
|
}
|
|
@@ -39681,25 +39744,25 @@ ${value}`, dataLines++;
|
|
|
39681
39744
|
return;
|
|
39682
39745
|
}
|
|
39683
39746
|
const firstCharCode = chunk.charCodeAt(start);
|
|
39684
|
-
if (
|
|
39685
|
-
const valueStart = chunk.charCodeAt(start + 5) ===
|
|
39747
|
+
if (isDataPrefix2(chunk, start, firstCharCode)) {
|
|
39748
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE2 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
39686
39749
|
data = dataLines === 0 ? value2 : `${data}
|
|
39687
39750
|
${value2}`, dataLines++;
|
|
39688
39751
|
return;
|
|
39689
39752
|
}
|
|
39690
|
-
if (
|
|
39691
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) ===
|
|
39753
|
+
if (isEventPrefix2(chunk, start, firstCharCode)) {
|
|
39754
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE2 ? start + 7 : start + 6, end) || void 0;
|
|
39692
39755
|
return;
|
|
39693
39756
|
}
|
|
39694
39757
|
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
39695
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) ===
|
|
39758
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE2 ? start + 4 : start + 3, end);
|
|
39696
39759
|
id = value2.includes("\0") ? void 0 : value2;
|
|
39697
39760
|
return;
|
|
39698
39761
|
}
|
|
39699
39762
|
if (firstCharCode === 58) {
|
|
39700
39763
|
if (onComment) {
|
|
39701
39764
|
const line2 = chunk.slice(start, end);
|
|
39702
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) ===
|
|
39765
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE2 ? 2 : 1));
|
|
39703
39766
|
}
|
|
39704
39767
|
return;
|
|
39705
39768
|
}
|
|
@@ -39708,7 +39771,7 @@ ${value2}`, dataLines++;
|
|
|
39708
39771
|
processField(line, "", line);
|
|
39709
39772
|
return;
|
|
39710
39773
|
}
|
|
39711
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) ===
|
|
39774
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE2 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
39712
39775
|
processField(field, value, line);
|
|
39713
39776
|
}
|
|
39714
39777
|
function processField(field, value, line) {
|
|
@@ -39758,10 +39821,10 @@ ${value}`, dataLines++;
|
|
|
39758
39821
|
}
|
|
39759
39822
|
return { feed, reset };
|
|
39760
39823
|
}
|
|
39761
|
-
function
|
|
39824
|
+
function isDataPrefix2(chunk, i, firstCharCode) {
|
|
39762
39825
|
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
39763
39826
|
}
|
|
39764
|
-
function
|
|
39827
|
+
function isEventPrefix2(chunk, i, firstCharCode) {
|
|
39765
39828
|
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
39766
39829
|
}
|
|
39767
39830
|
var EventSourceParserStream2 = class extends TransformStream {
|
|
@@ -46733,6 +46796,8 @@ var recallTool = (_memoryConfig, options) => {
|
|
|
46733
46796
|
}
|
|
46734
46797
|
});
|
|
46735
46798
|
};
|
|
46799
|
+
var UPDATE_WORKING_MEMORY_TOOL_NAME = "updateWorkingMemory";
|
|
46800
|
+
var SET_WORKING_MEMORY_TOOL_NAME = "setWorkingMemory";
|
|
46736
46801
|
function deepMergeWorkingMemory(existing, update) {
|
|
46737
46802
|
if (!update || typeof update !== "object" || Object.keys(update).length === 0) {
|
|
46738
46803
|
return existing && typeof existing === "object" ? { ...existing } : {};
|
|
@@ -46824,7 +46889,9 @@ var updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
46824
46889
|
};
|
|
46825
46890
|
}
|
|
46826
46891
|
const usesMergeSemantics = Boolean(schema);
|
|
46827
|
-
const
|
|
46892
|
+
const useStateSignals = memoryConfig?.workingMemory?.useStateSignals === true;
|
|
46893
|
+
const stateSignalsPreamble = `The current working memory state is delivered to you each turn by the system inside a <working-memory>...</working-memory> block. That block is system-emitted state, NOT something the user typed \u2014 never describe it as the user sharing it. Read from it directly when answering. Only call this tool when the user provides genuinely NEW or CHANGED facts that should be persisted; do NOT call it to re-save unchanged data.`;
|
|
46894
|
+
const description = schema ? useStateSignals ? `${stateSignalsPreamble} Data is merged with existing memory \u2014 only include fields you want to add or update.` : `Update the working memory with new information. Data is merged with existing memory - only include fields you want to add or update. To preserve existing data, omit the field entirely. Arrays are replaced entirely when provided, so pass the complete array or omit it to keep the existing values.` : useStateSignals ? `${stateSignalsPreamble} Pass the full updated Markdown blob as a string in the memory field.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`;
|
|
46828
46895
|
return createTool({
|
|
46829
46896
|
id: "update-working-memory",
|
|
46830
46897
|
description,
|
|
@@ -47003,6 +47070,12 @@ var __experimental_updateWorkingMemoryToolVNext = (config3) => {
|
|
|
47003
47070
|
}
|
|
47004
47071
|
});
|
|
47005
47072
|
};
|
|
47073
|
+
function createWorkingMemoryTool(config3, options = {}) {
|
|
47074
|
+
const useStateSignals = config3.workingMemory?.useStateSignals === true;
|
|
47075
|
+
const tool3 = options.vNext ? __experimental_updateWorkingMemoryToolVNext(config3) : updateWorkingMemoryTool(config3);
|
|
47076
|
+
const name21 = useStateSignals ? SET_WORKING_MEMORY_TOOL_NAME : UPDATE_WORKING_MEMORY_TOOL_NAME;
|
|
47077
|
+
return { name: name21, tool: tool3 };
|
|
47078
|
+
}
|
|
47006
47079
|
var WORKING_MEMORY_START_TAG = "<working_memory>";
|
|
47007
47080
|
var WORKING_MEMORY_END_TAG = "</working_memory>";
|
|
47008
47081
|
var LEGACY_SYSTEM_REMINDER_METADATA_KEY = "dynamicAgentsMdReminder";
|
|
@@ -47120,6 +47193,7 @@ var Memory = class extends MastraMemory {
|
|
|
47120
47193
|
},
|
|
47121
47194
|
observationalMemory: config3.options?.observationalMemory
|
|
47122
47195
|
});
|
|
47196
|
+
this.assertWorkingMemoryStateSignalsCompatibility(mergedConfig);
|
|
47123
47197
|
this.threadConfig = mergedConfig;
|
|
47124
47198
|
const omConfig = normalizeObservationalMemoryConfig(mergedConfig.observationalMemory);
|
|
47125
47199
|
if (omConfig?.retrieval && typeof omConfig.retrieval === "object" && omConfig.retrieval.vector) {
|
|
@@ -47487,6 +47561,7 @@ var Memory = class extends MastraMemory {
|
|
|
47487
47561
|
memoryConfig
|
|
47488
47562
|
}) {
|
|
47489
47563
|
const config3 = this.getMergedThreadConfig(memoryConfig || {});
|
|
47564
|
+
this.assertWorkingMemoryStateSignalsCompatibility(config3);
|
|
47490
47565
|
if (!config3.workingMemory?.enabled) {
|
|
47491
47566
|
throw new Error("Working memory is not enabled for this memory instance");
|
|
47492
47567
|
}
|
|
@@ -47866,9 +47941,13 @@ ${workingMemory}`;
|
|
|
47866
47941
|
memoryConfig
|
|
47867
47942
|
}) {
|
|
47868
47943
|
const config3 = this.getMergedThreadConfig(memoryConfig);
|
|
47944
|
+
this.assertWorkingMemoryStateSignalsCompatibility(config3);
|
|
47869
47945
|
if (!config3.workingMemory?.enabled) {
|
|
47870
47946
|
return null;
|
|
47871
47947
|
}
|
|
47948
|
+
if (config3.workingMemory?.useStateSignals) {
|
|
47949
|
+
return null;
|
|
47950
|
+
}
|
|
47872
47951
|
const workingMemoryTemplate = await this.getWorkingMemoryTemplate({ memoryConfig });
|
|
47873
47952
|
const workingMemoryData = await this.getWorkingMemory({ threadId, resourceId, memoryConfig: config3 });
|
|
47874
47953
|
if (!workingMemoryTemplate) {
|
|
@@ -47930,7 +48009,7 @@ ${workingMemory}`;
|
|
|
47930
48009
|
if (obsSystemMessage) {
|
|
47931
48010
|
systemParts.push(obsSystemMessage);
|
|
47932
48011
|
}
|
|
47933
|
-
const { OBSERVATION_CONTINUATION_HINT } = await import('./constants-
|
|
48012
|
+
const { OBSERVATION_CONTINUATION_HINT } = await import('./constants-DVRTNEGY.js');
|
|
47934
48013
|
continuationMessage = {
|
|
47935
48014
|
id: "om-continuation",
|
|
47936
48015
|
role: "user",
|
|
@@ -48032,7 +48111,7 @@ ${workingMemory}`;
|
|
|
48032
48111
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
48033
48112
|
);
|
|
48034
48113
|
}
|
|
48035
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
48114
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-G52HNRHE.js');
|
|
48036
48115
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
48037
48116
|
await this.indexObservation(observation);
|
|
48038
48117
|
} : void 0;
|
|
@@ -48183,6 +48262,13 @@ Notes:
|
|
|
48183
48262
|
const isMDWorkingMemory = !(`schema` in config3.workingMemory) && (typeof config3.workingMemory.template === `string` || config3.workingMemory.template) && config3.workingMemory;
|
|
48184
48263
|
return Boolean(isMDWorkingMemory && isMDWorkingMemory.version === `vnext`);
|
|
48185
48264
|
}
|
|
48265
|
+
assertWorkingMemoryStateSignalsCompatibility(config3) {
|
|
48266
|
+
if (config3?.workingMemory?.useStateSignals === true && this.isVNextWorkingMemoryConfig(config3)) {
|
|
48267
|
+
throw new Error(
|
|
48268
|
+
"workingMemory.useStateSignals is not supported with workingMemory.version: 'vnext'. Use stable template working memory or disable useStateSignals."
|
|
48269
|
+
);
|
|
48270
|
+
}
|
|
48271
|
+
}
|
|
48186
48272
|
getObservationEmbeddingIndexName(dimensions) {
|
|
48187
48273
|
const defaultDimensions = 384;
|
|
48188
48274
|
const usedDimensions = dimensions ?? defaultDimensions;
|
|
@@ -48384,9 +48470,13 @@ Notes:
|
|
|
48384
48470
|
}
|
|
48385
48471
|
listTools(config3) {
|
|
48386
48472
|
const mergedConfig = this.getMergedThreadConfig(config3);
|
|
48473
|
+
this.assertWorkingMemoryStateSignalsCompatibility(mergedConfig);
|
|
48387
48474
|
const tools = {};
|
|
48388
48475
|
if (mergedConfig.workingMemory?.enabled && !mergedConfig.readOnly) {
|
|
48389
|
-
|
|
48476
|
+
const { name: name21, tool: tool3 } = createWorkingMemoryTool(mergedConfig, {
|
|
48477
|
+
vNext: this.isVNextWorkingMemoryConfig(mergedConfig)
|
|
48478
|
+
});
|
|
48479
|
+
tools[name21] = tool3;
|
|
48390
48480
|
}
|
|
48391
48481
|
const omConfig = normalizeObservationalMemoryConfig(mergedConfig.observationalMemory);
|
|
48392
48482
|
if (omConfig?.retrieval) {
|
|
@@ -48932,6 +49022,10 @@ Notes:
|
|
|
48932
49022
|
if (om) {
|
|
48933
49023
|
processors.push(om);
|
|
48934
49024
|
}
|
|
49025
|
+
const wm = await this.createWorkingMemoryStateProcessor(configuredProcessors, context2);
|
|
49026
|
+
if (wm) {
|
|
49027
|
+
processors.push(wm);
|
|
49028
|
+
}
|
|
48935
49029
|
return processors;
|
|
48936
49030
|
}
|
|
48937
49031
|
/**
|
|
@@ -48969,11 +49063,29 @@ Notes:
|
|
|
48969
49063
|
if (!effectiveConfig) return null;
|
|
48970
49064
|
const engine = await this.omEngine;
|
|
48971
49065
|
if (!engine) return null;
|
|
48972
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
49066
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-G52HNRHE.js');
|
|
48973
49067
|
return new ObservationalMemoryProcessor(engine, this, {
|
|
48974
49068
|
temporalMarkers: effectiveConfig.temporalMarkers
|
|
48975
49069
|
});
|
|
48976
49070
|
}
|
|
49071
|
+
/**
|
|
49072
|
+
* Creates a WorkingMemoryStateProcessor when working memory is enabled and the
|
|
49073
|
+
* `useStateSignals` opt-in is set. Returns null otherwise or if the processor
|
|
49074
|
+
* is already present in the user's configured processors.
|
|
49075
|
+
*/
|
|
49076
|
+
async createWorkingMemoryStateProcessor(configuredProcessors = [], context2) {
|
|
49077
|
+
const runtimeMemory = context2?.get("MastraMemory");
|
|
49078
|
+
const mergedConfig = this.getMergedThreadConfig(runtimeMemory?.memoryConfig);
|
|
49079
|
+
this.assertWorkingMemoryStateSignalsCompatibility(mergedConfig);
|
|
49080
|
+
if (!mergedConfig.workingMemory?.enabled) return null;
|
|
49081
|
+
if (!mergedConfig.workingMemory?.useStateSignals) return null;
|
|
49082
|
+
const { WORKING_MEMORY_STATE_PROCESSOR_ID: WORKING_MEMORY_STATE_PROCESSOR_ID2, WorkingMemoryStateProcessor: WorkingMemoryStateProcessor2 } = await import('./working-memory-state-J7ASTNXX.js');
|
|
49083
|
+
const alreadyConfigured = configuredProcessors.some(
|
|
49084
|
+
(p) => !("workflow" in p) && p.id === WORKING_MEMORY_STATE_PROCESSOR_ID2
|
|
49085
|
+
);
|
|
49086
|
+
if (alreadyConfigured) return null;
|
|
49087
|
+
return new WorkingMemoryStateProcessor2(this, runtimeMemory?.memoryConfig);
|
|
49088
|
+
}
|
|
48977
49089
|
};
|
|
48978
49090
|
|
|
48979
49091
|
export { Memory, deepMergeWorkingMemory, extractWorkingMemoryContent, extractWorkingMemoryTags, removeWorkingMemoryTags };
|