@mastra/cloudflare 1.1.0-alpha.0 → 1.1.1-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 +108 -0
- package/dist/docs/SKILL.md +12 -22
- package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
- package/dist/docs/{storage/01-reference.md → references/reference-storage-cloudflare.md} +34 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/types.d.ts +7 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +5 -6
- package/dist/docs/README.md +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,113 @@
|
|
|
1
1
|
# @mastra/cloudflare
|
|
2
2
|
|
|
3
|
+
## 1.1.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added prompt block storage implementations. Each store supports full CRUD for prompt blocks and their versions, including JSON serialization for rules and metadata. Also updated agent instructions serialization to support the new `AgentInstructionBlock` array format alongside plain strings. ([#12776](https://github.com/mastra-ai/mastra/pull/12776))
|
|
8
|
+
|
|
9
|
+
- **Updated storage adapters for generic storage domain API** ([#12846](https://github.com/mastra-ai/mastra/pull/12846))
|
|
10
|
+
|
|
11
|
+
All storage adapters now implement the unified `VersionedStorageDomain` method names. Entity-specific methods (`createAgent`, `getAgentById`, `deleteAgent`, etc.) have been replaced with generic equivalents (`create`, `getById`, `delete`, etc.) across agents, prompt blocks, and scorer definitions domains.
|
|
12
|
+
|
|
13
|
+
Added `scorer-definitions` domain support to all adapters.
|
|
14
|
+
|
|
15
|
+
**Before:**
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const store = storage.getStore('agents');
|
|
19
|
+
await store.createAgent({ agent: input });
|
|
20
|
+
await store.getAgentById({ id: 'abc' });
|
|
21
|
+
await store.deleteAgent({ id: 'abc' });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**After:**
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const store = storage.getStore('agents');
|
|
28
|
+
await store.create({ agent: input });
|
|
29
|
+
await store.getById('abc');
|
|
30
|
+
await store.delete('abc');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
|
|
34
|
+
- @mastra/core@1.3.0-alpha.1
|
|
35
|
+
|
|
36
|
+
## 1.1.0
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- Added dynamic agent management with CRUD operations and version tracking ([#12038](https://github.com/mastra-ai/mastra/pull/12038))
|
|
41
|
+
|
|
42
|
+
**New Features:**
|
|
43
|
+
- Create, edit, and delete agents directly from the Mastra Studio UI
|
|
44
|
+
- Full version history for agents with compare and restore capabilities
|
|
45
|
+
- Visual diff viewer to compare agent configurations across versions
|
|
46
|
+
- Agent creation modal with comprehensive configuration options (model selection, instructions, tools, workflows, sub-agents, memory)
|
|
47
|
+
- AI-powered instruction enhancement
|
|
48
|
+
|
|
49
|
+
**Storage:**
|
|
50
|
+
- New storage interfaces for stored agents and agent versions
|
|
51
|
+
- PostgreSQL, LibSQL, and MongoDB implementations included
|
|
52
|
+
- In-memory storage for development and testing
|
|
53
|
+
|
|
54
|
+
**API:**
|
|
55
|
+
- RESTful endpoints for agent CRUD operations
|
|
56
|
+
- Version management endpoints (create, list, activate, restore, delete, compare)
|
|
57
|
+
- Automatic versioning on agent updates when enabled
|
|
58
|
+
|
|
59
|
+
**Client SDK:**
|
|
60
|
+
- JavaScript client with full support for stored agents and versions
|
|
61
|
+
- Type-safe methods for all CRUD and version operations
|
|
62
|
+
|
|
63
|
+
**Usage Example:**
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// Server-side: Configure storage
|
|
67
|
+
import { Mastra } from '@mastra/core';
|
|
68
|
+
import { PgAgentsStorage } from '@mastra/pg';
|
|
69
|
+
|
|
70
|
+
const mastra = new Mastra({
|
|
71
|
+
agents: { agentOne },
|
|
72
|
+
storage: {
|
|
73
|
+
agents: new PgAgentsStorage({
|
|
74
|
+
connectionString: process.env.DATABASE_URL,
|
|
75
|
+
}),
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Client-side: Use the SDK
|
|
80
|
+
import { MastraClient } from '@mastra/client-js';
|
|
81
|
+
|
|
82
|
+
const client = new MastraClient({ baseUrl: 'http://localhost:3000' });
|
|
83
|
+
|
|
84
|
+
// Create a stored agent
|
|
85
|
+
const agent = await client.createStoredAgent({
|
|
86
|
+
name: 'Customer Support Agent',
|
|
87
|
+
description: 'Handles customer inquiries',
|
|
88
|
+
model: { provider: 'ANTHROPIC', name: 'claude-sonnet-4-5' },
|
|
89
|
+
instructions: 'You are a helpful customer support agent...',
|
|
90
|
+
tools: ['search', 'email'],
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Create a version snapshot
|
|
94
|
+
await client.storedAgent(agent.id).createVersion({
|
|
95
|
+
name: 'v1.0 - Initial release',
|
|
96
|
+
changeMessage: 'First production version',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Compare versions
|
|
100
|
+
const diff = await client.storedAgent(agent.id).compareVersions('version-1', 'version-2');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Why:**
|
|
104
|
+
This feature enables teams to manage agents dynamically without code changes, making it easier to iterate on agent configurations and maintain a complete audit trail of changes.
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`b99ceac`](https://github.com/mastra-ai/mastra/commit/b99ceace2c830dbdef47c8692d56a91954aefea2), [`deea43e`](https://github.com/mastra-ai/mastra/commit/deea43eb1366d03a864c5e597d16a48592b9893f), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`ac9ec66`](https://github.com/mastra-ai/mastra/commit/ac9ec6672779b2e6d4344e415481d1a6a7d4911a), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
|
|
109
|
+
- @mastra/core@1.1.0
|
|
110
|
+
|
|
3
111
|
## 1.1.0-alpha.0
|
|
4
112
|
|
|
5
113
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: mastra-cloudflare
|
|
3
|
-
description: Documentation for @mastra/cloudflare.
|
|
2
|
+
name: mastra-cloudflare
|
|
3
|
+
description: Documentation for @mastra/cloudflare. Use when working with @mastra/cloudflare APIs, configuration, or implementation.
|
|
4
|
+
metadata:
|
|
5
|
+
package: "@mastra/cloudflare"
|
|
6
|
+
version: "1.1.1-alpha.0"
|
|
4
7
|
---
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
## When to use
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
> **Package**: @mastra/cloudflare
|
|
11
|
+
Use this skill whenever you are working with @mastra/cloudflare to obtain the domain-specific knowledge.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## How to use
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Read the individual reference documents for detailed explanations and code examples.
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
cat docs/SOURCE_MAP.json
|
|
17
|
-
```
|
|
17
|
+
### Reference
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
- **types**: `.d.ts` file with JSDoc and API signatures
|
|
21
|
-
- **implementation**: `.js` chunk file with readable source
|
|
22
|
-
- **docs**: Conceptual documentation in `docs/`
|
|
19
|
+
- [Reference: Cloudflare Storage](references/reference-storage-cloudflare.md) - Documentation for the Cloudflare KV storage implementation in Mastra.
|
|
23
20
|
|
|
24
|
-
## Top Exports
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
See SOURCE_MAP.json for the complete list.
|
|
29
|
-
|
|
30
|
-
## Available Topics
|
|
31
|
-
|
|
32
|
-
- [Storage](storage/) - 1 file(s)
|
|
22
|
+
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
# Storage
|
|
1
|
+
# Cloudflare Storage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Cloudflare KV storage implementation provides a globally distributed, serverless key-value store solution using Cloudflare Workers KV.
|
|
4
4
|
|
|
5
|
+
> **Observability Not Supported:** Cloudflare KV storage **does not support the observability domain**. Traces from the `DefaultExporter` cannot be persisted to KV, and Mastra Studio's observability features won't work with Cloudflare KV as your only storage provider. To enable observability, use [composite storage](https://mastra.ai/reference/storage/composite) to route observability data to a supported provider like ClickHouse or PostgreSQL.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## Installation
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
**npm**:
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mastra/cloudflare@latest
|
|
13
|
+
```
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
**pnpm**:
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @mastra/cloudflare@latest
|
|
19
|
+
```
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
**Yarn**:
|
|
18
22
|
|
|
19
|
-
```bash
|
|
20
|
-
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @mastra/cloudflare@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Bun**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bun add @mastra/cloudflare@latest
|
|
21
31
|
```
|
|
22
32
|
|
|
23
33
|
## Usage
|
|
@@ -47,6 +57,18 @@ const storageRest = new CloudflareStore({
|
|
|
47
57
|
|
|
48
58
|
## Parameters
|
|
49
59
|
|
|
60
|
+
**id:** (`string`): Unique identifier for this storage instance.
|
|
61
|
+
|
|
62
|
+
**bindings?:** (`Record<string, KVNamespace>`): Cloudflare Workers KV bindings (for Workers runtime)
|
|
63
|
+
|
|
64
|
+
**accountId?:** (`string`): Cloudflare Account ID (for REST API)
|
|
65
|
+
|
|
66
|
+
**apiToken?:** (`string`): Cloudflare API Token (for REST API)
|
|
67
|
+
|
|
68
|
+
**namespacePrefix?:** (`string`): Optional prefix for all namespace names (useful for environment isolation)
|
|
69
|
+
|
|
70
|
+
**keyPrefix?:** (`string`): Optional prefix for all keys (useful for environment isolation)
|
|
71
|
+
|
|
50
72
|
#### Additional Notes
|
|
51
73
|
|
|
52
74
|
### Schema Management
|
|
@@ -63,5 +85,4 @@ Cloudflare KV is an eventually consistent store, meaning that data may not be im
|
|
|
63
85
|
|
|
64
86
|
### Key Structure & Namespacing
|
|
65
87
|
|
|
66
|
-
Keys in Cloudflare KV are structured as a combination of a configurable prefix and a table-specific format (e.g., `threads:threadId`).
|
|
67
|
-
For Workers deployments, `keyPrefix` is used to isolate data within a namespace; for REST API deployments, `namespacePrefix` is used to isolate entire namespaces between environments or applications.
|
|
88
|
+
Keys in Cloudflare KV are structured as a combination of a configurable prefix and a table-specific format (e.g., `threads:threadId`). For Workers deployments, `keyPrefix` is used to isolate data within a namespace; for REST API deployments, `namespacePrefix` is used to isolate entire namespaces between environments or applications.
|