@letta-ai/letta-client 1.0.0-alpha.12 → 1.0.0-alpha.14

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 (75) hide show
  1. package/CHANGELOG.md +26 -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 +2 -2
  20. package/resources/agents/agents.d.mts.map +1 -1
  21. package/resources/agents/agents.d.ts +2 -2
  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 +1 -1
  34. package/resources/agents/index.d.mts.map +1 -1
  35. package/resources/agents/index.d.ts +1 -1
  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/groups/messages.d.mts +2 -1
  40. package/resources/groups/messages.d.mts.map +1 -1
  41. package/resources/groups/messages.d.ts +2 -1
  42. package/resources/groups/messages.d.ts.map +1 -1
  43. package/resources/groups/messages.js +5 -1
  44. package/resources/groups/messages.js.map +1 -1
  45. package/resources/groups/messages.mjs +5 -1
  46. package/resources/groups/messages.mjs.map +1 -1
  47. package/resources/runs/messages.d.mts +2 -1
  48. package/resources/runs/messages.d.mts.map +1 -1
  49. package/resources/runs/messages.d.ts +2 -1
  50. package/resources/runs/messages.d.ts.map +1 -1
  51. package/resources/runs/messages.js +5 -1
  52. package/resources/runs/messages.js.map +1 -1
  53. package/resources/runs/messages.mjs +5 -1
  54. package/resources/runs/messages.mjs.map +1 -1
  55. package/resources/templates/agents.d.mts +9 -14
  56. package/resources/templates/agents.d.mts.map +1 -1
  57. package/resources/templates/agents.d.ts +9 -14
  58. package/resources/templates/agents.d.ts.map +1 -1
  59. package/resources/templates/agents.js +2 -3
  60. package/resources/templates/agents.js.map +1 -1
  61. package/resources/templates/agents.mjs +2 -3
  62. package/resources/templates/agents.mjs.map +1 -1
  63. package/src/client.ts +13 -1
  64. package/src/core/pagination.ts +7 -7
  65. package/src/resources/agents/agents.ts +2 -0
  66. package/src/resources/agents/files.ts +47 -90
  67. package/src/resources/agents/index.ts +1 -0
  68. package/src/resources/groups/messages.ts +11 -2
  69. package/src/resources/runs/messages.ts +8 -3
  70. package/src/resources/templates/agents.ts +14 -17
  71. package/src/version.ts +1 -1
  72. package/version.d.mts +1 -1
  73. package/version.d.ts +1 -1
  74. package/version.js +1 -1
  75. package/version.mjs +1 -1
@@ -5,40 +5,35 @@ export declare class Agents extends APIResource {
5
5
  /**
6
6
  * Creates an Agent or multiple Agents from a template
7
7
  */
8
- create(templateVersion: string, params: AgentCreateParams, options?: RequestOptions): APIPromise<void>;
8
+ create(templateVersion: string, body?: AgentCreateParams | null | undefined, options?: RequestOptions): APIPromise<void>;
9
9
  }
10
10
  export interface AgentCreateParams {
11
11
  /**
12
- * Path param: The project id
13
- */
14
- project_id: string;
15
- /**
16
- * Body param: The name of the agent, optional otherwise a random one will be
17
- * assigned
12
+ * The name of the agent, optional otherwise a random one will be assigned
18
13
  */
19
14
  agent_name?: string;
20
15
  /**
21
- * Body param: The identity ids to assign to the agent
16
+ * The identity ids to assign to the agent
22
17
  */
23
18
  identity_ids?: Array<string>;
24
19
  /**
25
- * Body param: Set an initial sequence of messages, if not provided, the agent will
26
- * start with the default message sequence, if an empty array is provided, the
27
- * agent will start with no messages
20
+ * Set an initial sequence of messages, if not provided, the agent will start with
21
+ * the default message sequence, if an empty array is provided, the agent will
22
+ * start with no messages
28
23
  */
29
24
  initial_message_sequence?: Array<AgentCreateParams.InitialMessageSequence>;
30
25
  /**
31
- * Body param: The memory variables to assign to the agent
26
+ * The memory variables to assign to the agent
32
27
  */
33
28
  memory_variables?: {
34
29
  [key: string]: string;
35
30
  };
36
31
  /**
37
- * Body param: The tags to assign to the agent
32
+ * The tags to assign to the agent
38
33
  */
39
34
  tags?: Array<string>;
40
35
  /**
41
- * Body param: The tool variables to assign to the agent
36
+ * The tool variables to assign to the agent
42
37
  */
43
38
  tool_variables?: {
44
39
  [key: string]: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/resources/templates/agents.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAQvG;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;IAE3E;;OAEG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAE7C;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,sBAAsB;QACrC,OAAO,EAAE,MAAM,CAAC;QAEhB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;QAEtC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CACF;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,iBAAiB,IAAI,iBAAiB,EAAE,CAAC;CACxD"}
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/resources/templates/agents.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,MAAM,CACJ,eAAe,EAAE,MAAM,EACvB,IAAI,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAC/C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,IAAI,CAAC;CAOpB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;IAE3E;;OAEG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAE7C;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,sBAAsB;QACrC,OAAO,EAAE,MAAM,CAAC;QAEhB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;QAEtC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAErB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CACF;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,iBAAiB,IAAI,iBAAiB,EAAE,CAAC;CACxD"}
@@ -9,9 +9,8 @@ class Agents extends resource_1.APIResource {
9
9
  /**
10
10
  * Creates an Agent or multiple Agents from a template
11
11
  */
12
- create(templateVersion, params, options) {
13
- const { project_id, ...body } = params;
14
- return this._client.post((0, path_1.path) `/v1/templates/${project_id}/${templateVersion}/agents`, {
12
+ create(templateVersion, body = {}, options) {
13
+ return this._client.post((0, path_1.path) `/v1/templates/${templateVersion}/agents`, {
15
14
  body,
16
15
  ...options,
17
16
  headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/resources/templates/agents.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,MAAO,SAAQ,sBAAW;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,IAAA,WAAI,EAAA,iBAAiB,UAAU,IAAI,eAAe,SAAS,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAZD,wBAYC"}
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/resources/templates/agents.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;OAEG;IACH,MAAM,CACJ,eAAuB,EACvB,OAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,eAAe,SAAS,EAAE;YACtE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAfD,wBAeC"}
@@ -6,9 +6,8 @@ export class Agents extends APIResource {
6
6
  /**
7
7
  * Creates an Agent or multiple Agents from a template
8
8
  */
9
- create(templateVersion, params, options) {
10
- const { project_id, ...body } = params;
11
- return this._client.post(path `/v1/templates/${project_id}/${templateVersion}/agents`, {
9
+ create(templateVersion, body = {}, options) {
10
+ return this._client.post(path `/v1/templates/${templateVersion}/agents`, {
12
11
  body,
13
12
  ...options,
14
13
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
@@ -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,
@@ -1709,6 +1710,7 @@ export declare namespace Agents {
1709
1710
  type FileCloseResponse as FileCloseResponse,
1710
1711
  type FileCloseAllResponse as FileCloseAllResponse,
1711
1712
  type FileOpenResponse as FileOpenResponse,
1713
+ type FileListResponsesNextFilesPage as FileListResponsesNextFilesPage,
1712
1714
  type FileListParams as FileListParams,
1713
1715
  type FileCloseParams as FileCloseParams,
1714
1716
  type FileOpenParams as FileOpenParams,
@@ -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,
@@ -7,6 +7,7 @@ import * as MessagesAPI from '../agents/messages';
7
7
  import { LettaMessageUnionsArrayPage } from '../agents/messages';
8
8
  import { APIPromise } from '../../core/api-promise';
9
9
  import { ArrayPage, type ArrayPageParams, PagePromise } from '../../core/pagination';
10
+ import { Stream } from '../../core/streaming';
10
11
  import { RequestOptions } from '../../internal/request-options';
11
12
  import { path } from '../../internal/utils/path';
12
13
 
@@ -64,8 +65,16 @@ export class Messages extends APIResource {
64
65
  * specified pattern. It will stream the steps of the response always, and stream
65
66
  * the tokens if 'stream_tokens' is set to True.
66
67
  */
67
- stream(groupID: string, body: MessageStreamParams, options?: RequestOptions): APIPromise<unknown> {
68
- return this._client.post(path`/v1/groups/${groupID}/messages/stream`, { body, ...options });
68
+ stream(
69
+ groupID: string,
70
+ body: MessageStreamParams,
71
+ options?: RequestOptions,
72
+ ): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>> {
73
+ return this._client.post(path`/v1/groups/${groupID}/messages/stream`, {
74
+ body,
75
+ ...options,
76
+ stream: true,
77
+ }) as APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
69
78
  }
70
79
  }
71
80
 
@@ -5,6 +5,7 @@ import * as MessagesAPI from '../agents/messages';
5
5
  import { LettaMessageUnionsArrayPage } from '../agents/messages';
6
6
  import { APIPromise } from '../../core/api-promise';
7
7
  import { ArrayPage, type ArrayPageParams, PagePromise } from '../../core/pagination';
8
+ import { Stream } from '../../core/streaming';
8
9
  import { RequestOptions } from '../../internal/request-options';
9
10
  import { path } from '../../internal/utils/path';
10
11
 
@@ -29,10 +30,14 @@ export class Messages extends APIResource {
29
30
  */
30
31
  stream(
31
32
  runID: string,
32
- body: MessageStreamParams | null | undefined = {},
33
+ body: MessageStreamParams | undefined = {},
33
34
  options?: RequestOptions,
34
- ): APIPromise<unknown> {
35
- return this._client.post(path`/v1/runs/${runID}/stream`, { body, ...options });
35
+ ): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>> {
36
+ return this._client.post(path`/v1/runs/${runID}/stream`, {
37
+ body,
38
+ ...options,
39
+ stream: true,
40
+ }) as APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
36
41
  }
37
42
  }
38
43
 
@@ -10,9 +10,12 @@ export class Agents extends APIResource {
10
10
  /**
11
11
  * Creates an Agent or multiple Agents from a template
12
12
  */
13
- create(templateVersion: string, params: AgentCreateParams, options?: RequestOptions): APIPromise<void> {
14
- const { project_id, ...body } = params;
15
- return this._client.post(path`/v1/templates/${project_id}/${templateVersion}/agents`, {
13
+ create(
14
+ templateVersion: string,
15
+ body: AgentCreateParams | null | undefined = {},
16
+ options?: RequestOptions,
17
+ ): APIPromise<void> {
18
+ return this._client.post(path`/v1/templates/${templateVersion}/agents`, {
16
19
  body,
17
20
  ...options,
18
21
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
@@ -22,40 +25,34 @@ export class Agents extends APIResource {
22
25
 
23
26
  export interface AgentCreateParams {
24
27
  /**
25
- * Path param: The project id
26
- */
27
- project_id: string;
28
-
29
- /**
30
- * Body param: The name of the agent, optional otherwise a random one will be
31
- * assigned
28
+ * The name of the agent, optional otherwise a random one will be assigned
32
29
  */
33
30
  agent_name?: string;
34
31
 
35
32
  /**
36
- * Body param: The identity ids to assign to the agent
33
+ * The identity ids to assign to the agent
37
34
  */
38
35
  identity_ids?: Array<string>;
39
36
 
40
37
  /**
41
- * Body param: Set an initial sequence of messages, if not provided, the agent will
42
- * start with the default message sequence, if an empty array is provided, the
43
- * agent will start with no messages
38
+ * Set an initial sequence of messages, if not provided, the agent will start with
39
+ * the default message sequence, if an empty array is provided, the agent will
40
+ * start with no messages
44
41
  */
45
42
  initial_message_sequence?: Array<AgentCreateParams.InitialMessageSequence>;
46
43
 
47
44
  /**
48
- * Body param: The memory variables to assign to the agent
45
+ * The memory variables to assign to the agent
49
46
  */
50
47
  memory_variables?: { [key: string]: string };
51
48
 
52
49
  /**
53
- * Body param: The tags to assign to the agent
50
+ * The tags to assign to the agent
54
51
  */
55
52
  tags?: Array<string>;
56
53
 
57
54
  /**
58
- * Body param: The tool variables to assign to the agent
55
+ * The tool variables to assign to the agent
59
56
  */
60
57
  tool_variables?: { [key: string]: string };
61
58
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.0.0-alpha.12'; // x-release-please-version
1
+ export const VERSION = '1.0.0-alpha.14'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0-alpha.12";
1
+ export declare const VERSION = "1.0.0-alpha.14";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.0-alpha.12";
1
+ export declare const VERSION = "1.0.0-alpha.14";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.0.0-alpha.12'; // x-release-please-version
4
+ exports.VERSION = '1.0.0-alpha.14'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.0.0-alpha.12'; // x-release-please-version
1
+ export const VERSION = '1.0.0-alpha.14'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map