@anthropic-ai/sdk 0.118.0 → 0.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/client.d.mts +8 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -2
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/lib/tools/BetaRunnableTool.d.mts +4 -1
- package/lib/tools/BetaRunnableTool.d.mts.map +1 -1
- package/lib/tools/BetaRunnableTool.d.ts +4 -1
- package/lib/tools/BetaRunnableTool.d.ts.map +1 -1
- package/lib/tools/BetaRunnableTool.js +7 -2
- package/lib/tools/BetaRunnableTool.js.map +1 -1
- package/lib/tools/BetaRunnableTool.mjs +7 -2
- package/lib/tools/BetaRunnableTool.mjs.map +1 -1
- package/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/lib/tools/BetaToolRunner.js +3 -1
- package/lib/tools/BetaToolRunner.js.map +1 -1
- package/lib/tools/BetaToolRunner.mjs +3 -1
- package/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +4 -4
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/files.d.mts +22 -22
- package/resources/beta/files.d.mts.map +1 -1
- package/resources/beta/files.d.ts +22 -22
- package/resources/beta/files.d.ts.map +1 -1
- package/resources/beta/files.js +4 -4
- package/resources/beta/files.js.map +1 -1
- package/resources/beta/files.mjs +4 -4
- package/resources/beta/files.mjs.map +1 -1
- package/resources/beta/index.d.mts +2 -2
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/messages/index.d.mts +1 -1
- package/resources/beta/messages/index.d.mts.map +1 -1
- package/resources/beta/messages/index.d.ts +1 -1
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.mts +1201 -4
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +1201 -4
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/files.d.mts +105 -0
- package/resources/files.d.mts.map +1 -0
- package/resources/files.d.ts +105 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +52 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +48 -0
- package/resources/files.mjs.map +1 -0
- package/resources/index.d.mts +3 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/messages/index.d.mts +1 -1
- package/resources/messages/index.d.mts.map +1 -1
- package/resources/messages/index.d.ts +1 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js.map +1 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts +1267 -7
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +1267 -7
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/skills/index.d.mts +3 -0
- package/resources/skills/index.d.mts.map +1 -0
- package/resources/skills/index.d.ts +3 -0
- package/resources/skills/index.d.ts.map +1 -0
- package/resources/skills/index.js +9 -0
- package/resources/skills/index.js.map +1 -0
- package/resources/skills/index.mjs +4 -0
- package/resources/skills/index.mjs.map +1 -0
- package/resources/skills/skills.d.mts +129 -0
- package/resources/skills/skills.d.mts.map +1 -0
- package/resources/skills/skills.d.ts +129 -0
- package/resources/skills/skills.d.ts.map +1 -0
- package/resources/skills/skills.js +44 -0
- package/resources/skills/skills.js.map +1 -0
- package/resources/skills/skills.mjs +39 -0
- package/resources/skills/skills.mjs.map +1 -0
- package/resources/skills/versions.d.mts +104 -0
- package/resources/skills/versions.d.mts.map +1 -0
- package/resources/skills/versions.d.ts +104 -0
- package/resources/skills/versions.d.ts.map +1 -0
- package/resources/skills/versions.js +41 -0
- package/resources/skills/versions.js.map +1 -0
- package/resources/skills/versions.mjs +37 -0
- package/resources/skills/versions.mjs.map +1 -0
- package/resources/skills.d.mts +2 -0
- package/resources/skills.d.mts.map +1 -0
- package/resources/skills.d.ts +2 -0
- package/resources/skills.d.ts.map +1 -0
- package/resources/skills.js +6 -0
- package/resources/skills.js.map +1 -0
- package/resources/skills.mjs +3 -0
- package/resources/skills.mjs.map +1 -0
- package/src/client.ts +172 -0
- package/src/lib/tools/BetaRunnableTool.ts +9 -2
- package/src/lib/tools/BetaToolRunner.ts +6 -1
- package/src/resources/beta/beta.ts +126 -6
- package/src/resources/beta/files.ts +27 -27
- package/src/resources/beta/index.ts +63 -3
- package/src/resources/beta/messages/index.ts +60 -0
- package/src/resources/beta/messages/messages.ts +1861 -411
- package/src/resources/files.ts +163 -0
- package/src/resources/index.ts +83 -0
- package/src/resources/messages/index.ts +66 -0
- package/src/resources/messages/messages.ts +1648 -115
- package/src/resources/skills/index.ts +21 -0
- package/src/resources/skills/skills.ts +194 -0
- package/src/resources/skills/versions.ts +160 -0
- package/src/resources/skills.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -74,9 +74,16 @@ export type BetaRunnableTool<Input = any> = BetaClientRunnableToolType & {
|
|
|
74
74
|
close?: () => Promisable<void>;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The name the model calls a tool by: `mcp_server_name` for MCP toolsets, `type` for nameless server
|
|
79
|
+
* toolsets (browser/computer), `name` for everything else.
|
|
80
|
+
*/
|
|
78
81
|
export function toolName(tool: BetaToolUnion | BetaRunnableTool): string {
|
|
79
|
-
return
|
|
82
|
+
return (
|
|
83
|
+
'name' in tool ? tool.name
|
|
84
|
+
: 'mcp_server_name' in tool ? tool.mcp_server_name
|
|
85
|
+
: tool.type
|
|
86
|
+
);
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
/** Tool-result content for a thrown value: a {@link ToolError}'s own content, otherwise `Error: <message>`. */
|
|
@@ -492,7 +492,12 @@ async function generateToolResponse(
|
|
|
492
492
|
const available = availableToolNames(params);
|
|
493
493
|
const toolResults = await Promise.all(
|
|
494
494
|
toolUseBlocks.map(async (toolUse) => {
|
|
495
|
-
const tool = params.tools.find(
|
|
495
|
+
const tool = params.tools.find(
|
|
496
|
+
(t) =>
|
|
497
|
+
('name' in t ? t.name
|
|
498
|
+
: 'mcp_server_name' in t ? t.mcp_server_name
|
|
499
|
+
: t.type) === toolUse.name,
|
|
500
|
+
);
|
|
496
501
|
// A `tool_removal` is only a hint to the model, which may still emit a tool_use for a
|
|
497
502
|
// withdrawn tool — treat those exactly like a tool that was never defined.
|
|
498
503
|
if (!tool || !('run' in tool) || !available.has(toolUse.name)) {
|
|
@@ -101,13 +101,13 @@ import {
|
|
|
101
101
|
} from './dreams';
|
|
102
102
|
import * as FilesAPI from './files';
|
|
103
103
|
import {
|
|
104
|
+
BetaDeletedFile,
|
|
105
|
+
BetaFileMetadata,
|
|
106
|
+
BetaFileMetadataPage,
|
|
104
107
|
BetaFileScope,
|
|
105
|
-
DeletedFile,
|
|
106
108
|
FileDeleteParams,
|
|
107
109
|
FileDownloadParams,
|
|
108
110
|
FileListParams,
|
|
109
|
-
FileMetadata,
|
|
110
|
-
FileMetadataPage,
|
|
111
111
|
FileRetrieveMetadataParams,
|
|
112
112
|
FileUploadParams,
|
|
113
113
|
Files,
|
|
@@ -304,6 +304,46 @@ import {
|
|
|
304
304
|
BetaBashCodeExecutionToolResultBlockParam,
|
|
305
305
|
BetaBashCodeExecutionToolResultError,
|
|
306
306
|
BetaBashCodeExecutionToolResultErrorParam,
|
|
307
|
+
BetaBrowserCloseTabConfig,
|
|
308
|
+
BetaBrowserDoubleClickConfig,
|
|
309
|
+
BetaBrowserFileUploadConfig,
|
|
310
|
+
BetaBrowserFindConfig,
|
|
311
|
+
BetaBrowserFormInputConfig,
|
|
312
|
+
BetaBrowserGetPageTextConfig,
|
|
313
|
+
BetaBrowserHoldKeyConfig,
|
|
314
|
+
BetaBrowserHoverConfig,
|
|
315
|
+
BetaBrowserJavascriptExecConfig,
|
|
316
|
+
BetaBrowserKeyConfig,
|
|
317
|
+
BetaBrowserLeftClickConfig,
|
|
318
|
+
BetaBrowserLeftClickDragConfig,
|
|
319
|
+
BetaBrowserLeftMouseDownConfig,
|
|
320
|
+
BetaBrowserLeftMouseUpConfig,
|
|
321
|
+
BetaBrowserListTabsConfig,
|
|
322
|
+
BetaBrowserMiddleClickConfig,
|
|
323
|
+
BetaBrowserMouseMoveConfig,
|
|
324
|
+
BetaBrowserNavigateConfig,
|
|
325
|
+
BetaBrowserNewTabConfig,
|
|
326
|
+
BetaBrowserReadConsoleConfig,
|
|
327
|
+
BetaBrowserReadNetworkConfig,
|
|
328
|
+
BetaBrowserReadPageConfig,
|
|
329
|
+
BetaBrowserRightClickConfig,
|
|
330
|
+
BetaBrowserScreenshotConfig,
|
|
331
|
+
BetaBrowserScrollConfig,
|
|
332
|
+
BetaBrowserScrollToConfig,
|
|
333
|
+
BetaBrowserStateBlockParam,
|
|
334
|
+
BetaBrowserStateChange,
|
|
335
|
+
BetaBrowserStateChangeDownloadCompleted,
|
|
336
|
+
BetaBrowserStateChangeDownloadFailed,
|
|
337
|
+
BetaBrowserStateChangeDownloadStarted,
|
|
338
|
+
BetaBrowserStateChangeTabOpened,
|
|
339
|
+
BetaBrowserStateTabEntry,
|
|
340
|
+
BetaBrowserSwitchTabConfig,
|
|
341
|
+
BetaBrowserToolset20260801,
|
|
342
|
+
BetaBrowserToolsetConfigs,
|
|
343
|
+
BetaBrowserTripleClickConfig,
|
|
344
|
+
BetaBrowserTypeConfig,
|
|
345
|
+
BetaBrowserWaitConfig,
|
|
346
|
+
BetaBrowserZoomConfig,
|
|
307
347
|
BetaCacheControlEphemeral,
|
|
308
348
|
BetaCacheCreation,
|
|
309
349
|
BetaCacheMissMessagesChanged,
|
|
@@ -349,6 +389,25 @@ import {
|
|
|
349
389
|
BetaCompactionBlockParam,
|
|
350
390
|
BetaCompactionContentBlockDelta,
|
|
351
391
|
BetaCompactionIterationUsage,
|
|
392
|
+
BetaComputerCursorPositionConfig,
|
|
393
|
+
BetaComputerDoubleClickConfig,
|
|
394
|
+
BetaComputerHoldKeyConfig,
|
|
395
|
+
BetaComputerKeyConfig,
|
|
396
|
+
BetaComputerLeftClickConfig,
|
|
397
|
+
BetaComputerLeftClickDragConfig,
|
|
398
|
+
BetaComputerLeftMouseDownConfig,
|
|
399
|
+
BetaComputerLeftMouseUpConfig,
|
|
400
|
+
BetaComputerMiddleClickConfig,
|
|
401
|
+
BetaComputerMouseMoveConfig,
|
|
402
|
+
BetaComputerRightClickConfig,
|
|
403
|
+
BetaComputerScreenshotConfig,
|
|
404
|
+
BetaComputerScrollConfig,
|
|
405
|
+
BetaComputerToolset20260801,
|
|
406
|
+
BetaComputerToolsetConfigs,
|
|
407
|
+
BetaComputerTripleClickConfig,
|
|
408
|
+
BetaComputerTypeConfig,
|
|
409
|
+
BetaComputerWaitConfig,
|
|
410
|
+
BetaComputerZoomConfig,
|
|
352
411
|
BetaContainer,
|
|
353
412
|
BetaContainerParams,
|
|
354
413
|
BetaContainerUploadBlock,
|
|
@@ -381,6 +440,7 @@ import {
|
|
|
381
440
|
BetaFileDocumentSource,
|
|
382
441
|
BetaFileImageSource,
|
|
383
442
|
BetaImageBlockParam,
|
|
443
|
+
BetaImageTransformationsParam,
|
|
384
444
|
BetaInputJSONDelta,
|
|
385
445
|
BetaJSONOutputFormat,
|
|
386
446
|
BetaInputTokensClearAtLeast,
|
|
@@ -823,6 +883,46 @@ export declare namespace Beta {
|
|
|
823
883
|
type BetaBashCodeExecutionToolResultBlockParam as BetaBashCodeExecutionToolResultBlockParam,
|
|
824
884
|
type BetaBashCodeExecutionToolResultError as BetaBashCodeExecutionToolResultError,
|
|
825
885
|
type BetaBashCodeExecutionToolResultErrorParam as BetaBashCodeExecutionToolResultErrorParam,
|
|
886
|
+
type BetaBrowserCloseTabConfig as BetaBrowserCloseTabConfig,
|
|
887
|
+
type BetaBrowserDoubleClickConfig as BetaBrowserDoubleClickConfig,
|
|
888
|
+
type BetaBrowserFileUploadConfig as BetaBrowserFileUploadConfig,
|
|
889
|
+
type BetaBrowserFindConfig as BetaBrowserFindConfig,
|
|
890
|
+
type BetaBrowserFormInputConfig as BetaBrowserFormInputConfig,
|
|
891
|
+
type BetaBrowserGetPageTextConfig as BetaBrowserGetPageTextConfig,
|
|
892
|
+
type BetaBrowserHoldKeyConfig as BetaBrowserHoldKeyConfig,
|
|
893
|
+
type BetaBrowserHoverConfig as BetaBrowserHoverConfig,
|
|
894
|
+
type BetaBrowserJavascriptExecConfig as BetaBrowserJavascriptExecConfig,
|
|
895
|
+
type BetaBrowserKeyConfig as BetaBrowserKeyConfig,
|
|
896
|
+
type BetaBrowserLeftClickConfig as BetaBrowserLeftClickConfig,
|
|
897
|
+
type BetaBrowserLeftClickDragConfig as BetaBrowserLeftClickDragConfig,
|
|
898
|
+
type BetaBrowserLeftMouseDownConfig as BetaBrowserLeftMouseDownConfig,
|
|
899
|
+
type BetaBrowserLeftMouseUpConfig as BetaBrowserLeftMouseUpConfig,
|
|
900
|
+
type BetaBrowserListTabsConfig as BetaBrowserListTabsConfig,
|
|
901
|
+
type BetaBrowserMiddleClickConfig as BetaBrowserMiddleClickConfig,
|
|
902
|
+
type BetaBrowserMouseMoveConfig as BetaBrowserMouseMoveConfig,
|
|
903
|
+
type BetaBrowserNavigateConfig as BetaBrowserNavigateConfig,
|
|
904
|
+
type BetaBrowserNewTabConfig as BetaBrowserNewTabConfig,
|
|
905
|
+
type BetaBrowserReadConsoleConfig as BetaBrowserReadConsoleConfig,
|
|
906
|
+
type BetaBrowserReadNetworkConfig as BetaBrowserReadNetworkConfig,
|
|
907
|
+
type BetaBrowserReadPageConfig as BetaBrowserReadPageConfig,
|
|
908
|
+
type BetaBrowserRightClickConfig as BetaBrowserRightClickConfig,
|
|
909
|
+
type BetaBrowserScreenshotConfig as BetaBrowserScreenshotConfig,
|
|
910
|
+
type BetaBrowserScrollConfig as BetaBrowserScrollConfig,
|
|
911
|
+
type BetaBrowserScrollToConfig as BetaBrowserScrollToConfig,
|
|
912
|
+
type BetaBrowserStateBlockParam as BetaBrowserStateBlockParam,
|
|
913
|
+
type BetaBrowserStateChange as BetaBrowserStateChange,
|
|
914
|
+
type BetaBrowserStateChangeDownloadCompleted as BetaBrowserStateChangeDownloadCompleted,
|
|
915
|
+
type BetaBrowserStateChangeDownloadFailed as BetaBrowserStateChangeDownloadFailed,
|
|
916
|
+
type BetaBrowserStateChangeDownloadStarted as BetaBrowserStateChangeDownloadStarted,
|
|
917
|
+
type BetaBrowserStateChangeTabOpened as BetaBrowserStateChangeTabOpened,
|
|
918
|
+
type BetaBrowserStateTabEntry as BetaBrowserStateTabEntry,
|
|
919
|
+
type BetaBrowserSwitchTabConfig as BetaBrowserSwitchTabConfig,
|
|
920
|
+
type BetaBrowserToolset20260801 as BetaBrowserToolset20260801,
|
|
921
|
+
type BetaBrowserToolsetConfigs as BetaBrowserToolsetConfigs,
|
|
922
|
+
type BetaBrowserTripleClickConfig as BetaBrowserTripleClickConfig,
|
|
923
|
+
type BetaBrowserTypeConfig as BetaBrowserTypeConfig,
|
|
924
|
+
type BetaBrowserWaitConfig as BetaBrowserWaitConfig,
|
|
925
|
+
type BetaBrowserZoomConfig as BetaBrowserZoomConfig,
|
|
826
926
|
type BetaCacheControlEphemeral as BetaCacheControlEphemeral,
|
|
827
927
|
type BetaCacheCreation as BetaCacheCreation,
|
|
828
928
|
type BetaCacheMissMessagesChanged as BetaCacheMissMessagesChanged,
|
|
@@ -868,6 +968,25 @@ export declare namespace Beta {
|
|
|
868
968
|
type BetaCompactionBlockParam as BetaCompactionBlockParam,
|
|
869
969
|
type BetaCompactionContentBlockDelta as BetaCompactionContentBlockDelta,
|
|
870
970
|
type BetaCompactionIterationUsage as BetaCompactionIterationUsage,
|
|
971
|
+
type BetaComputerCursorPositionConfig as BetaComputerCursorPositionConfig,
|
|
972
|
+
type BetaComputerDoubleClickConfig as BetaComputerDoubleClickConfig,
|
|
973
|
+
type BetaComputerHoldKeyConfig as BetaComputerHoldKeyConfig,
|
|
974
|
+
type BetaComputerKeyConfig as BetaComputerKeyConfig,
|
|
975
|
+
type BetaComputerLeftClickConfig as BetaComputerLeftClickConfig,
|
|
976
|
+
type BetaComputerLeftClickDragConfig as BetaComputerLeftClickDragConfig,
|
|
977
|
+
type BetaComputerLeftMouseDownConfig as BetaComputerLeftMouseDownConfig,
|
|
978
|
+
type BetaComputerLeftMouseUpConfig as BetaComputerLeftMouseUpConfig,
|
|
979
|
+
type BetaComputerMiddleClickConfig as BetaComputerMiddleClickConfig,
|
|
980
|
+
type BetaComputerMouseMoveConfig as BetaComputerMouseMoveConfig,
|
|
981
|
+
type BetaComputerRightClickConfig as BetaComputerRightClickConfig,
|
|
982
|
+
type BetaComputerScreenshotConfig as BetaComputerScreenshotConfig,
|
|
983
|
+
type BetaComputerScrollConfig as BetaComputerScrollConfig,
|
|
984
|
+
type BetaComputerToolset20260801 as BetaComputerToolset20260801,
|
|
985
|
+
type BetaComputerToolsetConfigs as BetaComputerToolsetConfigs,
|
|
986
|
+
type BetaComputerTripleClickConfig as BetaComputerTripleClickConfig,
|
|
987
|
+
type BetaComputerTypeConfig as BetaComputerTypeConfig,
|
|
988
|
+
type BetaComputerWaitConfig as BetaComputerWaitConfig,
|
|
989
|
+
type BetaComputerZoomConfig as BetaComputerZoomConfig,
|
|
871
990
|
type BetaContainer as BetaContainer,
|
|
872
991
|
type BetaContainerParams as BetaContainerParams,
|
|
873
992
|
type BetaContainerUploadBlock as BetaContainerUploadBlock,
|
|
@@ -900,6 +1019,7 @@ export declare namespace Beta {
|
|
|
900
1019
|
type BetaFileDocumentSource as BetaFileDocumentSource,
|
|
901
1020
|
type BetaFileImageSource as BetaFileImageSource,
|
|
902
1021
|
type BetaImageBlockParam as BetaImageBlockParam,
|
|
1022
|
+
type BetaImageTransformationsParam as BetaImageTransformationsParam,
|
|
903
1023
|
type BetaInputJSONDelta as BetaInputJSONDelta,
|
|
904
1024
|
type BetaJSONOutputFormat as BetaJSONOutputFormat,
|
|
905
1025
|
type BetaInputTokensClearAtLeast as BetaInputTokensClearAtLeast,
|
|
@@ -1262,10 +1382,10 @@ export declare namespace Beta {
|
|
|
1262
1382
|
|
|
1263
1383
|
export {
|
|
1264
1384
|
Files as Files,
|
|
1385
|
+
type BetaDeletedFile as BetaDeletedFile,
|
|
1386
|
+
type BetaFileMetadata as BetaFileMetadata,
|
|
1265
1387
|
type BetaFileScope as BetaFileScope,
|
|
1266
|
-
type
|
|
1267
|
-
type FileMetadata as FileMetadata,
|
|
1268
|
-
type FileMetadataPage as FileMetadataPage,
|
|
1388
|
+
type BetaFileMetadataPage as BetaFileMetadataPage,
|
|
1269
1389
|
type FileListParams as FileListParams,
|
|
1270
1390
|
type FileDeleteParams as FileDeleteParams,
|
|
1271
1391
|
type FileDownloadParams as FileDownloadParams,
|
|
@@ -18,7 +18,7 @@ export class Files extends APIResource {
|
|
|
18
18
|
* @example
|
|
19
19
|
* ```ts
|
|
20
20
|
* // Automatically fetches more pages as needed.
|
|
21
|
-
* for await (const
|
|
21
|
+
* for await (const betaFileMetadata of client.beta.files.list()) {
|
|
22
22
|
* // ...
|
|
23
23
|
* }
|
|
24
24
|
* ```
|
|
@@ -26,9 +26,9 @@ export class Files extends APIResource {
|
|
|
26
26
|
list(
|
|
27
27
|
params: FileListParams | null | undefined = {},
|
|
28
28
|
options?: RequestOptions,
|
|
29
|
-
): PagePromise<
|
|
29
|
+
): PagePromise<BetaFileMetadataPage, BetaFileMetadata> {
|
|
30
30
|
const { betas, ...query } = params ?? {};
|
|
31
|
-
return this._client.getAPIList('/v1/files?beta=true', Page<
|
|
31
|
+
return this._client.getAPIList('/v1/files?beta=true', Page<BetaFileMetadata>, {
|
|
32
32
|
query,
|
|
33
33
|
...options,
|
|
34
34
|
headers: buildHeaders([
|
|
@@ -43,7 +43,7 @@ export class Files extends APIResource {
|
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* ```ts
|
|
46
|
-
* const
|
|
46
|
+
* const betaDeletedFile = await client.beta.files.delete(
|
|
47
47
|
* 'file_id',
|
|
48
48
|
* );
|
|
49
49
|
* ```
|
|
@@ -52,7 +52,7 @@ export class Files extends APIResource {
|
|
|
52
52
|
fileID: string,
|
|
53
53
|
params: FileDeleteParams | null | undefined = {},
|
|
54
54
|
options?: RequestOptions,
|
|
55
|
-
): APIPromise<
|
|
55
|
+
): APIPromise<BetaDeletedFile> {
|
|
56
56
|
const { betas } = params ?? {};
|
|
57
57
|
return this._client.delete(path`/v1/files/${fileID}?beta=true`, {
|
|
58
58
|
...options,
|
|
@@ -100,7 +100,7 @@ export class Files extends APIResource {
|
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
103
|
-
* const
|
|
103
|
+
* const betaFileMetadata =
|
|
104
104
|
* await client.beta.files.retrieveMetadata('file_id');
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
@@ -108,7 +108,7 @@ export class Files extends APIResource {
|
|
|
108
108
|
fileID: string,
|
|
109
109
|
params: FileRetrieveMetadataParams | null | undefined = {},
|
|
110
110
|
options?: RequestOptions,
|
|
111
|
-
): APIPromise<
|
|
111
|
+
): APIPromise<BetaFileMetadata> {
|
|
112
112
|
const { betas } = params ?? {};
|
|
113
113
|
return this._client.get(path`/v1/files/${fileID}?beta=true`, {
|
|
114
114
|
...options,
|
|
@@ -124,12 +124,12 @@ export class Files extends APIResource {
|
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
* ```ts
|
|
127
|
-
* const
|
|
127
|
+
* const betaFileMetadata = await client.beta.files.upload({
|
|
128
128
|
* file: fs.createReadStream('path/to/file'),
|
|
129
129
|
* });
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
|
-
upload(params: FileUploadParams, options?: RequestOptions): APIPromise<
|
|
132
|
+
upload(params: FileUploadParams, options?: RequestOptions): APIPromise<BetaFileMetadata> {
|
|
133
133
|
const { betas, ...body } = params;
|
|
134
134
|
|
|
135
135
|
return this._client.post(
|
|
@@ -150,21 +150,9 @@ export class Files extends APIResource {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
export type
|
|
153
|
+
export type BetaFileMetadataPage = Page<BetaFileMetadata>;
|
|
154
154
|
|
|
155
|
-
export interface
|
|
156
|
-
/**
|
|
157
|
-
* The ID of the scoping resource (e.g., the session ID).
|
|
158
|
-
*/
|
|
159
|
-
id: string;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* The type of scope (e.g., `"session"`).
|
|
163
|
-
*/
|
|
164
|
-
type: 'session';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface DeletedFile {
|
|
155
|
+
export interface BetaDeletedFile {
|
|
168
156
|
/**
|
|
169
157
|
* ID of the deleted file.
|
|
170
158
|
*/
|
|
@@ -178,7 +166,7 @@ export interface DeletedFile {
|
|
|
178
166
|
type?: 'file_deleted';
|
|
179
167
|
}
|
|
180
168
|
|
|
181
|
-
export interface
|
|
169
|
+
export interface BetaFileMetadata {
|
|
182
170
|
/**
|
|
183
171
|
* Unique object identifier.
|
|
184
172
|
*
|
|
@@ -225,6 +213,18 @@ export interface FileMetadata {
|
|
|
225
213
|
scope?: BetaFileScope | null;
|
|
226
214
|
}
|
|
227
215
|
|
|
216
|
+
export interface BetaFileScope {
|
|
217
|
+
/**
|
|
218
|
+
* The ID of the scoping resource (e.g., the session ID).
|
|
219
|
+
*/
|
|
220
|
+
id: string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The type of scope (e.g., `"session"`).
|
|
224
|
+
*/
|
|
225
|
+
type: 'session';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
228
|
export interface FileListParams extends PageParams {
|
|
229
229
|
/**
|
|
230
230
|
* Query param: Filter by scope ID. Only returns files associated with the
|
|
@@ -273,10 +273,10 @@ export interface FileUploadParams {
|
|
|
273
273
|
|
|
274
274
|
export declare namespace Files {
|
|
275
275
|
export {
|
|
276
|
+
type BetaDeletedFile as BetaDeletedFile,
|
|
277
|
+
type BetaFileMetadata as BetaFileMetadata,
|
|
276
278
|
type BetaFileScope as BetaFileScope,
|
|
277
|
-
type
|
|
278
|
-
type FileMetadata as FileMetadata,
|
|
279
|
-
type FileMetadataPage as FileMetadataPage,
|
|
279
|
+
type BetaFileMetadataPage as BetaFileMetadataPage,
|
|
280
280
|
type FileListParams as FileListParams,
|
|
281
281
|
type FileDeleteParams as FileDeleteParams,
|
|
282
282
|
type FileDownloadParams as FileDownloadParams,
|
|
@@ -189,15 +189,15 @@ export {
|
|
|
189
189
|
} from './environments/index';
|
|
190
190
|
export {
|
|
191
191
|
Files,
|
|
192
|
+
type BetaDeletedFile,
|
|
193
|
+
type BetaFileMetadata,
|
|
192
194
|
type BetaFileScope,
|
|
193
|
-
type DeletedFile,
|
|
194
|
-
type FileMetadata,
|
|
195
195
|
type FileListParams,
|
|
196
196
|
type FileDeleteParams,
|
|
197
197
|
type FileDownloadParams,
|
|
198
198
|
type FileRetrieveMetadataParams,
|
|
199
199
|
type FileUploadParams,
|
|
200
|
-
type
|
|
200
|
+
type BetaFileMetadataPage,
|
|
201
201
|
} from './files';
|
|
202
202
|
export {
|
|
203
203
|
MemoryStores,
|
|
@@ -234,6 +234,46 @@ export {
|
|
|
234
234
|
type BetaBashCodeExecutionToolResultBlockParam,
|
|
235
235
|
type BetaBashCodeExecutionToolResultError,
|
|
236
236
|
type BetaBashCodeExecutionToolResultErrorParam,
|
|
237
|
+
type BetaBrowserCloseTabConfig,
|
|
238
|
+
type BetaBrowserDoubleClickConfig,
|
|
239
|
+
type BetaBrowserFileUploadConfig,
|
|
240
|
+
type BetaBrowserFindConfig,
|
|
241
|
+
type BetaBrowserFormInputConfig,
|
|
242
|
+
type BetaBrowserGetPageTextConfig,
|
|
243
|
+
type BetaBrowserHoldKeyConfig,
|
|
244
|
+
type BetaBrowserHoverConfig,
|
|
245
|
+
type BetaBrowserJavascriptExecConfig,
|
|
246
|
+
type BetaBrowserKeyConfig,
|
|
247
|
+
type BetaBrowserLeftClickConfig,
|
|
248
|
+
type BetaBrowserLeftClickDragConfig,
|
|
249
|
+
type BetaBrowserLeftMouseDownConfig,
|
|
250
|
+
type BetaBrowserLeftMouseUpConfig,
|
|
251
|
+
type BetaBrowserListTabsConfig,
|
|
252
|
+
type BetaBrowserMiddleClickConfig,
|
|
253
|
+
type BetaBrowserMouseMoveConfig,
|
|
254
|
+
type BetaBrowserNavigateConfig,
|
|
255
|
+
type BetaBrowserNewTabConfig,
|
|
256
|
+
type BetaBrowserReadConsoleConfig,
|
|
257
|
+
type BetaBrowserReadNetworkConfig,
|
|
258
|
+
type BetaBrowserReadPageConfig,
|
|
259
|
+
type BetaBrowserRightClickConfig,
|
|
260
|
+
type BetaBrowserScreenshotConfig,
|
|
261
|
+
type BetaBrowserScrollConfig,
|
|
262
|
+
type BetaBrowserScrollToConfig,
|
|
263
|
+
type BetaBrowserStateBlockParam,
|
|
264
|
+
type BetaBrowserStateChange,
|
|
265
|
+
type BetaBrowserStateChangeDownloadCompleted,
|
|
266
|
+
type BetaBrowserStateChangeDownloadFailed,
|
|
267
|
+
type BetaBrowserStateChangeDownloadStarted,
|
|
268
|
+
type BetaBrowserStateChangeTabOpened,
|
|
269
|
+
type BetaBrowserStateTabEntry,
|
|
270
|
+
type BetaBrowserSwitchTabConfig,
|
|
271
|
+
type BetaBrowserToolset20260801,
|
|
272
|
+
type BetaBrowserToolsetConfigs,
|
|
273
|
+
type BetaBrowserTripleClickConfig,
|
|
274
|
+
type BetaBrowserTypeConfig,
|
|
275
|
+
type BetaBrowserWaitConfig,
|
|
276
|
+
type BetaBrowserZoomConfig,
|
|
237
277
|
type BetaCacheControlEphemeral,
|
|
238
278
|
type BetaCacheCreation,
|
|
239
279
|
type BetaCacheMissMessagesChanged,
|
|
@@ -279,6 +319,25 @@ export {
|
|
|
279
319
|
type BetaCompactionBlockParam,
|
|
280
320
|
type BetaCompactionContentBlockDelta,
|
|
281
321
|
type BetaCompactionIterationUsage,
|
|
322
|
+
type BetaComputerCursorPositionConfig,
|
|
323
|
+
type BetaComputerDoubleClickConfig,
|
|
324
|
+
type BetaComputerHoldKeyConfig,
|
|
325
|
+
type BetaComputerKeyConfig,
|
|
326
|
+
type BetaComputerLeftClickConfig,
|
|
327
|
+
type BetaComputerLeftClickDragConfig,
|
|
328
|
+
type BetaComputerLeftMouseDownConfig,
|
|
329
|
+
type BetaComputerLeftMouseUpConfig,
|
|
330
|
+
type BetaComputerMiddleClickConfig,
|
|
331
|
+
type BetaComputerMouseMoveConfig,
|
|
332
|
+
type BetaComputerRightClickConfig,
|
|
333
|
+
type BetaComputerScreenshotConfig,
|
|
334
|
+
type BetaComputerScrollConfig,
|
|
335
|
+
type BetaComputerToolset20260801,
|
|
336
|
+
type BetaComputerToolsetConfigs,
|
|
337
|
+
type BetaComputerTripleClickConfig,
|
|
338
|
+
type BetaComputerTypeConfig,
|
|
339
|
+
type BetaComputerWaitConfig,
|
|
340
|
+
type BetaComputerZoomConfig,
|
|
282
341
|
type BetaContainer,
|
|
283
342
|
type BetaContainerParams,
|
|
284
343
|
type BetaContainerUploadBlock,
|
|
@@ -311,6 +370,7 @@ export {
|
|
|
311
370
|
type BetaFileDocumentSource,
|
|
312
371
|
type BetaFileImageSource,
|
|
313
372
|
type BetaImageBlockParam,
|
|
373
|
+
type BetaImageTransformationsParam,
|
|
314
374
|
type BetaInputJSONDelta,
|
|
315
375
|
type BetaInputTokensClearAtLeast,
|
|
316
376
|
type BetaInputTokensTrigger,
|
|
@@ -42,6 +42,46 @@ export {
|
|
|
42
42
|
type BetaBashCodeExecutionToolResultBlockParam,
|
|
43
43
|
type BetaBashCodeExecutionToolResultError,
|
|
44
44
|
type BetaBashCodeExecutionToolResultErrorParam,
|
|
45
|
+
type BetaBrowserCloseTabConfig,
|
|
46
|
+
type BetaBrowserDoubleClickConfig,
|
|
47
|
+
type BetaBrowserFileUploadConfig,
|
|
48
|
+
type BetaBrowserFindConfig,
|
|
49
|
+
type BetaBrowserFormInputConfig,
|
|
50
|
+
type BetaBrowserGetPageTextConfig,
|
|
51
|
+
type BetaBrowserHoldKeyConfig,
|
|
52
|
+
type BetaBrowserHoverConfig,
|
|
53
|
+
type BetaBrowserJavascriptExecConfig,
|
|
54
|
+
type BetaBrowserKeyConfig,
|
|
55
|
+
type BetaBrowserLeftClickConfig,
|
|
56
|
+
type BetaBrowserLeftClickDragConfig,
|
|
57
|
+
type BetaBrowserLeftMouseDownConfig,
|
|
58
|
+
type BetaBrowserLeftMouseUpConfig,
|
|
59
|
+
type BetaBrowserListTabsConfig,
|
|
60
|
+
type BetaBrowserMiddleClickConfig,
|
|
61
|
+
type BetaBrowserMouseMoveConfig,
|
|
62
|
+
type BetaBrowserNavigateConfig,
|
|
63
|
+
type BetaBrowserNewTabConfig,
|
|
64
|
+
type BetaBrowserReadConsoleConfig,
|
|
65
|
+
type BetaBrowserReadNetworkConfig,
|
|
66
|
+
type BetaBrowserReadPageConfig,
|
|
67
|
+
type BetaBrowserRightClickConfig,
|
|
68
|
+
type BetaBrowserScreenshotConfig,
|
|
69
|
+
type BetaBrowserScrollConfig,
|
|
70
|
+
type BetaBrowserScrollToConfig,
|
|
71
|
+
type BetaBrowserStateBlockParam,
|
|
72
|
+
type BetaBrowserStateChange,
|
|
73
|
+
type BetaBrowserStateChangeDownloadCompleted,
|
|
74
|
+
type BetaBrowserStateChangeDownloadFailed,
|
|
75
|
+
type BetaBrowserStateChangeDownloadStarted,
|
|
76
|
+
type BetaBrowserStateChangeTabOpened,
|
|
77
|
+
type BetaBrowserStateTabEntry,
|
|
78
|
+
type BetaBrowserSwitchTabConfig,
|
|
79
|
+
type BetaBrowserToolset20260801,
|
|
80
|
+
type BetaBrowserToolsetConfigs,
|
|
81
|
+
type BetaBrowserTripleClickConfig,
|
|
82
|
+
type BetaBrowserTypeConfig,
|
|
83
|
+
type BetaBrowserWaitConfig,
|
|
84
|
+
type BetaBrowserZoomConfig,
|
|
45
85
|
type BetaCacheControlEphemeral,
|
|
46
86
|
type BetaCacheCreation,
|
|
47
87
|
type BetaCacheMissMessagesChanged,
|
|
@@ -87,6 +127,25 @@ export {
|
|
|
87
127
|
type BetaCompactionBlockParam,
|
|
88
128
|
type BetaCompactionContentBlockDelta,
|
|
89
129
|
type BetaCompactionIterationUsage,
|
|
130
|
+
type BetaComputerCursorPositionConfig,
|
|
131
|
+
type BetaComputerDoubleClickConfig,
|
|
132
|
+
type BetaComputerHoldKeyConfig,
|
|
133
|
+
type BetaComputerKeyConfig,
|
|
134
|
+
type BetaComputerLeftClickConfig,
|
|
135
|
+
type BetaComputerLeftClickDragConfig,
|
|
136
|
+
type BetaComputerLeftMouseDownConfig,
|
|
137
|
+
type BetaComputerLeftMouseUpConfig,
|
|
138
|
+
type BetaComputerMiddleClickConfig,
|
|
139
|
+
type BetaComputerMouseMoveConfig,
|
|
140
|
+
type BetaComputerRightClickConfig,
|
|
141
|
+
type BetaComputerScreenshotConfig,
|
|
142
|
+
type BetaComputerScrollConfig,
|
|
143
|
+
type BetaComputerToolset20260801,
|
|
144
|
+
type BetaComputerToolsetConfigs,
|
|
145
|
+
type BetaComputerTripleClickConfig,
|
|
146
|
+
type BetaComputerTypeConfig,
|
|
147
|
+
type BetaComputerWaitConfig,
|
|
148
|
+
type BetaComputerZoomConfig,
|
|
90
149
|
type BetaContainer,
|
|
91
150
|
type BetaContainerParams,
|
|
92
151
|
type BetaContainerUploadBlock,
|
|
@@ -119,6 +178,7 @@ export {
|
|
|
119
178
|
type BetaFileDocumentSource,
|
|
120
179
|
type BetaFileImageSource,
|
|
121
180
|
type BetaImageBlockParam,
|
|
181
|
+
type BetaImageTransformationsParam,
|
|
122
182
|
type BetaInputJSONDelta,
|
|
123
183
|
type BetaInputTokensClearAtLeast,
|
|
124
184
|
type BetaInputTokensTrigger,
|