@mastra/memory 0.0.0-bundle-recursion-20251030002519 → 0.0.0-bundle-studio-cloud-20251222034739
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 +776 -4
- package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +7549 -0
- package/dist/chunk-2CIPVDK5.js +250 -0
- package/dist/chunk-2CIPVDK5.js.map +1 -0
- package/dist/chunk-E53QBCQN.js +84 -0
- package/dist/chunk-E53QBCQN.js.map +1 -0
- package/dist/chunk-LRWWUW22.cjs +252 -0
- package/dist/chunk-LRWWUW22.cjs.map +1 -0
- package/dist/chunk-MWO6ARUW.cjs +89 -0
- package/dist/chunk-MWO6ARUW.cjs.map +1 -0
- package/dist/index.cjs +9293 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -43
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9262 -205
- package/dist/index.js.map +1 -1
- package/dist/token-6GSAFR2W-KVDFAJ2M.js +61 -0
- package/dist/token-6GSAFR2W-KVDFAJ2M.js.map +1 -0
- package/dist/token-6GSAFR2W-RTFFMWTB.cjs +63 -0
- package/dist/token-6GSAFR2W-RTFFMWTB.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-7TEUOH7J.cjs +10 -0
- package/dist/token-util-NEHG7TUY-7TEUOH7J.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD.js +8 -0
- package/dist/token-util-NEHG7TUY-DJYRKLRD.js.map +1 -0
- package/dist/tools/working-memory.d.ts +10 -14
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/dist/working-memory-utils.d.ts +20 -0
- package/dist/working-memory-utils.d.ts.map +1 -0
- package/package.json +20 -30
- package/dist/processors/index.cjs +0 -165
- package/dist/processors/index.cjs.map +0 -1
- package/dist/processors/index.d.ts +0 -3
- package/dist/processors/index.d.ts.map +0 -1
- package/dist/processors/index.js +0 -158
- package/dist/processors/index.js.map +0 -1
- package/dist/processors/token-limiter.d.ts +0 -32
- package/dist/processors/token-limiter.d.ts.map +0 -1
- package/dist/processors/tool-call-filter.d.ts +0 -20
- package/dist/processors/tool-call-filter.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { embedMany } from './_types/@internal_ai-sdk-v4/dist/index.js';
|
|
2
|
+
import type { MastraDBMessage } from '@mastra/core/agent';
|
|
2
3
|
import { MastraMemory } from '@mastra/core/memory';
|
|
3
|
-
import type { MastraMessageV1, MemoryConfig, SharedMemoryConfig, StorageThreadType, WorkingMemoryTemplate } from '@mastra/core/memory';
|
|
4
|
-
import type {
|
|
4
|
+
import type { MastraMessageV1, MemoryConfig, SharedMemoryConfig, StorageThreadType, WorkingMemoryTemplate, MessageDeleteInput } from '@mastra/core/memory';
|
|
5
|
+
import type { StorageListThreadsByResourceIdOutput, StorageListThreadsByResourceIdInput, StorageListMessagesInput } from '@mastra/core/storage';
|
|
5
6
|
import type { ToolAction } from '@mastra/core/tools';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
id: string;
|
|
10
|
-
}[];
|
|
7
|
+
import { deepMergeWorkingMemory } from './tools/working-memory.js';
|
|
8
|
+
export { deepMergeWorkingMemory };
|
|
9
|
+
export { extractWorkingMemoryTags, extractWorkingMemoryContent, removeWorkingMemoryTags } from './working-memory-utils.js';
|
|
11
10
|
/**
|
|
12
11
|
* Concrete implementation of MastraMemory that adds support for thread configuration
|
|
13
12
|
* and message injection.
|
|
@@ -16,35 +15,17 @@ export declare class Memory extends MastraMemory {
|
|
|
16
15
|
constructor(config?: SharedMemoryConfig);
|
|
17
16
|
protected validateThreadIsOwnedByResource(threadId: string, resourceId: string, config: MemoryConfig): Promise<void>;
|
|
18
17
|
protected checkStorageFeatureSupport(config: MemoryConfig): void;
|
|
19
|
-
|
|
18
|
+
recall(args: StorageListMessagesInput & {
|
|
20
19
|
threadConfig?: MemoryConfig;
|
|
21
|
-
|
|
22
|
-
messages: CoreMessage[];
|
|
23
|
-
uiMessages: UIMessageWithMetadata[];
|
|
24
|
-
messagesV2: MastraMessageV2[];
|
|
25
|
-
}>;
|
|
26
|
-
rememberMessages({ threadId, resourceId, vectorMessageSearch, config, }: {
|
|
20
|
+
vectorSearchString?: string;
|
|
27
21
|
threadId: string;
|
|
28
|
-
resourceId?: string;
|
|
29
|
-
vectorMessageSearch?: string;
|
|
30
|
-
config?: MemoryConfig;
|
|
31
22
|
}): Promise<{
|
|
32
|
-
messages:
|
|
33
|
-
messagesV2: MastraMessageV2[];
|
|
23
|
+
messages: MastraDBMessage[];
|
|
34
24
|
}>;
|
|
35
25
|
getThreadById({ threadId }: {
|
|
36
26
|
threadId: string;
|
|
37
27
|
}): Promise<StorageThreadType | null>;
|
|
38
|
-
|
|
39
|
-
resourceId: string;
|
|
40
|
-
} & ThreadSortOptions): Promise<StorageThreadType[]>;
|
|
41
|
-
getThreadsByResourceIdPaginated({ resourceId, page, perPage, orderBy, sortDirection, }: {
|
|
42
|
-
resourceId: string;
|
|
43
|
-
page: number;
|
|
44
|
-
perPage: number;
|
|
45
|
-
} & ThreadSortOptions): Promise<PaginationInfo & {
|
|
46
|
-
threads: StorageThreadType[];
|
|
47
|
-
}>;
|
|
28
|
+
listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
|
|
48
29
|
private handleWorkingMemoryFromMetadata;
|
|
49
30
|
saveThread({ thread, memoryConfig, }: {
|
|
50
31
|
thread: StorageThreadType;
|
|
@@ -86,18 +67,14 @@ export declare class Memory extends MastraMemory {
|
|
|
86
67
|
embeddings: Awaited<ReturnType<typeof embedMany>>["embeddings"];
|
|
87
68
|
dimension: number | undefined;
|
|
88
69
|
}>;
|
|
89
|
-
saveMessages(
|
|
90
|
-
messages:
|
|
70
|
+
saveMessages({ messages, memoryConfig, }: {
|
|
71
|
+
messages: MastraDBMessage[];
|
|
91
72
|
memoryConfig?: MemoryConfig | undefined;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
messages: (MastraMessageV1 | MastraMessageV2)[] | MastraMessageV1[] | MastraMessageV2[];
|
|
96
|
-
memoryConfig?: MemoryConfig | undefined;
|
|
97
|
-
format: 'v2';
|
|
98
|
-
}): Promise<MastraMessageV2[]>;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
messages: MastraDBMessage[];
|
|
75
|
+
}>;
|
|
99
76
|
protected updateMessageToHideWorkingMemory(message: MastraMessageV1): MastraMessageV1 | null;
|
|
100
|
-
protected updateMessageToHideWorkingMemoryV2(message:
|
|
77
|
+
protected updateMessageToHideWorkingMemoryV2(message: MastraDBMessage): MastraDBMessage | null;
|
|
101
78
|
protected parseWorkingMemory(text: string): string | null;
|
|
102
79
|
getWorkingMemory({ threadId, resourceId, memoryConfig, }: {
|
|
103
80
|
threadId: string;
|
|
@@ -129,17 +106,17 @@ export declare class Memory extends MastraMemory {
|
|
|
129
106
|
data: string | null;
|
|
130
107
|
}): string;
|
|
131
108
|
private isVNextWorkingMemoryConfig;
|
|
132
|
-
|
|
109
|
+
listTools(config?: MemoryConfig): Record<string, ToolAction<any, any, any>>;
|
|
133
110
|
/**
|
|
134
111
|
* Updates the metadata of a list of messages
|
|
135
112
|
* @param messages - The list of messages to update
|
|
136
113
|
* @returns The list of updated messages
|
|
137
114
|
*/
|
|
138
115
|
updateMessages({ messages, }: {
|
|
139
|
-
messages: Partial<
|
|
116
|
+
messages: Partial<MastraDBMessage> & {
|
|
140
117
|
id: string;
|
|
141
118
|
}[];
|
|
142
|
-
}): Promise<
|
|
119
|
+
}): Promise<MastraDBMessage[]>;
|
|
143
120
|
/**
|
|
144
121
|
* Deletes one or more messages
|
|
145
122
|
* @param input - Must be an array containing either:
|
|
@@ -149,4 +126,5 @@ export declare class Memory extends MastraMemory {
|
|
|
149
126
|
*/
|
|
150
127
|
deleteMessages(input: MessageDeleteInput): Promise<void>;
|
|
151
128
|
}
|
|
129
|
+
export { SemanticRecall, WorkingMemory, MessageHistory } from '@mastra/core/processors';
|
|
152
130
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,oCAAoC,EACpC,mCAAmC,EACnC,wBAAwB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EAGL,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAYxH;;;GAGG;AACH,qBAAa,MAAO,SAAQ,YAAY;gBAC1B,MAAM,GAAE,kBAAuB;cAe3B,+BAA+B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY;IAqB1G,SAAS,CAAC,0BAA0B,CAAC,MAAM,EAAE,YAAY;IAuBnD,MAAM,CACV,IAAI,EAAE,wBAAwB,GAAG;QAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;QAC5B,kBAAkB,CAAC,EA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