@mastra/memory 0.0.2-alpha.1 → 0.0.2-alpha.11

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.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [2712098]
8
+ - @mastra/core@0.1.27-alpha.32
9
+
10
+ ## 0.0.2-alpha.10
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [c2dd6b5]
15
+ - @mastra/core@0.1.27-alpha.31
16
+
17
+ ## 0.0.2-alpha.9
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [963c15a]
22
+ - @mastra/core@0.1.27-alpha.30
23
+
24
+ ## 0.0.2-alpha.8
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [7d87a15]
29
+ - @mastra/core@0.1.27-alpha.29
30
+
31
+ ## 0.0.2-alpha.7
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [1ebd071]
36
+ - @mastra/core@0.1.27-alpha.28
37
+
38
+ ## 0.0.2-alpha.6
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [cd02c56]
43
+ - @mastra/core@0.1.27-alpha.27
44
+
45
+ ## 0.0.2-alpha.5
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [d5e12de]
50
+ - @mastra/core@0.1.27-alpha.26
51
+
52
+ ## 0.0.2-alpha.4
53
+
54
+ ### Patch Changes
55
+
56
+ - 01502b0: fix thread title containing unnecessary text and removed unnecessary logs in memory
57
+ - Updated dependencies [01502b0]
58
+ - @mastra/core@0.1.27-alpha.25
59
+
60
+ ## 0.0.2-alpha.3
61
+
62
+ ### Patch Changes
63
+
64
+ - 836f4e3: Fixed some issues with memory, added Upstash as a memory provider. Silenced dev logs in core
65
+ - Updated dependencies [836f4e3]
66
+ - @mastra/core@0.1.27-alpha.24
67
+
68
+ ## 0.0.2-alpha.2
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [0b826f6]
73
+ - @mastra/core@0.1.27-alpha.23
74
+
3
75
  ## 0.0.2-alpha.1
4
76
 
5
77
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './postgres';
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 {};