@mastra/memory 0.0.2-alpha.0 → 0.0.2-alpha.10

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 CHANGED
@@ -1,5 +1,77 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 0.0.2-alpha.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c2dd6b5]
8
+ - @mastra/core@0.1.27-alpha.31
9
+
10
+ ## 0.0.2-alpha.9
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [963c15a]
15
+ - @mastra/core@0.1.27-alpha.30
16
+
17
+ ## 0.0.2-alpha.8
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [7d87a15]
22
+ - @mastra/core@0.1.27-alpha.29
23
+
24
+ ## 0.0.2-alpha.7
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [1ebd071]
29
+ - @mastra/core@0.1.27-alpha.28
30
+
31
+ ## 0.0.2-alpha.6
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [cd02c56]
36
+ - @mastra/core@0.1.27-alpha.27
37
+
38
+ ## 0.0.2-alpha.5
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [d5e12de]
43
+ - @mastra/core@0.1.27-alpha.26
44
+
45
+ ## 0.0.2-alpha.4
46
+
47
+ ### Patch Changes
48
+
49
+ - 01502b0: fix thread title containing unnecessary text and removed unnecessary logs in memory
50
+ - Updated dependencies [01502b0]
51
+ - @mastra/core@0.1.27-alpha.25
52
+
53
+ ## 0.0.2-alpha.3
54
+
55
+ ### Patch Changes
56
+
57
+ - 836f4e3: Fixed some issues with memory, added Upstash as a memory provider. Silenced dev logs in core
58
+ - Updated dependencies [836f4e3]
59
+ - @mastra/core@0.1.27-alpha.24
60
+
61
+ ## 0.0.2-alpha.2
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [0b826f6]
66
+ - @mastra/core@0.1.27-alpha.23
67
+
68
+ ## 0.0.2-alpha.1
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [7a19083]
73
+ - @mastra/core@0.1.27-alpha.22
74
+
3
75
  ## 0.0.2-alpha.0
4
76
 
5
77
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './cloudflare';
2
1
  export * from './postgres';
3
- export * from './redis';
2
+ export * from './kv/upstash';
@@ -0,0 +1,71 @@
1
+ import { MastraMemory, MessageType as BaseMastraMessageType, ThreadType, MessageResponse } from '@mastra/core';
2
+ import { Redis } from '@upstash/redis';
3
+ import { ToolResultPart, Message as AiMessage } from 'ai';
4
+ interface MessageType extends BaseMastraMessageType {
5
+ tokens?: number;
6
+ }
7
+ interface SerializedThreadType extends Omit<ThreadType, 'createdAt' | 'updatedAt'> {
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ }
11
+ export declare class UpstashKVMemory extends MastraMemory {
12
+ private prefix;
13
+ kv: Redis;
14
+ constructor(config: {
15
+ url: string;
16
+ token: string;
17
+ prefix?: string;
18
+ maxTokens?: number;
19
+ });
20
+ private getThreadKey;
21
+ private getMessagesKey;
22
+ private getToolCacheKey;
23
+ getThreadById({ threadId }: {
24
+ threadId: string;
25
+ }): Promise<ThreadType | null>;
26
+ getThreadsByResourceId({ resourceid }: {
27
+ resourceid: string;
28
+ }): Promise<ThreadType[]>;
29
+ saveThread({ thread }: {
30
+ thread: ThreadType;
31
+ }): Promise<ThreadType>;
32
+ updateThread(id: string, title: string, metadata: Record<string, unknown>): Promise<ThreadType>;
33
+ deleteThread(id: string): Promise<void>;
34
+ /**
35
+ * Tool Cache
36
+ */
37
+ validateToolCallArgs({ hashedArgs }: {
38
+ hashedArgs: string;
39
+ }): Promise<boolean>;
40
+ getToolResult({ threadId, toolArgs, toolName, }: {
41
+ threadId: string;
42
+ toolArgs: Record<string, unknown>;
43
+ toolName: string;
44
+ }): Promise<ToolResultPart['result'] | null>;
45
+ getContextWindow<T extends 'raw' | 'core_message'>({ threadId, startDate, endDate, format, }: {
46
+ format?: T;
47
+ threadId: string;
48
+ startDate?: Date;
49
+ endDate?: Date;
50
+ }): Promise<MessageResponse<T>>;
51
+ /**
52
+ * Messages
53
+ */
54
+ getMessages({ threadId }: {
55
+ threadId: string;
56
+ }): Promise<{
57
+ messages: MessageType[];
58
+ uiMessages: AiMessage[];
59
+ }>;
60
+ saveMessages({ messages }: {
61
+ messages: MessageType[];
62
+ }): Promise<MessageType[]>;
63
+ deleteMessage(id: string): Promise<void>;
64
+ /**
65
+ * Cleanup
66
+ */
67
+ drop(): Promise<void>;
68
+ parseThread(thread: SerializedThreadType): ThreadType;
69
+ parseMessages(messages: MessageType[]): MessageType[];
70
+ }
71
+ export {};