@visulima/storage 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/adapter/nuxt/module.d.ts +8 -8
- package/dist/ai/ai-sdk/index.d.ts +51 -59
- package/dist/ai/claude/index.d.ts +104 -119
- package/dist/ai/openai/index.d.ts +86 -99
- package/dist/ai/tanstack/index.d.ts +53 -61
- package/dist/handler/http/fetch/index.d.ts +201 -201
- package/dist/handler/http/hono/index.d.ts +59 -59
- package/dist/handler/http/nextjs/index.d.ts +54 -54
- package/dist/handler/http/node/index.d.ts +233 -246
- package/dist/handler/http/solid-start/index.d.ts +54 -54
- package/dist/index.d.ts +70 -70
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AwsLightStorage-BK-WPL0h.js → AwsLightStorage-EsqkAtU5.js} +1 -1
- package/dist/packem_shared/{AzureStorage-1UvDIQZd.js → AzureStorage-DL-U7qFG.js} +1 -1
- package/dist/packem_shared/BoxMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{BoxStorage-DbGqBLux.js → BoxStorage-B8_oCz27.js} +1 -1
- package/dist/packem_shared/BunS3MetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{BunS3Storage-DNvimm9e.js → BunS3Storage-_PVXu_na.js} +1 -1
- package/dist/packem_shared/BunnyMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{BunnyStorage-C7d0opLL.js → BunnyStorage-BsoWjScH.js} +1 -1
- package/dist/packem_shared/CloudinaryMetaStorage-BI9YXcwU.js +1 -0
- package/dist/packem_shared/{CloudinaryStorage-Dc3XA2lP.js → CloudinaryStorage-BNwiLF9V.js} +1 -1
- package/dist/packem_shared/{DiskStorage-CI07TVNu.js → DiskStorage-D-NtQDms.js} +1 -1
- package/dist/packem_shared/{DiskStorageWithChecksum-vFCubS6K.js → DiskStorageWithChecksum-UnCtyEvs.js} +1 -1
- package/dist/packem_shared/DropboxMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{DropboxStorage-CY9Ggu3m.js → DropboxStorage-BS9kj0nH.js} +1 -1
- package/dist/packem_shared/FirebaseMetaStorage-BI9YXcwU.js +1 -0
- package/dist/packem_shared/{FirebaseStorage-D6O9CJXN.js → FirebaseStorage-DNquii2p.js} +1 -1
- package/dist/packem_shared/FtpMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{FtpStorage-DbEjbq8z.js → FtpStorage-Bd004--s.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-C8dxa9A7.js → GCSMetaStorage-Bf4qDFB1.js} +1 -1
- package/dist/packem_shared/{GCStorage-DE-XFSBe.js → GCStorage-ChqEpgqR.js} +1 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-xlHfKwmR.js +1 -0
- package/dist/packem_shared/{GoogleDriveStorage-Bklsz7Bh.js → GoogleDriveStorage-v1glykjd.js} +1 -1
- package/dist/packem_shared/{LocalMetaStorage-BhicZnNl.js → LocalMetaStorage-YWPBYEe7.js} +1 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-BI9YXcwU.js +1 -0
- package/dist/packem_shared/{NetlifyBlobStorage-CkpCCoN1.js → NetlifyBlobStorage-BPyEWSnx.js} +1 -1
- package/dist/packem_shared/OneDriveMetaStorage-xlHfKwmR.js +1 -0
- package/dist/packem_shared/{OneDriveStorage-CP6MvGAa.js → OneDriveStorage-BJ3Kzxc5.js} +1 -1
- package/dist/packem_shared/PocketBaseMetaStorage-DnrxOQhO.js +1 -0
- package/dist/packem_shared/{PocketBaseStorage-2qhbI2PW.js → PocketBaseStorage-DqKHbbvn.js} +1 -1
- package/dist/packem_shared/{S3Storage-YGeNk3Tt.js → S3Storage-BiI2k6d1.js} +1 -1
- package/dist/packem_shared/SftpMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{SftpStorage-2Hz396Xr.js → SftpStorage-w8XdtZtw.js} +1 -1
- package/dist/packem_shared/SharePointMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{SharePointStorage-CrX2Pk6C.js → SharePointStorage-DpDpI7Ln.js} +1 -1
- package/dist/packem_shared/SupabaseMetaStorage-xlHfKwmR.js +1 -0
- package/dist/packem_shared/{SupabaseStorage-Dc_DBX29.js → SupabaseStorage-B_ugUCs7.js} +1 -1
- package/dist/packem_shared/UploadThingMetaStorage-BI9YXcwU.js +1 -0
- package/dist/packem_shared/{UploadThingStorage-BChykYSe.js → UploadThingStorage-_H45IVqX.js} +1 -1
- package/dist/packem_shared/VercelBlobMetaStorage-CHWrhgg2.js +1 -0
- package/dist/packem_shared/{VercelBlobStorage-CsRyPfw3.js → VercelBlobStorage-U1YMKeHs.js} +1 -1
- package/dist/packem_shared/{approval.d-CMAYH9GF.d.ts → approval.d-C-d-t94D.d.ts} +6 -6
- package/dist/packem_shared/disk-storage-BwPk2IRa.js +1 -0
- package/dist/packem_shared/disk-storage-with-checksum.d-CQucFacO.d.ts +146 -0
- package/dist/packem_shared/{executors.d-BZP2rWo3.d.ts → executors.d-DeDH3Ilt.d.ts} +2 -2
- package/dist/packem_shared/files.d-D8H_ge9Y.d.ts +655 -0
- package/dist/packem_shared/{gcs-meta-storage-DpkPEXso.js → gcs-meta-storage-DQGu_cHq.js} +1 -1
- package/dist/packem_shared/local-meta-storage-DJDcuxf1.js +11 -0
- package/dist/packem_shared/{local-meta-storage.d-D9PBfkn6.d.ts → local-meta-storage.d-DuTEzyii.d.ts} +7 -7
- package/dist/packem_shared/media-transformer.d-CvMFjINm.d.ts +331 -0
- package/dist/packem_shared/{memory-storage.d-4EU1cMt1.d.ts → memory-storage.d-BRdTiY8y.d.ts} +32 -40
- package/dist/packem_shared/{s3-base-storage-BoTyhuzO.js → s3-base-storage-CMUui93V.js} +1 -1
- package/dist/packem_shared/{s3-base-storage.d-BQgP5B-t.d.ts → s3-base-storage.d-Cg7m4FuH.d.ts} +64 -70
- package/dist/packem_shared/storage.d-DIav_lF1.d.ts +1163 -0
- package/dist/packem_shared/tus-base.d-BiEg5t4t.d.ts +102 -0
- package/dist/packem_shared/{types.d-CrUWY4On.d.ts → types.d-CAAzKiI6.d.ts} +134 -134
- package/dist/packem_shared/types.d-DgHhkCAl.d.ts +104 -0
- package/dist/packem_shared/{types.d-CggTCgXr.d.ts → types.d-jAs_Rp_v.d.ts} +3 -3
- package/dist/storage/aws/clients/index.d.ts +388 -388
- package/dist/storage/aws/index.d.ts +109 -113
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +63 -67
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +133 -139
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +88 -92
- package/dist/storage/box/index.js +1 -1
- package/dist/storage/bun-s3/index.d.ts +70 -76
- package/dist/storage/bun-s3/index.js +1 -1
- package/dist/storage/bunny/index.d.ts +51 -55
- package/dist/storage/bunny/index.js +1 -1
- package/dist/storage/cloudinary/index.d.ts +53 -59
- package/dist/storage/cloudinary/index.js +1 -1
- package/dist/storage/dropbox/index.d.ts +58 -62
- package/dist/storage/dropbox/index.js +1 -1
- package/dist/storage/firebase/index.d.ts +73 -79
- package/dist/storage/firebase/index.js +1 -1
- package/dist/storage/ftp/index.d.ts +37 -43
- package/dist/storage/ftp/index.js +1 -1
- package/dist/storage/gcs/index.d.ts +89 -95
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +68 -72
- package/dist/storage/google-drive/index.js +1 -1
- package/dist/storage/local/index.d.ts +3 -3
- package/dist/storage/local/index.js +1 -1
- package/dist/storage/memory/index.d.ts +2 -2
- package/dist/storage/netlify-blob/index.d.ts +85 -93
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +43 -53
- package/dist/storage/onedrive/index.js +1 -1
- package/dist/storage/pocketbase/index.d.ts +66 -72
- package/dist/storage/pocketbase/index.js +1 -1
- package/dist/storage/sftp/index.d.ts +39 -45
- package/dist/storage/sftp/index.js +1 -1
- package/dist/storage/sharepoint/index.d.ts +95 -95
- package/dist/storage/sharepoint/index.js +1 -1
- package/dist/storage/supabase/index.d.ts +49 -55
- package/dist/storage/supabase/index.js +1 -1
- package/dist/storage/uploadthing/index.d.ts +33 -37
- package/dist/storage/uploadthing/index.js +1 -1
- package/dist/storage/vercel-blob/index.d.ts +109 -115
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +96 -96
- package/dist/transformer/image-transformer.d.ts +422 -422
- package/dist/transformer/index.d.ts +34 -34
- package/dist/transformer/video-transformer.d.ts +111 -111
- package/package.json +1 -1
- package/dist/packem_shared/BoxMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/BunS3MetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/BunnyMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/CloudinaryMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/DropboxMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/FirebaseMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/FtpMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/OneDriveMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/PocketBaseMetaStorage-DOTLwVE7.js +0 -1
- package/dist/packem_shared/SftpMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/SharePointMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/SupabaseMetaStorage-Cbwa1CHV.js +0 -1
- package/dist/packem_shared/UploadThingMetaStorage-DPVnmNe5.js +0 -1
- package/dist/packem_shared/VercelBlobMetaStorage-BSn6Qfnf.js +0 -1
- package/dist/packem_shared/disk-storage-CsQcYW3s.js +0 -1
- package/dist/packem_shared/disk-storage-with-checksum.d-B-VGEsfl.d.ts +0 -156
- package/dist/packem_shared/files.d-CH0iLBNC.d.ts +0 -655
- package/dist/packem_shared/local-meta-storage-iuJnu90B.js +0 -11
- package/dist/packem_shared/media-transformer.d-Quf4ai47.d.ts +0 -331
- package/dist/packem_shared/storage.d-CEM1upWM.d.ts +0 -1176
- package/dist/packem_shared/tus-base.d-DLzKE54M.d.ts +0 -106
- package/dist/packem_shared/types.d-Bon9GVVe.d.ts +0 -104
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## @visulima/storage [1.0.10](https://github.com/visulima/visulima/compare/%40visulima%2Fstorage%401.0.9...%40visulima%2Fstorage%401.0.10) (2026-07-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Dependencies
|
|
5
|
+
|
|
6
|
+
* **@visulima/fs:** upgraded to 5.0.11
|
|
7
|
+
|
|
8
|
+
## @visulima/storage [1.0.9](https://github.com/visulima/visulima/compare/%40visulima%2Fstorage%401.0.8...%40visulima%2Fstorage%401.0.9) (2026-07-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* **@visulima/fs:** upgraded to 5.0.10
|
|
14
|
+
|
|
1
15
|
## @visulima/storage [1.0.8](https://github.com/visulima/visulima/compare/%40visulima%2Fstorage%401.0.7...%40visulima%2Fstorage%401.0.8) (2026-07-27)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { U as UploadOptions } from "../../packem_shared/types.d-
|
|
2
|
-
import { U as UploadFile, B as BaseStorage } from "../../packem_shared/storage.d-
|
|
1
|
+
import { U as UploadOptions } from "../../packem_shared/types.d-jAs_Rp_v.js";
|
|
2
|
+
import { U as UploadFile, B as BaseStorage } from "../../packem_shared/storage.d-DIav_lF1.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:events';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import '@visulima/pagination';
|
|
7
|
-
import "../../packem_shared/media-transformer.d-
|
|
8
|
-
import "../../packem_shared/types.d-
|
|
7
|
+
import "../../packem_shared/media-transformer.d-CvMFjINm.js";
|
|
8
|
+
import "../../packem_shared/types.d-CAAzKiI6.js";
|
|
9
9
|
import 'node:crypto';
|
|
10
10
|
import 'lru-cache';
|
|
11
11
|
/**
|
|
12
|
-
* CORS configuration for upload endpoints
|
|
13
|
-
*/
|
|
12
|
+
* CORS configuration for upload endpoints
|
|
13
|
+
*/
|
|
14
14
|
interface CorsOptions {
|
|
15
15
|
/** Allowed CORS headers */
|
|
16
16
|
headers?: string[];
|
|
@@ -20,8 +20,8 @@ interface CorsOptions {
|
|
|
20
20
|
origin?: string | string[];
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Configuration options for the Nuxt storage module
|
|
24
|
-
*/
|
|
23
|
+
* Configuration options for the Nuxt storage module
|
|
24
|
+
*/
|
|
25
25
|
interface ModuleOptions {
|
|
26
26
|
/** Base path for upload routes (default: '/api/upload') */
|
|
27
27
|
basePath?: string;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { F as Files } from "../../packem_shared/files.d-
|
|
1
|
+
import { F as Files } from "../../packem_shared/files.d-D8H_ge9Y.js";
|
|
2
2
|
import 'node:stream';
|
|
3
3
|
import 'node:crypto';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
import 'lru-cache';
|
|
6
|
-
import { C as CopyFileInput, D as DeleteFileInput, a as DownloadFileInput, G as GetFileMetadataInput, b as GetFileUrlInput, L as ListFilesInput, S as SignUploadUrlInput, U as UploadFileInput, F as FileToolName, A as ApprovalConfig, c as FileReadToolName } from "../../packem_shared/approval.d-
|
|
7
|
-
export type { d as FileWriteToolName } from "../../packem_shared/approval.d-
|
|
6
|
+
import { C as CopyFileInput, D as DeleteFileInput, a as DownloadFileInput, G as GetFileMetadataInput, b as GetFileUrlInput, L as ListFilesInput, S as SignUploadUrlInput, U as UploadFileInput, F as FileToolName, A as ApprovalConfig, c as FileReadToolName } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
7
|
+
export type { d as FileWriteToolName } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
8
8
|
import { Tool } from 'ai';
|
|
9
|
-
import { e as executors } from "../../packem_shared/executors.d-
|
|
10
|
-
import "../../packem_shared/storage.d-
|
|
9
|
+
import { e as executors } from "../../packem_shared/executors.d-DeDH3Ilt.js";
|
|
10
|
+
import "../../packem_shared/storage.d-DIav_lF1.js";
|
|
11
11
|
import 'zod';
|
|
12
12
|
/**
|
|
13
|
-
* Common options accepted by every write-tool factory.
|
|
14
|
-
*/
|
|
13
|
+
* Common options accepted by every write-tool factory.
|
|
14
|
+
*/
|
|
15
15
|
interface ToolOptions {
|
|
16
16
|
needsApproval?: boolean;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Per-tool overrides for customizing AI SDK `tool()` properties without
|
|
20
|
-
* changing the underlying implementation. Core properties (`execute`,
|
|
21
|
-
* `inputSchema`, `outputSchema`) are intentionally excluded — those drive
|
|
22
|
-
* the tool's behavior and contract and shouldn't be patched at this layer.
|
|
23
|
-
*/
|
|
19
|
+
* Per-tool overrides for customizing AI SDK `tool()` properties without
|
|
20
|
+
* changing the underlying implementation. Core properties (`execute`,
|
|
21
|
+
* `inputSchema`, `outputSchema`) are intentionally excluded — those drive
|
|
22
|
+
* the tool's behavior and contract and shouldn't be patched at this layer.
|
|
23
|
+
*/
|
|
24
24
|
type ToolOverrides = Partial<Pick<Tool, "description" | "needsApproval" | "onInputAvailable" | "onInputDelta" | "onInputStart" | "providerOptions" | "toModelOutput">>;
|
|
25
25
|
type ListFilesOutput = Awaited<ReturnType<typeof executors.listFiles>>;
|
|
26
26
|
type GetFileMetadataOutput = Awaited<ReturnType<typeof executors.getFileMetadata>>;
|
|
@@ -34,40 +34,32 @@ declare const listFiles: (files: Files) => Tool<ListFilesInput, ListFilesOutput>
|
|
|
34
34
|
declare const getFileMetadata: (files: Files) => Tool<GetFileMetadataInput, GetFileMetadataOutput>;
|
|
35
35
|
declare const downloadFile: (files: Files) => Tool<DownloadFileInput, DownloadFileOutput>;
|
|
36
36
|
declare const getFileUrl: (files: Files) => Tool<GetFileUrlInput, GetFileUrlOutput>;
|
|
37
|
-
declare const uploadFile: (files: Files, {
|
|
38
|
-
|
|
39
|
-
}?: ToolOptions) => Tool<
|
|
40
|
-
declare const
|
|
41
|
-
needsApproval
|
|
42
|
-
}?: ToolOptions) => Tool<DeleteFileInput, DeleteFileOutput>;
|
|
43
|
-
declare const copyFile: (files: Files, {
|
|
44
|
-
needsApproval
|
|
45
|
-
}?: ToolOptions) => Tool<CopyFileInput, CopyFileOutput>;
|
|
46
|
-
declare const signUploadUrl: (files: Files, {
|
|
47
|
-
needsApproval
|
|
48
|
-
}?: ToolOptions) => Tool<SignUploadUrlInput, SignUploadUrlOutput>;
|
|
37
|
+
declare const uploadFile: (files: Files, { needsApproval }?: ToolOptions) => Tool<UploadFileInput, UploadFileOutput>;
|
|
38
|
+
declare const deleteFile: (files: Files, { needsApproval }?: ToolOptions) => Tool<DeleteFileInput, DeleteFileOutput>;
|
|
39
|
+
declare const copyFile: (files: Files, { needsApproval }?: ToolOptions) => Tool<CopyFileInput, CopyFileOutput>;
|
|
40
|
+
declare const signUploadUrl: (files: Files, { needsApproval }?: ToolOptions) => Tool<SignUploadUrlInput, SignUploadUrlOutput>;
|
|
49
41
|
interface FileToolsOptions {
|
|
50
42
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
* The configured `Files` instance the tools will operate against.
|
|
44
|
+
* Each tool delegates to the methods on this instance.
|
|
45
|
+
*/
|
|
54
46
|
files: Files;
|
|
55
47
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
* Per-tool overrides for customizing tool behavior (description, title,
|
|
49
|
+
* needsApproval, etc.) without changing the underlying implementation.
|
|
50
|
+
* `execute` and `inputSchema` cannot be overridden.
|
|
51
|
+
*/
|
|
60
52
|
overrides?: Partial<Record<FileToolName, ToolOverrides>>;
|
|
61
53
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
* When `true`, write tools (`uploadFile`, `deleteFile`, `copyFile`,
|
|
55
|
+
* `signUploadUrl`) are omitted entirely. The model cannot mutate the
|
|
56
|
+
* bucket regardless of approval configuration.
|
|
57
|
+
*/
|
|
66
58
|
readOnly?: boolean;
|
|
67
59
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
* Approval gating for write tools. Defaults to `true` (all writes
|
|
61
|
+
* require approval). See {@link ApprovalConfig}.
|
|
62
|
+
*/
|
|
71
63
|
requireApproval?: ApprovalConfig;
|
|
72
64
|
}
|
|
73
65
|
interface FileTools {
|
|
@@ -82,27 +74,27 @@ interface FileTools {
|
|
|
82
74
|
}
|
|
83
75
|
type ReadOnlyFileTools = Pick<FileTools, FileReadToolName>;
|
|
84
76
|
/**
|
|
85
|
-
* Create a set of visulima/storage tools for the Vercel AI SDK.
|
|
86
|
-
*
|
|
87
|
-
* Write operations require user approval by default. Control globally or
|
|
88
|
-
* per-tool via `requireApproval`, or strip writes entirely with
|
|
89
|
-
* `readOnly: true`.
|
|
90
|
-
* @example
|
|
91
|
-
* ```ts
|
|
92
|
-
* import { Files } from "@visulima/storage";
|
|
93
|
-
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
94
|
-
* import { createFileTools } from "@visulima/storage/ai/sdk";
|
|
95
|
-
* import { generateText } from "ai";
|
|
96
|
-
*
|
|
97
|
-
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
98
|
-
*
|
|
99
|
-
* const result = await generateText({
|
|
100
|
-
* model,
|
|
101
|
-
* tools: createFileTools({ files }),
|
|
102
|
-
* prompt: "Find every CSV under reports/ and summarize the latest one.",
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
77
|
+
* Create a set of visulima/storage tools for the Vercel AI SDK.
|
|
78
|
+
*
|
|
79
|
+
* Write operations require user approval by default. Control globally or
|
|
80
|
+
* per-tool via `requireApproval`, or strip writes entirely with
|
|
81
|
+
* `readOnly: true`.
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* import { Files } from "@visulima/storage";
|
|
85
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
86
|
+
* import { createFileTools } from "@visulima/storage/ai/sdk";
|
|
87
|
+
* import { generateText } from "ai";
|
|
88
|
+
*
|
|
89
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
90
|
+
*
|
|
91
|
+
* const result = await generateText({
|
|
92
|
+
* model,
|
|
93
|
+
* tools: createFileTools({ files }),
|
|
94
|
+
* prompt: "Find every CSV under reports/ and summarize the latest one.",
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
106
98
|
declare function createFileTools(options: FileToolsOptions & {
|
|
107
99
|
readOnly: true;
|
|
108
100
|
}): ReadOnlyFileTools;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { SdkMcpToolDefinition, CanUseTool, McpSdkServerConfigWithInstance } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
-
import { F as Files } from "../../packem_shared/files.d-
|
|
2
|
+
import { F as Files } from "../../packem_shared/files.d-D8H_ge9Y.js";
|
|
3
3
|
import 'node:stream';
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'node:http';
|
|
6
6
|
import 'lru-cache';
|
|
7
|
-
import { T as TOOL_SCHEMAS, F as FileToolName, A as ApprovalConfig } from "../../packem_shared/approval.d-
|
|
8
|
-
export type { c as FileReadToolName, d as FileWriteToolName } from "../../packem_shared/approval.d-
|
|
9
|
-
import "../../packem_shared/storage.d-
|
|
7
|
+
import { T as TOOL_SCHEMAS, F as FileToolName, A as ApprovalConfig } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
8
|
+
export type { c as FileReadToolName, d as FileWriteToolName } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
9
|
+
import "../../packem_shared/storage.d-DIav_lF1.js";
|
|
10
10
|
import 'zod';
|
|
11
11
|
/**
|
|
12
|
-
* MCP tool annotations as accepted by `tool()` and exposed on
|
|
13
|
-
* `SdkMcpToolDefinition`. Re-derived from the SDK rather than imported from
|
|
14
|
-
* `@modelcontextprotocol/sdk` directly to avoid taking on a second peer
|
|
15
|
-
* dependency.
|
|
16
|
-
*/
|
|
12
|
+
* MCP tool annotations as accepted by `tool()` and exposed on
|
|
13
|
+
* `SdkMcpToolDefinition`. Re-derived from the SDK rather than imported from
|
|
14
|
+
* `@modelcontextprotocol/sdk` directly to avoid taking on a second peer
|
|
15
|
+
* dependency.
|
|
16
|
+
*/
|
|
17
17
|
type ToolAnnotations = NonNullable<SdkMcpToolDefinition["annotations"]>;
|
|
18
18
|
/**
|
|
19
|
-
* Per-tool overrides for `createClaudeFileTools`. `name`, `inputSchema`, and
|
|
20
|
-
* `handler` are intentionally not overridable — the contract that drives tool
|
|
21
|
-
* behavior should not be patched at this layer.
|
|
22
|
-
*/
|
|
19
|
+
* Per-tool overrides for `createClaudeFileTools`. `name`, `inputSchema`, and
|
|
20
|
+
* `handler` are intentionally not overridable — the contract that drives tool
|
|
21
|
+
* behavior should not be patched at this layer.
|
|
22
|
+
*/
|
|
23
23
|
interface ClaudeToolOverrides {
|
|
24
24
|
annotations?: ToolAnnotations;
|
|
25
25
|
description?: string;
|
|
@@ -39,139 +39,124 @@ declare const claudeListFiles: (files: Files) => SdkMcpToolDefinition<ListFilesS
|
|
|
39
39
|
declare const claudeGetFileMetadata: (files: Files) => SdkMcpToolDefinition<GetFileMetadataShape>;
|
|
40
40
|
declare const claudeDownloadFile: (files: Files) => SdkMcpToolDefinition<DownloadFileShape>;
|
|
41
41
|
declare const claudeGetFileUrl: (files: Files) => SdkMcpToolDefinition<GetFileUrlShape>;
|
|
42
|
-
declare const claudeUploadFile: (files: Files, {
|
|
43
|
-
|
|
44
|
-
}?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<
|
|
45
|
-
declare const
|
|
46
|
-
annotations
|
|
47
|
-
}?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<DeleteFileShape>;
|
|
48
|
-
declare const claudeCopyFile: (files: Files, {
|
|
49
|
-
annotations
|
|
50
|
-
}?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<CopyFileShape>;
|
|
51
|
-
declare const claudeSignUploadUrl: (files: Files, {
|
|
52
|
-
annotations
|
|
53
|
-
}?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<SignUploadUrlShape>;
|
|
42
|
+
declare const claudeUploadFile: (files: Files, { annotations }?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<UploadFileShape>;
|
|
43
|
+
declare const claudeDeleteFile: (files: Files, { annotations }?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<DeleteFileShape>;
|
|
44
|
+
declare const claudeCopyFile: (files: Files, { annotations }?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<CopyFileShape>;
|
|
45
|
+
declare const claudeSignUploadUrl: (files: Files, { annotations }?: ClaudeWriteToolOptions) => SdkMcpToolDefinition<SignUploadUrlShape>;
|
|
54
46
|
interface ClaudeFileToolsOptions {
|
|
55
47
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
* The configured `Files` instance the tools will operate against.
|
|
49
|
+
*/
|
|
58
50
|
files: Files;
|
|
59
51
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
* Per-tool overrides for `description` / `annotations` without touching
|
|
53
|
+
* the underlying handler or input schema.
|
|
54
|
+
*/
|
|
63
55
|
overrides?: Partial<Record<FileToolName, ClaudeToolOverrides>>;
|
|
64
56
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
* When `true`, write tools (`uploadFile`, `deleteFile`, `copyFile`,
|
|
58
|
+
* `signUploadUrl`) are omitted from the MCP server. The model cannot
|
|
59
|
+
* mutate the bucket regardless of approval configuration.
|
|
60
|
+
*/
|
|
69
61
|
readOnly?: boolean;
|
|
70
62
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
* Approval gating reflected by {@link ClaudeFileTools.needsApproval} and
|
|
64
|
+
* the bundled {@link ClaudeFileTools.canUseTool}. Defaults to `true`
|
|
65
|
+
* (every write requires approval). Pass `false` to disable, or an object
|
|
66
|
+
* keyed by write-tool name for fine-grained control.
|
|
67
|
+
*/
|
|
76
68
|
requireApproval?: ApprovalConfig;
|
|
77
69
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
* Name of the in-process MCP server that wraps these tools. Affects the
|
|
71
|
+
* `mcp__<server-name>__<tool-name>` strings the agent uses to address
|
|
72
|
+
* each tool. Defaults to `"files"`.
|
|
73
|
+
*/
|
|
82
74
|
serverName?: string;
|
|
83
75
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
* MCP server `version` metadata. Defaults to `"1.0.0"`.
|
|
77
|
+
*/
|
|
86
78
|
serverVersion?: string;
|
|
87
79
|
}
|
|
88
80
|
interface ClaudeFileTools {
|
|
89
81
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
* Pass into `query({ options: { allowedTools: tools.allowedTools } })`.
|
|
83
|
+
* Each entry is of the form `mcp__<serverName>__<toolName>`.
|
|
84
|
+
*/
|
|
93
85
|
allowedTools: string[];
|
|
94
86
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
* Ready-made `canUseTool` callback. Allows reads unconditionally, allows
|
|
88
|
+
* writes whose `needsApproval` resolves to `false`, denies the rest with
|
|
89
|
+
* a `"requires approval"` message. Pass directly into `query()`, or
|
|
90
|
+
* compose your own using {@link ClaudeFileTools.needsApproval}.
|
|
91
|
+
*/
|
|
100
92
|
canUseTool: CanUseTool;
|
|
101
93
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
* Pass into `query({ options: { mcpServers: tools.mcpServers } })`.
|
|
95
|
+
*/
|
|
104
96
|
mcpServers: Record<string, McpSdkServerConfigWithInstance>;
|
|
105
97
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
* Whether the named tool is approval-gated under the configured
|
|
99
|
+
* `requireApproval`. Accepts both bare names (`"uploadFile"`) and the
|
|
100
|
+
* MCP-prefixed form (`"mcp__files__uploadFile"`). Read tools and unknown
|
|
101
|
+
* names return `false`.
|
|
102
|
+
*/
|
|
111
103
|
needsApproval: (toolName: string) => boolean;
|
|
112
104
|
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
105
|
+
* The raw SDK MCP server instance — same value as
|
|
106
|
+
* `mcpServers[serverName]`. Exposed for callers that want to compose it
|
|
107
|
+
* into a larger `mcpServers` map.
|
|
108
|
+
*/
|
|
117
109
|
server: McpSdkServerConfigWithInstance;
|
|
118
110
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
* The MCP server name used in the `mcp__<server>__*` prefix.
|
|
112
|
+
*/
|
|
121
113
|
serverName: string;
|
|
122
114
|
}
|
|
123
115
|
/**
|
|
124
|
-
* Create storage tools shaped for the Claude Agent SDK
|
|
125
|
-
* (`@anthropic-ai/claude-agent-sdk`).
|
|
126
|
-
*
|
|
127
|
-
* The Claude Agent SDK consumes tools by way of an in-process MCP server +
|
|
128
|
-
* an `allowedTools` allow-list + a `canUseTool` approval callback. The
|
|
129
|
-
* returned bundle gives you all three, plus the raw server instance and a
|
|
130
|
-
* `needsApproval()` helper if you want to wire your own `canUseTool`.
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
134
|
-
* import { Files } from "@visulima/storage";
|
|
135
|
-
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
136
|
-
* import { createClaudeFileTools } from "@visulima/storage/ai/claude";
|
|
137
|
-
*
|
|
138
|
-
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
139
|
-
* const tools = createClaudeFileTools({ files });
|
|
140
|
-
*
|
|
141
|
-
* for await (const message of query({
|
|
142
|
-
* prompt: "List my files.",
|
|
143
|
-
* options: {
|
|
144
|
-
* mcpServers: tools.mcpServers,
|
|
145
|
-
* allowedTools: tools.allowedTools,
|
|
146
|
-
* canUseTool: tools.canUseTool,
|
|
147
|
-
* },
|
|
148
|
-
* })) {
|
|
149
|
-
* // handle messages
|
|
150
|
-
* }
|
|
151
|
-
* ```
|
|
152
|
-
* @example Read-only agent
|
|
153
|
-
* ```ts
|
|
154
|
-
* createClaudeFileTools({ files, readOnly: true })
|
|
155
|
-
* ```
|
|
156
|
-
* @example Granular approval
|
|
157
|
-
* ```ts
|
|
158
|
-
* createClaudeFileTools({
|
|
159
|
-
* files,
|
|
160
|
-
* requireApproval: {
|
|
161
|
-
* copyFile: false,
|
|
162
|
-
* deleteFile: true,
|
|
163
|
-
* signUploadUrl: true,
|
|
164
|
-
* uploadFile: false,
|
|
165
|
-
* },
|
|
166
|
-
* })
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
declare const createClaudeFileTools: ({
|
|
170
|
-
files,
|
|
171
|
-
overrides,
|
|
172
|
-
readOnly,
|
|
173
|
-
requireApproval,
|
|
174
|
-
serverName,
|
|
175
|
-
serverVersion
|
|
176
|
-
}: ClaudeFileToolsOptions) => ClaudeFileTools;
|
|
116
|
+
* Create storage tools shaped for the Claude Agent SDK
|
|
117
|
+
* (`@anthropic-ai/claude-agent-sdk`).
|
|
118
|
+
*
|
|
119
|
+
* The Claude Agent SDK consumes tools by way of an in-process MCP server +
|
|
120
|
+
* an `allowedTools` allow-list + a `canUseTool` approval callback. The
|
|
121
|
+
* returned bundle gives you all three, plus the raw server instance and a
|
|
122
|
+
* `needsApproval()` helper if you want to wire your own `canUseTool`.
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
126
|
+
* import { Files } from "@visulima/storage";
|
|
127
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
128
|
+
* import { createClaudeFileTools } from "@visulima/storage/ai/claude";
|
|
129
|
+
*
|
|
130
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
131
|
+
* const tools = createClaudeFileTools({ files });
|
|
132
|
+
*
|
|
133
|
+
* for await (const message of query({
|
|
134
|
+
* prompt: "List my files.",
|
|
135
|
+
* options: {
|
|
136
|
+
* mcpServers: tools.mcpServers,
|
|
137
|
+
* allowedTools: tools.allowedTools,
|
|
138
|
+
* canUseTool: tools.canUseTool,
|
|
139
|
+
* },
|
|
140
|
+
* })) {
|
|
141
|
+
* // handle messages
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
* @example Read-only agent
|
|
145
|
+
* ```ts
|
|
146
|
+
* createClaudeFileTools({ files, readOnly: true })
|
|
147
|
+
* ```
|
|
148
|
+
* @example Granular approval
|
|
149
|
+
* ```ts
|
|
150
|
+
* createClaudeFileTools({
|
|
151
|
+
* files,
|
|
152
|
+
* requireApproval: {
|
|
153
|
+
* copyFile: false,
|
|
154
|
+
* deleteFile: true,
|
|
155
|
+
* signUploadUrl: true,
|
|
156
|
+
* uploadFile: false,
|
|
157
|
+
* },
|
|
158
|
+
* })
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
declare const createClaudeFileTools: ({ files, overrides, readOnly, requireApproval, serverName, serverVersion }: ClaudeFileToolsOptions) => ClaudeFileTools;
|
|
177
162
|
export { type ApprovalConfig, ClaudeFileTools, ClaudeFileToolsOptions, type ClaudeToolOverrides, type ClaudeWriteToolOptions, type FileToolName, type ToolAnnotations, claudeCopyFile, claudeDeleteFile, claudeDownloadFile, claudeGetFileMetadata, claudeGetFileUrl, claudeListFiles, claudeSignUploadUrl, claudeUploadFile, createClaudeFileTools };
|