@anthropic-ai/sdk 0.56.0 → 0.58.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/client.d.mts +7 -7
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -7
  5. package/client.d.ts.map +1 -1
  6. package/client.js +17 -14
  7. package/client.js.map +1 -1
  8. package/client.mjs +17 -14
  9. package/client.mjs.map +1 -1
  10. package/internal/constants.d.mts.map +1 -1
  11. package/internal/constants.d.ts.map +1 -1
  12. package/internal/constants.js +3 -0
  13. package/internal/constants.js.map +1 -1
  14. package/internal/constants.mjs +3 -0
  15. package/internal/constants.mjs.map +1 -1
  16. package/internal/parse.js +2 -2
  17. package/internal/parse.js.map +1 -1
  18. package/internal/parse.mjs +2 -2
  19. package/internal/parse.mjs.map +1 -1
  20. package/package.json +1 -5
  21. package/resources/beta/beta.d.mts +2 -2
  22. package/resources/beta/beta.d.mts.map +1 -1
  23. package/resources/beta/beta.d.ts +2 -2
  24. package/resources/beta/beta.d.ts.map +1 -1
  25. package/resources/beta/beta.js.map +1 -1
  26. package/resources/beta/beta.mjs.map +1 -1
  27. package/resources/beta/index.d.mts +1 -1
  28. package/resources/beta/index.d.mts.map +1 -1
  29. package/resources/beta/index.d.ts +1 -1
  30. package/resources/beta/index.d.ts.map +1 -1
  31. package/resources/beta/index.js.map +1 -1
  32. package/resources/beta/index.mjs.map +1 -1
  33. package/resources/beta/messages/index.d.mts +1 -1
  34. package/resources/beta/messages/index.d.mts.map +1 -1
  35. package/resources/beta/messages/index.d.ts +1 -1
  36. package/resources/beta/messages/index.d.ts.map +1 -1
  37. package/resources/beta/messages/index.js.map +1 -1
  38. package/resources/beta/messages/index.mjs.map +1 -1
  39. package/resources/beta/messages/messages.d.mts +24 -3
  40. package/resources/beta/messages/messages.d.mts.map +1 -1
  41. package/resources/beta/messages/messages.d.ts +24 -3
  42. package/resources/beta/messages/messages.d.ts.map +1 -1
  43. package/resources/beta/messages/messages.js.map +1 -1
  44. package/resources/beta/messages/messages.mjs.map +1 -1
  45. package/resources/index.d.mts +1 -1
  46. package/resources/index.d.mts.map +1 -1
  47. package/resources/index.d.ts +1 -1
  48. package/resources/index.d.ts.map +1 -1
  49. package/resources/index.js.map +1 -1
  50. package/resources/index.mjs.map +1 -1
  51. package/resources/messages/index.d.mts +1 -1
  52. package/resources/messages/index.d.mts.map +1 -1
  53. package/resources/messages/index.d.ts +1 -1
  54. package/resources/messages/index.d.ts.map +1 -1
  55. package/resources/messages/index.js.map +1 -1
  56. package/resources/messages/index.mjs.map +1 -1
  57. package/resources/messages/messages.d.mts +37 -33
  58. package/resources/messages/messages.d.mts.map +1 -1
  59. package/resources/messages/messages.d.ts +37 -33
  60. package/resources/messages/messages.d.ts.map +1 -1
  61. package/resources/messages/messages.js.map +1 -1
  62. package/resources/messages/messages.mjs.map +1 -1
  63. package/src/client.ts +23 -16
  64. package/src/internal/constants.ts +3 -0
  65. package/src/internal/parse.ts +2 -2
  66. package/src/resources/beta/beta.ts +2 -0
  67. package/src/resources/beta/index.ts +1 -0
  68. package/src/resources/beta/messages/index.ts +1 -0
  69. package/src/resources/beta/messages/messages.ts +31 -0
  70. package/src/resources/index.ts +2 -0
  71. package/src/resources/messages/index.ts +2 -0
  72. package/src/resources/messages/messages.ts +51 -41
  73. package/src/version.ts +1 -1
  74. package/version.d.mts +1 -1
  75. package/version.d.ts +1 -1
  76. package/version.js +1 -1
  77. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../src/resources/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE;OAGf,EAAE,aAAa,EAAE;OACjB,KAAK,UAAU;OACf,EAGL,OAAO,GAWR;OAGM,EAAE,yBAAyB,EAAE;AAEpC,MAAM,OAAO,QAAS,SAAQ,WAAW;IAAzC;;QACE,YAA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D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,OAAO,EAAE,OAAO,IAAI,MAAM;YAC1B,GAAG,OAAO;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;SAC7B,CAAoE,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,IAA8B,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AA2ZD,MAAM,iBAAiB,GAEnB;IACF,YAAY,EAAE,oBAAoB;IAClC,iBAAiB,EAAE,oBAAoB;IACvC,oBAAoB,EAAE,oBAAoB;IAC1C,yBAAyB,EAAE,oBAAoB;IAC/C,oBAAoB,EAAE,oBAAoB;IAC1C,0BAA0B,EAAE,iBAAiB;IAC7C,wBAAwB,EAAE,mBAAmB;IAC7C,YAAY,EAAE,iBAAiB;IAC/B,YAAY,EAAE,iBAAiB;CAChC,CAAC;AA4rCF,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC"}
package/src/client.ts CHANGED
@@ -118,6 +118,8 @@ import {
118
118
  ToolChoiceTool,
119
119
  ToolResultBlockParam,
120
120
  ToolTextEditor20250124,
121
+ ToolTextEditor20250429,
122
+ ToolTextEditor20250728,
121
123
  ToolUnion,
122
124
  ToolUseBlock,
123
125
  ToolUseBlockParam,
@@ -311,7 +313,7 @@ export class BaseAnthropic {
311
313
  * Create a new client instance re-using the same options given to the current client with optional overriding.
312
314
  */
313
315
  withOptions(options: Partial<ClientOptions>): this {
314
- return new (this.constructor as any as new (props: ClientOptions) => typeof this)({
316
+ const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
315
317
  ...this._options,
316
318
  baseURL: this.baseURL,
317
319
  maxRetries: this.maxRetries,
@@ -324,6 +326,7 @@ export class BaseAnthropic {
324
326
  authToken: this.authToken,
325
327
  ...options,
326
328
  });
329
+ return client;
327
330
  }
328
331
 
329
332
  /**
@@ -357,18 +360,18 @@ export class BaseAnthropic {
357
360
  );
358
361
  }
359
362
 
360
- protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined {
361
- return buildHeaders([this.apiKeyAuth(opts), this.bearerAuth(opts)]);
363
+ protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
364
+ return buildHeaders([await this.apiKeyAuth(opts), await this.bearerAuth(opts)]);
362
365
  }
363
366
 
364
- protected apiKeyAuth(opts: FinalRequestOptions): NullableHeaders | undefined {
367
+ protected async apiKeyAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
365
368
  if (this.apiKey == null) {
366
369
  return undefined;
367
370
  }
368
371
  return buildHeaders([{ 'X-Api-Key': this.apiKey }]);
369
372
  }
370
373
 
371
- protected bearerAuth(opts: FinalRequestOptions): NullableHeaders | undefined {
374
+ protected async bearerAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
372
375
  if (this.authToken == null) {
373
376
  return undefined;
374
377
  }
@@ -440,7 +443,7 @@ export class BaseAnthropic {
440
443
  const expectedTimeout = (60 * 60 * maxTokens) / 128_000;
441
444
  if (expectedTimeout > defaultTimeout) {
442
445
  throw new Errors.AnthropicError(
443
- 'Streaming is strongly recommended for operations that may take longer than 10 minutes. ' +
446
+ 'Streaming is required for operations that may take longer than 10 minutes. ' +
444
447
  'See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details',
445
448
  );
446
449
  }
@@ -515,7 +518,9 @@ export class BaseAnthropic {
515
518
 
516
519
  await this.prepareOptions(options);
517
520
 
518
- const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
521
+ const { req, url, timeout } = await this.buildRequest(options, {
522
+ retryCount: maxRetries - retriesRemaining,
523
+ });
519
524
 
520
525
  await this.prepareRequest(req, { url, options });
521
526
 
@@ -597,7 +602,7 @@ export class BaseAnthropic {
597
602
  } with status ${response.status} in ${headersTime - startTime}ms`;
598
603
 
599
604
  if (!response.ok) {
600
- const shouldRetry = this.shouldRetry(response);
605
+ const shouldRetry = await this.shouldRetry(response);
601
606
  if (retriesRemaining && shouldRetry) {
602
607
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
603
608
 
@@ -715,7 +720,7 @@ export class BaseAnthropic {
715
720
  }
716
721
  }
717
722
 
718
- private shouldRetry(response: Response): boolean {
723
+ private async shouldRetry(response: Response): Promise<boolean> {
719
724
  // Note this is not a standard header.
720
725
  const shouldRetryHeader = response.headers.get('x-should-retry');
721
726
 
@@ -799,17 +804,17 @@ export class BaseAnthropic {
799
804
  const expectedTime = (maxTime * maxTokens) / 128000;
800
805
  if (expectedTime > defaultTime || (maxNonstreamingTokens != null && maxTokens > maxNonstreamingTokens)) {
801
806
  throw new Errors.AnthropicError(
802
- 'Streaming is strongly recommended for operations that may token longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details',
807
+ 'Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details',
803
808
  );
804
809
  }
805
810
 
806
811
  return defaultTime;
807
812
  }
808
813
 
809
- buildRequest(
814
+ async buildRequest(
810
815
  inputOptions: FinalRequestOptions,
811
816
  { retryCount = 0 }: { retryCount?: number } = {},
812
- ): { req: FinalizedRequestInit; url: string; timeout: number } {
817
+ ): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> {
813
818
  const options = { ...inputOptions };
814
819
  const { method, path, query, defaultBaseURL } = options;
815
820
 
@@ -817,7 +822,7 @@ export class BaseAnthropic {
817
822
  if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
818
823
  options.timeout = options.timeout ?? this.timeout;
819
824
  const { bodyHeaders, body } = this.buildBody({ options });
820
- const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
825
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
821
826
 
822
827
  const req: FinalizedRequestInit = {
823
828
  method,
@@ -833,7 +838,7 @@ export class BaseAnthropic {
833
838
  return { req, url, timeout: options.timeout };
834
839
  }
835
840
 
836
- private buildHeaders({
841
+ private async buildHeaders({
837
842
  options,
838
843
  method,
839
844
  bodyHeaders,
@@ -843,7 +848,7 @@ export class BaseAnthropic {
843
848
  method: HTTPMethod;
844
849
  bodyHeaders: HeadersLike;
845
850
  retryCount: number;
846
- }): Headers {
851
+ }): Promise<Headers> {
847
852
  let idempotencyHeaders: HeadersLike = {};
848
853
  if (this.idempotencyHeader && method !== 'get') {
849
854
  if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
@@ -863,7 +868,7 @@ export class BaseAnthropic {
863
868
  : undefined),
864
869
  'anthropic-version': '2023-06-01',
865
870
  },
866
- this.authHeaders(options),
871
+ await this.authHeaders(options),
867
872
  this._options.defaultHeaders,
868
873
  bodyHeaders,
869
874
  options.headers,
@@ -1032,6 +1037,8 @@ export declare namespace Anthropic {
1032
1037
  type ToolChoiceTool as ToolChoiceTool,
1033
1038
  type ToolResultBlockParam as ToolResultBlockParam,
1034
1039
  type ToolTextEditor20250124 as ToolTextEditor20250124,
1040
+ type ToolTextEditor20250429 as ToolTextEditor20250429,
1041
+ type ToolTextEditor20250728 as ToolTextEditor20250728,
1035
1042
  type ToolUnion as ToolUnion,
1036
1043
  type ToolUseBlock as ToolUseBlock,
1037
1044
  type ToolUseBlockParam as ToolUseBlockParam,
@@ -9,4 +9,7 @@ export const MODEL_NONSTREAMING_TOKENS: Record<string, number> = {
9
9
  'claude-4-opus-20250514': 8192,
10
10
  'anthropic.claude-opus-4-20250514-v1:0': 8192,
11
11
  'claude-opus-4@20250514': 8192,
12
+ 'claude-opus-4-1-20250805': 8192,
13
+ 'anthropic.claude-opus-4-1-20250805-v1:0': 8192,
14
+ 'claude-opus-4-1@20250805': 8192,
12
15
  };
@@ -28,10 +28,10 @@ export async function defaultParseResponse<T>(
28
28
  // that if you set `stream: true` the response type must also be `Stream<T>`
29
29
 
30
30
  if (props.options.__streamClass) {
31
- return props.options.__streamClass.fromSSEResponse(response, props.controller, client) as any;
31
+ return props.options.__streamClass.fromSSEResponse(response, props.controller) as any;
32
32
  }
33
33
 
34
- return Stream.fromSSEResponse(response, props.controller, client) as any;
34
+ return Stream.fromSSEResponse(response, props.controller) as any;
35
35
  }
36
36
 
37
37
  // fetch refuses to read the body when the status code is 204.
@@ -111,6 +111,7 @@ import {
111
111
  BetaToolTextEditor20241022,
112
112
  BetaToolTextEditor20250124,
113
113
  BetaToolTextEditor20250429,
114
+ BetaToolTextEditor20250728,
114
115
  BetaToolUnion,
115
116
  BetaToolUseBlock,
116
117
  BetaToolUseBlockParam,
@@ -351,6 +352,7 @@ export declare namespace Beta {
351
352
  type BetaToolTextEditor20241022 as BetaToolTextEditor20241022,
352
353
  type BetaToolTextEditor20250124 as BetaToolTextEditor20250124,
353
354
  type BetaToolTextEditor20250429 as BetaToolTextEditor20250429,
355
+ type BetaToolTextEditor20250728 as BetaToolTextEditor20250728,
354
356
  type BetaToolUnion as BetaToolUnion,
355
357
  type BetaToolUseBlock as BetaToolUseBlock,
356
358
  type BetaToolUseBlockParam as BetaToolUseBlockParam,
@@ -121,6 +121,7 @@ export {
121
121
  type BetaToolTextEditor20241022,
122
122
  type BetaToolTextEditor20250124,
123
123
  type BetaToolTextEditor20250429,
124
+ type BetaToolTextEditor20250728,
124
125
  type BetaToolUnion,
125
126
  type BetaToolUseBlock,
126
127
  type BetaToolUseBlockParam,
@@ -114,6 +114,7 @@ export {
114
114
  type BetaToolTextEditor20241022,
115
115
  type BetaToolTextEditor20250124,
116
116
  type BetaToolTextEditor20250429,
117
+ type BetaToolTextEditor20250728,
117
118
  type BetaToolUnion,
118
119
  type BetaToolUseBlock,
119
120
  type BetaToolUseBlockParam,
@@ -203,6 +203,8 @@ export interface BetaCitationCharLocation {
203
203
 
204
204
  end_char_index: number;
205
205
 
206
+ file_id: string | null;
207
+
206
208
  start_char_index: number;
207
209
 
208
210
  type: 'char_location';
@@ -231,6 +233,8 @@ export interface BetaCitationContentBlockLocation {
231
233
 
232
234
  end_block_index: number;
233
235
 
236
+ file_id: string | null;
237
+
234
238
  start_block_index: number;
235
239
 
236
240
  type: 'content_block_location';
@@ -259,6 +263,8 @@ export interface BetaCitationPageLocation {
259
263
 
260
264
  end_page_number: number;
261
265
 
266
+ file_id: string | null;
267
+
262
268
  start_page_number: number;
263
269
 
264
270
  type: 'page_location';
@@ -1390,6 +1396,28 @@ export interface BetaToolTextEditor20250429 {
1390
1396
  cache_control?: BetaCacheControlEphemeral | null;
1391
1397
  }
1392
1398
 
1399
+ export interface BetaToolTextEditor20250728 {
1400
+ /**
1401
+ * Name of the tool.
1402
+ *
1403
+ * This is how the tool will be called by the model and in `tool_use` blocks.
1404
+ */
1405
+ name: 'str_replace_based_edit_tool';
1406
+
1407
+ type: 'text_editor_20250728';
1408
+
1409
+ /**
1410
+ * Create a cache control breakpoint at this content block.
1411
+ */
1412
+ cache_control?: BetaCacheControlEphemeral | null;
1413
+
1414
+ /**
1415
+ * Maximum number of characters to display when viewing a file. If not specified,
1416
+ * defaults to displaying the full file.
1417
+ */
1418
+ max_characters?: number | null;
1419
+ }
1420
+
1393
1421
  export type BetaToolUnion =
1394
1422
  | BetaTool
1395
1423
  | BetaToolBash20241022
@@ -1400,6 +1428,7 @@ export type BetaToolUnion =
1400
1428
  | BetaToolTextEditor20241022
1401
1429
  | BetaToolTextEditor20250124
1402
1430
  | BetaToolTextEditor20250429
1431
+ | BetaToolTextEditor20250728
1403
1432
  | BetaWebSearchTool20250305;
1404
1433
 
1405
1434
  export interface BetaToolUseBlock {
@@ -2179,6 +2208,7 @@ export interface MessageCountTokensParams {
2179
2208
  | BetaToolTextEditor20241022
2180
2209
  | BetaToolTextEditor20250124
2181
2210
  | BetaToolTextEditor20250429
2211
+ | BetaToolTextEditor20250728
2182
2212
  | BetaWebSearchTool20250305
2183
2213
  >;
2184
2214
 
@@ -2285,6 +2315,7 @@ export declare namespace Messages {
2285
2315
  type BetaToolTextEditor20241022 as BetaToolTextEditor20241022,
2286
2316
  type BetaToolTextEditor20250124 as BetaToolTextEditor20250124,
2287
2317
  type BetaToolTextEditor20250429 as BetaToolTextEditor20250429,
2318
+ type BetaToolTextEditor20250728 as BetaToolTextEditor20250728,
2288
2319
  type BetaToolUnion as BetaToolUnion,
2289
2320
  type BetaToolUseBlock as BetaToolUseBlock,
2290
2321
  type BetaToolUseBlockParam as BetaToolUseBlockParam,
@@ -92,6 +92,8 @@ export {
92
92
  type ToolChoiceTool,
93
93
  type ToolResultBlockParam,
94
94
  type ToolTextEditor20250124,
95
+ type ToolTextEditor20250429,
96
+ type ToolTextEditor20250728,
95
97
  type ToolUnion,
96
98
  type ToolUseBlock,
97
99
  type ToolUseBlockParam,
@@ -83,6 +83,8 @@ export {
83
83
  type ToolChoiceTool,
84
84
  type ToolResultBlockParam,
85
85
  type ToolTextEditor20250124,
86
+ type ToolTextEditor20250429,
87
+ type ToolTextEditor20250728,
86
88
  type ToolUnion,
87
89
  type ToolUseBlock,
88
90
  type ToolUseBlockParam,
@@ -138,6 +138,8 @@ export interface CitationCharLocation {
138
138
 
139
139
  end_char_index: number;
140
140
 
141
+ file_id: string | null;
142
+
141
143
  start_char_index: number;
142
144
 
143
145
  type: 'char_location';
@@ -166,6 +168,8 @@ export interface CitationContentBlockLocation {
166
168
 
167
169
  end_block_index: number;
168
170
 
171
+ file_id: string | null;
172
+
169
173
  start_block_index: number;
170
174
 
171
175
  type: 'content_block_location';
@@ -194,6 +198,8 @@ export interface CitationPageLocation {
194
198
 
195
199
  end_page_number: number;
196
200
 
201
+ file_id: string | null;
202
+
197
203
  start_page_number: number;
198
204
 
199
205
  type: 'page_location';
@@ -431,27 +437,10 @@ export type MessageCountTokensTool =
431
437
  | Tool
432
438
  | ToolBash20250124
433
439
  | ToolTextEditor20250124
434
- | MessageCountTokensTool.TextEditor20250429
440
+ | ToolTextEditor20250429
441
+ | ToolTextEditor20250728
435
442
  | WebSearchTool20250305;
436
443
 
437
- export namespace MessageCountTokensTool {
438
- export interface TextEditor20250429 {
439
- /**
440
- * Name of the tool.
441
- *
442
- * This is how the tool will be called by the model and in `tool_use` blocks.
443
- */
444
- name: 'str_replace_based_edit_tool';
445
-
446
- type: 'text_editor_20250429';
447
-
448
- /**
449
- * Create a cache control breakpoint at this content block.
450
- */
451
- cache_control?: MessagesAPI.CacheControlEphemeral | null;
452
- }
453
- }
454
-
455
444
  export interface MessageDeltaUsage {
456
445
  /**
457
446
  * The cumulative number of input tokens used to create the cache entry.
@@ -523,12 +512,10 @@ export type Model =
523
512
  | 'claude-opus-4-0'
524
513
  | 'claude-opus-4-20250514'
525
514
  | 'claude-4-opus-20250514'
515
+ | 'claude-opus-4-1-20250805'
526
516
  | 'claude-3-opus-latest'
527
517
  | 'claude-3-opus-20240229'
528
- | 'claude-3-sonnet-20240229'
529
518
  | 'claude-3-haiku-20240307'
530
- | 'claude-2.1'
531
- | 'claude-2.0'
532
519
  | (string & {});
533
520
 
534
521
  const DEPRECATED_MODELS: {
@@ -955,31 +942,52 @@ export interface ToolTextEditor20250124 {
955
942
  cache_control?: CacheControlEphemeral | null;
956
943
  }
957
944
 
945
+ export interface ToolTextEditor20250429 {
946
+ /**
947
+ * Name of the tool.
948
+ *
949
+ * This is how the tool will be called by the model and in `tool_use` blocks.
950
+ */
951
+ name: 'str_replace_based_edit_tool';
952
+
953
+ type: 'text_editor_20250429';
954
+
955
+ /**
956
+ * Create a cache control breakpoint at this content block.
957
+ */
958
+ cache_control?: CacheControlEphemeral | null;
959
+ }
960
+
961
+ export interface ToolTextEditor20250728 {
962
+ /**
963
+ * Name of the tool.
964
+ *
965
+ * This is how the tool will be called by the model and in `tool_use` blocks.
966
+ */
967
+ name: 'str_replace_based_edit_tool';
968
+
969
+ type: 'text_editor_20250728';
970
+
971
+ /**
972
+ * Create a cache control breakpoint at this content block.
973
+ */
974
+ cache_control?: CacheControlEphemeral | null;
975
+
976
+ /**
977
+ * Maximum number of characters to display when viewing a file. If not specified,
978
+ * defaults to displaying the full file.
979
+ */
980
+ max_characters?: number | null;
981
+ }
982
+
958
983
  export type ToolUnion =
959
984
  | Tool
960
985
  | ToolBash20250124
961
986
  | ToolTextEditor20250124
962
- | ToolUnion.TextEditor20250429
987
+ | ToolTextEditor20250429
988
+ | ToolTextEditor20250728
963
989
  | WebSearchTool20250305;
964
990
 
965
- export namespace ToolUnion {
966
- export interface TextEditor20250429 {
967
- /**
968
- * Name of the tool.
969
- *
970
- * This is how the tool will be called by the model and in `tool_use` blocks.
971
- */
972
- name: 'str_replace_based_edit_tool';
973
-
974
- type: 'text_editor_20250429';
975
-
976
- /**
977
- * Create a cache control breakpoint at this content block.
978
- */
979
- cache_control?: MessagesAPI.CacheControlEphemeral | null;
980
- }
981
- }
982
-
983
991
  export interface ToolUseBlock {
984
992
  id: string;
985
993
 
@@ -1804,6 +1812,8 @@ export declare namespace Messages {
1804
1812
  type ToolChoiceTool as ToolChoiceTool,
1805
1813
  type ToolResultBlockParam as ToolResultBlockParam,
1806
1814
  type ToolTextEditor20250124 as ToolTextEditor20250124,
1815
+ type ToolTextEditor20250429 as ToolTextEditor20250429,
1816
+ type ToolTextEditor20250728 as ToolTextEditor20250728,
1807
1817
  type ToolUnion as ToolUnion,
1808
1818
  type ToolUseBlock as ToolUseBlock,
1809
1819
  type ToolUseBlockParam as ToolUseBlockParam,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.56.0'; // x-release-please-version
1
+ export const VERSION = '0.58.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.56.0";
1
+ export declare const VERSION = "0.58.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.56.0";
1
+ export declare const VERSION = "0.58.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.56.0'; // x-release-please-version
4
+ exports.VERSION = '0.58.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.56.0'; // x-release-please-version
1
+ export const VERSION = '0.58.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map