@mastra/mongodb 1.24.1-alpha.0 → 1.24.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/dist/_types/@internal_core/dist/memory/index.d.ts +0 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +9 -3
- package/dist/docs/references/reference-rag-retrieval.md +11 -0
- package/dist/docs/references/reference-storage-retention.md +1 -1
- package/dist/docs/references/reference-vectors-mongodb.md +6 -6
- package/dist/index.cjs +32 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -62
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/vector/filter.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/memory/index.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Shared rules for observational memory lifecycle writes. Every storage adapter applies
|
|
4
3
|
* these inside its own atomic section (lock, transaction, or conditional update), so the
|
|
@@ -97,5 +96,4 @@ export declare function assertActiveObservationsApplied(result: UpdateActiveObse
|
|
|
97
96
|
* (equal, or only appended to since).
|
|
98
97
|
*/
|
|
99
98
|
export declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
|
|
100
|
-
//#endregion
|
|
101
99
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
# Semantic recall
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Semantic recall is a built-in form of Retrieval-Augmented Generation (RAG) for agent memory. When a user sends a message, Mastra searches earlier messages for ones with a similar meaning and adds the most relevant ones to the agent's context.
|
|
8
|
+
|
|
9
|
+
Matching on meaning matters because people often remember the idea behind something, not the exact words they used. A user might ask "What did we decide about the refund?" after originally writing "Let's give them their money back." A keyword search misses that connection, but semantic recall finds it.
|
|
10
|
+
|
|
11
|
+
Use semantic recall when your agent needs details from earlier in a long conversation, or from a user's other conversations, that are no longer in [recent message history](https://mastra.ai/docs/memory/message-history).
|
|
8
12
|
|
|
9
13
|
> **📹 Watch:** Watch [Mastra semantic recall](https://www.youtube.com/watch?v=UVZtK8cK8xQ\&pp=ygUVbWFzdHJhIHdvcmtpbmcgbWVtb3J5) to see how agents retrieve relevant messages from past conversations.
|
|
10
14
|
|
|
@@ -452,8 +456,10 @@ const agent = new Agent({
|
|
|
452
456
|
indexConfig: {
|
|
453
457
|
type: 'hnsw', // Use HNSW for better performance
|
|
454
458
|
metric: 'dotproduct', // Best for OpenAI embeddings
|
|
455
|
-
|
|
456
|
-
|
|
459
|
+
hnsw: {
|
|
460
|
+
m: 16, // Number of bi-directional links (default: 16)
|
|
461
|
+
efConstruction: 64, // Size of candidate list during construction (default: 64)
|
|
462
|
+
},
|
|
457
463
|
},
|
|
458
464
|
},
|
|
459
465
|
},
|
|
@@ -382,6 +382,7 @@ Vector store prompts define query patterns and filtering capabilities for each v
|
|
|
382
382
|
|
|
383
383
|
```ts
|
|
384
384
|
import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
385
|
+
import { Agent } from '@mastra/core/agent'
|
|
385
386
|
|
|
386
387
|
export const ragAgent = new Agent({
|
|
387
388
|
id: 'rag-agent',
|
|
@@ -416,6 +417,7 @@ export const ragAgent = new Agent({
|
|
|
416
417
|
|
|
417
418
|
```ts
|
|
418
419
|
import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
420
|
+
import { Agent } from '@mastra/core/agent'
|
|
419
421
|
|
|
420
422
|
export const ragAgent = new Agent({
|
|
421
423
|
id: 'rag-agent',
|
|
@@ -433,6 +435,7 @@ export const ragAgent = new Agent({
|
|
|
433
435
|
|
|
434
436
|
```ts
|
|
435
437
|
import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
438
|
+
import { Agent } from '@mastra/core/agent'
|
|
436
439
|
|
|
437
440
|
export const ragAgent = new Agent({
|
|
438
441
|
id: 'rag-agent',
|
|
@@ -450,6 +453,7 @@ export const ragAgent = new Agent({
|
|
|
450
453
|
|
|
451
454
|
```ts
|
|
452
455
|
import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
456
|
+
import { Agent } from '@mastra/core/agent'
|
|
453
457
|
|
|
454
458
|
export const ragAgent = new Agent({
|
|
455
459
|
id: 'rag-agent',
|
|
@@ -467,6 +471,7 @@ export const ragAgent = new Agent({
|
|
|
467
471
|
|
|
468
472
|
```ts
|
|
469
473
|
import { ASTRA_PROMPT } from '@mastra/astra'
|
|
474
|
+
import { Agent } from '@mastra/core/agent'
|
|
470
475
|
|
|
471
476
|
export const ragAgent = new Agent({
|
|
472
477
|
id: 'rag-agent',
|
|
@@ -484,6 +489,7 @@ export const ragAgent = new Agent({
|
|
|
484
489
|
|
|
485
490
|
```ts
|
|
486
491
|
import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
492
|
+
import { Agent } from '@mastra/core/agent'
|
|
487
493
|
|
|
488
494
|
export const ragAgent = new Agent({
|
|
489
495
|
id: 'rag-agent',
|
|
@@ -501,6 +507,7 @@ export const ragAgent = new Agent({
|
|
|
501
507
|
|
|
502
508
|
```ts
|
|
503
509
|
import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
510
|
+
import { Agent } from '@mastra/core/agent'
|
|
504
511
|
|
|
505
512
|
export const ragAgent = new Agent({
|
|
506
513
|
id: 'rag-agent',
|
|
@@ -518,6 +525,7 @@ export const ragAgent = new Agent({
|
|
|
518
525
|
|
|
519
526
|
```ts
|
|
520
527
|
import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
528
|
+
import { Agent } from '@mastra/core/agent'
|
|
521
529
|
|
|
522
530
|
export const ragAgent = new Agent({
|
|
523
531
|
id: 'rag-agent',
|
|
@@ -535,6 +543,7 @@ export const ragAgent = new Agent({
|
|
|
535
543
|
|
|
536
544
|
```ts
|
|
537
545
|
import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
546
|
+
import { Agent } from '@mastra/core/agent'
|
|
538
547
|
|
|
539
548
|
export const ragAgent = new Agent({
|
|
540
549
|
id: 'rag-agent',
|
|
@@ -552,6 +561,7 @@ export const ragAgent = new Agent({
|
|
|
552
561
|
|
|
553
562
|
```ts
|
|
554
563
|
import { ORACLEDB_PROMPT } from '@mastra/oracledb'
|
|
564
|
+
import { Agent } from '@mastra/core/agent'
|
|
555
565
|
|
|
556
566
|
export const ragAgent = new Agent({
|
|
557
567
|
id: 'rag-agent',
|
|
@@ -569,6 +579,7 @@ export const ragAgent = new Agent({
|
|
|
569
579
|
|
|
570
580
|
```ts
|
|
571
581
|
import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
582
|
+
import { Agent } from '@mastra/core/agent'
|
|
572
583
|
|
|
573
584
|
export const ragAgent = new Agent({
|
|
574
585
|
id: 'rag-agent',
|
|
@@ -294,7 +294,7 @@ const storage = new MongoDBStore({
|
|
|
294
294
|
|
|
295
295
|
## Reclaiming disk
|
|
296
296
|
|
|
297
|
-
`prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist
|
|
297
|
+
`prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist for reuse by future writes. Reusing these pages prevents unbounded file growth for most users.
|
|
298
298
|
|
|
299
299
|
Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically. A manual `VACUUM FULL` is only needed if you must return disk to the OS.
|
|
300
300
|
|
|
@@ -97,7 +97,7 @@ Creates a new vector index (collection) in MongoDB.
|
|
|
97
97
|
|
|
98
98
|
**collectionName** (`string`): Store the vectors on an existing (operational) collection instead of a managed collection named after the index. The collection is never created or dropped by this store when set. Defaults to indexName.
|
|
99
99
|
|
|
100
|
-
**searchIndexName** (`string`): Name for the MongoDB vectorSearch index created on the collection. Defaults to ${indexName}\
|
|
100
|
+
**searchIndexName** (`string`): Name for the MongoDB vectorSearch index created on the collection. Defaults to ${indexName}\_vector_index.
|
|
101
101
|
|
|
102
102
|
**allowWrites** (`boolean`): Opt-in to write operations (upsert, updateVector, deleteVector, deleteVectors) on a bring-your-own collection. By default a BYO index is read-only: the store never modifies or deletes caller-owned operational documents. Ignored for managed collections, which are always writable. The policy is persisted with the index registration and survives restarts. (Default: `false`)
|
|
103
103
|
|
|
@@ -178,7 +178,7 @@ await store.createSearchIndex({
|
|
|
178
178
|
})
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes.
|
|
181
|
+
The field-mapped index name includes the logical `indexName`, so two logical indexes on the same collection get distinct text indexes. Calling `createSearchIndex()` again for the _same_ logical index with different `fields` updates the existing text index definition in place. You don't need to drop it first.
|
|
182
182
|
|
|
183
183
|
### `waitForSearchIndexReady()`
|
|
184
184
|
|
|
@@ -279,18 +279,18 @@ Returns:
|
|
|
279
279
|
interface IndexStats {
|
|
280
280
|
dimension: number
|
|
281
281
|
count: number
|
|
282
|
-
metric
|
|
282
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct'
|
|
283
283
|
}
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
-
On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
|
|
286
|
+
On an `autoEmbed` index, `dimension` is read from the index definition and reports MongoDB's default of `1024` when the index doesn't pin one. `metric` is omitted when the `autoEmbed` index doesn't specify a similarity. `count` counts documents that carry the embedded text field, since the generated vectors aren't stored on your documents.
|
|
287
287
|
|
|
288
288
|
### `deleteIndex()`
|
|
289
289
|
|
|
290
290
|
Deletes a vector index. Behavior depends on how the index was created:
|
|
291
291
|
|
|
292
292
|
- **Managed index** (created without `collectionName`): drops the entire collection and all its data.
|
|
293
|
-
- **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
|
|
293
|
+
- **Bring-your-own index** (created with `collectionName`): drops the MongoDB vectorSearch index. If `createSearchIndex()` provisioned a companion full-text search index, it drops that index too. A vectorSearch or full-text index that another logical index on the same collection still references is kept for that index. The caller's operational collection and its documents are preserved. This store never drops a collection it didn't create.
|
|
294
294
|
|
|
295
295
|
The BYO classification is recorded durably when the index is created, so it's applied correctly even by a different process (e.g. an index created by a setup job and later deleted by a long-lived service). Always pass the **logical index name** (the `indexName` used at `createIndex`), not the physical collection name.
|
|
296
296
|
|
|
@@ -350,7 +350,7 @@ Query results are returned in this format:
|
|
|
350
350
|
interface QueryResult {
|
|
351
351
|
id: string
|
|
352
352
|
score: number
|
|
353
|
-
metadata
|
|
353
|
+
metadata?: Record<string, any>
|
|
354
354
|
vector?: number[] // Only included if includeVector is true
|
|
355
355
|
document?: string // Source text stored with the vector, when available
|
|
356
356
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -9,10 +9,9 @@ let crypto$1 = require("crypto");
|
|
|
9
9
|
let _mastra_core_agent = require("@mastra/core/agent");
|
|
10
10
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
11
11
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
12
|
-
|
|
13
|
-
var version = "1.24.1
|
|
14
|
-
|
|
15
|
-
//#region src/vector/filter.ts
|
|
12
|
+
// package.json
|
|
13
|
+
var version = "1.24.1";
|
|
14
|
+
// src/vector/filter.ts
|
|
16
15
|
/**
|
|
17
16
|
* Translator for MongoDB filter queries.
|
|
18
17
|
* Maintains MongoDB-compatible syntax while ensuring proper validation
|
|
@@ -47,10 +46,9 @@ var MongoDBFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
|
|
|
47
46
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("$not operator requires an object");
|
|
48
47
|
if (this.isEmpty(value)) throw new Error("$not operator cannot be empty");
|
|
49
48
|
return this.translateNode(value);
|
|
50
|
-
} else {
|
|
51
|
-
if (!Array.isArray(value)) throw new Error(`Value for logical operator ${operator} must be an array`);
|
|
52
|
-
return value.map((item) => this.translateNode(item));
|
|
53
49
|
}
|
|
50
|
+
if (!Array.isArray(value)) throw new Error(`Value for logical operator ${operator} must be an array`);
|
|
51
|
+
return value.map((item) => this.translateNode(item));
|
|
54
52
|
}
|
|
55
53
|
if (this.isBasicOperator(operator) || this.isNumericOperator(operator)) {
|
|
56
54
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -82,8 +80,7 @@ var MongoDBFilterTranslator = class extends _mastra_core_vector_filter.BaseFilte
|
|
|
82
80
|
return filter === void 0 || filter === null || typeof filter === "object" && Object.keys(filter).length === 0;
|
|
83
81
|
}
|
|
84
82
|
};
|
|
85
|
-
|
|
86
|
-
//#region src/vector/index.ts
|
|
83
|
+
// src/vector/index.ts
|
|
87
84
|
/** Name an index's embedding mode for a conflict message. */
|
|
88
85
|
function describeEmbedding(config) {
|
|
89
86
|
return config ? `autoEmbed (path "${config.path}", model "${config.model}")` : "client-side vectors";
|
|
@@ -1566,8 +1563,7 @@ var MongoDBVector = class MongoDBVector extends _mastra_core_vector.MastraVector
|
|
|
1566
1563
|
return true;
|
|
1567
1564
|
}
|
|
1568
1565
|
};
|
|
1569
|
-
|
|
1570
|
-
//#region src/storage/connectors/MongoDBConnector.ts
|
|
1566
|
+
// src/storage/connectors/MongoDBConnector.ts
|
|
1571
1567
|
var MongoDBConnector = class MongoDBConnector {
|
|
1572
1568
|
#client;
|
|
1573
1569
|
#dbName;
|
|
@@ -1678,8 +1674,7 @@ var MongoDBConnector = class MongoDBConnector {
|
|
|
1678
1674
|
if (this.#handler) await this.#handler.close();
|
|
1679
1675
|
}
|
|
1680
1676
|
};
|
|
1681
|
-
|
|
1682
|
-
//#region src/storage/db/index.ts
|
|
1677
|
+
// src/storage/db/index.ts
|
|
1683
1678
|
/**
|
|
1684
1679
|
* Resolves a config to a MongoDBConnector instance.
|
|
1685
1680
|
* Accepts both MongoDBConfig (main store) and MongoDBDomainConfig (domains).
|
|
@@ -1724,8 +1719,7 @@ function resolveMongoDBConfig(config) {
|
|
|
1724
1719
|
}, error);
|
|
1725
1720
|
}
|
|
1726
1721
|
}
|
|
1727
|
-
|
|
1728
|
-
//#region src/storage/domains/agents/index.ts
|
|
1722
|
+
// src/storage/domains/agents/index.ts
|
|
1729
1723
|
/**
|
|
1730
1724
|
* The set of fields from StorageAgentSnapshotType that live on version rows.
|
|
1731
1725
|
* Used to strip snapshot config from version documents when transforming.
|
|
@@ -2423,8 +2417,7 @@ function resolveTargets({ policies, descriptor, order, encodings }) {
|
|
|
2423
2417
|
}
|
|
2424
2418
|
return targets;
|
|
2425
2419
|
}
|
|
2426
|
-
|
|
2427
|
-
//#region src/storage/domains/background-tasks/index.ts
|
|
2420
|
+
// src/storage/domains/background-tasks/index.ts
|
|
2428
2421
|
function toDoc(task) {
|
|
2429
2422
|
return {
|
|
2430
2423
|
id: task.id,
|
|
@@ -2674,8 +2667,7 @@ var BackgroundTasksStorageMongoDB = class BackgroundTasksStorageMongoDB extends
|
|
|
2674
2667
|
});
|
|
2675
2668
|
}
|
|
2676
2669
|
};
|
|
2677
|
-
|
|
2678
|
-
//#region src/storage/domains/blobs/index.ts
|
|
2670
|
+
// src/storage/domains/blobs/index.ts
|
|
2679
2671
|
var MongoDBBlobStore = class MongoDBBlobStore extends _mastra_core_storage.BlobStore {
|
|
2680
2672
|
#connector;
|
|
2681
2673
|
#skipDefaultIndexes;
|
|
@@ -2832,8 +2824,7 @@ var MongoDBBlobStore = class MongoDBBlobStore extends _mastra_core_storage.BlobS
|
|
|
2832
2824
|
};
|
|
2833
2825
|
}
|
|
2834
2826
|
};
|
|
2835
|
-
|
|
2836
|
-
//#region src/storage/domains/utils.ts
|
|
2827
|
+
// src/storage/domains/utils.ts
|
|
2837
2828
|
function formatDateForMongoDB(date) {
|
|
2838
2829
|
return typeof date === "string" ? new Date(date) : date;
|
|
2839
2830
|
}
|
|
@@ -2850,8 +2841,7 @@ function applyTenancyFilter(filter, filters) {
|
|
|
2850
2841
|
if (filters.organizationId !== void 0) filter.organizationId = filters.organizationId;
|
|
2851
2842
|
if (filters.projectId !== void 0) filter.projectId = filters.projectId;
|
|
2852
2843
|
}
|
|
2853
|
-
|
|
2854
|
-
//#region src/storage/domains/datasets/index.ts
|
|
2844
|
+
// src/storage/domains/datasets/index.ts
|
|
2855
2845
|
const MANAGED_COLLECTIONS = [
|
|
2856
2846
|
_mastra_core_storage.TABLE_DATASETS,
|
|
2857
2847
|
_mastra_core_storage.TABLE_DATASET_ITEMS,
|
|
@@ -4037,8 +4027,7 @@ var MongoDBDatasetsStorage = class extends _mastra_core_storage.DatasetsStorage
|
|
|
4037
4027
|
}, failures[0].reason);
|
|
4038
4028
|
}
|
|
4039
4029
|
};
|
|
4040
|
-
|
|
4041
|
-
//#region src/storage/domains/experiments/index.ts
|
|
4030
|
+
// src/storage/domains/experiments/index.ts
|
|
4042
4031
|
function toDate(value) {
|
|
4043
4032
|
if (value instanceof Date) return value;
|
|
4044
4033
|
if (typeof value === "string" || typeof value === "number") return new Date(value);
|
|
@@ -4770,8 +4759,7 @@ var MongoDBExperimentsStorage = class MongoDBExperimentsStorage extends _mastra_
|
|
|
4770
4759
|
} catch {}
|
|
4771
4760
|
}
|
|
4772
4761
|
};
|
|
4773
|
-
|
|
4774
|
-
//#region src/storage/domains/knowledge/index.ts
|
|
4762
|
+
// src/storage/domains/knowledge/index.ts
|
|
4775
4763
|
let assertDescriptionWithinBound;
|
|
4776
4764
|
async function assertKnowledgeDescriptionWithinBoundCompat(description) {
|
|
4777
4765
|
let assertWithinBound = assertDescriptionWithinBound;
|
|
@@ -5612,8 +5600,7 @@ var KnowledgeMongoDB = class KnowledgeMongoDB extends _mastra_core_storage.Knowl
|
|
|
5612
5600
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5613
5601
|
}
|
|
5614
5602
|
};
|
|
5615
|
-
|
|
5616
|
-
//#region src/storage/domains/mcp-clients/index.ts
|
|
5603
|
+
// src/storage/domains/mcp-clients/index.ts
|
|
5617
5604
|
/**
|
|
5618
5605
|
* Snapshot config fields that live on MCP client version documents.
|
|
5619
5606
|
*/
|
|
@@ -6058,8 +6045,7 @@ var MongoDBMCPClientsStorage = class MongoDBMCPClientsStorage extends _mastra_co
|
|
|
6058
6045
|
return result;
|
|
6059
6046
|
}
|
|
6060
6047
|
};
|
|
6061
|
-
|
|
6062
|
-
//#region src/storage/domains/mcp-servers/index.ts
|
|
6048
|
+
// src/storage/domains/mcp-servers/index.ts
|
|
6063
6049
|
/**
|
|
6064
6050
|
* Snapshot config fields that live on MCP server version documents.
|
|
6065
6051
|
*/
|
|
@@ -6514,8 +6500,7 @@ var MongoDBMCPServersStorage = class MongoDBMCPServersStorage extends _mastra_co
|
|
|
6514
6500
|
return result;
|
|
6515
6501
|
}
|
|
6516
6502
|
};
|
|
6517
|
-
|
|
6518
|
-
//#region ../../packages/_internal-core/dist/memory/index.js
|
|
6503
|
+
// ../../packages/_internal-core/dist/memory/index.js
|
|
6519
6504
|
/**
|
|
6520
6505
|
* A buffered chunk stores `lastObservedAt = max message time + 1ms`. It is wholly covered
|
|
6521
6506
|
* (every message it observed is already at or before the cursor) iff
|
|
@@ -6579,8 +6564,7 @@ function isAppendOnlySince(storedObservations, snapshotObservations) {
|
|
|
6579
6564
|
const snapshot = snapshotObservations ?? "";
|
|
6580
6565
|
return stored === snapshot || stored.startsWith(snapshot);
|
|
6581
6566
|
}
|
|
6582
|
-
|
|
6583
|
-
//#region src/storage/domains/run-fencing.ts
|
|
6567
|
+
// src/storage/domains/run-fencing.ts
|
|
6584
6568
|
async function getRunClaims(connector, name) {
|
|
6585
6569
|
return await connector.getCollection(name);
|
|
6586
6570
|
}
|
|
@@ -6613,8 +6597,7 @@ async function withRunFence(connector, check, write) {
|
|
|
6613
6597
|
return write(session);
|
|
6614
6598
|
});
|
|
6615
6599
|
}
|
|
6616
|
-
|
|
6617
|
-
//#region src/storage/domains/memory/index.ts
|
|
6600
|
+
// src/storage/domains/memory/index.ts
|
|
6618
6601
|
/**
|
|
6619
6602
|
* Local constant for the observational memory table name.
|
|
6620
6603
|
* Defined locally to avoid a static import that crashes on older @mastra/core
|
|
@@ -8731,8 +8714,7 @@ var MemoryStorageMongoDB = class MemoryStorageMongoDB extends _mastra_core_stora
|
|
|
8731
8714
|
}
|
|
8732
8715
|
}
|
|
8733
8716
|
};
|
|
8734
|
-
|
|
8735
|
-
//#region src/storage/domains/notifications/index.ts
|
|
8717
|
+
// src/storage/domains/notifications/index.ts
|
|
8736
8718
|
/** Ids per updateMany/find command — keeps the `$in` filter far below MongoDB's 16 MiB BSON limit. */
|
|
8737
8719
|
const BULK_ID_BATCH_SIZE = 500;
|
|
8738
8720
|
const statusTimestamp = (status, now) => {
|
|
@@ -9110,8 +9092,7 @@ const dueTime = (record) => {
|
|
|
9110
9092
|
if (deliverAt !== void 0 && summaryAt !== void 0) return Math.min(deliverAt, summaryAt);
|
|
9111
9093
|
return deliverAt ?? summaryAt ?? Number.POSITIVE_INFINITY;
|
|
9112
9094
|
};
|
|
9113
|
-
|
|
9114
|
-
//#region src/storage/domains/observability/index.ts
|
|
9095
|
+
// src/storage/domains/observability/index.ts
|
|
9115
9096
|
var ObservabilityMongoDB = class ObservabilityMongoDB extends _mastra_core_storage.ObservabilityStorage {
|
|
9116
9097
|
#connector;
|
|
9117
9098
|
#skipDefaultIndexes;
|
|
@@ -9783,8 +9764,7 @@ MIGRATION REQUIRED: Duplicate spans detected in ${_mastra_core_storage.TABLE_SPA
|
|
|
9783
9764
|
return span;
|
|
9784
9765
|
}
|
|
9785
9766
|
};
|
|
9786
|
-
|
|
9787
|
-
//#region src/storage/domains/prompt-blocks/index.ts
|
|
9767
|
+
// src/storage/domains/prompt-blocks/index.ts
|
|
9788
9768
|
/**
|
|
9789
9769
|
* Snapshot config fields that live on prompt block version documents.
|
|
9790
9770
|
*/
|
|
@@ -10231,8 +10211,7 @@ var MongoDBPromptBlocksStorage = class MongoDBPromptBlocksStorage extends _mastr
|
|
|
10231
10211
|
return result;
|
|
10232
10212
|
}
|
|
10233
10213
|
};
|
|
10234
|
-
|
|
10235
|
-
//#region src/storage/domains/schedules/index.ts
|
|
10214
|
+
// src/storage/domains/schedules/index.ts
|
|
10236
10215
|
function scheduleToDoc(schedule) {
|
|
10237
10216
|
return {
|
|
10238
10217
|
id: schedule.id,
|
|
@@ -10486,8 +10465,7 @@ var SchedulesMongoDB = class SchedulesMongoDB extends _mastra_core_storage.Sched
|
|
|
10486
10465
|
return (await cursor.toArray()).map(docToTrigger);
|
|
10487
10466
|
}
|
|
10488
10467
|
};
|
|
10489
|
-
|
|
10490
|
-
//#region src/storage/domains/scorer-definitions/index.ts
|
|
10468
|
+
// src/storage/domains/scorer-definitions/index.ts
|
|
10491
10469
|
/**
|
|
10492
10470
|
* Snapshot config fields that live on scorer definition version documents.
|
|
10493
10471
|
*/
|
|
@@ -10937,8 +10915,7 @@ var MongoDBScorerDefinitionsStorage = class MongoDBScorerDefinitionsStorage exte
|
|
|
10937
10915
|
return result;
|
|
10938
10916
|
}
|
|
10939
10917
|
};
|
|
10940
|
-
|
|
10941
|
-
//#region src/storage/domains/scores/index.ts
|
|
10918
|
+
// src/storage/domains/scores/index.ts
|
|
10942
10919
|
/**
|
|
10943
10920
|
* MongoDB-specific score row transformation.
|
|
10944
10921
|
* Converts timestamp strings to Date objects.
|
|
@@ -11314,8 +11291,7 @@ var ScoresStorageMongoDB = class ScoresStorageMongoDB extends _mastra_core_stora
|
|
|
11314
11291
|
}
|
|
11315
11292
|
}
|
|
11316
11293
|
};
|
|
11317
|
-
|
|
11318
|
-
//#region src/storage/domains/skills/index.ts
|
|
11294
|
+
// src/storage/domains/skills/index.ts
|
|
11319
11295
|
/**
|
|
11320
11296
|
* Snapshot config fields that live on skill version documents.
|
|
11321
11297
|
*/
|
|
@@ -11814,8 +11790,7 @@ var MongoDBSkillsStorage = class MongoDBSkillsStorage extends _mastra_core_stora
|
|
|
11814
11790
|
return result;
|
|
11815
11791
|
}
|
|
11816
11792
|
};
|
|
11817
|
-
|
|
11818
|
-
//#region src/storage/domains/workflow-definitions/index.ts
|
|
11793
|
+
// src/storage/domains/workflow-definitions/index.ts
|
|
11819
11794
|
function docToDefinition(doc) {
|
|
11820
11795
|
const def = {
|
|
11821
11796
|
id: String(doc.id),
|
|
@@ -11952,8 +11927,7 @@ var MongoDBWorkflowDefinitionsStore = class MongoDBWorkflowDefinitionsStore exte
|
|
|
11952
11927
|
await (await this.getCollection(_mastra_core_storage.TABLE_WORKFLOW_DEFINITIONS)).deleteOne({ id });
|
|
11953
11928
|
}
|
|
11954
11929
|
};
|
|
11955
|
-
|
|
11956
|
-
//#region src/storage/domains/workflows/index.ts
|
|
11930
|
+
// src/storage/domains/workflows/index.ts
|
|
11957
11931
|
const RUN_OWNER_PROJECTION = {
|
|
11958
11932
|
generation: 1,
|
|
11959
11933
|
ownerId: 1,
|
|
@@ -12463,8 +12437,7 @@ var WorkflowsStorageMongoDB = class WorkflowsStorageMongoDB extends _mastra_core
|
|
|
12463
12437
|
};
|
|
12464
12438
|
}
|
|
12465
12439
|
};
|
|
12466
|
-
|
|
12467
|
-
//#region src/storage/domains/workspaces/index.ts
|
|
12440
|
+
// src/storage/domains/workspaces/index.ts
|
|
12468
12441
|
/**
|
|
12469
12442
|
* Snapshot config fields that live on workspace version documents.
|
|
12470
12443
|
*/
|
|
@@ -12963,8 +12936,7 @@ var MongoDBWorkspacesStorage = class MongoDBWorkspacesStorage extends _mastra_co
|
|
|
12963
12936
|
return result;
|
|
12964
12937
|
}
|
|
12965
12938
|
};
|
|
12966
|
-
|
|
12967
|
-
//#region src/storage/index.ts
|
|
12939
|
+
// src/storage/index.ts
|
|
12968
12940
|
/**
|
|
12969
12941
|
* MongoDB storage adapter for Mastra.
|
|
12970
12942
|
*
|
|
@@ -13057,8 +13029,7 @@ var MongoDBStore = class extends _mastra_core_storage.MastraCompositeStore {
|
|
|
13057
13029
|
}
|
|
13058
13030
|
}
|
|
13059
13031
|
};
|
|
13060
|
-
|
|
13061
|
-
//#region src/vector/prompt.ts
|
|
13032
|
+
// src/vector/prompt.ts
|
|
13062
13033
|
/**
|
|
13063
13034
|
* Vector store specific prompt that details supported operators and examples.
|
|
13064
13035
|
* This prompt helps users construct valid filters for MongoDB Vector.
|
|
@@ -13156,7 +13127,6 @@ Example Complex Query:
|
|
|
13156
13127
|
{ "$not": { "status": "discontinued" } }
|
|
13157
13128
|
]
|
|
13158
13129
|
}`;
|
|
13159
|
-
//#endregion
|
|
13160
13130
|
exports.BackgroundTasksStorageMongoDB = BackgroundTasksStorageMongoDB;
|
|
13161
13131
|
exports.KnowledgeMongoDB = KnowledgeMongoDB;
|
|
13162
13132
|
exports.MONGODB_PROMPT = MONGODB_PROMPT;
|