@letta-ai/letta-client 1.0.0-alpha.13 → 1.0.0-alpha.15
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 +7 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -1
- package/client.d.ts.map +1 -1
- package/client.js +7 -2
- package/client.js.map +1 -1
- package/client.mjs +7 -2
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +1 -1
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +1 -1
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +6 -6
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +6 -6
- package/core/pagination.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agents/agents.d.mts +4 -4
- package/resources/agents/agents.d.mts.map +1 -1
- package/resources/agents/agents.d.ts +4 -4
- package/resources/agents/agents.d.ts.map +1 -1
- package/resources/agents/agents.js.map +1 -1
- package/resources/agents/agents.mjs.map +1 -1
- package/resources/agents/files.d.mts +39 -79
- package/resources/agents/files.d.mts.map +1 -1
- package/resources/agents/files.d.ts +39 -79
- package/resources/agents/files.d.ts.map +1 -1
- package/resources/agents/files.js +5 -1
- package/resources/agents/files.js.map +1 -1
- package/resources/agents/files.mjs +5 -1
- package/resources/agents/files.mjs.map +1 -1
- package/resources/agents/index.d.mts +2 -2
- package/resources/agents/index.d.mts.map +1 -1
- package/resources/agents/index.d.ts +2 -2
- package/resources/agents/index.d.ts.map +1 -1
- package/resources/agents/index.js.map +1 -1
- package/resources/agents/index.mjs.map +1 -1
- package/resources/agents/messages.d.mts +258 -21
- package/resources/agents/messages.d.mts.map +1 -1
- package/resources/agents/messages.d.ts +258 -21
- package/resources/agents/messages.d.ts.map +1 -1
- package/resources/batches/batches.d.mts +44 -4
- package/resources/batches/batches.d.mts.map +1 -1
- package/resources/batches/batches.d.ts +44 -4
- package/resources/batches/batches.d.ts.map +1 -1
- package/resources/batches/batches.js.map +1 -1
- package/resources/batches/batches.mjs.map +1 -1
- package/resources/groups/messages.d.mts +88 -8
- package/resources/groups/messages.d.mts.map +1 -1
- package/resources/groups/messages.d.ts +88 -8
- package/resources/groups/messages.d.ts.map +1 -1
- package/resources/steps/messages.d.mts +1 -1
- package/resources/steps/messages.d.mts.map +1 -1
- package/resources/steps/messages.d.ts +1 -1
- package/resources/steps/messages.d.ts.map +1 -1
- package/resources/templates/agents.d.mts +9 -14
- package/resources/templates/agents.d.mts.map +1 -1
- package/resources/templates/agents.d.ts +9 -14
- package/resources/templates/agents.d.ts.map +1 -1
- package/resources/templates/agents.js +2 -3
- package/resources/templates/agents.js.map +1 -1
- package/resources/templates/agents.mjs +2 -3
- package/resources/templates/agents.mjs.map +1 -1
- package/src/client.ts +13 -1
- package/src/core/pagination.ts +7 -7
- package/src/resources/agents/agents.ts +6 -0
- package/src/resources/agents/files.ts +47 -90
- package/src/resources/agents/index.ts +3 -0
- package/src/resources/agents/messages.ts +382 -23
- package/src/resources/batches/batches.ts +64 -5
- package/src/resources/groups/messages.ts +129 -9
- package/src/resources/steps/messages.ts +3 -1
- package/src/resources/templates/agents.ts +14 -17
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.mjs","sourceRoot":"","sources":["../../src/resources/templates/agents.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"agents.mjs","sourceRoot":"","sources":["../../src/resources/templates/agents.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,MAAM,CACJ,eAAuB,EACvB,OAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,eAAe,SAAS,EAAE;YACtE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -196,6 +196,11 @@ export interface ClientOptions {
|
|
|
196
196
|
|
|
197
197
|
projectID?: string | null | undefined;
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Deprecated, please use project_id instead.
|
|
201
|
+
*/
|
|
202
|
+
project?: string | null | undefined;
|
|
203
|
+
|
|
199
204
|
/**
|
|
200
205
|
* Specifies the environment to use for the API.
|
|
201
206
|
*
|
|
@@ -280,6 +285,7 @@ export interface ClientOptions {
|
|
|
280
285
|
export class Letta {
|
|
281
286
|
apiKey: string;
|
|
282
287
|
projectID: string | null;
|
|
288
|
+
project: string | null;
|
|
283
289
|
|
|
284
290
|
baseURL: string;
|
|
285
291
|
maxRetries: number;
|
|
@@ -298,6 +304,7 @@ export class Letta {
|
|
|
298
304
|
*
|
|
299
305
|
* @param {string | undefined} [opts.apiKey=process.env['LETTA_API_KEY'] ?? undefined]
|
|
300
306
|
* @param {string | null | undefined} [opts.projectID]
|
|
307
|
+
* @param {string | null | undefined} [opts.project]
|
|
301
308
|
* @param {Environment} [opts.environment=cloud] - Specifies the environment URL to use for the API.
|
|
302
309
|
* @param {string} [opts.baseURL=process.env['LETTA_BASE_URL'] ?? https://api.letta.com] - Override the default base URL for the API.
|
|
303
310
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
@@ -311,6 +318,7 @@ export class Letta {
|
|
|
311
318
|
baseURL = readEnv('LETTA_BASE_URL'),
|
|
312
319
|
apiKey = readEnv('LETTA_API_KEY'),
|
|
313
320
|
projectID = null,
|
|
321
|
+
project = null,
|
|
314
322
|
...opts
|
|
315
323
|
}: ClientOptions = {}) {
|
|
316
324
|
if (apiKey === undefined) {
|
|
@@ -322,6 +330,7 @@ export class Letta {
|
|
|
322
330
|
const options: ClientOptions = {
|
|
323
331
|
apiKey,
|
|
324
332
|
projectID,
|
|
333
|
+
project,
|
|
325
334
|
...opts,
|
|
326
335
|
baseURL,
|
|
327
336
|
environment: opts.environment ?? 'cloud',
|
|
@@ -352,6 +361,7 @@ export class Letta {
|
|
|
352
361
|
|
|
353
362
|
this.apiKey = apiKey;
|
|
354
363
|
this.projectID = projectID;
|
|
364
|
+
this.project = project;
|
|
355
365
|
}
|
|
356
366
|
|
|
357
367
|
/**
|
|
@@ -370,6 +380,7 @@ export class Letta {
|
|
|
370
380
|
fetchOptions: this.fetchOptions,
|
|
371
381
|
apiKey: this.apiKey,
|
|
372
382
|
projectID: this.projectID,
|
|
383
|
+
project: this.project,
|
|
373
384
|
...options,
|
|
374
385
|
});
|
|
375
386
|
return client;
|
|
@@ -840,7 +851,8 @@ export class Letta {
|
|
|
840
851
|
'X-Stainless-Retry-Count': String(retryCount),
|
|
841
852
|
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
842
853
|
...getPlatformHeaders(),
|
|
843
|
-
'X-Project': this.projectID,
|
|
854
|
+
'X-Project-Id': this.projectID,
|
|
855
|
+
'X-Project': this.project,
|
|
844
856
|
},
|
|
845
857
|
await this.authHeaders(options),
|
|
846
858
|
this._options.defaultHeaders,
|
package/src/core/pagination.ts
CHANGED
|
@@ -264,7 +264,7 @@ export interface NextFilesPageParams {
|
|
|
264
264
|
order_by?: string | null;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
export class NextFilesPage<Item extends {
|
|
267
|
+
export class NextFilesPage<Item extends { id: string }>
|
|
268
268
|
extends AbstractPage<Item>
|
|
269
269
|
implements NextFilesPageResponse<Item>
|
|
270
270
|
{
|
|
@@ -304,8 +304,8 @@ export class NextFilesPage<Item extends { next_cursor: string | null }>
|
|
|
304
304
|
|
|
305
305
|
const isForwards = !(typeof this.options.query === 'object' && 'before' in (this.options.query || {}));
|
|
306
306
|
if (isForwards) {
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
307
|
+
const id = files[files.length - 1]?.id;
|
|
308
|
+
if (!id) {
|
|
309
309
|
return null;
|
|
310
310
|
}
|
|
311
311
|
|
|
@@ -313,13 +313,13 @@ export class NextFilesPage<Item extends { next_cursor: string | null }>
|
|
|
313
313
|
...this.options,
|
|
314
314
|
query: {
|
|
315
315
|
...maybeObj(this.options.query),
|
|
316
|
-
after:
|
|
316
|
+
after: id,
|
|
317
317
|
},
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
const
|
|
322
|
-
if (!
|
|
321
|
+
const id = files[0]?.id;
|
|
322
|
+
if (!id) {
|
|
323
323
|
return null;
|
|
324
324
|
}
|
|
325
325
|
|
|
@@ -327,7 +327,7 @@ export class NextFilesPage<Item extends { next_cursor: string | null }>
|
|
|
327
327
|
...this.options,
|
|
328
328
|
query: {
|
|
329
329
|
...maybeObj(this.options.query),
|
|
330
|
-
before:
|
|
330
|
+
before: id,
|
|
331
331
|
},
|
|
332
332
|
};
|
|
333
333
|
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
FileCloseResponse,
|
|
23
23
|
FileListParams,
|
|
24
24
|
FileListResponse,
|
|
25
|
+
FileListResponsesNextFilesPage,
|
|
25
26
|
FileOpenParams,
|
|
26
27
|
FileOpenResponse,
|
|
27
28
|
Files,
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
ApprovalRequestMessage,
|
|
43
44
|
ApprovalResponseMessage,
|
|
44
45
|
AssistantMessage,
|
|
46
|
+
EventMessage,
|
|
45
47
|
HiddenReasoningMessage,
|
|
46
48
|
ImageContent,
|
|
47
49
|
JobStatus,
|
|
@@ -72,6 +74,7 @@ import {
|
|
|
72
74
|
ReasoningMessage,
|
|
73
75
|
RedactedReasoningContent,
|
|
74
76
|
Run,
|
|
77
|
+
SummaryMessage,
|
|
75
78
|
SystemMessage,
|
|
76
79
|
TextContent,
|
|
77
80
|
ToolCall,
|
|
@@ -1709,6 +1712,7 @@ export declare namespace Agents {
|
|
|
1709
1712
|
type FileCloseResponse as FileCloseResponse,
|
|
1710
1713
|
type FileCloseAllResponse as FileCloseAllResponse,
|
|
1711
1714
|
type FileOpenResponse as FileOpenResponse,
|
|
1715
|
+
type FileListResponsesNextFilesPage as FileListResponsesNextFilesPage,
|
|
1712
1716
|
type FileListParams as FileListParams,
|
|
1713
1717
|
type FileCloseParams as FileCloseParams,
|
|
1714
1718
|
type FileOpenParams as FileOpenParams,
|
|
@@ -1733,6 +1737,7 @@ export declare namespace Agents {
|
|
|
1733
1737
|
type ApprovalRequestMessage as ApprovalRequestMessage,
|
|
1734
1738
|
type ApprovalResponseMessage as ApprovalResponseMessage,
|
|
1735
1739
|
type AssistantMessage as AssistantMessage,
|
|
1740
|
+
type EventMessage as EventMessage,
|
|
1736
1741
|
type HiddenReasoningMessage as HiddenReasoningMessage,
|
|
1737
1742
|
type ImageContent as ImageContent,
|
|
1738
1743
|
type JobStatus as JobStatus,
|
|
@@ -1752,6 +1757,7 @@ export declare namespace Agents {
|
|
|
1752
1757
|
type ReasoningMessage as ReasoningMessage,
|
|
1753
1758
|
type RedactedReasoningContent as RedactedReasoningContent,
|
|
1754
1759
|
type Run as Run,
|
|
1760
|
+
type SummaryMessage as SummaryMessage,
|
|
1755
1761
|
type SystemMessage as SystemMessage,
|
|
1756
1762
|
type TextContent as TextContent,
|
|
1757
1763
|
type ToolCall as ToolCall,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { NextFilesPage, type NextFilesPageParams, PagePromise } from '../../core/pagination';
|
|
5
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
6
7
|
import { path } from '../../internal/utils/path';
|
|
7
8
|
|
|
@@ -13,8 +14,11 @@ export class Files extends APIResource {
|
|
|
13
14
|
agentID: string,
|
|
14
15
|
query: FileListParams | null | undefined = {},
|
|
15
16
|
options?: RequestOptions,
|
|
16
|
-
):
|
|
17
|
-
return this._client.
|
|
17
|
+
): PagePromise<FileListResponsesNextFilesPage, FileListResponse> {
|
|
18
|
+
return this._client.getAPIList(path`/v1/agents/${agentID}/files`, NextFilesPage<FileListResponse>, {
|
|
19
|
+
query,
|
|
20
|
+
...options,
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -51,128 +55,80 @@ export class Files extends APIResource {
|
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
|
|
58
|
+
export type FileListResponsesNextFilesPage = NextFilesPage<FileListResponse>;
|
|
59
|
+
|
|
54
60
|
/**
|
|
55
|
-
*
|
|
61
|
+
* Response model for agent file attachments showing file status in agent context
|
|
56
62
|
*/
|
|
57
63
|
export interface FileListResponse {
|
|
58
64
|
/**
|
|
59
|
-
*
|
|
65
|
+
* Unique identifier of the file-agent relationship
|
|
60
66
|
*/
|
|
61
|
-
|
|
67
|
+
id: string;
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
|
-
*
|
|
70
|
+
* Unique identifier of the file
|
|
65
71
|
*/
|
|
66
|
-
|
|
72
|
+
file_id: string;
|
|
67
73
|
|
|
68
74
|
/**
|
|
69
|
-
*
|
|
75
|
+
* Name of the file
|
|
70
76
|
*/
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export namespace FileListResponse {
|
|
75
|
-
/**
|
|
76
|
-
* Response model for agent file attachments showing file status in agent context
|
|
77
|
-
*/
|
|
78
|
-
export interface File {
|
|
79
|
-
/**
|
|
80
|
-
* Unique identifier of the file-agent relationship
|
|
81
|
-
*/
|
|
82
|
-
id: string;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Unique identifier of the file
|
|
86
|
-
*/
|
|
87
|
-
file_id: string;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Name of the file
|
|
91
|
-
*/
|
|
92
|
-
file_name: string;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Unique identifier of the folder/source
|
|
96
|
-
*/
|
|
97
|
-
folder_id: string;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Name of the folder/source
|
|
101
|
-
*/
|
|
102
|
-
folder_name: string;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Whether the file is currently open in the agent's context
|
|
106
|
-
*/
|
|
107
|
-
is_open: boolean;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Ending line number if file was opened with line range
|
|
111
|
-
*/
|
|
112
|
-
end_line?: number | null;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Timestamp of last access by the agent
|
|
116
|
-
*/
|
|
117
|
-
last_accessed_at?: string | null;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Starting line number if file was opened with line range
|
|
121
|
-
*/
|
|
122
|
-
start_line?: number | null;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Portion of the file visible to the agent if open
|
|
126
|
-
*/
|
|
127
|
-
visible_content?: string | null;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export type FileCloseResponse = unknown;
|
|
77
|
+
file_name: string;
|
|
132
78
|
|
|
133
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Unique identifier of the folder/source
|
|
81
|
+
*/
|
|
82
|
+
folder_id: string;
|
|
134
83
|
|
|
135
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Name of the folder/source
|
|
86
|
+
*/
|
|
87
|
+
folder_name: string;
|
|
136
88
|
|
|
137
|
-
export interface FileListParams {
|
|
138
89
|
/**
|
|
139
|
-
*
|
|
140
|
-
* specified sort order
|
|
90
|
+
* Whether the file is currently open in the agent's context
|
|
141
91
|
*/
|
|
142
|
-
|
|
92
|
+
is_open: boolean;
|
|
143
93
|
|
|
144
94
|
/**
|
|
145
|
-
*
|
|
146
|
-
* the specified sort order
|
|
95
|
+
* Ending line number if file was opened with line range
|
|
147
96
|
*/
|
|
148
|
-
|
|
97
|
+
end_line?: number | null;
|
|
149
98
|
|
|
150
99
|
/**
|
|
151
|
-
*
|
|
152
|
-
* before/after)
|
|
100
|
+
* Timestamp of last access by the agent
|
|
153
101
|
*/
|
|
154
|
-
|
|
102
|
+
last_accessed_at?: string | null;
|
|
155
103
|
|
|
156
104
|
/**
|
|
157
|
-
*
|
|
105
|
+
* Starting line number if file was opened with line range
|
|
158
106
|
*/
|
|
159
|
-
|
|
107
|
+
start_line?: number | null;
|
|
160
108
|
|
|
161
109
|
/**
|
|
162
|
-
*
|
|
110
|
+
* Portion of the file visible to the agent if open
|
|
163
111
|
*/
|
|
164
|
-
|
|
112
|
+
visible_content?: string | null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type FileCloseResponse = unknown;
|
|
116
|
+
|
|
117
|
+
export type FileCloseAllResponse = Array<string>;
|
|
165
118
|
|
|
119
|
+
export type FileOpenResponse = Array<string>;
|
|
120
|
+
|
|
121
|
+
export interface FileListParams extends NextFilesPageParams {
|
|
166
122
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
123
|
+
* @deprecated Pagination cursor from previous response (deprecated, use
|
|
124
|
+
* before/after)
|
|
169
125
|
*/
|
|
170
|
-
|
|
126
|
+
cursor?: string | null;
|
|
171
127
|
|
|
172
128
|
/**
|
|
173
|
-
*
|
|
129
|
+
* Filter by open status (true for open files, false for closed files)
|
|
174
130
|
*/
|
|
175
|
-
|
|
131
|
+
is_open?: boolean | null;
|
|
176
132
|
}
|
|
177
133
|
|
|
178
134
|
export interface FileCloseParams {
|
|
@@ -195,6 +151,7 @@ export declare namespace Files {
|
|
|
195
151
|
type FileCloseResponse as FileCloseResponse,
|
|
196
152
|
type FileCloseAllResponse as FileCloseAllResponse,
|
|
197
153
|
type FileOpenResponse as FileOpenResponse,
|
|
154
|
+
type FileListResponsesNextFilesPage as FileListResponsesNextFilesPage,
|
|
198
155
|
type FileListParams as FileListParams,
|
|
199
156
|
type FileCloseParams as FileCloseParams,
|
|
200
157
|
type FileOpenParams as FileOpenParams,
|
|
@@ -50,6 +50,7 @@ export {
|
|
|
50
50
|
type FileListParams,
|
|
51
51
|
type FileCloseParams,
|
|
52
52
|
type FileOpenParams,
|
|
53
|
+
type FileListResponsesNextFilesPage,
|
|
53
54
|
} from './files';
|
|
54
55
|
export {
|
|
55
56
|
Folders,
|
|
@@ -65,6 +66,7 @@ export {
|
|
|
65
66
|
type ApprovalRequestMessage,
|
|
66
67
|
type ApprovalResponseMessage,
|
|
67
68
|
type AssistantMessage,
|
|
69
|
+
type EventMessage,
|
|
68
70
|
type HiddenReasoningMessage,
|
|
69
71
|
type ImageContent,
|
|
70
72
|
type JobStatus,
|
|
@@ -84,6 +86,7 @@ export {
|
|
|
84
86
|
type ReasoningMessage,
|
|
85
87
|
type RedactedReasoningContent,
|
|
86
88
|
type Run,
|
|
89
|
+
type SummaryMessage,
|
|
87
90
|
type SystemMessage,
|
|
88
91
|
type TextContent,
|
|
89
92
|
type ToolCall,
|