@mastra/upstash 1.0.1 → 1.0.2

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,23 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
8
+
9
+ - Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
10
+ - @mastra/core@1.8.0
11
+
12
+ ## 1.0.2-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
17
+
18
+ - Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
19
+ - @mastra/core@1.8.0-alpha.0
20
+
3
21
  ## 1.0.1
4
22
 
5
23
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-upstash
3
3
  description: Documentation for @mastra/upstash. Use when working with @mastra/upstash APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/upstash"
6
- version: "1.0.1"
6
+ version: "1.0.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.1",
2
+ "version": "1.0.2",
3
3
  "package": "@mastra/upstash",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -18,15 +18,15 @@ Working memory can persist at two different scopes:
18
18
  Here's a minimal example of setting up an agent with working memory:
19
19
 
20
20
  ```typescript
21
- import { Agent } from "@mastra/core/agent";
22
- import { Memory } from "@mastra/memory";
21
+ import { Agent } from '@mastra/core/agent'
22
+ import { Memory } from '@mastra/memory'
23
23
 
24
24
  // Create agent with working memory enabled
25
25
  const agent = new Agent({
26
- id: "personal-assistant",
27
- name: "PersonalAssistant",
28
- instructions: "You are a helpful personal assistant.",
29
- model: "openai/gpt-5.1",
26
+ id: 'personal-assistant',
27
+ name: 'PersonalAssistant',
28
+ instructions: 'You are a helpful personal assistant.',
29
+ model: 'openai/gpt-5.1',
30
30
  memory: new Memory({
31
31
  options: {
32
32
  workingMemory: {
@@ -34,7 +34,7 @@ const agent = new Agent({
34
34
  },
35
35
  },
36
36
  }),
37
- });
37
+ })
38
38
  ```
39
39
 
40
40
  ## How it Works
@@ -57,7 +57,7 @@ const memory = new Memory({
57
57
  options: {
58
58
  workingMemory: {
59
59
  enabled: true,
60
- scope: "resource", // Memory persists across all user threads
60
+ scope: 'resource', // Memory persists across all user threads
61
61
  template: `# User Profile
62
62
  - **Name**:
63
63
  - **Location**:
@@ -67,7 +67,7 @@ const memory = new Memory({
67
67
  `,
68
68
  },
69
69
  },
70
- });
70
+ })
71
71
  ```
72
72
 
73
73
  **Use cases:**
@@ -82,12 +82,12 @@ When using resource-scoped memory, make sure to pass the `resource` parameter in
82
82
 
83
83
  ```typescript
84
84
  // Resource-scoped memory requires resource
85
- const response = await agent.generate("Hello!", {
85
+ const response = await agent.generate('Hello!', {
86
86
  memory: {
87
- thread: "conversation-123",
88
- resource: "user-alice-456", // Same user across different threads
87
+ thread: 'conversation-123',
88
+ resource: 'user-alice-456', // Same user across different threads
89
89
  },
90
- });
90
+ })
91
91
  ```
92
92
 
93
93
  ### Thread-Scoped Memory
@@ -100,7 +100,7 @@ const memory = new Memory({
100
100
  options: {
101
101
  workingMemory: {
102
102
  enabled: true,
103
- scope: "thread", // Memory is isolated per thread
103
+ scope: 'thread', // Memory is isolated per thread
104
104
  template: `# User Profile
105
105
  - **Name**:
106
106
  - **Interests**:
@@ -108,7 +108,7 @@ const memory = new Memory({
108
108
  `,
109
109
  },
110
110
  },
111
- });
111
+ })
112
112
  ```
113
113
 
114
114
  **Use cases:**
@@ -165,7 +165,7 @@ const memory = new Memory({
165
165
  `,
166
166
  },
167
167
  },
168
- });
168
+ })
169
169
  ```
170
170
 
171
171
  ## Designing Effective Templates
@@ -190,7 +190,7 @@ const basicMemory = new Memory({
190
190
  template: `User Facts:\n- Name:\n- Favorite Color:\n- Current Topic:`,
191
191
  },
192
192
  },
193
- });
193
+ })
194
194
  ```
195
195
 
196
196
  You can also store the key facts in a short paragraph format if you prefer a more narrative style:
@@ -203,7 +203,7 @@ const paragraphMemory = new Memory({
203
203
  template: `Important Details:\n\nKeep a short paragraph capturing the user's important facts (name, main goal, current task).`,
204
204
  },
205
205
  },
206
- });
206
+ })
207
207
  ```
208
208
 
209
209
  ## Structured Working Memory
@@ -215,8 +215,8 @@ Working memory can also be defined using a structured schema instead of a Markdo
215
215
  ### Example: Schema-Based Working Memory
216
216
 
217
217
  ```typescript
218
- import { z } from "zod";
219
- import { Memory } from "@mastra/memory";
218
+ import { z } from 'zod'
219
+ import { Memory } from '@mastra/memory'
220
220
 
221
221
  const userProfileSchema = z.object({
222
222
  name: z.string().optional(),
@@ -229,7 +229,7 @@ const userProfileSchema = z.object({
229
229
  deadlines: z.array(z.string()).optional(),
230
230
  })
231
231
  .optional(),
232
- });
232
+ })
233
233
 
234
234
  const memory = new Memory({
235
235
  options: {
@@ -239,7 +239,7 @@ const memory = new Memory({
239
239
  // template: ... (do not set)
240
240
  },
241
241
  },
242
- });
242
+ })
243
243
  ```
244
244
 
245
245
  When a schema is provided, the agent receives the working memory as a JSON object. For example:
@@ -314,9 +314,9 @@ When creating a thread, you can provide initial working memory through the metad
314
314
  ```typescript
315
315
  // Create a thread with initial working memory
316
316
  const thread = await memory.createThread({
317
- threadId: "thread-123",
318
- resourceId: "user-456",
319
- title: "Medical Consultation",
317
+ threadId: 'thread-123',
318
+ resourceId: 'user-456',
319
+ title: 'Medical Consultation',
320
320
  metadata: {
321
321
  workingMemory: `# Patient Profile
322
322
  - Name: John Doe
@@ -326,15 +326,15 @@ const thread = await memory.createThread({
326
326
  - Medical History: Hypertension (controlled)
327
327
  `,
328
328
  },
329
- });
329
+ })
330
330
 
331
331
  // The agent will now have access to this information in all messages
332
332
  await agent.generate("What's my blood type?", {
333
333
  memory: {
334
334
  thread: thread.id,
335
- resource: "user-456",
335
+ resource: 'user-456',
336
336
  },
337
- });
337
+ })
338
338
  // Response: "Your blood type is O+."
339
339
  ```
340
340
 
@@ -345,7 +345,7 @@ You can also update an existing thread's working memory:
345
345
  ```typescript
346
346
  // Update thread metadata to add/modify working memory
347
347
  await memory.updateThread({
348
- id: "thread-123",
348
+ id: 'thread-123',
349
349
  title: thread.title,
350
350
  metadata: {
351
351
  ...thread.metadata,
@@ -357,7 +357,7 @@ await memory.updateThread({
357
357
  - Medical History: Hypertension (controlled)
358
358
  `,
359
359
  },
360
- });
360
+ })
361
361
  ```
362
362
 
363
363
  ### Direct Memory Update
@@ -366,10 +366,10 @@ Alternatively, use the `updateWorkingMemory` method directly:
366
366
 
367
367
  ```typescript
368
368
  await memory.updateWorkingMemory({
369
- threadId: "thread-123",
370
- resourceId: "user-456", // Required for resource-scoped memory
371
- workingMemory: "Updated memory content...",
372
- });
369
+ threadId: 'thread-123',
370
+ resourceId: 'user-456', // Required for resource-scoped memory
371
+ workingMemory: 'Updated memory content...',
372
+ })
373
373
  ```
374
374
 
375
375
  ## Read-Only Working Memory
@@ -382,15 +382,15 @@ In some scenarios, you may want an agent to have access to working memory data w
382
382
  To enable read-only mode, set `readOnly: true` in the memory options:
383
383
 
384
384
  ```typescript
385
- const response = await agent.generate("What do you know about me?", {
385
+ const response = await agent.generate('What do you know about me?', {
386
386
  memory: {
387
- thread: "conversation-123",
388
- resource: "user-alice-456",
387
+ thread: 'conversation-123',
388
+ resource: 'user-alice-456',
389
389
  options: {
390
390
  readOnly: true, // Working memory is provided but cannot be updated
391
391
  },
392
392
  },
393
- });
393
+ })
394
394
  ```
395
395
 
396
396
  ## Examples