@mastra/memory 1.37.0 → 1.37.1-alpha.1

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.
Files changed (55) hide show
  1. package/dist/docs/SKILL.md +1 -1
  2. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  3. package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
  4. package/dist/docs/references/docs-memory-observational-memory.md +17 -15
  5. package/dist/docs/references/reference-memory-listThreads.md +1 -1
  6. package/dist/docs/references/reference-memory-observational-memory.md +3 -3
  7. package/dist/docs/references/reference-processors-token-limiter-processor.md +2 -2
  8. package/dist/docs/references/reference-vectors-libsql.md +1 -1
  9. package/dist/docs/references/reference-vectors-mongodb.md +2 -1
  10. package/dist/docs/references/reference-vectors-pg.md +16 -11
  11. package/dist/docs/references/reference-vectors-upstash.md +10 -4
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/processors/index.cjs +1 -1
  16. package/dist/processors/index.js +1 -1
  17. package/dist/processors/observational-memory/buffering-coordinator.d.ts +25 -0
  18. package/dist/processors/observational-memory/buffering-coordinator.d.ts.map +1 -1
  19. package/dist/processors/observational-memory/commit-queue.d.ts +46 -0
  20. package/dist/processors/observational-memory/commit-queue.d.ts.map +1 -0
  21. package/dist/processors/observational-memory/extraction-runner.d.ts.map +1 -1
  22. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts +7 -4
  23. package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
  24. package/dist/processors/observational-memory/observation-strategies/base.d.ts +93 -6
  25. package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +1 -1
  26. package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts +20 -3
  27. package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts.map +1 -1
  28. package/dist/processors/observational-memory/observation-strategies/sync.d.ts +10 -3
  29. package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -1
  30. package/dist/processors/observational-memory/observation-strategies/types.d.ts +30 -0
  31. package/dist/processors/observational-memory/observation-strategies/types.d.ts.map +1 -1
  32. package/dist/processors/observational-memory/observation-turn/step.d.ts +1 -1
  33. package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -1
  34. package/dist/processors/observational-memory/observational-memory.d.ts +30 -6
  35. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  36. package/dist/processors/observational-memory/observer-agent.d.ts +8 -0
  37. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  38. package/dist/processors/observational-memory/observer-runner.d.ts +1 -1
  39. package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
  40. package/dist/processors/observational-memory/processor.d.ts.map +1 -1
  41. package/dist/processors/observational-memory/record-lineage.d.ts +21 -0
  42. package/dist/processors/observational-memory/record-lineage.d.ts.map +1 -0
  43. package/dist/processors/observational-memory/reflector-agent.d.ts.map +1 -1
  44. package/dist/processors/observational-memory/reflector-runner.d.ts +9 -0
  45. package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
  46. package/dist/processors/observational-memory/types.d.ts +10 -8
  47. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  48. package/dist/processors/observational-memory/working-memory-extractor.d.ts.map +1 -1
  49. package/dist/{src-D-jA6eRb.cjs → src-BcRCGtUY.cjs} +1062 -302
  50. package/dist/src-BcRCGtUY.cjs.map +1 -0
  51. package/dist/{src-B9qhQmNI.js → src-DjDnBIS0.js} +1063 -303
  52. package/dist/src-DjDnBIS0.js.map +1 -0
  53. package/package.json +3 -3
  54. package/dist/src-B9qhQmNI.js.map +0 -1
  55. package/dist/src-D-jA6eRb.cjs.map +0 -1
@@ -3,7 +3,7 @@ name: mastra-memory
3
3
  description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/memory"
6
- version: "1.37.0"
6
+ version: "1.37.1-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.37.0",
2
+ "version": "1.37.1-alpha.1",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {},
5
5
  "modules": {
@@ -158,7 +158,7 @@ const memory = new Memory({
158
158
  })
159
159
  ```
160
160
 
161
- OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, `@mastra/mongodb`, or `@mastra/oracledb`.
161
+ OM requires a storage adapter that supports it: `@mastra/libsql`, `@mastra/pg`, `@mastra/mongodb`, `@mastra/mysql`, `@mastra/convex`, or `@mastra/oracledb`.
162
162
 
163
163
  > **Note:** If you switch the Observer to a less capable model and see facts attributed to a generic `User` instead of individual participants, use [`observation.instruction`](https://mastra.ai/reference/memory/observational-memory) to explain how to interpret the `<turn>` tag.
164
164
 
@@ -468,7 +468,7 @@ With default settings, the context window doesn't grow unbounded. It oscillates
468
468
  3. **Repeat**: History grows from \~6k back toward 30k and shrinks again. Each cycle appends to the observation log, which grows much more slowly than raw history.
469
469
  4. **Observations reach 40k**: The Reflector creates a smaller log from the current observations and any earlier reflections.
470
470
 
471
- In the normal buffered cycle, raw history oscillates between roughly 6k and 30k tokens. The observation log stays around 40k tokens, however long the conversation runs. These are activation thresholds rather than hard caps, so history can grow past the threshold whenever background buffering doesn't keep pace. Above `blockAfter` (default `1.2`, \~36k tokens) activation is allowed to overshoot the retention target instead of activating fewer chunks. It doesn't drain the buffer, and with the default settings it removes the same amount of history as below the threshold. Reflection falls back to a synchronous run above its own `blockAfter` (\~48k tokens).
471
+ In the normal buffered cycle, raw history oscillates between roughly 6k and 30k tokens. The observation log stays around 40k tokens, however long the conversation runs. These are activation thresholds rather than hard caps, so history can grow past the threshold whenever background buffering doesn't keep pace. Between the threshold and `blockAfter` (default `1.2`, \~36k tokens), buffering keeps running in the background and the next ready chunk activates without blocking the agent. At `blockAfter`, a synchronous observation runs if no buffered chunk activates. Reflection falls back to a synchronous run above its own `blockAfter` (\~48k tokens).
472
472
 
473
473
  With [`shareTokenBudget`](https://mastra.ai/reference/memory/observational-memory) enabled, the two budgets pool together. While the observation log is small, message history can expand into the unused observation space (up to \~70k tokens with the defaults) before observation triggers. It then shrinks as observations accumulate.
474
474
 
@@ -796,23 +796,25 @@ When message tokens reach the `messageTokens` threshold, buffered chunks activat
796
796
 
797
797
  Async buffered Observer calls don't generate continuation hints because delayed hints can be stale by activation time. When buffered chunks activate, any previously stored suggested response and current task are cleared. The main agent receives the compressed observations without those hints.
798
798
 
799
- When message production outpaces the Observer, the `blockAfter` safety threshold allows activation to overshoot the retention target instead of using fewer chunks. Activation still uses no more chunks than needed to reach the target, and the default settings remain unaffected. A synchronous observation runs when the `messageTokens` threshold is reached and activating buffered chunks doesn't bring pending tokens back under it. For example, this happens when a large tool result arrives after buffering has stopped. Buffered activation usually preserves a minimum remaining context (the smaller of \~1k tokens or the configured retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less.
799
+ When message production outpaces the Observer, history can pass `messageTokens` before a buffered chunk is ready. Between `messageTokens` and `blockAfter`, Mastra keeps buffering in the background and activates the chunk on a later step, so the agent doesn't wait on the Observer. A synchronous observation runs if pending tokens still reach `blockAfter` after buffered activation, for example when a large tool result leaves an uncovered tail. Above `blockAfter`, activation may also overshoot the retention target instead of using fewer chunks. Buffered activation usually preserves a minimum remaining context (the smaller of \~1k tokens or the configured retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less.
800
+
801
+ At `blockAfter`, activation waits a bounded time for a buffered observation that's still being produced so it activates with the rest. If that takes longer, Mastra observes the remaining messages synchronously. A late observation whose messages are all already observed is then dropped instead of stored. Activations triggered by the idle TTL or a model change don't wait.
800
802
 
801
803
  Reflection works similarly: the Reflector runs in the background when observations reach a fraction of the reflection threshold.
802
804
 
803
805
  ### Settings
804
806
 
805
- | Setting | Default | What it controls |
806
- | ------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
807
- | `observation.bufferTokens` | `0.2` | How often to buffer. `0.2` means every 20% of `messageTokens`. With the default 30k threshold, that's roughly every 6k tokens. Can also be an absolute token count (e.g. `5000`). |
808
- | `observation.bufferActivation` | `0.8` | How aggressively to clear the message window on activation. `0.8` means remove enough messages to keep only 20% of `messageTokens` remaining. Lower values keep more message history. |
809
- | `observation.blockAfter` | `1.2` | Safety net if buffering can't keep up. Values from 1 up to (but not including) 100 multiply `messageTokens`. For example, `1.2` creates a threshold of 36k tokens (1.2 × 30k), above which activation may overshoot the retention target rather than use fewer chunks. Values of 100 or more are absolute token counts (e.g. `50_000`) and must be greater than `messageTokens`. |
810
- | `activateAfterIdle` | none | Forces buffered observations to activate after a period of inactivity, even before `observation.messageTokens` is reached. Accepts a numeric millisecond value such as `300_000`, duration strings like `"5m"` or `"1hr"`, `"auto"` for a provider-aware prompt cache TTL, or an object of per-provider TTLs such as `{ default: 'auto', anthropic: '1h' }`. |
811
- | `activateOnProviderChange` | `false` | Forces buffered observations to activate when the next step uses a different `provider/model` than the one that produced the latest assistant step. Use this when switching providers or models would invalidate prompt cache reuse. |
812
- | `reflection.bufferActivation` | `0.5` | When to start background reflection. `0.5` means reflection begins when observations reach 50% of the `observationTokens` threshold. |
813
- | `reflection.activateAfterIdle` | none | Opts buffered reflections into idle activation. Reflections don't inherit top-level `activateAfterIdle`. |
814
- | `reflection.activateOnProviderChange` | `false` | Opts buffered reflections into provider-change activation. Reflections don't inherit top-level `activateOnProviderChange`. |
815
- | `reflection.blockAfter` | `1.2` | Safety threshold for reflection. Same value format as observation (absolute values must be greater than `observationTokens`), but above it reflection runs synchronously when no buffered reflection is ready to activate. |
807
+ | Setting | Default | What it controls |
808
+ | ------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
809
+ | `observation.bufferTokens` | `0.2` | How often to buffer. `0.2` means every 20% of `messageTokens`. With the default 30k threshold, that's roughly every 6k tokens. Can also be an absolute token count (e.g. `5000`). |
810
+ | `observation.bufferActivation` | `0.8` | How aggressively to clear the message window on activation. `0.8` means remove enough messages to keep only 20% of `messageTokens` remaining. Lower values keep more message history. |
811
+ | `observation.blockAfter` | `1.2` | Safety net if buffering can't keep up. Values from 1 up to (but not including) 100 multiply `messageTokens`. For example, `1.2` creates a threshold of 36k tokens (1.2 × 30k). Below it, only background buffering and activation run. Observation runs synchronously if pending tokens still reach it after buffered activation. Activation may also overshoot the retention target. Values of 100 or more are absolute token counts (e.g. `50_000`) and must be greater than `messageTokens`. Set `1` to observe synchronously at `messageTokens`. |
812
+ | `activateAfterIdle` | none | Forces buffered observations to activate after a period of inactivity, even before `observation.messageTokens` is reached. Accepts a numeric millisecond value such as `300_000`, duration strings like `"5m"` or `"1hr"`, `"auto"` for a provider-aware prompt cache TTL, or an object of per-provider TTLs such as `{ default: 'auto', anthropic: '1h' }`. |
813
+ | `activateOnProviderChange` | `false` | Forces buffered observations to activate when the next step uses a different `provider/model` than the one that produced the latest assistant step. Use this when switching providers or models would invalidate prompt cache reuse. |
814
+ | `reflection.bufferActivation` | `0.5` | When to start background reflection. `0.5` means reflection begins when observations reach 50% of the `observationTokens` threshold. |
815
+ | `reflection.activateAfterIdle` | none | Opts buffered reflections into idle activation. Reflections don't inherit top-level `activateAfterIdle`. |
816
+ | `reflection.activateOnProviderChange` | `false` | Opts buffered reflections into provider-change activation. Reflections don't inherit top-level `activateOnProviderChange`. |
817
+ | `reflection.blockAfter` | `1.2` | Safety threshold for reflection. Same value format as observation (absolute values must be greater than `observationTokens`), but above it reflection runs synchronously when no buffered reflection is ready to activate. |
816
818
 
817
819
  If you're relying on prompt caching, set `activateAfterIdle` to `"auto"` or to a specific cache TTL. That way, once a thread has been idle long enough for the cache to expire, the next request can activate buffered observations first and send a smaller compressed context window.
818
820
 
@@ -909,9 +911,9 @@ const memory = new Memory({
909
911
  })
910
912
  ```
911
913
 
912
- - `previousObserverTokens: 2000` → default. Keeps \~2k tokens of recent observations.
914
+ - `previousObserverTokens: false` → default. Sends the full previous observations.
915
+ - `previousObserverTokens: 2000` → keeps \~2k tokens of recent observations.
913
916
  - `previousObserverTokens: 0` → omit previous observations completely.
914
- - `previousObserverTokens: false` → disable truncation and keep full previous observations.
915
917
 
916
918
  ## Hooks
917
919
 
@@ -69,7 +69,7 @@ const result = await memory.listThreads({
69
69
 
70
70
  **page** (`number`): Page number (0-indexed) to retrieve
71
71
 
72
- **perPage** (`number | false`): Maximum number of threads to return per page, or false to fetch all
72
+ **perPage** (`number | false`): Maximum number of threads to return per page, or false to fetch all (Default: `100`)
73
73
 
74
74
  **orderBy** (`{ field: 'createdAt' | 'updatedAt', direction: 'ASC' | 'DESC' }`): Sort configuration with field and direction (defaults to { field: 'createdAt', direction: 'DESC' })
75
75
 
@@ -99,7 +99,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
99
99
 
100
100
  **observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateOnProviderChange only.
101
101
 
102
- **observation.blockAfter** (`number`): Safety net for when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 resolves to 120% of the threshold (36k tokens with the default 30k). Values of 100 or more are absolute token counts and must be greater than messageTokens. Above this point, activation uses the smallest set of buffered chunks that reaches the retention target, even when that overshoots the target by more than the usual safeguard allows. It never activates more chunks than are needed to reach the retention target, so it removes only slightly more history than a normal activation. It changes the result only when the retention floor is above roughly 20,000 tokens; with the default bufferActivation (a 6k floor) it has no observable effect. Activation usually keeps a minimum remaining context (the smaller of 1000 tokens or the retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less. Crossing blockAfter does not trigger a blocking observation. A synchronous (blocking) observation runs when the messageTokens threshold is reached and activating buffered chunks doesn't bring pending tokens back under it, for example when a large tool result arrives after buffering has stopped. All remaining buffered chunks are activated first, so the synchronous observation only covers messages no chunk has observed. Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
102
+ **observation.blockAfter** (`number`): Safety net for when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 resolves to 120% of the threshold (36k tokens with the default 30k). Multipliers apply to a per-thread messageTokens override when one is set. Values of 100 or more are absolute token counts and must be greater than messageTokens. Between messageTokens and blockAfter, only async buffering and activation run: reaching the threshold without a buffered chunk to activate starts background buffering, and the chunk activates on a later step. A synchronous (blocking) observation runs if pending tokens still reach blockAfter after buffered activation. All remaining buffered chunks are activated first, so the synchronous observation only covers messages no chunk has observed. Set blockAfter: 1 to observe synchronously at messageTokens. Above this point, activation also uses the smallest set of buffered chunks that reaches the retention target, even when that overshoots the target by more than the usual safeguard allows. It never activates more chunks than are needed to reach the retention target, so it removes only slightly more history than a normal activation. It changes the result only when the retention floor is above roughly 20,000 tokens; with the default bufferActivation (a 6k floor) it has no observable effect. Activation usually keeps a minimum remaining context (the smaller of 1000 tokens or the retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less. Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
103
103
 
104
104
  **observation.previousObserverTokens** (`number | false`): Optional token budget for the observer's previous-observations context. When set to a number, the observations passed to the Observer agent are tail-truncated to fit within this budget while keeping the newest observations and preserving highlighted 🔴 items when possible. When a buffered reflection is pending, the already-reflected observation lines are automatically replaced with the reflection summary before truncation. Set to 0 to omit previous observations entirely, or false to disable truncation explicitly.
105
105
 
@@ -371,7 +371,7 @@ export const agent = new Agent({
371
371
 
372
372
  Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows: when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
373
373
 
374
- The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals and produce chunks of observations. At the threshold, activation moves observations into the log and removes raw messages from context. Above `blockAfter`, activation may overshoot the retention target instead of activating fewer chunks. A synchronous observation runs if pending tokens are still at or above the threshold after all buffered chunks have been activated.
374
+ The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals and produce chunks of observations. At the threshold, activation moves observations into the log and removes raw messages from context. Between the threshold and `blockAfter`, buffering continues in the background and the next ready chunk activates on a later step. A synchronous observation runs if pending tokens still reach `blockAfter` after all buffered chunks have been activated. Above `blockAfter`, activation may also overshoot the retention target instead of activating fewer chunks.
375
375
 
376
376
  Default settings:
377
377
 
@@ -402,7 +402,7 @@ export const agent = new Agent({
402
402
  bufferTokens: 5_000,
403
403
  // Activate to retain 30% of threshold
404
404
  bufferActivation: 0.7,
405
- // Above 1.5x the threshold, let activation overshoot the retention target
405
+ // Observe synchronously at 1.5x the threshold if no buffered chunk is ready
406
406
  blockAfter: 1.5,
407
407
  },
408
408
  reflection: {
@@ -28,7 +28,7 @@ const processor = new TokenLimiterProcessor({
28
28
 
29
29
  **options.limit** (`number`): Maximum number of tokens to allow in the response
30
30
 
31
- **options.encoding** (`TiktokenBPE`): Optional encoding to use. Defaults to o200k\_base which is used by gpt-5.1
31
+ **options.encoding** (`unknown`): Deprecated. Accepted for backwards compatibility but ignored. Token counts are estimated with tokenx, so no encoder is needed.
32
32
 
33
33
  **options.strategy** (`'truncate' | 'abort'`): Strategy when token limit is reached: 'truncate' stops emitting chunks, 'abort' calls abort() to stop the stream
34
34
 
@@ -40,7 +40,7 @@ const processor = new TokenLimiterProcessor({
40
40
 
41
41
  **id** (`string`): Processor identifier set to 'token-limiter'
42
42
 
43
- **name** (`string`): Optional processor display name
43
+ **name** (`string`): Processor display name set to 'Token Limiter'
44
44
 
45
45
  **processInput** (`(args: { messages: MastraDBMessage[]; abort: (reason?: string) => never }) => Promise<MastraDBMessage[]>`): Trims stored history to fit within the token limit before the agentic loop starts in 'memory-only' trim mode, prioritizing recent messages while preserving system messages and the current turn
46
46
 
@@ -121,7 +121,7 @@ Searches for similar vectors with optional metadata filtering.
121
121
 
122
122
  **includeVector** (`boolean`): Whether to include vector data in results (Default: `false`)
123
123
 
124
- **minScore** (`number`): Minimum similarity score threshold (Default: `0`)
124
+ **minScore** (`number`): Minimum similarity score threshold (cosine similarity ranges from -1 to 1) (Default: `-1`)
125
125
 
126
126
  ### `describeIndex()`
127
127
 
@@ -352,6 +352,7 @@ interface QueryResult {
352
352
  score: number
353
353
  metadata: Record<string, any>
354
354
  vector?: number[] // Only included if includeVector is true
355
+ document?: string // Source text stored with the vector, when available
355
356
  }
356
357
  ```
357
358
 
@@ -429,7 +430,7 @@ const results = await store.query({
429
430
 
430
431
  **similarity** (`'cosine' | 'dotProduct' | 'euclidean'`): Vector similarity function. Defaults to MongoDB's own default when omitted.
431
432
 
432
- **numDimensions** (`256 | 512 | 1024 | 2048`): Length of the generated embeddings. (Default: `1024`)
433
+ **numDimensions** (`number`): Length of the generated embeddings. Common values are 256, 512, 1024, and 2048. (Default: `1024`)
433
434
 
434
435
  **quantization** (`'float' | 'scalar' | 'binary' | 'binaryNoRescore'`): Storage format for the generated vectors. (Default: `scalar`)
435
436
 
@@ -82,7 +82,9 @@ const vectorStore = new PgVector({
82
82
 
83
83
  **dimension** (`number`): Vector dimension (must match your embedding model)
84
84
 
85
- **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
85
+ **metric** (`'cosine' | 'euclidean' | 'dotproduct' | 'hamming' | 'jaccard'`): Distance metric for similarity search. 'hamming' and 'jaccard' are only valid with vectorType 'bit', and 'jaccard' requires an HNSW index. (Default: `'cosine' ('hamming' when vectorType is 'bit')`)
86
+
87
+ **vectorType** (`'vector' | 'halfvec' | 'bit' | 'sparsevec'`): pgvector storage type for the embeddings (Default: `vector`)
86
88
 
87
89
  **indexConfig** (`IndexConfig`): Index configuration (Default: `{ type: 'ivfflat' }`)
88
90
 
@@ -142,13 +144,11 @@ Higher M values or efConstruction values will increase memory requirements subst
142
144
 
143
145
  **includeVector** (`boolean`): Whether to include the vector in the result (Default: `false`)
144
146
 
145
- **minScore** (`number`): Minimum similarity score threshold (Default: `0`)
146
-
147
- **options** (`{ ef?: number; probes?: number }`): Additional options for HNSW and IVF indexes
147
+ **minScore** (`number`): Minimum similarity score threshold (Default: `-1`)
148
148
 
149
- **options.ef** (`number`): HNSW search parameter
149
+ **ef** (`number`): HNSW search parameter. Higher values improve accuracy at the cost of speed.
150
150
 
151
- **options.probes** (`number`): IVF search parameter
151
+ **probes** (`number`): IVFFlat search parameter. Number of lists to visit during search.
152
152
 
153
153
  ### `listIndexes()`
154
154
 
@@ -164,8 +164,9 @@ Returns:
164
164
  interface PGIndexStats {
165
165
  dimension: number
166
166
  count: number
167
- metric: 'cosine' | 'euclidean' | 'dotproduct'
167
+ metric: 'cosine' | 'euclidean' | 'dotproduct' | 'hamming' | 'jaccard'
168
168
  type: 'flat' | 'hnsw' | 'ivfflat'
169
+ vectorType: 'vector' | 'halfvec' | 'bit' | 'sparsevec'
169
170
  config: {
170
171
  m?: number
171
172
  efConstruction?: number
@@ -246,7 +247,7 @@ Closes the database connection pool. Should be called when done using the store.
246
247
 
247
248
  **indexName** (`string`): Name of the index to define
248
249
 
249
- **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
250
+ **metric** (`'cosine' | 'euclidean' | 'dotproduct' | 'hamming' | 'jaccard'`): Distance metric for similarity search (Default: `cosine`)
250
251
 
251
252
  **indexConfig** (`IndexConfig`): Configuration for the index type and parameters
252
253
 
@@ -291,17 +292,21 @@ interface QueryResult {
291
292
 
292
293
  ## Error handling
293
294
 
294
- The store throws typed errors that can be caught:
295
+ The store throws `MastraError` instances from `@mastra/core/error`:
295
296
 
296
297
  ```typescript
298
+ import { MastraError } from '@mastra/core/error'
299
+
297
300
  try {
298
301
  await store.query({
299
302
  indexName: 'index_name',
300
303
  queryVector: queryVector,
301
304
  })
302
305
  } catch (error) {
303
- if (error instanceof VectorStoreError) {
304
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
306
+ if (error instanceof MastraError) {
307
+ console.log(error.id) // 'MASTRA_VECTOR_PG_QUERY_FAILED'
308
+ console.log(error.domain) // 'MASTRA_VECTOR'
309
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
305
310
  console.log(error.details) // Additional error context
306
311
  }
307
312
  }
@@ -8,6 +8,8 @@ The UpstashVector class provides vector search using [Upstash Vector](https://up
8
8
 
9
9
  ## Constructor options
10
10
 
11
+ **id** (`string`): Unique identifier for this vector store instance
12
+
11
13
  **url** (`string`): Upstash Vector database URL
12
14
 
13
15
  **token** (`string`): Upstash Vector API token
@@ -194,24 +196,28 @@ Query results are returned in this format:
194
196
  interface QueryResult {
195
197
  id: string
196
198
  score: number
197
- metadata: Record<string, any>
199
+ metadata?: Record<string, any>
198
200
  vector?: number[] // Only included if includeVector is true
199
201
  }
200
202
  ```
201
203
 
202
204
  ## Error handling
203
205
 
204
- The store throws typed errors that can be caught:
206
+ The store throws `MastraError` instances from `@mastra/core/error`:
205
207
 
206
208
  ```typescript
209
+ import { MastraError } from '@mastra/core/error'
210
+
207
211
  try {
208
212
  await store.query({
209
213
  indexName: 'index_name',
210
214
  queryVector: queryVector,
211
215
  })
212
216
  } catch (error) {
213
- if (error instanceof VectorStoreError) {
214
- console.log(error.code) // 'connection_failed' | 'invalid_dimension' | etc
217
+ if (error instanceof MastraError) {
218
+ console.log(error.id) // 'MASTRA_VECTOR_UPSTASH_QUERY_FAILED'
219
+ console.log(error.domain) // 'STORAGE'
220
+ console.log(error.category) // 'USER' | 'THIRD_PARTY'
215
221
  console.log(error.details) // Additional error context
216
222
  }
217
223
  }
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-D-jA6eRb.cjs");
2
+ const require_src = require("./src-BcRCGtUY.cjs");
3
3
  let _mastra_core_processors = require("@mastra/core/processors");
4
4
  exports.AUTO_MODEL_BY_PROVIDER = require_src.AUTO_MODEL_BY_PROVIDER;
5
5
  exports.Extractor = require_src.Extractor;
@@ -1 +1 @@
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;AAI1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,YAAY,EAKb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAA6B,MAAM,4BAA4B,CAAC;AAElG,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,oCAAoC,EACpC,yBAAyB,EACzB,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EAEzB,gBAAgB,EAChB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACxG,OAAO,EAAE,iCAAiC,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAKjH,OAAO,KAAK,EACV,4BA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;;;;;;;;;;OAaG;IACI,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO;IAIzD;;;;;;;;;;;;;OAaG;IACU,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAWjF;;;;;;;;;;;;OAYG;IACU,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAyBlG;;;;;;;;;;;OAWG;IACU,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAmB5E;;;;;;;OAOG;IACG,kBAAkB,CACtB,oBAAoB,GAAE,wBAAwB,EAAO,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC;IAsB5B;;;;OAIG;IACG,mBAAmB,CACvB,oBAAoB,GAAE,yBAAyB,EAAO,EACtD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC;IAW7B;;;;OAIG;YACW,iBAAiB;IAqC/B;;;;OAIG;YACW,iCAAiC;IAyB/C;;;;;;OAMG;YACW,0BAA0B;CAiBzC;AAGD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGxF,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,mCAAmC,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as WorkingMemoryExtractor, E as summarizeConversation, G as Subconscious, K as KnowledgeSemanticIndexCoordinator, T as SUMMARIZE_THREAD_DEFAULTS, Y as ModelByInputTokens, a as extractWorkingMemoryContent, c as getObservationsAsOf, d as AUTO_MODEL_BY_PROVIDER, et as Extractor, f as resolveAutoModelId, h as WorkingMemoryStateProcessor, i as WorkingMemory, m as WORKING_MEMORY_STATE_PROCESSOR_ID, n as MessageHistory, o as extractWorkingMemoryTags, p as WORKING_MEMORY_STATE_ID, q as StaleKnowledgeSemanticIndexError, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, w as deepMergeWorkingMemory } from "./src-B9qhQmNI.js";
1
+ import { C as WorkingMemoryExtractor, E as summarizeConversation, G as Subconscious, K as KnowledgeSemanticIndexCoordinator, T as SUMMARIZE_THREAD_DEFAULTS, Y as ModelByInputTokens, a as extractWorkingMemoryContent, c as getObservationsAsOf, d as AUTO_MODEL_BY_PROVIDER, et as Extractor, f as resolveAutoModelId, h as WorkingMemoryStateProcessor, i as WorkingMemory, m as WORKING_MEMORY_STATE_PROCESSOR_ID, n as MessageHistory, o as extractWorkingMemoryTags, p as WORKING_MEMORY_STATE_ID, q as StaleKnowledgeSemanticIndexError, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, w as deepMergeWorkingMemory } from "./src-DjDnBIS0.js";
2
2
  export { AUTO_MODEL_BY_PROVIDER, Extractor, KnowledgeSemanticIndexCoordinator, Memory, MessageHistory, ModelByInputTokens, SUMMARIZE_THREAD_DEFAULTS, SemanticRecall, StaleKnowledgeSemanticIndexError, Subconscious, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemory, WorkingMemoryExtractor, WorkingMemoryStateProcessor, deepMergeWorkingMemory, extractWorkingMemoryContent, extractWorkingMemoryTags, getObservationsAsOf, removeWorkingMemoryTags, resolveAutoModelId, summarizeConversation };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("../src-D-jA6eRb.cjs");
2
+ const require_src = require("../src-BcRCGtUY.cjs");
3
3
  exports.AUTO_MODEL_BY_PROVIDER = require_src.AUTO_MODEL_BY_PROVIDER;
4
4
  exports.Extractor = require_src.Extractor;
5
5
  exports.KnowledgeSemanticIndexCoordinator = require_src.KnowledgeSemanticIndexCoordinator;
@@ -1,2 +1,2 @@
1
- import { $ as renderSubconsciousActivity, A as buildObserverSystemPrompt, B as OBSERVATION_CONTEXT_INSTRUCTIONS, C as WorkingMemoryExtractor, D as TokenCounter, E as summarizeConversation, F as parseObserverOutput, G as Subconscious, H as OBSERVATION_CONTEXT_PROMPT_THREAD, I as injectAnchorIds, J as SubconsciousRemindExtractor, K as KnowledgeSemanticIndexCoordinator, L as parseAnchorId, M as formatMessagesForObserver, N as hasCurrentTaskSection, O as OBSERVER_SYSTEM_PROMPT, P as optimizeObservationsForContext, Q as publishSubconsciousActivity, R as stripEphemeralAnchorIds, S as wrapInObservationGroup, U as OBSERVATION_CONTINUATION_HINT, V as OBSERVATION_CONTEXT_PROMPT, W as getObservationContextPrompt, X as SUBCONSCIOUS_ACTIVITY_STATE_ID, Y as ModelByInputTokens, Z as buildSubconsciousActivitySnapshot, _ as deriveObservationGroupProvenance, b as renderObservationGroupsForReflection, c as getObservationsAsOf, d as AUTO_MODEL_BY_PROVIDER, et as Extractor, f as resolveAutoModelId, g as combineObservationGroupRanges, j as extractCurrentTask, k as buildObserverPrompt, l as ObservationalMemoryProcessor, q as StaleKnowledgeSemanticIndexError, u as ObservationalMemory, v as parseObservationGroups, x as stripObservationGroups, y as reconcileObservationGroupsFromReflection, z as OBSERVATIONAL_MEMORY_DEFAULTS } from "../src-B9qhQmNI.js";
1
+ import { $ as renderSubconsciousActivity, A as buildObserverSystemPrompt, B as OBSERVATION_CONTEXT_INSTRUCTIONS, C as WorkingMemoryExtractor, D as TokenCounter, E as summarizeConversation, F as parseObserverOutput, G as Subconscious, H as OBSERVATION_CONTEXT_PROMPT_THREAD, I as injectAnchorIds, J as SubconsciousRemindExtractor, K as KnowledgeSemanticIndexCoordinator, L as parseAnchorId, M as formatMessagesForObserver, N as hasCurrentTaskSection, O as OBSERVER_SYSTEM_PROMPT, P as optimizeObservationsForContext, Q as publishSubconsciousActivity, R as stripEphemeralAnchorIds, S as wrapInObservationGroup, U as OBSERVATION_CONTINUATION_HINT, V as OBSERVATION_CONTEXT_PROMPT, W as getObservationContextPrompt, X as SUBCONSCIOUS_ACTIVITY_STATE_ID, Y as ModelByInputTokens, Z as buildSubconsciousActivitySnapshot, _ as deriveObservationGroupProvenance, b as renderObservationGroupsForReflection, c as getObservationsAsOf, d as AUTO_MODEL_BY_PROVIDER, et as Extractor, f as resolveAutoModelId, g as combineObservationGroupRanges, j as extractCurrentTask, k as buildObserverPrompt, l as ObservationalMemoryProcessor, q as StaleKnowledgeSemanticIndexError, u as ObservationalMemory, v as parseObservationGroups, x as stripObservationGroups, y as reconcileObservationGroupsFromReflection, z as OBSERVATIONAL_MEMORY_DEFAULTS } from "../src-DjDnBIS0.js";
2
2
  export { AUTO_MODEL_BY_PROVIDER, Extractor, KnowledgeSemanticIndexCoordinator, ModelByInputTokens, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_PROMPT_THREAD, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, SUBCONSCIOUS_ACTIVITY_STATE_ID, StaleKnowledgeSemanticIndexError, Subconscious, SubconsciousRemindExtractor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, buildSubconsciousActivitySnapshot, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationContextPrompt, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, publishSubconsciousActivity, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, renderSubconsciousActivity, resolveAutoModelId, stripEphemeralAnchorIds, stripObservationGroups, summarizeConversation, wrapInObservationGroup };
@@ -17,11 +17,31 @@ export declare class BufferingCoordinator {
17
17
  * Value: Promise that resolves when buffering completes
18
18
  */
19
19
  static asyncBufferingOps: Map<string, Promise<void>>;
20
+ /**
21
+ * Observation buffer ops that may still append a buffered chunk.
22
+ * Key format: "obs:{lockKey}"
23
+ * Value: Promise that resolves once the op has persisted its chunk (or ended without one)
24
+ *
25
+ * Above the threshold→blockAfter band, activation waits (bounded) on this phase so the chunk
26
+ * activates instead of being re-observed by the sync pass. It is not needed for safety: storage
27
+ * keeps a chunk appended during activation. An op stays in asyncBufferingOps through its
28
+ * post-persist work (indexing, thread title), which activation never waits for.
29
+ */
30
+ static pendingChunkWrites: Map<string, Promise<void>>;
20
31
  /**
21
32
  * Track the last token boundary at which we started buffering.
22
33
  * Key format: "obs:{lockKey}" or "refl:{lockKey}"
23
34
  */
24
35
  static lastBufferedBoundary: Map<string, number>;
36
+ /**
37
+ * The buffer op that set the observation boundary, if one did. Any other write (an activation
38
+ * reset, another op) replaces or clears it, so an op that outlived it never writes its boundary
39
+ * back. Key format: "obs:{lockKey}"
40
+ */
41
+ static observationBoundaryOwners: Map<string, symbol>;
42
+ /** Set the observation boundary; `owner` is the buffer op setting it, if any. */
43
+ static setObservationBoundary(bufferKey: string, tokens: number, owner?: symbol): void;
44
+ static ownsObservationBoundary(bufferKey: string, owner: symbol): boolean;
25
45
  /**
26
46
  * Track the timestamp cursor for buffered messages.
27
47
  * Key format: "obs:{lockKey}"
@@ -43,6 +63,11 @@ export declare class BufferingCoordinator {
43
63
  getObservationBufferKey(lockKey: string): string;
44
64
  getReflectionBufferKey(lockKey: string): string;
45
65
  isAsyncBufferingInProgress(bufferKey: string): boolean;
66
+ /**
67
+ * Mark an observation buffer op as able to append a chunk. Call the returned release
68
+ * function once it no longer can; releasing more than once is a no-op.
69
+ */
70
+ static trackChunkWrite(bufferKey: string): () => void;
46
71
  /**
47
72
  * Clean up static maps for a thread/resource to prevent memory leaks.
48
73
  */
@@ -1 +1 @@
1
- {"version":3,"file":"buffering-coordinator.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/buffering-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAItE,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnF;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2B;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAE9C;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,6BAAoC;IAE5D;;;OAGG;IACH,MAAM,CAAC,oBAAoB,sBAA6B;IAExD;;;OAGG;IACH,MAAM,CAAC,kBAAkB,oBAA2B;IAEpD;;;OAGG;IACH,MAAM,CAAC,wBAAwB,sBAA6B;gBAEhD,IAAI,EAAE;QAChB,iBAAiB,EAAE,yBAAyB,CAAC;QAC7C,gBAAgB,EAAE,wBAAwB,CAAC;QAC3C,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC;KAC9B;IAMD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM;IAO9F,yBAAyB,IAAI,OAAO;IAIpC,wBAAwB,IAAI,OAAO;IAInC,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIhD,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI/C,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAqBrG;;OAEG;IACH,6BAA6B,CAC3B,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,yBAAyB,EACjC,OAAO,CAAC,EAAE;QAAE,2BAA2B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,EACnF,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO;IAgCV;;OAEG;WACU,cAAc,CACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,KAAK,EAAE,QAAQ,GAAG,UAAU,EAC5B,SAAS,SAAQ,GAChB,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
1
+ {"version":3,"file":"buffering-coordinator.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/buffering-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAKtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnF;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2B;IAC5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAE9C;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,6BAAoC;IAE5D;;;;;;;;;OASG;IACH,MAAM,CAAC,kBAAkB,6BAAoC;IAE7D;;;OAGG;IACH,MAAM,CAAC,oBAAoB,sBAA6B;IAExD;;;;OAIG;IACH,MAAM,CAAC,yBAAyB,sBAA6B;IAE7D,iFAAiF;IACjF,MAAM,CAAC,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM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,IAAI,GAAG,SAAS,EACnC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,KAAK,EAAE,QAAQ,GAAG,UAAU,EAC5B,SAAS,SAAQ,GAChB,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Process-wide queue for observational memory storage commits, keyed per thread or resource
3
+ * (the `BufferingCoordinator.getLockKey` scheme).
4
+ *
5
+ * Storage alone keeps every commit correct (other processes never see this queue). The queue
6
+ * adds a deterministic order inside one process: one commit at a time per key, and a waiting
7
+ * reflection commit runs before waiting normal commits, so a due reflection is not held behind
8
+ * a backlog of chunk writes. A running op is never preempted.
9
+ *
10
+ * Ops hold the storage commit, the head read it needs, and in-memory work on that head (such as
11
+ * recomposing observation text against it). No model calls, indexing, or other slow I/O.
12
+ *
13
+ * An op still running after `OM_COMMIT_STALL_MS` (a storage call that never settles, e.g. a
14
+ * Postgres row-lock wait with no `lock_timeout`) releases its key with a warning, so later
15
+ * commits for that thread or resource proceed. The stalled op is not cancelled and its caller
16
+ * keeps waiting for it. If it later lands, it races the newer commits the way a commit from
17
+ * another process does, and storage's generation fencing keeps that correct.
18
+ *
19
+ * Each op runs in the async context of the caller that enqueued it (tracing spans, logger
20
+ * correlation), not the context of the op it waited behind.
21
+ */
22
+ export type OMCommitPriority = 'reflection' | 'normal';
23
+ /** How long an op may hold its key before later ops on that key stop waiting for it. */
24
+ export declare const OM_COMMIT_STALL_MS = 60000;
25
+ /** The per-thread / per-resource key shared by the commit queue and `BufferingCoordinator`. */
26
+ export declare function getOMLockKey(scope: 'thread' | 'resource', threadId: string | null | undefined, resourceId: string | null | undefined): string;
27
+ /**
28
+ * Runs `op` once every earlier op on `key` has settled (reflection-priority ops first among those
29
+ * still waiting) and resolves or rejects with its result. A rejection reaches only this caller.
30
+ *
31
+ * Enqueueing on a key from inside an op that holds the same key, directly or through nested ops
32
+ * on other keys, would deadlock, so it rejects.
33
+ */
34
+ export declare function runOMCommit<T>(key: string, op: () => Promise<T>, { priority }?: {
35
+ priority?: OMCommitPriority;
36
+ }): Promise<T>;
37
+ /** Whether the current async context runs inside an op holding `key`. Test-only. */
38
+ export declare function isInOMCommit(key: string): boolean;
39
+ /** Number of keys with running or waiting ops. Test-only. */
40
+ export declare function activeOMCommitKeys(): number;
41
+ /** Ops waiting (not running) on `key`, by priority. Test-only. */
42
+ export declare function waitingOMCommits(key: string): {
43
+ reflection: number;
44
+ normal: number;
45
+ };
46
+ //# sourceMappingURL=commit-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-queue.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/commit-queue.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEvD,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC,+FAA+F;AAC/F,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,GAAG,UAAU,EAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,MAAM,CAKR;AAuCD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,EAAE,QAAmB,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAA;CAAO,GAC5D,OAAO,CAAC,CAAC,CAAC,CAuDZ;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAGpF"}
@@ -1 +1 @@
1
- {"version":3,"file":"extraction-runner.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/extraction-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9D,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAiBD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACjC,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IACvC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CA4HtC"}
1
+ {"version":3,"file":"extraction-runner.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/extraction-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9D,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAwBD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACjC,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IACvC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAuItC"}
@@ -1,11 +1,13 @@
1
1
  import type { MastraDBMessage } from '@mastra/core/agent';
2
2
  import { ObservationStrategy } from './base.js';
3
3
  import type { StrategyDeps } from './base.js';
4
- import type { ObservationRunOpts, ObserverOutput, ProcessedObservation } from './types.js';
4
+ import type { ObservationPersistOutcome, ObservationRunOpts, ObserverOutput, ProcessedObservation } from './types.js';
5
5
  export declare class AsyncBufferObservationStrategy extends ObservationStrategy {
6
6
  private readonly startedAt;
7
7
  private readonly cycleId;
8
8
  private priorExtractedValues?;
9
+ /** The generation the chunk was written to (the head when the target was retired). */
10
+ private persistedRecordId?;
9
11
  constructor(deps: StrategyDeps, opts: ObservationRunOpts);
10
12
  get needsLock(): boolean;
11
13
  get needsReflection(): boolean;
@@ -16,7 +18,7 @@ export declare class AsyncBufferObservationStrategy extends ObservationStrategy
16
18
  existingObservations: string;
17
19
  }>;
18
20
  emitStartMarkers(_cycleId: string): Promise<void>;
19
- observe(existingObservations: string, messages: MastraDBMessage[]): Promise<{
21
+ observe(observerContext: string, messages: MastraDBMessage[], wasTruncated: boolean): Promise<{
20
22
  extractedValues: Record<string, unknown> | undefined;
21
23
  extractionFailures: import("../extracted-values").ExtractionFailure[] | undefined;
22
24
  observations: string;
@@ -32,8 +34,9 @@ export declare class AsyncBufferObservationStrategy extends ObservationStrategy
32
34
  providerMetadata?: import("@mastra/core/stream").ProviderMetadata;
33
35
  }>;
34
36
  process(output: ObserverOutput, _existingObservations: string): Promise<ProcessedObservation>;
35
- persist(processed: ProcessedObservation): Promise<boolean>;
36
- emitEndMarkers(_cycleId: string, processed: ProcessedObservation): Promise<void>;
37
+ persist(processed: ProcessedObservation): Promise<ObservationPersistOutcome | void>;
38
+ emitEndMarkers(): Promise<void>;
39
+ private emitBufferingEndMarker;
37
40
  emitFailedMarkers(_cycleId: string, error: unknown): Promise<void>;
38
41
  }
39
42
  //# sourceMappingURL=async-buffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"async-buffer.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/observation-strategies/async-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAgB1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SA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CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,oBAAoB,CAAC,CAA0B;IACvD,sFAAsF;IACtF,OAAO,CAAC,iBAAiB,CAAC,CAAS;gBAEvB,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB;IAMxD,IAAI,SAAS,YAEZ;IACD,IAAI,eAAe,YAElB;IACD,IAAI,gBAAgB,YAEnB;cAEkB,eAAe,IAAI,MAAM;IAItC,OAAO;;;;IAQP,gBAAgB,CAAC,QAAQ,EAAE,MAAM;IAIjC,OAAO,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,YAAY,EAAE,OAAO;;;;;;;;;uBAsCjF,CAAC;wBAAsB,CAAC;uBAC9B,CAAH;;;;IAQO,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA6C7F,OAAO,CAAC,SAAS,EAAE,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAuJnF,cAAc;YAIN,sBAAsB;IA8B9B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAsBzD"}