@anthropic-ai/sdk 0.117.1 → 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 +36 -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 +7 -1
- package/client.js.map +1 -1
- package/client.mjs +7 -1
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +1 -0
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts +1 -0
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js +7 -2
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs +8 -3
- package/core/api-promise.mjs.map +1 -1
- package/core/error.d.mts +1 -0
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +1 -0
- package/core/error.d.ts.map +1 -1
- package/core/error.js +1 -0
- package/core/error.js.map +1 -1
- package/core/error.mjs +1 -0
- package/core/error.mjs.map +1 -1
- package/core/middleware.js +1 -1
- package/core/middleware.js.map +1 -1
- package/core/middleware.mjs +2 -2
- package/core/middleware.mjs.map +1 -1
- package/helpers/beta/zod.d.mts.map +1 -1
- package/helpers/beta/zod.d.ts.map +1 -1
- package/helpers/beta/zod.js +1 -2
- package/helpers/beta/zod.js.map +1 -1
- package/helpers/beta/zod.mjs +1 -2
- package/helpers/beta/zod.mjs.map +1 -1
- package/helpers/zod.d.mts.map +1 -1
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js +1 -2
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs +1 -2
- package/helpers/zod.mjs.map +1 -1
- package/internal/parse.d.mts +2 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts +2 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +6 -6
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -5
- package/internal/parse.mjs.map +1 -1
- package/lib/BetaMessageStream.d.mts +2 -0
- package/lib/BetaMessageStream.d.mts.map +1 -1
- package/lib/BetaMessageStream.d.ts +2 -0
- package/lib/BetaMessageStream.d.ts.map +1 -1
- package/lib/BetaMessageStream.js +8 -2
- package/lib/BetaMessageStream.js.map +1 -1
- package/lib/BetaMessageStream.mjs +8 -2
- package/lib/BetaMessageStream.mjs.map +1 -1
- package/lib/MessageStream.d.mts +2 -0
- package/lib/MessageStream.d.mts.map +1 -1
- package/lib/MessageStream.d.ts +2 -0
- package/lib/MessageStream.d.ts.map +1 -1
- package/lib/MessageStream.js +8 -2
- package/lib/MessageStream.js.map +1 -1
- package/lib/MessageStream.mjs +8 -2
- package/lib/MessageStream.mjs.map +1 -1
- package/lib/environments/worker.d.mts +10 -6
- package/lib/environments/worker.d.mts.map +1 -1
- package/lib/environments/worker.d.ts +10 -6
- package/lib/environments/worker.d.ts.map +1 -1
- package/lib/environments/worker.js +22 -15
- package/lib/environments/worker.js.map +1 -1
- package/lib/environments/worker.mjs +22 -15
- package/lib/environments/worker.mjs.map +1 -1
- package/lib/tools/BetaRunnableTool.d.mts +21 -40
- package/lib/tools/BetaRunnableTool.d.mts.map +1 -1
- package/lib/tools/BetaRunnableTool.d.ts +21 -40
- package/lib/tools/BetaRunnableTool.d.ts.map +1 -1
- package/lib/tools/BetaRunnableTool.js +7 -16
- package/lib/tools/BetaRunnableTool.js.map +1 -1
- package/lib/tools/BetaRunnableTool.mjs +7 -16
- 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 -13
- package/lib/tools/BetaToolRunner.js.map +1 -1
- package/lib/tools/BetaToolRunner.mjs +3 -13
- package/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/lib/tools/SessionToolRunner.d.mts +6 -0
- package/lib/tools/SessionToolRunner.d.mts.map +1 -1
- package/lib/tools/SessionToolRunner.d.ts +6 -0
- package/lib/tools/SessionToolRunner.d.ts.map +1 -1
- package/lib/tools/SessionToolRunner.js +37 -8
- package/lib/tools/SessionToolRunner.js.map +1 -1
- package/lib/tools/SessionToolRunner.mjs +38 -9
- package/lib/tools/SessionToolRunner.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/agents/agents.d.mts +3 -3
- package/resources/beta/agents/agents.d.ts +3 -3
- package/resources/beta/agents/agents.js +1 -1
- package/resources/beta/agents/agents.mjs +1 -1
- package/resources/beta/beta.d.mts +5 -5
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +5 -5
- 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/dreams.d.mts +2 -2
- package/resources/beta/dreams.d.ts +2 -2
- package/resources/beta/environments/environments.d.mts +4 -3
- package/resources/beta/environments/environments.d.mts.map +1 -1
- package/resources/beta/environments/environments.d.ts +4 -3
- package/resources/beta/environments/environments.d.ts.map +1 -1
- package/resources/beta/environments/environments.js.map +1 -1
- package/resources/beta/environments/environments.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/memory-stores/index.d.mts +1 -1
- package/resources/beta/memory-stores/index.d.mts.map +1 -1
- package/resources/beta/memory-stores/index.d.ts +1 -1
- package/resources/beta/memory-stores/index.d.ts.map +1 -1
- package/resources/beta/memory-stores/index.js.map +1 -1
- package/resources/beta/memory-stores/index.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.mts +2 -2
- package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.ts +2 -2
- package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.js.map +1 -1
- package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.mts +17 -2
- package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.ts +17 -2
- package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/resources/beta/messages/batches.d.mts +1 -1
- package/resources/beta/messages/batches.d.ts +1 -1
- package/resources/beta/messages/batches.js +1 -1
- package/resources/beta/messages/batches.mjs +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 +1204 -25
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +1204 -25
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +1 -1
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +1 -1
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/sessions/sessions.d.mts +1 -1
- package/resources/beta/sessions/sessions.d.ts +1 -1
- package/resources/beta/user-profiles.d.mts +35 -9
- package/resources/beta/user-profiles.d.mts.map +1 -1
- package/resources/beta/user-profiles.d.ts +35 -9
- package/resources/beta/user-profiles.d.ts.map +1 -1
- package/resources/beta/user-profiles.js +5 -5
- package/resources/beta/user-profiles.mjs +5 -5
- 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/batches.d.mts +1 -1
- package/resources/messages/batches.d.ts +1 -1
- package/resources/messages/batches.js +1 -1
- package/resources/messages/batches.mjs +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 +1270 -28
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +1270 -28
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +1 -1
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +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 +173 -3
- package/src/core/api-promise.ts +14 -4
- package/src/core/error.ts +2 -0
- package/src/core/middleware.ts +2 -2
- package/src/helpers/beta/zod.ts +1 -3
- package/src/helpers/zod.ts +1 -3
- package/src/internal/parse.ts +6 -6
- package/src/lib/BetaMessageStream.ts +8 -0
- package/src/lib/MessageStream.ts +8 -0
- package/src/lib/environments/worker.ts +28 -14
- package/src/lib/tools/BetaRunnableTool.ts +26 -43
- package/src/lib/tools/BetaToolRunner.ts +6 -13
- package/src/lib/tools/SessionToolRunner.ts +39 -6
- package/src/resources/beta/agents/agents.ts +3 -3
- package/src/resources/beta/beta.ts +127 -8
- package/src/resources/beta/dreams.ts +2 -2
- package/src/resources/beta/environments/environments.ts +4 -3
- package/src/resources/beta/files.ts +27 -27
- package/src/resources/beta/index.ts +63 -4
- package/src/resources/beta/memory-stores/index.ts +1 -0
- package/src/resources/beta/memory-stores/memory-stores.ts +2 -0
- package/src/resources/beta/memory-stores/memory-versions.ts +21 -1
- package/src/resources/beta/messages/batches.ts +1 -1
- package/src/resources/beta/messages/index.ts +60 -1
- package/src/resources/beta/messages/messages.ts +1862 -435
- package/src/resources/beta/sessions/sessions.ts +1 -1
- package/src/resources/beta/user-profiles.ts +44 -15
- package/src/resources/files.ts +163 -0
- package/src/resources/index.ts +83 -1
- package/src/resources/messages/batches.ts +1 -1
- package/src/resources/messages/index.ts +66 -1
- package/src/resources/messages/messages.ts +1830 -320
- 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
|
@@ -370,7 +370,7 @@ export interface BetaManagedAgentsAgentWithOverridesParams {
|
|
|
370
370
|
mcp_servers?: Array<AgentsAPI.BetaManagedAgentsURLMCPServerParams>;
|
|
371
371
|
|
|
372
372
|
/**
|
|
373
|
-
* Replacement model. Accepts the model string, e.g. `claude-opus-
|
|
373
|
+
* Replacement model. Accepts the model string, e.g. `claude-opus-5`, or a
|
|
374
374
|
* `model_config` object. Omit to use the agent's model.
|
|
375
375
|
*/
|
|
376
376
|
model?: AgentsAPI.BetaManagedAgentsModel | AgentsAPI.BetaManagedAgentsModelConfigParams;
|
|
@@ -24,7 +24,7 @@ export class UserProfiles extends APIResource {
|
|
|
24
24
|
body,
|
|
25
25
|
...options,
|
|
26
26
|
headers: buildHeaders([
|
|
27
|
-
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-
|
|
27
|
+
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
|
|
28
28
|
options?.headers,
|
|
29
29
|
]),
|
|
30
30
|
});
|
|
@@ -50,7 +50,7 @@ export class UserProfiles extends APIResource {
|
|
|
50
50
|
return this._client.get(path`/v1/user_profiles/${userProfileID}?beta=true`, {
|
|
51
51
|
...options,
|
|
52
52
|
headers: buildHeaders([
|
|
53
|
-
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-
|
|
53
|
+
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
|
|
54
54
|
options?.headers,
|
|
55
55
|
]),
|
|
56
56
|
});
|
|
@@ -77,7 +77,7 @@ export class UserProfiles extends APIResource {
|
|
|
77
77
|
body,
|
|
78
78
|
...options,
|
|
79
79
|
headers: buildHeaders([
|
|
80
|
-
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-
|
|
80
|
+
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
|
|
81
81
|
options?.headers,
|
|
82
82
|
]),
|
|
83
83
|
});
|
|
@@ -103,7 +103,7 @@ export class UserProfiles extends APIResource {
|
|
|
103
103
|
query,
|
|
104
104
|
...options,
|
|
105
105
|
headers: buildHeaders([
|
|
106
|
-
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-
|
|
106
|
+
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
|
|
107
107
|
options?.headers,
|
|
108
108
|
]),
|
|
109
109
|
});
|
|
@@ -129,7 +129,7 @@ export class UserProfiles extends APIResource {
|
|
|
129
129
|
return this._client.post(path`/v1/user_profiles/${userProfileID}/enrollment_url?beta=true`, {
|
|
130
130
|
...options,
|
|
131
131
|
headers: buildHeaders([
|
|
132
|
-
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-
|
|
132
|
+
{ 'anthropic-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
|
|
133
133
|
options?.headers,
|
|
134
134
|
]),
|
|
135
135
|
});
|
|
@@ -155,13 +155,6 @@ export interface BetaUserProfile {
|
|
|
155
155
|
*/
|
|
156
156
|
metadata: { [key: string]: string };
|
|
157
157
|
|
|
158
|
-
/**
|
|
159
|
-
* How the entity behind a user profile relates to the platform that owns the API
|
|
160
|
-
* key. `external`: an individual end-user of the platform. `resold`: a company the
|
|
161
|
-
* platform resells Claude access to. `internal`: the platform's own usage.
|
|
162
|
-
*/
|
|
163
|
-
relationship: 'external' | 'resold' | 'internal';
|
|
164
|
-
|
|
165
158
|
/**
|
|
166
159
|
* Trust grants for this profile, keyed by grant name. Key omitted when no grant is
|
|
167
160
|
* active or in flight.
|
|
@@ -178,6 +171,15 @@ export interface BetaUserProfile {
|
|
|
178
171
|
*/
|
|
179
172
|
updated_at: string;
|
|
180
173
|
|
|
174
|
+
/**
|
|
175
|
+
* How the platform uses the API on behalf of the entity this profile represents.
|
|
176
|
+
* `application`: the platform sells a product that uses the API behind the scenes,
|
|
177
|
+
* and the profile represents an individual end-user of that product.
|
|
178
|
+
* `passthrough`: the platform resells raw inference, and the profile identifies
|
|
179
|
+
* the resold-to company.
|
|
180
|
+
*/
|
|
181
|
+
access_type?: 'application' | 'passthrough';
|
|
182
|
+
|
|
181
183
|
/**
|
|
182
184
|
* Platform's own identifier for this user. Not enforced unique.
|
|
183
185
|
*/
|
|
@@ -185,9 +187,17 @@ export interface BetaUserProfile {
|
|
|
185
187
|
|
|
186
188
|
/**
|
|
187
189
|
* Real-world name of the entity this profile represents (company or individual).
|
|
188
|
-
* For
|
|
190
|
+
* For a resold-to company (`access_type` `passthrough`, or `relationship` `resold`
|
|
191
|
+
* under the `user-profiles-2026-03-24` header) this is that company's name.
|
|
189
192
|
*/
|
|
190
193
|
name?: string | null;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* How the entity behind a user profile relates to the platform that owns the API
|
|
197
|
+
* key. `external`: an individual end-user of the platform. `resold`: a company the
|
|
198
|
+
* platform resells Claude access to. `internal`: the platform's own usage.
|
|
199
|
+
*/
|
|
200
|
+
relationship?: 'external' | 'resold' | 'internal';
|
|
191
201
|
}
|
|
192
202
|
|
|
193
203
|
export interface BetaUserProfileEnrollmentURL {
|
|
@@ -215,6 +225,15 @@ export interface BetaUserProfileTrustGrant {
|
|
|
215
225
|
}
|
|
216
226
|
|
|
217
227
|
export interface UserProfileCreateParams {
|
|
228
|
+
/**
|
|
229
|
+
* Body param: How the platform uses the API on behalf of the entity this profile
|
|
230
|
+
* represents. `application`: the platform sells a product that uses the API behind
|
|
231
|
+
* the scenes, and the profile represents an individual end-user of that product.
|
|
232
|
+
* `passthrough`: the platform resells raw inference, and the profile identifies
|
|
233
|
+
* the resold-to company.
|
|
234
|
+
*/
|
|
235
|
+
access_type?: 'application' | 'passthrough';
|
|
236
|
+
|
|
218
237
|
/**
|
|
219
238
|
* Body param: Platform's own identifier for this user. Not enforced unique.
|
|
220
239
|
* Maximum 255 characters.
|
|
@@ -230,8 +249,9 @@ export interface UserProfileCreateParams {
|
|
|
230
249
|
|
|
231
250
|
/**
|
|
232
251
|
* Body param: Optional for all profiles. Real-world name of the entity this
|
|
233
|
-
* profile represents (company or individual); for
|
|
234
|
-
*
|
|
252
|
+
* profile represents (company or individual); for a resold-to company
|
|
253
|
+
* (`relationship` `resold` / `access_type` `passthrough`), that company's name
|
|
254
|
+
* where known. Maximum 255 characters.
|
|
235
255
|
*/
|
|
236
256
|
name?: string | null;
|
|
237
257
|
|
|
@@ -257,6 +277,15 @@ export interface UserProfileRetrieveParams {
|
|
|
257
277
|
}
|
|
258
278
|
|
|
259
279
|
export interface UserProfileUpdateParams {
|
|
280
|
+
/**
|
|
281
|
+
* Body param: How the platform uses the API on behalf of the entity this profile
|
|
282
|
+
* represents. `application`: the platform sells a product that uses the API behind
|
|
283
|
+
* the scenes, and the profile represents an individual end-user of that product.
|
|
284
|
+
* `passthrough`: the platform resells raw inference, and the profile identifies
|
|
285
|
+
* the resold-to company.
|
|
286
|
+
*/
|
|
287
|
+
access_type?: 'application' | 'passthrough' | null;
|
|
288
|
+
|
|
260
289
|
/**
|
|
261
290
|
* Body param: If present, replaces the stored external_id. Omit to leave
|
|
262
291
|
* unchanged. Maximum 255 characters.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { PageCursor, type PageCursorParams, PagePromise } from '../core/pagination';
|
|
6
|
+
import { type Uploadable } from '../core/uploads';
|
|
7
|
+
import { buildHeaders } from '../internal/headers';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { stainlessHelperHeaderFromFile } from '../internal/stainless-helper-header';
|
|
10
|
+
import { multipartFormRequestOptions } from '../internal/uploads';
|
|
11
|
+
import { path } from '../internal/utils/path';
|
|
12
|
+
|
|
13
|
+
export class Files extends APIResource {
|
|
14
|
+
/**
|
|
15
|
+
* List Files
|
|
16
|
+
*/
|
|
17
|
+
list(
|
|
18
|
+
query: FileListParams | null | undefined = {},
|
|
19
|
+
options?: RequestOptions,
|
|
20
|
+
): PagePromise<FileMetadataPageCursor, FileMetadata> {
|
|
21
|
+
return this._client.getAPIList('/v1/files', PageCursor<FileMetadata>, { query, ...options });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Delete File
|
|
26
|
+
*/
|
|
27
|
+
delete(fileID: string, options?: RequestOptions): APIPromise<DeletedFile> {
|
|
28
|
+
return this._client.delete(path`/v1/files/${fileID}`, options);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Download File
|
|
33
|
+
*/
|
|
34
|
+
download(fileID: string, options?: RequestOptions): APIPromise<Response> {
|
|
35
|
+
return this._client.get(path`/v1/files/${fileID}/content`, {
|
|
36
|
+
...options,
|
|
37
|
+
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
38
|
+
__binaryResponse: true,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get File Metadata
|
|
44
|
+
*/
|
|
45
|
+
retrieveMetadata(fileID: string, options?: RequestOptions): APIPromise<FileMetadata> {
|
|
46
|
+
return this._client.get(path`/v1/files/${fileID}`, options);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Upload File
|
|
51
|
+
*/
|
|
52
|
+
upload(body: FileUploadParams, options?: RequestOptions): APIPromise<FileMetadata> {
|
|
53
|
+
return this._client.post(
|
|
54
|
+
'/v1/files',
|
|
55
|
+
multipartFormRequestOptions(
|
|
56
|
+
{
|
|
57
|
+
body,
|
|
58
|
+
...options,
|
|
59
|
+
headers: buildHeaders([stainlessHelperHeaderFromFile(body.file), options?.headers]),
|
|
60
|
+
},
|
|
61
|
+
this._client,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type FileMetadataPageCursor = PageCursor<FileMetadata>;
|
|
68
|
+
|
|
69
|
+
export interface DeletedFile {
|
|
70
|
+
/**
|
|
71
|
+
* ID of the deleted file.
|
|
72
|
+
*/
|
|
73
|
+
id: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Deleted object type.
|
|
77
|
+
*
|
|
78
|
+
* For file deletion, this is always `"file_deleted"`.
|
|
79
|
+
*/
|
|
80
|
+
type?: 'file_deleted';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface FileMetadata {
|
|
84
|
+
/**
|
|
85
|
+
* Unique object identifier.
|
|
86
|
+
*
|
|
87
|
+
* The format and length of IDs may change over time.
|
|
88
|
+
*/
|
|
89
|
+
id: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* RFC 3339 datetime string representing when the file was created.
|
|
93
|
+
*/
|
|
94
|
+
created_at: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Original filename of the uploaded file.
|
|
98
|
+
*/
|
|
99
|
+
filename: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* MIME type of the file.
|
|
103
|
+
*/
|
|
104
|
+
mime_type: string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Size of the file in bytes.
|
|
108
|
+
*/
|
|
109
|
+
size_bytes: number;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Object type.
|
|
113
|
+
*
|
|
114
|
+
* For files, this is always `"file"`.
|
|
115
|
+
*/
|
|
116
|
+
type: 'file';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Whether the file can be downloaded.
|
|
120
|
+
*/
|
|
121
|
+
downloadable?: boolean;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* RFC 3339 datetime string representing when the file will expire and become
|
|
125
|
+
* unavailable for download. Null if the file does not expire. For files uploaded
|
|
126
|
+
* with `expires_in_seconds`, this is the upload time plus that value.
|
|
127
|
+
*/
|
|
128
|
+
expires_at?: string | null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface FileListParams extends PageCursorParams {
|
|
132
|
+
/**
|
|
133
|
+
* Restrict the result set to Files whose `id` is in this list. At most 100 entries
|
|
134
|
+
* (after de-duplication). Mutually exclusive with `page` and `limit`. When
|
|
135
|
+
* supplied, the response is always a single page (`next_page` is null). IDs that
|
|
136
|
+
* do not resolve to a visible File — including deleted Files — are silently
|
|
137
|
+
* omitted.
|
|
138
|
+
*/
|
|
139
|
+
ids?: Array<string> | null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface FileUploadParams {
|
|
143
|
+
/**
|
|
144
|
+
* The file to upload
|
|
145
|
+
*/
|
|
146
|
+
file: Uploadable;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Seconds from upload until the file expires and its bytes become permanently
|
|
150
|
+
* unavailable. Must be between 3600 (one hour) and 7776000 (ninety days).
|
|
151
|
+
*/
|
|
152
|
+
expires_in_seconds?: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export declare namespace Files {
|
|
156
|
+
export {
|
|
157
|
+
type DeletedFile as DeletedFile,
|
|
158
|
+
type FileMetadata as FileMetadata,
|
|
159
|
+
type FileMetadataPageCursor as FileMetadataPageCursor,
|
|
160
|
+
type FileListParams as FileListParams,
|
|
161
|
+
type FileUploadParams as FileUploadParams,
|
|
162
|
+
};
|
|
163
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -25,6 +25,14 @@ export {
|
|
|
25
25
|
type CompletionCreateParamsNonStreaming,
|
|
26
26
|
type CompletionCreateParamsStreaming,
|
|
27
27
|
} from './completions';
|
|
28
|
+
export {
|
|
29
|
+
Files,
|
|
30
|
+
type DeletedFile,
|
|
31
|
+
type FileMetadata,
|
|
32
|
+
type FileListParams,
|
|
33
|
+
type FileUploadParams,
|
|
34
|
+
type FileMetadataPageCursor,
|
|
35
|
+
} from './files';
|
|
28
36
|
export {
|
|
29
37
|
Messages,
|
|
30
38
|
type Base64ImageSource,
|
|
@@ -38,6 +46,46 @@ export {
|
|
|
38
46
|
type BashCodeExecutionToolResultError,
|
|
39
47
|
type BashCodeExecutionToolResultErrorCode,
|
|
40
48
|
type BashCodeExecutionToolResultErrorParam,
|
|
49
|
+
type BrowserCloseTabConfig,
|
|
50
|
+
type BrowserDoubleClickConfig,
|
|
51
|
+
type BrowserFileUploadConfig,
|
|
52
|
+
type BrowserFindConfig,
|
|
53
|
+
type BrowserFormInputConfig,
|
|
54
|
+
type BrowserGetPageTextConfig,
|
|
55
|
+
type BrowserHoldKeyConfig,
|
|
56
|
+
type BrowserHoverConfig,
|
|
57
|
+
type BrowserJavascriptExecConfig,
|
|
58
|
+
type BrowserKeyConfig,
|
|
59
|
+
type BrowserLeftClickConfig,
|
|
60
|
+
type BrowserLeftClickDragConfig,
|
|
61
|
+
type BrowserLeftMouseDownConfig,
|
|
62
|
+
type BrowserLeftMouseUpConfig,
|
|
63
|
+
type BrowserListTabsConfig,
|
|
64
|
+
type BrowserMiddleClickConfig,
|
|
65
|
+
type BrowserMouseMoveConfig,
|
|
66
|
+
type BrowserNavigateConfig,
|
|
67
|
+
type BrowserNewTabConfig,
|
|
68
|
+
type BrowserReadConsoleConfig,
|
|
69
|
+
type BrowserReadNetworkConfig,
|
|
70
|
+
type BrowserReadPageConfig,
|
|
71
|
+
type BrowserRightClickConfig,
|
|
72
|
+
type BrowserScreenshotConfig,
|
|
73
|
+
type BrowserScrollConfig,
|
|
74
|
+
type BrowserScrollToConfig,
|
|
75
|
+
type BrowserStateBlockParam,
|
|
76
|
+
type BrowserStateChange,
|
|
77
|
+
type BrowserStateChangeDownloadCompleted,
|
|
78
|
+
type BrowserStateChangeDownloadFailed,
|
|
79
|
+
type BrowserStateChangeDownloadStarted,
|
|
80
|
+
type BrowserStateChangeTabOpened,
|
|
81
|
+
type BrowserStateTabEntry,
|
|
82
|
+
type BrowserSwitchTabConfig,
|
|
83
|
+
type BrowserToolset20260801,
|
|
84
|
+
type BrowserToolsetConfigs,
|
|
85
|
+
type BrowserTripleClickConfig,
|
|
86
|
+
type BrowserTypeConfig,
|
|
87
|
+
type BrowserWaitConfig,
|
|
88
|
+
type BrowserZoomConfig,
|
|
41
89
|
type CacheControlEphemeral,
|
|
42
90
|
type CacheCreation,
|
|
43
91
|
type CitationCharLocation,
|
|
@@ -68,7 +116,28 @@ export {
|
|
|
68
116
|
type CodeExecutionToolResultError,
|
|
69
117
|
type CodeExecutionToolResultErrorCode,
|
|
70
118
|
type CodeExecutionToolResultErrorParam,
|
|
119
|
+
type ComputerCursorPositionConfig,
|
|
120
|
+
type ComputerDoubleClickConfig,
|
|
121
|
+
type ComputerHoldKeyConfig,
|
|
122
|
+
type ComputerKeyConfig,
|
|
123
|
+
type ComputerLeftClickConfig,
|
|
124
|
+
type ComputerLeftClickDragConfig,
|
|
125
|
+
type ComputerLeftMouseDownConfig,
|
|
126
|
+
type ComputerLeftMouseUpConfig,
|
|
127
|
+
type ComputerMiddleClickConfig,
|
|
128
|
+
type ComputerMouseMoveConfig,
|
|
129
|
+
type ComputerRightClickConfig,
|
|
130
|
+
type ComputerScreenshotConfig,
|
|
131
|
+
type ComputerScrollConfig,
|
|
132
|
+
type ComputerToolset20260801,
|
|
133
|
+
type ComputerToolsetConfigs,
|
|
134
|
+
type ComputerTripleClickConfig,
|
|
135
|
+
type ComputerTypeConfig,
|
|
136
|
+
type ComputerWaitConfig,
|
|
137
|
+
type ComputerZoomConfig,
|
|
71
138
|
type Container,
|
|
139
|
+
type ContainerParams,
|
|
140
|
+
type ContainerSkill,
|
|
72
141
|
type ContainerUploadBlock,
|
|
73
142
|
type ContainerUploadBlockParam,
|
|
74
143
|
type ContentBlock,
|
|
@@ -82,19 +151,22 @@ export {
|
|
|
82
151
|
type DocumentBlockParam,
|
|
83
152
|
type EncryptedCodeExecutionResultBlock,
|
|
84
153
|
type EncryptedCodeExecutionResultBlockParam,
|
|
154
|
+
type FileDocumentSource,
|
|
155
|
+
type FileImageSource,
|
|
85
156
|
type ImageBlockParam,
|
|
157
|
+
type ImageTransformationsParam,
|
|
86
158
|
type InputJSONDelta,
|
|
87
159
|
type JSONOutputFormat,
|
|
88
160
|
type MemoryTool20250818,
|
|
89
161
|
type Message,
|
|
90
162
|
type MessageCountTokensTool,
|
|
163
|
+
type MessageCreateParamsContainer,
|
|
91
164
|
type MessageDeltaEvent,
|
|
92
165
|
type MessageDeltaUsage,
|
|
93
166
|
type MessageParam,
|
|
94
167
|
type MessageStreamParams,
|
|
95
168
|
type MessageTokensCount,
|
|
96
169
|
type Metadata,
|
|
97
|
-
type MidConversationSystemBlockParam,
|
|
98
170
|
type Model,
|
|
99
171
|
type OutputConfig,
|
|
100
172
|
type OutputTokensDetails,
|
|
@@ -117,6 +189,7 @@ export {
|
|
|
117
189
|
type ServerToolUseBlock,
|
|
118
190
|
type ServerToolUseBlockParam,
|
|
119
191
|
type SignatureDelta,
|
|
192
|
+
type SkillParams,
|
|
120
193
|
type StopReason,
|
|
121
194
|
type TextBlock,
|
|
122
195
|
type TextBlockParam,
|
|
@@ -211,3 +284,12 @@ export {
|
|
|
211
284
|
type ModelListParams,
|
|
212
285
|
type ModelInfosPage,
|
|
213
286
|
} from './models';
|
|
287
|
+
export {
|
|
288
|
+
Skills,
|
|
289
|
+
type DeletedSkill,
|
|
290
|
+
type Skill,
|
|
291
|
+
type SkillSource,
|
|
292
|
+
type SkillCreateParams,
|
|
293
|
+
type SkillListParams,
|
|
294
|
+
type SkillsPageCursor,
|
|
295
|
+
} from './skills/skills';
|
|
@@ -28,6 +28,46 @@ export {
|
|
|
28
28
|
type BashCodeExecutionToolResultError,
|
|
29
29
|
type BashCodeExecutionToolResultErrorCode,
|
|
30
30
|
type BashCodeExecutionToolResultErrorParam,
|
|
31
|
+
type BrowserCloseTabConfig,
|
|
32
|
+
type BrowserDoubleClickConfig,
|
|
33
|
+
type BrowserFileUploadConfig,
|
|
34
|
+
type BrowserFindConfig,
|
|
35
|
+
type BrowserFormInputConfig,
|
|
36
|
+
type BrowserGetPageTextConfig,
|
|
37
|
+
type BrowserHoldKeyConfig,
|
|
38
|
+
type BrowserHoverConfig,
|
|
39
|
+
type BrowserJavascriptExecConfig,
|
|
40
|
+
type BrowserKeyConfig,
|
|
41
|
+
type BrowserLeftClickConfig,
|
|
42
|
+
type BrowserLeftClickDragConfig,
|
|
43
|
+
type BrowserLeftMouseDownConfig,
|
|
44
|
+
type BrowserLeftMouseUpConfig,
|
|
45
|
+
type BrowserListTabsConfig,
|
|
46
|
+
type BrowserMiddleClickConfig,
|
|
47
|
+
type BrowserMouseMoveConfig,
|
|
48
|
+
type BrowserNavigateConfig,
|
|
49
|
+
type BrowserNewTabConfig,
|
|
50
|
+
type BrowserReadConsoleConfig,
|
|
51
|
+
type BrowserReadNetworkConfig,
|
|
52
|
+
type BrowserReadPageConfig,
|
|
53
|
+
type BrowserRightClickConfig,
|
|
54
|
+
type BrowserScreenshotConfig,
|
|
55
|
+
type BrowserScrollConfig,
|
|
56
|
+
type BrowserScrollToConfig,
|
|
57
|
+
type BrowserStateBlockParam,
|
|
58
|
+
type BrowserStateChange,
|
|
59
|
+
type BrowserStateChangeDownloadCompleted,
|
|
60
|
+
type BrowserStateChangeDownloadFailed,
|
|
61
|
+
type BrowserStateChangeDownloadStarted,
|
|
62
|
+
type BrowserStateChangeTabOpened,
|
|
63
|
+
type BrowserStateTabEntry,
|
|
64
|
+
type BrowserSwitchTabConfig,
|
|
65
|
+
type BrowserToolset20260801,
|
|
66
|
+
type BrowserToolsetConfigs,
|
|
67
|
+
type BrowserTripleClickConfig,
|
|
68
|
+
type BrowserTypeConfig,
|
|
69
|
+
type BrowserWaitConfig,
|
|
70
|
+
type BrowserZoomConfig,
|
|
31
71
|
type CacheControlEphemeral,
|
|
32
72
|
type CacheCreation,
|
|
33
73
|
type CitationCharLocation,
|
|
@@ -58,7 +98,28 @@ export {
|
|
|
58
98
|
type CodeExecutionToolResultError,
|
|
59
99
|
type CodeExecutionToolResultErrorCode,
|
|
60
100
|
type CodeExecutionToolResultErrorParam,
|
|
101
|
+
type ComputerCursorPositionConfig,
|
|
102
|
+
type ComputerDoubleClickConfig,
|
|
103
|
+
type ComputerHoldKeyConfig,
|
|
104
|
+
type ComputerKeyConfig,
|
|
105
|
+
type ComputerLeftClickConfig,
|
|
106
|
+
type ComputerLeftClickDragConfig,
|
|
107
|
+
type ComputerLeftMouseDownConfig,
|
|
108
|
+
type ComputerLeftMouseUpConfig,
|
|
109
|
+
type ComputerMiddleClickConfig,
|
|
110
|
+
type ComputerMouseMoveConfig,
|
|
111
|
+
type ComputerRightClickConfig,
|
|
112
|
+
type ComputerScreenshotConfig,
|
|
113
|
+
type ComputerScrollConfig,
|
|
114
|
+
type ComputerToolset20260801,
|
|
115
|
+
type ComputerToolsetConfigs,
|
|
116
|
+
type ComputerTripleClickConfig,
|
|
117
|
+
type ComputerTypeConfig,
|
|
118
|
+
type ComputerWaitConfig,
|
|
119
|
+
type ComputerZoomConfig,
|
|
61
120
|
type Container,
|
|
121
|
+
type ContainerParams,
|
|
122
|
+
type ContainerSkill,
|
|
62
123
|
type ContainerUploadBlock,
|
|
63
124
|
type ContainerUploadBlockParam,
|
|
64
125
|
type ContentBlock,
|
|
@@ -72,18 +133,21 @@ export {
|
|
|
72
133
|
type DocumentBlockParam,
|
|
73
134
|
type EncryptedCodeExecutionResultBlock,
|
|
74
135
|
type EncryptedCodeExecutionResultBlockParam,
|
|
136
|
+
type FileDocumentSource,
|
|
137
|
+
type FileImageSource,
|
|
75
138
|
type ImageBlockParam,
|
|
139
|
+
type ImageTransformationsParam,
|
|
76
140
|
type InputJSONDelta,
|
|
77
141
|
type JSONOutputFormat,
|
|
78
142
|
type MemoryTool20250818,
|
|
79
143
|
type Message,
|
|
80
144
|
type MessageCountTokensTool,
|
|
145
|
+
type MessageCreateParamsContainer,
|
|
81
146
|
type MessageDeltaEvent,
|
|
82
147
|
type MessageDeltaUsage,
|
|
83
148
|
type MessageParam,
|
|
84
149
|
type MessageTokensCount,
|
|
85
150
|
type Metadata,
|
|
86
|
-
type MidConversationSystemBlockParam,
|
|
87
151
|
type Model,
|
|
88
152
|
type OutputConfig,
|
|
89
153
|
type OutputTokensDetails,
|
|
@@ -106,6 +170,7 @@ export {
|
|
|
106
170
|
type ServerToolUseBlock,
|
|
107
171
|
type ServerToolUseBlockParam,
|
|
108
172
|
type SignatureDelta,
|
|
173
|
+
type SkillParams,
|
|
109
174
|
type StopReason,
|
|
110
175
|
type TextBlock,
|
|
111
176
|
type TextBlockParam,
|