@mastra/azure 0.3.2-alpha.0 → 0.3.3-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/dist/blob/index.cjs +1 -1
- package/dist/blob/index.js +1 -2
- package/dist/{blob-D20A-jNB.js → blob-Bds4wJ8g.js} +19 -11
- package/dist/{blob-D20A-jNB.js.map → blob-Bds4wJ8g.js.map} +1 -1
- package/dist/{blob-B1rO2XRY.cjs → blob-Dbkc3LM4.cjs} +19 -11
- package/dist/{blob-B1rO2XRY.cjs.map → blob-Dbkc3LM4.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -2
- package/package.json +10 -11
package/dist/blob/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_blob = require("../blob-
|
|
2
|
+
const require_blob = require("../blob-Dbkc3LM4.cjs");
|
|
3
3
|
exports.AzureBlobFilesystem = require_blob.AzureBlobFilesystem;
|
|
4
4
|
exports.AzureBlobStore = require_blob.AzureBlobStore;
|
|
5
5
|
exports.azureBlobFilesystemProvider = require_blob.azureBlobFilesystemProvider;
|
package/dist/blob/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { AzureBlobFilesystem, AzureBlobStore, azureBlobFilesystemProvider, azureBlobStoreProvider };
|
|
1
|
+
export { i as AzureBlobFilesystem, r as AzureBlobStore, t as azureBlobFilesystemProvider, n as azureBlobStoreProvider } from "../blob-Bds4wJ8g.js";
|
|
@@ -163,12 +163,16 @@ var AzureBlobFilesystem = class extends MastraFilesystem {
|
|
|
163
163
|
else {
|
|
164
164
|
if (!this.endpoint && !this.accountName) throw new Error("Azure Blob Storage requires either a connectionString, or an accountName/endpoint. Provide at least one of: connectionString, accountName, or endpoint.");
|
|
165
165
|
const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;
|
|
166
|
-
if (this.accountName && this.accountKey)
|
|
167
|
-
|
|
166
|
+
if (this.accountName && this.accountKey) {
|
|
167
|
+
const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);
|
|
168
|
+
serviceClient = new BlobServiceClient(baseUrl, credential);
|
|
169
|
+
} else if (this.sasToken) {
|
|
168
170
|
const sas = this.sasToken.replace(/^\?+/, "");
|
|
169
|
-
|
|
171
|
+
const separator = baseUrl.includes("?") ? "&" : "?";
|
|
172
|
+
serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);
|
|
170
173
|
} else if (this.useDefaultCredential) try {
|
|
171
|
-
|
|
174
|
+
const credential = new (await (import("@azure/identity"))).DefaultAzureCredential();
|
|
175
|
+
serviceClient = new BlobServiceClient(baseUrl, credential);
|
|
172
176
|
} catch {
|
|
173
177
|
throw new Error("DefaultAzureCredential requires @azure/identity to be installed. Install it with: npm install @azure/identity");
|
|
174
178
|
}
|
|
@@ -255,14 +259,14 @@ var AzureBlobFilesystem = class extends MastraFilesystem {
|
|
|
255
259
|
try {
|
|
256
260
|
const sasUrl = await srcBlob.generateSasUrl({
|
|
257
261
|
permissions: BlobSASPermissions.parse("r"),
|
|
258
|
-
expiresOn: new Date(Date.now() +
|
|
262
|
+
expiresOn: new Date(Date.now() + 3e5)
|
|
259
263
|
});
|
|
260
264
|
const properties = await srcBlob.getProperties();
|
|
261
265
|
if (properties.contentLength === 0) {
|
|
262
266
|
await destBlob.getBlockBlobClient().upload(Buffer.alloc(0), 0);
|
|
263
267
|
return;
|
|
264
268
|
}
|
|
265
|
-
if ((properties.contentLength ?? 0) <=
|
|
269
|
+
if ((properties.contentLength ?? 0) <= 268435456) await destBlob.syncCopyFromURL(sasUrl);
|
|
266
270
|
else await (await destBlob.beginCopyFromURL(sasUrl)).pollUntilDone();
|
|
267
271
|
} catch (error) {
|
|
268
272
|
if (isNotFoundError$1(error)) throw new FileNotFoundError(src);
|
|
@@ -526,12 +530,16 @@ var AzureBlobStore = class extends BlobStore {
|
|
|
526
530
|
else {
|
|
527
531
|
if (!this.endpoint && !this.accountName) throw new Error("Azure Blob Storage requires either a connectionString, or an accountName/endpoint. Provide at least one of: connectionString, accountName, or endpoint.");
|
|
528
532
|
const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;
|
|
529
|
-
if (this.accountName && this.accountKey)
|
|
530
|
-
|
|
533
|
+
if (this.accountName && this.accountKey) {
|
|
534
|
+
const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);
|
|
535
|
+
serviceClient = new BlobServiceClient(baseUrl, credential);
|
|
536
|
+
} else if (this.sasToken) {
|
|
531
537
|
const sas = this.sasToken.replace(/^\?+/, "");
|
|
532
|
-
|
|
538
|
+
const separator = baseUrl.includes("?") ? "&" : "?";
|
|
539
|
+
serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);
|
|
533
540
|
} else if (this.useDefaultCredential) try {
|
|
534
|
-
|
|
541
|
+
const credential = new (await (import("@azure/identity"))).DefaultAzureCredential();
|
|
542
|
+
serviceClient = new BlobServiceClient(baseUrl, credential);
|
|
535
543
|
} catch {
|
|
536
544
|
throw new Error("DefaultAzureCredential requires @azure/identity to be installed. Install it with: npm install @azure/identity");
|
|
537
545
|
}
|
|
@@ -717,4 +725,4 @@ const azureBlobStoreProvider = {
|
|
|
717
725
|
//#endregion
|
|
718
726
|
export { AzureBlobFilesystem as i, azureBlobStoreProvider as n, AzureBlobStore as r, azureBlobFilesystemProvider as t };
|
|
719
727
|
|
|
720
|
-
//# sourceMappingURL=blob-
|
|
728
|
+
//# sourceMappingURL=blob-Bds4wJ8g.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-D20A-jNB.js","names":["isNotFoundError","restErr","trimSlashes"],"sources":["../src/blob/filesystem/index.ts","../src/blob/blob-store/index.ts","../src/blob/provider.ts"],"sourcesContent":["/**\n * Azure Blob Storage Filesystem Provider\n *\n * A filesystem implementation backed by Azure Blob Storage.\n */\n\nimport { BlobSASPermissions, BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient, RestError } from '@azure/storage-blob';\n\nimport type {\n FileContent,\n FileStat,\n FileEntry,\n ReadOptions,\n WriteOptions,\n ListOptions,\n RemoveOptions,\n CopyOptions,\n FilesystemInfo,\n FilesystemMountConfig,\n FilesystemIcon,\n ProviderStatus,\n MastraFilesystemOptions,\n} from '@mastra/core/workspace';\nimport { MastraFilesystem, FileNotFoundError, FileExistsError, PermissionError } from '@mastra/core/workspace';\n\n/**\n * Azure Blob mount configuration.\n * Returned by AzureBlobFilesystem.getMountConfig() for FUSE mounting in sandboxes.\n */\nexport interface AzureBlobMountConfig extends FilesystemMountConfig {\n type: 'azure-blob';\n container: string;\n accountName?: string;\n accountKey?: string;\n sasToken?: string;\n connectionString?: string;\n useDefaultCredential?: boolean;\n endpoint?: string;\n prefix?: string;\n readOnly?: boolean;\n}\n\nconst MIME_TYPES: Record<string, string> = {\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.markdown': 'text/markdown',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.css': 'text/css',\n '.csv': 'text/csv',\n '.xml': 'text/xml',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.ts': 'text/typescript',\n '.tsx': 'text/typescript',\n '.jsx': 'text/javascript',\n '.json': 'application/json',\n '.yaml': 'text/yaml',\n '.yml': 'text/yaml',\n '.py': 'text/x-python',\n '.rb': 'text/x-ruby',\n '.sh': 'text/x-shellscript',\n '.bash': 'text/x-shellscript',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.webp': 'image/webp',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.zip': 'application/zip',\n '.gz': 'application/gzip',\n '.tar': 'application/x-tar',\n};\n\nfunction getMimeType(path: string): string {\n const ext = path.toLowerCase().match(/\\.[^.]+$/)?.[0];\n return ext ? (MIME_TYPES[ext] ?? 'application/octet-stream') : 'application/octet-stream';\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 404;\n}\n\nfunction isAccessDeniedError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 403;\n}\n\n/** Trim leading and trailing slashes without regex (avoids polynomial regex on user input). */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nasync function streamToBuffer(stream: NodeJS.ReadableStream | undefined): Promise<Buffer> {\n if (!stream) return Buffer.alloc(0);\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks);\n}\n\nfunction toBuffer(content: FileContent): Buffer {\n if (Buffer.isBuffer(content)) return content;\n return typeof content === 'string' ? Buffer.from(content, 'utf-8') : Buffer.from(content);\n}\n\nexport interface AzureBlobFilesystemOptions extends MastraFilesystemOptions {\n /** Unique identifier for this filesystem instance */\n id?: string;\n /** Azure Blob container name */\n container: string;\n /** Human-friendly display name for the UI */\n displayName?: string;\n /** Icon identifier for the UI (defaults to 'azure-blob') */\n icon?: FilesystemIcon;\n /** Description shown in tooltips */\n description?: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Supports Managed Identity, Azure CLI, environment variables, etc.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Optional prefix for all keys (acts like a subdirectory) */\n prefix?: string;\n /** Mount as read-only (blocks write operations, mounts read-only in sandboxes) */\n readOnly?: boolean;\n /**\n * Custom endpoint URL.\n * Used for local development with Azurite emulator.\n */\n endpoint?: string;\n}\n\nexport class AzureBlobFilesystem extends MastraFilesystem {\n readonly id: string;\n readonly name = 'AzureBlobFilesystem';\n readonly provider = 'azure-blob';\n readonly readOnly?: boolean;\n\n status: ProviderStatus = 'pending';\n\n readonly displayName?: string;\n readonly icon: FilesystemIcon = 'azure-blob';\n readonly description?: string;\n\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly prefix: string;\n private readonly endpoint?: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobFilesystemOptions) {\n super({ ...options, name: 'AzureBlobFilesystem' });\n this.id = options.id ?? `azure-fs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : '';\n this.endpoint = options.endpoint;\n\n this.displayName = options.displayName ?? 'Azure Blob Storage';\n this.icon = options.icon ?? 'azure-blob';\n this.description = options.description;\n this.readOnly = options.readOnly;\n }\n\n /**\n * Get the underlying ContainerClient for direct access to Azure Blob APIs.\n *\n * Use this when you need features not exposed through the WorkspaceFilesystem\n * interface (e.g., SAS URL generation, lease management, etc.).\n *\n * This is async because DefaultAzureCredential requires a dynamic import.\n * For non-DefaultAzureCredential auth methods, the promise resolves immediately.\n */\n getContainer(): Promise<ContainerClient> {\n return this.getContainerClient();\n }\n\n getMountConfig(): AzureBlobMountConfig {\n const config: AzureBlobMountConfig = {\n type: 'azure-blob',\n container: this.containerName,\n };\n\n if (this.connectionString) {\n config.connectionString = this.connectionString;\n } else {\n if (this.accountName) {\n config.accountName = this.accountName;\n }\n if (this.accountKey) {\n config.accountKey = this.accountKey;\n }\n if (this.sasToken) {\n config.sasToken = this.sasToken;\n }\n }\n\n if (this.useDefaultCredential) {\n config.useDefaultCredential = true;\n }\n\n if (this.endpoint) {\n config.endpoint = this.endpoint;\n }\n\n if (this.prefix) {\n config.prefix = this.prefix;\n }\n\n if (this.readOnly) {\n config.readOnly = true;\n }\n\n return config;\n }\n\n getInfo(): FilesystemInfo<{\n container: string;\n endpoint?: string;\n prefix?: string;\n }> {\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n error: this.error,\n readOnly: this.readOnly,\n icon: this.icon,\n metadata: {\n container: this.containerName,\n ...(this.endpoint && { endpoint: this.endpoint }),\n ...(this.prefix && { prefix: this.prefix }),\n },\n };\n }\n\n getInstructions(): string {\n const access = this.readOnly ? 'Read-only' : 'Persistent';\n return `Azure Blob Storage in container \"${this.containerName}\". ${access} storage - files are retained across sessions.`;\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private async getReadyContainer(): Promise<ContainerClient> {\n await this.ensureReady();\n return this.getContainerClient();\n }\n\n private toKey(path: string): string {\n const cleanPath = path.replace(/^\\/+/, '');\n return this.prefix + cleanPath;\n }\n\n private handleError(error: unknown): unknown {\n if (isAccessDeniedError(error)) {\n this.status = 'error';\n this.error = 'Access denied - check credentials and container permissions';\n }\n return error;\n }\n\n private assertWritable(path: string, operation: string): void {\n if (this.readOnly) {\n throw new PermissionError(path, `${operation} (filesystem is read-only)`);\n }\n }\n\n // ---------------------------------------------------------------------------\n // File Operations\n // ---------------------------------------------------------------------------\n\n async readFile(path: string, options?: ReadOptions): Promise<string | Buffer> {\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n try {\n const response = await blobClient.download(0);\n const buffer = await streamToBuffer(response.readableStreamBody);\n\n if (options?.encoding) {\n return buffer.toString(options.encoding);\n }\n return buffer;\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async writeFile(path: string, content: FileContent, options?: WriteOptions): Promise<void> {\n this.assertWritable(path, 'write');\n const containerClient = await this.getReadyContainer();\n\n if (options?.overwrite === false && (await this.exists(path))) {\n throw new FileExistsError(path);\n }\n\n const body = toBuffer(content);\n const contentType = getMimeType(path);\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n await blobClient.upload(body, body.length, {\n blobHTTPHeaders: { blobContentType: contentType },\n });\n }\n\n async appendFile(path: string, content: FileContent): Promise<void> {\n this.assertWritable(path, 'append');\n let existing: Buffer = Buffer.alloc(0);\n try {\n const read = await this.readFile(path);\n existing = Buffer.isBuffer(read) ? read : Buffer.from(read);\n } catch (error) {\n if (error instanceof FileNotFoundError) {\n // File doesn't exist, start fresh with empty buffer\n } else {\n throw error;\n }\n }\n\n const appendBuffer = toBuffer(content);\n await this.writeFile(path, Buffer.concat([existing, appendBuffer]));\n }\n\n async deleteFile(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'delete');\n const isDir = await this.isDirectory(path);\n if (isDir) {\n await this.rmdir(path, { recursive: true, force: options?.force });\n return;\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(this.toKey(path));\n\n try {\n await blobClient.delete();\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n if (options?.force) return;\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async copyFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'copy');\n if (options?.overwrite === false && (await this.exists(dest))) {\n throw new FileExistsError(dest);\n }\n\n const containerClient = await this.getReadyContainer();\n const srcBlob = containerClient.getBlobClient(this.toKey(src));\n const destBlob = containerClient.getBlobClient(this.toKey(dest));\n\n try {\n const sasUrl = await srcBlob.generateSasUrl({\n permissions: BlobSASPermissions.parse('r'),\n expiresOn: new Date(Date.now() + 5 * 60 * 1000),\n });\n\n const properties = await srcBlob.getProperties();\n\n if (properties.contentLength === 0) {\n // Azure bug: syncCopyFromURL fails on zero-length blobs with CannotVerifyCopySource\n await destBlob.getBlockBlobClient().upload(Buffer.alloc(0), 0);\n return;\n }\n\n const MAX_SYNC_COPY_SIZE = 256 * 1024 * 1024;\n if ((properties.contentLength ?? 0) <= MAX_SYNC_COPY_SIZE) {\n await destBlob.syncCopyFromURL(sasUrl);\n } else {\n const poller = await destBlob.beginCopyFromURL(sasUrl);\n await poller.pollUntilDone();\n }\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(src);\n }\n\n // SAS generation fails without StorageSharedKeyCredential (e.g. DefaultAzureCredential).\n // Fall back to download+reupload.\n if (\n error instanceof Error &&\n (error.message.includes('generateSasUrl') ||\n (error.message.includes('SAS') && error.message.includes('shared key credential')))\n ) {\n const content = await this.readFile(src);\n await this.writeFile(dest, content);\n return;\n }\n\n throw this.handleError(error);\n }\n }\n\n async moveFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'move');\n await this.copyFile(src, dest, options);\n await this.deleteFile(src, { force: true });\n }\n\n // ---------------------------------------------------------------------------\n // Directory Operations\n // ---------------------------------------------------------------------------\n\n async mkdir(_path: string, _options?: { recursive?: boolean }): Promise<void> {\n // Azure Blob Storage doesn't have real directories - they're just key prefixes.\n // No-op, directories are created implicitly when files are written.\n }\n\n async rmdir(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'rmdir');\n const containerClient = await this.getReadyContainer();\n const prefix = this.toKey(path).replace(/\\/$/, '') + '/';\n\n if (!options?.recursive) {\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n if (!first.done) {\n throw new Error(`Directory not empty: ${path}`);\n }\n return;\n }\n\n // Delete all blobs with this prefix in batches\n let blobNames: string[] = [];\n for await (const blob of containerClient.listBlobsFlat({ prefix })) {\n blobNames.push(blob.name);\n\n if (blobNames.length >= 256) {\n await this.deleteBlobBatch(containerClient, blobNames);\n blobNames = [];\n }\n }\n\n if (blobNames.length > 0) {\n await this.deleteBlobBatch(containerClient, blobNames);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n\n async readdir(path: string, options?: ListOptions): Promise<FileEntry[]> {\n const containerClient = await this.getReadyContainer();\n\n const prefix = this.toKey(path).replace(/\\/$/, '');\n const searchPrefix = prefix ? prefix + '/' : '';\n\n const entries: FileEntry[] = [];\n const seenDirs = new Set<string>();\n\n if (options?.recursive) {\n for await (const blob of containerClient.listBlobsFlat({ prefix: searchPrefix })) {\n const key = blob.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: blob.properties.contentLength,\n });\n }\n } else {\n for await (const item of containerClient.listBlobsByHierarchy('/', { prefix: searchPrefix })) {\n if (item.kind === 'prefix') {\n const dirName = item.name.slice(searchPrefix.length).replace(/\\/$/, '');\n if (dirName && !seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n } else {\n const key = item.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: item.properties.contentLength,\n });\n }\n }\n }\n\n return entries;\n }\n\n // ---------------------------------------------------------------------------\n // Path Operations\n // ---------------------------------------------------------------------------\n\n async exists(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n const exists = await blobClient.exists();\n if (exists) return true;\n\n // Check if it's a \"directory\" (has blobs with this prefix)\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n async stat(path: string): Promise<FileStat> {\n const key = this.toKey(path);\n\n if (!key) {\n return {\n name: '',\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n try {\n const properties = await blobClient.getProperties();\n const name = path.split('/').pop() ?? '';\n\n return {\n name,\n path,\n type: 'file',\n size: properties.contentLength ?? 0,\n createdAt: properties.createdOn ?? new Date(),\n modifiedAt: properties.lastModified ?? new Date(),\n };\n } catch (error: unknown) {\n if (!isNotFoundError(error)) throw this.handleError(error);\n\n const isDir = await this.isDirectory(path);\n if (isDir) {\n const name = path.split('/').filter(Boolean).pop() ?? '';\n return {\n name,\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n throw new FileNotFoundError(path);\n }\n }\n\n async isFile(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return false;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n return blobClient.exists();\n }\n\n async isDirectory(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n async init(): Promise<void> {\n const containerClient = await this.getContainerClient();\n try {\n if (this.sasToken) {\n const iter = containerClient.listBlobsFlat({ prefix: this.prefix });\n await iter.next();\n return;\n }\n\n const exists = await containerClient.exists();\n if (!exists) {\n const err = new Error(`Container \"${this.containerName}\" does not exist`) as Error & { status?: number };\n err.status = 404;\n throw err;\n }\n } catch (error) {\n if ((error as { status?: number }).status) {\n throw error;\n }\n\n const statusCode = (error as RestError).statusCode;\n if (typeof statusCode === 'number') {\n const message = error instanceof Error ? error.message : String(error);\n const err = new Error(message) as Error & { status?: number };\n err.status = statusCode;\n throw err;\n }\n throw error;\n }\n }\n\n async destroy(): Promise<void> {\n this._containerClient = null;\n }\n}\n","import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient } from '@azure/storage-blob';\n\nimport { BlobStore } from '@mastra/core/storage';\nimport type { StorageBlobEntry } from '@mastra/core/storage';\n\n/**\n * Configuration for AzureBlobStore.\n */\nexport interface AzureBlobStoreOptions {\n /** Azure Blob container name */\n container: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Custom endpoint URL (e.g. for the Azurite emulator) */\n endpoint?: string;\n /**\n * Key prefix for all blob objects.\n * Defaults to 'mastra_skill_blobs/'.\n */\n prefix?: string;\n}\n\n/** Trim leading and trailing slashes. */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n return (error as { statusCode?: number }).statusCode === 404;\n}\n\n/** Azure metadata batch limit per request. */\nconst BATCH_DELETE_SIZE = 256;\n\n/**\n * Azure Blob Storage-backed content-addressable blob store for skill versioning.\n *\n * Each blob is stored as a block blob keyed by its SHA-256 hash. Metadata\n * (size, mimeType, createdAt) is stored as Azure blob metadata.\n *\n * Since blobs are content-addressable, writes are idempotent — the same hash\n * always maps to the same content, so overwrites are safe and equivalent to\n * a no-op.\n *\n * @example Connection string\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING!,\n * });\n * ```\n *\n * @example Account key\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME!,\n * accountKey: process.env.AZURE_STORAGE_ACCOUNT_KEY!,\n * });\n * ```\n */\nexport class AzureBlobStore extends BlobStore {\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly endpoint?: string;\n private readonly prefix: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobStoreOptions) {\n super();\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.endpoint = options.endpoint;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : 'mastra_skill_blobs/';\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private toKey(hash: string): string {\n return this.prefix + hash;\n }\n\n async init(): Promise<void> {\n // Azure does not require table creation — the container is expected to exist.\n }\n\n async put(entry: StorageBlobEntry): Promise<void> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(entry.hash));\n const now = entry.createdAt ?? new Date();\n const buffer = Buffer.from(entry.content, 'utf-8');\n\n await blobClient.uploadData(buffer, {\n blobHTTPHeaders: {\n blobContentType: entry.mimeType ?? 'application/octet-stream',\n },\n metadata: {\n size: String(entry.size),\n createdat: now.toISOString(),\n ...(entry.mimeType ? { mimetype: entry.mimeType } : {}),\n },\n });\n }\n\n async get(hash: string): Promise<StorageBlobEntry | null> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n const buffer = await blobClient.downloadToBuffer();\n const properties = await blobClient.getProperties();\n const metadata = properties.metadata ?? {};\n const content = buffer.toString('utf-8');\n\n return {\n hash,\n content,\n size: metadata.size != null ? Number(metadata.size) : Buffer.byteLength(content, 'utf-8'),\n mimeType: metadata.mimetype || properties.contentType || undefined,\n createdAt: metadata.createdat ? new Date(metadata.createdat) : new Date(),\n };\n } catch (error: unknown) {\n if (isNotFoundError(error)) return null;\n throw error;\n }\n }\n\n async has(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n await blobClient.getProperties();\n return true;\n } catch (error: unknown) {\n if (isNotFoundError(error)) return false;\n throw error;\n }\n }\n\n async delete(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n const response = await blobClient.deleteIfExists();\n return response.succeeded;\n }\n\n async putMany(entries: StorageBlobEntry[]): Promise<void> {\n if (entries.length === 0) return;\n // Azure does not have a batch PUT, so we parallelize individual puts.\n // Content-addressable means duplicate writes are idempotent.\n await Promise.all(entries.map(entry => this.put(entry)));\n }\n\n async getMany(hashes: string[]): Promise<Map<string, StorageBlobEntry>> {\n const result = new Map<string, StorageBlobEntry>();\n if (hashes.length === 0) return result;\n\n const entries = await Promise.all(hashes.map(hash => this.get(hash)));\n for (const entry of entries) {\n if (entry) {\n result.set(entry.hash, entry);\n }\n }\n return result;\n }\n\n async dangerouslyClearAll(): Promise<void> {\n const containerClient = await this.getContainerClient();\n let batch: string[] = [];\n\n for await (const blob of containerClient.listBlobsFlat({ prefix: this.prefix })) {\n batch.push(blob.name);\n if (batch.length >= BATCH_DELETE_SIZE) {\n await this.deleteBlobBatch(containerClient, batch);\n batch = [];\n }\n }\n\n if (batch.length > 0) {\n await this.deleteBlobBatch(containerClient, batch);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n}\n","import type { BlobStoreProvider, FilesystemProvider } from '@mastra/core/editor';\nimport { AzureBlobStore } from './blob-store';\nimport type { AzureBlobStoreOptions } from './blob-store';\nimport { AzureBlobFilesystem } from './filesystem';\nimport type { AzureBlobFilesystemOptions } from './filesystem';\n\nexport const azureBlobFilesystemProvider: FilesystemProvider<AzureBlobFilesystemOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Storage',\n description: 'Azure Blob Storage container',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix (acts like a subdirectory)' },\n readOnly: { type: 'boolean', description: 'Mount as read-only', default: false },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createFilesystem: config => new AzureBlobFilesystem(config),\n};\n\nexport const azureBlobStoreProvider: BlobStoreProvider<AzureBlobStoreOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Store',\n description: 'Content-addressable blob storage backed by Azure Blob Storage',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix for blob objects (default: mastra_skill_blobs/)' },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createBlobStore: config => new AzureBlobStore(config),\n};\n"],"mappings":";;;;;;;;;AA2CA,MAAM,aAAqC;CACzC,QAAQ;CACR,OAAO;CACP,aAAa;CACb,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;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AAM;IAAU,aAAa;GAAuB;GACnE,YAAY;IAAE,MAAM;IAAU,aAAa;GAAsB;GACjE,UAAU;IAAE,MAAM;IAAU,aAAa;GAAgC;GACzE,kBAAkB;IAAE,MAAM;IAAU,aAAa;GAAwD;GACzG,sBAAsB;IACpB,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IAAE,MAAM;IAAU,aAAa;GAAwC;GAC/E,UAAU;IAAE,MAAM;IAAW,aAAa;IAAsB,SAAS;GAAM;GAC/E,UAAU;IAAE,MAAM;IAAU,aAAa;GAA6C;EACxF;CACF;CACA,mBAAkB,WAAU,IAAI,oBAAoB,MAAM;AAC5D;AAEA,MAAa,yBAAmE;CAC9E,IAAI;CACJ,MAAM;CACN,aAAa;CACb,cAAc;EACZ,MAAM;EACN,UAAU,CAAC,WAAW;EACtB,YAAY;GACV,WAAW;IAAE,MAAM;IAAU,aAAa;GAA4B;GACtE,aAAa;IAAE,MAAM;IAAU,aAAa;GAAuB;GACnE,YAAY;IAAE,MAAM;IAAU,aAAa;GAAsB;GACjE,UAAU;IAAE,MAAM;IAAU,aAAa;GAAgC;GACzE,kBAAkB;IAAE,MAAM;IAAU,aAAa;GAAwD;GACzG,sBAAsB;IACpB,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IAAE,MAAM;IAAU,aAAa;GAA6D;GACpG,UAAU;IAAE,MAAM;IAAU,aAAa;GAA6C;EACxF;CACF;CACA,kBAAiB,WAAU,IAAI,eAAe,MAAM;AACtD"}
|
|
1
|
+
{"version":3,"file":"blob-Bds4wJ8g.js","names":["isNotFoundError","restErr","trimSlashes"],"sources":["../src/blob/filesystem/index.ts","../src/blob/blob-store/index.ts","../src/blob/provider.ts"],"sourcesContent":["/**\n * Azure Blob Storage Filesystem Provider\n *\n * A filesystem implementation backed by Azure Blob Storage.\n */\n\nimport { BlobSASPermissions, BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient, RestError } from '@azure/storage-blob';\n\nimport type {\n FileContent,\n FileStat,\n FileEntry,\n ReadOptions,\n WriteOptions,\n ListOptions,\n RemoveOptions,\n CopyOptions,\n FilesystemInfo,\n FilesystemMountConfig,\n FilesystemIcon,\n ProviderStatus,\n MastraFilesystemOptions,\n} from '@mastra/core/workspace';\nimport { MastraFilesystem, FileNotFoundError, FileExistsError, PermissionError } from '@mastra/core/workspace';\n\n/**\n * Azure Blob mount configuration.\n * Returned by AzureBlobFilesystem.getMountConfig() for FUSE mounting in sandboxes.\n */\nexport interface AzureBlobMountConfig extends FilesystemMountConfig {\n type: 'azure-blob';\n container: string;\n accountName?: string;\n accountKey?: string;\n sasToken?: string;\n connectionString?: string;\n useDefaultCredential?: boolean;\n endpoint?: string;\n prefix?: string;\n readOnly?: boolean;\n}\n\nconst MIME_TYPES: Record<string, string> = {\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.markdown': 'text/markdown',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.css': 'text/css',\n '.csv': 'text/csv',\n '.xml': 'text/xml',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.ts': 'text/typescript',\n '.tsx': 'text/typescript',\n '.jsx': 'text/javascript',\n '.json': 'application/json',\n '.yaml': 'text/yaml',\n '.yml': 'text/yaml',\n '.py': 'text/x-python',\n '.rb': 'text/x-ruby',\n '.sh': 'text/x-shellscript',\n '.bash': 'text/x-shellscript',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.webp': 'image/webp',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.zip': 'application/zip',\n '.gz': 'application/gzip',\n '.tar': 'application/x-tar',\n};\n\nfunction getMimeType(path: string): string {\n const ext = path.toLowerCase().match(/\\.[^.]+$/)?.[0];\n return ext ? (MIME_TYPES[ext] ?? 'application/octet-stream') : 'application/octet-stream';\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 404;\n}\n\nfunction isAccessDeniedError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 403;\n}\n\n/** Trim leading and trailing slashes without regex (avoids polynomial regex on user input). */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nasync function streamToBuffer(stream: NodeJS.ReadableStream | undefined): Promise<Buffer> {\n if (!stream) return Buffer.alloc(0);\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks);\n}\n\nfunction toBuffer(content: FileContent): Buffer {\n if (Buffer.isBuffer(content)) return content;\n return typeof content === 'string' ? Buffer.from(content, 'utf-8') : Buffer.from(content);\n}\n\nexport interface AzureBlobFilesystemOptions extends MastraFilesystemOptions {\n /** Unique identifier for this filesystem instance */\n id?: string;\n /** Azure Blob container name */\n container: string;\n /** Human-friendly display name for the UI */\n displayName?: string;\n /** Icon identifier for the UI (defaults to 'azure-blob') */\n icon?: FilesystemIcon;\n /** Description shown in tooltips */\n description?: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Supports Managed Identity, Azure CLI, environment variables, etc.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Optional prefix for all keys (acts like a subdirectory) */\n prefix?: string;\n /** Mount as read-only (blocks write operations, mounts read-only in sandboxes) */\n readOnly?: boolean;\n /**\n * Custom endpoint URL.\n * Used for local development with Azurite emulator.\n */\n endpoint?: string;\n}\n\nexport class AzureBlobFilesystem extends MastraFilesystem {\n readonly id: string;\n readonly name = 'AzureBlobFilesystem';\n readonly provider = 'azure-blob';\n readonly readOnly?: boolean;\n\n status: ProviderStatus = 'pending';\n\n readonly displayName?: string;\n readonly icon: FilesystemIcon = 'azure-blob';\n readonly description?: string;\n\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly prefix: string;\n private readonly endpoint?: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobFilesystemOptions) {\n super({ ...options, name: 'AzureBlobFilesystem' });\n this.id = options.id ?? `azure-fs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : '';\n this.endpoint = options.endpoint;\n\n this.displayName = options.displayName ?? 'Azure Blob Storage';\n this.icon = options.icon ?? 'azure-blob';\n this.description = options.description;\n this.readOnly = options.readOnly;\n }\n\n /**\n * Get the underlying ContainerClient for direct access to Azure Blob APIs.\n *\n * Use this when you need features not exposed through the WorkspaceFilesystem\n * interface (e.g., SAS URL generation, lease management, etc.).\n *\n * This is async because DefaultAzureCredential requires a dynamic import.\n * For non-DefaultAzureCredential auth methods, the promise resolves immediately.\n */\n getContainer(): Promise<ContainerClient> {\n return this.getContainerClient();\n }\n\n getMountConfig(): AzureBlobMountConfig {\n const config: AzureBlobMountConfig = {\n type: 'azure-blob',\n container: this.containerName,\n };\n\n if (this.connectionString) {\n config.connectionString = this.connectionString;\n } else {\n if (this.accountName) {\n config.accountName = this.accountName;\n }\n if (this.accountKey) {\n config.accountKey = this.accountKey;\n }\n if (this.sasToken) {\n config.sasToken = this.sasToken;\n }\n }\n\n if (this.useDefaultCredential) {\n config.useDefaultCredential = true;\n }\n\n if (this.endpoint) {\n config.endpoint = this.endpoint;\n }\n\n if (this.prefix) {\n config.prefix = this.prefix;\n }\n\n if (this.readOnly) {\n config.readOnly = true;\n }\n\n return config;\n }\n\n getInfo(): FilesystemInfo<{\n container: string;\n endpoint?: string;\n prefix?: string;\n }> {\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n error: this.error,\n readOnly: this.readOnly,\n icon: this.icon,\n metadata: {\n container: this.containerName,\n ...(this.endpoint && { endpoint: this.endpoint }),\n ...(this.prefix && { prefix: this.prefix }),\n },\n };\n }\n\n getInstructions(): string {\n const access = this.readOnly ? 'Read-only' : 'Persistent';\n return `Azure Blob Storage in container \"${this.containerName}\". ${access} storage - files are retained across sessions.`;\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private async getReadyContainer(): Promise<ContainerClient> {\n await this.ensureReady();\n return this.getContainerClient();\n }\n\n private toKey(path: string): string {\n const cleanPath = path.replace(/^\\/+/, '');\n return this.prefix + cleanPath;\n }\n\n private handleError(error: unknown): unknown {\n if (isAccessDeniedError(error)) {\n this.status = 'error';\n this.error = 'Access denied - check credentials and container permissions';\n }\n return error;\n }\n\n private assertWritable(path: string, operation: string): void {\n if (this.readOnly) {\n throw new PermissionError(path, `${operation} (filesystem is read-only)`);\n }\n }\n\n // ---------------------------------------------------------------------------\n // File Operations\n // ---------------------------------------------------------------------------\n\n async readFile(path: string, options?: ReadOptions): Promise<string | Buffer> {\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n try {\n const response = await blobClient.download(0);\n const buffer = await streamToBuffer(response.readableStreamBody);\n\n if (options?.encoding) {\n return buffer.toString(options.encoding);\n }\n return buffer;\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async writeFile(path: string, content: FileContent, options?: WriteOptions): Promise<void> {\n this.assertWritable(path, 'write');\n const containerClient = await this.getReadyContainer();\n\n if (options?.overwrite === false && (await this.exists(path))) {\n throw new FileExistsError(path);\n }\n\n const body = toBuffer(content);\n const contentType = getMimeType(path);\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n await blobClient.upload(body, body.length, {\n blobHTTPHeaders: { blobContentType: contentType },\n });\n }\n\n async appendFile(path: string, content: FileContent): Promise<void> {\n this.assertWritable(path, 'append');\n let existing: Buffer = Buffer.alloc(0);\n try {\n const read = await this.readFile(path);\n existing = Buffer.isBuffer(read) ? read : Buffer.from(read);\n } catch (error) {\n if (error instanceof FileNotFoundError) {\n // File doesn't exist, start fresh with empty buffer\n } else {\n throw error;\n }\n }\n\n const appendBuffer = toBuffer(content);\n await this.writeFile(path, Buffer.concat([existing, appendBuffer]));\n }\n\n async deleteFile(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'delete');\n const isDir = await this.isDirectory(path);\n if (isDir) {\n await this.rmdir(path, { recursive: true, force: options?.force });\n return;\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(this.toKey(path));\n\n try {\n await blobClient.delete();\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n if (options?.force) return;\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async copyFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'copy');\n if (options?.overwrite === false && (await this.exists(dest))) {\n throw new FileExistsError(dest);\n }\n\n const containerClient = await this.getReadyContainer();\n const srcBlob = containerClient.getBlobClient(this.toKey(src));\n const destBlob = containerClient.getBlobClient(this.toKey(dest));\n\n try {\n const sasUrl = await srcBlob.generateSasUrl({\n permissions: BlobSASPermissions.parse('r'),\n expiresOn: new Date(Date.now() + 5 * 60 * 1000),\n });\n\n const properties = await srcBlob.getProperties();\n\n if (properties.contentLength === 0) {\n // Azure bug: syncCopyFromURL fails on zero-length blobs with CannotVerifyCopySource\n await destBlob.getBlockBlobClient().upload(Buffer.alloc(0), 0);\n return;\n }\n\n const MAX_SYNC_COPY_SIZE = 256 * 1024 * 1024;\n if ((properties.contentLength ?? 0) <= MAX_SYNC_COPY_SIZE) {\n await destBlob.syncCopyFromURL(sasUrl);\n } else {\n const poller = await destBlob.beginCopyFromURL(sasUrl);\n await poller.pollUntilDone();\n }\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(src);\n }\n\n // SAS generation fails without StorageSharedKeyCredential (e.g. DefaultAzureCredential).\n // Fall back to download+reupload.\n if (\n error instanceof Error &&\n (error.message.includes('generateSasUrl') ||\n (error.message.includes('SAS') && error.message.includes('shared key credential')))\n ) {\n const content = await this.readFile(src);\n await this.writeFile(dest, content);\n return;\n }\n\n throw this.handleError(error);\n }\n }\n\n async moveFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'move');\n await this.copyFile(src, dest, options);\n await this.deleteFile(src, { force: true });\n }\n\n // ---------------------------------------------------------------------------\n // Directory Operations\n // ---------------------------------------------------------------------------\n\n async mkdir(_path: string, _options?: { recursive?: boolean }): Promise<void> {\n // Azure Blob Storage doesn't have real directories - they're just key prefixes.\n // No-op, directories are created implicitly when files are written.\n }\n\n async rmdir(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'rmdir');\n const containerClient = await this.getReadyContainer();\n const prefix = this.toKey(path).replace(/\\/$/, '') + '/';\n\n if (!options?.recursive) {\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n if (!first.done) {\n throw new Error(`Directory not empty: ${path}`);\n }\n return;\n }\n\n // Delete all blobs with this prefix in batches\n let blobNames: string[] = [];\n for await (const blob of containerClient.listBlobsFlat({ prefix })) {\n blobNames.push(blob.name);\n\n if (blobNames.length >= 256) {\n await this.deleteBlobBatch(containerClient, blobNames);\n blobNames = [];\n }\n }\n\n if (blobNames.length > 0) {\n await this.deleteBlobBatch(containerClient, blobNames);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n\n async readdir(path: string, options?: ListOptions): Promise<FileEntry[]> {\n const containerClient = await this.getReadyContainer();\n\n const prefix = this.toKey(path).replace(/\\/$/, '');\n const searchPrefix = prefix ? prefix + '/' : '';\n\n const entries: FileEntry[] = [];\n const seenDirs = new Set<string>();\n\n if (options?.recursive) {\n for await (const blob of containerClient.listBlobsFlat({ prefix: searchPrefix })) {\n const key = blob.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: blob.properties.contentLength,\n });\n }\n } else {\n for await (const item of containerClient.listBlobsByHierarchy('/', { prefix: searchPrefix })) {\n if (item.kind === 'prefix') {\n const dirName = item.name.slice(searchPrefix.length).replace(/\\/$/, '');\n if (dirName && !seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n } else {\n const key = item.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: item.properties.contentLength,\n });\n }\n }\n }\n\n return entries;\n }\n\n // ---------------------------------------------------------------------------\n // Path Operations\n // ---------------------------------------------------------------------------\n\n async exists(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n const exists = await blobClient.exists();\n if (exists) return true;\n\n // Check if it's a \"directory\" (has blobs with this prefix)\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n async stat(path: string): Promise<FileStat> {\n const key = this.toKey(path);\n\n if (!key) {\n return {\n name: '',\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n try {\n const properties = await blobClient.getProperties();\n const name = path.split('/').pop() ?? '';\n\n return {\n name,\n path,\n type: 'file',\n size: properties.contentLength ?? 0,\n createdAt: properties.createdOn ?? new Date(),\n modifiedAt: properties.lastModified ?? new Date(),\n };\n } catch (error: unknown) {\n if (!isNotFoundError(error)) throw this.handleError(error);\n\n const isDir = await this.isDirectory(path);\n if (isDir) {\n const name = path.split('/').filter(Boolean).pop() ?? '';\n return {\n name,\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n throw new FileNotFoundError(path);\n }\n }\n\n async isFile(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return false;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n return blobClient.exists();\n }\n\n async isDirectory(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n async init(): Promise<void> {\n const containerClient = await this.getContainerClient();\n try {\n if (this.sasToken) {\n const iter = containerClient.listBlobsFlat({ prefix: this.prefix });\n await iter.next();\n return;\n }\n\n const exists = await containerClient.exists();\n if (!exists) {\n const err = new Error(`Container \"${this.containerName}\" does not exist`) as Error & { status?: number };\n err.status = 404;\n throw err;\n }\n } catch (error) {\n if ((error as { status?: number }).status) {\n throw error;\n }\n\n const statusCode = (error as RestError).statusCode;\n if (typeof statusCode === 'number') {\n const message = error instanceof Error ? error.message : String(error);\n const err = new Error(message) as Error & { status?: number };\n err.status = statusCode;\n throw err;\n }\n throw error;\n }\n }\n\n async destroy(): Promise<void> {\n this._containerClient = null;\n }\n}\n","import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient } from '@azure/storage-blob';\n\nimport { BlobStore } from '@mastra/core/storage';\nimport type { StorageBlobEntry } from '@mastra/core/storage';\n\n/**\n * Configuration for AzureBlobStore.\n */\nexport interface AzureBlobStoreOptions {\n /** Azure Blob container name */\n container: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Custom endpoint URL (e.g. for the Azurite emulator) */\n endpoint?: string;\n /**\n * Key prefix for all blob objects.\n * Defaults to 'mastra_skill_blobs/'.\n */\n prefix?: string;\n}\n\n/** Trim leading and trailing slashes. */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n return (error as { statusCode?: number }).statusCode === 404;\n}\n\n/** Azure metadata batch limit per request. */\nconst BATCH_DELETE_SIZE = 256;\n\n/**\n * Azure Blob Storage-backed content-addressable blob store for skill versioning.\n *\n * Each blob is stored as a block blob keyed by its SHA-256 hash. Metadata\n * (size, mimeType, createdAt) is stored as Azure blob metadata.\n *\n * Since blobs are content-addressable, writes are idempotent — the same hash\n * always maps to the same content, so overwrites are safe and equivalent to\n * a no-op.\n *\n * @example Connection string\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING!,\n * });\n * ```\n *\n * @example Account key\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME!,\n * accountKey: process.env.AZURE_STORAGE_ACCOUNT_KEY!,\n * });\n * ```\n */\nexport class AzureBlobStore extends BlobStore {\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly endpoint?: string;\n private readonly prefix: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobStoreOptions) {\n super();\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.endpoint = options.endpoint;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : 'mastra_skill_blobs/';\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private toKey(hash: string): string {\n return this.prefix + hash;\n }\n\n async init(): Promise<void> {\n // Azure does not require table creation — the container is expected to exist.\n }\n\n async put(entry: StorageBlobEntry): Promise<void> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(entry.hash));\n const now = entry.createdAt ?? new Date();\n const buffer = Buffer.from(entry.content, 'utf-8');\n\n await blobClient.uploadData(buffer, {\n blobHTTPHeaders: {\n blobContentType: entry.mimeType ?? 'application/octet-stream',\n },\n metadata: {\n size: String(entry.size),\n createdat: now.toISOString(),\n ...(entry.mimeType ? { mimetype: entry.mimeType } : {}),\n },\n });\n }\n\n async get(hash: string): Promise<StorageBlobEntry | null> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n const buffer = await blobClient.downloadToBuffer();\n const properties = await blobClient.getProperties();\n const metadata = properties.metadata ?? {};\n const content = buffer.toString('utf-8');\n\n return {\n hash,\n content,\n size: metadata.size != null ? Number(metadata.size) : Buffer.byteLength(content, 'utf-8'),\n mimeType: metadata.mimetype || properties.contentType || undefined,\n createdAt: metadata.createdat ? new Date(metadata.createdat) : new Date(),\n };\n } catch (error: unknown) {\n if (isNotFoundError(error)) return null;\n throw error;\n }\n }\n\n async has(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n await blobClient.getProperties();\n return true;\n } catch (error: unknown) {\n if (isNotFoundError(error)) return false;\n throw error;\n }\n }\n\n async delete(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n const response = await blobClient.deleteIfExists();\n return response.succeeded;\n }\n\n async putMany(entries: StorageBlobEntry[]): Promise<void> {\n if (entries.length === 0) return;\n // Azure does not have a batch PUT, so we parallelize individual puts.\n // Content-addressable means duplicate writes are idempotent.\n await Promise.all(entries.map(entry => this.put(entry)));\n }\n\n async getMany(hashes: string[]): Promise<Map<string, StorageBlobEntry>> {\n const result = new Map<string, StorageBlobEntry>();\n if (hashes.length === 0) return result;\n\n const entries = await Promise.all(hashes.map(hash => this.get(hash)));\n for (const entry of entries) {\n if (entry) {\n result.set(entry.hash, entry);\n }\n }\n return result;\n }\n\n async dangerouslyClearAll(): Promise<void> {\n const containerClient = await this.getContainerClient();\n let batch: string[] = [];\n\n for await (const blob of containerClient.listBlobsFlat({ prefix: this.prefix })) {\n batch.push(blob.name);\n if (batch.length >= BATCH_DELETE_SIZE) {\n await this.deleteBlobBatch(containerClient, batch);\n batch = [];\n }\n }\n\n if (batch.length > 0) {\n await this.deleteBlobBatch(containerClient, batch);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n}\n","import type { BlobStoreProvider, FilesystemProvider } from '@mastra/core/editor';\nimport { AzureBlobStore } from './blob-store';\nimport type { AzureBlobStoreOptions } from './blob-store';\nimport { AzureBlobFilesystem } from './filesystem';\nimport type { AzureBlobFilesystemOptions } from './filesystem';\n\nexport const azureBlobFilesystemProvider: FilesystemProvider<AzureBlobFilesystemOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Storage',\n description: 'Azure Blob Storage container',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix (acts like a subdirectory)' },\n readOnly: { type: 'boolean', description: 'Mount as read-only', default: false },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createFilesystem: config => new AzureBlobFilesystem(config),\n};\n\nexport const azureBlobStoreProvider: BlobStoreProvider<AzureBlobStoreOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Store',\n description: 'Content-addressable blob storage backed by Azure Blob Storage',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix for blob objects (default: mastra_skill_blobs/)' },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createBlobStore: config => new AzureBlobStore(config),\n};\n"],"mappings":";;;;;;;;;AA2CA,MAAM,aAAqC;CACzC,QAAQ;CACR,OAAO;CACP,aAAa;CACb,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ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Aa;GAA4B;GACtE,aAAa;IAAE,MAAM;IAAU,aAAa;GAAuB;GACnE,YAAY;IAAE,MAAM;IAAU,aAAa;GAAsB;GACjE,UAAU;IAAE,MAAM;IAAU,aAAa;GAAgC;GACzE,kBAAkB;IAAE,MAAM;IAAU,aAAa;GAAwD;GACzG,sBAAsB;IACpB,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IAAE,MAAM;IAAU,aAAa;GAAwC;GAC/E,UAAU;IAAE,MAAM;IAAW,aAAa;IAAsB,SAAS;GAAM;GAC/E,UAAU;IAAE,MAAM;IAAU,aAAa;GAA6C;EACxF;CACF;CACA,mBAAkB,WAAU,IAAI,oBAAoB,MAAM;AAC5D;AAEA,MAAa,yBAAmE;CAC9E,IAAI;CACJ,MAAM;CACN,aAAa;CACb,cAAc;EACZ,MAAM;EACN,UAAU,CAAC,WAAW;EACtB,YAAY;GACV,WAAW;IAAE,MAAM;IAAU,aAAa;GAA4B;GACtE,aAAa;IAAE,MAAM;IAAU,aAAa;GAAuB;GACnE,YAAY;IAAE,MAAM;IAAU,aAAa;GAAsB;GACjE,UAAU;IAAE,MAAM;IAAU,aAAa;GAAgC;GACzE,kBAAkB;IAAE,MAAM;IAAU,aAAa;GAAwD;GACzG,sBAAsB;IACpB,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IAAE,MAAM;IAAU,aAAa;GAA6D;GACpG,UAAU;IAAE,MAAM;IAAU,aAAa;GAA6C;EACxF;CACF;CACA,kBAAiB,WAAU,IAAI,eAAe,MAAM;AACtD"}
|
|
@@ -163,12 +163,16 @@ var AzureBlobFilesystem = class extends _mastra_core_workspace.MastraFilesystem
|
|
|
163
163
|
else {
|
|
164
164
|
if (!this.endpoint && !this.accountName) throw new Error("Azure Blob Storage requires either a connectionString, or an accountName/endpoint. Provide at least one of: connectionString, accountName, or endpoint.");
|
|
165
165
|
const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;
|
|
166
|
-
if (this.accountName && this.accountKey)
|
|
167
|
-
|
|
166
|
+
if (this.accountName && this.accountKey) {
|
|
167
|
+
const credential = new _azure_storage_blob.StorageSharedKeyCredential(this.accountName, this.accountKey);
|
|
168
|
+
serviceClient = new _azure_storage_blob.BlobServiceClient(baseUrl, credential);
|
|
169
|
+
} else if (this.sasToken) {
|
|
168
170
|
const sas = this.sasToken.replace(/^\?+/, "");
|
|
169
|
-
|
|
171
|
+
const separator = baseUrl.includes("?") ? "&" : "?";
|
|
172
|
+
serviceClient = new _azure_storage_blob.BlobServiceClient(`${baseUrl}${separator}${sas}`);
|
|
170
173
|
} else if (this.useDefaultCredential) try {
|
|
171
|
-
|
|
174
|
+
const credential = new (await (import("@azure/identity"))).DefaultAzureCredential();
|
|
175
|
+
serviceClient = new _azure_storage_blob.BlobServiceClient(baseUrl, credential);
|
|
172
176
|
} catch {
|
|
173
177
|
throw new Error("DefaultAzureCredential requires @azure/identity to be installed. Install it with: npm install @azure/identity");
|
|
174
178
|
}
|
|
@@ -255,14 +259,14 @@ var AzureBlobFilesystem = class extends _mastra_core_workspace.MastraFilesystem
|
|
|
255
259
|
try {
|
|
256
260
|
const sasUrl = await srcBlob.generateSasUrl({
|
|
257
261
|
permissions: _azure_storage_blob.BlobSASPermissions.parse("r"),
|
|
258
|
-
expiresOn: new Date(Date.now() +
|
|
262
|
+
expiresOn: new Date(Date.now() + 3e5)
|
|
259
263
|
});
|
|
260
264
|
const properties = await srcBlob.getProperties();
|
|
261
265
|
if (properties.contentLength === 0) {
|
|
262
266
|
await destBlob.getBlockBlobClient().upload(Buffer.alloc(0), 0);
|
|
263
267
|
return;
|
|
264
268
|
}
|
|
265
|
-
if ((properties.contentLength ?? 0) <=
|
|
269
|
+
if ((properties.contentLength ?? 0) <= 268435456) await destBlob.syncCopyFromURL(sasUrl);
|
|
266
270
|
else await (await destBlob.beginCopyFromURL(sasUrl)).pollUntilDone();
|
|
267
271
|
} catch (error) {
|
|
268
272
|
if (isNotFoundError$1(error)) throw new _mastra_core_workspace.FileNotFoundError(src);
|
|
@@ -526,12 +530,16 @@ var AzureBlobStore = class extends _mastra_core_storage.BlobStore {
|
|
|
526
530
|
else {
|
|
527
531
|
if (!this.endpoint && !this.accountName) throw new Error("Azure Blob Storage requires either a connectionString, or an accountName/endpoint. Provide at least one of: connectionString, accountName, or endpoint.");
|
|
528
532
|
const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;
|
|
529
|
-
if (this.accountName && this.accountKey)
|
|
530
|
-
|
|
533
|
+
if (this.accountName && this.accountKey) {
|
|
534
|
+
const credential = new _azure_storage_blob.StorageSharedKeyCredential(this.accountName, this.accountKey);
|
|
535
|
+
serviceClient = new _azure_storage_blob.BlobServiceClient(baseUrl, credential);
|
|
536
|
+
} else if (this.sasToken) {
|
|
531
537
|
const sas = this.sasToken.replace(/^\?+/, "");
|
|
532
|
-
|
|
538
|
+
const separator = baseUrl.includes("?") ? "&" : "?";
|
|
539
|
+
serviceClient = new _azure_storage_blob.BlobServiceClient(`${baseUrl}${separator}${sas}`);
|
|
533
540
|
} else if (this.useDefaultCredential) try {
|
|
534
|
-
|
|
541
|
+
const credential = new (await (import("@azure/identity"))).DefaultAzureCredential();
|
|
542
|
+
serviceClient = new _azure_storage_blob.BlobServiceClient(baseUrl, credential);
|
|
535
543
|
} catch {
|
|
536
544
|
throw new Error("DefaultAzureCredential requires @azure/identity to be installed. Install it with: npm install @azure/identity");
|
|
537
545
|
}
|
|
@@ -740,4 +748,4 @@ Object.defineProperty(exports, "azureBlobStoreProvider", {
|
|
|
740
748
|
}
|
|
741
749
|
});
|
|
742
750
|
|
|
743
|
-
//# sourceMappingURL=blob-
|
|
751
|
+
//# sourceMappingURL=blob-Dbkc3LM4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-B1rO2XRY.cjs","names":["isNotFoundError","restErr","trimSlashes","MastraFilesystem","BlobServiceClient","StorageSharedKeyCredential","PermissionError","FileNotFoundError","FileExistsError","BlobSASPermissions","BlobStore","BlobServiceClient","StorageSharedKeyCredential"],"sources":["../src/blob/filesystem/index.ts","../src/blob/blob-store/index.ts","../src/blob/provider.ts"],"sourcesContent":["/**\n * Azure Blob Storage Filesystem Provider\n *\n * A filesystem implementation backed by Azure Blob Storage.\n */\n\nimport { BlobSASPermissions, BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient, RestError } from '@azure/storage-blob';\n\nimport type {\n FileContent,\n FileStat,\n FileEntry,\n ReadOptions,\n WriteOptions,\n ListOptions,\n RemoveOptions,\n CopyOptions,\n FilesystemInfo,\n FilesystemMountConfig,\n FilesystemIcon,\n ProviderStatus,\n MastraFilesystemOptions,\n} from '@mastra/core/workspace';\nimport { MastraFilesystem, FileNotFoundError, FileExistsError, PermissionError } from '@mastra/core/workspace';\n\n/**\n * Azure Blob mount configuration.\n * Returned by AzureBlobFilesystem.getMountConfig() for FUSE mounting in sandboxes.\n */\nexport interface AzureBlobMountConfig extends FilesystemMountConfig {\n type: 'azure-blob';\n container: string;\n accountName?: string;\n accountKey?: string;\n sasToken?: string;\n connectionString?: string;\n useDefaultCredential?: boolean;\n endpoint?: string;\n prefix?: string;\n readOnly?: boolean;\n}\n\nconst MIME_TYPES: Record<string, string> = {\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.markdown': 'text/markdown',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.css': 'text/css',\n '.csv': 'text/csv',\n '.xml': 'text/xml',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.ts': 'text/typescript',\n '.tsx': 'text/typescript',\n '.jsx': 'text/javascript',\n '.json': 'application/json',\n '.yaml': 'text/yaml',\n '.yml': 'text/yaml',\n '.py': 'text/x-python',\n '.rb': 'text/x-ruby',\n '.sh': 'text/x-shellscript',\n '.bash': 'text/x-shellscript',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.webp': 'image/webp',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.zip': 'application/zip',\n '.gz': 'application/gzip',\n '.tar': 'application/x-tar',\n};\n\nfunction getMimeType(path: string): string {\n const ext = path.toLowerCase().match(/\\.[^.]+$/)?.[0];\n return ext ? (MIME_TYPES[ext] ?? 'application/octet-stream') : 'application/octet-stream';\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 404;\n}\n\nfunction isAccessDeniedError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 403;\n}\n\n/** Trim leading and trailing slashes without regex (avoids polynomial regex on user input). */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nasync function streamToBuffer(stream: NodeJS.ReadableStream | undefined): Promise<Buffer> {\n if (!stream) return Buffer.alloc(0);\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks);\n}\n\nfunction toBuffer(content: FileContent): Buffer {\n if (Buffer.isBuffer(content)) return content;\n return typeof content === 'string' ? Buffer.from(content, 'utf-8') : Buffer.from(content);\n}\n\nexport interface AzureBlobFilesystemOptions extends MastraFilesystemOptions {\n /** Unique identifier for this filesystem instance */\n id?: string;\n /** Azure Blob container name */\n container: string;\n /** Human-friendly display name for the UI */\n displayName?: string;\n /** Icon identifier for the UI (defaults to 'azure-blob') */\n icon?: FilesystemIcon;\n /** Description shown in tooltips */\n description?: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Supports Managed Identity, Azure CLI, environment variables, etc.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Optional prefix for all keys (acts like a subdirectory) */\n prefix?: string;\n /** Mount as read-only (blocks write operations, mounts read-only in sandboxes) */\n readOnly?: boolean;\n /**\n * Custom endpoint URL.\n * Used for local development with Azurite emulator.\n */\n endpoint?: string;\n}\n\nexport class AzureBlobFilesystem extends MastraFilesystem {\n readonly id: string;\n readonly name = 'AzureBlobFilesystem';\n readonly provider = 'azure-blob';\n readonly readOnly?: boolean;\n\n status: ProviderStatus = 'pending';\n\n readonly displayName?: string;\n readonly icon: FilesystemIcon = 'azure-blob';\n readonly description?: string;\n\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly prefix: string;\n private readonly endpoint?: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobFilesystemOptions) {\n super({ ...options, name: 'AzureBlobFilesystem' });\n this.id = options.id ?? `azure-fs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : '';\n this.endpoint = options.endpoint;\n\n this.displayName = options.displayName ?? 'Azure Blob Storage';\n this.icon = options.icon ?? 'azure-blob';\n this.description = options.description;\n this.readOnly = options.readOnly;\n }\n\n /**\n * Get the underlying ContainerClient for direct access to Azure Blob APIs.\n *\n * Use this when you need features not exposed through the WorkspaceFilesystem\n * interface (e.g., SAS URL generation, lease management, etc.).\n *\n * This is async because DefaultAzureCredential requires a dynamic import.\n * For non-DefaultAzureCredential auth methods, the promise resolves immediately.\n */\n getContainer(): Promise<ContainerClient> {\n return this.getContainerClient();\n }\n\n getMountConfig(): AzureBlobMountConfig {\n const config: AzureBlobMountConfig = {\n type: 'azure-blob',\n container: this.containerName,\n };\n\n if (this.connectionString) {\n config.connectionString = this.connectionString;\n } else {\n if (this.accountName) {\n config.accountName = this.accountName;\n }\n if (this.accountKey) {\n config.accountKey = this.accountKey;\n }\n if (this.sasToken) {\n config.sasToken = this.sasToken;\n }\n }\n\n if (this.useDefaultCredential) {\n config.useDefaultCredential = true;\n }\n\n if (this.endpoint) {\n config.endpoint = this.endpoint;\n }\n\n if (this.prefix) {\n config.prefix = this.prefix;\n }\n\n if (this.readOnly) {\n config.readOnly = true;\n }\n\n return config;\n }\n\n getInfo(): FilesystemInfo<{\n container: string;\n endpoint?: string;\n prefix?: string;\n }> {\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n error: this.error,\n readOnly: this.readOnly,\n icon: this.icon,\n metadata: {\n container: this.containerName,\n ...(this.endpoint && { endpoint: this.endpoint }),\n ...(this.prefix && { prefix: this.prefix }),\n },\n };\n }\n\n getInstructions(): string {\n const access = this.readOnly ? 'Read-only' : 'Persistent';\n return `Azure Blob Storage in container \"${this.containerName}\". ${access} storage - files are retained across sessions.`;\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private async getReadyContainer(): Promise<ContainerClient> {\n await this.ensureReady();\n return this.getContainerClient();\n }\n\n private toKey(path: string): string {\n const cleanPath = path.replace(/^\\/+/, '');\n return this.prefix + cleanPath;\n }\n\n private handleError(error: unknown): unknown {\n if (isAccessDeniedError(error)) {\n this.status = 'error';\n this.error = 'Access denied - check credentials and container permissions';\n }\n return error;\n }\n\n private assertWritable(path: string, operation: string): void {\n if (this.readOnly) {\n throw new PermissionError(path, `${operation} (filesystem is read-only)`);\n }\n }\n\n // ---------------------------------------------------------------------------\n // File Operations\n // ---------------------------------------------------------------------------\n\n async readFile(path: string, options?: ReadOptions): Promise<string | Buffer> {\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n try {\n const response = await blobClient.download(0);\n const buffer = await streamToBuffer(response.readableStreamBody);\n\n if (options?.encoding) {\n return buffer.toString(options.encoding);\n }\n return buffer;\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async writeFile(path: string, content: FileContent, options?: WriteOptions): Promise<void> {\n this.assertWritable(path, 'write');\n const containerClient = await this.getReadyContainer();\n\n if (options?.overwrite === false && (await this.exists(path))) {\n throw new FileExistsError(path);\n }\n\n const body = toBuffer(content);\n const contentType = getMimeType(path);\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n await blobClient.upload(body, body.length, {\n blobHTTPHeaders: { blobContentType: contentType },\n });\n }\n\n async appendFile(path: string, content: FileContent): Promise<void> {\n this.assertWritable(path, 'append');\n let existing: Buffer = Buffer.alloc(0);\n try {\n const read = await this.readFile(path);\n existing = Buffer.isBuffer(read) ? read : Buffer.from(read);\n } catch (error) {\n if (error instanceof FileNotFoundError) {\n // File doesn't exist, start fresh with empty buffer\n } else {\n throw error;\n }\n }\n\n const appendBuffer = toBuffer(content);\n await this.writeFile(path, Buffer.concat([existing, appendBuffer]));\n }\n\n async deleteFile(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'delete');\n const isDir = await this.isDirectory(path);\n if (isDir) {\n await this.rmdir(path, { recursive: true, force: options?.force });\n return;\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(this.toKey(path));\n\n try {\n await blobClient.delete();\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n if (options?.force) return;\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async copyFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'copy');\n if (options?.overwrite === false && (await this.exists(dest))) {\n throw new FileExistsError(dest);\n }\n\n const containerClient = await this.getReadyContainer();\n const srcBlob = containerClient.getBlobClient(this.toKey(src));\n const destBlob = containerClient.getBlobClient(this.toKey(dest));\n\n try {\n const sasUrl = await srcBlob.generateSasUrl({\n permissions: BlobSASPermissions.parse('r'),\n expiresOn: new Date(Date.now() + 5 * 60 * 1000),\n });\n\n const properties = await srcBlob.getProperties();\n\n if (properties.contentLength === 0) {\n // Azure bug: syncCopyFromURL fails on zero-length blobs with CannotVerifyCopySource\n await destBlob.getBlockBlobClient().upload(Buffer.alloc(0), 0);\n return;\n }\n\n const MAX_SYNC_COPY_SIZE = 256 * 1024 * 1024;\n if ((properties.contentLength ?? 0) <= MAX_SYNC_COPY_SIZE) {\n await destBlob.syncCopyFromURL(sasUrl);\n } else {\n const poller = await destBlob.beginCopyFromURL(sasUrl);\n await poller.pollUntilDone();\n }\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(src);\n }\n\n // SAS generation fails without StorageSharedKeyCredential (e.g. DefaultAzureCredential).\n // Fall back to download+reupload.\n if (\n error instanceof Error &&\n (error.message.includes('generateSasUrl') ||\n (error.message.includes('SAS') && error.message.includes('shared key credential')))\n ) {\n const content = await this.readFile(src);\n await this.writeFile(dest, content);\n return;\n }\n\n throw this.handleError(error);\n }\n }\n\n async moveFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'move');\n await this.copyFile(src, dest, options);\n await this.deleteFile(src, { force: true });\n }\n\n // ---------------------------------------------------------------------------\n // Directory Operations\n // ---------------------------------------------------------------------------\n\n async mkdir(_path: string, _options?: { recursive?: boolean }): Promise<void> {\n // Azure Blob Storage doesn't have real directories - they're just key prefixes.\n // No-op, directories are created implicitly when files are written.\n }\n\n async rmdir(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'rmdir');\n const containerClient = await this.getReadyContainer();\n const prefix = this.toKey(path).replace(/\\/$/, '') + '/';\n\n if (!options?.recursive) {\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n if (!first.done) {\n throw new Error(`Directory not empty: ${path}`);\n }\n return;\n }\n\n // Delete all blobs with this prefix in batches\n let blobNames: string[] = [];\n for await (const blob of containerClient.listBlobsFlat({ prefix })) {\n blobNames.push(blob.name);\n\n if (blobNames.length >= 256) {\n await this.deleteBlobBatch(containerClient, blobNames);\n blobNames = [];\n }\n }\n\n if (blobNames.length > 0) {\n await this.deleteBlobBatch(containerClient, blobNames);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n\n async readdir(path: string, options?: ListOptions): Promise<FileEntry[]> {\n const containerClient = await this.getReadyContainer();\n\n const prefix = this.toKey(path).replace(/\\/$/, '');\n const searchPrefix = prefix ? prefix + '/' : '';\n\n const entries: FileEntry[] = [];\n const seenDirs = new Set<string>();\n\n if (options?.recursive) {\n for await (const blob of containerClient.listBlobsFlat({ prefix: searchPrefix })) {\n const key = blob.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: blob.properties.contentLength,\n });\n }\n } else {\n for await (const item of containerClient.listBlobsByHierarchy('/', { prefix: searchPrefix })) {\n if (item.kind === 'prefix') {\n const dirName = item.name.slice(searchPrefix.length).replace(/\\/$/, '');\n if (dirName && !seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n } else {\n const key = item.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: item.properties.contentLength,\n });\n }\n }\n }\n\n return entries;\n }\n\n // ---------------------------------------------------------------------------\n // Path Operations\n // ---------------------------------------------------------------------------\n\n async exists(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n const exists = await blobClient.exists();\n if (exists) return true;\n\n // Check if it's a \"directory\" (has blobs with this prefix)\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n async stat(path: string): Promise<FileStat> {\n const key = this.toKey(path);\n\n if (!key) {\n return {\n name: '',\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n try {\n const properties = await blobClient.getProperties();\n const name = path.split('/').pop() ?? '';\n\n return {\n name,\n path,\n type: 'file',\n size: properties.contentLength ?? 0,\n createdAt: properties.createdOn ?? new Date(),\n modifiedAt: properties.lastModified ?? new Date(),\n };\n } catch (error: unknown) {\n if (!isNotFoundError(error)) throw this.handleError(error);\n\n const isDir = await this.isDirectory(path);\n if (isDir) {\n const name = path.split('/').filter(Boolean).pop() ?? '';\n return {\n name,\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n throw new FileNotFoundError(path);\n }\n }\n\n async isFile(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return false;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n return blobClient.exists();\n }\n\n async isDirectory(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n async init(): Promise<void> {\n const containerClient = await this.getContainerClient();\n try {\n if (this.sasToken) {\n const iter = containerClient.listBlobsFlat({ prefix: this.prefix });\n await iter.next();\n return;\n }\n\n const exists = await containerClient.exists();\n if (!exists) {\n const err = new Error(`Container \"${this.containerName}\" does not exist`) as Error & { status?: number };\n err.status = 404;\n throw err;\n }\n } catch (error) {\n if ((error as { status?: number }).status) {\n throw error;\n }\n\n const statusCode = (error as RestError).statusCode;\n if (typeof statusCode === 'number') {\n const message = error instanceof Error ? error.message : String(error);\n const err = new Error(message) as Error & { status?: number };\n err.status = statusCode;\n throw err;\n }\n throw error;\n }\n }\n\n async destroy(): Promise<void> {\n this._containerClient = null;\n }\n}\n","import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient } from '@azure/storage-blob';\n\nimport { BlobStore } from '@mastra/core/storage';\nimport type { StorageBlobEntry } from '@mastra/core/storage';\n\n/**\n * Configuration for AzureBlobStore.\n */\nexport interface AzureBlobStoreOptions {\n /** Azure Blob container name */\n container: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Custom endpoint URL (e.g. for the Azurite emulator) */\n endpoint?: string;\n /**\n * Key prefix for all blob objects.\n * Defaults to 'mastra_skill_blobs/'.\n */\n prefix?: string;\n}\n\n/** Trim leading and trailing slashes. */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n return (error as { statusCode?: number }).statusCode === 404;\n}\n\n/** Azure metadata batch limit per request. */\nconst BATCH_DELETE_SIZE = 256;\n\n/**\n * Azure Blob Storage-backed content-addressable blob store for skill versioning.\n *\n * Each blob is stored as a block blob keyed by its SHA-256 hash. Metadata\n * (size, mimeType, createdAt) is stored as Azure blob metadata.\n *\n * Since blobs are content-addressable, writes are idempotent — the same hash\n * always maps to the same content, so overwrites are safe and equivalent to\n * a no-op.\n *\n * @example Connection string\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING!,\n * });\n * ```\n *\n * @example Account key\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME!,\n * accountKey: process.env.AZURE_STORAGE_ACCOUNT_KEY!,\n * });\n * ```\n */\nexport class AzureBlobStore extends BlobStore {\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly endpoint?: string;\n private readonly prefix: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobStoreOptions) {\n super();\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.endpoint = options.endpoint;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : 'mastra_skill_blobs/';\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private toKey(hash: string): string {\n return this.prefix + hash;\n }\n\n async init(): Promise<void> {\n // Azure does not require table creation — the container is expected to exist.\n }\n\n async put(entry: StorageBlobEntry): Promise<void> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(entry.hash));\n const now = entry.createdAt ?? new Date();\n const buffer = Buffer.from(entry.content, 'utf-8');\n\n await blobClient.uploadData(buffer, {\n blobHTTPHeaders: {\n blobContentType: entry.mimeType ?? 'application/octet-stream',\n },\n metadata: {\n size: String(entry.size),\n createdat: now.toISOString(),\n ...(entry.mimeType ? { mimetype: entry.mimeType } : {}),\n },\n });\n }\n\n async get(hash: string): Promise<StorageBlobEntry | null> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n const buffer = await blobClient.downloadToBuffer();\n const properties = await blobClient.getProperties();\n const metadata = properties.metadata ?? {};\n const content = buffer.toString('utf-8');\n\n return {\n hash,\n content,\n size: metadata.size != null ? Number(metadata.size) : Buffer.byteLength(content, 'utf-8'),\n mimeType: metadata.mimetype || properties.contentType || undefined,\n createdAt: metadata.createdat ? new Date(metadata.createdat) : new Date(),\n };\n } catch (error: unknown) {\n if (isNotFoundError(error)) return null;\n throw error;\n }\n }\n\n async has(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n await blobClient.getProperties();\n return true;\n } catch (error: unknown) {\n if (isNotFoundError(error)) return false;\n throw error;\n }\n }\n\n async delete(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n const response = await blobClient.deleteIfExists();\n return response.succeeded;\n }\n\n async putMany(entries: StorageBlobEntry[]): Promise<void> {\n if (entries.length === 0) return;\n // Azure does not have a batch PUT, so we parallelize individual puts.\n // Content-addressable means duplicate writes are idempotent.\n await Promise.all(entries.map(entry => this.put(entry)));\n }\n\n async getMany(hashes: string[]): Promise<Map<string, StorageBlobEntry>> {\n const result = new Map<string, StorageBlobEntry>();\n if (hashes.length === 0) return result;\n\n const entries = await Promise.all(hashes.map(hash => this.get(hash)));\n for (const entry of entries) {\n if (entry) {\n result.set(entry.hash, entry);\n }\n }\n return result;\n }\n\n async dangerouslyClearAll(): Promise<void> {\n const containerClient = await this.getContainerClient();\n let batch: string[] = [];\n\n for await (const blob of containerClient.listBlobsFlat({ prefix: this.prefix })) {\n batch.push(blob.name);\n if (batch.length >= BATCH_DELETE_SIZE) {\n await this.deleteBlobBatch(containerClient, batch);\n batch = [];\n }\n }\n\n if (batch.length > 0) {\n await this.deleteBlobBatch(containerClient, batch);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n}\n","import type { BlobStoreProvider, FilesystemProvider } from '@mastra/core/editor';\nimport { AzureBlobStore } from './blob-store';\nimport type { AzureBlobStoreOptions } from './blob-store';\nimport { AzureBlobFilesystem } from './filesystem';\nimport type { AzureBlobFilesystemOptions } from './filesystem';\n\nexport const azureBlobFilesystemProvider: FilesystemProvider<AzureBlobFilesystemOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Storage',\n description: 'Azure Blob Storage container',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix (acts like a subdirectory)' },\n readOnly: { type: 'boolean', description: 'Mount as read-only', default: false },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createFilesystem: config => new AzureBlobFilesystem(config),\n};\n\nexport const azureBlobStoreProvider: BlobStoreProvider<AzureBlobStoreOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Store',\n description: 'Content-addressable blob storage backed by Azure Blob Storage',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix for blob objects (default: mastra_skill_blobs/)' },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createBlobStore: config => new AzureBlobStore(config),\n};\n"],"mappings":";;;;;;;;;AA2CA,MAAM,aAAqC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aAAa;GAA6D;GACpG,UAAU;IAAE,MAAM;IAAU,aAAa;GAA6C;EACxF;CACF;CACA,kBAAiB,WAAU,IAAI,eAAe,MAAM;AACtD"}
|
|
1
|
+
{"version":3,"file":"blob-Dbkc3LM4.cjs","names":["isNotFoundError","restErr","trimSlashes","MastraFilesystem","BlobServiceClient","StorageSharedKeyCredential","PermissionError","FileNotFoundError","FileExistsError","BlobSASPermissions","BlobStore","BlobServiceClient","StorageSharedKeyCredential"],"sources":["../src/blob/filesystem/index.ts","../src/blob/blob-store/index.ts","../src/blob/provider.ts"],"sourcesContent":["/**\n * Azure Blob Storage Filesystem Provider\n *\n * A filesystem implementation backed by Azure Blob Storage.\n */\n\nimport { BlobSASPermissions, BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient, RestError } from '@azure/storage-blob';\n\nimport type {\n FileContent,\n FileStat,\n FileEntry,\n ReadOptions,\n WriteOptions,\n ListOptions,\n RemoveOptions,\n CopyOptions,\n FilesystemInfo,\n FilesystemMountConfig,\n FilesystemIcon,\n ProviderStatus,\n MastraFilesystemOptions,\n} from '@mastra/core/workspace';\nimport { MastraFilesystem, FileNotFoundError, FileExistsError, PermissionError } from '@mastra/core/workspace';\n\n/**\n * Azure Blob mount configuration.\n * Returned by AzureBlobFilesystem.getMountConfig() for FUSE mounting in sandboxes.\n */\nexport interface AzureBlobMountConfig extends FilesystemMountConfig {\n type: 'azure-blob';\n container: string;\n accountName?: string;\n accountKey?: string;\n sasToken?: string;\n connectionString?: string;\n useDefaultCredential?: boolean;\n endpoint?: string;\n prefix?: string;\n readOnly?: boolean;\n}\n\nconst MIME_TYPES: Record<string, string> = {\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.markdown': 'text/markdown',\n '.html': 'text/html',\n '.htm': 'text/html',\n '.css': 'text/css',\n '.csv': 'text/csv',\n '.xml': 'text/xml',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.ts': 'text/typescript',\n '.tsx': 'text/typescript',\n '.jsx': 'text/javascript',\n '.json': 'application/json',\n '.yaml': 'text/yaml',\n '.yml': 'text/yaml',\n '.py': 'text/x-python',\n '.rb': 'text/x-ruby',\n '.sh': 'text/x-shellscript',\n '.bash': 'text/x-shellscript',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.webp': 'image/webp',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.zip': 'application/zip',\n '.gz': 'application/gzip',\n '.tar': 'application/x-tar',\n};\n\nfunction getMimeType(path: string): string {\n const ext = path.toLowerCase().match(/\\.[^.]+$/)?.[0];\n return ext ? (MIME_TYPES[ext] ?? 'application/octet-stream') : 'application/octet-stream';\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 404;\n}\n\nfunction isAccessDeniedError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n const restErr = error as { statusCode?: number };\n return restErr.statusCode === 403;\n}\n\n/** Trim leading and trailing slashes without regex (avoids polynomial regex on user input). */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nasync function streamToBuffer(stream: NodeJS.ReadableStream | undefined): Promise<Buffer> {\n if (!stream) return Buffer.alloc(0);\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks);\n}\n\nfunction toBuffer(content: FileContent): Buffer {\n if (Buffer.isBuffer(content)) return content;\n return typeof content === 'string' ? Buffer.from(content, 'utf-8') : Buffer.from(content);\n}\n\nexport interface AzureBlobFilesystemOptions extends MastraFilesystemOptions {\n /** Unique identifier for this filesystem instance */\n id?: string;\n /** Azure Blob container name */\n container: string;\n /** Human-friendly display name for the UI */\n displayName?: string;\n /** Icon identifier for the UI (defaults to 'azure-blob') */\n icon?: FilesystemIcon;\n /** Description shown in tooltips */\n description?: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Supports Managed Identity, Azure CLI, environment variables, etc.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Optional prefix for all keys (acts like a subdirectory) */\n prefix?: string;\n /** Mount as read-only (blocks write operations, mounts read-only in sandboxes) */\n readOnly?: boolean;\n /**\n * Custom endpoint URL.\n * Used for local development with Azurite emulator.\n */\n endpoint?: string;\n}\n\nexport class AzureBlobFilesystem extends MastraFilesystem {\n readonly id: string;\n readonly name = 'AzureBlobFilesystem';\n readonly provider = 'azure-blob';\n readonly readOnly?: boolean;\n\n status: ProviderStatus = 'pending';\n\n readonly displayName?: string;\n readonly icon: FilesystemIcon = 'azure-blob';\n readonly description?: string;\n\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly prefix: string;\n private readonly endpoint?: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobFilesystemOptions) {\n super({ ...options, name: 'AzureBlobFilesystem' });\n this.id = options.id ?? `azure-fs-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : '';\n this.endpoint = options.endpoint;\n\n this.displayName = options.displayName ?? 'Azure Blob Storage';\n this.icon = options.icon ?? 'azure-blob';\n this.description = options.description;\n this.readOnly = options.readOnly;\n }\n\n /**\n * Get the underlying ContainerClient for direct access to Azure Blob APIs.\n *\n * Use this when you need features not exposed through the WorkspaceFilesystem\n * interface (e.g., SAS URL generation, lease management, etc.).\n *\n * This is async because DefaultAzureCredential requires a dynamic import.\n * For non-DefaultAzureCredential auth methods, the promise resolves immediately.\n */\n getContainer(): Promise<ContainerClient> {\n return this.getContainerClient();\n }\n\n getMountConfig(): AzureBlobMountConfig {\n const config: AzureBlobMountConfig = {\n type: 'azure-blob',\n container: this.containerName,\n };\n\n if (this.connectionString) {\n config.connectionString = this.connectionString;\n } else {\n if (this.accountName) {\n config.accountName = this.accountName;\n }\n if (this.accountKey) {\n config.accountKey = this.accountKey;\n }\n if (this.sasToken) {\n config.sasToken = this.sasToken;\n }\n }\n\n if (this.useDefaultCredential) {\n config.useDefaultCredential = true;\n }\n\n if (this.endpoint) {\n config.endpoint = this.endpoint;\n }\n\n if (this.prefix) {\n config.prefix = this.prefix;\n }\n\n if (this.readOnly) {\n config.readOnly = true;\n }\n\n return config;\n }\n\n getInfo(): FilesystemInfo<{\n container: string;\n endpoint?: string;\n prefix?: string;\n }> {\n return {\n id: this.id,\n name: this.name,\n provider: this.provider,\n status: this.status,\n error: this.error,\n readOnly: this.readOnly,\n icon: this.icon,\n metadata: {\n container: this.containerName,\n ...(this.endpoint && { endpoint: this.endpoint }),\n ...(this.prefix && { prefix: this.prefix }),\n },\n };\n }\n\n getInstructions(): string {\n const access = this.readOnly ? 'Read-only' : 'Persistent';\n return `Azure Blob Storage in container \"${this.containerName}\". ${access} storage - files are retained across sessions.`;\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private async getReadyContainer(): Promise<ContainerClient> {\n await this.ensureReady();\n return this.getContainerClient();\n }\n\n private toKey(path: string): string {\n const cleanPath = path.replace(/^\\/+/, '');\n return this.prefix + cleanPath;\n }\n\n private handleError(error: unknown): unknown {\n if (isAccessDeniedError(error)) {\n this.status = 'error';\n this.error = 'Access denied - check credentials and container permissions';\n }\n return error;\n }\n\n private assertWritable(path: string, operation: string): void {\n if (this.readOnly) {\n throw new PermissionError(path, `${operation} (filesystem is read-only)`);\n }\n }\n\n // ---------------------------------------------------------------------------\n // File Operations\n // ---------------------------------------------------------------------------\n\n async readFile(path: string, options?: ReadOptions): Promise<string | Buffer> {\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n try {\n const response = await blobClient.download(0);\n const buffer = await streamToBuffer(response.readableStreamBody);\n\n if (options?.encoding) {\n return buffer.toString(options.encoding);\n }\n return buffer;\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async writeFile(path: string, content: FileContent, options?: WriteOptions): Promise<void> {\n this.assertWritable(path, 'write');\n const containerClient = await this.getReadyContainer();\n\n if (options?.overwrite === false && (await this.exists(path))) {\n throw new FileExistsError(path);\n }\n\n const body = toBuffer(content);\n const contentType = getMimeType(path);\n const blobClient = containerClient.getBlockBlobClient(this.toKey(path));\n\n await blobClient.upload(body, body.length, {\n blobHTTPHeaders: { blobContentType: contentType },\n });\n }\n\n async appendFile(path: string, content: FileContent): Promise<void> {\n this.assertWritable(path, 'append');\n let existing: Buffer = Buffer.alloc(0);\n try {\n const read = await this.readFile(path);\n existing = Buffer.isBuffer(read) ? read : Buffer.from(read);\n } catch (error) {\n if (error instanceof FileNotFoundError) {\n // File doesn't exist, start fresh with empty buffer\n } else {\n throw error;\n }\n }\n\n const appendBuffer = toBuffer(content);\n await this.writeFile(path, Buffer.concat([existing, appendBuffer]));\n }\n\n async deleteFile(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'delete');\n const isDir = await this.isDirectory(path);\n if (isDir) {\n await this.rmdir(path, { recursive: true, force: options?.force });\n return;\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(this.toKey(path));\n\n try {\n await blobClient.delete();\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n if (options?.force) return;\n throw new FileNotFoundError(path);\n }\n throw this.handleError(error);\n }\n }\n\n async copyFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'copy');\n if (options?.overwrite === false && (await this.exists(dest))) {\n throw new FileExistsError(dest);\n }\n\n const containerClient = await this.getReadyContainer();\n const srcBlob = containerClient.getBlobClient(this.toKey(src));\n const destBlob = containerClient.getBlobClient(this.toKey(dest));\n\n try {\n const sasUrl = await srcBlob.generateSasUrl({\n permissions: BlobSASPermissions.parse('r'),\n expiresOn: new Date(Date.now() + 5 * 60 * 1000),\n });\n\n const properties = await srcBlob.getProperties();\n\n if (properties.contentLength === 0) {\n // Azure bug: syncCopyFromURL fails on zero-length blobs with CannotVerifyCopySource\n await destBlob.getBlockBlobClient().upload(Buffer.alloc(0), 0);\n return;\n }\n\n const MAX_SYNC_COPY_SIZE = 256 * 1024 * 1024;\n if ((properties.contentLength ?? 0) <= MAX_SYNC_COPY_SIZE) {\n await destBlob.syncCopyFromURL(sasUrl);\n } else {\n const poller = await destBlob.beginCopyFromURL(sasUrl);\n await poller.pollUntilDone();\n }\n } catch (error: unknown) {\n if (isNotFoundError(error)) {\n throw new FileNotFoundError(src);\n }\n\n // SAS generation fails without StorageSharedKeyCredential (e.g. DefaultAzureCredential).\n // Fall back to download+reupload.\n if (\n error instanceof Error &&\n (error.message.includes('generateSasUrl') ||\n (error.message.includes('SAS') && error.message.includes('shared key credential')))\n ) {\n const content = await this.readFile(src);\n await this.writeFile(dest, content);\n return;\n }\n\n throw this.handleError(error);\n }\n }\n\n async moveFile(src: string, dest: string, options?: CopyOptions): Promise<void> {\n this.assertWritable(dest, 'move');\n await this.copyFile(src, dest, options);\n await this.deleteFile(src, { force: true });\n }\n\n // ---------------------------------------------------------------------------\n // Directory Operations\n // ---------------------------------------------------------------------------\n\n async mkdir(_path: string, _options?: { recursive?: boolean }): Promise<void> {\n // Azure Blob Storage doesn't have real directories - they're just key prefixes.\n // No-op, directories are created implicitly when files are written.\n }\n\n async rmdir(path: string, options?: RemoveOptions): Promise<void> {\n this.assertWritable(path, 'rmdir');\n const containerClient = await this.getReadyContainer();\n const prefix = this.toKey(path).replace(/\\/$/, '') + '/';\n\n if (!options?.recursive) {\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n if (!first.done) {\n throw new Error(`Directory not empty: ${path}`);\n }\n return;\n }\n\n // Delete all blobs with this prefix in batches\n let blobNames: string[] = [];\n for await (const blob of containerClient.listBlobsFlat({ prefix })) {\n blobNames.push(blob.name);\n\n if (blobNames.length >= 256) {\n await this.deleteBlobBatch(containerClient, blobNames);\n blobNames = [];\n }\n }\n\n if (blobNames.length > 0) {\n await this.deleteBlobBatch(containerClient, blobNames);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n\n async readdir(path: string, options?: ListOptions): Promise<FileEntry[]> {\n const containerClient = await this.getReadyContainer();\n\n const prefix = this.toKey(path).replace(/\\/$/, '');\n const searchPrefix = prefix ? prefix + '/' : '';\n\n const entries: FileEntry[] = [];\n const seenDirs = new Set<string>();\n\n if (options?.recursive) {\n for await (const blob of containerClient.listBlobsFlat({ prefix: searchPrefix })) {\n const key = blob.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: blob.properties.contentLength,\n });\n }\n } else {\n for await (const item of containerClient.listBlobsByHierarchy('/', { prefix: searchPrefix })) {\n if (item.kind === 'prefix') {\n const dirName = item.name.slice(searchPrefix.length).replace(/\\/$/, '');\n if (dirName && !seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n } else {\n const key = item.name;\n if (!key || key === searchPrefix) continue;\n\n const relativePath = key.slice(searchPrefix.length);\n if (!relativePath) continue;\n\n if (relativePath.endsWith('/')) {\n const dirName = relativePath.slice(0, -1);\n if (!seenDirs.has(dirName)) {\n seenDirs.add(dirName);\n entries.push({ name: dirName, type: 'directory' });\n }\n continue;\n }\n\n if (options?.extension) {\n const extensions = Array.isArray(options.extension) ? options.extension : [options.extension];\n if (!extensions.some(ext => relativePath.endsWith(ext))) {\n continue;\n }\n }\n\n entries.push({\n name: relativePath,\n type: 'file',\n size: item.properties.contentLength,\n });\n }\n }\n }\n\n return entries;\n }\n\n // ---------------------------------------------------------------------------\n // Path Operations\n // ---------------------------------------------------------------------------\n\n async exists(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n const exists = await blobClient.exists();\n if (exists) return true;\n\n // Check if it's a \"directory\" (has blobs with this prefix)\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n async stat(path: string): Promise<FileStat> {\n const key = this.toKey(path);\n\n if (!key) {\n return {\n name: '',\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n\n try {\n const properties = await blobClient.getProperties();\n const name = path.split('/').pop() ?? '';\n\n return {\n name,\n path,\n type: 'file',\n size: properties.contentLength ?? 0,\n createdAt: properties.createdOn ?? new Date(),\n modifiedAt: properties.lastModified ?? new Date(),\n };\n } catch (error: unknown) {\n if (!isNotFoundError(error)) throw this.handleError(error);\n\n const isDir = await this.isDirectory(path);\n if (isDir) {\n const name = path.split('/').filter(Boolean).pop() ?? '';\n return {\n name,\n path,\n type: 'directory',\n size: 0,\n createdAt: new Date(),\n modifiedAt: new Date(),\n };\n }\n\n throw new FileNotFoundError(path);\n }\n }\n\n async isFile(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return false;\n\n const containerClient = await this.getReadyContainer();\n const blobClient = containerClient.getBlobClient(key);\n return blobClient.exists();\n }\n\n async isDirectory(path: string): Promise<boolean> {\n const key = this.toKey(path);\n if (!key) return true;\n\n const containerClient = await this.getReadyContainer();\n const prefix = key.replace(/\\/$/, '') + '/';\n const iter = containerClient.listBlobsFlat({ prefix });\n const first = await iter.next();\n return !first.done;\n }\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n async init(): Promise<void> {\n const containerClient = await this.getContainerClient();\n try {\n if (this.sasToken) {\n const iter = containerClient.listBlobsFlat({ prefix: this.prefix });\n await iter.next();\n return;\n }\n\n const exists = await containerClient.exists();\n if (!exists) {\n const err = new Error(`Container \"${this.containerName}\" does not exist`) as Error & { status?: number };\n err.status = 404;\n throw err;\n }\n } catch (error) {\n if ((error as { status?: number }).status) {\n throw error;\n }\n\n const statusCode = (error as RestError).statusCode;\n if (typeof statusCode === 'number') {\n const message = error instanceof Error ? error.message : String(error);\n const err = new Error(message) as Error & { status?: number };\n err.status = statusCode;\n throw err;\n }\n throw error;\n }\n }\n\n async destroy(): Promise<void> {\n this._containerClient = null;\n }\n}\n","import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob';\nimport type { ContainerClient } from '@azure/storage-blob';\n\nimport { BlobStore } from '@mastra/core/storage';\nimport type { StorageBlobEntry } from '@mastra/core/storage';\n\n/**\n * Configuration for AzureBlobStore.\n */\nexport interface AzureBlobStoreOptions {\n /** Azure Blob container name */\n container: string;\n /** Storage account name (required unless using connectionString) */\n accountName?: string;\n /** Storage account key */\n accountKey?: string;\n /** SAS token for authentication */\n sasToken?: string;\n /** Full connection string (takes priority over accountName/accountKey) */\n connectionString?: string;\n /**\n * Use DefaultAzureCredential from @azure/identity for authentication.\n * Requires @azure/identity to be installed as a peer dependency.\n */\n useDefaultCredential?: boolean;\n /** Custom endpoint URL (e.g. for the Azurite emulator) */\n endpoint?: string;\n /**\n * Key prefix for all blob objects.\n * Defaults to 'mastra_skill_blobs/'.\n */\n prefix?: string;\n}\n\n/** Trim leading and trailing slashes. */\nfunction trimSlashes(s: string): string {\n let start = 0;\n let end = s.length;\n while (start < end && s[start] === '/') start++;\n while (end > start && s[end - 1] === '/') end--;\n return s.slice(start, end);\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n if (!error || typeof error !== 'object') return false;\n return (error as { statusCode?: number }).statusCode === 404;\n}\n\n/** Azure metadata batch limit per request. */\nconst BATCH_DELETE_SIZE = 256;\n\n/**\n * Azure Blob Storage-backed content-addressable blob store for skill versioning.\n *\n * Each blob is stored as a block blob keyed by its SHA-256 hash. Metadata\n * (size, mimeType, createdAt) is stored as Azure blob metadata.\n *\n * Since blobs are content-addressable, writes are idempotent — the same hash\n * always maps to the same content, so overwrites are safe and equivalent to\n * a no-op.\n *\n * @example Connection string\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING!,\n * });\n * ```\n *\n * @example Account key\n * ```typescript\n * import { AzureBlobStore } from '@mastra/azure/blob';\n *\n * const blobs = new AzureBlobStore({\n * container: 'my-skill-blobs',\n * accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME!,\n * accountKey: process.env.AZURE_STORAGE_ACCOUNT_KEY!,\n * });\n * ```\n */\nexport class AzureBlobStore extends BlobStore {\n private readonly containerName: string;\n private readonly accountName?: string;\n private readonly accountKey?: string;\n private readonly sasToken?: string;\n private readonly connectionString?: string;\n private readonly useDefaultCredential: boolean;\n private readonly endpoint?: string;\n private readonly prefix: string;\n\n private _containerClient: ContainerClient | null = null;\n\n constructor(options: AzureBlobStoreOptions) {\n super();\n this.containerName = options.container;\n this.accountName = options.accountName;\n this.accountKey = options.accountKey;\n this.sasToken = options.sasToken;\n this.connectionString = options.connectionString;\n this.useDefaultCredential = options.useDefaultCredential ?? false;\n this.endpoint = options.endpoint;\n this.prefix = options.prefix ? trimSlashes(options.prefix) + '/' : 'mastra_skill_blobs/';\n }\n\n private async getContainerClient(): Promise<ContainerClient> {\n if (this._containerClient) return this._containerClient;\n\n let serviceClient: BlobServiceClient;\n\n if (this.connectionString) {\n serviceClient = BlobServiceClient.fromConnectionString(this.connectionString);\n } else {\n if (!this.endpoint && !this.accountName) {\n throw new Error(\n 'Azure Blob Storage requires either a connectionString, or an accountName/endpoint. ' +\n 'Provide at least one of: connectionString, accountName, or endpoint.',\n );\n }\n const baseUrl = this.endpoint ?? `https://${this.accountName}.blob.core.windows.net`;\n\n if (this.accountName && this.accountKey) {\n const credential = new StorageSharedKeyCredential(this.accountName, this.accountKey);\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } else if (this.sasToken) {\n const sas = this.sasToken.replace(/^\\?+/, '');\n const separator = baseUrl.includes('?') ? '&' : '?';\n serviceClient = new BlobServiceClient(`${baseUrl}${separator}${sas}`);\n } else if (this.useDefaultCredential) {\n // Dynamically import @azure/identity to avoid requiring it when not used.\n // Must use import() (not require()) because this package is ESM-first.\n try {\n const identity = await import('@azure/identity');\n const credential = new identity.DefaultAzureCredential();\n serviceClient = new BlobServiceClient(baseUrl, credential);\n } catch {\n throw new Error(\n 'DefaultAzureCredential requires @azure/identity to be installed. ' +\n 'Install it with: npm install @azure/identity',\n );\n }\n } else {\n // Anonymous access\n serviceClient = new BlobServiceClient(baseUrl);\n }\n }\n\n this._containerClient = serviceClient.getContainerClient(this.containerName);\n return this._containerClient;\n }\n\n private toKey(hash: string): string {\n return this.prefix + hash;\n }\n\n async init(): Promise<void> {\n // Azure does not require table creation — the container is expected to exist.\n }\n\n async put(entry: StorageBlobEntry): Promise<void> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(entry.hash));\n const now = entry.createdAt ?? new Date();\n const buffer = Buffer.from(entry.content, 'utf-8');\n\n await blobClient.uploadData(buffer, {\n blobHTTPHeaders: {\n blobContentType: entry.mimeType ?? 'application/octet-stream',\n },\n metadata: {\n size: String(entry.size),\n createdat: now.toISOString(),\n ...(entry.mimeType ? { mimetype: entry.mimeType } : {}),\n },\n });\n }\n\n async get(hash: string): Promise<StorageBlobEntry | null> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n const buffer = await blobClient.downloadToBuffer();\n const properties = await blobClient.getProperties();\n const metadata = properties.metadata ?? {};\n const content = buffer.toString('utf-8');\n\n return {\n hash,\n content,\n size: metadata.size != null ? Number(metadata.size) : Buffer.byteLength(content, 'utf-8'),\n mimeType: metadata.mimetype || properties.contentType || undefined,\n createdAt: metadata.createdat ? new Date(metadata.createdat) : new Date(),\n };\n } catch (error: unknown) {\n if (isNotFoundError(error)) return null;\n throw error;\n }\n }\n\n async has(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n\n try {\n await blobClient.getProperties();\n return true;\n } catch (error: unknown) {\n if (isNotFoundError(error)) return false;\n throw error;\n }\n }\n\n async delete(hash: string): Promise<boolean> {\n const containerClient = await this.getContainerClient();\n const blobClient = containerClient.getBlockBlobClient(this.toKey(hash));\n const response = await blobClient.deleteIfExists();\n return response.succeeded;\n }\n\n async putMany(entries: StorageBlobEntry[]): Promise<void> {\n if (entries.length === 0) return;\n // Azure does not have a batch PUT, so we parallelize individual puts.\n // Content-addressable means duplicate writes are idempotent.\n await Promise.all(entries.map(entry => this.put(entry)));\n }\n\n async getMany(hashes: string[]): Promise<Map<string, StorageBlobEntry>> {\n const result = new Map<string, StorageBlobEntry>();\n if (hashes.length === 0) return result;\n\n const entries = await Promise.all(hashes.map(hash => this.get(hash)));\n for (const entry of entries) {\n if (entry) {\n result.set(entry.hash, entry);\n }\n }\n return result;\n }\n\n async dangerouslyClearAll(): Promise<void> {\n const containerClient = await this.getContainerClient();\n let batch: string[] = [];\n\n for await (const blob of containerClient.listBlobsFlat({ prefix: this.prefix })) {\n batch.push(blob.name);\n if (batch.length >= BATCH_DELETE_SIZE) {\n await this.deleteBlobBatch(containerClient, batch);\n batch = [];\n }\n }\n\n if (batch.length > 0) {\n await this.deleteBlobBatch(containerClient, batch);\n }\n }\n\n private async deleteBlobBatch(containerClient: ContainerClient, blobNames: string[]): Promise<void> {\n const blobClients = blobNames.map(name => containerClient.getBlobClient(name));\n await containerClient.getBlobBatchClient().deleteBlobs(blobClients);\n }\n}\n","import type { BlobStoreProvider, FilesystemProvider } from '@mastra/core/editor';\nimport { AzureBlobStore } from './blob-store';\nimport type { AzureBlobStoreOptions } from './blob-store';\nimport { AzureBlobFilesystem } from './filesystem';\nimport type { AzureBlobFilesystemOptions } from './filesystem';\n\nexport const azureBlobFilesystemProvider: FilesystemProvider<AzureBlobFilesystemOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Storage',\n description: 'Azure Blob Storage container',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix (acts like a subdirectory)' },\n readOnly: { type: 'boolean', description: 'Mount as read-only', default: false },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createFilesystem: config => new AzureBlobFilesystem(config),\n};\n\nexport const azureBlobStoreProvider: BlobStoreProvider<AzureBlobStoreOptions> = {\n id: 'azure-blob',\n name: 'Azure Blob Store',\n description: 'Content-addressable blob storage backed by Azure Blob Storage',\n configSchema: {\n type: 'object',\n required: ['container'],\n properties: {\n container: { type: 'string', description: 'Azure Blob container name' },\n accountName: { type: 'string', description: 'Storage account name' },\n accountKey: { type: 'string', description: 'Storage account key' },\n sasToken: { type: 'string', description: 'Shared Access Signature token' },\n connectionString: { type: 'string', description: 'Full connection string (overrides other auth options)' },\n useDefaultCredential: {\n type: 'boolean',\n description: 'Use DefaultAzureCredential (requires @azure/identity)',\n default: false,\n },\n prefix: { type: 'string', description: 'Key prefix for blob objects (default: mastra_skill_blobs/)' },\n endpoint: { type: 'string', description: 'Custom endpoint URL (for Azurite emulator)' },\n },\n },\n createBlobStore: config => new AzureBlobStore(config),\n};\n"],"mappings":";;;;;;;;;AA2CA,MAAM,aAAqC;CACzC,QAAQ;CACR,OAAO;CACP,aAAa;CACb,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,QAAQ;AACV;AAEA,SAAS,YAAY,MAAsB;CACzC,MAAM,MAAM,KAAK,YAAY,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG;CACnD,OAAO,MAAO,WAAW,QAAQ,6BAA8B;AACjE;AAEA,SAASA,kBAAgB,OAAyB;CAChD,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAEhD,OAAOC,MAAQ,eAAe;AAChC;AAEA,SAAS,oBAAoB,OAAyB;CACpD,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAEhD,OAAOA,MAAQ,eAAe;AAChC;;AAGA,SAASC,cAAY,GAAmB;CACtC,IAAI,QAAQ;CACZ,IAAI,MAAM,EAAE;CACZ,OAAO,QAAQ,OAAO,EAAE,WAAW,KAAK;CACxC,OAAO,MAAM,SAAS,EAAE,MAAM,OAAO,KAAK;CAC1C,OAAO,EAAE,MAAM,OAAO,GAAG;AAC3B;AAEA,eAAe,eAAe,QAA4D;CACxF,IAAI,CAAC,QAAQ,OAAO,OAAO,MA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a;CACb,cAAc;EACZ,MAAM;EACN,UAAU,CAAC,WAAW;EACtB,YAAY;GACV,WAAW;IAAE,MAAM;IAAU,aAAa;GAA4B;GACtE,aAAa;IAAE,MAAM;IAAU,aAAa;GAAuB;GACnE,YAAY;IAAE,MAAM;IAAU,aAAa;GAAsB;GACjE,UAAU;IAAE,MAAM;IAAU,aAAa;GAAgC;GACzE,kBAAkB;IAAE,MAAM;IAAU,aAAa;GAAwD;GACzG,sBAAsB;IACpB,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,QAAQ;IAAE,MAAM;IAAU,aAAa;GAA6D;GACpG,UAAU;IAAE,MAAM;IAAU,aAAa;GAA6C;EACxF;CACF;CACA,kBAAiB,WAAU,IAAI,eAAe,MAAM;AACtD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_blob = require("./blob-
|
|
2
|
+
const require_blob = require("./blob-Dbkc3LM4.cjs");
|
|
3
3
|
exports.AzureBlobFilesystem = require_blob.AzureBlobFilesystem;
|
|
4
4
|
exports.AzureBlobStore = require_blob.AzureBlobStore;
|
|
5
5
|
exports.azureBlobFilesystemProvider = require_blob.azureBlobFilesystemProvider;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { AzureBlobFilesystem, AzureBlobStore, azureBlobFilesystemProvider, azureBlobStoreProvider };
|
|
1
|
+
export { i as AzureBlobFilesystem, r as AzureBlobStore, t as azureBlobFilesystemProvider, n as azureBlobStoreProvider } from "./blob-Bds4wJ8g.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/azure",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3-alpha.0",
|
|
4
4
|
"description": "Azure provider for Mastra - includes Blob Storage workspace filesystem",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,21 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@azure/storage-blob": "^12.
|
|
33
|
+
"@azure/storage-blob": "^12.34.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "22.20.
|
|
36
|
+
"@types/node": "22.20.5",
|
|
37
37
|
"@vitest/coverage-v8": "4.1.11",
|
|
38
38
|
"@vitest/ui": "4.1.11",
|
|
39
39
|
"dotenv": "^17.4.2",
|
|
40
|
-
"
|
|
41
|
-
"tsdown": "0.22.9",
|
|
40
|
+
"tsdown": "0.23.1",
|
|
42
41
|
"typescript": "^7.0.2",
|
|
43
42
|
"vitest": "4.1.11",
|
|
44
|
-
"@internal/
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@internal/workspace-test-utils": "0.0.
|
|
43
|
+
"@internal/lint": "0.0.145",
|
|
44
|
+
"@mastra/core": "1.80.0-alpha.0",
|
|
45
|
+
"@internal/types-builder": "0.0.120",
|
|
46
|
+
"@internal/workspace-test-utils": "0.0.89"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
49
|
"@mastra/core": ">=1.4.0-0 <2.0.0-0",
|
|
@@ -80,7 +79,7 @@
|
|
|
80
79
|
"test": "PORT=$(docker compose port azurite 10000 | cut -d: -f2) && AZURE_STORAGE_CONNECTION_STRING=\"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:${PORT}/devstoreaccount1;\" TEST_AZURE_CONTAINER=test-container vitest run integration.test.ts",
|
|
81
80
|
"posttest": "docker compose down -v",
|
|
82
81
|
"test:cloud": "vitest run integration.test.ts",
|
|
83
|
-
"lint": "oxlint
|
|
84
|
-
"lint:fix": "oxlint --
|
|
82
|
+
"lint": "oxlint --type-aware .",
|
|
83
|
+
"lint:fix": "oxlint --type-aware --fix ."
|
|
85
84
|
}
|
|
86
85
|
}
|