@visulima/storage 1.0.9 → 1.0.11
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 +17 -0
- package/dist/adapter/nuxt/module.d.ts +9 -8
- package/dist/ai/ai-sdk/index.d.ts +52 -59
- package/dist/ai/claude/index.d.ts +105 -119
- package/dist/ai/openai/index.d.ts +87 -99
- package/dist/ai/tanstack/index.d.ts +54 -61
- package/dist/handler/http/fetch/index.d.ts +202 -201
- package/dist/handler/http/fetch/index.js +1 -1
- package/dist/handler/http/hono/index.d.ts +60 -59
- package/dist/handler/http/hono/index.js +1 -1
- package/dist/handler/http/nextjs/index.d.ts +55 -54
- package/dist/handler/http/nextjs/index.js +1 -1
- package/dist/handler/http/node/index.d.ts +234 -246
- package/dist/handler/http/node/index.js +1 -1
- package/dist/handler/http/solid-start/index.d.ts +55 -54
- package/dist/handler/http/solid-start/index.js +1 -1
- package/dist/index.d.ts +71 -70
- package/dist/index.js +1 -1
- package/dist/packem_shared/{AbstractBaseStorage-CiPEMcuo.js → AbstractBaseStorage-CLsYmMZg.js} +1 -1
- package/dist/packem_shared/AwsLightStorage-DGSPFUqr.js +1 -0
- package/dist/packem_shared/AzureStorage-DvKk_hhz.js +1 -0
- package/dist/packem_shared/BoxMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BoxStorage-DbGqBLux.js → BoxStorage-CmM95wi2.js} +1 -1
- package/dist/packem_shared/BunS3MetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BunS3Storage-DNvimm9e.js → BunS3Storage-B_roVJ29.js} +1 -1
- package/dist/packem_shared/BunnyMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{BunnyStorage-C7d0opLL.js → BunnyStorage-eZ1QDVaY.js} +1 -1
- package/dist/packem_shared/CloudinaryMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{CloudinaryStorage-Dc3XA2lP.js → CloudinaryStorage-CpH2f0Fv.js} +1 -1
- package/dist/packem_shared/DiskStorage-DzjjqCzo.js +1 -0
- package/dist/packem_shared/{DiskStorageWithChecksum-vFCubS6K.js → DiskStorageWithChecksum-MZkDEyts.js} +1 -1
- package/dist/packem_shared/DropboxMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{DropboxStorage-CY9Ggu3m.js → DropboxStorage-BB9NoWK2.js} +1 -1
- package/dist/packem_shared/{Files-CpIcMjP0.js → Files-DyMJ9FPN.js} +1 -1
- package/dist/packem_shared/FirebaseMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{FirebaseStorage-D6O9CJXN.js → FirebaseStorage-BgbxzYNC.js} +1 -1
- package/dist/packem_shared/FtpMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{FtpStorage-DbEjbq8z.js → FtpStorage-CNqXDz7P.js} +1 -1
- package/dist/packem_shared/{GCSMetaStorage-DT8K6zdm.js → GCSMetaStorage-gEhWlpfS.js} +1 -1
- package/dist/packem_shared/{GCStorage-6BHkFlEs.js → GCStorage-CRd5vjok.js} +1 -1
- package/dist/packem_shared/GoogleDriveMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{GoogleDriveStorage-Bklsz7Bh.js → GoogleDriveStorage-Du7uBhSm.js} +1 -1
- package/dist/packem_shared/{LocalMetaStorage-BhicZnNl.js → LocalMetaStorage-CcGfFG39.js} +1 -1
- package/dist/packem_shared/{MemoryStorage-9gbWd09l.js → MemoryStorage-ChKyI6OY.js} +1 -1
- package/dist/packem_shared/{Multipart-D0ok6BBy.js → Multipart-C35TR2qL.js} +1 -1
- package/dist/packem_shared/{Multipart-CQjYqU--.js → Multipart-V64Bg5dt.js} +1 -1
- package/dist/packem_shared/NetlifyBlobMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/NetlifyBlobStorage-CZsr_0DF.js +1 -0
- package/dist/packem_shared/OneDriveMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{OneDriveStorage-CP6MvGAa.js → OneDriveStorage-B8qFgMq1.js} +1 -1
- package/dist/packem_shared/PocketBaseMetaStorage-Cm3v8g1-.js +1 -0
- package/dist/packem_shared/{PocketBaseStorage-2qhbI2PW.js → PocketBaseStorage-D2vMN-oY.js} +1 -1
- package/dist/packem_shared/{Rest-CI_BiZPv.js → Rest-B7g1sgkq.js} +1 -1
- package/dist/packem_shared/{Rest-DvfN4-kf.js → Rest-BrEMYgxZ.js} +1 -1
- package/dist/packem_shared/{S3Storage-YGeNk3Tt.js → S3Storage-CTe_BMDl.js} +1 -1
- package/dist/packem_shared/SftpMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{SftpStorage-2Hz396Xr.js → SftpStorage-BKeAzuej.js} +1 -1
- package/dist/packem_shared/SharePointMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{SharePointStorage-CrX2Pk6C.js → SharePointStorage-Dtnt5-wk.js} +1 -1
- package/dist/packem_shared/SupabaseMetaStorage-B0gLF7Io.js +1 -0
- package/dist/packem_shared/{SupabaseStorage-Dc_DBX29.js → SupabaseStorage-CmGQjqXf.js} +1 -1
- package/dist/packem_shared/{Tus-BlBZykIL.js → Tus-CJBgnJrn.js} +1 -1
- package/dist/packem_shared/{Tus-BBVt2ky3.js → Tus-D9c7KDnl.js} +1 -1
- package/dist/packem_shared/UploadThingMetaStorage-Bv_YCZ0Q.js +1 -0
- package/dist/packem_shared/{UploadThingStorage-BChykYSe.js → UploadThingStorage-DZ4zNvDH.js} +1 -1
- package/dist/packem_shared/VercelBlobMetaStorage-CJsyeQ63.js +1 -0
- package/dist/packem_shared/{VercelBlobStorage-CsRyPfw3.js → VercelBlobStorage-DDNEofR3.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/{base-handler-core-D-9Ku1h-.js → base-handler-core-BJP9jHCE.js} +1 -1
- package/dist/packem_shared/{base-handler-fetch-CfkNakv8.js → base-handler-fetch-yrYrukwL.js} +1 -1
- package/dist/packem_shared/base-handler-node-C8P9rkaH.js +1 -0
- package/dist/packem_shared/{createRetryWrapper-CxgiV_hH.js → createRetryWrapper-DgmeHPNF.js} +1 -1
- package/dist/packem_shared/disk-storage-DqnnFQAQ.js +1 -0
- package/dist/packem_shared/disk-storage-with-checksum.d-Dgwyza8a.d.ts +146 -0
- package/dist/packem_shared/{executors.d-BZP2rWo3.d.ts → executors.d-B9dIy3NT.d.ts} +3 -2
- package/dist/packem_shared/files.d-CmSZi3M0.d.ts +655 -0
- package/dist/packem_shared/gcs-meta-storage-C9F78Sqq.js +1 -0
- package/dist/packem_shared/local-meta-storage-BELb1YwO.js +11 -0
- package/dist/packem_shared/{local-meta-storage.d-D9PBfkn6.d.ts → local-meta-storage.d-cRTXr1kb.d.ts} +7 -7
- package/dist/packem_shared/media-transformer.d-C8tn4J2Z.d.ts +331 -0
- package/dist/packem_shared/{memory-storage.d-4EU1cMt1.d.ts → memory-storage.d-BNZvDG1b.d.ts} +32 -40
- package/dist/packem_shared/path-C-OWflAo-_mqb5p5d.js +1 -0
- package/dist/packem_shared/{rest-base-e0reNDE_.js → rest-base-BQ_dhWyV.js} +1 -1
- package/dist/packem_shared/s3-base-storage-CX94H-Za.js +1 -0
- package/dist/packem_shared/{s3-base-storage.d-BQgP5B-t.d.ts → s3-base-storage.d-ks99NSs-.d.ts} +64 -70
- package/dist/packem_shared/storage-DR7qdwBN.js +1 -0
- package/dist/packem_shared/storage.d-DwdJrArF.d.ts +1186 -0
- package/dist/packem_shared/tus-base.d-BKBoJVy0.d.ts +103 -0
- package/dist/packem_shared/types.d-B1_xZIhu.d.ts +104 -0
- package/dist/packem_shared/{types.d-CrUWY4On.d.ts → types.d-BEUv414z.d.ts} +134 -134
- package/dist/packem_shared/{types.d-CggTCgXr.d.ts → types.d-D7Zlz5RE.d.ts} +3 -3
- package/dist/storage/aws/clients/index.d.ts +388 -388
- package/dist/storage/aws/index.d.ts +110 -113
- package/dist/storage/aws/index.js +1 -1
- package/dist/storage/aws-light/index.d.ts +64 -67
- package/dist/storage/aws-light/index.js +1 -1
- package/dist/storage/azure/index.d.ts +134 -139
- package/dist/storage/azure/index.js +1 -1
- package/dist/storage/box/index.d.ts +89 -92
- package/dist/storage/box/index.js +1 -1
- package/dist/storage/bun-s3/index.d.ts +71 -76
- package/dist/storage/bun-s3/index.js +1 -1
- package/dist/storage/bunny/index.d.ts +52 -55
- package/dist/storage/bunny/index.js +1 -1
- package/dist/storage/cloudinary/index.d.ts +54 -59
- package/dist/storage/cloudinary/index.js +1 -1
- package/dist/storage/dropbox/index.d.ts +59 -62
- package/dist/storage/dropbox/index.js +1 -1
- package/dist/storage/firebase/index.d.ts +74 -79
- package/dist/storage/firebase/index.js +1 -1
- package/dist/storage/ftp/index.d.ts +38 -43
- package/dist/storage/ftp/index.js +1 -1
- package/dist/storage/gcs/index.d.ts +90 -95
- package/dist/storage/gcs/index.js +1 -1
- package/dist/storage/google-drive/index.d.ts +69 -72
- package/dist/storage/google-drive/index.js +1 -1
- package/dist/storage/local/index.d.ts +4 -3
- package/dist/storage/local/index.js +1 -1
- package/dist/storage/memory/index.d.ts +3 -2
- package/dist/storage/memory/index.js +1 -1
- package/dist/storage/netlify-blob/index.d.ts +86 -93
- package/dist/storage/netlify-blob/index.js +1 -1
- package/dist/storage/onedrive/index.d.ts +44 -53
- package/dist/storage/onedrive/index.js +1 -1
- package/dist/storage/pocketbase/index.d.ts +67 -72
- package/dist/storage/pocketbase/index.js +1 -1
- package/dist/storage/sftp/index.d.ts +40 -45
- package/dist/storage/sftp/index.js +1 -1
- package/dist/storage/sharepoint/index.d.ts +96 -95
- package/dist/storage/sharepoint/index.js +1 -1
- package/dist/storage/supabase/index.d.ts +50 -55
- package/dist/storage/supabase/index.js +1 -1
- package/dist/storage/uploadthing/index.d.ts +34 -37
- package/dist/storage/uploadthing/index.js +1 -1
- package/dist/storage/vercel-blob/index.d.ts +110 -115
- package/dist/storage/vercel-blob/index.js +1 -1
- package/dist/transformer/audio-transformer.d.ts +97 -96
- package/dist/transformer/image-transformer.d.ts +423 -422
- package/dist/transformer/index.d.ts +35 -34
- package/dist/transformer/video-transformer.d.ts +112 -111
- package/package.json +2 -2
- package/dist/packem_shared/AwsLightStorage-BK-WPL0h.js +0 -1
- package/dist/packem_shared/AzureStorage-1UvDIQZd.js +0 -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/DiskStorage-CI07TVNu.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/NetlifyBlobStorage-CkpCCoN1.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/base-handler-node-BF1v1qDa.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/gcs-meta-storage-B7BnctnV.js +0 -1
- 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/path-0oTTdkvl-DvWvbDbh.js +0 -1
- package/dist/packem_shared/s3-base-storage-BoTyhuzO.js +0 -1
- package/dist/packem_shared/storage-0j5nCAUp.js +0 -1
- 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,29 @@
|
|
|
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-CmSZi3M0.js";
|
|
5
5
|
import 'node:stream';
|
|
6
|
+
import 'node:timers';
|
|
6
7
|
import 'node:crypto';
|
|
7
8
|
import 'node:http';
|
|
8
9
|
import 'lru-cache';
|
|
9
|
-
import { e as executors } from "../../packem_shared/executors.d-
|
|
10
|
+
import { e as executors } from "../../packem_shared/executors.d-B9dIy3NT.js";
|
|
10
11
|
import 'zod';
|
|
11
|
-
import "../../packem_shared/storage.d-
|
|
12
|
+
import "../../packem_shared/storage.d-DwdJrArF.js";
|
|
12
13
|
/**
|
|
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
|
-
*/
|
|
14
|
+
* Per-tool overrides for `createResponsesFileTools`. `name`, `parameters`, and
|
|
15
|
+
* `type` are intentionally not overridable — the contract that drives tool
|
|
16
|
+
* behavior should not be patched at this layer.
|
|
17
|
+
*/
|
|
17
18
|
interface ResponsesToolOverrides {
|
|
18
19
|
description?: string;
|
|
19
20
|
strict?: boolean;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
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
|
-
*/
|
|
23
|
+
* Per-tool overrides for `createAgentsFileTools`. `name`, `parameters`,
|
|
24
|
+
* `execute`, and `strict` are intentionally not overridable — the contract
|
|
25
|
+
* that drives tool behavior should not be patched at this layer.
|
|
26
|
+
*/
|
|
26
27
|
interface AgentsToolOverrides {
|
|
27
28
|
description?: string;
|
|
28
29
|
needsApproval?: boolean;
|
|
@@ -47,24 +48,16 @@ declare const agentsListFiles: (files: Files) => FunctionTool<UnknownContext, Li
|
|
|
47
48
|
declare const agentsGetFileMetadata: (files: Files) => FunctionTool<UnknownContext, GetFileMetadataParameters, GetFileMetadataOutput>;
|
|
48
49
|
declare const agentsDownloadFile: (files: Files) => FunctionTool<UnknownContext, DownloadFileParameters, DownloadFileOutput>;
|
|
49
50
|
declare const agentsGetFileUrl: (files: Files) => FunctionTool<UnknownContext, GetFileUrlParameters, GetFileUrlOutput>;
|
|
50
|
-
declare const agentsUploadFile: (files: Files, {
|
|
51
|
-
needsApproval
|
|
52
|
-
}?: {
|
|
51
|
+
declare const agentsUploadFile: (files: Files, { needsApproval }?: {
|
|
53
52
|
needsApproval?: boolean;
|
|
54
53
|
}) => FunctionTool<UnknownContext, UploadFileParameters, UploadFileOutput>;
|
|
55
|
-
declare const agentsDeleteFile: (files: Files, {
|
|
56
|
-
needsApproval
|
|
57
|
-
}?: {
|
|
54
|
+
declare const agentsDeleteFile: (files: Files, { needsApproval }?: {
|
|
58
55
|
needsApproval?: boolean;
|
|
59
56
|
}) => FunctionTool<UnknownContext, DeleteFileParameters, DeleteFileOutput>;
|
|
60
|
-
declare const agentsCopyFile: (files: Files, {
|
|
61
|
-
needsApproval
|
|
62
|
-
}?: {
|
|
57
|
+
declare const agentsCopyFile: (files: Files, { needsApproval }?: {
|
|
63
58
|
needsApproval?: boolean;
|
|
64
59
|
}) => FunctionTool<UnknownContext, CopyFileParameters, CopyFileOutput>;
|
|
65
|
-
declare const agentsSignUploadUrl: (files: Files, {
|
|
66
|
-
needsApproval
|
|
67
|
-
}?: {
|
|
60
|
+
declare const agentsSignUploadUrl: (files: Files, { needsApproval }?: {
|
|
68
61
|
needsApproval?: boolean;
|
|
69
62
|
}) => FunctionTool<UnknownContext, SignUploadUrlParameters, SignUploadUrlOutput>;
|
|
70
63
|
interface AgentsFileTools {
|
|
@@ -85,29 +78,29 @@ interface AgentsFileToolsOptions {
|
|
|
85
78
|
requireApproval?: ApprovalConfig;
|
|
86
79
|
}
|
|
87
80
|
/**
|
|
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
|
-
*/
|
|
81
|
+
* Create a set of storage tools shaped for the OpenAI Agents SDK (`@openai/agents`).
|
|
82
|
+
*
|
|
83
|
+
* Returns a record keyed by tool name — spread `Object.values()` into
|
|
84
|
+
* `new Agent({ tools })`. Write tools require approval by default.
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { Agent, run } from "@openai/agents";
|
|
88
|
+
* import { Files } from "@visulima/storage";
|
|
89
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
90
|
+
* import { createAgentsFileTools } from "@visulima/storage/ai/openai";
|
|
91
|
+
*
|
|
92
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
93
|
+
* const tools = createAgentsFileTools({ files });
|
|
94
|
+
*
|
|
95
|
+
* const agent = new Agent({
|
|
96
|
+
* instructions: "Help the user manage their files.",
|
|
97
|
+
* name: "Files agent",
|
|
98
|
+
* tools: Object.values(tools),
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* const result = await run(agent, "List my files.");
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
111
104
|
declare function createAgentsFileTools(options: AgentsFileToolsOptions & {
|
|
112
105
|
readOnly: true;
|
|
113
106
|
}): ReadOnlyAgentsFileTools;
|
|
@@ -116,9 +109,9 @@ declare function createAgentsFileTools(options: AgentsFileToolsOptions & {
|
|
|
116
109
|
}): AgentsFileTools;
|
|
117
110
|
declare function createAgentsFileTools(options: AgentsFileToolsOptions): AgentsFileTools | ReadOnlyAgentsFileTools;
|
|
118
111
|
/**
|
|
119
|
-
* A function-tool definition shaped for OpenAI's Responses API. Pass an
|
|
120
|
-
* array of these to `openai.responses.create({ tools })`.
|
|
121
|
-
*/
|
|
112
|
+
* A function-tool definition shaped for OpenAI's Responses API. Pass an
|
|
113
|
+
* array of these to `openai.responses.create({ tools })`.
|
|
114
|
+
*/
|
|
122
115
|
interface ResponsesFunctionTool {
|
|
123
116
|
description: string;
|
|
124
117
|
name: string;
|
|
@@ -127,8 +120,8 @@ interface ResponsesFunctionTool {
|
|
|
127
120
|
type: "function";
|
|
128
121
|
}
|
|
129
122
|
/**
|
|
130
|
-
* A function call emitted by the Responses API in `response.output[]`.
|
|
131
|
-
*/
|
|
123
|
+
* A function call emitted by the Responses API in `response.output[]`.
|
|
124
|
+
*/
|
|
132
125
|
interface FunctionCallItem {
|
|
133
126
|
arguments: string;
|
|
134
127
|
call_id: string;
|
|
@@ -136,9 +129,9 @@ interface FunctionCallItem {
|
|
|
136
129
|
type: "function_call";
|
|
137
130
|
}
|
|
138
131
|
/**
|
|
139
|
-
* A function-call output item to append to the next `responses.create`
|
|
140
|
-
* input alongside the original `function_call` item.
|
|
141
|
-
*/
|
|
132
|
+
* A function-call output item to append to the next `responses.create`
|
|
133
|
+
* input alongside the original `function_call` item.
|
|
134
|
+
*/
|
|
142
135
|
interface FunctionCallOutputItem {
|
|
143
136
|
call_id: string;
|
|
144
137
|
output: string;
|
|
@@ -146,21 +139,21 @@ interface FunctionCallOutputItem {
|
|
|
146
139
|
}
|
|
147
140
|
interface ResponsesFileTools {
|
|
148
141
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
* Function tool definitions. Pass directly to `openai.responses.create({ tools })`.
|
|
143
|
+
*/
|
|
151
144
|
definitions: ResponsesFunctionTool[];
|
|
152
145
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
146
|
+
* Execute a `function_call` item from the model's `response.output[]`.
|
|
147
|
+
* Returns a `function_call_output` item ready to push into the next turn's input.
|
|
148
|
+
*
|
|
149
|
+
* Approval is **not** enforced. Check {@link ResponsesFileTools.needsApproval}
|
|
150
|
+
* first if you want a human-in-the-loop gate.
|
|
151
|
+
*/
|
|
159
152
|
execute: (call: FunctionCallItem) => Promise<FunctionCallOutputItem>;
|
|
160
153
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
154
|
+
* Returns whether the named tool is approval-gated under this config.
|
|
155
|
+
* Read tools always return `false`. Unknown names return `false`.
|
|
156
|
+
*/
|
|
164
157
|
needsApproval: (name: string) => boolean;
|
|
165
158
|
}
|
|
166
159
|
interface ResponsesFileToolsOptions {
|
|
@@ -170,36 +163,31 @@ interface ResponsesFileToolsOptions {
|
|
|
170
163
|
requireApproval?: ApprovalConfig;
|
|
171
164
|
}
|
|
172
165
|
/**
|
|
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;
|
|
166
|
+
* Create a set of storage tools shaped for OpenAI's Responses API (`openai.responses.create`).
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* import OpenAI from "openai";
|
|
170
|
+
* import { Files } from "@visulima/storage";
|
|
171
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
172
|
+
* import { createResponsesFileTools } from "@visulima/storage/ai/openai";
|
|
173
|
+
*
|
|
174
|
+
* const client = new OpenAI();
|
|
175
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
176
|
+
* const ft = createResponsesFileTools({ files });
|
|
177
|
+
*
|
|
178
|
+
* const input: any[] = [{ role: "user", content: "List my files." }];
|
|
179
|
+
* while (true) {
|
|
180
|
+
* const res = await client.responses.create({ model: "gpt-4.1", input, tools: ft.definitions });
|
|
181
|
+
* const calls = res.output.filter((o) => o.type === "function_call");
|
|
182
|
+
* if (calls.length === 0) break;
|
|
183
|
+
* for (const call of calls) {
|
|
184
|
+
* if (ft.needsApproval(call.name)) {
|
|
185
|
+
* // surface approval UX, then continue or break
|
|
186
|
+
* }
|
|
187
|
+
* input.push(call, await ft.execute(call));
|
|
188
|
+
* }
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare const createResponsesFileTools: ({ files, overrides, readOnly, requireApproval }: ResponsesFileToolsOptions) => ResponsesFileTools;
|
|
205
193
|
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,26 @@
|
|
|
1
|
-
import { F as Files } from "../../packem_shared/files.d-
|
|
1
|
+
import { F as Files } from "../../packem_shared/files.d-CmSZi3M0.js";
|
|
2
2
|
import 'node:stream';
|
|
3
|
+
import 'node:timers';
|
|
3
4
|
import 'node:crypto';
|
|
4
5
|
import 'node:http';
|
|
5
6
|
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-
|
|
7
|
+
import { T as TOOL_SCHEMAS, c as FileReadToolName, F as FileToolName, A as ApprovalConfig } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
8
|
+
export type { d as FileWriteToolName } from "../../packem_shared/approval.d-C-d-t94D.js";
|
|
8
9
|
import { ServerTool } from '@tanstack/ai';
|
|
9
|
-
import "../../packem_shared/storage.d-
|
|
10
|
+
import "../../packem_shared/storage.d-DwdJrArF.js";
|
|
10
11
|
import 'zod';
|
|
11
12
|
/**
|
|
12
|
-
* Common options accepted by every write-tool factory.
|
|
13
|
-
*/
|
|
13
|
+
* Common options accepted by every write-tool factory.
|
|
14
|
+
*/
|
|
14
15
|
interface ToolOptions {
|
|
15
16
|
needsApproval?: boolean;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
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
|
-
*/
|
|
19
|
+
* Per-tool overrides for customizing TanStack AI `ServerTool` properties
|
|
20
|
+
* without changing the underlying implementation. Core properties
|
|
21
|
+
* (`execute`, `inputSchema`, `outputSchema`, `__toolSide`) are intentionally
|
|
22
|
+
* excluded — those drive the tool's behavior and contract.
|
|
23
|
+
*/
|
|
23
24
|
type ToolOverrides = Partial<Pick<ServerTool, "description" | "lazy" | "metadata" | "needsApproval">>;
|
|
24
25
|
type ListFilesParameters = typeof TOOL_SCHEMAS.listFiles.input;
|
|
25
26
|
type GetFileMetadataParameters = typeof TOOL_SCHEMAS.getFileMetadata.input;
|
|
@@ -33,40 +34,32 @@ declare const listFiles: (files: Files) => ServerTool<ListFilesParameters, never
|
|
|
33
34
|
declare const getFileMetadata: (files: Files) => ServerTool<GetFileMetadataParameters, never, "getFileMetadata">;
|
|
34
35
|
declare const downloadFile: (files: Files) => ServerTool<DownloadFileParameters, never, "downloadFile">;
|
|
35
36
|
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">;
|
|
37
|
+
declare const uploadFile: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<UploadFileParameters, never, "uploadFile">;
|
|
38
|
+
declare const deleteFile: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<DeleteFileParameters, never, "deleteFile">;
|
|
39
|
+
declare const copyFile: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<CopyFileParameters, never, "copyFile">;
|
|
40
|
+
declare const signUploadUrl: (files: Files, { needsApproval }?: ToolOptions) => ServerTool<SignUploadUrlParameters, never, "signUploadUrl">;
|
|
48
41
|
interface TanstackFileToolsOptions {
|
|
49
42
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
* The configured `Files` instance the tools will operate against.
|
|
44
|
+
* Each tool delegates to the methods on this instance.
|
|
45
|
+
*/
|
|
53
46
|
files: Files;
|
|
54
47
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
* Per-tool overrides for customizing tool behavior (description,
|
|
49
|
+
* needsApproval, metadata) without changing the underlying implementation.
|
|
50
|
+
* `execute` and `inputSchema` cannot be overridden.
|
|
51
|
+
*/
|
|
59
52
|
overrides?: Partial<Record<FileToolName, ToolOverrides>>;
|
|
60
53
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
*/
|
|
65
58
|
readOnly?: boolean;
|
|
66
59
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
* Approval gating for write tools. Defaults to `true` (all writes
|
|
61
|
+
* require approval). See {@link ApprovalConfig}.
|
|
62
|
+
*/
|
|
70
63
|
requireApproval?: ApprovalConfig;
|
|
71
64
|
}
|
|
72
65
|
interface TanstackFileTools {
|
|
@@ -81,30 +74,30 @@ interface TanstackFileTools {
|
|
|
81
74
|
}
|
|
82
75
|
type ReadOnlyTanstackFileTools = Pick<TanstackFileTools, FileReadToolName>;
|
|
83
76
|
/**
|
|
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
|
-
*/
|
|
77
|
+
* Create a set of visulima/storage tools for TanStack AI.
|
|
78
|
+
*
|
|
79
|
+
* Each entry is a `ServerTool` built via `toolDefinition(...).server(...)`,
|
|
80
|
+
* ready to be passed to `chat({ tools: [...] })` or registered with a
|
|
81
|
+
* `ToolRegistry`. Write operations require user approval by default;
|
|
82
|
+
* control globally or per-tool via `requireApproval`, or strip writes
|
|
83
|
+
* entirely with `readOnly: true`.
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { Files } from "@visulima/storage";
|
|
87
|
+
* import { S3Storage } from "@visulima/storage/provider/aws";
|
|
88
|
+
* import { createTanstackFileTools } from "@visulima/storage/ai/tanstack";
|
|
89
|
+
* import { chat } from "@tanstack/ai";
|
|
90
|
+
*
|
|
91
|
+
* const files = new Files({ adapter: new S3Storage({ bucket: "uploads" }) });
|
|
92
|
+
* const tools = createTanstackFileTools({ files });
|
|
93
|
+
*
|
|
94
|
+
* const stream = chat({
|
|
95
|
+
* adapter,
|
|
96
|
+
* messages,
|
|
97
|
+
* tools: Object.values(tools),
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
108
101
|
declare function createTanstackFileTools(options: TanstackFileToolsOptions & {
|
|
109
102
|
readOnly: true;
|
|
110
103
|
}): ReadOnlyTanstackFileTools;
|