@letta-ai/letta-client 0.1.14 → 0.1.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 (248) hide show
  1. package/api/resources/agents/client/Client.d.ts +6 -125
  2. package/api/resources/agents/client/Client.js +22 -626
  3. package/api/resources/agents/client/requests/index.d.ts +0 -2
  4. package/api/resources/agents/resources/archivalMemory/client/Client.d.ts +21 -4
  5. package/api/resources/agents/resources/archivalMemory/client/Client.js +104 -28
  6. package/api/resources/agents/resources/archivalMemory/client/index.d.ts +1 -1
  7. package/api/resources/agents/resources/archivalMemory/client/index.js +15 -0
  8. package/api/resources/agents/{client/requests/ListArchivalMemoryRequest.d.ts → resources/archivalMemory/client/requests/ArchivalMemoryListRequest.d.ts} +1 -1
  9. package/api/resources/agents/resources/archivalMemory/client/requests/index.d.ts +2 -0
  10. package/api/resources/agents/resources/archivalMemory/client/requests/index.js +2 -0
  11. package/api/resources/agents/resources/context/client/Client.js +1 -1
  12. package/api/resources/agents/resources/coreMemory/client/Client.d.ts +42 -15
  13. package/api/resources/agents/resources/coreMemory/client/Client.js +195 -64
  14. package/api/resources/agents/resources/index.d.ts +1 -0
  15. package/api/resources/agents/resources/index.js +1 -0
  16. package/api/resources/agents/resources/memoryVariables/client/Client.js +3 -3
  17. package/api/resources/agents/resources/messages/client/Client.d.ts +2 -2
  18. package/api/resources/agents/resources/messages/client/Client.js +7 -7
  19. package/api/resources/agents/resources/messages/client/requests/LettaStreamingRequest.d.ts +1 -1
  20. package/api/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -2
  21. package/api/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +8 -0
  22. package/api/resources/agents/resources/messages/types/index.d.ts +1 -0
  23. package/api/resources/agents/resources/messages/types/index.js +1 -0
  24. package/api/resources/agents/resources/sources/client/Client.js +3 -3
  25. package/api/resources/agents/resources/templates/client/Client.js +3 -3
  26. package/api/resources/agents/resources/tools/client/Client.js +3 -3
  27. package/api/resources/blocks/client/Client.d.ts +13 -0
  28. package/api/resources/blocks/client/Client.js +71 -5
  29. package/api/resources/health/client/Client.js +1 -1
  30. package/api/resources/jobs/client/Client.js +4 -4
  31. package/api/resources/models/client/Client.js +2 -2
  32. package/api/resources/providers/client/Client.js +4 -4
  33. package/api/resources/runs/client/Client.js +6 -6
  34. package/api/resources/sources/client/Client.js +6 -6
  35. package/api/resources/sources/resources/files/client/Client.js +3 -3
  36. package/api/resources/sources/resources/passages/client/Client.js +1 -1
  37. package/api/resources/tag/client/Client.js +1 -1
  38. package/api/resources/tools/client/Client.js +11 -11
  39. package/api/types/AssistantMessage.d.ts +2 -1
  40. package/api/types/AssistantMessageContent.d.ts +5 -0
  41. package/api/types/LlmConfig.d.ts +3 -0
  42. package/api/types/Message.d.ts +2 -2
  43. package/api/types/MessageCreate.d.ts +2 -2
  44. package/api/types/MessageCreateContent.d.ts +8 -0
  45. package/api/types/MessageCreateContent.js +5 -0
  46. package/api/types/SystemMessage.d.ts +3 -2
  47. package/api/types/SystemMessageContent.d.ts +5 -0
  48. package/api/types/SystemMessageContent.js +5 -0
  49. package/api/types/TextContent.d.ts +8 -0
  50. package/api/types/TextContent.js +5 -0
  51. package/api/types/UserMessage.d.ts +3 -2
  52. package/api/types/UserMessageContent.d.ts +5 -0
  53. package/api/types/UserMessageContent.js +5 -0
  54. package/api/types/index.d.ts +5 -0
  55. package/api/types/index.js +5 -0
  56. package/dist/api/resources/agents/client/Client.d.ts +6 -125
  57. package/dist/api/resources/agents/client/Client.js +22 -626
  58. package/dist/api/resources/agents/client/requests/index.d.ts +0 -2
  59. package/dist/api/resources/agents/resources/archivalMemory/client/Client.d.ts +21 -4
  60. package/dist/api/resources/agents/resources/archivalMemory/client/Client.js +104 -28
  61. package/dist/api/resources/agents/resources/archivalMemory/client/index.d.ts +1 -1
  62. package/dist/api/resources/agents/resources/archivalMemory/client/index.js +15 -0
  63. package/dist/api/resources/agents/{client/requests/ListArchivalMemoryRequest.d.ts → resources/archivalMemory/client/requests/ArchivalMemoryListRequest.d.ts} +1 -1
  64. package/dist/api/resources/agents/resources/archivalMemory/client/requests/ArchivalMemoryListRequest.js +5 -0
  65. package/dist/api/resources/agents/resources/archivalMemory/client/requests/CreateArchivalMemory.js +5 -0
  66. package/dist/api/resources/agents/resources/archivalMemory/client/requests/index.d.ts +2 -0
  67. package/dist/api/resources/agents/resources/archivalMemory/client/requests/index.js +2 -0
  68. package/dist/api/resources/agents/resources/context/client/Client.js +1 -1
  69. package/dist/api/resources/agents/resources/coreMemory/client/Client.d.ts +42 -15
  70. package/dist/api/resources/agents/resources/coreMemory/client/Client.js +195 -64
  71. package/dist/api/resources/agents/resources/index.d.ts +1 -0
  72. package/dist/api/resources/agents/resources/index.js +1 -0
  73. package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +3 -3
  74. package/dist/api/resources/agents/resources/messages/client/Client.d.ts +2 -2
  75. package/dist/api/resources/agents/resources/messages/client/Client.js +7 -7
  76. package/dist/api/resources/agents/resources/messages/client/requests/LettaStreamingRequest.d.ts +1 -1
  77. package/dist/api/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -2
  78. package/dist/api/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +8 -0
  79. package/dist/api/resources/agents/resources/messages/types/MessageUpdateContent.js +5 -0
  80. package/dist/api/resources/agents/resources/messages/types/index.d.ts +1 -0
  81. package/dist/api/resources/agents/resources/messages/types/index.js +1 -0
  82. package/dist/api/resources/agents/resources/sources/client/Client.js +3 -3
  83. package/dist/api/resources/agents/resources/templates/client/Client.js +3 -3
  84. package/dist/api/resources/agents/resources/tools/client/Client.js +3 -3
  85. package/dist/api/resources/blocks/client/Client.d.ts +13 -0
  86. package/dist/api/resources/blocks/client/Client.js +71 -5
  87. package/dist/api/resources/health/client/Client.js +1 -1
  88. package/dist/api/resources/jobs/client/Client.js +4 -4
  89. package/dist/api/resources/models/client/Client.js +2 -2
  90. package/dist/api/resources/providers/client/Client.js +4 -4
  91. package/dist/api/resources/runs/client/Client.js +6 -6
  92. package/dist/api/resources/sources/client/Client.js +6 -6
  93. package/dist/api/resources/sources/resources/files/client/Client.js +3 -3
  94. package/dist/api/resources/sources/resources/passages/client/Client.js +1 -1
  95. package/dist/api/resources/tag/client/Client.js +1 -1
  96. package/dist/api/resources/tools/client/Client.js +11 -11
  97. package/dist/api/types/AssistantMessage.d.ts +2 -1
  98. package/dist/api/types/AssistantMessageContent.d.ts +5 -0
  99. package/dist/api/types/AssistantMessageContent.js +5 -0
  100. package/dist/api/types/LlmConfig.d.ts +3 -0
  101. package/dist/api/types/Message.d.ts +2 -2
  102. package/dist/api/types/MessageCreate.d.ts +2 -2
  103. package/dist/api/types/MessageCreateContent.d.ts +8 -0
  104. package/dist/api/types/MessageCreateContent.js +5 -0
  105. package/dist/api/types/SystemMessage.d.ts +3 -2
  106. package/dist/api/types/SystemMessageContent.d.ts +5 -0
  107. package/dist/api/types/SystemMessageContent.js +5 -0
  108. package/dist/api/types/TextContent.d.ts +8 -0
  109. package/dist/api/types/TextContent.js +5 -0
  110. package/dist/api/types/UserMessage.d.ts +3 -2
  111. package/dist/api/types/UserMessageContent.d.ts +5 -0
  112. package/dist/api/types/UserMessageContent.js +5 -0
  113. package/dist/api/types/index.d.ts +5 -0
  114. package/dist/api/types/index.js +5 -0
  115. package/dist/serialization/resources/agents/client/index.d.ts +0 -3
  116. package/dist/serialization/resources/agents/client/index.js +1 -4
  117. package/dist/serialization/resources/agents/client/requests/index.d.ts +0 -1
  118. package/dist/serialization/resources/agents/client/requests/index.js +1 -3
  119. package/dist/serialization/resources/agents/resources/archivalMemory/client/create.d.ts +11 -0
  120. package/dist/serialization/resources/agents/{client/createArchivalMemory.js → resources/archivalMemory/client/create.js} +2 -2
  121. package/dist/serialization/resources/agents/resources/archivalMemory/client/index.d.ts +3 -0
  122. package/dist/serialization/resources/agents/resources/archivalMemory/client/index.js +42 -0
  123. package/dist/serialization/resources/agents/resources/archivalMemory/client/list.d.ts +11 -0
  124. package/dist/serialization/resources/agents/{client/listArchivalMemory.js → resources/archivalMemory/client/list.js} +2 -2
  125. package/dist/serialization/resources/agents/resources/archivalMemory/client/requests/CreateArchivalMemory.d.ts +12 -0
  126. package/{serialization/resources/agents → dist/serialization/resources/agents/resources/archivalMemory}/client/requests/CreateArchivalMemory.js +1 -1
  127. package/dist/serialization/resources/agents/resources/archivalMemory/client/requests/index.d.ts +1 -0
  128. package/dist/serialization/resources/agents/resources/archivalMemory/client/requests/index.js +5 -0
  129. package/dist/serialization/resources/agents/resources/archivalMemory/index.d.ts +1 -0
  130. package/dist/serialization/resources/agents/resources/archivalMemory/index.js +17 -0
  131. package/dist/serialization/resources/agents/resources/coreMemory/client/index.d.ts +1 -0
  132. package/dist/serialization/resources/agents/resources/coreMemory/client/index.js +37 -0
  133. package/dist/serialization/resources/agents/resources/coreMemory/client/listBlocks.d.ts +11 -0
  134. package/{serialization/resources/agents/client/listCoreMemoryBlocks.js → dist/serialization/resources/agents/resources/coreMemory/client/listBlocks.js} +2 -2
  135. package/dist/serialization/resources/agents/resources/coreMemory/index.d.ts +1 -0
  136. package/dist/serialization/resources/agents/resources/coreMemory/index.js +17 -0
  137. package/dist/serialization/resources/agents/resources/index.d.ts +3 -0
  138. package/dist/serialization/resources/agents/resources/index.js +4 -1
  139. package/dist/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -1
  140. package/dist/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.js +2 -1
  141. package/dist/serialization/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +11 -0
  142. package/dist/serialization/resources/agents/resources/messages/types/MessageUpdateContent.js +42 -0
  143. package/dist/serialization/resources/agents/resources/messages/types/index.d.ts +1 -0
  144. package/dist/serialization/resources/agents/resources/messages/types/index.js +1 -0
  145. package/dist/serialization/resources/blocks/client/index.d.ts +1 -0
  146. package/dist/serialization/resources/blocks/client/index.js +2 -1
  147. package/dist/serialization/resources/{agents/client/createArchivalMemory.d.ts → blocks/client/listAgentsForBlock.d.ts} +3 -3
  148. package/dist/serialization/resources/blocks/client/listAgentsForBlock.js +42 -0
  149. package/dist/serialization/types/AssistantMessage.d.ts +2 -1
  150. package/dist/serialization/types/AssistantMessage.js +2 -1
  151. package/dist/serialization/types/AssistantMessageContent.d.ts +11 -0
  152. package/dist/serialization/types/AssistantMessageContent.js +42 -0
  153. package/dist/serialization/types/LlmConfig.d.ts +1 -0
  154. package/dist/serialization/types/LlmConfig.js +1 -0
  155. package/dist/serialization/types/Message.d.ts +2 -1
  156. package/dist/serialization/types/Message.js +2 -1
  157. package/dist/serialization/types/MessageCreate.d.ts +2 -1
  158. package/dist/serialization/types/MessageCreate.js +2 -1
  159. package/dist/serialization/types/MessageCreateContent.d.ts +11 -0
  160. package/dist/serialization/types/MessageCreateContent.js +42 -0
  161. package/dist/serialization/types/SystemMessage.d.ts +2 -1
  162. package/dist/serialization/types/SystemMessage.js +2 -1
  163. package/dist/serialization/types/SystemMessageContent.d.ts +11 -0
  164. package/dist/serialization/types/SystemMessageContent.js +42 -0
  165. package/dist/serialization/types/TextContent.d.ts +13 -0
  166. package/dist/serialization/types/TextContent.js +44 -0
  167. package/dist/serialization/types/UserMessage.d.ts +2 -1
  168. package/dist/serialization/types/UserMessage.js +2 -1
  169. package/dist/serialization/types/UserMessageContent.d.ts +11 -0
  170. package/dist/serialization/types/UserMessageContent.js +42 -0
  171. package/dist/serialization/types/index.d.ts +5 -0
  172. package/dist/serialization/types/index.js +5 -0
  173. package/dist/version.d.ts +1 -1
  174. package/dist/version.js +1 -1
  175. package/package.json +1 -1
  176. package/reference.md +487 -895
  177. package/serialization/resources/agents/client/index.d.ts +0 -3
  178. package/serialization/resources/agents/client/index.js +1 -4
  179. package/serialization/resources/agents/client/requests/index.d.ts +0 -1
  180. package/serialization/resources/agents/client/requests/index.js +1 -3
  181. package/serialization/resources/agents/resources/archivalMemory/client/create.d.ts +11 -0
  182. package/serialization/resources/agents/{client/listArchivalMemory.js → resources/archivalMemory/client/create.js} +2 -2
  183. package/serialization/resources/agents/resources/archivalMemory/client/index.d.ts +3 -0
  184. package/serialization/resources/agents/resources/archivalMemory/client/index.js +42 -0
  185. package/serialization/resources/agents/resources/archivalMemory/client/list.d.ts +11 -0
  186. package/serialization/resources/agents/{client/createArchivalMemory.js → resources/archivalMemory/client/list.js} +2 -2
  187. package/serialization/resources/agents/resources/archivalMemory/client/requests/CreateArchivalMemory.d.ts +12 -0
  188. package/{dist/serialization/resources/agents → serialization/resources/agents/resources/archivalMemory}/client/requests/CreateArchivalMemory.js +1 -1
  189. package/serialization/resources/agents/resources/archivalMemory/client/requests/index.d.ts +1 -0
  190. package/serialization/resources/agents/resources/archivalMemory/client/requests/index.js +5 -0
  191. package/serialization/resources/agents/resources/archivalMemory/index.d.ts +1 -0
  192. package/serialization/resources/agents/resources/archivalMemory/index.js +17 -0
  193. package/serialization/resources/agents/resources/coreMemory/client/index.d.ts +1 -0
  194. package/serialization/resources/agents/resources/coreMemory/client/index.js +37 -0
  195. package/serialization/resources/agents/resources/coreMemory/client/listBlocks.d.ts +11 -0
  196. package/{dist/serialization/resources/agents/client/listCoreMemoryBlocks.js → serialization/resources/agents/resources/coreMemory/client/listBlocks.js} +2 -2
  197. package/serialization/resources/agents/resources/coreMemory/index.d.ts +1 -0
  198. package/serialization/resources/agents/resources/coreMemory/index.js +17 -0
  199. package/serialization/resources/agents/resources/index.d.ts +3 -0
  200. package/serialization/resources/agents/resources/index.js +4 -1
  201. package/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -1
  202. package/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.js +2 -1
  203. package/serialization/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +11 -0
  204. package/serialization/resources/agents/resources/messages/types/MessageUpdateContent.js +42 -0
  205. package/serialization/resources/agents/resources/messages/types/index.d.ts +1 -0
  206. package/serialization/resources/agents/resources/messages/types/index.js +1 -0
  207. package/serialization/resources/blocks/client/index.d.ts +1 -0
  208. package/serialization/resources/blocks/client/index.js +2 -1
  209. package/{dist/serialization/resources/agents/client/listArchivalMemory.d.ts → serialization/resources/blocks/client/listAgentsForBlock.d.ts} +3 -3
  210. package/serialization/resources/blocks/client/listAgentsForBlock.js +42 -0
  211. package/serialization/types/AssistantMessage.d.ts +2 -1
  212. package/serialization/types/AssistantMessage.js +2 -1
  213. package/serialization/types/AssistantMessageContent.d.ts +11 -0
  214. package/serialization/types/AssistantMessageContent.js +42 -0
  215. package/serialization/types/LlmConfig.d.ts +1 -0
  216. package/serialization/types/LlmConfig.js +1 -0
  217. package/serialization/types/Message.d.ts +2 -1
  218. package/serialization/types/Message.js +2 -1
  219. package/serialization/types/MessageCreate.d.ts +2 -1
  220. package/serialization/types/MessageCreate.js +2 -1
  221. package/serialization/types/MessageCreateContent.d.ts +11 -0
  222. package/serialization/types/MessageCreateContent.js +42 -0
  223. package/serialization/types/SystemMessage.d.ts +2 -1
  224. package/serialization/types/SystemMessage.js +2 -1
  225. package/serialization/types/SystemMessageContent.d.ts +11 -0
  226. package/serialization/types/SystemMessageContent.js +42 -0
  227. package/serialization/types/TextContent.d.ts +13 -0
  228. package/serialization/types/TextContent.js +44 -0
  229. package/serialization/types/UserMessage.d.ts +2 -1
  230. package/serialization/types/UserMessage.js +2 -1
  231. package/serialization/types/UserMessageContent.d.ts +11 -0
  232. package/serialization/types/UserMessageContent.js +42 -0
  233. package/serialization/types/index.d.ts +5 -0
  234. package/serialization/types/index.js +5 -0
  235. package/version.d.ts +1 -1
  236. package/version.js +1 -1
  237. package/dist/serialization/resources/agents/client/listCoreMemoryBlocks.d.ts +0 -11
  238. package/dist/serialization/resources/agents/client/requests/CreateArchivalMemory.d.ts +0 -12
  239. package/serialization/resources/agents/client/createArchivalMemory.d.ts +0 -11
  240. package/serialization/resources/agents/client/listArchivalMemory.d.ts +0 -11
  241. package/serialization/resources/agents/client/listCoreMemoryBlocks.d.ts +0 -11
  242. package/serialization/resources/agents/client/requests/CreateArchivalMemory.d.ts +0 -12
  243. /package/api/resources/agents/{client/requests/CreateArchivalMemory.js → resources/archivalMemory/client/requests/ArchivalMemoryListRequest.js} +0 -0
  244. /package/api/resources/agents/{client → resources/archivalMemory/client}/requests/CreateArchivalMemory.d.ts +0 -0
  245. /package/{dist/api/resources/agents → api/resources/agents/resources/archivalMemory}/client/requests/CreateArchivalMemory.js +0 -0
  246. /package/api/resources/agents/{client/requests/ListArchivalMemoryRequest.js → resources/messages/types/MessageUpdateContent.js} +0 -0
  247. /package/{dist/api/resources/agents/client/requests/ListArchivalMemoryRequest.js → api/types/AssistantMessageContent.js} +0 -0
  248. /package/dist/api/resources/agents/{client → resources/archivalMemory/client}/requests/CreateArchivalMemory.d.ts +0 -0
@@ -51,16 +51,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.CoreMemory = void 0;
52
52
  const environments = __importStar(require("../../../../../../environments"));
53
53
  const core = __importStar(require("../../../../../../core"));
54
+ const Letta = __importStar(require("../../../../../index"));
54
55
  const url_join_1 = __importDefault(require("url-join"));
56
+ const serializers = __importStar(require("../../../../../../serialization/index"));
55
57
  const errors = __importStar(require("../../../../../../errors/index"));
56
58
  class CoreMemory {
57
59
  constructor(_options = {}) {
58
60
  this._options = _options;
59
61
  }
60
62
  /**
63
+ * Retrieve the memory state of a specific agent.
64
+ * This endpoint fetches the current memory state of the agent identified by the user ID and agent ID.
65
+ *
61
66
  * @param {string} agentId
62
67
  * @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
63
68
  *
69
+ * @throws {@link Letta.UnprocessableEntityError}
70
+ *
64
71
  * @example
65
72
  * await client.agents.coreMemory.retrieve("agent_id")
66
73
  */
@@ -68,9 +75,9 @@ class CoreMemory {
68
75
  return __awaiter(this, void 0, void 0, function* () {
69
76
  var _a, _b, _c;
70
77
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
71
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory`),
78
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory`),
72
79
  method: "GET",
73
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
80
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
74
81
  contentType: "application/json",
75
82
  requestType: "json",
76
83
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -78,13 +85,30 @@ class CoreMemory {
78
85
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
79
86
  });
80
87
  if (_response.ok) {
81
- return;
88
+ return serializers.Memory.parseOrThrow(_response.body, {
89
+ unrecognizedObjectKeys: "passthrough",
90
+ allowUnrecognizedUnionMembers: true,
91
+ allowUnrecognizedEnumValues: true,
92
+ skipValidation: true,
93
+ breadcrumbsPrefix: ["response"],
94
+ });
82
95
  }
83
96
  if (_response.error.reason === "status-code") {
84
- throw new errors.LettaError({
85
- statusCode: _response.error.statusCode,
86
- body: _response.error.body,
87
- });
97
+ switch (_response.error.statusCode) {
98
+ case 422:
99
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
100
+ unrecognizedObjectKeys: "passthrough",
101
+ allowUnrecognizedUnionMembers: true,
102
+ allowUnrecognizedEnumValues: true,
103
+ skipValidation: true,
104
+ breadcrumbsPrefix: ["response"],
105
+ }));
106
+ default:
107
+ throw new errors.LettaError({
108
+ statusCode: _response.error.statusCode,
109
+ body: _response.error.body,
110
+ });
111
+ }
88
112
  }
89
113
  switch (_response.error.reason) {
90
114
  case "non-json":
@@ -93,7 +117,7 @@ class CoreMemory {
93
117
  body: _response.error.rawBody,
94
118
  });
95
119
  case "timeout":
96
- throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core_memory.");
120
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory.");
97
121
  case "unknown":
98
122
  throw new errors.LettaError({
99
123
  message: _response.error.errorMessage,
@@ -102,19 +126,24 @@ class CoreMemory {
102
126
  });
103
127
  }
104
128
  /**
129
+ * Retrieve a memory block from an agent.
130
+ *
105
131
  * @param {string} agentId
132
+ * @param {string} blockLabel
106
133
  * @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
107
134
  *
135
+ * @throws {@link Letta.UnprocessableEntityError}
136
+ *
108
137
  * @example
109
- * await client.agents.coreMemory.listBlocks("agent_id")
138
+ * await client.agents.coreMemory.retrieveBlock("agent_id", "block_label")
110
139
  */
111
- listBlocks(agentId, requestOptions) {
140
+ retrieveBlock(agentId, blockLabel, requestOptions) {
112
141
  return __awaiter(this, void 0, void 0, function* () {
113
142
  var _a, _b, _c;
114
143
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
115
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory/blocks`),
144
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/${encodeURIComponent(blockLabel)}`),
116
145
  method: "GET",
117
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
146
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
118
147
  contentType: "application/json",
119
148
  requestType: "json",
120
149
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -122,13 +151,30 @@ class CoreMemory {
122
151
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
123
152
  });
124
153
  if (_response.ok) {
125
- return;
154
+ return serializers.Block.parseOrThrow(_response.body, {
155
+ unrecognizedObjectKeys: "passthrough",
156
+ allowUnrecognizedUnionMembers: true,
157
+ allowUnrecognizedEnumValues: true,
158
+ skipValidation: true,
159
+ breadcrumbsPrefix: ["response"],
160
+ });
126
161
  }
127
162
  if (_response.error.reason === "status-code") {
128
- throw new errors.LettaError({
129
- statusCode: _response.error.statusCode,
130
- body: _response.error.body,
131
- });
163
+ switch (_response.error.statusCode) {
164
+ case 422:
165
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
166
+ unrecognizedObjectKeys: "passthrough",
167
+ allowUnrecognizedUnionMembers: true,
168
+ allowUnrecognizedEnumValues: true,
169
+ skipValidation: true,
170
+ breadcrumbsPrefix: ["response"],
171
+ }));
172
+ default:
173
+ throw new errors.LettaError({
174
+ statusCode: _response.error.statusCode,
175
+ body: _response.error.body,
176
+ });
177
+ }
132
178
  }
133
179
  switch (_response.error.reason) {
134
180
  case "non-json":
@@ -137,7 +183,7 @@ class CoreMemory {
137
183
  body: _response.error.rawBody,
138
184
  });
139
185
  case "timeout":
140
- throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core_memory/blocks.");
186
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory/blocks/{block_label}.");
141
187
  case "unknown":
142
188
  throw new errors.LettaError({
143
189
  message: _response.error.errorMessage,
@@ -146,34 +192,57 @@ class CoreMemory {
146
192
  });
147
193
  }
148
194
  /**
195
+ * Updates a memory block of an agent.
196
+ *
149
197
  * @param {string} agentId
150
- * @param {string} blockId
198
+ * @param {string} blockLabel
199
+ * @param {Letta.BlockUpdate} request
151
200
  * @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
152
201
  *
202
+ * @throws {@link Letta.UnprocessableEntityError}
203
+ *
153
204
  * @example
154
- * await client.agents.coreMemory.attachBlock("agent_id", "block_id")
205
+ * await client.agents.coreMemory.modifyBlock("agent_id", "block_label", {})
155
206
  */
156
- attachBlock(agentId, blockId, requestOptions) {
207
+ modifyBlock(agentId, blockLabel, request, requestOptions) {
157
208
  return __awaiter(this, void 0, void 0, function* () {
158
209
  var _a, _b, _c;
159
210
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
160
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory/blocks/attach/${encodeURIComponent(blockId)}`),
211
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/${encodeURIComponent(blockLabel)}`),
161
212
  method: "PATCH",
162
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
213
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
163
214
  contentType: "application/json",
164
215
  requestType: "json",
216
+ body: serializers.BlockUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
165
217
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
166
218
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
167
219
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
168
220
  });
169
221
  if (_response.ok) {
170
- return;
222
+ return serializers.Block.parseOrThrow(_response.body, {
223
+ unrecognizedObjectKeys: "passthrough",
224
+ allowUnrecognizedUnionMembers: true,
225
+ allowUnrecognizedEnumValues: true,
226
+ skipValidation: true,
227
+ breadcrumbsPrefix: ["response"],
228
+ });
171
229
  }
172
230
  if (_response.error.reason === "status-code") {
173
- throw new errors.LettaError({
174
- statusCode: _response.error.statusCode,
175
- body: _response.error.body,
176
- });
231
+ switch (_response.error.statusCode) {
232
+ case 422:
233
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
234
+ unrecognizedObjectKeys: "passthrough",
235
+ allowUnrecognizedUnionMembers: true,
236
+ allowUnrecognizedEnumValues: true,
237
+ skipValidation: true,
238
+ breadcrumbsPrefix: ["response"],
239
+ }));
240
+ default:
241
+ throw new errors.LettaError({
242
+ statusCode: _response.error.statusCode,
243
+ body: _response.error.body,
244
+ });
245
+ }
177
246
  }
178
247
  switch (_response.error.reason) {
179
248
  case "non-json":
@@ -182,7 +251,7 @@ class CoreMemory {
182
251
  body: _response.error.rawBody,
183
252
  });
184
253
  case "timeout":
185
- throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core_memory/blocks/attach/{block_id}.");
254
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core-memory/blocks/{block_label}.");
186
255
  case "unknown":
187
256
  throw new errors.LettaError({
188
257
  message: _response.error.errorMessage,
@@ -191,20 +260,23 @@ class CoreMemory {
191
260
  });
192
261
  }
193
262
  /**
263
+ * Retrieve the memory blocks of a specific agent.
264
+ *
194
265
  * @param {string} agentId
195
- * @param {string} blockId
196
266
  * @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
197
267
  *
268
+ * @throws {@link Letta.UnprocessableEntityError}
269
+ *
198
270
  * @example
199
- * await client.agents.coreMemory.detachBlock("agent_id", "block_id")
271
+ * await client.agents.coreMemory.listBlocks("agent_id")
200
272
  */
201
- detachBlock(agentId, blockId, requestOptions) {
273
+ listBlocks(agentId, requestOptions) {
202
274
  return __awaiter(this, void 0, void 0, function* () {
203
275
  var _a, _b, _c;
204
276
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
205
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory/blocks/detach/${encodeURIComponent(blockId)}`),
206
- method: "PATCH",
207
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
277
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks`),
278
+ method: "GET",
279
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
208
280
  contentType: "application/json",
209
281
  requestType: "json",
210
282
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -212,13 +284,30 @@ class CoreMemory {
212
284
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
213
285
  });
214
286
  if (_response.ok) {
215
- return;
287
+ return serializers.agents.coreMemory.listBlocks.Response.parseOrThrow(_response.body, {
288
+ unrecognizedObjectKeys: "passthrough",
289
+ allowUnrecognizedUnionMembers: true,
290
+ allowUnrecognizedEnumValues: true,
291
+ skipValidation: true,
292
+ breadcrumbsPrefix: ["response"],
293
+ });
216
294
  }
217
295
  if (_response.error.reason === "status-code") {
218
- throw new errors.LettaError({
219
- statusCode: _response.error.statusCode,
220
- body: _response.error.body,
221
- });
296
+ switch (_response.error.statusCode) {
297
+ case 422:
298
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
299
+ unrecognizedObjectKeys: "passthrough",
300
+ allowUnrecognizedUnionMembers: true,
301
+ allowUnrecognizedEnumValues: true,
302
+ skipValidation: true,
303
+ breadcrumbsPrefix: ["response"],
304
+ }));
305
+ default:
306
+ throw new errors.LettaError({
307
+ statusCode: _response.error.statusCode,
308
+ body: _response.error.body,
309
+ });
310
+ }
222
311
  }
223
312
  switch (_response.error.reason) {
224
313
  case "non-json":
@@ -227,7 +316,7 @@ class CoreMemory {
227
316
  body: _response.error.rawBody,
228
317
  });
229
318
  case "timeout":
230
- throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core_memory/blocks/detach/{block_id}.");
319
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory/blocks.");
231
320
  case "unknown":
232
321
  throw new errors.LettaError({
233
322
  message: _response.error.errorMessage,
@@ -236,20 +325,24 @@ class CoreMemory {
236
325
  });
237
326
  }
238
327
  /**
328
+ * Attach a block to an agent.
329
+ *
239
330
  * @param {string} agentId
240
- * @param {string} blockLabel
331
+ * @param {string} blockId
241
332
  * @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
242
333
  *
334
+ * @throws {@link Letta.UnprocessableEntityError}
335
+ *
243
336
  * @example
244
- * await client.agents.coreMemory.retrieveBlock("agent_id", "block_label")
337
+ * await client.agents.coreMemory.attachBlock("agent_id", "block_id")
245
338
  */
246
- retrieveBlock(agentId, blockLabel, requestOptions) {
339
+ attachBlock(agentId, blockId, requestOptions) {
247
340
  return __awaiter(this, void 0, void 0, function* () {
248
341
  var _a, _b, _c;
249
342
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
250
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory/blocks/${encodeURIComponent(blockLabel)}`),
251
- method: "GET",
252
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
343
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/attach/${encodeURIComponent(blockId)}`),
344
+ method: "PATCH",
345
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
253
346
  contentType: "application/json",
254
347
  requestType: "json",
255
348
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -257,13 +350,30 @@ class CoreMemory {
257
350
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
258
351
  });
259
352
  if (_response.ok) {
260
- return;
353
+ return serializers.AgentState.parseOrThrow(_response.body, {
354
+ unrecognizedObjectKeys: "passthrough",
355
+ allowUnrecognizedUnionMembers: true,
356
+ allowUnrecognizedEnumValues: true,
357
+ skipValidation: true,
358
+ breadcrumbsPrefix: ["response"],
359
+ });
261
360
  }
262
361
  if (_response.error.reason === "status-code") {
263
- throw new errors.LettaError({
264
- statusCode: _response.error.statusCode,
265
- body: _response.error.body,
266
- });
362
+ switch (_response.error.statusCode) {
363
+ case 422:
364
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
365
+ unrecognizedObjectKeys: "passthrough",
366
+ allowUnrecognizedUnionMembers: true,
367
+ allowUnrecognizedEnumValues: true,
368
+ skipValidation: true,
369
+ breadcrumbsPrefix: ["response"],
370
+ }));
371
+ default:
372
+ throw new errors.LettaError({
373
+ statusCode: _response.error.statusCode,
374
+ body: _response.error.body,
375
+ });
376
+ }
267
377
  }
268
378
  switch (_response.error.reason) {
269
379
  case "non-json":
@@ -272,7 +382,7 @@ class CoreMemory {
272
382
  body: _response.error.rawBody,
273
383
  });
274
384
  case "timeout":
275
- throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core_memory/blocks/{block_label}.");
385
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core-memory/blocks/attach/{block_id}.");
276
386
  case "unknown":
277
387
  throw new errors.LettaError({
278
388
  message: _response.error.errorMessage,
@@ -281,20 +391,24 @@ class CoreMemory {
281
391
  });
282
392
  }
283
393
  /**
394
+ * Detach a block from an agent.
395
+ *
284
396
  * @param {string} agentId
285
- * @param {string} blockLabel
397
+ * @param {string} blockId
286
398
  * @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
287
399
  *
400
+ * @throws {@link Letta.UnprocessableEntityError}
401
+ *
288
402
  * @example
289
- * await client.agents.coreMemory.modifyBlock("agent_id", "block_label")
403
+ * await client.agents.coreMemory.detachBlock("agent_id", "block_id")
290
404
  */
291
- modifyBlock(agentId, blockLabel, requestOptions) {
405
+ detachBlock(agentId, blockId, requestOptions) {
292
406
  return __awaiter(this, void 0, void 0, function* () {
293
407
  var _a, _b, _c;
294
408
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
295
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory/blocks/${encodeURIComponent(blockLabel)}`),
409
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/detach/${encodeURIComponent(blockId)}`),
296
410
  method: "PATCH",
297
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
411
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
298
412
  contentType: "application/json",
299
413
  requestType: "json",
300
414
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -302,13 +416,30 @@ class CoreMemory {
302
416
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
303
417
  });
304
418
  if (_response.ok) {
305
- return;
419
+ return serializers.AgentState.parseOrThrow(_response.body, {
420
+ unrecognizedObjectKeys: "passthrough",
421
+ allowUnrecognizedUnionMembers: true,
422
+ allowUnrecognizedEnumValues: true,
423
+ skipValidation: true,
424
+ breadcrumbsPrefix: ["response"],
425
+ });
306
426
  }
307
427
  if (_response.error.reason === "status-code") {
308
- throw new errors.LettaError({
309
- statusCode: _response.error.statusCode,
310
- body: _response.error.body,
311
- });
428
+ switch (_response.error.statusCode) {
429
+ case 422:
430
+ throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
431
+ unrecognizedObjectKeys: "passthrough",
432
+ allowUnrecognizedUnionMembers: true,
433
+ allowUnrecognizedEnumValues: true,
434
+ skipValidation: true,
435
+ breadcrumbsPrefix: ["response"],
436
+ }));
437
+ default:
438
+ throw new errors.LettaError({
439
+ statusCode: _response.error.statusCode,
440
+ body: _response.error.body,
441
+ });
442
+ }
312
443
  }
313
444
  switch (_response.error.reason) {
314
445
  case "non-json":
@@ -317,7 +448,7 @@ class CoreMemory {
317
448
  body: _response.error.rawBody,
318
449
  });
319
450
  case "timeout":
320
- throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core_memory/blocks/{block_label}.");
451
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core-memory/blocks/detach/{block_id}.");
321
452
  case "unknown":
322
453
  throw new errors.LettaError({
323
454
  message: _response.error.errorMessage,
@@ -9,5 +9,6 @@ export * as tools from "./tools";
9
9
  export * as sources from "./sources";
10
10
  export * as coreMemory from "./coreMemory";
11
11
  export * as archivalMemory from "./archivalMemory";
12
+ export * from "./archivalMemory/client/requests";
12
13
  export * from "./messages/client/requests";
13
14
  export * from "./templates/client/requests";
@@ -48,5 +48,6 @@ exports.tools = __importStar(require("./tools"));
48
48
  exports.sources = __importStar(require("./sources"));
49
49
  exports.coreMemory = __importStar(require("./coreMemory"));
50
50
  exports.archivalMemory = __importStar(require("./archivalMemory"));
51
+ __exportStar(require("./archivalMemory/client/requests"), exports);
51
52
  __exportStar(require("./messages/client/requests"), exports);
52
53
  __exportStar(require("./templates/client/requests"), exports);
@@ -76,9 +76,9 @@ class MemoryVariables {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
77
  var _a, _b, _c;
78
78
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
79
- url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core_memory/variables`),
79
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/variables`),
80
80
  method: "GET",
81
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
81
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
82
82
  contentType: "application/json",
83
83
  requestType: "json",
84
84
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -112,7 +112,7 @@ class MemoryVariables {
112
112
  body: _response.error.rawBody,
113
113
  });
114
114
  case "timeout":
115
- throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core_memory/variables.");
115
+ throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory/variables.");
116
116
  case "unknown":
117
117
  throw new errors.LettaError({
118
118
  message: _response.error.errorMessage,
@@ -53,7 +53,7 @@ export declare class Messages {
53
53
  * await client.agents.messages.create("agent_id", {
54
54
  * messages: [{
55
55
  * role: "user",
56
- * text: "text"
56
+ * content: "content"
57
57
  * }]
58
58
  * })
59
59
  */
@@ -92,7 +92,7 @@ export declare class Messages {
92
92
  * await client.agents.messages.createAsync("agent_id", {
93
93
  * messages: [{
94
94
  * role: "user",
95
- * text: "text"
95
+ * content: "content"
96
96
  * }]
97
97
  * })
98
98
  */
@@ -94,7 +94,7 @@ class Messages {
94
94
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
95
95
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages`),
96
96
  method: "GET",
97
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
97
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
98
98
  contentType: "application/json",
99
99
  queryParameters: _queryParams,
100
100
  requestType: "json",
@@ -157,7 +157,7 @@ class Messages {
157
157
  * await client.agents.messages.create("agent_id", {
158
158
  * messages: [{
159
159
  * role: "user",
160
- * text: "text"
160
+ * content: "content"
161
161
  * }]
162
162
  * })
163
163
  */
@@ -167,7 +167,7 @@ class Messages {
167
167
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
168
168
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages`),
169
169
  method: "POST",
170
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
170
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
171
171
  contentType: "application/json",
172
172
  requestType: "json",
173
173
  body: serializers.LettaRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -235,7 +235,7 @@ class Messages {
235
235
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
236
236
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages/${encodeURIComponent(messageId)}`),
237
237
  method: "PATCH",
238
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
238
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
239
239
  contentType: "application/json",
240
240
  requestType: "json",
241
241
  body: serializers.agents.MessageUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -295,7 +295,7 @@ class Messages {
295
295
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
296
296
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages/stream`),
297
297
  method: "POST",
298
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
298
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
299
299
  contentType: "application/json",
300
300
  requestType: "json",
301
301
  body: serializers.agents.LettaStreamingRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -369,7 +369,7 @@ class Messages {
369
369
  * await client.agents.messages.createAsync("agent_id", {
370
370
  * messages: [{
371
371
  * role: "user",
372
- * text: "text"
372
+ * content: "content"
373
373
  * }]
374
374
  * })
375
375
  */
@@ -379,7 +379,7 @@ class Messages {
379
379
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
380
380
  url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages/async`),
381
381
  method: "POST",
382
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.14", "User-Agent": "@letta-ai/letta-client/0.1.14", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
382
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
383
383
  contentType: "application/json",
384
384
  requestType: "json",
385
385
  body: serializers.LettaRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -7,7 +7,7 @@ import * as Letta from "../../../../../../index";
7
7
  * {
8
8
  * messages: [{
9
9
  * role: "user",
10
- * text: "text"
10
+ * content: "content"
11
11
  * }]
12
12
  * }
13
13
  */
@@ -9,8 +9,8 @@ import * as Letta from "../../../../../../index";
9
9
  export interface MessageUpdate {
10
10
  /** The role of the participant. */
11
11
  role?: Letta.MessageRole;
12
- /** The text of the message. */
13
- text?: string;
12
+ /** The content of the message. */
13
+ content?: Letta.agents.MessageUpdateContent;
14
14
  /** The name of the participant. */
15
15
  name?: string;
16
16
  /** The list of tool calls requested. */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Letta from "../../../../../index";
5
+ /**
6
+ * The content of the message.
7
+ */
8
+ export type MessageUpdateContent = string | Letta.TextContent[];
@@ -1,2 +1,3 @@
1
1
  export * from "./MessagesListResponse";
2
+ export * from "./MessageUpdateContent";
2
3
  export * from "./LettaStreamingResponse";