@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.
Files changed (79) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/client.d.mts +7 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js +7 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +7 -2
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +1 -1
  11. package/core/pagination.d.mts.map +1 -1
  12. package/core/pagination.d.ts +1 -1
  13. package/core/pagination.d.ts.map +1 -1
  14. package/core/pagination.js +6 -6
  15. package/core/pagination.js.map +1 -1
  16. package/core/pagination.mjs +6 -6
  17. package/core/pagination.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/agents/agents.d.mts +4 -4
  20. package/resources/agents/agents.d.mts.map +1 -1
  21. package/resources/agents/agents.d.ts +4 -4
  22. package/resources/agents/agents.d.ts.map +1 -1
  23. package/resources/agents/agents.js.map +1 -1
  24. package/resources/agents/agents.mjs.map +1 -1
  25. package/resources/agents/files.d.mts +39 -79
  26. package/resources/agents/files.d.mts.map +1 -1
  27. package/resources/agents/files.d.ts +39 -79
  28. package/resources/agents/files.d.ts.map +1 -1
  29. package/resources/agents/files.js +5 -1
  30. package/resources/agents/files.js.map +1 -1
  31. package/resources/agents/files.mjs +5 -1
  32. package/resources/agents/files.mjs.map +1 -1
  33. package/resources/agents/index.d.mts +2 -2
  34. package/resources/agents/index.d.mts.map +1 -1
  35. package/resources/agents/index.d.ts +2 -2
  36. package/resources/agents/index.d.ts.map +1 -1
  37. package/resources/agents/index.js.map +1 -1
  38. package/resources/agents/index.mjs.map +1 -1
  39. package/resources/agents/messages.d.mts +258 -21
  40. package/resources/agents/messages.d.mts.map +1 -1
  41. package/resources/agents/messages.d.ts +258 -21
  42. package/resources/agents/messages.d.ts.map +1 -1
  43. package/resources/batches/batches.d.mts +44 -4
  44. package/resources/batches/batches.d.mts.map +1 -1
  45. package/resources/batches/batches.d.ts +44 -4
  46. package/resources/batches/batches.d.ts.map +1 -1
  47. package/resources/batches/batches.js.map +1 -1
  48. package/resources/batches/batches.mjs.map +1 -1
  49. package/resources/groups/messages.d.mts +88 -8
  50. package/resources/groups/messages.d.mts.map +1 -1
  51. package/resources/groups/messages.d.ts +88 -8
  52. package/resources/groups/messages.d.ts.map +1 -1
  53. package/resources/steps/messages.d.mts +1 -1
  54. package/resources/steps/messages.d.mts.map +1 -1
  55. package/resources/steps/messages.d.ts +1 -1
  56. package/resources/steps/messages.d.ts.map +1 -1
  57. package/resources/templates/agents.d.mts +9 -14
  58. package/resources/templates/agents.d.mts.map +1 -1
  59. package/resources/templates/agents.d.ts +9 -14
  60. package/resources/templates/agents.d.ts.map +1 -1
  61. package/resources/templates/agents.js +2 -3
  62. package/resources/templates/agents.js.map +1 -1
  63. package/resources/templates/agents.mjs +2 -3
  64. package/resources/templates/agents.mjs.map +1 -1
  65. package/src/client.ts +13 -1
  66. package/src/core/pagination.ts +7 -7
  67. package/src/resources/agents/agents.ts +6 -0
  68. package/src/resources/agents/files.ts +47 -90
  69. package/src/resources/agents/index.ts +3 -0
  70. package/src/resources/agents/messages.ts +382 -23
  71. package/src/resources/batches/batches.ts +64 -5
  72. package/src/resources/groups/messages.ts +129 -9
  73. package/src/resources/steps/messages.ts +3 -1
  74. package/src/resources/templates/agents.ts +14 -17
  75. package/src/version.ts +1 -1
  76. package/version.d.mts +1 -1
  77. package/version.d.ts +1 -1
  78. package/version.js +1 -1
  79. 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,CAAC,eAAuB,EAAE,MAAyB,EAAE,OAAwB;QACjF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,IAAI,eAAe,SAAS,EAAE;YACpF,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"}
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,
@@ -264,7 +264,7 @@ export interface NextFilesPageParams {
264
264
  order_by?: string | null;
265
265
  }
266
266
 
267
- export class NextFilesPage<Item extends { next_cursor: string | null }>
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 nextCursor = files[files.length - 1]?.next_cursor;
308
- if (!nextCursor) {
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: nextCursor,
316
+ after: id,
317
317
  },
318
318
  };
319
319
  }
320
320
 
321
- const nextCursor = files[0]?.next_cursor;
322
- if (!nextCursor) {
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: nextCursor,
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
- ): APIPromise<FileListResponse> {
17
- return this._client.get(path`/v1/agents/${agentID}/files`, { query, ...options });
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
- * Paginated response for agent files
61
+ * Response model for agent file attachments showing file status in agent context
56
62
  */
57
63
  export interface FileListResponse {
58
64
  /**
59
- * List of file attachments for the agent
65
+ * Unique identifier of the file-agent relationship
60
66
  */
61
- files: Array<FileListResponse.File>;
67
+ id: string;
62
68
 
63
69
  /**
64
- * Whether more results exist after this page
70
+ * Unique identifier of the file
65
71
  */
66
- has_more: boolean;
72
+ file_id: string;
67
73
 
68
74
  /**
69
- * Cursor for fetching the next page (file-agent relationship ID)
75
+ * Name of the file
70
76
  */
71
- next_cursor?: string | null;
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
- export type FileCloseAllResponse = Array<string>;
79
+ /**
80
+ * Unique identifier of the folder/source
81
+ */
82
+ folder_id: string;
134
83
 
135
- export type FileOpenResponse = Array<string>;
84
+ /**
85
+ * Name of the folder/source
86
+ */
87
+ folder_name: string;
136
88
 
137
- export interface FileListParams {
138
89
  /**
139
- * File ID cursor for pagination. Returns files that come after this file ID in the
140
- * specified sort order
90
+ * Whether the file is currently open in the agent's context
141
91
  */
142
- after?: string | null;
92
+ is_open: boolean;
143
93
 
144
94
  /**
145
- * File ID cursor for pagination. Returns files that come before this file ID in
146
- * the specified sort order
95
+ * Ending line number if file was opened with line range
147
96
  */
148
- before?: string | null;
97
+ end_line?: number | null;
149
98
 
150
99
  /**
151
- * @deprecated Pagination cursor from previous response (deprecated, use
152
- * before/after)
100
+ * Timestamp of last access by the agent
153
101
  */
154
- cursor?: string | null;
102
+ last_accessed_at?: string | null;
155
103
 
156
104
  /**
157
- * Filter by open status (true for open files, false for closed files)
105
+ * Starting line number if file was opened with line range
158
106
  */
159
- is_open?: boolean | null;
107
+ start_line?: number | null;
160
108
 
161
109
  /**
162
- * Maximum number of files to return
110
+ * Portion of the file visible to the agent if open
163
111
  */
164
- limit?: number | null;
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
- * Sort order for files by creation time. 'asc' for oldest first, 'desc' for newest
168
- * first
123
+ * @deprecated Pagination cursor from previous response (deprecated, use
124
+ * before/after)
169
125
  */
170
- order?: 'asc' | 'desc';
126
+ cursor?: string | null;
171
127
 
172
128
  /**
173
- * Field to sort by
129
+ * Filter by open status (true for open files, false for closed files)
174
130
  */
175
- order_by?: 'created_at';
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,