@visulima/storage 1.0.9 → 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 +7 -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-DT8K6zdm.js → GCSMetaStorage-Bf4qDFB1.js} +1 -1
- package/dist/packem_shared/{GCStorage-6BHkFlEs.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-B7BnctnV.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
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { T as TOOL_SCHEMAS, F as FileToolName, A as ApprovalConfig, c as FileReadToolName } from "../../packem_shared/approval.d-
|
|
2
|
-
export type { d as FileWriteToolName } from "../../packem_shared/approval.d-
|
|
1
|
+
import { T as TOOL_SCHEMAS, F as FileToolName, A as ApprovalConfig, c as FileReadToolName } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
2
|
+
export type { d as FileWriteToolName } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
3
3
|
import { UnknownContext, FunctionTool } from '@openai/agents';
|
|
4
|
-
import { F as Files } from "../../packem_shared/files.d-
|
|
4
|
+
import { F as Files } from "../../packem_shared/files.d-D8H_ge9Y.js";
|
|
5
5
|
import 'node:stream';
|
|
6
6
|
import 'node:crypto';
|
|
7
7
|
import 'node:http';
|
|
8
8
|
import 'lru-cache';
|
|
9
|
-
import { e as executors } from "../../packem_shared/executors.d-
|
|
9
|
+
import { e as executors } from "../../packem_shared/executors.d-DeDH3Ilt.js";
|
|
10
10
|
import 'zod';
|
|
11
|
-
import "../../packem_shared/storage.d-
|
|
11
|
+
import "../../packem_shared/storage.d-DIav_lF1.js";
|
|
12
12
|
/**
|
|
13
|
-
* Per-tool overrides for `createResponsesFileTools`. `name`, `parameters`, and
|
|
14
|
-
* `type` are intentionally not overridable — the contract that drives tool
|
|
15
|
-
* behavior should not be patched at this layer.
|
|
16
|
-
*/
|
|
13
|
+
* Per-tool overrides for `createResponsesFileTools`. `name`, `parameters`, and
|
|
14
|
+
* `type` are intentionally not overridable — the contract that drives tool
|
|
15
|
+
* behavior should not be patched at this layer.
|
|
16
|
+
*/
|
|
17
17
|
interface ResponsesToolOverrides {
|
|
18
18
|
description?: string;
|
|
19
19
|
strict?: boolean;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Per-tool overrides for `createAgentsFileTools`. `name`, `parameters`,
|
|
23
|
-
* `execute`, and `strict` are intentionally not overridable — the contract
|
|
24
|
-
* that drives tool behavior should not be patched at this layer.
|
|
25
|
-
*/
|
|
22
|
+
* Per-tool overrides for `createAgentsFileTools`. `name`, `parameters`,
|
|
23
|
+
* `execute`, and `strict` are intentionally not overridable — the contract
|
|
24
|
+
* that drives tool behavior should not be patched at this layer.
|
|
25
|
+
*/
|
|
26
26
|
interface AgentsToolOverrides {
|
|
27
27
|
description?: string;
|
|
28
28
|
needsApproval?: boolean;
|
|
@@ -47,24 +47,16 @@ declare const agentsListFiles: (files: Files) => FunctionTool<UnknownContext, Li
|
|
|
47
47
|
declare const agentsGetFileMetadata: (files: Files) => FunctionTool<UnknownContext, GetFileMetadataParameters, GetFileMetadataOutput>;
|
|
48
48
|
declare const agentsDownloadFile: (files: Files) => FunctionTool<UnknownContext, DownloadFileParameters, DownloadFileOutput>;
|
|
49
49
|
declare const agentsGetFileUrl: (files: Files) => FunctionTool<UnknownContext, GetFileUrlParameters, GetFileUrlOutput>;
|
|
50
|
-
declare const agentsUploadFile: (files: Files, {
|
|
51
|
-
needsApproval
|
|
52
|
-
}?: {
|
|
50
|
+
declare const agentsUploadFile: (files: Files, { needsApproval }?: {
|
|
53
51
|
needsApproval?: boolean;
|
|
54
52
|
}) => FunctionTool<UnknownContext, UploadFileParameters, UploadFileOutput>;
|
|
55
|
-
declare const agentsDeleteFile: (files: Files, {
|
|
56
|
-
needsApproval
|
|
57
|
-
}?: {
|
|
53
|
+
declare const agentsDeleteFile: (files: Files, { needsApproval }?: {
|
|
58
54
|
needsApproval?: boolean;
|
|
59
55
|
}) => FunctionTool<UnknownContext, DeleteFileParameters, DeleteFileOutput>;
|
|
60
|
-
declare const agentsCopyFile: (files: Files, {
|
|
61
|
-
needsApproval
|
|
62
|
-
}?: {
|
|
56
|
+
declare const agentsCopyFile: (files: Files, { needsApproval }?: {
|
|
63
57
|
needsApproval?: boolean;
|
|
64
58
|
}) => FunctionTool<UnknownContext, CopyFileParameters, CopyFileOutput>;
|
|
65
|
-
declare const agentsSignUploadUrl: (files: Files, {
|
|
66
|
-
needsApproval
|
|
67
|
-
}?: {
|
|
59
|
+
declare const agentsSignUploadUrl: (files: Files, { needsApproval }?: {
|
|
68
60
|
needsApproval?: boolean;
|
|
69
61
|
}) => FunctionTool<UnknownContext, SignUploadUrlParameters, SignUploadUrlOutput>;
|
|
70
62
|
interface AgentsFileTools {
|
|
@@ -85,29 +77,29 @@ interface AgentsFileToolsOptions {
|
|
|
85
77
|
requireApproval?: ApprovalConfig;
|
|
86
78
|
}
|
|
87
79
|
/**
|
|
88
|
-
* Create a set of storage tools shaped for the OpenAI Agents SDK (`@openai/agents`).
|
|
89
|
-
*
|
|
90
|
-
* Returns a record keyed by tool name — spread `Object.values()` into
|
|
91
|
-
* `new Agent({ tools })`. Write tools require approval by default.
|
|
92
|
-
* @example
|
|
93
|
-
* ```ts
|
|
94
|
-
* import { Agent, run } from "@openai/agents";
|
|
95
|
-
* import { Files } from "@visulima/storage";
|
|
96
|
-
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
97
|
-
* import { createAgentsFileTools } from "@visulima/storage/ai/openai";
|
|
98
|
-
*
|
|
99
|
-
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
100
|
-
* const tools = createAgentsFileTools({ files });
|
|
101
|
-
*
|
|
102
|
-
* const agent = new Agent({
|
|
103
|
-
* instructions: "Help the user manage their files.",
|
|
104
|
-
* name: "Files agent",
|
|
105
|
-
* tools: Object.values(tools),
|
|
106
|
-
* });
|
|
107
|
-
*
|
|
108
|
-
* const result = await run(agent, "List my files.");
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
80
|
+
* Create a set of storage tools shaped for the OpenAI Agents SDK (`@openai/agents`).
|
|
81
|
+
*
|
|
82
|
+
* Returns a record keyed by tool name — spread `Object.values()` into
|
|
83
|
+
* `new Agent({ tools })`. Write tools require approval by default.
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { Agent, run } from "@openai/agents";
|
|
87
|
+
* import { Files } from "@visulima/storage";
|
|
88
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
89
|
+
* import { createAgentsFileTools } from "@visulima/storage/ai/openai";
|
|
90
|
+
*
|
|
91
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
92
|
+
* const tools = createAgentsFileTools({ files });
|
|
93
|
+
*
|
|
94
|
+
* const agent = new Agent({
|
|
95
|
+
* instructions: "Help the user manage their files.",
|
|
96
|
+
* name: "Files agent",
|
|
97
|
+
* tools: Object.values(tools),
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* const result = await run(agent, "List my files.");
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
111
103
|
declare function createAgentsFileTools(options: AgentsFileToolsOptions & {
|
|
112
104
|
readOnly: true;
|
|
113
105
|
}): ReadOnlyAgentsFileTools;
|
|
@@ -116,9 +108,9 @@ declare function createAgentsFileTools(options: AgentsFileToolsOptions & {
|
|
|
116
108
|
}): AgentsFileTools;
|
|
117
109
|
declare function createAgentsFileTools(options: AgentsFileToolsOptions): AgentsFileTools | ReadOnlyAgentsFileTools;
|
|
118
110
|
/**
|
|
119
|
-
* A function-tool definition shaped for OpenAI's Responses API. Pass an
|
|
120
|
-
* array of these to `openai.responses.create({ tools })`.
|
|
121
|
-
*/
|
|
111
|
+
* A function-tool definition shaped for OpenAI's Responses API. Pass an
|
|
112
|
+
* array of these to `openai.responses.create({ tools })`.
|
|
113
|
+
*/
|
|
122
114
|
interface ResponsesFunctionTool {
|
|
123
115
|
description: string;
|
|
124
116
|
name: string;
|
|
@@ -127,8 +119,8 @@ interface ResponsesFunctionTool {
|
|
|
127
119
|
type: "function";
|
|
128
120
|
}
|
|
129
121
|
/**
|
|
130
|
-
* A function call emitted by the Responses API in `response.output[]`.
|
|
131
|
-
*/
|
|
122
|
+
* A function call emitted by the Responses API in `response.output[]`.
|
|
123
|
+
*/
|
|
132
124
|
interface FunctionCallItem {
|
|
133
125
|
arguments: string;
|
|
134
126
|
call_id: string;
|
|
@@ -136,9 +128,9 @@ interface FunctionCallItem {
|
|
|
136
128
|
type: "function_call";
|
|
137
129
|
}
|
|
138
130
|
/**
|
|
139
|
-
* A function-call output item to append to the next `responses.create`
|
|
140
|
-
* input alongside the original `function_call` item.
|
|
141
|
-
*/
|
|
131
|
+
* A function-call output item to append to the next `responses.create`
|
|
132
|
+
* input alongside the original `function_call` item.
|
|
133
|
+
*/
|
|
142
134
|
interface FunctionCallOutputItem {
|
|
143
135
|
call_id: string;
|
|
144
136
|
output: string;
|
|
@@ -146,21 +138,21 @@ interface FunctionCallOutputItem {
|
|
|
146
138
|
}
|
|
147
139
|
interface ResponsesFileTools {
|
|
148
140
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
141
|
+
* Function tool definitions. Pass directly to `openai.responses.create({ tools })`.
|
|
142
|
+
*/
|
|
151
143
|
definitions: ResponsesFunctionTool[];
|
|
152
144
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
145
|
+
* Execute a `function_call` item from the model's `response.output[]`.
|
|
146
|
+
* Returns a `function_call_output` item ready to push into the next turn's input.
|
|
147
|
+
*
|
|
148
|
+
* Approval is **not** enforced. Check {@link ResponsesFileTools.needsApproval}
|
|
149
|
+
* first if you want a human-in-the-loop gate.
|
|
150
|
+
*/
|
|
159
151
|
execute: (call: FunctionCallItem) => Promise<FunctionCallOutputItem>;
|
|
160
152
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
* Returns whether the named tool is approval-gated under this config.
|
|
154
|
+
* Read tools always return `false`. Unknown names return `false`.
|
|
155
|
+
*/
|
|
164
156
|
needsApproval: (name: string) => boolean;
|
|
165
157
|
}
|
|
166
158
|
interface ResponsesFileToolsOptions {
|
|
@@ -170,36 +162,31 @@ interface ResponsesFileToolsOptions {
|
|
|
170
162
|
requireApproval?: ApprovalConfig;
|
|
171
163
|
}
|
|
172
164
|
/**
|
|
173
|
-
* Create a set of storage tools shaped for OpenAI's Responses API (`openai.responses.create`).
|
|
174
|
-
* @example
|
|
175
|
-
* ```ts
|
|
176
|
-
* import OpenAI from "openai";
|
|
177
|
-
* import { Files } from "@visulima/storage";
|
|
178
|
-
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
179
|
-
* import { createResponsesFileTools } from "@visulima/storage/ai/openai";
|
|
180
|
-
*
|
|
181
|
-
* const client = new OpenAI();
|
|
182
|
-
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
183
|
-
* const ft = createResponsesFileTools({ files });
|
|
184
|
-
*
|
|
185
|
-
* const input: any[] = [{ role: "user", content: "List my files." }];
|
|
186
|
-
* while (true) {
|
|
187
|
-
* const res = await client.responses.create({ model: "gpt-4.1", input, tools: ft.definitions });
|
|
188
|
-
* const calls = res.output.filter((o) => o.type === "function_call");
|
|
189
|
-
* if (calls.length === 0) break;
|
|
190
|
-
* for (const call of calls) {
|
|
191
|
-
* if (ft.needsApproval(call.name)) {
|
|
192
|
-
* // surface approval UX, then continue or break
|
|
193
|
-
* }
|
|
194
|
-
* input.push(call, await ft.execute(call));
|
|
195
|
-
* }
|
|
196
|
-
* }
|
|
197
|
-
* ```
|
|
198
|
-
*/
|
|
199
|
-
declare const createResponsesFileTools: ({
|
|
200
|
-
files,
|
|
201
|
-
overrides,
|
|
202
|
-
readOnly,
|
|
203
|
-
requireApproval
|
|
204
|
-
}: ResponsesFileToolsOptions) => ResponsesFileTools;
|
|
165
|
+
* Create a set of storage tools shaped for OpenAI's Responses API (`openai.responses.create`).
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* import OpenAI from "openai";
|
|
169
|
+
* import { Files } from "@visulima/storage";
|
|
170
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
171
|
+
* import { createResponsesFileTools } from "@visulima/storage/ai/openai";
|
|
172
|
+
*
|
|
173
|
+
* const client = new OpenAI();
|
|
174
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
175
|
+
* const ft = createResponsesFileTools({ files });
|
|
176
|
+
*
|
|
177
|
+
* const input: any[] = [{ role: "user", content: "List my files." }];
|
|
178
|
+
* while (true) {
|
|
179
|
+
* const res = await client.responses.create({ model: "gpt-4.1", input, tools: ft.definitions });
|
|
180
|
+
* const calls = res.output.filter((o) => o.type === "function_call");
|
|
181
|
+
* if (calls.length === 0) break;
|
|
182
|
+
* for (const call of calls) {
|
|
183
|
+
* if (ft.needsApproval(call.name)) {
|
|
184
|
+
* // surface approval UX, then continue or break
|
|
185
|
+
* }
|
|
186
|
+
* input.push(call, await ft.execute(call));
|
|
187
|
+
* }
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
declare const createResponsesFileTools: ({ files, overrides, readOnly, requireApproval }: ResponsesFileToolsOptions) => ResponsesFileTools;
|
|
205
192
|
export { type AgentsFileTools, type AgentsFileToolsOptions, type AgentsToolOverrides, type ApprovalConfig, type FileReadToolName, type FileToolName, type FunctionCallItem, type FunctionCallOutputItem, type ReadOnlyAgentsFileTools, type ResponsesFileTools, type ResponsesFileToolsOptions, type ResponsesFunctionTool, type ResponsesToolOverrides, agentsCopyFile, agentsDeleteFile, agentsDownloadFile, agentsGetFileMetadata, agentsGetFileUrl, agentsListFiles, agentsSignUploadUrl, agentsUploadFile, createAgentsFileTools, createResponsesFileTools };
|
|
@@ -1,25 +1,25 @@
|
|
|
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 { T as TOOL_SCHEMAS, c as FileReadToolName, F as FileToolName, A as ApprovalConfig } from "../../packem_shared/approval.d-
|
|
7
|
-
export type { d as FileWriteToolName } from "../../packem_shared/approval.d-
|
|
6
|
+
import { T as TOOL_SCHEMAS, c as FileReadToolName, F as FileToolName, A as ApprovalConfig } 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 { ServerTool } from '@tanstack/ai';
|
|
9
|
-
import "../../packem_shared/storage.d-
|
|
9
|
+
import "../../packem_shared/storage.d-DIav_lF1.js";
|
|
10
10
|
import 'zod';
|
|
11
11
|
/**
|
|
12
|
-
* Common options accepted by every write-tool factory.
|
|
13
|
-
*/
|
|
12
|
+
* Common options accepted by every write-tool factory.
|
|
13
|
+
*/
|
|
14
14
|
interface ToolOptions {
|
|
15
15
|
needsApproval?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Per-tool overrides for customizing TanStack AI `ServerTool` properties
|
|
19
|
-
* without changing the underlying implementation. Core properties
|
|
20
|
-
* (`execute`, `inputSchema`, `outputSchema`, `__toolSide`) are intentionally
|
|
21
|
-
* excluded — those drive the tool's behavior and contract.
|
|
22
|
-
*/
|
|
18
|
+
* Per-tool overrides for customizing TanStack AI `ServerTool` properties
|
|
19
|
+
* without changing the underlying implementation. Core properties
|
|
20
|
+
* (`execute`, `inputSchema`, `outputSchema`, `__toolSide`) are intentionally
|
|
21
|
+
* excluded — those drive the tool's behavior and contract.
|
|
22
|
+
*/
|
|
23
23
|
type ToolOverrides = Partial<Pick<ServerTool, "description" | "lazy" | "metadata" | "needsApproval">>;
|
|
24
24
|
type ListFilesParameters = typeof TOOL_SCHEMAS.listFiles.input;
|
|
25
25
|
type GetFileMetadataParameters = typeof TOOL_SCHEMAS.getFileMetadata.input;
|
|
@@ -33,40 +33,32 @@ declare const listFiles: (files: Files) => ServerTool<ListFilesParameters, never
|
|
|
33
33
|
declare const getFileMetadata: (files: Files) => ServerTool<GetFileMetadataParameters, never, "getFileMetadata">;
|
|
34
34
|
declare const downloadFile: (files: Files) => ServerTool<DownloadFileParameters, never, "downloadFile">;
|
|
35
35
|
declare const getFileUrl: (files: Files) => ServerTool<GetFileUrlParameters, never, "getFileUrl">;
|
|
36
|
-
declare const uploadFile: (files: Files, {
|
|
37
|
-
|
|
38
|
-
}?: ToolOptions) => ServerTool<
|
|
39
|
-
declare const
|
|
40
|
-
needsApproval
|
|
41
|
-
}?: ToolOptions) => ServerTool<DeleteFileParameters, never, "deleteFile">;
|
|
42
|
-
declare const copyFile: (files: Files, {
|
|
43
|
-
needsApproval
|
|
44
|
-
}?: ToolOptions) => ServerTool<CopyFileParameters, never, "copyFile">;
|
|
45
|
-
declare const signUploadUrl: (files: Files, {
|
|
46
|
-
needsApproval
|
|
47
|
-
}?: ToolOptions) => ServerTool<SignUploadUrlParameters, never, "signUploadUrl">;
|
|
36
|
+
declare const uploadFile: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<UploadFileParameters, never, "uploadFile">;
|
|
37
|
+
declare const deleteFile: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<DeleteFileParameters, never, "deleteFile">;
|
|
38
|
+
declare const copyFile: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<CopyFileParameters, never, "copyFile">;
|
|
39
|
+
declare const signUploadUrl: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<SignUploadUrlParameters, never, "signUploadUrl">;
|
|
48
40
|
interface TanstackFileToolsOptions {
|
|
49
41
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
* The configured `Files` instance the tools will operate against.
|
|
43
|
+
* Each tool delegates to the methods on this instance.
|
|
44
|
+
*/
|
|
53
45
|
files: Files;
|
|
54
46
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
* Per-tool overrides for customizing tool behavior (description,
|
|
48
|
+
* needsApproval, metadata) without changing the underlying implementation.
|
|
49
|
+
* `execute` and `inputSchema` cannot be overridden.
|
|
50
|
+
*/
|
|
59
51
|
overrides?: Partial<Record<FileToolName, ToolOverrides>>;
|
|
60
52
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
* When `true`, write tools (`uploadFile`, `deleteFile`, `copyFile`,
|
|
54
|
+
* `signUploadUrl`) are omitted entirely. The model cannot mutate the
|
|
55
|
+
* bucket regardless of approval configuration.
|
|
56
|
+
*/
|
|
65
57
|
readOnly?: boolean;
|
|
66
58
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
* Approval gating for write tools. Defaults to `true` (all writes
|
|
60
|
+
* require approval). See {@link ApprovalConfig}.
|
|
61
|
+
*/
|
|
70
62
|
requireApproval?: ApprovalConfig;
|
|
71
63
|
}
|
|
72
64
|
interface TanstackFileTools {
|
|
@@ -81,30 +73,30 @@ interface TanstackFileTools {
|
|
|
81
73
|
}
|
|
82
74
|
type ReadOnlyTanstackFileTools = Pick<TanstackFileTools, FileReadToolName>;
|
|
83
75
|
/**
|
|
84
|
-
* Create a set of visulima/storage tools for TanStack AI.
|
|
85
|
-
*
|
|
86
|
-
* Each entry is a `ServerTool` built via `toolDefinition(...).server(...)`,
|
|
87
|
-
* ready to be passed to `chat({ tools: [...] })` or registered with a
|
|
88
|
-
* `ToolRegistry`. Write operations require user approval by default;
|
|
89
|
-
* control globally or per-tool via `requireApproval`, or strip writes
|
|
90
|
-
* entirely with `readOnly: true`.
|
|
91
|
-
* @example
|
|
92
|
-
* ```ts
|
|
93
|
-
* import { Files } from "@visulima/storage";
|
|
94
|
-
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
95
|
-
* import { createTanstackFileTools } from "@visulima/storage/ai/tanstack";
|
|
96
|
-
* import { chat } from "@tanstack/ai";
|
|
97
|
-
*
|
|
98
|
-
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
99
|
-
* const tools = createTanstackFileTools({ files });
|
|
100
|
-
*
|
|
101
|
-
* const stream = chat({
|
|
102
|
-
* adapter,
|
|
103
|
-
* messages,
|
|
104
|
-
* tools: Object.values(tools),
|
|
105
|
-
* });
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
76
|
+
* Create a set of visulima/storage tools for TanStack AI.
|
|
77
|
+
*
|
|
78
|
+
* Each entry is a `ServerTool` built via `toolDefinition(...).server(...)`,
|
|
79
|
+
* ready to be passed to `chat({ tools: [...] })` or registered with a
|
|
80
|
+
* `ToolRegistry`. Write operations require user approval by default;
|
|
81
|
+
* control globally or per-tool via `requireApproval`, or strip writes
|
|
82
|
+
* entirely with `readOnly: true`.
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { Files } from "@visulima/storage";
|
|
86
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
87
|
+
* import { createTanstackFileTools } from "@visulima/storage/ai/tanstack";
|
|
88
|
+
* import { chat } from "@tanstack/ai";
|
|
89
|
+
*
|
|
90
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
91
|
+
* const tools = createTanstackFileTools({ files });
|
|
92
|
+
*
|
|
93
|
+
* const stream = chat({
|
|
94
|
+
* adapter,
|
|
95
|
+
* messages,
|
|
96
|
+
* tools: Object.values(tools),
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
108
100
|
declare function createTanstackFileTools(options: TanstackFileToolsOptions & {
|
|
109
101
|
readOnly: true;
|
|
110
102
|
}): ReadOnlyTanstackFileTools;
|