@mastra/files-sdk 0.0.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 ADDED
@@ -0,0 +1 @@
1
+ # @mastra/files-sdk
package/LICENSE.md ADDED
@@ -0,0 +1,30 @@
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
+
16
+ # Apache License 2.0
17
+
18
+ Copyright (c) 2025 Kepler Software, Inc.
19
+
20
+ Licensed under the Apache License, Version 2.0 (the "License");
21
+ you may not use this file except in compliance with the License.
22
+ You may obtain a copy of the License at
23
+
24
+ http://www.apache.org/licenses/LICENSE-2.0
25
+
26
+ Unless required by applicable law or agreed to in writing, software
27
+ distributed under the License is distributed on an "AS IS" BASIS,
28
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
+ See the License for the specific language governing permissions and
30
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @mastra/files-sdk
2
+
3
+ Unified storage filesystem provider for Mastra workspaces, powered by [FilesSDK](https://files-sdk.dev). Works with any FilesSDK adapter — S3, Cloudflare R2, Google Cloud Storage, Azure Blob, Vercel Blob, local filesystem, and more.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/files-sdk files-sdk
9
+ ```
10
+
11
+ Then install the FilesSDK adapter for your storage backend:
12
+
13
+ ```bash
14
+ # AWS S3 / R2 / MinIO / DigitalOcean Spaces
15
+ npm install @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner
16
+
17
+ # Google Cloud Storage
18
+ npm install @google-cloud/storage google-auth-library
19
+
20
+ # Azure Blob Storage
21
+ npm install @azure/storage-blob @azure/core-auth @azure/identity
22
+
23
+ # Vercel Blob
24
+ npm install @vercel/blob
25
+
26
+ # Local filesystem (dev/test)
27
+ # No extra dependencies needed
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```typescript
33
+ import { Agent } from '@mastra/core/agent';
34
+ import { Workspace } from '@mastra/core/workspace';
35
+ import { FilesSDKFilesystem } from '@mastra/files-sdk';
36
+ import { Files } from 'files-sdk';
37
+ import { s3 } from 'files-sdk/s3';
38
+
39
+ const files = new Files({
40
+ adapter: s3({
41
+ bucket: 'my-bucket',
42
+ region: 'us-east-1',
43
+ }),
44
+ });
45
+
46
+ const workspace = new Workspace({
47
+ filesystem: new FilesSDKFilesystem({ files }),
48
+ });
49
+
50
+ const agent = new Agent({
51
+ name: 'my-agent',
52
+ model: 'anthropic/claude-opus-4-5',
53
+ workspace,
54
+ });
55
+ ```
56
+
57
+ ### Switching adapters
58
+
59
+ The power of FilesSDK is that you can swap storage backends by changing only the adapter import:
60
+
61
+ ```typescript
62
+ import { Files } from 'files-sdk';
63
+ import { r2 } from 'files-sdk/r2';
64
+
65
+ const files = new Files({
66
+ adapter: r2({
67
+ accountId: process.env.R2_ACCOUNT_ID!,
68
+ accessKeyId: process.env.R2_ACCESS_KEY_ID!,
69
+ secretAccessKey: process.env.R2_SECRET_ACCESS_KEY!,
70
+ bucket: 'my-bucket',
71
+ }),
72
+ });
73
+
74
+ const workspace = new Workspace({
75
+ filesystem: new FilesSDKFilesystem({ files }),
76
+ });
77
+ ```
78
+
79
+ ### Local filesystem for development
80
+
81
+ ```typescript
82
+ import { Files } from 'files-sdk';
83
+ import { fs } from 'files-sdk/fs';
84
+
85
+ const files = new Files({
86
+ adapter: fs({ root: './.uploads' }),
87
+ });
88
+
89
+ const workspace = new Workspace({
90
+ filesystem: new FilesSDKFilesystem({ files }),
91
+ });
92
+ ```
93
+
94
+ ## Options
95
+
96
+ | Option | Type | Required | Description |
97
+ | ------------- | --------- | -------- | ------------------------------------- |
98
+ | `files` | `Files` | Yes | Pre-configured FilesSDK instance |
99
+ | `id` | `string` | No | Unique filesystem ID (auto-generated) |
100
+ | `displayName` | `string` | No | Human-friendly name for UI |
101
+ | `icon` | `string` | No | Icon identifier |
102
+ | `description` | `string` | No | Description for UI |
103
+ | `readOnly` | `boolean` | No | Mount as read-only |
104
+
105
+ ## License
106
+
107
+ Apache-2.0
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@mastra/files-sdk",
3
+ "version": "0.0.0",
4
+ "description": "FilesSDK filesystem provider for Mastra workspaces — unified storage across S3, R2, GCS, Azure, Vercel Blob, and more",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "dependencies": {
23
+ "files-sdk": "^1.5.0"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "22.19.15",
27
+ "eslint": "^10.2.1",
28
+ "tsup": "^8.5.1",
29
+ "typescript": "^6.0.3",
30
+ "vitest": "4.1.5",
31
+ "@internal/lint": "0.0.97",
32
+ "@internal/types-builder": "0.0.72",
33
+ "@mastra/core": "1.37.0-alpha.7",
34
+ "@internal/workspace-test-utils": "0.0.41"
35
+ },
36
+ "peerDependencies": {
37
+ "@mastra/core": ">=1.4.0-0 <2.0.0-0"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "CHANGELOG.md"
42
+ ],
43
+ "homepage": "https://mastra.ai",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/mastra-ai/mastra.git",
47
+ "directory": "workspaces/files-sdk"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/mastra-ai/mastra/issues"
51
+ },
52
+ "engines": {
53
+ "node": ">=22.13.0"
54
+ },
55
+ "scripts": {
56
+ "build": "tsup --silent --config tsup.config.ts",
57
+ "build:lib": "pnpm build",
58
+ "build:watch": "pnpm build --watch",
59
+ "test:unit": "vitest run --exclude '**/*.integration.test.ts'",
60
+ "test:integration": "vitest run ./src/**/*.integration.test.ts",
61
+ "test:watch": "vitest watch",
62
+ "lint": "eslint ."
63
+ }
64
+ }