@mastra/core 0.0.0-storage-20250225005900
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/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/agent/index.d.ts +15 -0
- package/dist/agent/index.js +1 -0
- package/dist/base-CHNzbTDj.d.ts +894 -0
- package/dist/base-eWkcLLSb.d.ts +139 -0
- package/dist/base.d.ts +6 -0
- package/dist/base.js +1 -0
- package/dist/bundler/index.d.ts +28 -0
- package/dist/bundler/index.js +1 -0
- package/dist/chunk-4IIE6KIC.js +10 -0
- package/dist/chunk-4ZNSY7J7.js +215 -0
- package/dist/chunk-4ZRHVG25.js +402 -0
- package/dist/chunk-5275WBGX.js +318 -0
- package/dist/chunk-6RDA4JYW.js +49 -0
- package/dist/chunk-BB4KXGBU.js +83 -0
- package/dist/chunk-C6A6W6XS.js +77 -0
- package/dist/chunk-FEBWYMJQ.js +416 -0
- package/dist/chunk-KP5SHTKA.js +145 -0
- package/dist/chunk-N7KZVQDK.js +61 -0
- package/dist/chunk-NDQR6IPC.js +37 -0
- package/dist/chunk-NUDAZEOG.js +35 -0
- package/dist/chunk-ORM3OCHX.js +1367 -0
- package/dist/chunk-PNZK456O.js +88 -0
- package/dist/chunk-QXPUH6PK.js +620 -0
- package/dist/chunk-RG66XEJT.js +8 -0
- package/dist/chunk-SIFBBGY6.js +190 -0
- package/dist/chunk-TCMOYQ74.js +1204 -0
- package/dist/chunk-WIBGG4X6.js +173 -0
- package/dist/chunk-YKDBP67T.js +346 -0
- package/dist/chunk-YUOADWSP.js +22 -0
- package/dist/chunk-Z735LDV7.js +10 -0
- package/dist/chunk-ZDWFBE5L.js +1 -0
- package/dist/chunk-ZINPRHAN.js +22 -0
- package/dist/deployer/index.d.ts +19 -0
- package/dist/deployer/index.js +1 -0
- package/dist/eval/index.d.ts +28 -0
- package/dist/eval/index.js +1 -0
- package/dist/filter/index.d.ts +90 -0
- package/dist/filter/index.js +1 -0
- package/dist/hooks/index.d.ts +33 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index-C5uPdbs4.d.ts +90 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +119 -0
- package/dist/integration/index.d.ts +53 -0
- package/dist/integration/index.js +1 -0
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.js +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.js +1 -0
- package/dist/mastra/index.d.ts +68 -0
- package/dist/mastra/index.js +1 -0
- package/dist/memory/index.d.ts +15 -0
- package/dist/memory/index.js +1 -0
- package/dist/relevance/index.d.ts +21 -0
- package/dist/relevance/index.js +1 -0
- package/dist/storage/index.d.ts +15 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/libsql/index.d.ts +81 -0
- package/dist/storage/libsql/index.js +1 -0
- package/dist/telemetry/index.d.ts +51 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/otel-vendor.d.ts +7 -0
- package/dist/telemetry/otel-vendor.js +7 -0
- package/dist/tools/index.d.ts +29 -0
- package/dist/tools/index.js +1 -0
- package/dist/tts/index.d.ts +28 -0
- package/dist/tts/index.js +1 -0
- package/dist/types-m9RryK9a.d.ts +14 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.js +1 -0
- package/dist/vector/index.d.ts +29 -0
- package/dist/vector/index.js +1 -0
- package/dist/vector/libsql/index.d.ts +29 -0
- package/dist/vector/libsql/index.js +1 -0
- package/dist/voice/index.d.ts +67 -0
- package/dist/voice/index.js +76 -0
- package/dist/workflow-CddifUps.d.ts +92 -0
- package/dist/workflows/index.d.ts +31 -0
- package/dist/workflows/index.js +1 -0
- package/package.json +134 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ehindero Israel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @mastra/core
|
|
2
|
+
|
|
3
|
+
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
`@mastra/core` is the foundational package of the Mastra framework, providing:
|
|
14
|
+
|
|
15
|
+
- Core abstractions and interfaces
|
|
16
|
+
- AI agent management and execution
|
|
17
|
+
- Integration with multiple AI providers
|
|
18
|
+
- Workflow orchestration
|
|
19
|
+
- Memory and vector store management
|
|
20
|
+
- Telemetry and logging infrastructure
|
|
21
|
+
- Text-to-speech capabilities
|
|
22
|
+
|
|
23
|
+
For comprehensive documentation, visit our [official documentation](https://mastra.ai/docs).
|
|
24
|
+
|
|
25
|
+
## Core Components
|
|
26
|
+
|
|
27
|
+
### Agents (`/agent`)
|
|
28
|
+
|
|
29
|
+
Agents are autonomous AI entities that can understand instructions, use tools, and complete tasks. They encapsulate LLM interactions and can maintain conversation history, use provided tools, and follow specific behavioral guidelines through instructions.
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { openai } from '@ai-sdk/openai';
|
|
33
|
+
import { Agent } from '@mastra/core/agent';
|
|
34
|
+
|
|
35
|
+
const agent = new Agent({
|
|
36
|
+
name: 'my-agent',
|
|
37
|
+
instructions: 'Your task-specific instructions',
|
|
38
|
+
model: openai('gpt-4o-mini'),
|
|
39
|
+
tools: {}, // Optional tools
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[More agent documentation →](https://mastra.ai/docs/reference/agents/overview)
|
|
44
|
+
|
|
45
|
+
### Embeddings (`/embeddings`)
|
|
46
|
+
|
|
47
|
+
The embeddings module provides a unified interface for converting text into vector representations across multiple AI providers. These vectors are essential for semantic search, similarity comparisons, and other NLP tasks.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { openai } from '@ai-sdk/openai';
|
|
51
|
+
import { embed } from 'ai';
|
|
52
|
+
|
|
53
|
+
const embeddings = await embed({
|
|
54
|
+
model: openai.embedding('text-embedding-3-small'),
|
|
55
|
+
value: 'text to embed',
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Supported providers right now are OpenAI, Cohere, Amazon Bedrock, Google AI, Mistral, and Voyage.
|
|
60
|
+
|
|
61
|
+
[More embeddings documentation →](https://mastra.ai/docs/reference/embeddings/overview)
|
|
62
|
+
|
|
63
|
+
### Evaluations (`/eval`)
|
|
64
|
+
|
|
65
|
+
The evaluation system enables quantitative assessment of AI outputs. Create custom metrics to measure specific aspects of AI performance, from response quality to task completion accuracy.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { Metric, evaluate } from '@mastra/core';
|
|
69
|
+
|
|
70
|
+
class CustomMetric extends Metric {
|
|
71
|
+
async measure(input: string, output: string): Promise<MetricResult> {
|
|
72
|
+
// Your evaluation logic
|
|
73
|
+
return { score: 0.95 };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
[More evaluations documentation →](https://mastra.ai/docs/reference/eval/overview)
|
|
79
|
+
|
|
80
|
+
### Memory (`/memory`)
|
|
81
|
+
|
|
82
|
+
Memory management provides persistent storage and retrieval of AI interactions. It supports different storage backends and enables context-aware conversations and long-term learning.
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { MastraMemory } from '@mastra/core';
|
|
86
|
+
|
|
87
|
+
const memory = new MastraMemory({
|
|
88
|
+
// Memory configuration
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Note:** this is the base `MastraMemory` class. This class in `@mastra/core` is intended to be extended when developing custom agent memory strategies.
|
|
93
|
+
To use a premade memory strategy (recommended), with long and short term memory built in, use `import { Memory } from "@mastra/memory"` instead.
|
|
94
|
+
|
|
95
|
+
[Visit the memory documentation to use Memory in your project →](https://mastra.ai/docs/reference/memory/overview)
|
|
96
|
+
|
|
97
|
+
### Vector Stores (`/vector`)
|
|
98
|
+
|
|
99
|
+
Vector stores provide the infrastructure for storing and querying vector embeddings. They support semantic search, similarity matching, and efficient vector operations across different backend implementations.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { MastraVector } from '@mastra/core';
|
|
103
|
+
|
|
104
|
+
class CustomVectorStore extends MastraVector {
|
|
105
|
+
// Vector store implementation
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
[More vector stores documentation →](https://mastra.ai/docs/reference/vector/overview)
|
|
110
|
+
|
|
111
|
+
### Workflows (`/workflows`)
|
|
112
|
+
|
|
113
|
+
Workflows orchestrate complex AI tasks by combining multiple actions into a coherent sequence. They handle state management, error recovery, and can include conditional logic and parallel execution.
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { Workflow } from '@mastra/core';
|
|
117
|
+
|
|
118
|
+
const workflow = new Workflow({
|
|
119
|
+
name: 'my-workflow',
|
|
120
|
+
steps: [
|
|
121
|
+
// Workflow steps
|
|
122
|
+
],
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
[More workflows documentation →](https://mastra.ai/docs/reference/workflows/overview)
|
|
127
|
+
|
|
128
|
+
### Tools (`/tools`)
|
|
129
|
+
|
|
130
|
+
Tools are functions that agents can use to interact with external systems or perform specific tasks. Each tool has a clear description and schema, making it easy for AI to understand and use them effectively.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { ToolAction } from '@mastra/core';
|
|
134
|
+
|
|
135
|
+
const tool = new ToolAction({
|
|
136
|
+
name: 'tool-name',
|
|
137
|
+
description: 'Tool description',
|
|
138
|
+
execute: async context => {
|
|
139
|
+
// Tool implementation
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
[More tools documentation →](https://mastra.ai/docs/reference/tools/overview)
|
|
145
|
+
|
|
146
|
+
### Logger (`/logger`)
|
|
147
|
+
|
|
148
|
+
The logging system provides structured, leveled logging with multiple transport options. It supports debug information, performance monitoring, and error tracking across your AI applications.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { createLogger, LogLevel } from '@mastra/core';
|
|
152
|
+
|
|
153
|
+
const logger = createLogger({
|
|
154
|
+
name: 'MyApp',
|
|
155
|
+
level: LogLevel.INFO,
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
[More logging documentation →](https://mastra.ai/docs/reference/observability/logging)
|
|
160
|
+
|
|
161
|
+
### Telemetry (`/telemetry`)
|
|
162
|
+
|
|
163
|
+
Telemetry provides OpenTelemetry integration for comprehensive monitoring of your AI systems. Track latency, success rates, and system health with distributed tracing and metrics collection.
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { Telemetry } from '@mastra/core';
|
|
167
|
+
|
|
168
|
+
const telemetry = Telemetry.init({
|
|
169
|
+
serviceName: 'my-service',
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
[More Telemetry documentation →](https://mastra.ai/docs/reference/observability/telemetry)
|
|
174
|
+
|
|
175
|
+
## Additional Resources
|
|
176
|
+
|
|
177
|
+
- [Getting Started Guide](https://mastra.ai/docs/getting-started/installation)
|
|
178
|
+
- [API Reference](https://mastra.ai/docs/reference)
|
|
179
|
+
- [Examples](https://mastra.ai/docs/examples)
|
|
180
|
+
- [Deployment Guide](https://mastra.ai/docs/deployment/overview)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'ai';
|
|
2
|
+
import 'json-schema';
|
|
3
|
+
import 'zod';
|
|
4
|
+
export { A as Agent } from '../base-CHNzbTDj.js';
|
|
5
|
+
import '../base-eWkcLLSb.js';
|
|
6
|
+
import '../types-m9RryK9a.js';
|
|
7
|
+
import '../voice/index.js';
|
|
8
|
+
import 'sift';
|
|
9
|
+
import '../vector/index.js';
|
|
10
|
+
import '@opentelemetry/api';
|
|
11
|
+
import '../index-C5uPdbs4.js';
|
|
12
|
+
import 'pino';
|
|
13
|
+
import 'stream';
|
|
14
|
+
import '@opentelemetry/sdk-trace-base';
|
|
15
|
+
import '../tts/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Agent } from '../chunk-ORM3OCHX.js';
|