@anthropic-ai/sdk 0.121.0 → 0.122.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 (153) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -1
  3. package/core/middleware.d.mts.map +1 -1
  4. package/core/middleware.d.ts.map +1 -1
  5. package/core/middleware.js +4 -4
  6. package/core/middleware.js.map +1 -1
  7. package/core/middleware.mjs +4 -4
  8. package/core/middleware.mjs.map +1 -1
  9. package/internal/errors.d.mts.map +1 -1
  10. package/internal/errors.d.ts.map +1 -1
  11. package/internal/errors.js +3 -1
  12. package/internal/errors.js.map +1 -1
  13. package/internal/errors.mjs +3 -1
  14. package/internal/errors.mjs.map +1 -1
  15. package/internal/parse.js +1 -1
  16. package/internal/parse.js.map +1 -1
  17. package/internal/parse.mjs +1 -1
  18. package/internal/parse.mjs.map +1 -1
  19. package/internal/uploads.js +10 -6
  20. package/internal/uploads.js.map +1 -1
  21. package/internal/uploads.mjs +10 -6
  22. package/internal/uploads.mjs.map +1 -1
  23. package/lib/sessions/accumulate.d.mts +3 -2
  24. package/lib/sessions/accumulate.d.mts.map +1 -1
  25. package/lib/sessions/accumulate.d.ts +3 -2
  26. package/lib/sessions/accumulate.d.ts.map +1 -1
  27. package/lib/sessions/accumulate.js +3 -45
  28. package/lib/sessions/accumulate.js.map +1 -1
  29. package/lib/sessions/accumulate.mjs +3 -45
  30. package/lib/sessions/accumulate.mjs.map +1 -1
  31. package/package.json +1 -1
  32. package/resources/beta/beta.d.mts +6 -6
  33. package/resources/beta/beta.d.mts.map +1 -1
  34. package/resources/beta/beta.d.ts +6 -6
  35. package/resources/beta/beta.d.ts.map +1 -1
  36. package/resources/beta/beta.js.map +1 -1
  37. package/resources/beta/beta.mjs.map +1 -1
  38. package/resources/beta/files.d.mts +25 -5
  39. package/resources/beta/files.d.mts.map +1 -1
  40. package/resources/beta/files.d.ts +25 -5
  41. package/resources/beta/files.d.ts.map +1 -1
  42. package/resources/beta/files.js +6 -6
  43. package/resources/beta/files.js.map +1 -1
  44. package/resources/beta/files.mjs +7 -7
  45. package/resources/beta/files.mjs.map +1 -1
  46. package/resources/beta/index.d.mts +3 -3
  47. package/resources/beta/index.d.mts.map +1 -1
  48. package/resources/beta/index.d.ts +3 -3
  49. package/resources/beta/index.d.ts.map +1 -1
  50. package/resources/beta/index.js.map +1 -1
  51. package/resources/beta/index.mjs.map +1 -1
  52. package/resources/beta/messages/index.d.mts +1 -1
  53. package/resources/beta/messages/index.d.mts.map +1 -1
  54. package/resources/beta/messages/index.d.ts +1 -1
  55. package/resources/beta/messages/index.d.ts.map +1 -1
  56. package/resources/beta/messages/messages.d.mts +19 -19
  57. package/resources/beta/messages/messages.d.mts.map +1 -1
  58. package/resources/beta/messages/messages.d.ts +19 -19
  59. package/resources/beta/messages/messages.d.ts.map +1 -1
  60. package/resources/beta/organization/rate-limits.d.mts +2 -3
  61. package/resources/beta/organization/rate-limits.d.mts.map +1 -1
  62. package/resources/beta/organization/rate-limits.d.ts +2 -3
  63. package/resources/beta/organization/rate-limits.d.ts.map +1 -1
  64. package/resources/beta/organization/rate-limits.js +2 -3
  65. package/resources/beta/organization/rate-limits.js.map +1 -1
  66. package/resources/beta/organization/rate-limits.mjs +2 -3
  67. package/resources/beta/organization/rate-limits.mjs.map +1 -1
  68. package/resources/beta/organization/workspaces/rate-limits.d.mts +2 -3
  69. package/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -1
  70. package/resources/beta/organization/workspaces/rate-limits.d.ts +2 -3
  71. package/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -1
  72. package/resources/beta/organization/workspaces/rate-limits.js +2 -3
  73. package/resources/beta/organization/workspaces/rate-limits.js.map +1 -1
  74. package/resources/beta/organization/workspaces/rate-limits.mjs +2 -3
  75. package/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -1
  76. package/resources/beta/skills/index.d.mts +2 -2
  77. package/resources/beta/skills/index.d.mts.map +1 -1
  78. package/resources/beta/skills/index.d.ts +2 -2
  79. package/resources/beta/skills/index.d.ts.map +1 -1
  80. package/resources/beta/skills/index.js.map +1 -1
  81. package/resources/beta/skills/index.mjs.map +1 -1
  82. package/resources/beta/skills/skills.d.mts +48 -120
  83. package/resources/beta/skills/skills.d.mts.map +1 -1
  84. package/resources/beta/skills/skills.d.ts +48 -120
  85. package/resources/beta/skills/skills.d.ts.map +1 -1
  86. package/resources/beta/skills/skills.js +12 -8
  87. package/resources/beta/skills/skills.js.map +1 -1
  88. package/resources/beta/skills/skills.mjs +12 -8
  89. package/resources/beta/skills/skills.mjs.map +1 -1
  90. package/resources/beta/skills/versions.d.mts +35 -138
  91. package/resources/beta/skills/versions.d.mts.map +1 -1
  92. package/resources/beta/skills/versions.d.ts +35 -138
  93. package/resources/beta/skills/versions.d.ts.map +1 -1
  94. package/resources/beta/skills/versions.js +18 -18
  95. package/resources/beta/skills/versions.js.map +1 -1
  96. package/resources/beta/skills/versions.mjs +18 -18
  97. package/resources/beta/skills/versions.mjs.map +1 -1
  98. package/resources/beta/webhooks.d.mts +16 -17
  99. package/resources/beta/webhooks.d.mts.map +1 -1
  100. package/resources/beta/webhooks.d.ts +16 -17
  101. package/resources/beta/webhooks.d.ts.map +1 -1
  102. package/resources/beta/webhooks.js +21 -8
  103. package/resources/beta/webhooks.js.map +1 -1
  104. package/resources/beta/webhooks.mjs +21 -8
  105. package/resources/beta/webhooks.mjs.map +1 -1
  106. package/src/core/middleware.ts +4 -3
  107. package/src/internal/errors.ts +3 -1
  108. package/src/internal/parse.ts +1 -1
  109. package/src/internal/uploads.ts +10 -7
  110. package/src/lib/sessions/accumulate.ts +7 -47
  111. package/src/resources/beta/beta.ts +12 -14
  112. package/src/resources/beta/files.ts +34 -11
  113. package/src/resources/beta/index.ts +6 -7
  114. package/src/resources/beta/messages/index.ts +1 -1
  115. package/src/resources/beta/messages/messages.ts +22 -22
  116. package/src/resources/beta/organization/rate-limits.ts +2 -3
  117. package/src/resources/beta/organization/workspaces/rate-limits.ts +2 -3
  118. package/src/resources/beta/skills/index.ts +7 -10
  119. package/src/resources/beta/skills/skills.ts +60 -150
  120. package/src/resources/beta/skills/versions.ts +43 -166
  121. package/src/resources/beta/webhooks.ts +25 -29
  122. package/src/tools/agent-toolset/node.browser.ts +0 -4
  123. package/src/tools/agent-toolset/node.ts +118 -13
  124. package/src/tools/agent-toolset/skills.ts +5 -33
  125. package/src/version.ts +1 -1
  126. package/tools/agent-toolset/node.browser.d.mts +0 -1
  127. package/tools/agent-toolset/node.browser.d.mts.map +1 -1
  128. package/tools/agent-toolset/node.browser.d.ts +0 -1
  129. package/tools/agent-toolset/node.browser.d.ts.map +1 -1
  130. package/tools/agent-toolset/node.browser.js +0 -4
  131. package/tools/agent-toolset/node.browser.js.map +1 -1
  132. package/tools/agent-toolset/node.browser.mjs +0 -3
  133. package/tools/agent-toolset/node.browser.mjs.map +1 -1
  134. package/tools/agent-toolset/node.d.mts +9 -7
  135. package/tools/agent-toolset/node.d.mts.map +1 -1
  136. package/tools/agent-toolset/node.d.ts +9 -7
  137. package/tools/agent-toolset/node.d.ts.map +1 -1
  138. package/tools/agent-toolset/node.js +96 -8
  139. package/tools/agent-toolset/node.js.map +1 -1
  140. package/tools/agent-toolset/node.mjs +96 -7
  141. package/tools/agent-toolset/node.mjs.map +1 -1
  142. package/tools/agent-toolset/skills.d.mts +0 -8
  143. package/tools/agent-toolset/skills.d.mts.map +1 -1
  144. package/tools/agent-toolset/skills.d.ts +0 -8
  145. package/tools/agent-toolset/skills.d.ts.map +1 -1
  146. package/tools/agent-toolset/skills.js +5 -25
  147. package/tools/agent-toolset/skills.js.map +1 -1
  148. package/tools/agent-toolset/skills.mjs +5 -24
  149. package/tools/agent-toolset/skills.mjs.map +1 -1
  150. package/version.d.mts +1 -1
  151. package/version.d.ts +1 -1
  152. package/version.js +1 -1
  153. package/version.mjs +1 -1
@@ -4,16 +4,14 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as BetaAPI from '../beta';
5
5
  import * as VersionsAPI from './versions';
6
6
  import {
7
+ BetaDeletedSkillVersion,
8
+ BetaSkillVersion,
9
+ BetaSkillVersionsPageCursor,
7
10
  VersionCreateParams,
8
- VersionCreateResponse,
9
11
  VersionDeleteParams,
10
- VersionDeleteResponse,
11
12
  VersionDownloadParams,
12
13
  VersionListParams,
13
- VersionListResponse,
14
- VersionListResponsesPageCursor,
15
14
  VersionRetrieveParams,
16
- VersionRetrieveResponse,
17
15
  Versions,
18
16
  } from './versions';
19
17
  import { APIPromise } from '../../../core/api-promise';
@@ -32,12 +30,12 @@ export class Skills extends APIResource {
32
30
  *
33
31
  * @example
34
32
  * ```ts
35
- * const skill = await client.beta.skills.create({
33
+ * const betaSkill = await client.beta.skills.create({
36
34
  * files: [fs.createReadStream('path/to/file')],
37
35
  * });
38
36
  * ```
39
37
  */
40
- create(params: SkillCreateParams, options?: RequestOptions): APIPromise<SkillCreateResponse> {
38
+ create(params: SkillCreateParams, options?: RequestOptions): APIPromise<BetaSkill> {
41
39
  const { betas, ...body } = params;
42
40
  return this._client.post(
43
41
  '/v1/skills?beta=true',
@@ -46,7 +44,7 @@ export class Skills extends APIResource {
46
44
  body,
47
45
  ...options,
48
46
  headers: buildHeaders([
49
- { 'anthropic-beta': [...(betas ?? []), 'skills-2025-10-02'].toString() },
47
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
50
48
  options?.headers,
51
49
  ]),
52
50
  },
@@ -61,19 +59,21 @@ export class Skills extends APIResource {
61
59
  *
62
60
  * @example
63
61
  * ```ts
64
- * const skill = await client.beta.skills.retrieve('skill_id');
62
+ * const betaSkill = await client.beta.skills.retrieve(
63
+ * 'skill_id',
64
+ * );
65
65
  * ```
66
66
  */
67
67
  retrieve(
68
68
  skillID: string,
69
69
  params: SkillRetrieveParams | null | undefined = {},
70
70
  options?: RequestOptions,
71
- ): APIPromise<SkillRetrieveResponse> {
71
+ ): APIPromise<BetaSkill> {
72
72
  const { betas } = params ?? {};
73
73
  return this._client.get(path`/v1/skills/${skillID}?beta=true`, {
74
74
  ...options,
75
75
  headers: buildHeaders([
76
- { 'anthropic-beta': [...(betas ?? []), 'skills-2025-10-02'].toString() },
76
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
77
77
  options?.headers,
78
78
  ]),
79
79
  });
@@ -85,7 +85,7 @@ export class Skills extends APIResource {
85
85
  * @example
86
86
  * ```ts
87
87
  * // Automatically fetches more pages as needed.
88
- * for await (const skillListResponse of client.beta.skills.list()) {
88
+ * for await (const betaSkill of client.beta.skills.list()) {
89
89
  * // ...
90
90
  * }
91
91
  * ```
@@ -93,13 +93,13 @@ export class Skills extends APIResource {
93
93
  list(
94
94
  params: SkillListParams | null | undefined = {},
95
95
  options?: RequestOptions,
96
- ): PagePromise<SkillListResponsesPageCursor, SkillListResponse> {
96
+ ): PagePromise<BetaSkillsPageCursor, BetaSkill> {
97
97
  const { betas, ...query } = params ?? {};
98
- return this._client.getAPIList('/v1/skills?beta=true', PageCursor<SkillListResponse>, {
98
+ return this._client.getAPIList('/v1/skills?beta=true', PageCursor<BetaSkill>, {
99
99
  query,
100
100
  ...options,
101
101
  headers: buildHeaders([
102
- { 'anthropic-beta': [...(betas ?? []), 'skills-2025-10-02'].toString() },
102
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
103
103
  options?.headers,
104
104
  ]),
105
105
  });
@@ -110,28 +110,30 @@ export class Skills extends APIResource {
110
110
  *
111
111
  * @example
112
112
  * ```ts
113
- * const skill = await client.beta.skills.delete('skill_id');
113
+ * const betaDeletedSkill = await client.beta.skills.delete(
114
+ * 'skill_id',
115
+ * );
114
116
  * ```
115
117
  */
116
118
  delete(
117
119
  skillID: string,
118
120
  params: SkillDeleteParams | null | undefined = {},
119
121
  options?: RequestOptions,
120
- ): APIPromise<SkillDeleteResponse> {
122
+ ): APIPromise<BetaDeletedSkill> {
121
123
  const { betas } = params ?? {};
122
124
  return this._client.delete(path`/v1/skills/${skillID}?beta=true`, {
123
125
  ...options,
124
126
  headers: buildHeaders([
125
- { 'anthropic-beta': [...(betas ?? []), 'skills-2025-10-02'].toString() },
127
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
126
128
  options?.headers,
127
129
  ]),
128
130
  });
129
131
  }
130
132
  }
131
133
 
132
- export type SkillListResponsesPageCursor = PageCursor<SkillListResponse>;
134
+ export type BetaSkillsPageCursor = PageCursor<BetaSkill>;
133
135
 
134
- export interface SkillCreateResponse {
136
+ export interface BetaDeletedSkill {
135
137
  /**
136
138
  * Unique identifier for the skill.
137
139
  *
@@ -140,100 +142,14 @@ export interface SkillCreateResponse {
140
142
  id: string;
141
143
 
142
144
  /**
143
- * ISO 8601 timestamp of when the skill was created.
144
- */
145
- created_at: string;
146
-
147
- /**
148
- * Display title for the skill.
149
- *
150
- * This is a human-readable label that is not included in the prompt sent to the
151
- * model.
152
- */
153
- display_title: string | null;
154
-
155
- /**
156
- * The latest version identifier for the skill.
157
- *
158
- * This represents the most recent version of the skill that has been created.
159
- */
160
- latest_version: string | null;
161
-
162
- /**
163
- * Source of the skill.
164
- *
165
- * This may be one of the following values:
166
- *
167
- * - `"custom"`: the skill was created by a user
168
- * - `"anthropic"`: the skill was created by Anthropic
169
- */
170
- source: string;
171
-
172
- /**
173
- * Object type.
174
- *
175
- * For Skills, this is always `"skill"`.
176
- */
177
- type: string;
178
-
179
- /**
180
- * ISO 8601 timestamp of when the skill was last updated.
181
- */
182
- updated_at: string;
183
- }
184
-
185
- export interface SkillRetrieveResponse {
186
- /**
187
- * Unique identifier for the skill.
188
- *
189
- * The format and length of IDs may change over time.
190
- */
191
- id: string;
192
-
193
- /**
194
- * ISO 8601 timestamp of when the skill was created.
195
- */
196
- created_at: string;
197
-
198
- /**
199
- * Display title for the skill.
200
- *
201
- * This is a human-readable label that is not included in the prompt sent to the
202
- * model.
203
- */
204
- display_title: string | null;
205
-
206
- /**
207
- * The latest version identifier for the skill.
208
- *
209
- * This represents the most recent version of the skill that has been created.
210
- */
211
- latest_version: string | null;
212
-
213
- /**
214
- * Source of the skill.
215
- *
216
- * This may be one of the following values:
217
- *
218
- * - `"custom"`: the skill was created by a user
219
- * - `"anthropic"`: the skill was created by Anthropic
220
- */
221
- source: string;
222
-
223
- /**
224
- * Object type.
145
+ * Deleted object type.
225
146
  *
226
- * For Skills, this is always `"skill"`.
227
- */
228
- type: string;
229
-
230
- /**
231
- * ISO 8601 timestamp of when the skill was last updated.
147
+ * For Skills, this is always `"skill_deleted"`.
232
148
  */
233
- updated_at: string;
149
+ type: 'skill_deleted';
234
150
  }
235
151
 
236
- export interface SkillListResponse {
152
+ export interface BetaSkill {
237
153
  /**
238
154
  * Unique identifier for the skill.
239
155
  *
@@ -247,36 +163,36 @@ export interface SkillListResponse {
247
163
  created_at: string;
248
164
 
249
165
  /**
250
- * Display title for the skill.
251
- *
252
- * This is a human-readable label that is not included in the prompt sent to the
253
- * model.
166
+ * Human-readable, single-line label for the Skill. Maximum 255 characters. Always
167
+ * set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not
168
+ * unique.
254
169
  */
255
- display_title: string | null;
170
+ display_name: string;
256
171
 
257
172
  /**
258
- * The latest version identifier for the skill.
259
- *
260
- * This represents the most recent version of the skill that has been created.
173
+ * ID of the newest Skill Version — what `latest` references resolve to. Always
174
+ * set: a Skill holds at least one version.
261
175
  */
262
- latest_version: string | null;
176
+ latest_version_id: string;
263
177
 
264
178
  /**
265
- * Source of the skill.
179
+ * Where the Skill comes from.
266
180
  *
267
- * This may be one of the following values:
181
+ * Possible values:
268
182
  *
269
- * - `"custom"`: the skill was created by a user
270
- * - `"anthropic"`: the skill was created by Anthropic
183
+ * - `"custom"`: authored by the platform user; private to their workspace
184
+ * - `"anthropic"`: published by Anthropic; shared and read-only
185
+ * - `"anthropic_example"`: Anthropic-published sample Skill
186
+ * - `"plugin"`: resolved from an installed plugin
271
187
  */
272
- source: string;
188
+ source: BetaSkillSource;
273
189
 
274
190
  /**
275
191
  * Object type.
276
192
  *
277
193
  * For Skills, this is always `"skill"`.
278
194
  */
279
- type: string;
195
+ type: 'skill';
280
196
 
281
197
  /**
282
198
  * ISO 8601 timestamp of when the skill was last updated.
@@ -284,20 +200,18 @@ export interface SkillListResponse {
284
200
  updated_at: string;
285
201
  }
286
202
 
287
- export interface SkillDeleteResponse {
203
+ export interface BetaSkillSource {
288
204
  /**
289
- * Unique identifier for the skill.
205
+ * Where the Skill comes from.
290
206
  *
291
- * The format and length of IDs may change over time.
292
- */
293
- id: string;
294
-
295
- /**
296
- * Deleted object type.
207
+ * Possible values:
297
208
  *
298
- * For Skills, this is always `"skill_deleted"`.
209
+ * - `"custom"`: authored by the platform user; private to their workspace
210
+ * - `"anthropic"`: published by Anthropic; shared and read-only
211
+ * - `"anthropic_example"`: Anthropic-published sample Skill
212
+ * - `"plugin"`: resolved from an installed plugin
299
213
  */
300
- type: string;
214
+ type: 'custom' | 'anthropic' | 'anthropic_example' | 'plugin';
301
215
  }
302
216
 
303
217
  export interface SkillCreateParams {
@@ -310,12 +224,11 @@ export interface SkillCreateParams {
310
224
  files: Array<Uploadable>;
311
225
 
312
226
  /**
313
- * Body param: Display title for the skill.
314
- *
315
- * This is a human-readable label that is not included in the prompt sent to the
316
- * model.
227
+ * Body param: Human-readable, single-line label for the Skill. Maximum 255
228
+ * characters. Always set: derived from the SKILL.md frontmatter `name` when
229
+ * omitted at creation. Not unique.
317
230
  */
318
- display_title?: string | null;
231
+ display_name?: string | null;
319
232
 
320
233
  /**
321
234
  * Header param: Optional header to specify the beta version(s) you want to use.
@@ -358,11 +271,10 @@ Skills.Versions = Versions;
358
271
 
359
272
  export declare namespace Skills {
360
273
  export {
361
- type SkillCreateResponse as SkillCreateResponse,
362
- type SkillRetrieveResponse as SkillRetrieveResponse,
363
- type SkillListResponse as SkillListResponse,
364
- type SkillDeleteResponse as SkillDeleteResponse,
365
- type SkillListResponsesPageCursor as SkillListResponsesPageCursor,
274
+ type BetaDeletedSkill as BetaDeletedSkill,
275
+ type BetaSkill as BetaSkill,
276
+ type BetaSkillSource as BetaSkillSource,
277
+ type BetaSkillsPageCursor as BetaSkillsPageCursor,
366
278
  type SkillCreateParams as SkillCreateParams,
367
279
  type SkillRetrieveParams as SkillRetrieveParams,
368
280
  type SkillListParams as SkillListParams,
@@ -371,11 +283,9 @@ export declare namespace Skills {
371
283
 
372
284
  export {
373
285
  Versions as Versions,
374
- type VersionCreateResponse as VersionCreateResponse,
375
- type VersionRetrieveResponse as VersionRetrieveResponse,
376
- type VersionListResponse as VersionListResponse,
377
- type VersionDeleteResponse as VersionDeleteResponse,
378
- type VersionListResponsesPageCursor as VersionListResponsesPageCursor,
286
+ type BetaDeletedSkillVersion as BetaDeletedSkillVersion,
287
+ type BetaSkillVersion as BetaSkillVersion,
288
+ type BetaSkillVersionsPageCursor as BetaSkillVersionsPageCursor,
379
289
  type VersionCreateParams as VersionCreateParams,
380
290
  type VersionRetrieveParams as VersionRetrieveParams,
381
291
  type VersionListParams as VersionListParams,