@mastra/memory 1.22.2 → 1.23.0-alpha.1
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 +51 -0
- package/dist/{chunk-3JX4RMDN.cjs → chunk-5HE6DK63.cjs} +6504 -6350
- package/dist/chunk-5HE6DK63.cjs.map +1 -0
- package/dist/{chunk-TB6SV7QK.js → chunk-HF2E2T6Z.js} +6504 -6352
- package/dist/chunk-HF2E2T6Z.js.map +1 -0
- package/dist/docs/SKILL.md +5 -3
- package/dist/docs/assets/SOURCE_MAP.json +53 -45
- package/dist/docs/references/docs-agents-agent-approval.md +2 -2
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-long-running-agents-background-tasks.md +2 -2
- package/dist/docs/references/docs-long-running-agents-goals.md +4 -4
- package/dist/docs/references/docs-memory-memory-processors.md +67 -0
- package/dist/docs/references/docs-memory-message-history.md +56 -2
- package/dist/docs/references/docs-memory-observational-memory.md +3 -3
- package/dist/docs/references/docs-memory-overview.md +3 -3
- package/dist/docs/references/docs-memory-semantic-recall.md +35 -1
- package/dist/docs/references/docs-storage-overview.md +214 -0
- package/dist/docs/references/reference-memory-observational-memory.md +1 -1
- package/dist/docs/references/reference-memory-summarizeConversation.md +99 -0
- package/dist/docs/references/reference-memory-summarizeThread.md +93 -0
- package/dist/docs/references/reference-storage-dynamodb.md +1 -1
- package/dist/docs/references/reference-storage-mongodb.md +46 -46
- package/dist/docs/references/reference-vectors-mongodb.md +93 -4
- package/dist/index.cjs +21 -13
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{observational-memory-TEIGXE56.cjs → observational-memory-LEIZSPQ5.cjs} +32 -28
- package/dist/{observational-memory-TEIGXE56.cjs.map → observational-memory-LEIZSPQ5.cjs.map} +1 -1
- package/dist/{observational-memory-NNGAOKRQ.js → observational-memory-XKEEBG2S.js} +3 -3
- package/dist/{observational-memory-NNGAOKRQ.js.map → observational-memory-XKEEBG2S.js.map} +1 -1
- package/dist/processors/index.cjs +30 -26
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/index.d.ts +2 -0
- package/dist/processors/observational-memory/index.d.ts.map +1 -1
- package/dist/processors/observational-memory/summarize.d.ts +92 -0
- package/dist/processors/observational-memory/summarize.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/chunk-3JX4RMDN.cjs.map +0 -1
- package/dist/chunk-TB6SV7QK.js.map +0 -1
- package/dist/docs/references/docs-memory-storage.md +0 -267
|
@@ -1,109 +1,113 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5HE6DK63_cjs = require('../chunk-5HE6DK63.cjs');
|
|
4
4
|
var chunkD4J4XPGM_cjs = require('../chunk-D4J4XPGM.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "Extractor", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk5HE6DK63_cjs.Extractor; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "ModelByInputTokens", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk5HE6DK63_cjs.ModelByInputTokens; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "OBSERVER_SYSTEM_PROMPT", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunk5HE6DK63_cjs.OBSERVER_SYSTEM_PROMPT; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "ObservationalMemory", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunk5HE6DK63_cjs.ObservationalMemory; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "ObservationalMemoryProcessor", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunk5HE6DK63_cjs.ObservationalMemoryProcessor; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "TokenCounter", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk5HE6DK63_cjs.TokenCounter; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "WorkingMemoryExtractor", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk5HE6DK63_cjs.WorkingMemoryExtractor; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "buildObserverPrompt", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk5HE6DK63_cjs.buildObserverPrompt; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "buildObserverSystemPrompt", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunk5HE6DK63_cjs.buildObserverSystemPrompt; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "combineObservationGroupRanges", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunk5HE6DK63_cjs.combineObservationGroupRanges; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "deriveObservationGroupProvenance", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk5HE6DK63_cjs.deriveObservationGroupProvenance; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "extractCurrentTask", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk5HE6DK63_cjs.extractCurrentTask; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "formatMessagesForObserver", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunk5HE6DK63_cjs.formatMessagesForObserver; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "getObservationsAsOf", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunk5HE6DK63_cjs.getObservationsAsOf; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "hasCurrentTaskSection", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunk5HE6DK63_cjs.hasCurrentTaskSection; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "injectAnchorIds", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunk5HE6DK63_cjs.injectAnchorIds; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "optimizeObservationsForContext", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunk5HE6DK63_cjs.optimizeObservationsForContext; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "parseAnchorId", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunk5HE6DK63_cjs.parseAnchorId; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "parseObservationGroups", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunk5HE6DK63_cjs.parseObservationGroups; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "parseObserverOutput", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunk5HE6DK63_cjs.parseObserverOutput; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "reconcileObservationGroupsFromReflection", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunk5HE6DK63_cjs.reconcileObservationGroupsFromReflection; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "renderObservationGroupsForReflection", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunk5HE6DK63_cjs.renderObservationGroupsForReflection; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "stripEphemeralAnchorIds", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunk5HE6DK63_cjs.stripEphemeralAnchorIds; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "stripObservationGroups", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunk5HE6DK63_cjs.stripObservationGroups; }
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "summarizeConversation", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () { return chunk5HE6DK63_cjs.summarizeConversation; }
|
|
103
107
|
});
|
|
104
108
|
Object.defineProperty(exports, "wrapInObservationGroup", {
|
|
105
109
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunk5HE6DK63_cjs.wrapInObservationGroup; }
|
|
107
111
|
});
|
|
108
112
|
Object.defineProperty(exports, "OBSERVATIONAL_MEMORY_DEFAULTS", {
|
|
109
113
|
enumerable: true,
|
package/dist/processors/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Extractor, ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, wrapInObservationGroup } from '../chunk-
|
|
1
|
+
export { Extractor, ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, summarizeConversation, wrapInObservationGroup } from '../chunk-HF2E2T6Z.js';
|
|
2
2
|
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT } from '../chunk-LSJJAJAF.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -19,6 +19,8 @@ export { ModelByInputTokens, type ModelByInputTokensConfig } from './model-by-in
|
|
|
19
19
|
export { Extractor } from './extractor.js';
|
|
20
20
|
export type { ExtractorConfig, ExtractorOnExtractedContext, ExtractorRuntimeContext, ExtractorSource, } from './extractor.js';
|
|
21
21
|
export { WorkingMemoryExtractor } from './working-memory-extractor.js';
|
|
22
|
+
export { summarizeConversation } from './summarize.js';
|
|
23
|
+
export type { SummarizeConversationOptions, SummarizeConversationResult, SummarizeModel } from './summarize.js';
|
|
22
24
|
export type { ObservationalMemoryConfig, ObservationDebugEvent, ObserveHooks, ObserveHookUsage, ObservationConfig, ReflectionConfig, ObserverResult, ReflectorResult, ObservationMarkerConfig, DataOmObservationStartPart, DataOmObservationEndPart, DataOmObservationFailedPart, DataOmStatusPart, DataOmThreadUpdatePart, DataOmObservationPart, DataOmBufferingStartPart, DataOmBufferingEndPart, DataOmBufferingFailedPart, DataOmBufferingPart, DataOmActivationPart, DataOmPart, } from './types.js';
|
|
23
25
|
export { OBSERVER_SYSTEM_PROMPT, buildObserverSystemPrompt, buildObserverPrompt, parseObserverOutput, optimizeObservationsForContext, formatMessagesForObserver, hasCurrentTaskSection, extractCurrentTask, type ObserverResult as ObserverAgentResult, } from './observer-agent.js';
|
|
24
26
|
export type { ObservationalMemoryRecord, ObservationalMemoryScope, ObservationalMemoryOriginType, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, CreateReflectionGenerationInput, } from '@mastra/core/storage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,kBAAkB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAA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,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oCAAoC,EACpC,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { MastraDBMessage } from '@mastra/core/agent';
|
|
2
|
+
import type { Mastra } from '@mastra/core/mastra';
|
|
3
|
+
import type { ObservabilityContext } from '@mastra/core/observability';
|
|
4
|
+
import type { RequestContext } from '@mastra/core/request-context';
|
|
5
|
+
import type { Memory } from '../../index.js';
|
|
6
|
+
import type { ExtractionFailure } from './extracted-values.js';
|
|
7
|
+
import type { Extractor } from './extractor.js';
|
|
8
|
+
import type { ModelByInputTokens } from './model-by-input-tokens.js';
|
|
9
|
+
import type { ObservationalMemoryModel } from './types.js';
|
|
10
|
+
/** A concrete model config — token-based model routing is not supported for one-shot summarization. */
|
|
11
|
+
export type SummarizeModel = Exclude<ObservationalMemoryModel, ModelByInputTokens>;
|
|
12
|
+
/** Defaults for how `Memory.summarizeThread()` loads a thread's messages from storage. */
|
|
13
|
+
export declare const SUMMARIZE_THREAD_DEFAULTS: {
|
|
14
|
+
/** Stop loading older messages once the collected messages exceed this estimated token count. */
|
|
15
|
+
readonly maxInputTokens: 1000000;
|
|
16
|
+
/** Number of messages fetched per storage page while paginating backwards from the newest message. */
|
|
17
|
+
readonly pageSize: 100;
|
|
18
|
+
};
|
|
19
|
+
export interface SummarizeConversationOptions {
|
|
20
|
+
/** Model that runs the summarization (e.g. a router string like `'openai/gpt-4.1-mini'`). */
|
|
21
|
+
model: SummarizeModel;
|
|
22
|
+
/** The conversation to summarize. */
|
|
23
|
+
messages: MastraDBMessage[];
|
|
24
|
+
/** Extra guidance appended to the summarizer's system prompt (e.g. what to focus on, audience). */
|
|
25
|
+
instructions?: string;
|
|
26
|
+
/** Extractors to run over the conversation. Structured (with a schema) or inline. `onExtracted` hooks fire. */
|
|
27
|
+
extract?: Extractor<any>[];
|
|
28
|
+
/** Thread the conversation belongs to. Defaults to the first `threadId` found on `messages`. Passed to extractor contexts. */
|
|
29
|
+
threadId?: string;
|
|
30
|
+
/** Resource (user) the conversation belongs to. Defaults to the first `resourceId` found on `messages`. Passed to extractor contexts. */
|
|
31
|
+
resourceId?: string;
|
|
32
|
+
requestContext?: RequestContext;
|
|
33
|
+
observabilityContext?: ObservabilityContext;
|
|
34
|
+
abortSignal?: AbortSignal;
|
|
35
|
+
/** Memory instance forwarded to extractor contexts (set automatically by `Memory.summarizeThread()`). */
|
|
36
|
+
memory?: Memory;
|
|
37
|
+
/** Mastra instance for custom gateway model resolution (set automatically by `Memory.summarizeThread()`). */
|
|
38
|
+
mastra?: Mastra;
|
|
39
|
+
}
|
|
40
|
+
export interface SummarizeConversationResult {
|
|
41
|
+
/** The distilled observations produced from the conversation (dense bullet form). */
|
|
42
|
+
summary: string;
|
|
43
|
+
/** Values produced by `extract` extractors, keyed by extractor slug (after `onExtracted` hooks ran). */
|
|
44
|
+
extracted: Record<string, unknown>;
|
|
45
|
+
/** Extractors that failed to produce a valid value, with the reason. */
|
|
46
|
+
extractionFailures?: ExtractionFailure[];
|
|
47
|
+
usage?: {
|
|
48
|
+
inputTokens?: number;
|
|
49
|
+
outputTokens?: number;
|
|
50
|
+
totalTokens?: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Summarize a conversation in one shot, without Observational Memory attached to an agent.
|
|
55
|
+
*
|
|
56
|
+
* Reuses Observational Memory's Observer plumbing — the same distillation prompt, output
|
|
57
|
+
* parsing, retry handling, and extractor pipeline — as a standalone call over the messages
|
|
58
|
+
* you pass in. Nothing is read from or written to storage: the summary and extracted values
|
|
59
|
+
* are returned to you (and to each extractor's `onExtracted` hook), so you decide where they
|
|
60
|
+
* go.
|
|
61
|
+
*
|
|
62
|
+
* Use this when a session ends and you want a summary or structured extraction of the whole
|
|
63
|
+
* conversation — for example a voice call at hang-up. If Observational Memory is configured
|
|
64
|
+
* on a `Memory` instance and you want to summarize one of its threads, use
|
|
65
|
+
* `memory.summarizeThread()` instead, which loads the messages for you.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { summarizeConversation, Extractor } from '@mastra/memory';
|
|
70
|
+
* import { z } from 'zod';
|
|
71
|
+
*
|
|
72
|
+
* const result = await summarizeConversation({
|
|
73
|
+
* model: 'openai/gpt-4.1-mini',
|
|
74
|
+
* messages,
|
|
75
|
+
* instructions: 'Summarize this voicemail call for the business owner.',
|
|
76
|
+
* extract: [
|
|
77
|
+
* new Extractor({
|
|
78
|
+
* name: 'call-summary',
|
|
79
|
+
* instructions: 'Return a concise summary of the call.',
|
|
80
|
+
* schema: z.object({
|
|
81
|
+
* summary: z.string(),
|
|
82
|
+
* sentiment: z.enum(['positive', 'neutral', 'negative']),
|
|
83
|
+
* }),
|
|
84
|
+
* metadataKeyPath: false,
|
|
85
|
+
* }),
|
|
86
|
+
* ],
|
|
87
|
+
* });
|
|
88
|
+
* result.extracted['call-summary']; // { summary, sentiment }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function summarizeConversation(opts: SummarizeConversationOptions): Promise<SummarizeConversationResult>;
|
|
92
|
+
//# sourceMappingURL=summarize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/summarize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM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AC;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;IAChB,wGAAwG;IACxG,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC,KAAK,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAyDpH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"tokenx": "^1.3.0",
|
|
46
46
|
"xxhash-wasm": "^1.1.0",
|
|
47
47
|
"zod": "^4.4.3",
|
|
48
|
-
"@mastra/schema-compat": "1.3.
|
|
48
|
+
"@mastra/schema-compat": "1.3.4-alpha.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@ai-sdk/openai": "^1.3.24",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"typescript-eslint": "^8.57.0",
|
|
63
63
|
"vitest": "4.1.9",
|
|
64
64
|
"@internal/ai-sdk-v4": "0.0.60",
|
|
65
|
-
"@internal/ai-sdk-v5": "0.0.60",
|
|
66
|
-
"@internal/lint": "0.0.113",
|
|
67
65
|
"@internal/ai-v6": "0.0.60",
|
|
66
|
+
"@internal/ai-sdk-v5": "0.0.60",
|
|
68
67
|
"@internal/types-builder": "0.0.88",
|
|
69
|
-
"@
|
|
68
|
+
"@internal/lint": "0.0.113",
|
|
69
|
+
"@mastra/core": "1.50.2-alpha.1"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@mastra/core": ">=1.4.1-0 <2.0.0-0"
|