@fairyhunter13/ai-anthropic 3.0.75-fork.4 → 3.0.75-fork.6

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.
@@ -1,6 +1,6 @@
1
1
  import { LanguageModelV4, JSONObject, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, JSONSchema7, SharedV4ProviderMetadata, SharedV4Warning } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable, FetchFunction, ToolExecuteFunction, Tool, Sandbox, ProviderDefinedTool } from '@ai-sdk/provider-utils';
4
4
 
5
5
  type AnthropicModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | (string & {});
6
6
 
@@ -69,6 +69,64 @@ declare function getModelCapabilities(modelId: string): {
69
69
  isKnownModel: boolean;
70
70
  };
71
71
 
72
+ type Bash20241022Input = {
73
+ /**
74
+ * The bash command to run. Required unless the tool is being restarted.
75
+ */
76
+ command: string;
77
+ /**
78
+ * Specifying true will restart this tool. Otherwise, leave this unspecified.
79
+ */
80
+ restart?: boolean;
81
+ };
82
+ type Bash20241022Options<OUTPUT> = {
83
+ execute?: ToolExecuteFunction<Bash20241022Input, OUTPUT, {}>;
84
+ needsApproval?: Tool<Bash20241022Input, OUTPUT, {}>['needsApproval'];
85
+ toModelOutput?: Tool<Bash20241022Input, OUTPUT, {}>['toModelOutput'];
86
+ onInputStart?: Tool<Bash20241022Input, OUTPUT, {}>['onInputStart'];
87
+ onInputDelta?: Tool<Bash20241022Input, OUTPUT, {}>['onInputDelta'];
88
+ onInputAvailable?: Tool<Bash20241022Input, OUTPUT, {}>['onInputAvailable'];
89
+ };
90
+ type Bash20241022DefaultOutput = Awaited<ReturnType<Sandbox['executeCommand']>>;
91
+ declare function bash_20241022(options?: Omit<Bash20241022Options<Bash20241022DefaultOutput>, 'execute'> & {
92
+ execute?: undefined;
93
+ }): ProviderDefinedTool<Bash20241022Input, Bash20241022DefaultOutput, {}>;
94
+ declare function bash_20241022<OUTPUT = never>(options: Omit<Bash20241022Options<OUTPUT>, 'execute'> & {
95
+ execute: null;
96
+ }): ProviderDefinedTool<Bash20241022Input, OUTPUT, {}>;
97
+ declare function bash_20241022<OUTPUT>(options: Omit<Bash20241022Options<OUTPUT>, 'execute'> & {
98
+ execute: Bash20241022Options<OUTPUT>['execute'];
99
+ }): ProviderDefinedTool<Bash20241022Input, OUTPUT, {}>;
100
+
101
+ type Bash20250124Input = {
102
+ /**
103
+ * The bash command to run. Required unless the tool is being restarted.
104
+ */
105
+ command: string;
106
+ /**
107
+ * Specifying true will restart this tool. Otherwise, leave this unspecified.
108
+ */
109
+ restart?: boolean;
110
+ };
111
+ type Bash20250124Options<OUTPUT> = {
112
+ execute?: ToolExecuteFunction<Bash20250124Input, OUTPUT, {}>;
113
+ needsApproval?: Tool<Bash20250124Input, OUTPUT, {}>['needsApproval'];
114
+ toModelOutput?: Tool<Bash20250124Input, OUTPUT, {}>['toModelOutput'];
115
+ onInputStart?: Tool<Bash20250124Input, OUTPUT, {}>['onInputStart'];
116
+ onInputDelta?: Tool<Bash20250124Input, OUTPUT, {}>['onInputDelta'];
117
+ onInputAvailable?: Tool<Bash20250124Input, OUTPUT, {}>['onInputAvailable'];
118
+ };
119
+ type Bash20250124DefaultOutput = Awaited<ReturnType<Sandbox['executeCommand']>>;
120
+ declare function bash_20250124(options?: Omit<Bash20250124Options<Bash20250124DefaultOutput>, 'execute'> & {
121
+ execute?: undefined;
122
+ }): ProviderDefinedTool<Bash20250124Input, Bash20250124DefaultOutput, {}>;
123
+ declare function bash_20250124<OUTPUT = never>(options: Omit<Bash20250124Options<OUTPUT>, 'execute'> & {
124
+ execute: null;
125
+ }): ProviderDefinedTool<Bash20250124Input, OUTPUT, {}>;
126
+ declare function bash_20250124<OUTPUT>(options: Omit<Bash20250124Options<OUTPUT>, 'execute'> & {
127
+ execute: Bash20250124Options<OUTPUT>['execute'];
128
+ }): ProviderDefinedTool<Bash20250124Input, OUTPUT, {}>;
129
+
72
130
  declare const anthropicTools: {
73
131
  /**
74
132
  * The bash tool enables Claude to execute shell commands in a persistent bash session,
@@ -76,20 +134,14 @@ declare const anthropicTools: {
76
134
  *
77
135
  * Image results are supported.
78
136
  */
79
- bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
80
- command: string;
81
- restart?: boolean;
82
- }, {}, {}>;
137
+ bash_20241022: typeof bash_20241022;
83
138
  /**
84
139
  * The bash tool enables Claude to execute shell commands in a persistent bash session,
85
140
  * allowing system operations, script execution, and command-line automation.
86
141
  *
87
142
  * Image results are supported.
88
143
  */
89
- bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
90
- command: string;
91
- restart?: boolean;
92
- }, {}, {}>;
144
+ bash_20250124: typeof bash_20250124;
93
145
  /**
94
146
  * Claude can analyze data, create visualizations, perform complex calculations,
95
147
  * run system commands, create and edit files, and process uploaded files directly within
@@ -5186,10 +5186,28 @@ var bash_20241022InputSchema = lazySchema13(
5186
5186
  })
5187
5187
  )
5188
5188
  );
5189
- var bash_20241022 = createProviderDefinedToolFactory2({
5189
+ var bash_20241022_internal = createProviderDefinedToolFactory2({
5190
5190
  id: "anthropic.bash_20241022",
5191
5191
  inputSchema: bash_20241022InputSchema
5192
5192
  });
5193
+ function bash_20241022(options = {}) {
5194
+ const { execute, ...rest } = options;
5195
+ if (execute === void 0) {
5196
+ return bash_20241022_internal({
5197
+ ...rest,
5198
+ execute: async ({ command }, { sandbox }) => {
5199
+ if (!sandbox) {
5200
+ throw new Error("Sandbox is not available");
5201
+ }
5202
+ return await sandbox.executeCommand({ command });
5203
+ }
5204
+ });
5205
+ }
5206
+ return bash_20241022_internal({
5207
+ ...rest,
5208
+ ...execute === null ? {} : { execute }
5209
+ });
5210
+ }
5193
5211
 
5194
5212
  // src/tool/bash_20250124.ts
5195
5213
  import {
@@ -5206,10 +5224,28 @@ var bash_20250124InputSchema = lazySchema14(
5206
5224
  })
5207
5225
  )
5208
5226
  );
5209
- var bash_20250124 = createProviderDefinedToolFactory3({
5227
+ var bash_20250124_internal = createProviderDefinedToolFactory3({
5210
5228
  id: "anthropic.bash_20250124",
5211
5229
  inputSchema: bash_20250124InputSchema
5212
5230
  });
5231
+ function bash_20250124(options = {}) {
5232
+ const { execute, ...rest } = options;
5233
+ if (execute === void 0) {
5234
+ return bash_20250124_internal({
5235
+ ...rest,
5236
+ execute: async ({ command }, { sandbox }) => {
5237
+ if (!sandbox) {
5238
+ throw new Error("Sandbox is not available");
5239
+ }
5240
+ return await sandbox.executeCommand({ command });
5241
+ }
5242
+ });
5243
+ }
5244
+ return bash_20250124_internal({
5245
+ ...rest,
5246
+ ...execute === null ? {} : { execute }
5247
+ });
5248
+ }
5213
5249
 
5214
5250
  // src/tool/computer_20241022.ts
5215
5251
  import {