@mastra/astra 1.0.1 → 1.0.4-alpha.0

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,14 @@
1
1
  # @mastra/astra
2
2
 
3
+ ## 1.0.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Security remediation for the 2026-06-17 "easy-day-js" supply-chain incident. Patch bump to publish clean versions and move the `latest` dist-tag forward, superseding the compromised versions that declared the malicious `easy-day-js` dependency. ([#18056](https://github.com/mastra-ai/mastra/pull/18056))
8
+
9
+ - Updated dependencies [[`77a2351`](https://github.com/mastra-ai/mastra/commit/77a2351ee79296e360bce822cb3391f7cfd6489d)]:
10
+ - @mastra/core@1.43.1-alpha.0
11
+
3
12
  ## 1.0.1
4
13
 
5
14
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -1,3 +1,18 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named "ee/" within this
4
+ repository, including but not limited to:
5
+ - `packages/core/src/auth/ee/`
6
+ - `packages/server/src/server/auth/ee/`
7
+ is licensed under the license defined in `ee/LICENSE`.
8
+
9
+ - All third-party components incorporated into the Mastra Software are
10
+ licensed under the original license provided by the owner of the
11
+ applicable component.
12
+
13
+ - Content outside of the above-mentioned directories or restrictions is
14
+ available under the "Apache License 2.0" as defined below.
15
+
1
16
  # Apache License 2.0
2
17
 
3
18
  Copyright (c) 2025 Kepler Software, Inc.
@@ -3,7 +3,7 @@ name: mastra-astra
3
3
  description: Documentation for @mastra/astra. Use when working with @mastra/astra APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/astra"
6
- version: "1.0.1"
6
+ version: "1.0.4-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -16,12 +16,12 @@ Read the individual reference documents for detailed explanations and code examp
16
16
 
17
17
  ### Docs
18
18
 
19
- - [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.
20
- - [Storing Embeddings in A Vector Database](references/docs-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
19
+ - [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.
20
+ - [Storing embeddings in a vector database](references/docs-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
21
21
 
22
22
  ### Reference
23
23
 
24
- - [Reference: Astra Vector Store](references/reference-vectors-astra.md) - Documentation for the AstraVector class in Mastra, which provides vector search using DataStax Astra DB.
24
+ - [Reference: Astra vector store](references/reference-vectors-astra.md) - Documentation for the AstraVector class in Mastra, which provides vector search using DataStax Astra DB.
25
25
 
26
26
 
27
27
  Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.1",
2
+ "version": "1.0.4-alpha.0",
3
3
  "package": "@mastra/astra",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,10 +1,10 @@
1
- # Retrieval in RAG Systems
1
+ # Retrieval in RAG systems
2
2
 
3
3
  After storing embeddings, you need to retrieve relevant chunks to answer user queries.
4
4
 
5
5
  Mastra provides flexible retrieval options with support for semantic search, filtering, and re-ranking.
6
6
 
7
- ## How Retrieval Works
7
+ ## How retrieval works
8
8
 
9
9
  1. The user's query is converted to an embedding using the same model used for document embeddings
10
10
  2. This embedding is compared to stored embeddings using vector similarity
@@ -14,7 +14,7 @@ Mastra provides flexible retrieval options with support for semantic search, fil
14
14
  - Re-ranked for better relevance
15
15
  - Processed through a knowledge graph
16
16
 
17
- ## Basic Retrieval
17
+ ## Basic retrieval
18
18
 
19
19
  The simplest approach is direct semantic search. This method uses vector similarity to find chunks that are semantically similar to the query:
20
20
 
@@ -63,7 +63,7 @@ Results include both the text content and a similarity score:
63
63
  ]
64
64
  ```
65
65
 
66
- ## Advanced Retrieval options
66
+ ## Advanced retrieval options
67
67
 
68
68
  ### Metadata Filtering
69
69
 
@@ -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.5',
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.5',
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.5',
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.5',
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.5',
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.5',
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.5',
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.5',
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.5',
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.5',
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.5',
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,10 @@ 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(
476
+ 'relevance-scorer',
477
+ 'openai/gpt-5.5',
478
+ )
476
479
 
477
480
  // Re-rank the results
478
481
  const rerankedResults = await rerank({
@@ -1,8 +1,8 @@
1
- # Storing Embeddings in A Vector Database
1
+ # Storing embeddings in a vector database
2
2
 
3
3
  After generating embeddings, you need to store them in a database that supports vector similarity search. Mastra provides a consistent interface for storing and querying embeddings across various vector databases.
4
4
 
5
- ## Supported Databases
5
+ ## Supported databases
6
6
 
7
7
  **MongoDB**:
8
8
 
@@ -234,7 +234,7 @@ await store.upsert({
234
234
  })
235
235
  ```
236
236
 
237
- **ElasticSearch**:
237
+ **Elasticsearch**:
238
238
 
239
239
  ```ts
240
240
  import { ElasticSearchVector } from '@mastra/elasticsearch'
@@ -337,7 +337,7 @@ await store.upsert({
337
337
  })
338
338
  ```
339
339
 
340
- ## Using Vector Storage
340
+ ## Using vector storage
341
341
 
342
342
  Once initialized, all vector stores share the same interface for creating indexes, upserting embeddings, and querying.
343
343
 
@@ -355,11 +355,11 @@ await store.createIndex({
355
355
 
356
356
  The dimension size must match the output dimension of your chosen embedding model. Common dimension sizes are:
357
357
 
358
- - OpenAI text-embedding-3-small: 1536 dimensions (or custom, e.g., 256)
359
- - Cohere embed-multilingual-v3: 1024 dimensions
360
- - Google gemini-embedding-001: 768 dimensions (or custom)
358
+ - `OpenAI text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
359
+ - `Cohere embed-multilingual-v3`: 1024 dimensions
360
+ - `Google gemini-embedding-001`: 768 dimensions (or custom)
361
361
 
362
- > **Warning:** Index dimensions cannot be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
362
+ > **Warning:** Index dimensions can't be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
363
363
 
364
364
  ### Naming Rules for Databases
365
365
 
@@ -490,7 +490,7 @@ Index names must:
490
490
  - Example: `My_Index` is not valid (contains uppercase letters)
491
491
  - Example: `_myindex` is not valid (begins with underscore)
492
492
 
493
- **ElasticSearch**:
493
+ **Elasticsearch**:
494
494
 
495
495
  Index names must:
496
496
 
@@ -543,7 +543,7 @@ The upsert operation:
543
543
  - Creates new vectors if they don't exist
544
544
  - Automatically handles batching for large datasets
545
545
 
546
- ## Adding Metadata
546
+ ## Adding metadata
547
547
 
548
548
  Vector stores support rich metadata (any JSON-serializable fields) for filtering and organization. Since metadata is stored with no fixed schema, use consistent field naming to avoid unexpected query results.
549
549
 
@@ -581,9 +581,9 @@ Key metadata considerations:
581
581
  - Only include fields you plan to filter or sort by - extra fields add overhead
582
582
  - Add timestamps (e.g., 'createdAt', 'lastUpdated') to track content freshness
583
583
 
584
- ## Deleting Vectors
584
+ ## Deleting vectors
585
585
 
586
- When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it easy to remove all embeddings associated with a specific document.
586
+ When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it straightforward to remove all embeddings associated with a specific document.
587
587
 
588
588
  ### Delete by Metadata Filter
589
589
 
@@ -637,7 +637,7 @@ await store.deleteVectors({
637
637
  })
638
638
  ```
639
639
 
640
- ## Best Practices
640
+ ## Best practices
641
641
 
642
642
  - Create indexes before bulk insertions
643
643
  - Use batch operations for large insertions (the upsert method handles batching automatically)
@@ -1,54 +1,54 @@
1
- # Astra Vector Store
1
+ # Astra vector store
2
2
 
3
3
  The AstraVector class provides vector search using [DataStax Astra DB](https://www.datastax.com/products/datastax-astra), a cloud-native, serverless database built on Apache Cassandra. It provides vector search capabilities with enterprise-grade scalability and high availability.
4
4
 
5
- ## Constructor Options
5
+ ## Constructor options
6
6
 
7
- **token:** (`string`): Astra DB API token
7
+ **token** (`string`): Astra DB API token
8
8
 
9
- **endpoint:** (`string`): Astra DB API endpoint
9
+ **endpoint** (`string`): Astra DB API endpoint
10
10
 
11
- **keyspace?:** (`string`): Optional keyspace name
11
+ **keyspace** (`string`): Optional keyspace name
12
12
 
13
13
  ## Methods
14
14
 
15
- ### createIndex()
15
+ ### `createIndex()`
16
16
 
17
- **indexName:** (`string`): Name of the index to create
17
+ **indexName** (`string`): Name of the index to create
18
18
 
19
- **dimension:** (`number`): Vector dimension (must match your embedding model)
19
+ **dimension** (`number`): Vector dimension (must match your embedding model)
20
20
 
21
- **metric?:** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (maps to dot\_product for dotproduct) (Default: `cosine`)
21
+ **metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (maps to dot\_product for dotproduct) (Default: `cosine`)
22
22
 
23
- ### upsert()
23
+ ### `upsert()`
24
24
 
25
- **indexName:** (`string`): Name of the index to upsert into
25
+ **indexName** (`string`): Name of the index to upsert into
26
26
 
27
- **vectors:** (`number[][]`): Array of embedding vectors
27
+ **vectors** (`number[][]`): Array of embedding vectors
28
28
 
29
- **metadata?:** (`Record<string, any>[]`): Metadata for each vector
29
+ **metadata** (`Record<string, any>[]`): Metadata for each vector
30
30
 
31
- **ids?:** (`string[]`): Optional vector IDs (auto-generated if not provided)
31
+ **ids** (`string[]`): Optional vector IDs (auto-generated if not provided)
32
32
 
33
- ### query()
33
+ ### `query()`
34
34
 
35
- **indexName:** (`string`): Name of the index to query
35
+ **indexName** (`string`): Name of the index to query
36
36
 
37
- **queryVector:** (`number[]`): Query vector to find similar vectors
37
+ **queryVector** (`number[]`): Query vector to find similar vectors
38
38
 
39
- **topK?:** (`number`): Number of results to return (Default: `10`)
39
+ **topK** (`number`): Number of results to return (Default: `10`)
40
40
 
41
- **filter?:** (`Record<string, any>`): Metadata filters for the query
41
+ **filter** (`Record<string, any>`): Metadata filters for the query
42
42
 
43
- **includeVector?:** (`boolean`): Whether to include vectors in the results (Default: `false`)
43
+ **includeVector** (`boolean`): Whether to include vectors in the results (Default: `false`)
44
44
 
45
- ### listIndexes()
45
+ ### `listIndexes()`
46
46
 
47
47
  Returns an array of index names as strings.
48
48
 
49
- ### describeIndex()
49
+ ### `describeIndex()`
50
50
 
51
- **indexName:** (`string`): Name of the index to describe
51
+ **indexName** (`string`): Name of the index to describe
52
52
 
53
53
  Returns:
54
54
 
@@ -60,25 +60,25 @@ interface IndexStats {
60
60
  }
61
61
  ```
62
62
 
63
- ### deleteIndex()
63
+ ### `deleteIndex()`
64
64
 
65
- **indexName:** (`string`): Name of the index to delete
65
+ **indexName** (`string`): Name of the index to delete
66
66
 
67
- ### updateVector()
67
+ ### `updateVector()`
68
68
 
69
- **indexName:** (`string`): Name of the index containing the vector
69
+ **indexName** (`string`): Name of the index containing the vector
70
70
 
71
- **id:** (`string`): ID of the vector to update
71
+ **id** (`string`): ID of the vector to update
72
72
 
73
- **update:** (`object`): number\[]Record\<string, any>
73
+ **update** (`object`): Update object containing vector and/or metadata changes
74
74
 
75
- ### deleteVector()
75
+ ### `deleteVector()`
76
76
 
77
- **indexName:** (`string`): Name of the index containing the vector
77
+ **indexName** (`string`): Name of the index containing the vector
78
78
 
79
- **id:** (`string`): ID of the vector to delete
79
+ **id** (`string`): ID of the vector to delete
80
80
 
81
- ## Response Types
81
+ ## Response types
82
82
 
83
83
  Query results are returned in this format:
84
84
 
@@ -91,7 +91,7 @@ interface QueryResult {
91
91
  }
92
92
  ```
93
93
 
94
- ## Error Handling
94
+ ## Error handling
95
95
 
96
96
  The store throws typed errors that can be caught:
97
97
 
@@ -109,7 +109,7 @@ try {
109
109
  }
110
110
  ```
111
111
 
112
- ## Environment Variables
112
+ ## Environment variables
113
113
 
114
114
  Required environment variables:
115
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/astra",
3
- "version": "1.0.1",
3
+ "version": "1.0.4-alpha.0",
4
4
  "description": "Astra DB provider for Mastra - includes vector store capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,16 +27,17 @@
27
27
  "@datastax/astra-db-ts": "^1.5.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/node": "22.19.7",
31
- "@vitest/coverage-v8": "4.0.18",
32
- "@vitest/ui": "4.0.18",
33
- "eslint": "^9.37.0",
30
+ "@types/node": "22.19.21",
31
+ "@vitest/coverage-v8": "4.1.8",
32
+ "@vitest/ui": "4.1.8",
33
+ "eslint": "^10.4.1",
34
34
  "tsup": "^8.5.1",
35
- "typescript": "^5.9.3",
36
- "vitest": "4.0.18",
37
- "@internal/lint": "0.0.63",
38
- "@mastra/core": "1.8.0",
39
- "@internal/types-builder": "0.0.38"
35
+ "tsx": "^4.22.4",
36
+ "typescript": "^6.0.3",
37
+ "vitest": "4.1.8",
38
+ "@internal/lint": "0.0.105",
39
+ "@internal/types-builder": "0.0.80",
40
+ "@mastra/core": "1.43.1-alpha.0"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@mastra/core": ">=1.0.0-0 <2.0.0-0"