@mastra/memory 0.0.0-error-handler-fix-20251020202607 → 0.0.0-execa-dynamic-import-20260304221256
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 +2181 -3
- package/LICENSE.md +15 -0
- package/dist/_types/@internal_ai-sdk-v4/dist/index.d.ts +7562 -0
- package/dist/chunk-23EXJLET.cjs +84 -0
- package/dist/chunk-23EXJLET.cjs.map +1 -0
- package/dist/chunk-33ZIVK5L.js +5220 -0
- package/dist/chunk-33ZIVK5L.js.map +1 -0
- package/dist/chunk-BSDWQEU3.js +79 -0
- package/dist/chunk-BSDWQEU3.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/chunk-EQ4M72KU.js +439 -0
- package/dist/chunk-EQ4M72KU.js.map +1 -0
- package/dist/chunk-HJYHDIOC.js +250 -0
- package/dist/chunk-HJYHDIOC.js.map +1 -0
- package/dist/chunk-IDRQZVB4.cjs +84 -0
- package/dist/chunk-IDRQZVB4.cjs.map +1 -0
- package/dist/chunk-JEQ2X3Z6.cjs +12 -0
- package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
- package/dist/chunk-LIBOSOHM.cjs +252 -0
- package/dist/chunk-LIBOSOHM.cjs.map +1 -0
- package/dist/chunk-Q7VDGOMJ.cjs +5240 -0
- package/dist/chunk-Q7VDGOMJ.cjs.map +1 -0
- package/dist/chunk-RC6RZVYE.js +79 -0
- package/dist/chunk-RC6RZVYE.js.map +1 -0
- package/dist/chunk-ZD3BKU5O.cjs +441 -0
- package/dist/chunk-ZD3BKU5O.cjs.map +1 -0
- package/dist/docs/SKILL.md +55 -0
- package/dist/docs/assets/SOURCE_MAP.json +103 -0
- package/dist/docs/references/docs-agents-agent-approval.md +588 -0
- package/dist/docs/references/docs-agents-agent-memory.md +209 -0
- package/dist/docs/references/docs-agents-network-approval.md +275 -0
- package/dist/docs/references/docs-agents-networks.md +299 -0
- package/dist/docs/references/docs-agents-supervisor-agents.md +304 -0
- package/dist/docs/references/docs-memory-memory-processors.md +314 -0
- package/dist/docs/references/docs-memory-message-history.md +260 -0
- package/dist/docs/references/docs-memory-observational-memory.md +255 -0
- package/dist/docs/references/docs-memory-overview.md +45 -0
- package/dist/docs/references/docs-memory-semantic-recall.md +288 -0
- package/dist/docs/references/docs-memory-storage.md +261 -0
- package/dist/docs/references/docs-memory-working-memory.md +400 -0
- package/dist/docs/references/reference-core-getMemory.md +50 -0
- package/dist/docs/references/reference-core-listMemory.md +56 -0
- package/dist/docs/references/reference-memory-clone-utilities.md +199 -0
- package/dist/docs/references/reference-memory-cloneThread.md +142 -0
- package/dist/docs/references/reference-memory-createThread.md +68 -0
- package/dist/docs/references/reference-memory-getThreadById.md +24 -0
- package/dist/docs/references/reference-memory-listThreads.md +145 -0
- package/dist/docs/references/reference-memory-memory-class.md +147 -0
- package/dist/docs/references/reference-memory-observational-memory.md +577 -0
- package/dist/docs/references/reference-processors-token-limiter-processor.md +115 -0
- package/dist/docs/references/reference-storage-dynamodb.md +282 -0
- package/dist/docs/references/reference-storage-libsql.md +135 -0
- package/dist/docs/references/reference-storage-mongodb.md +262 -0
- package/dist/docs/references/reference-storage-postgresql.md +526 -0
- package/dist/docs/references/reference-storage-upstash.md +160 -0
- package/dist/docs/references/reference-vectors-libsql.md +305 -0
- package/dist/docs/references/reference-vectors-mongodb.md +295 -0
- package/dist/docs/references/reference-vectors-pg.md +408 -0
- package/dist/docs/references/reference-vectors-upstash.md +294 -0
- package/dist/index.cjs +16008 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +252 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15970 -295
- package/dist/index.js.map +1 -1
- package/dist/observational-memory-3NJCJNCQ.cjs +64 -0
- package/dist/observational-memory-3NJCJNCQ.cjs.map +1 -0
- package/dist/observational-memory-SKDDNPFW.js +3 -0
- package/dist/observational-memory-SKDDNPFW.js.map +1 -0
- package/dist/processors/index.cjs +57 -158
- package/dist/processors/index.cjs.map +1 -1
- package/dist/processors/index.d.ts +1 -2
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -156
- package/dist/processors/index.js.map +1 -1
- package/dist/processors/observational-memory/date-utils.d.ts +35 -0
- package/dist/processors/observational-memory/date-utils.d.ts.map +1 -0
- package/dist/processors/observational-memory/index.d.ts +18 -0
- package/dist/processors/observational-memory/index.d.ts.map +1 -0
- package/dist/processors/observational-memory/markers.d.ts +94 -0
- package/dist/processors/observational-memory/markers.d.ts.map +1 -0
- package/dist/processors/observational-memory/observational-memory.d.ts +842 -0
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -0
- package/dist/processors/observational-memory/observer-agent.d.ts +140 -0
- package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -0
- package/dist/processors/observational-memory/operation-registry.d.ts +14 -0
- package/dist/processors/observational-memory/operation-registry.d.ts.map +1 -0
- package/dist/processors/observational-memory/reflector-agent.d.ts +55 -0
- package/dist/processors/observational-memory/reflector-agent.d.ts.map +1 -0
- package/dist/processors/observational-memory/thresholds.d.ts +52 -0
- package/dist/processors/observational-memory/thresholds.d.ts.map +1 -0
- package/dist/processors/observational-memory/token-counter.d.ts +33 -0
- package/dist/processors/observational-memory/token-counter.d.ts.map +1 -0
- package/dist/processors/observational-memory/types.d.ts +539 -0
- package/dist/processors/observational-memory/types.d.ts.map +1 -0
- package/dist/token-6GSAFR2W-ABXTQD64.js +61 -0
- package/dist/token-6GSAFR2W-ABXTQD64.js.map +1 -0
- package/dist/token-6GSAFR2W-TW2P7HCS.cjs +63 -0
- package/dist/token-6GSAFR2W-TW2P7HCS.cjs.map +1 -0
- package/dist/token-APYSY3BW-2DN6RAUY.js +61 -0
- package/dist/token-APYSY3BW-2DN6RAUY.js.map +1 -0
- package/dist/token-APYSY3BW-ZQ7TMBY7.cjs +63 -0
- package/dist/token-APYSY3BW-ZQ7TMBY7.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs +10 -0
- package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-XQP3QSPX.js +8 -0
- package/dist/token-util-NEHG7TUY-XQP3QSPX.js.map +1 -0
- package/dist/token-util-RMHT2CPJ-6TGPE335.cjs +10 -0
- package/dist/token-util-RMHT2CPJ-6TGPE335.cjs.map +1 -0
- package/dist/token-util-RMHT2CPJ-RJEA3FAN.js +8 -0
- package/dist/token-util-RMHT2CPJ-RJEA3FAN.js.map +1 -0
- package/dist/tools/working-memory.d.ts +17 -24
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/package.json +26 -25
- 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,50 +1,72 @@
|
|
|
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 {
|
|
4
|
-
import type {
|
|
4
|
+
import type { MemoryConfig, SharedMemoryConfig, StorageThreadType, WorkingMemoryTemplate, MessageDeleteInput } from '@mastra/core/memory';
|
|
5
|
+
import type { InputProcessor, InputProcessorOrWorkflow, OutputProcessor, OutputProcessorOrWorkflow } from '@mastra/core/processors';
|
|
6
|
+
import type { RequestContext } from '@mastra/core/request-context';
|
|
7
|
+
import type { StorageListThreadsInput, StorageListThreadsOutput, StorageListMessagesInput, MemoryStorage, StorageCloneThreadInput, StorageCloneThreadOutput, ThreadCloneMetadata } from '@mastra/core/storage';
|
|
5
8
|
import type { ToolAction } from '@mastra/core/tools';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
id: string;
|
|
10
|
-
}[];
|
|
9
|
+
import { deepMergeWorkingMemory } from './tools/working-memory.js';
|
|
10
|
+
export { deepMergeWorkingMemory };
|
|
11
|
+
export { extractWorkingMemoryTags, extractWorkingMemoryContent, removeWorkingMemoryTags } from '@mastra/core/memory';
|
|
11
12
|
/**
|
|
12
13
|
* Concrete implementation of MastraMemory that adds support for thread configuration
|
|
13
14
|
* and message injection.
|
|
14
15
|
*/
|
|
15
16
|
export declare class Memory extends MastraMemory {
|
|
16
17
|
constructor(config?: SharedMemoryConfig);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Gets the memory storage domain, throwing if not available.
|
|
20
|
+
*/
|
|
21
|
+
protected getMemoryStore(): Promise<MemoryStorage>;
|
|
22
|
+
listMessagesByResourceId(args: {
|
|
23
|
+
resourceId: string;
|
|
24
|
+
perPage?: number | false;
|
|
25
|
+
page?: number;
|
|
26
|
+
orderBy?: {
|
|
27
|
+
field?: 'createdAt';
|
|
28
|
+
direction?: 'ASC' | 'DESC';
|
|
29
|
+
};
|
|
30
|
+
filter?: {
|
|
31
|
+
dateRange?: {
|
|
32
|
+
start?: Date;
|
|
33
|
+
end?: Date;
|
|
34
|
+
startExclusive?: boolean;
|
|
35
|
+
endExclusive?: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
include?: Array<{
|
|
39
|
+
id: string;
|
|
40
|
+
threadId?: string;
|
|
41
|
+
withPreviousMessages?: number;
|
|
42
|
+
withNextMessages?: number;
|
|
43
|
+
}>;
|
|
21
44
|
}): Promise<{
|
|
22
|
-
messages:
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
messages: MastraDBMessage[];
|
|
46
|
+
total: number;
|
|
47
|
+
page: number;
|
|
48
|
+
perPage: number | false;
|
|
49
|
+
hasMore: boolean;
|
|
25
50
|
}>;
|
|
26
|
-
|
|
51
|
+
protected validateThreadIsOwnedByResource(threadId: string, resourceId: string, config: MemoryConfig): Promise<void>;
|
|
52
|
+
recall(args: StorageListMessagesInput & {
|
|
53
|
+
threadConfig?: MemoryConfig;
|
|
54
|
+
vectorSearchString?: string;
|
|
27
55
|
threadId: string;
|
|
28
|
-
resourceId?: string;
|
|
29
|
-
vectorMessageSearch?: string;
|
|
30
|
-
config?: MemoryConfig;
|
|
31
56
|
}): Promise<{
|
|
32
|
-
messages:
|
|
33
|
-
|
|
57
|
+
messages: MastraDBMessage[];
|
|
58
|
+
usage?: {
|
|
59
|
+
tokens: number;
|
|
60
|
+
};
|
|
61
|
+
total: number;
|
|
62
|
+
page: number;
|
|
63
|
+
perPage: number | false;
|
|
64
|
+
hasMore: boolean;
|
|
34
65
|
}>;
|
|
35
66
|
getThreadById({ threadId }: {
|
|
36
67
|
threadId: string;
|
|
37
68
|
}): 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
|
-
}>;
|
|
69
|
+
listThreads(args: StorageListThreadsInput): Promise<StorageListThreadsOutput>;
|
|
48
70
|
private handleWorkingMemoryFromMetadata;
|
|
49
71
|
saveThread({ thread, memoryConfig, }: {
|
|
50
72
|
thread: StorageThreadType;
|
|
@@ -84,20 +106,21 @@ export declare class Memory extends MastraMemory {
|
|
|
84
106
|
protected embedMessageContent(content: string): Promise<{
|
|
85
107
|
chunks: string[];
|
|
86
108
|
embeddings: Awaited<ReturnType<typeof embedMany>>["embeddings"];
|
|
109
|
+
usage?: {
|
|
110
|
+
tokens: number;
|
|
111
|
+
};
|
|
87
112
|
dimension: number | undefined;
|
|
88
113
|
}>;
|
|
89
|
-
saveMessages(
|
|
90
|
-
messages:
|
|
114
|
+
saveMessages({ messages, memoryConfig, }: {
|
|
115
|
+
messages: MastraDBMessage[];
|
|
91
116
|
memoryConfig?: MemoryConfig | undefined;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
protected updateMessageToHideWorkingMemory(message: MastraMessageV1): MastraMessageV1 | null;
|
|
100
|
-
protected updateMessageToHideWorkingMemoryV2(message: MastraMessageV2): MastraMessageV2 | null;
|
|
117
|
+
}): Promise<{
|
|
118
|
+
messages: MastraDBMessage[];
|
|
119
|
+
usage?: {
|
|
120
|
+
tokens: number;
|
|
121
|
+
};
|
|
122
|
+
}>;
|
|
123
|
+
protected updateMessageToHideWorkingMemoryV2(message: MastraDBMessage): MastraDBMessage | null;
|
|
101
124
|
protected parseWorkingMemory(text: string): string | null;
|
|
102
125
|
getWorkingMemory({ threadId, resourceId, memoryConfig, }: {
|
|
103
126
|
threadId: string;
|
|
@@ -128,18 +151,32 @@ export declare class Memory extends MastraMemory {
|
|
|
128
151
|
template: WorkingMemoryTemplate;
|
|
129
152
|
data: string | null;
|
|
130
153
|
}): string;
|
|
154
|
+
/**
|
|
155
|
+
* Generate read-only working memory instructions.
|
|
156
|
+
* This provides the working memory context without any tool update instructions.
|
|
157
|
+
* Used when memory is in readOnly mode.
|
|
158
|
+
*/
|
|
159
|
+
protected getReadOnlyWorkingMemoryInstruction({ data }: {
|
|
160
|
+
template: WorkingMemoryTemplate;
|
|
161
|
+
data: string | null;
|
|
162
|
+
}): string;
|
|
131
163
|
private isVNextWorkingMemoryConfig;
|
|
132
|
-
|
|
164
|
+
listTools(config?: MemoryConfig): Record<string, ToolAction<any, any, any>>;
|
|
133
165
|
/**
|
|
134
|
-
* Updates
|
|
135
|
-
*
|
|
166
|
+
* Updates a list of messages and syncs the vector database for semantic recall.
|
|
167
|
+
* When message content is updated, the corresponding vector embeddings are also updated
|
|
168
|
+
* to ensure semantic recall stays in sync with the message content.
|
|
169
|
+
*
|
|
170
|
+
* @param messages - The list of messages to update (must include id, can include partial content)
|
|
171
|
+
* @param memoryConfig - Optional memory configuration to determine if semantic recall is enabled
|
|
136
172
|
* @returns The list of updated messages
|
|
137
173
|
*/
|
|
138
|
-
updateMessages({ messages, }: {
|
|
139
|
-
messages: Partial<
|
|
174
|
+
updateMessages({ messages, memoryConfig, }: {
|
|
175
|
+
messages: (Partial<MastraDBMessage> & {
|
|
140
176
|
id: string;
|
|
141
|
-
}[];
|
|
142
|
-
|
|
177
|
+
})[];
|
|
178
|
+
memoryConfig?: MemoryConfig;
|
|
179
|
+
}): Promise<MastraDBMessage[]>;
|
|
143
180
|
/**
|
|
144
181
|
* Deletes one or more messages
|
|
145
182
|
* @param input - Must be an array containing either:
|
|
@@ -148,5 +185,171 @@ export declare class Memory extends MastraMemory {
|
|
|
148
185
|
* @returns Promise that resolves when all messages are deleted
|
|
149
186
|
*/
|
|
150
187
|
deleteMessages(input: MessageDeleteInput): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Clone a thread and its messages to create a new independent thread.
|
|
190
|
+
* The cloned thread will have metadata tracking its source.
|
|
191
|
+
*
|
|
192
|
+
* If semantic recall is enabled, the cloned messages will also be embedded
|
|
193
|
+
* and added to the vector store for semantic search.
|
|
194
|
+
*
|
|
195
|
+
* @param args - Clone configuration options
|
|
196
|
+
* @param args.sourceThreadId - ID of the thread to clone
|
|
197
|
+
* @param args.newThreadId - ID for the new cloned thread (if not provided, a random UUID will be generated)
|
|
198
|
+
* @param args.resourceId - Resource ID for the new thread (defaults to source thread's resourceId)
|
|
199
|
+
* @param args.title - Title for the new cloned thread
|
|
200
|
+
* @param args.metadata - Additional metadata to merge with clone metadata
|
|
201
|
+
* @param args.options - Options for filtering which messages to include
|
|
202
|
+
* @param args.options.messageLimit - Maximum number of messages to copy (from most recent)
|
|
203
|
+
* @param args.options.messageFilter - Filter messages by date range or specific IDs
|
|
204
|
+
* @param memoryConfig - Optional memory configuration override
|
|
205
|
+
* @returns The newly created thread and the cloned messages
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* // Clone entire thread
|
|
210
|
+
* const { thread, clonedMessages } = await memory.cloneThread({
|
|
211
|
+
* sourceThreadId: 'thread-123',
|
|
212
|
+
* });
|
|
213
|
+
*
|
|
214
|
+
* // Clone with custom ID
|
|
215
|
+
* const { thread, clonedMessages } = await memory.cloneThread({
|
|
216
|
+
* sourceThreadId: 'thread-123',
|
|
217
|
+
* newThreadId: 'my-custom-thread-id',
|
|
218
|
+
* });
|
|
219
|
+
*
|
|
220
|
+
* // Clone with message limit
|
|
221
|
+
* const { thread, clonedMessages } = await memory.cloneThread({
|
|
222
|
+
* sourceThreadId: 'thread-123',
|
|
223
|
+
* title: 'My cloned conversation',
|
|
224
|
+
* options: {
|
|
225
|
+
* messageLimit: 10, // Only clone last 10 messages
|
|
226
|
+
* },
|
|
227
|
+
* });
|
|
228
|
+
*
|
|
229
|
+
* // Clone with date filter
|
|
230
|
+
* const { thread, clonedMessages } = await memory.cloneThread({
|
|
231
|
+
* sourceThreadId: 'thread-123',
|
|
232
|
+
* options: {
|
|
233
|
+
* messageFilter: {
|
|
234
|
+
* startDate: new Date('2024-01-01'),
|
|
235
|
+
* endDate: new Date('2024-06-01'),
|
|
236
|
+
* },
|
|
237
|
+
* },
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
cloneThread(args: StorageCloneThreadInput, memoryConfig?: MemoryConfig): Promise<StorageCloneThreadOutput>;
|
|
242
|
+
/**
|
|
243
|
+
* Clone observational memory records when cloning a thread.
|
|
244
|
+
* Thread-scoped: always cloned to the new thread.
|
|
245
|
+
* Resource-scoped: cloned only when the resourceId changes (same resourceId shares OM naturally).
|
|
246
|
+
* All stored message/thread IDs are remapped to the cloned IDs.
|
|
247
|
+
*/
|
|
248
|
+
private cloneObservationalMemory;
|
|
249
|
+
/**
|
|
250
|
+
* Create a remapped copy of an OM record with new thread/message IDs.
|
|
251
|
+
*/
|
|
252
|
+
private remapObservationalMemoryRecord;
|
|
253
|
+
/**
|
|
254
|
+
* Embed cloned messages for semantic recall.
|
|
255
|
+
* This is similar to the embedding logic in saveMessages but operates on already-saved messages.
|
|
256
|
+
*/
|
|
257
|
+
private embedClonedMessages;
|
|
258
|
+
/**
|
|
259
|
+
* Get the clone metadata from a thread if it was cloned from another thread.
|
|
260
|
+
*
|
|
261
|
+
* @param thread - The thread to check
|
|
262
|
+
* @returns The clone metadata if the thread is a clone, null otherwise
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* const thread = await memory.getThreadById({ threadId: 'thread-123' });
|
|
267
|
+
* const cloneInfo = memory.getCloneMetadata(thread);
|
|
268
|
+
* if (cloneInfo) {
|
|
269
|
+
* console.log(`This thread was cloned from ${cloneInfo.sourceThreadId}`);
|
|
270
|
+
* }
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
getCloneMetadata(thread: StorageThreadType | null): ThreadCloneMetadata | null;
|
|
274
|
+
/**
|
|
275
|
+
* Check if a thread is a clone of another thread.
|
|
276
|
+
*
|
|
277
|
+
* @param thread - The thread to check
|
|
278
|
+
* @returns True if the thread is a clone, false otherwise
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* const thread = await memory.getThreadById({ threadId: 'thread-123' });
|
|
283
|
+
* if (memory.isClone(thread)) {
|
|
284
|
+
* console.log('This is a cloned thread');
|
|
285
|
+
* }
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
isClone(thread: StorageThreadType | null): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Get the source thread that a cloned thread was created from.
|
|
291
|
+
*
|
|
292
|
+
* @param threadId - ID of the cloned thread
|
|
293
|
+
* @returns The source thread if found, null if the thread is not a clone or source doesn't exist
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const sourceThread = await memory.getSourceThread('cloned-thread-123');
|
|
298
|
+
* if (sourceThread) {
|
|
299
|
+
* console.log(`Original thread: ${sourceThread.title}`);
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
getSourceThread(threadId: string): Promise<StorageThreadType | null>;
|
|
304
|
+
/**
|
|
305
|
+
* List all threads that were cloned from a specific source thread.
|
|
306
|
+
*
|
|
307
|
+
* @param sourceThreadId - ID of the source thread
|
|
308
|
+
* @param resourceId - Optional resource ID to filter by
|
|
309
|
+
* @returns Array of threads that are clones of the source thread
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```typescript
|
|
313
|
+
* const clones = await memory.listClones('original-thread-123', 'user-456');
|
|
314
|
+
* console.log(`Found ${clones.length} clones of this thread`);
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
listClones(sourceThreadId: string, resourceId?: string): Promise<StorageThreadType[]>;
|
|
318
|
+
/**
|
|
319
|
+
* Get the clone history chain for a thread (all ancestors back to the original).
|
|
320
|
+
*
|
|
321
|
+
* @param threadId - ID of the thread to get history for
|
|
322
|
+
* @returns Array of threads from oldest ancestor to the given thread (inclusive)
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* const history = await memory.getCloneHistory('deeply-cloned-thread');
|
|
327
|
+
* // Returns: [originalThread, firstClone, secondClone, deeplyClonedThread]
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
getCloneHistory(threadId: string): Promise<StorageThreadType[]>;
|
|
331
|
+
/**
|
|
332
|
+
* Get input processors for this memory instance.
|
|
333
|
+
* Extends the base implementation to add ObservationalMemory processor when configured.
|
|
334
|
+
*
|
|
335
|
+
* @param configuredProcessors - Processors already configured by the user (for deduplication)
|
|
336
|
+
* @param context - Request context for runtime configuration
|
|
337
|
+
* @returns Array of input processors configured for this memory instance
|
|
338
|
+
*/
|
|
339
|
+
getInputProcessors(configuredProcessors?: InputProcessorOrWorkflow[], context?: RequestContext): Promise<InputProcessor[]>;
|
|
340
|
+
/**
|
|
341
|
+
* Extends the base implementation to add ObservationalMemory as an output processor.
|
|
342
|
+
* OM needs processOutputResult to save messages at the end of the agent turn,
|
|
343
|
+
* even when the observation threshold was never reached during the loop.
|
|
344
|
+
*/
|
|
345
|
+
getOutputProcessors(configuredProcessors?: OutputProcessorOrWorkflow[], context?: RequestContext): Promise<OutputProcessor[]>;
|
|
346
|
+
/**
|
|
347
|
+
* Creates an ObservationalMemory processor instance if configured and not already present.
|
|
348
|
+
* A new instance is created per call — processorStates (e.g., sealedIds) are shared
|
|
349
|
+
* via the ProcessorRunner's state map keyed by processor ID, not by instance identity.
|
|
350
|
+
*/
|
|
351
|
+
private createOMProcessor;
|
|
151
352
|
}
|
|
353
|
+
export { SemanticRecall, WorkingMemory, MessageHistory } from '@mastra/core/processors';
|
|
354
|
+
export type { StorageCloneThreadInput, StorageCloneThreadOutput, ThreadCloneMetadata } from '@mastra/core/storage';
|
|
152
355
|
//# 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;AAKhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAwD,MAAM,qBAAqB,CAAC;AACzG,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAEnB,MAAM,qBAAqB,CAAC;AAe7B,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,E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