@mastra/memory 1.28.3-alpha.2 → 1.28.3-alpha.3
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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/constants.d.ts +1 -0
- package/dist/processors/observational-memory/constants.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/types.d.ts +4 -1
- package/dist/processors/observational-memory/types.d.ts.map +1 -1
- package/dist/{src-xexf1pDz.js → src-BFP4tRqs.js} +21 -4
- package/dist/{src-xexf1pDz.js.map → src-BFP4tRqs.js.map} +1 -1
- package/dist/{src-CFsPC_sG.cjs → src-D4Wm6M4v.cjs} +22 -5
- package/dist/{src-CFsPC_sG.cjs.map → src-D4Wm6M4v.cjs.map} +1 -1
- package/package.json +3 -3
|
@@ -29,6 +29,8 @@ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(
|
|
|
29
29
|
enumerable: true
|
|
30
30
|
}) : target, mod));
|
|
31
31
|
//#endregion
|
|
32
|
+
let crypto$1 = require("crypto");
|
|
33
|
+
crypto$1 = __toESM$1(crypto$1, 1);
|
|
32
34
|
let zod_v3 = require("zod/v3");
|
|
33
35
|
let zod = require("zod");
|
|
34
36
|
let zod_v4 = require("zod/v4");
|
|
@@ -46,8 +48,6 @@ xxhash_wasm = __toESM$1(xxhash_wasm, 1);
|
|
|
46
48
|
let _mastra_core_storage = require("@mastra/core/storage");
|
|
47
49
|
let fs = require("fs");
|
|
48
50
|
let path = require("path");
|
|
49
|
-
let crypto$1 = require("crypto");
|
|
50
|
-
crypto$1 = __toESM$1(crypto$1, 1);
|
|
51
51
|
let _mastra_core_tools = require("@mastra/core/tools");
|
|
52
52
|
let _mastra_core_request_context = require("@mastra/core/request-context");
|
|
53
53
|
let _mastra_core_llm = require("@mastra/core/llm");
|
|
@@ -17604,6 +17604,7 @@ const OBSERVATIONAL_MEMORY_DEFAULTS = {
|
|
|
17604
17604
|
},
|
|
17605
17605
|
providerOptions: { google: { thinkingConfig: { thinkingBudget: 215 } } },
|
|
17606
17606
|
maxTokensPerBatch: 1e4,
|
|
17607
|
+
observeAttachments: ["image/*", "application/pdf"],
|
|
17607
17608
|
bufferTokens: .2,
|
|
17608
17609
|
bufferActivation: .8
|
|
17609
17610
|
},
|
|
@@ -24212,13 +24213,16 @@ var ObservationStrategy = class ObservationStrategy {
|
|
|
24212
24213
|
if (!resourceId || !this.deps.onIndexObservations) return;
|
|
24213
24214
|
const groups = parseObservationGroups(observations);
|
|
24214
24215
|
if (groups.length === 0) return;
|
|
24215
|
-
await Promise.all(groups.map((group) => this.deps.onIndexObservations({
|
|
24216
|
+
await Promise.all(groups.map((group) => withRetry(() => this.deps.onIndexObservations({
|
|
24216
24217
|
text: group.content,
|
|
24217
24218
|
groupId: group.id,
|
|
24218
24219
|
range: group.range,
|
|
24219
24220
|
threadId,
|
|
24220
24221
|
resourceId,
|
|
24221
24222
|
observedAt
|
|
24223
|
+
}), {
|
|
24224
|
+
label: "index-observations",
|
|
24225
|
+
abortSignal: this.opts.abortSignal
|
|
24222
24226
|
})));
|
|
24223
24227
|
}
|
|
24224
24228
|
/**
|
|
@@ -27385,7 +27389,7 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
27385
27389
|
previousObserverTokens: config.observation?.previousObserverTokens ?? 2e3,
|
|
27386
27390
|
instruction: config.observation?.instruction,
|
|
27387
27391
|
threadTitle: config.observation?.threadTitle ?? false,
|
|
27388
|
-
observeAttachments: config.observation?.observeAttachments ??
|
|
27392
|
+
observeAttachments: config.observation?.observeAttachments ?? [...OBSERVATIONAL_MEMORY_DEFAULTS.observation.observeAttachments],
|
|
27389
27393
|
extractors: composeObservationExtractors({
|
|
27390
27394
|
threadTitle: config.observation?.threadTitle ?? false,
|
|
27391
27395
|
extract: config.observation?.extract,
|
|
@@ -31234,8 +31238,21 @@ Notes:
|
|
|
31234
31238
|
const embedResult = await this.embedMessageContent(text);
|
|
31235
31239
|
if (embedResult.embeddings.length === 0 || embedResult.dimension === void 0) return;
|
|
31236
31240
|
const { indexName } = await this.createObservationEmbeddingIndex(embedResult.dimension);
|
|
31241
|
+
const ids = embedResult.chunks.map((_, chunkIndex) => {
|
|
31242
|
+
const hash = (0, crypto$1.createHash)("sha256").update(JSON.stringify([
|
|
31243
|
+
resourceId,
|
|
31244
|
+
threadId,
|
|
31245
|
+
groupId,
|
|
31246
|
+
chunkIndex
|
|
31247
|
+
])).digest();
|
|
31248
|
+
hash[6] = hash[6] & 15 | 128;
|
|
31249
|
+
hash[8] = hash[8] & 63 | 128;
|
|
31250
|
+
const hex = hash.toString("hex", 0, 16);
|
|
31251
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
31252
|
+
});
|
|
31237
31253
|
await this.vector.upsert({
|
|
31238
31254
|
indexName,
|
|
31255
|
+
ids,
|
|
31239
31256
|
vectors: embedResult.embeddings,
|
|
31240
31257
|
metadata: embedResult.chunks.map((chunk) => ({
|
|
31241
31258
|
group_id: groupId,
|
|
@@ -32259,4 +32276,4 @@ Object.defineProperty(exports, "wrapInObservationGroup", {
|
|
|
32259
32276
|
}
|
|
32260
32277
|
});
|
|
32261
32278
|
|
|
32262
|
-
//# sourceMappingURL=src-
|
|
32279
|
+
//# sourceMappingURL=src-D4Wm6M4v.cjs.map
|