@anthropic-ai/sdk 0.91.1 → 0.93.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 +28 -0
- package/client.d.mts +73 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +73 -0
- package/client.d.ts.map +1 -1
- package/client.js +269 -9
- package/client.js.map +1 -1
- package/client.mjs +269 -9
- package/client.mjs.map +1 -1
- package/core/credentials.d.mts +111 -0
- package/core/credentials.d.mts.map +1 -0
- package/core/credentials.d.ts +111 -0
- package/core/credentials.d.ts.map +1 -0
- package/core/credentials.js +298 -0
- package/core/credentials.js.map +1 -0
- package/core/credentials.mjs +259 -0
- package/core/credentials.mjs.map +1 -0
- package/internal/types.d.mts +12 -6
- package/internal/types.d.ts +12 -6
- package/internal/utils/time.d.mts +3 -0
- package/internal/utils/time.d.mts.map +1 -0
- package/internal/utils/time.d.ts +3 -0
- package/internal/utils/time.d.ts.map +1 -0
- package/internal/utils/time.js +8 -0
- package/internal/utils/time.js.map +1 -0
- package/internal/utils/time.mjs +5 -0
- package/internal/utils/time.mjs.map +1 -0
- package/lib/credentials/credential-chain.d.mts +39 -0
- package/lib/credentials/credential-chain.d.mts.map +1 -0
- package/lib/credentials/credential-chain.d.ts +39 -0
- package/lib/credentials/credential-chain.d.ts.map +1 -0
- package/lib/credentials/credential-chain.js +237 -0
- package/lib/credentials/credential-chain.js.map +1 -0
- package/lib/credentials/credential-chain.mjs +200 -0
- package/lib/credentials/credential-chain.mjs.map +1 -0
- package/lib/credentials/identity-token.d.mts +11 -0
- package/lib/credentials/identity-token.d.mts.map +1 -0
- package/lib/credentials/identity-token.d.ts +11 -0
- package/lib/credentials/identity-token.d.ts.map +1 -0
- package/lib/credentials/identity-token.js +72 -0
- package/lib/credentials/identity-token.js.map +1 -0
- package/lib/credentials/identity-token.mjs +35 -0
- package/lib/credentials/identity-token.mjs.map +1 -0
- package/lib/credentials/oidc-federation.d.mts +28 -0
- package/lib/credentials/oidc-federation.d.mts.map +1 -0
- package/lib/credentials/oidc-federation.d.ts +28 -0
- package/lib/credentials/oidc-federation.d.ts.map +1 -0
- package/lib/credentials/oidc-federation.js +69 -0
- package/lib/credentials/oidc-federation.js.map +1 -0
- package/lib/credentials/oidc-federation.mjs +66 -0
- package/lib/credentials/oidc-federation.mjs.map +1 -0
- package/lib/credentials/token-cache.d.mts +54 -0
- package/lib/credentials/token-cache.d.mts.map +1 -0
- package/lib/credentials/token-cache.d.ts +54 -0
- package/lib/credentials/token-cache.d.ts.map +1 -0
- package/lib/credentials/token-cache.js +112 -0
- package/lib/credentials/token-cache.js.map +1 -0
- package/lib/credentials/token-cache.mjs +108 -0
- package/lib/credentials/token-cache.mjs.map +1 -0
- package/lib/credentials/types.d.mts +96 -0
- package/lib/credentials/types.d.mts.map +1 -0
- package/lib/credentials/types.d.ts +96 -0
- package/lib/credentials/types.d.ts.map +1 -0
- package/lib/credentials/types.js +266 -0
- package/lib/credentials/types.js.map +1 -0
- package/lib/credentials/types.mjs +224 -0
- package/lib/credentials/types.mjs.map +1 -0
- package/lib/credentials/user-oauth.d.mts +21 -0
- package/lib/credentials/user-oauth.d.mts.map +1 -0
- package/lib/credentials/user-oauth.d.ts +21 -0
- package/lib/credentials/user-oauth.d.ts.map +1 -0
- package/lib/credentials/user-oauth.js +130 -0
- package/lib/credentials/user-oauth.js.map +1 -0
- package/lib/credentials/user-oauth.mjs +94 -0
- package/lib/credentials/user-oauth.mjs.map +1 -0
- package/lib/credentials.d.mts +4 -0
- package/lib/credentials.d.mts.map +1 -0
- package/lib/credentials.d.ts +4 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +8 -0
- package/lib/credentials.js.map +1 -0
- package/lib/credentials.mjs +3 -0
- package/lib/credentials.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/beta/environments.d.mts +1 -1
- package/resources/beta/environments.d.ts +1 -1
- package/resources/beta/index.d.mts +1 -1
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- 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/memories.d.mts +126 -11
- package/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/resources/beta/memory-stores/memories.d.ts +126 -11
- package/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/resources/beta/memory-stores/memories.js +5 -5
- package/resources/beta/memory-stores/memories.mjs +5 -5
- package/resources/beta/memory-stores/memory-stores.d.mts +58 -14
- package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.ts +58 -14
- package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.js +6 -6
- package/resources/beta/memory-stores/memory-stores.js.map +1 -1
- package/resources/beta/memory-stores/memory-stores.mjs +6 -6
- package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.mts +88 -5
- package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.ts +88 -5
- package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.js +3 -3
- package/resources/beta/memory-stores/memory-versions.mjs +3 -3
- package/resources/beta/messages/batches.d.mts +4 -0
- package/resources/beta/messages/batches.d.mts.map +1 -1
- package/resources/beta/messages/batches.d.ts +4 -0
- package/resources/beta/messages/batches.d.ts.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 +5 -1
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +5 -1
- 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 +5 -0
- package/resources/beta/sessions/sessions.d.mts.map +1 -1
- package/resources/beta/sessions/sessions.d.ts +5 -0
- package/resources/beta/sessions/sessions.d.ts.map +1 -1
- package/resources/beta/sessions/sessions.js.map +1 -1
- package/resources/beta/sessions/sessions.mjs.map +1 -1
- package/resources/messages/messages.d.mts +4 -0
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +4 -0
- 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/src/client.ts +354 -14
- package/src/core/credentials.ts +349 -0
- package/src/internal/utils/time.ts +4 -0
- package/src/lib/credentials/credential-chain.ts +284 -0
- package/src/lib/credentials/identity-token.ts +37 -0
- package/src/lib/credentials/oidc-federation.ts +112 -0
- package/src/lib/credentials/token-cache.ts +130 -0
- package/src/lib/credentials/types.ts +295 -0
- package/src/lib/credentials/user-oauth.ts +144 -0
- package/src/lib/credentials.ts +3 -0
- package/src/resources/beta/environments.ts +1 -1
- package/src/resources/beta/index.ts +1 -0
- package/src/resources/beta/memory-stores/memories.ts +126 -11
- package/src/resources/beta/memory-stores/memory-stores.ts +58 -14
- package/src/resources/beta/memory-stores/memory-versions.ts +88 -5
- package/src/resources/beta/messages/batches.ts +4 -0
- package/src/resources/beta/messages/index.ts +1 -0
- package/src/resources/beta/messages/messages.ts +5 -1
- package/src/resources/beta/sessions/sessions.ts +6 -0
- package/src/resources/messages/messages.ts +4 -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
|
@@ -10,7 +10,7 @@ import { path } from '../../../internal/utils/path';
|
|
|
10
10
|
|
|
11
11
|
export class Memories extends APIResource {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Create a memory
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
@@ -39,7 +39,7 @@ export class Memories extends APIResource {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Retrieve a memory
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* ```ts
|
|
@@ -67,7 +67,7 @@ export class Memories extends APIResource {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Update a memory
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* ```ts
|
|
@@ -96,7 +96,7 @@ export class Memories extends APIResource {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* List memories
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
@@ -129,7 +129,7 @@ export class Memories extends APIResource {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
132
|
+
* Delete a memory
|
|
133
133
|
*
|
|
134
134
|
* @example
|
|
135
135
|
* ```ts
|
|
@@ -165,13 +165,37 @@ export interface BetaManagedAgentsConflictError {
|
|
|
165
165
|
message?: string;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Optimistic-concurrency precondition: the update applies only if the memory's
|
|
170
|
+
* stored `content_sha256` equals the supplied value. On mismatch, the request
|
|
171
|
+
* returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and
|
|
172
|
+
* retry against the fresh state. If the precondition fails but the stored state
|
|
173
|
+
* already exactly matches the requested `content` and `path`, the server returns
|
|
174
|
+
* 200 instead of 409.
|
|
175
|
+
*/
|
|
168
176
|
export interface BetaManagedAgentsContentSha256Precondition {
|
|
169
177
|
type: 'content_sha256';
|
|
170
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Expected `content_sha256` of the stored memory (64 lowercase hexadecimal
|
|
181
|
+
* characters). Typically the `content_sha256` returned by a prior read or list
|
|
182
|
+
* call. Because the server applies no content normalization, clients can also
|
|
183
|
+
* compute this locally as the SHA-256 of the UTF-8 content bytes.
|
|
184
|
+
*/
|
|
171
185
|
content_sha256?: string;
|
|
172
186
|
}
|
|
173
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Tombstone returned by
|
|
190
|
+
* [Delete a memory](/en/api/beta/memory_stores/memories/delete). The memory's
|
|
191
|
+
* version history persists and remains listable via
|
|
192
|
+
* [List memory versions](/en/api/beta/memory_stores/memory_versions/list) until
|
|
193
|
+
* the store itself is deleted.
|
|
194
|
+
*/
|
|
174
195
|
export interface BetaManagedAgentsDeletedMemory {
|
|
196
|
+
/**
|
|
197
|
+
* ID of the deleted memory (a `mem_...` value).
|
|
198
|
+
*/
|
|
175
199
|
id: string;
|
|
176
200
|
|
|
177
201
|
type: 'memory_deleted';
|
|
@@ -191,11 +215,33 @@ export type BetaManagedAgentsError =
|
|
|
191
215
|
| BetaManagedAgentsMemoryPathConflictError
|
|
192
216
|
| BetaManagedAgentsConflictError;
|
|
193
217
|
|
|
218
|
+
/**
|
|
219
|
+
* A `memory` object: a single text document at a hierarchical path inside a memory
|
|
220
|
+
* store. The `content` field is populated when `view=full` and `null` when
|
|
221
|
+
* `view=basic`; the `content_size_bytes` and `content_sha256` fields are always
|
|
222
|
+
* populated so sync clients can diff without fetching content. Memories are
|
|
223
|
+
* addressed by their `mem_...` ID; the path is the create key and can be changed
|
|
224
|
+
* via update.
|
|
225
|
+
*/
|
|
194
226
|
export interface BetaManagedAgentsMemory {
|
|
227
|
+
/**
|
|
228
|
+
* Unique identifier for this memory (a `mem_...` value). Stable across renames;
|
|
229
|
+
* use this ID, not the path, to read, update, or delete the memory.
|
|
230
|
+
*/
|
|
195
231
|
id: string;
|
|
196
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Lowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The
|
|
235
|
+
* server applies no normalization, so clients can compute the same hash locally
|
|
236
|
+
* for staleness checks and as the value for a `content_sha256` precondition on
|
|
237
|
+
* update. Always populated, regardless of `view`.
|
|
238
|
+
*/
|
|
197
239
|
content_sha256: string;
|
|
198
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Size of `content` in bytes (the UTF-8 plaintext length). Always populated,
|
|
243
|
+
* regardless of `view`.
|
|
244
|
+
*/
|
|
199
245
|
content_size_bytes: number;
|
|
200
246
|
|
|
201
247
|
/**
|
|
@@ -203,10 +249,25 @@ export interface BetaManagedAgentsMemory {
|
|
|
203
249
|
*/
|
|
204
250
|
created_at: string;
|
|
205
251
|
|
|
252
|
+
/**
|
|
253
|
+
* ID of the memory store this memory belongs to (a `memstore_...` value).
|
|
254
|
+
*/
|
|
206
255
|
memory_store_id: string;
|
|
207
256
|
|
|
257
|
+
/**
|
|
258
|
+
* ID of the `memory_version` representing this memory's current content (a
|
|
259
|
+
* `memver_...` value). This is the authoritative head pointer; `memory_version`
|
|
260
|
+
* objects do not carry an `is_latest` flag, so compare against this field instead.
|
|
261
|
+
* Enumerate the full history via
|
|
262
|
+
* [List memory versions](/en/api/beta/memory_stores/memory_versions/list).
|
|
263
|
+
*/
|
|
208
264
|
memory_version_id: string;
|
|
209
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Hierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`.
|
|
268
|
+
* Always starts with `/`. Paths are case-sensitive and unique within a store.
|
|
269
|
+
* Maximum 1,024 bytes.
|
|
270
|
+
*/
|
|
210
271
|
path: string;
|
|
211
272
|
|
|
212
273
|
type: 'memory';
|
|
@@ -216,9 +277,18 @@ export interface BetaManagedAgentsMemory {
|
|
|
216
277
|
*/
|
|
217
278
|
updated_at: string;
|
|
218
279
|
|
|
280
|
+
/**
|
|
281
|
+
* The memory's UTF-8 text content. Populated when `view=full`; `null` when
|
|
282
|
+
* `view=basic`. Maximum 100 kB (102,400 bytes).
|
|
283
|
+
*/
|
|
219
284
|
content?: string | null;
|
|
220
285
|
}
|
|
221
286
|
|
|
287
|
+
/**
|
|
288
|
+
* One item in a [List memories](/en/api/beta/memory_stores/memories/list)
|
|
289
|
+
* response: either a `memory` object or, when `depth` is set, a `memory_prefix`
|
|
290
|
+
* rollup marker.
|
|
291
|
+
*/
|
|
222
292
|
export type BetaManagedAgentsMemoryListItem = BetaManagedAgentsMemory | BetaManagedAgentsMemoryPrefix;
|
|
223
293
|
|
|
224
294
|
export interface BetaManagedAgentsMemoryPathConflictError {
|
|
@@ -237,31 +307,66 @@ export interface BetaManagedAgentsMemoryPreconditionFailedError {
|
|
|
237
307
|
message?: string;
|
|
238
308
|
}
|
|
239
309
|
|
|
310
|
+
/**
|
|
311
|
+
* A rolled-up directory marker returned by
|
|
312
|
+
* [List memories](/en/api/beta/memory_stores/memories/list) when `depth` is set.
|
|
313
|
+
* Indicates that one or more memories exist deeper than the requested depth under
|
|
314
|
+
* this prefix. This is a list-time rollup, not a stored resource; it has no ID and
|
|
315
|
+
* no lifecycle. Each prefix counts toward the page `limit` and interleaves with
|
|
316
|
+
* `memory` items in path order.
|
|
317
|
+
*/
|
|
240
318
|
export interface BetaManagedAgentsMemoryPrefix {
|
|
319
|
+
/**
|
|
320
|
+
* The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`).
|
|
321
|
+
* Pass this value as `path_prefix` on a subsequent list call to drill into the
|
|
322
|
+
* directory.
|
|
323
|
+
*/
|
|
241
324
|
path: string;
|
|
242
325
|
|
|
243
326
|
type: 'memory_prefix';
|
|
244
327
|
}
|
|
245
328
|
|
|
246
329
|
/**
|
|
247
|
-
*
|
|
330
|
+
* Selects which projection of a `memory` or `memory_version` the server returns.
|
|
331
|
+
* `basic` returns the object with `content` set to `null`; `full` populates
|
|
332
|
+
* `content`. When omitted, the default is endpoint-specific: retrieve operations
|
|
333
|
+
* default to `full`; list, create, and update operations default to `basic`.
|
|
334
|
+
* Listing with `view=full` caps `limit` at 20.
|
|
248
335
|
*/
|
|
249
336
|
export type BetaManagedAgentsMemoryView = 'basic' | 'full';
|
|
250
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Optimistic-concurrency precondition: the update applies only if the memory's
|
|
340
|
+
* stored `content_sha256` equals the supplied value. On mismatch, the request
|
|
341
|
+
* returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and
|
|
342
|
+
* retry against the fresh state. If the precondition fails but the stored state
|
|
343
|
+
* already exactly matches the requested `content` and `path`, the server returns
|
|
344
|
+
* 200 instead of 409.
|
|
345
|
+
*/
|
|
251
346
|
export interface BetaManagedAgentsPrecondition {
|
|
252
347
|
type: 'content_sha256';
|
|
253
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Expected `content_sha256` of the stored memory (64 lowercase hexadecimal
|
|
351
|
+
* characters). Typically the `content_sha256` returned by a prior read or list
|
|
352
|
+
* call. Because the server applies no content normalization, clients can also
|
|
353
|
+
* compute this locally as the SHA-256 of the UTF-8 content bytes.
|
|
354
|
+
*/
|
|
254
355
|
content_sha256?: string;
|
|
255
356
|
}
|
|
256
357
|
|
|
257
358
|
export interface MemoryCreateParams {
|
|
258
359
|
/**
|
|
259
|
-
* Body param
|
|
360
|
+
* Body param: UTF-8 text content for the new memory. Maximum 100 kB (102,400
|
|
361
|
+
* bytes). Required; pass `""` explicitly to create an empty memory.
|
|
260
362
|
*/
|
|
261
363
|
content: string | null;
|
|
262
364
|
|
|
263
365
|
/**
|
|
264
|
-
* Body param
|
|
366
|
+
* Body param: Hierarchical path for the new memory, e.g. `/projects/foo/notes.md`.
|
|
367
|
+
* Must start with `/`, contain at least one non-empty segment, and be at most
|
|
368
|
+
* 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or
|
|
369
|
+
* format characters, and must be NFC-normalized. Paths are case-sensitive.
|
|
265
370
|
*/
|
|
266
371
|
path: string;
|
|
267
372
|
|
|
@@ -305,17 +410,27 @@ export interface MemoryUpdateParams {
|
|
|
305
410
|
view?: BetaManagedAgentsMemoryView;
|
|
306
411
|
|
|
307
412
|
/**
|
|
308
|
-
* Body param
|
|
413
|
+
* Body param: New UTF-8 text content for the memory. Maximum 100 kB (102,400
|
|
414
|
+
* bytes). Omit to leave the content unchanged (e.g., for a rename-only update).
|
|
309
415
|
*/
|
|
310
416
|
content?: string | null;
|
|
311
417
|
|
|
312
418
|
/**
|
|
313
|
-
* Body param
|
|
419
|
+
* Body param: New path for the memory (a rename). Must start with `/`, contain at
|
|
420
|
+
* least one non-empty segment, and be at most 1,024 bytes. Must not contain empty
|
|
421
|
+
* segments, `.` or `..` segments, control or format characters, and must be
|
|
422
|
+
* NFC-normalized. Paths are case-sensitive. The memory's `id` is preserved across
|
|
423
|
+
* renames. Omit to leave the path unchanged.
|
|
314
424
|
*/
|
|
315
425
|
path?: string | null;
|
|
316
426
|
|
|
317
427
|
/**
|
|
318
|
-
* Body param
|
|
428
|
+
* Body param: Optimistic-concurrency precondition: the update applies only if the
|
|
429
|
+
* memory's stored `content_sha256` equals the supplied value. On mismatch, the
|
|
430
|
+
* request returns `memory_precondition_failed_error` (HTTP 409); re-read the
|
|
431
|
+
* memory and retry against the fresh state. If the precondition fails but the
|
|
432
|
+
* stored state already exactly matches the requested `content` and `path`, the
|
|
433
|
+
* server returns 200 instead of 409.
|
|
319
434
|
*/
|
|
320
435
|
precondition?: BetaManagedAgentsPrecondition;
|
|
321
436
|
|
|
@@ -48,7 +48,7 @@ export class MemoryStores extends APIResource {
|
|
|
48
48
|
memoryVersions: MemoryVersionsAPI.MemoryVersions = new MemoryVersionsAPI.MemoryVersions(this._client);
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Create a memory store
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```ts
|
|
@@ -72,7 +72,7 @@ export class MemoryStores extends APIResource {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Retrieve a memory store
|
|
76
76
|
*
|
|
77
77
|
* @example
|
|
78
78
|
* ```ts
|
|
@@ -98,7 +98,7 @@ export class MemoryStores extends APIResource {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* Update a memory store
|
|
102
102
|
*
|
|
103
103
|
* @example
|
|
104
104
|
* ```ts
|
|
@@ -123,7 +123,7 @@ export class MemoryStores extends APIResource {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* List memory stores
|
|
127
127
|
*
|
|
128
128
|
* @example
|
|
129
129
|
* ```ts
|
|
@@ -149,7 +149,7 @@ export class MemoryStores extends APIResource {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
*
|
|
152
|
+
* Delete a memory store
|
|
153
153
|
*
|
|
154
154
|
* @example
|
|
155
155
|
* ```ts
|
|
@@ -173,7 +173,7 @@ export class MemoryStores extends APIResource {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
176
|
+
* Archive a memory store
|
|
177
177
|
*
|
|
178
178
|
* @example
|
|
179
179
|
* ```ts
|
|
@@ -199,13 +199,30 @@ export class MemoryStores extends APIResource {
|
|
|
199
199
|
|
|
200
200
|
export type BetaManagedAgentsMemoryStoresPageCursor = PageCursor<BetaManagedAgentsMemoryStore>;
|
|
201
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Confirmation that a `memory_store` was deleted.
|
|
204
|
+
*/
|
|
202
205
|
export interface BetaManagedAgentsDeletedMemoryStore {
|
|
206
|
+
/**
|
|
207
|
+
* ID of the deleted memory store (a `memstore_...` identifier). The store and all
|
|
208
|
+
* its memories and versions are no longer retrievable.
|
|
209
|
+
*/
|
|
203
210
|
id: string;
|
|
204
211
|
|
|
205
212
|
type: 'memory_store_deleted';
|
|
206
213
|
}
|
|
207
214
|
|
|
215
|
+
/**
|
|
216
|
+
* A `memory_store`: a named container for agent memories, scoped to a workspace.
|
|
217
|
+
* Attach a store to a session via `resources[]` to mount it as a directory the
|
|
218
|
+
* agent can read and write.
|
|
219
|
+
*/
|
|
208
220
|
export interface BetaManagedAgentsMemoryStore {
|
|
221
|
+
/**
|
|
222
|
+
* Unique identifier for the memory store (a `memstore_...` tagged ID). Use this
|
|
223
|
+
* when attaching the store to a session, or in the `{memory_store_id}` path
|
|
224
|
+
* parameter of subsequent calls.
|
|
225
|
+
*/
|
|
209
226
|
id: string;
|
|
210
227
|
|
|
211
228
|
/**
|
|
@@ -213,6 +230,10 @@ export interface BetaManagedAgentsMemoryStore {
|
|
|
213
230
|
*/
|
|
214
231
|
created_at: string;
|
|
215
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Human-readable name for the store. 1–255 characters. The store's mount-path slug
|
|
235
|
+
* under `/mnt/memory/` is derived from this name.
|
|
236
|
+
*/
|
|
216
237
|
name: string;
|
|
217
238
|
|
|
218
239
|
type: 'memory_store';
|
|
@@ -227,24 +248,41 @@ export interface BetaManagedAgentsMemoryStore {
|
|
|
227
248
|
*/
|
|
228
249
|
archived_at?: string | null;
|
|
229
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Free-text description of what the store contains, up to 1024 characters.
|
|
253
|
+
* Included in the agent's system prompt when the store is attached, so word it to
|
|
254
|
+
* be useful to the agent. Empty string when unset.
|
|
255
|
+
*/
|
|
230
256
|
description?: string;
|
|
231
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Arbitrary key-value tags for your own bookkeeping (such as the end user a store
|
|
260
|
+
* belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters.
|
|
261
|
+
* Returned on retrieve/list but not filterable.
|
|
262
|
+
*/
|
|
232
263
|
metadata?: { [key: string]: string };
|
|
233
264
|
}
|
|
234
265
|
|
|
235
266
|
export interface MemoryStoreCreateParams {
|
|
236
267
|
/**
|
|
237
|
-
* Body param
|
|
268
|
+
* Body param: Human-readable name for the store. Required; 1–255 characters; no
|
|
269
|
+
* control characters. The mount-path slug under `/mnt/memory/` is derived from
|
|
270
|
+
* this name (lowercased, non-alphanumeric runs collapsed to a hyphen). Names need
|
|
271
|
+
* not be unique within a workspace.
|
|
238
272
|
*/
|
|
239
273
|
name: string;
|
|
240
274
|
|
|
241
275
|
/**
|
|
242
|
-
* Body param
|
|
276
|
+
* Body param: Free-text description of what the store contains, up to 1024
|
|
277
|
+
* characters. Included in the agent's system prompt when the store is attached, so
|
|
278
|
+
* word it to be useful to the agent.
|
|
243
279
|
*/
|
|
244
280
|
description?: string;
|
|
245
281
|
|
|
246
282
|
/**
|
|
247
|
-
* Body param
|
|
283
|
+
* Body param: Arbitrary key-value tags for your own bookkeeping (such as the end
|
|
284
|
+
* user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512
|
|
285
|
+
* characters. Not visible to the agent.
|
|
248
286
|
*/
|
|
249
287
|
metadata?: { [key: string]: string };
|
|
250
288
|
|
|
@@ -263,7 +301,8 @@ export interface MemoryStoreRetrieveParams {
|
|
|
263
301
|
|
|
264
302
|
export interface MemoryStoreUpdateParams {
|
|
265
303
|
/**
|
|
266
|
-
* Body param
|
|
304
|
+
* Body param: New description for the store, up to 1024 characters. Pass an empty
|
|
305
|
+
* string to clear it.
|
|
267
306
|
*/
|
|
268
307
|
description?: string | null;
|
|
269
308
|
|
|
@@ -275,7 +314,9 @@ export interface MemoryStoreUpdateParams {
|
|
|
275
314
|
metadata?: { [key: string]: string | null } | null;
|
|
276
315
|
|
|
277
316
|
/**
|
|
278
|
-
* Body param
|
|
317
|
+
* Body param: New human-readable name for the store. 1–255 characters; no control
|
|
318
|
+
* characters. Renaming changes the slug used for the store's `mount_path` in
|
|
319
|
+
* sessions created after the update.
|
|
279
320
|
*/
|
|
280
321
|
name?: string | null;
|
|
281
322
|
|
|
@@ -287,17 +328,20 @@ export interface MemoryStoreUpdateParams {
|
|
|
287
328
|
|
|
288
329
|
export interface MemoryStoreListParams extends PageCursorParams {
|
|
289
330
|
/**
|
|
290
|
-
* Query param: Return stores
|
|
331
|
+
* Query param: Return only stores whose `created_at` is at or after this time
|
|
332
|
+
* (inclusive). Sent on the wire as `created_at[gte]`.
|
|
291
333
|
*/
|
|
292
334
|
'created_at[gte]'?: string;
|
|
293
335
|
|
|
294
336
|
/**
|
|
295
|
-
* Query param: Return stores
|
|
337
|
+
* Query param: Return only stores whose `created_at` is at or before this time
|
|
338
|
+
* (inclusive). Sent on the wire as `created_at[lte]`.
|
|
296
339
|
*/
|
|
297
340
|
'created_at[lte]'?: string;
|
|
298
341
|
|
|
299
342
|
/**
|
|
300
|
-
* Query param:
|
|
343
|
+
* Query param: When `true`, archived stores are included in the results. Defaults
|
|
344
|
+
* to `false` (archived stores are excluded).
|
|
301
345
|
*/
|
|
302
346
|
include_archived?: boolean;
|
|
303
347
|
|
|
@@ -11,7 +11,7 @@ import { path } from '../../../internal/utils/path';
|
|
|
11
11
|
|
|
12
12
|
export class MemoryVersions extends APIResource {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Retrieve a memory version
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
@@ -42,7 +42,7 @@ export class MemoryVersions extends APIResource {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* List memory versions
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* ```ts
|
|
@@ -75,7 +75,7 @@ export class MemoryVersions extends APIResource {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Redact a memory version
|
|
79
79
|
*
|
|
80
80
|
* @example
|
|
81
81
|
* ```ts
|
|
@@ -107,18 +107,44 @@ export class MemoryVersions extends APIResource {
|
|
|
107
107
|
|
|
108
108
|
export type BetaManagedAgentsMemoryVersionsPageCursor = PageCursor<BetaManagedAgentsMemoryVersion>;
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Identifies who performed a write or redact operation. Captured at write time on
|
|
112
|
+
* the `memory_version` row. The API key that created a session is not recorded on
|
|
113
|
+
* agent writes; attribution answers who made the write, not who is ultimately
|
|
114
|
+
* responsible. Look up session provenance separately via the
|
|
115
|
+
* [Sessions API](/en/api/sessions-retrieve).
|
|
116
|
+
*/
|
|
110
117
|
export type BetaManagedAgentsActor =
|
|
111
118
|
| BetaManagedAgentsSessionActor
|
|
112
119
|
| BetaManagedAgentsAPIActor
|
|
113
120
|
| BetaManagedAgentsUserActor;
|
|
114
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Attribution for a write made directly via the public API (outside of any
|
|
124
|
+
* session).
|
|
125
|
+
*/
|
|
115
126
|
export interface BetaManagedAgentsAPIActor {
|
|
127
|
+
/**
|
|
128
|
+
* ID of the API key that performed the write. This identifies the key, not the
|
|
129
|
+
* secret.
|
|
130
|
+
*/
|
|
116
131
|
api_key_id: string;
|
|
117
132
|
|
|
118
133
|
type: 'api_actor';
|
|
119
134
|
}
|
|
120
135
|
|
|
136
|
+
/**
|
|
137
|
+
* A `memory_version` object: one immutable, attributed row in a memory's
|
|
138
|
+
* append-only history. Every non-no-op mutation to a memory produces a new
|
|
139
|
+
* version. Versions belong to the store (not the individual memory) and persist
|
|
140
|
+
* after the memory is deleted. Retrieving a redacted version returns 200 with
|
|
141
|
+
* `content`, `path`, `content_size_bytes`, and `content_sha256` set to `null`;
|
|
142
|
+
* branch on `redacted_at`, not HTTP status.
|
|
143
|
+
*/
|
|
121
144
|
export interface BetaManagedAgentsMemoryVersion {
|
|
145
|
+
/**
|
|
146
|
+
* Unique identifier for this version (a `memver_...` value).
|
|
147
|
+
*/
|
|
122
148
|
id: string;
|
|
123
149
|
|
|
124
150
|
/**
|
|
@@ -126,25 +152,59 @@ export interface BetaManagedAgentsMemoryVersion {
|
|
|
126
152
|
*/
|
|
127
153
|
created_at: string;
|
|
128
154
|
|
|
155
|
+
/**
|
|
156
|
+
* ID of the memory this version snapshots (a `mem_...` value). Remains valid after
|
|
157
|
+
* the memory is deleted; pass it as `memory_id` to
|
|
158
|
+
* [List memory versions](/en/api/beta/memory_stores/memory_versions/list) to
|
|
159
|
+
* retrieve the full lineage including the `deleted` row.
|
|
160
|
+
*/
|
|
129
161
|
memory_id: string;
|
|
130
162
|
|
|
163
|
+
/**
|
|
164
|
+
* ID of the memory store this version belongs to (a `memstore_...` value).
|
|
165
|
+
*/
|
|
131
166
|
memory_store_id: string;
|
|
132
167
|
|
|
133
168
|
/**
|
|
134
|
-
*
|
|
169
|
+
* The kind of mutation a `memory_version` records. Every non-no-op mutation to a
|
|
170
|
+
* memory appends exactly one version row with one of these values.
|
|
135
171
|
*/
|
|
136
172
|
operation: BetaManagedAgentsMemoryVersionOperation;
|
|
137
173
|
|
|
138
174
|
type: 'memory_version';
|
|
139
175
|
|
|
176
|
+
/**
|
|
177
|
+
* The memory's UTF-8 text content as of this version. `null` when `view=basic`,
|
|
178
|
+
* when `operation` is `deleted`, or when `redacted_at` is set.
|
|
179
|
+
*/
|
|
140
180
|
content?: string | null;
|
|
141
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Lowercase hex SHA-256 digest of `content` as of this version (64 characters).
|
|
184
|
+
* `null` when `redacted_at` is set or `operation` is `deleted`. Populated
|
|
185
|
+
* regardless of `view` otherwise.
|
|
186
|
+
*/
|
|
142
187
|
content_sha256?: string | null;
|
|
143
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Size of `content` in bytes as of this version. `null` when `redacted_at` is set
|
|
191
|
+
* or `operation` is `deleted`. Populated regardless of `view` otherwise.
|
|
192
|
+
*/
|
|
144
193
|
content_size_bytes?: number | null;
|
|
145
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Identifies who performed a write or redact operation. Captured at write time on
|
|
197
|
+
* the `memory_version` row. The API key that created a session is not recorded on
|
|
198
|
+
* agent writes; attribution answers who made the write, not who is ultimately
|
|
199
|
+
* responsible. Look up session provenance separately via the
|
|
200
|
+
* [Sessions API](/en/api/sessions-retrieve).
|
|
201
|
+
*/
|
|
146
202
|
created_by?: BetaManagedAgentsActor;
|
|
147
203
|
|
|
204
|
+
/**
|
|
205
|
+
* The memory's path at the time of this write. `null` if and only if `redacted_at`
|
|
206
|
+
* is set.
|
|
207
|
+
*/
|
|
148
208
|
path?: string | null;
|
|
149
209
|
|
|
150
210
|
/**
|
|
@@ -152,23 +212,46 @@ export interface BetaManagedAgentsMemoryVersion {
|
|
|
152
212
|
*/
|
|
153
213
|
redacted_at?: string | null;
|
|
154
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Identifies who performed a write or redact operation. Captured at write time on
|
|
217
|
+
* the `memory_version` row. The API key that created a session is not recorded on
|
|
218
|
+
* agent writes; attribution answers who made the write, not who is ultimately
|
|
219
|
+
* responsible. Look up session provenance separately via the
|
|
220
|
+
* [Sessions API](/en/api/sessions-retrieve).
|
|
221
|
+
*/
|
|
155
222
|
redacted_by?: BetaManagedAgentsActor;
|
|
156
223
|
}
|
|
157
224
|
|
|
158
225
|
/**
|
|
159
|
-
*
|
|
226
|
+
* The kind of mutation a `memory_version` records. Every non-no-op mutation to a
|
|
227
|
+
* memory appends exactly one version row with one of these values.
|
|
160
228
|
*/
|
|
161
229
|
export type BetaManagedAgentsMemoryVersionOperation = 'created' | 'modified' | 'deleted';
|
|
162
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Attribution for a write made by an agent during a session, through the mounted
|
|
233
|
+
* filesystem at `/mnt/memory/`.
|
|
234
|
+
*/
|
|
163
235
|
export interface BetaManagedAgentsSessionActor {
|
|
236
|
+
/**
|
|
237
|
+
* ID of the session that performed the write (a `sesn_...` value). Look up the
|
|
238
|
+
* session via [Retrieve a session](/en/api/sessions-retrieve) for further
|
|
239
|
+
* provenance.
|
|
240
|
+
*/
|
|
164
241
|
session_id: string;
|
|
165
242
|
|
|
166
243
|
type: 'session_actor';
|
|
167
244
|
}
|
|
168
245
|
|
|
246
|
+
/**
|
|
247
|
+
* Attribution for a write made by a human user through the Anthropic Console.
|
|
248
|
+
*/
|
|
169
249
|
export interface BetaManagedAgentsUserActor {
|
|
170
250
|
type: 'user_actor';
|
|
171
251
|
|
|
252
|
+
/**
|
|
253
|
+
* ID of the user who performed the write (a `user_...` value).
|
|
254
|
+
*/
|
|
172
255
|
user_id: string;
|
|
173
256
|
}
|
|
174
257
|
|
|
@@ -459,6 +459,10 @@ export namespace BatchCreateParams {
|
|
|
459
459
|
* Note that our models may stop _before_ reaching this maximum. This parameter
|
|
460
460
|
* only specifies the absolute maximum number of tokens to generate.
|
|
461
461
|
*
|
|
462
|
+
* Set to `0` to populate the
|
|
463
|
+
* [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache)
|
|
464
|
+
* without generating a response.
|
|
465
|
+
*
|
|
462
466
|
* Different models have different maximum values for this parameter. See
|
|
463
467
|
* [models](https://docs.claude.com/en/docs/models-overview) for details.
|
|
464
468
|
*/
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { AnthropicError } from '../../../error';
|
|
4
4
|
import { Anthropic } from '../../../client';
|
|
5
|
+
import * as BatchesAPI from './batches';
|
|
5
6
|
import { APIPromise } from '../../../core/api-promise';
|
|
6
7
|
import { APIResource } from '../../../core/resource';
|
|
7
8
|
import { Stream } from '../../../core/streaming';
|
|
@@ -25,7 +26,6 @@ import type { Model } from '../../messages/messages';
|
|
|
25
26
|
import * as BetaMessagesAPI from './messages';
|
|
26
27
|
import * as MessagesAPI from '../../messages/messages';
|
|
27
28
|
import * as BetaAPI from '../beta';
|
|
28
|
-
import * as BatchesAPI from './batches';
|
|
29
29
|
import {
|
|
30
30
|
BatchCancelParams,
|
|
31
31
|
BatchCreateParams,
|
|
@@ -3755,6 +3755,10 @@ export interface MessageCreateParamsBase {
|
|
|
3755
3755
|
* Note that our models may stop _before_ reaching this maximum. This parameter
|
|
3756
3756
|
* only specifies the absolute maximum number of tokens to generate.
|
|
3757
3757
|
*
|
|
3758
|
+
* Set to `0` to populate the
|
|
3759
|
+
* [prompt cache](https://docs.claude.com/en/docs/build-with-claude/prompt-caching#pre-warming-the-cache)
|
|
3760
|
+
* without generating a response.
|
|
3761
|
+
*
|
|
3758
3762
|
* Different models have different maximum values for this parameter. See
|
|
3759
3763
|
* [models](https://docs.claude.com/en/docs/models-overview) for details.
|
|
3760
3764
|
*/
|
|
@@ -626,6 +626,12 @@ export interface SessionListParams extends PageCursorParams {
|
|
|
626
626
|
*/
|
|
627
627
|
include_archived?: boolean;
|
|
628
628
|
|
|
629
|
+
/**
|
|
630
|
+
* Query param: Filter sessions whose resources contain a memory_store with this
|
|
631
|
+
* memory store ID.
|
|
632
|
+
*/
|
|
633
|
+
memory_store_id?: string;
|
|
634
|
+
|
|
629
635
|
/**
|
|
630
636
|
* Query param: Sort direction for results, ordered by created_at. Defaults to desc
|
|
631
637
|
* (newest first).
|