@mastra/pg 1.8.0 → 1.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Added dated message boundary delimiters when activating buffered observations for improved cache stability. ([#14367](https://github.com/mastra-ai/mastra/pull/14367))
8
+
9
+ - Updated dependencies [[`51970b3`](https://github.com/mastra-ai/mastra/commit/51970b3828494d59a8dd4df143b194d37d31e3f5), [`4444280`](https://github.com/mastra-ai/mastra/commit/444428094253e916ec077e66284e685fde67021e), [`085e371`](https://github.com/mastra-ai/mastra/commit/085e3718a7d0fe9a210fe7dd1c867b9bdfe8d16b), [`b77aa19`](https://github.com/mastra-ai/mastra/commit/b77aa1981361c021f2c881bee8f0c703687f00da), [`dbb879a`](https://github.com/mastra-ai/mastra/commit/dbb879af0b809c668e9b3a9d8bac97d806caa267), [`8b4ce84`](https://github.com/mastra-ai/mastra/commit/8b4ce84aed0808b9805cc4fd7147c1f8a2ef7a36), [`8d4cfe6`](https://github.com/mastra-ai/mastra/commit/8d4cfe6b9a7157d3876206227ec9f04cde6dbc4a), [`dd6ca1c`](https://github.com/mastra-ai/mastra/commit/dd6ca1cdea3b8b6182f4cf61df41070ba0cc0deb), [`ce26fe2`](https://github.com/mastra-ai/mastra/commit/ce26fe2166dd90254f8bee5776e55977143e97de), [`68a019d`](https://github.com/mastra-ai/mastra/commit/68a019d30d22251ddd628a2947d60215c03c350a), [`4cb4edf`](https://github.com/mastra-ai/mastra/commit/4cb4edf3c909d197ec356c1790d13270514ffef6), [`8de3555`](https://github.com/mastra-ai/mastra/commit/8de355572c6fd838f863a3e7e6fe24d0947b774f), [`b26307f`](https://github.com/mastra-ai/mastra/commit/b26307f050df39629511b0e831b8fc26973ce8b1), [`68a019d`](https://github.com/mastra-ai/mastra/commit/68a019d30d22251ddd628a2947d60215c03c350a)]:
10
+ - @mastra/core@1.14.0
11
+
12
+ ## 1.8.1-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Added dated message boundary delimiters when activating buffered observations for improved cache stability. ([#14367](https://github.com/mastra-ai/mastra/pull/14367))
17
+
18
+ - Updated dependencies [[`4444280`](https://github.com/mastra-ai/mastra/commit/444428094253e916ec077e66284e685fde67021e), [`dbb879a`](https://github.com/mastra-ai/mastra/commit/dbb879af0b809c668e9b3a9d8bac97d806caa267), [`8de3555`](https://github.com/mastra-ai/mastra/commit/8de355572c6fd838f863a3e7e6fe24d0947b774f)]:
19
+ - @mastra/core@1.14.0-alpha.2
20
+
3
21
  ## 1.8.0
4
22
 
5
23
  ### Minor Changes
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.8.0"
6
+ version: "1.8.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -17,7 +17,7 @@ Read the individual reference documents for detailed explanations and code examp
17
17
  ### Docs
18
18
 
19
19
  - [Semantic recall](references/docs-memory-semantic-recall.md) - Learn how to use semantic recall in Mastra to retrieve relevant messages from past conversations using vector search and embeddings.
20
- - [Storage](references/docs-memory-storage.md) - Configure storage for Mastra's memory system to persist conversations, workflows, and traces.
20
+ - [Storage](references/docs-memory-storage.md) - Configure storage for Mastra to persist conversations and other runtime state.
21
21
  - [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
22
22
  - [RAG (Retrieval-Augmented Generation) in Mastra](references/docs-rag-overview.md) - Overview of Retrieval-Augmented Generation (RAG) in Mastra, detailing its capabilities for enhancing LLM outputs with relevant context.
23
23
  - [Retrieval, semantic search, reranking](references/docs-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.0",
2
+ "version": "1.8.1",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -28,7 +28,7 @@ const agent = new Agent({
28
28
  id: 'support-agent',
29
29
  name: 'SupportAgent',
30
30
  instructions: 'You are a helpful support agent.',
31
- model: 'openai/gpt-5.1',
31
+ model: 'openai/gpt-5.4',
32
32
  memory: new Memory(),
33
33
  })
34
34
  ```
@@ -1,6 +1,6 @@
1
1
  # Storage
2
2
 
3
- For agents to remember previous interactions, Mastra needs a database. Use a storage adapter for one of the [supported databases](#supported-providers) and pass it to your Mastra instance.
3
+ For agents to remember previous interactions, Mastra needs a storage adapter. Use one of the [supported providers](#supported-providers) and pass it to your Mastra instance.
4
4
 
5
5
  ```typescript
6
6
  import { Mastra } from '@mastra/core'
@@ -24,7 +24,7 @@ export const mastra = new Mastra({
24
24
 
25
25
  This configures instance-level storage, which all agents share by default. You can also configure [agent-level storage](#agent-level-storage) for isolated data boundaries.
26
26
 
27
- Mastra automatically creates the necessary tables on first interaction. See the [core schema](https://mastra.ai/reference/storage/overview) for details on what gets created, including tables for messages, threads, resources, workflows, traces, and evaluation datasets.
27
+ Mastra automatically initializes the necessary storage structures on first interaction. See [Storage Overview](https://mastra.ai/reference/storage/overview) for domain coverage and the schema used by the built-in database-backed domains.
28
28
 
29
29
  ## Supported providers
30
30
 
@@ -35,7 +35,7 @@ Each provider page includes installation instructions, configuration parameters,
35
35
  - [MongoDB](https://mastra.ai/reference/storage/mongodb)
36
36
  - [Upstash](https://mastra.ai/reference/storage/upstash)
37
37
  - [Cloudflare D1](https://mastra.ai/reference/storage/cloudflare-d1)
38
- - [Cloudflare Durable Objects](https://mastra.ai/reference/storage/cloudflare)
38
+ - [Cloudflare KV & Durable Objects](https://mastra.ai/reference/storage/cloudflare)
39
39
  - [Convex](https://mastra.ai/reference/storage/convex)
40
40
  - [DynamoDB](https://mastra.ai/reference/storage/dynamodb)
41
41
  - [LanceDB](https://mastra.ai/reference/storage/lance)
@@ -49,7 +49,7 @@ Storage can be configured at the instance level (shared by all agents) or at the
49
49
 
50
50
  ### Instance-level storage
51
51
 
52
- Add storage to your Mastra instance so all agents, workflows, observability traces and scores share the same memory provider:
52
+ Add storage to your Mastra instance so all agents, workflows, observability traces, and scores share the same storage backend:
53
53
 
54
54
  ```typescript
55
55
  import { Mastra } from '@mastra/core'
@@ -71,7 +71,7 @@ This is useful when all primitives share the same storage backend and have simil
71
71
 
72
72
  #### Composite storage
73
73
 
74
- [Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to set the `memory` domain (and any other [domains](https://mastra.ai/reference/storage/composite) you need) to different storage providers.
74
+ [Composite storage](https://mastra.ai/reference/storage/composite) is an alternative way to configure instance-level storage. Use `MastraCompositeStore` to route `memory` and any other [supported domains](https://mastra.ai/reference/storage/composite) to different storage providers.
75
75
 
76
76
  ```typescript
77
77
  import { Mastra } from '@mastra/core'
@@ -180,7 +180,7 @@ export const agent = new Agent({
180
180
  memory: new Memory({
181
181
  options: {
182
182
  generateTitle: {
183
- model: 'openai/gpt-4o-mini',
183
+ model: 'openai/gpt-5-mini',
184
184
  instructions: 'Generate a 1 word title',
185
185
  },
186
186
  },
@@ -26,7 +26,7 @@ const agent = new Agent({
26
26
  id: 'personal-assistant',
27
27
  name: 'PersonalAssistant',
28
28
  instructions: 'You are a helpful personal assistant.',
29
- model: 'openai/gpt-5.1',
29
+ model: 'openai/gpt-5.4',
30
30
  memory: new Memory({
31
31
  options: {
32
32
  workingMemory: {
@@ -268,7 +268,7 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
268
268
  ## Choosing between template and schema
269
269
 
270
270
  - Use a **template** (Markdown) if you want the agent to maintain memory as a free-form text block, such as a user profile or scratchpad. Templates use **replace semantics** — the agent must provide the complete memory content on each update.
271
- - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
271
+ - Use a **schema** if you need structured, type-safe data that can be validated and programmatically accessed as JSON. The `workingMemory.schema` field accepts any `PublicSchema`-compatible schema (including Zod v3, Zod v4, JSON Schema, or already-standard schemas). Schemas use **merge semantics** — the agent only provides fields to update, and existing fields are preserved.
272
272
  - Only one mode can be active at a time: setting both `template` and `schema` isn't supported.
273
273
 
274
274
  ## Example: Multi-step retention
@@ -272,7 +272,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
272
272
  export const ragAgent = new Agent({
273
273
  id: 'rag-agent',
274
274
  name: 'RAG Agent',
275
- model: 'openai/gpt-5.1',
275
+ model: 'openai/gpt-5.4',
276
276
  instructions: `
277
277
  Process queries using the provided context. Structure responses to be concise and relevant.
278
278
  ${PGVECTOR_PROMPT}
@@ -289,7 +289,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
289
289
  export const ragAgent = new Agent({
290
290
  id: 'rag-agent',
291
291
  name: 'RAG Agent',
292
- model: 'openai/gpt-5.1',
292
+ model: 'openai/gpt-5.4',
293
293
  instructions: `
294
294
  Process queries using the provided context. Structure responses to be concise and relevant.
295
295
  ${PINECONE_PROMPT}
@@ -306,7 +306,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
306
306
  export const ragAgent = new Agent({
307
307
  id: 'rag-agent',
308
308
  name: 'RAG Agent',
309
- model: 'openai/gpt-5.1',
309
+ model: 'openai/gpt-5.4',
310
310
  instructions: `
311
311
  Process queries using the provided context. Structure responses to be concise and relevant.
312
312
  ${QDRANT_PROMPT}
@@ -323,7 +323,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
323
323
  export const ragAgent = new Agent({
324
324
  id: 'rag-agent',
325
325
  name: 'RAG Agent',
326
- model: 'openai/gpt-5.1',
326
+ model: 'openai/gpt-5.4',
327
327
  instructions: `
328
328
  Process queries using the provided context. Structure responses to be concise and relevant.
329
329
  ${CHROMA_PROMPT}
@@ -340,7 +340,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
340
340
  export const ragAgent = new Agent({
341
341
  id: 'rag-agent',
342
342
  name: 'RAG Agent',
343
- model: 'openai/gpt-5.1',
343
+ model: 'openai/gpt-5.4',
344
344
  instructions: `
345
345
  Process queries using the provided context. Structure responses to be concise and relevant.
346
346
  ${ASTRA_PROMPT}
@@ -357,7 +357,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
357
357
  export const ragAgent = new Agent({
358
358
  id: 'rag-agent',
359
359
  name: 'RAG Agent',
360
- model: 'openai/gpt-5.1',
360
+ model: 'openai/gpt-5.4',
361
361
  instructions: `
362
362
  Process queries using the provided context. Structure responses to be concise and relevant.
363
363
  ${LIBSQL_PROMPT}
@@ -374,7 +374,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
374
374
  export const ragAgent = new Agent({
375
375
  id: 'rag-agent',
376
376
  name: 'RAG Agent',
377
- model: 'openai/gpt-5.1',
377
+ model: 'openai/gpt-5.4',
378
378
  instructions: `
379
379
  Process queries using the provided context. Structure responses to be concise and relevant.
380
380
  ${UPSTASH_PROMPT}
@@ -391,7 +391,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
391
391
  export const ragAgent = new Agent({
392
392
  id: 'rag-agent',
393
393
  name: 'RAG Agent',
394
- model: 'openai/gpt-5.1',
394
+ model: 'openai/gpt-5.4',
395
395
  instructions: `
396
396
  Process queries using the provided context. Structure responses to be concise and relevant.
397
397
  ${VECTORIZE_PROMPT}
@@ -408,7 +408,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
408
408
  export const ragAgent = new Agent({
409
409
  id: 'rag-agent',
410
410
  name: 'RAG Agent',
411
- model: 'openai/gpt-5.1',
411
+ model: 'openai/gpt-5.4',
412
412
  instructions: `
413
413
  Process queries using the provided context. Structure responses to be concise and relevant.
414
414
  ${MONGODB_PROMPT}
@@ -425,7 +425,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
425
425
  export const ragAgent = new Agent({
426
426
  id: 'rag-agent',
427
427
  name: 'RAG Agent',
428
- model: 'openai/gpt-5.1',
428
+ model: 'openai/gpt-5.4',
429
429
  instructions: `
430
430
  Process queries using the provided context. Structure responses to be concise and relevant.
431
431
  ${OPENSEARCH_PROMPT}
@@ -442,7 +442,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
442
442
  export const ragAgent = new Agent({
443
443
  id: 'rag-agent',
444
444
  name: 'RAG Agent',
445
- model: 'openai/gpt-5.1',
445
+ model: 'openai/gpt-5.4',
446
446
  instructions: `
447
447
  Process queries using the provided context. Structure responses to be concise and relevant.
448
448
  ${S3VECTORS_PROMPT}
@@ -472,7 +472,7 @@ const initialResults = await pgVector.query({
472
472
  })
473
473
 
474
474
  // Create a relevance scorer
475
- const relevanceProvider = new MastraAgentRelevanceScorer('relevance-scorer', 'openai/gpt-5.1')
475
+ const relevanceProvider = new MastraAgentRelevanceScorer('relevance-scorer', 'openai/gpt-5.4')
476
476
 
477
477
  // Re-rank the results
478
478
  const rerankedResults = await rerank({
@@ -11,7 +11,7 @@ import { Agent } from '@mastra/core/agent'
11
11
  export const agent = new Agent({
12
12
  name: 'test-agent',
13
13
  instructions: 'You are an agent with memory.',
14
- model: 'openai/gpt-5.1',
14
+ model: 'openai/gpt-5.4',
15
15
  memory: new Memory({
16
16
  options: {
17
17
  workingMemory: {
@@ -60,7 +60,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
60
60
  export const agent = new Agent({
61
61
  name: 'test-agent',
62
62
  instructions: 'You are an agent with memory.',
63
- model: 'openai/gpt-5.1',
63
+ model: 'openai/gpt-5.4',
64
64
  memory: new Memory({
65
65
  storage: new LibSQLStore({
66
66
  id: 'test-agent-storage',
@@ -97,7 +97,7 @@ import { PgStore, PgVector } from '@mastra/pg'
97
97
  export const agent = new Agent({
98
98
  name: 'pg-agent',
99
99
  instructions: 'You are an agent with optimized PostgreSQL memory.',
100
- model: 'openai/gpt-5.1',
100
+ model: 'openai/gpt-5.4',
101
101
  memory: new Memory({
102
102
  storage: new PgStore({
103
103
  id: 'pg-agent-storage',
@@ -58,7 +58,7 @@ bun add @mastra/pg@latest @mastra/libsql@latest
58
58
 
59
59
  ## Storage domains
60
60
 
61
- Mastra organizes storage into five specialized domains, each handling a specific type of data. Each domain can be backed by a different storage adapter, and domain classes are exported from each storage package.
61
+ Mastra organizes storage into domains, each handling a specific type of data. Each domain can be backed by a different storage adapter, and domain classes are exported from each storage package.
62
62
 
63
63
  | Domain | Description |
64
64
  | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -67,6 +67,10 @@ Mastra organizes storage into five specialized domains, each handling a specific
67
67
  | `scores` | Evaluation results from Mastra's evals system. Scores and metrics are persisted here for analysis and comparison over time. |
68
68
  | `observability` | Telemetry data including traces and spans. Agent interactions, tool calls, and LLM requests generate spans collected into traces for debugging and performance analysis. |
69
69
  | `agents` | Agent configurations for stored agents. Enables agents to be defined and updated at runtime without code deployments. |
70
+ | `datasets` | Evaluation datasets used for experiment runs. Stores dataset definitions, schemas, and versioned items. |
71
+ | `experiments` | Experiment runs and per-item experiment results linked to datasets and targets. |
72
+
73
+ > **Note:** `MastraCompositeStore` accepts all of the domain keys above, but storage adapter support varies by package. You can mix adapters per domain, but only for domains implemented and exported by those adapters. For example, `memory: new MemoryLibSQL(...)` and `workflows: new WorkflowsPG(...)` is valid because both packages export those domain classes.
70
74
 
71
75
  ## Usage
72
76
 
@@ -124,7 +128,9 @@ export const mastra = new Mastra({
124
128
 
125
129
  **default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in \`domains\` will use this storage's domains as fallbacks.
126
130
 
127
- **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over the default storage.
131
+ **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
132
+
133
+ **domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both \`editor\` and \`default\` storage.
128
134
 
129
135
  **domains.memory** (`MemoryStorage`): Storage for threads, messages, and resources.
130
136
 
@@ -136,7 +142,9 @@ export const mastra = new Mastra({
136
142
 
137
143
  **domains.agents** (`AgentsStorage`): Storage for stored agent configurations.
138
144
 
139
- **disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
145
+ **domains.datasets** (`DatasetsStorage`): Storage for dataset metadata, dataset items, and dataset versions.
146
+
147
+ **domains.experiments** (`ExperimentsStorage`): Storage for experiment runs and per-item experiment results.
140
148
 
141
149
  ## Initialization
142
150
 
@@ -332,7 +332,7 @@ export const pgAgent = new Agent({
332
332
  name: 'PG Agent',
333
333
  instructions:
334
334
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
335
- model: 'openai/gpt-5.1',
335
+ model: 'openai/gpt-5.4',
336
336
  memory: new Memory({
337
337
  storage: new PostgresStore({
338
338
  id: 'pg-agent-storage',
@@ -142,7 +142,7 @@ const queryTool = createVectorQueryTool({
142
142
  indexName: 'documentation',
143
143
  model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
144
144
  reranker: {
145
- model: 'openai/gpt-5.1',
145
+ model: 'openai/gpt-5.4',
146
146
  options: {
147
147
  weights: {
148
148
  semantic: 0.5, // Semantic relevance weight
@@ -399,7 +399,7 @@ export const pgAgent = new Agent({
399
399
  name: 'PG Agent',
400
400
  instructions:
401
401
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
402
- model: 'openai/gpt-5.1',
402
+ model: 'openai/gpt-5.4',
403
403
  memory: new Memory({
404
404
  storage: new PostgresStore({
405
405
  id: 'pg-agent-storage',
package/dist/index.cjs CHANGED
@@ -10,9 +10,11 @@ var xxhash = require('xxhash-wasm');
10
10
  var filter = require('@mastra/core/vector/filter');
11
11
  var base = require('@mastra/core/base');
12
12
  var crypto$1 = require('crypto');
13
+ var module$1 = require('module');
13
14
  var agent = require('@mastra/core/agent');
14
15
  var evals = require('@mastra/core/evals');
15
16
 
17
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
16
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
19
 
18
20
  function _interopNamespace(e) {
@@ -6921,7 +6923,8 @@ var MCPServersPG = class _MCPServersPG extends storage.MCPServersStorage {
6921
6923
  var OM_TABLE = "mastra_observational_memory";
6922
6924
  var _omTableSchema;
6923
6925
  try {
6924
- const storage = __require("@mastra/core/storage");
6926
+ const __require2 = typeof __require === "function" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
6927
+ const storage = __require2("@mastra/core/storage");
6925
6928
  _omTableSchema = storage.OBSERVATIONAL_MEMORY_TABLE_SCHEMA;
6926
6929
  } catch {
6927
6930
  }
@@ -8995,15 +8998,15 @@ var MemoryPG = class _MemoryPG extends storage.MemoryStorage {
8995
8998
  let bestUnderTokens = 0;
8996
8999
  for (let i = 0; i < chunks.length; i++) {
8997
9000
  cumulativeMessageTokens += chunks[i].messageTokens ?? 0;
8998
- const boundary = i + 1;
9001
+ const boundary2 = i + 1;
8999
9002
  if (cumulativeMessageTokens >= targetMessageTokens) {
9000
9003
  if (bestOverBoundary === 0 || cumulativeMessageTokens < bestOverTokens) {
9001
- bestOverBoundary = boundary;
9004
+ bestOverBoundary = boundary2;
9002
9005
  bestOverTokens = cumulativeMessageTokens;
9003
9006
  }
9004
9007
  } else {
9005
9008
  if (cumulativeMessageTokens > bestUnderTokens) {
9006
- bestUnderBoundary = boundary;
9009
+ bestUnderBoundary = boundary2;
9007
9010
  bestUnderTokens = cumulativeMessageTokens;
9008
9011
  }
9009
9012
  }
@@ -9035,11 +9038,16 @@ var MemoryPG = class _MemoryPG extends storage.MemoryStorage {
9035
9038
  const latestChunk = activatedChunks[activatedChunks.length - 1];
9036
9039
  const lastObservedAt = input.lastObservedAt ?? (latestChunk?.lastObservedAt ? new Date(latestChunk.lastObservedAt) : /* @__PURE__ */ new Date());
9037
9040
  const lastObservedAtStr = lastObservedAt.toISOString();
9041
+ const boundary = `
9042
+
9043
+ --- message boundary (${lastObservedAt.toISOString()}) ---
9044
+
9045
+ `;
9038
9046
  await this.#db.client.query(
9039
9047
  `UPDATE ${tableName} SET
9040
9048
  "activeObservations" = CASE
9041
9049
  WHEN "activeObservations" IS NOT NULL AND "activeObservations" != ''
9042
- THEN "activeObservations" || E'\\n\\n' || $1
9050
+ THEN "activeObservations" || $10 || $1
9043
9051
  ELSE $1
9044
9052
  END,
9045
9053
  "observationTokenCount" = COALESCE("observationTokenCount", 0) + $2,
@@ -9059,7 +9067,8 @@ var MemoryPG = class _MemoryPG extends storage.MemoryStorage {
9059
9067
  lastObservedAtStr,
9060
9068
  nowStr,
9061
9069
  nowStr,
9062
- input.id
9070
+ input.id,
9071
+ boundary
9063
9072
  ]
9064
9073
  );
9065
9074
  const latestChunkHints = activatedChunks[activatedChunks.length - 1];