@letta-ai/letta-client 0.1.170 → 0.1.173

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 (384) hide show
  1. package/README.md +16 -3
  2. package/api/errors/BadRequestError.d.ts +2 -1
  3. package/api/errors/BadRequestError.js +2 -1
  4. package/api/errors/ConflictError.d.ts +2 -1
  5. package/api/errors/ConflictError.js +2 -1
  6. package/api/errors/InternalServerError.d.ts +2 -1
  7. package/api/errors/InternalServerError.js +2 -1
  8. package/api/errors/NotFoundError.d.ts +2 -1
  9. package/api/errors/NotFoundError.js +2 -1
  10. package/api/errors/PaymentRequiredError.d.ts +2 -1
  11. package/api/errors/PaymentRequiredError.js +2 -1
  12. package/api/errors/UnprocessableEntityError.d.ts +2 -1
  13. package/api/errors/UnprocessableEntityError.js +2 -1
  14. package/api/resources/agents/client/Client.d.ts +20 -10
  15. package/api/resources/agents/client/Client.js +166 -82
  16. package/api/resources/agents/client/requests/AgentsListRequest.d.ts +1 -1
  17. package/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
  18. package/api/resources/agents/client/requests/UpdateAgent.d.ts +2 -0
  19. package/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
  20. package/api/resources/agents/resources/blocks/client/Client.js +90 -45
  21. package/api/resources/agents/resources/context/client/Client.d.ts +2 -1
  22. package/api/resources/agents/resources/context/client/Client.js +18 -9
  23. package/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
  24. package/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
  25. package/api/resources/agents/resources/files/client/Client.d.ts +6 -3
  26. package/api/resources/agents/resources/files/client/Client.js +45 -21
  27. package/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
  28. package/api/resources/agents/resources/folders/client/Client.js +54 -27
  29. package/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
  30. package/api/resources/agents/resources/groups/client/Client.js +19 -10
  31. package/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
  32. package/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
  33. package/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
  34. package/api/resources/agents/resources/messages/client/Client.js +155 -83
  35. package/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
  36. package/api/resources/agents/resources/passages/client/Client.js +64 -31
  37. package/api/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +2 -2
  38. package/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
  39. package/api/resources/agents/resources/sources/client/Client.js +54 -27
  40. package/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
  41. package/api/resources/agents/resources/templates/client/Client.js +54 -27
  42. package/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
  43. package/api/resources/agents/resources/tools/client/Client.js +54 -27
  44. package/api/resources/batches/client/Client.d.ts +8 -4
  45. package/api/resources/batches/client/Client.js +63 -30
  46. package/api/resources/blocks/client/Client.d.ts +12 -6
  47. package/api/resources/blocks/client/Client.js +100 -49
  48. package/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
  49. package/api/resources/blocks/resources/agents/client/Client.js +19 -10
  50. package/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
  51. package/api/resources/clientSideAccessTokens/client/Client.js +46 -22
  52. package/api/resources/embeddingModels/client/Client.d.ts +2 -1
  53. package/api/resources/embeddingModels/client/Client.js +18 -9
  54. package/api/resources/folders/client/Client.d.ts +18 -9
  55. package/api/resources/folders/client/Client.js +154 -76
  56. package/api/resources/folders/resources/files/client/Client.d.ts +6 -3
  57. package/api/resources/folders/resources/files/client/Client.js +48 -24
  58. package/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
  59. package/api/resources/folders/resources/passages/client/Client.js +19 -10
  60. package/api/resources/groups/client/Client.d.ts +12 -6
  61. package/api/resources/groups/client/Client.js +105 -52
  62. package/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
  63. package/api/resources/groups/resources/messages/client/Client.js +91 -49
  64. package/api/resources/health/client/Client.d.ts +2 -1
  65. package/api/resources/health/client/Client.js +17 -8
  66. package/api/resources/identities/client/Client.d.ts +14 -7
  67. package/api/resources/identities/client/Client.js +123 -61
  68. package/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
  69. package/api/resources/identities/resources/properties/client/Client.js +9 -3
  70. package/api/resources/jobs/client/Client.d.ts +10 -5
  71. package/api/resources/jobs/client/Client.js +92 -47
  72. package/api/resources/messages/client/Client.d.ts +2 -1
  73. package/api/resources/messages/client/Client.js +19 -10
  74. package/api/resources/models/client/Client.d.ts +2 -1
  75. package/api/resources/models/client/Client.js +27 -14
  76. package/api/resources/projects/client/Client.d.ts +2 -1
  77. package/api/resources/projects/client/Client.js +18 -9
  78. package/api/resources/providers/client/Client.d.ts +10 -5
  79. package/api/resources/providers/client/Client.js +77 -36
  80. package/api/resources/runs/client/Client.d.ts +8 -4
  81. package/api/resources/runs/client/Client.js +74 -38
  82. package/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
  83. package/api/resources/runs/resources/messages/client/Client.js +21 -12
  84. package/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
  85. package/api/resources/runs/resources/steps/client/Client.js +19 -10
  86. package/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
  87. package/api/resources/runs/resources/usage/client/Client.js +18 -9
  88. package/api/resources/sources/client/Client.d.ts +20 -10
  89. package/api/resources/sources/client/Client.js +173 -86
  90. package/api/resources/sources/resources/files/client/Client.d.ts +6 -3
  91. package/api/resources/sources/resources/files/client/Client.js +48 -24
  92. package/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
  93. package/api/resources/sources/resources/passages/client/Client.js +19 -10
  94. package/api/resources/steps/client/Client.d.ts +4 -2
  95. package/api/resources/steps/client/Client.js +41 -21
  96. package/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
  97. package/api/resources/steps/resources/feedback/client/Client.js +23 -12
  98. package/api/resources/tags/client/Client.d.ts +2 -1
  99. package/api/resources/tags/client/Client.js +19 -10
  100. package/api/resources/telemetry/client/Client.d.ts +2 -1
  101. package/api/resources/telemetry/client/Client.js +18 -9
  102. package/api/resources/templates/client/Client.d.ts +2 -1
  103. package/api/resources/templates/client/Client.js +18 -9
  104. package/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
  105. package/api/resources/templates/resources/agents/client/Client.js +19 -10
  106. package/api/resources/tools/client/Client.d.ts +40 -20
  107. package/api/resources/tools/client/Client.js +356 -182
  108. package/api/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
  109. package/api/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
  110. package/api/resources/voice/client/Client.d.ts +2 -1
  111. package/api/resources/voice/client/Client.js +9 -3
  112. package/api/types/AgentState.d.ts +2 -0
  113. package/api/types/EmbeddingConfig.d.ts +1 -11
  114. package/api/types/LettaStreamingRequest.d.ts +2 -0
  115. package/api/types/LlmConfig.d.ts +1 -11
  116. package/api/types/ModalSandboxConfig.d.ts +4 -0
  117. package/api/types/ModalSandboxConfigLanguage.d.ts +8 -0
  118. package/api/types/ModalSandboxConfigLanguage.js +10 -0
  119. package/api/types/NpmRequirement.d.ts +9 -0
  120. package/api/types/NpmRequirement.js +5 -0
  121. package/api/types/Passage.d.ts +4 -4
  122. package/api/types/Tool.d.ts +2 -0
  123. package/api/types/ToolCreate.d.ts +2 -0
  124. package/api/types/ToolType.d.ts +2 -1
  125. package/api/types/ToolType.js +1 -0
  126. package/api/types/index.d.ts +2 -0
  127. package/api/types/index.js +2 -0
  128. package/core/fetcher/APIResponse.d.ts +10 -0
  129. package/core/fetcher/Fetcher.d.ts +1 -1
  130. package/core/fetcher/Fetcher.js +11 -3
  131. package/core/fetcher/Headers.d.ts +2 -0
  132. package/core/fetcher/Headers.js +84 -0
  133. package/core/fetcher/HttpResponsePromise.d.ts +58 -0
  134. package/core/fetcher/HttpResponsePromise.js +103 -0
  135. package/core/fetcher/RawResponse.d.ts +29 -0
  136. package/core/fetcher/RawResponse.js +44 -0
  137. package/core/fetcher/createRequestUrl.d.ts +1 -1
  138. package/core/fetcher/getRequestBody.js +2 -1
  139. package/core/fetcher/index.d.ts +3 -0
  140. package/core/fetcher/index.js +7 -1
  141. package/core/fetcher/requestWithRetries.js +1 -1
  142. package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
  143. package/core/form-data-utils/FormDataWrapper.js +53 -10
  144. package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
  145. package/core/form-data-utils/encodeAsFormParameter.js +18 -0
  146. package/core/form-data-utils/index.d.ts +1 -0
  147. package/core/form-data-utils/index.js +3 -0
  148. package/core/json.d.ts +15 -0
  149. package/core/json.js +24 -0
  150. package/core/schemas/Schema.d.ts +2 -0
  151. package/core/schemas/Schema.js +2 -0
  152. package/core/schemas/builders/bigint/bigint.d.ts +1 -1
  153. package/core/schemas/builders/bigint/bigint.js +21 -17
  154. package/core/schemas/builders/object/object.js +1 -0
  155. package/core/schemas/builders/record/record.js +1 -2
  156. package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  157. package/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
  158. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
  159. package/dist/api/errors/BadRequestError.d.ts +2 -1
  160. package/dist/api/errors/BadRequestError.js +2 -1
  161. package/dist/api/errors/ConflictError.d.ts +2 -1
  162. package/dist/api/errors/ConflictError.js +2 -1
  163. package/dist/api/errors/InternalServerError.d.ts +2 -1
  164. package/dist/api/errors/InternalServerError.js +2 -1
  165. package/dist/api/errors/NotFoundError.d.ts +2 -1
  166. package/dist/api/errors/NotFoundError.js +2 -1
  167. package/dist/api/errors/PaymentRequiredError.d.ts +2 -1
  168. package/dist/api/errors/PaymentRequiredError.js +2 -1
  169. package/dist/api/errors/UnprocessableEntityError.d.ts +2 -1
  170. package/dist/api/errors/UnprocessableEntityError.js +2 -1
  171. package/dist/api/resources/agents/client/Client.d.ts +20 -10
  172. package/dist/api/resources/agents/client/Client.js +166 -82
  173. package/dist/api/resources/agents/client/requests/AgentsListRequest.d.ts +1 -1
  174. package/dist/api/resources/agents/client/requests/CreateAgentRequest.d.ts +2 -0
  175. package/dist/api/resources/agents/client/requests/UpdateAgent.d.ts +2 -0
  176. package/dist/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
  177. package/dist/api/resources/agents/resources/blocks/client/Client.js +90 -45
  178. package/dist/api/resources/agents/resources/context/client/Client.d.ts +2 -1
  179. package/dist/api/resources/agents/resources/context/client/Client.js +18 -9
  180. package/dist/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
  181. package/dist/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
  182. package/dist/api/resources/agents/resources/files/client/Client.d.ts +6 -3
  183. package/dist/api/resources/agents/resources/files/client/Client.js +45 -21
  184. package/dist/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
  185. package/dist/api/resources/agents/resources/folders/client/Client.js +54 -27
  186. package/dist/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
  187. package/dist/api/resources/agents/resources/groups/client/Client.js +19 -10
  188. package/dist/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
  189. package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
  190. package/dist/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
  191. package/dist/api/resources/agents/resources/messages/client/Client.js +155 -83
  192. package/dist/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
  193. package/dist/api/resources/agents/resources/passages/client/Client.js +64 -31
  194. package/dist/api/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +2 -2
  195. package/dist/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
  196. package/dist/api/resources/agents/resources/sources/client/Client.js +54 -27
  197. package/dist/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
  198. package/dist/api/resources/agents/resources/templates/client/Client.js +54 -27
  199. package/dist/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
  200. package/dist/api/resources/agents/resources/tools/client/Client.js +54 -27
  201. package/dist/api/resources/batches/client/Client.d.ts +8 -4
  202. package/dist/api/resources/batches/client/Client.js +63 -30
  203. package/dist/api/resources/blocks/client/Client.d.ts +12 -6
  204. package/dist/api/resources/blocks/client/Client.js +100 -49
  205. package/dist/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
  206. package/dist/api/resources/blocks/resources/agents/client/Client.js +19 -10
  207. package/dist/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
  208. package/dist/api/resources/clientSideAccessTokens/client/Client.js +46 -22
  209. package/dist/api/resources/embeddingModels/client/Client.d.ts +2 -1
  210. package/dist/api/resources/embeddingModels/client/Client.js +18 -9
  211. package/dist/api/resources/folders/client/Client.d.ts +18 -9
  212. package/dist/api/resources/folders/client/Client.js +154 -76
  213. package/dist/api/resources/folders/resources/files/client/Client.d.ts +6 -3
  214. package/dist/api/resources/folders/resources/files/client/Client.js +48 -24
  215. package/dist/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
  216. package/dist/api/resources/folders/resources/passages/client/Client.js +19 -10
  217. package/dist/api/resources/groups/client/Client.d.ts +12 -6
  218. package/dist/api/resources/groups/client/Client.js +105 -52
  219. package/dist/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
  220. package/dist/api/resources/groups/resources/messages/client/Client.js +91 -49
  221. package/dist/api/resources/health/client/Client.d.ts +2 -1
  222. package/dist/api/resources/health/client/Client.js +17 -8
  223. package/dist/api/resources/identities/client/Client.d.ts +14 -7
  224. package/dist/api/resources/identities/client/Client.js +123 -61
  225. package/dist/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
  226. package/dist/api/resources/identities/resources/properties/client/Client.js +9 -3
  227. package/dist/api/resources/jobs/client/Client.d.ts +10 -5
  228. package/dist/api/resources/jobs/client/Client.js +92 -47
  229. package/dist/api/resources/messages/client/Client.d.ts +2 -1
  230. package/dist/api/resources/messages/client/Client.js +19 -10
  231. package/dist/api/resources/models/client/Client.d.ts +2 -1
  232. package/dist/api/resources/models/client/Client.js +27 -14
  233. package/dist/api/resources/projects/client/Client.d.ts +2 -1
  234. package/dist/api/resources/projects/client/Client.js +18 -9
  235. package/dist/api/resources/providers/client/Client.d.ts +10 -5
  236. package/dist/api/resources/providers/client/Client.js +77 -36
  237. package/dist/api/resources/runs/client/Client.d.ts +8 -4
  238. package/dist/api/resources/runs/client/Client.js +74 -38
  239. package/dist/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
  240. package/dist/api/resources/runs/resources/messages/client/Client.js +21 -12
  241. package/dist/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
  242. package/dist/api/resources/runs/resources/steps/client/Client.js +19 -10
  243. package/dist/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
  244. package/dist/api/resources/runs/resources/usage/client/Client.js +18 -9
  245. package/dist/api/resources/sources/client/Client.d.ts +20 -10
  246. package/dist/api/resources/sources/client/Client.js +173 -86
  247. package/dist/api/resources/sources/resources/files/client/Client.d.ts +6 -3
  248. package/dist/api/resources/sources/resources/files/client/Client.js +48 -24
  249. package/dist/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
  250. package/dist/api/resources/sources/resources/passages/client/Client.js +19 -10
  251. package/dist/api/resources/steps/client/Client.d.ts +4 -2
  252. package/dist/api/resources/steps/client/Client.js +41 -21
  253. package/dist/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
  254. package/dist/api/resources/steps/resources/feedback/client/Client.js +23 -12
  255. package/dist/api/resources/tags/client/Client.d.ts +2 -1
  256. package/dist/api/resources/tags/client/Client.js +19 -10
  257. package/dist/api/resources/telemetry/client/Client.d.ts +2 -1
  258. package/dist/api/resources/telemetry/client/Client.js +18 -9
  259. package/dist/api/resources/templates/client/Client.d.ts +2 -1
  260. package/dist/api/resources/templates/client/Client.js +18 -9
  261. package/dist/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
  262. package/dist/api/resources/templates/resources/agents/client/Client.js +19 -10
  263. package/dist/api/resources/tools/client/Client.d.ts +40 -20
  264. package/dist/api/resources/tools/client/Client.js +356 -182
  265. package/dist/api/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
  266. package/dist/api/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
  267. package/dist/api/resources/voice/client/Client.d.ts +2 -1
  268. package/dist/api/resources/voice/client/Client.js +9 -3
  269. package/dist/api/types/AgentState.d.ts +2 -0
  270. package/dist/api/types/EmbeddingConfig.d.ts +1 -11
  271. package/dist/api/types/LettaStreamingRequest.d.ts +2 -0
  272. package/dist/api/types/LlmConfig.d.ts +1 -11
  273. package/dist/api/types/ModalSandboxConfig.d.ts +4 -0
  274. package/dist/api/types/ModalSandboxConfigLanguage.d.ts +8 -0
  275. package/dist/api/types/ModalSandboxConfigLanguage.js +10 -0
  276. package/dist/api/types/NpmRequirement.d.ts +9 -0
  277. package/dist/api/types/NpmRequirement.js +5 -0
  278. package/dist/api/types/Passage.d.ts +4 -4
  279. package/dist/api/types/Tool.d.ts +2 -0
  280. package/dist/api/types/ToolCreate.d.ts +2 -0
  281. package/dist/api/types/ToolType.d.ts +2 -1
  282. package/dist/api/types/ToolType.js +1 -0
  283. package/dist/api/types/index.d.ts +2 -0
  284. package/dist/api/types/index.js +2 -0
  285. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  286. package/dist/core/fetcher/Fetcher.d.ts +1 -1
  287. package/dist/core/fetcher/Fetcher.js +11 -3
  288. package/dist/core/fetcher/Headers.d.ts +2 -0
  289. package/dist/core/fetcher/Headers.js +84 -0
  290. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  291. package/dist/core/fetcher/HttpResponsePromise.js +103 -0
  292. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  293. package/dist/core/fetcher/RawResponse.js +44 -0
  294. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  295. package/dist/core/fetcher/getRequestBody.js +2 -1
  296. package/dist/core/fetcher/index.d.ts +3 -0
  297. package/dist/core/fetcher/index.js +7 -1
  298. package/dist/core/fetcher/requestWithRetries.js +1 -1
  299. package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
  300. package/dist/core/form-data-utils/FormDataWrapper.js +53 -10
  301. package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
  302. package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
  303. package/dist/core/form-data-utils/index.d.ts +1 -0
  304. package/dist/core/form-data-utils/index.js +3 -0
  305. package/dist/core/json.d.ts +15 -0
  306. package/dist/core/json.js +24 -0
  307. package/dist/core/schemas/Schema.d.ts +2 -0
  308. package/dist/core/schemas/Schema.js +2 -0
  309. package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
  310. package/dist/core/schemas/builders/bigint/bigint.js +21 -17
  311. package/dist/core/schemas/builders/object/object.js +1 -0
  312. package/dist/core/schemas/builders/record/record.js +1 -2
  313. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
  314. package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
  315. package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
  316. package/dist/errors/LettaError.d.ts +4 -1
  317. package/dist/errors/LettaError.js +6 -8
  318. package/dist/serialization/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -0
  319. package/dist/serialization/resources/agents/client/requests/CreateAgentRequest.js +1 -0
  320. package/dist/serialization/resources/agents/client/requests/UpdateAgent.d.ts +1 -0
  321. package/dist/serialization/resources/agents/client/requests/UpdateAgent.js +1 -0
  322. package/dist/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +1 -1
  323. package/dist/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.js +1 -1
  324. package/dist/serialization/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
  325. package/dist/serialization/resources/tools/client/requests/ToolRunFromSource.js +2 -0
  326. package/dist/serialization/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
  327. package/dist/serialization/resources/tools/client/requests/ToolUpdate.js +2 -0
  328. package/dist/serialization/types/AgentState.d.ts +1 -0
  329. package/dist/serialization/types/AgentState.js +1 -0
  330. package/dist/serialization/types/LettaStreamingRequest.d.ts +1 -0
  331. package/dist/serialization/types/LettaStreamingRequest.js +1 -0
  332. package/dist/serialization/types/ModalSandboxConfig.d.ts +3 -0
  333. package/dist/serialization/types/ModalSandboxConfig.js +3 -0
  334. package/dist/serialization/types/ModalSandboxConfigLanguage.d.ts +10 -0
  335. package/dist/serialization/types/ModalSandboxConfigLanguage.js +41 -0
  336. package/dist/serialization/types/NpmRequirement.d.ts +13 -0
  337. package/dist/serialization/types/NpmRequirement.js +44 -0
  338. package/dist/serialization/types/Passage.d.ts +1 -1
  339. package/dist/serialization/types/Passage.js +1 -1
  340. package/dist/serialization/types/Tool.d.ts +2 -0
  341. package/dist/serialization/types/Tool.js +2 -0
  342. package/dist/serialization/types/ToolCreate.d.ts +2 -0
  343. package/dist/serialization/types/ToolCreate.js +2 -0
  344. package/dist/serialization/types/ToolType.d.ts +1 -1
  345. package/dist/serialization/types/ToolType.js +1 -0
  346. package/dist/serialization/types/index.d.ts +2 -0
  347. package/dist/serialization/types/index.js +2 -0
  348. package/dist/version.d.ts +1 -1
  349. package/dist/version.js +1 -1
  350. package/errors/LettaError.d.ts +4 -1
  351. package/errors/LettaError.js +6 -8
  352. package/package.json +4 -4
  353. package/serialization/resources/agents/client/requests/CreateAgentRequest.d.ts +1 -0
  354. package/serialization/resources/agents/client/requests/CreateAgentRequest.js +1 -0
  355. package/serialization/resources/agents/client/requests/UpdateAgent.d.ts +1 -0
  356. package/serialization/resources/agents/client/requests/UpdateAgent.js +1 -0
  357. package/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.d.ts +1 -1
  358. package/serialization/resources/agents/resources/passages/client/requests/PassageUpdate.js +1 -1
  359. package/serialization/resources/tools/client/requests/ToolRunFromSource.d.ts +2 -0
  360. package/serialization/resources/tools/client/requests/ToolRunFromSource.js +2 -0
  361. package/serialization/resources/tools/client/requests/ToolUpdate.d.ts +2 -0
  362. package/serialization/resources/tools/client/requests/ToolUpdate.js +2 -0
  363. package/serialization/types/AgentState.d.ts +1 -0
  364. package/serialization/types/AgentState.js +1 -0
  365. package/serialization/types/LettaStreamingRequest.d.ts +1 -0
  366. package/serialization/types/LettaStreamingRequest.js +1 -0
  367. package/serialization/types/ModalSandboxConfig.d.ts +3 -0
  368. package/serialization/types/ModalSandboxConfig.js +3 -0
  369. package/serialization/types/ModalSandboxConfigLanguage.d.ts +10 -0
  370. package/serialization/types/ModalSandboxConfigLanguage.js +41 -0
  371. package/serialization/types/NpmRequirement.d.ts +13 -0
  372. package/serialization/types/NpmRequirement.js +44 -0
  373. package/serialization/types/Passage.d.ts +1 -1
  374. package/serialization/types/Passage.js +1 -1
  375. package/serialization/types/Tool.d.ts +2 -0
  376. package/serialization/types/Tool.js +2 -0
  377. package/serialization/types/ToolCreate.d.ts +2 -0
  378. package/serialization/types/ToolCreate.js +2 -0
  379. package/serialization/types/ToolType.d.ts +1 -1
  380. package/serialization/types/ToolType.js +1 -0
  381. package/serialization/types/index.d.ts +2 -0
  382. package/serialization/types/index.js +2 -0
  383. package/version.d.ts +1 -1
  384. package/version.js +1 -1
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The raw response from the fetch call excluding the body.
3
+ */
4
+ export type RawResponse = Omit<{
5
+ [K in keyof Response as Response[K] extends Function ? never : K]: Response[K];
6
+ }, "ok" | "body" | "bodyUsed">;
7
+ /**
8
+ * A raw response indicating that the request was aborted.
9
+ */
10
+ export declare const abortRawResponse: RawResponse;
11
+ /**
12
+ * A raw response indicating an unknown error.
13
+ */
14
+ export declare const unknownRawResponse: RawResponse;
15
+ /**
16
+ * Converts a `RawResponse` object into a `RawResponse` by extracting its properties,
17
+ * excluding the `body` and `bodyUsed` fields.
18
+ *
19
+ * @param response - The `RawResponse` object to convert.
20
+ * @returns A `RawResponse` object containing the extracted properties of the input response.
21
+ */
22
+ export declare function toRawResponse(response: Response): RawResponse;
23
+ /**
24
+ * Creates a `RawResponse` from a standard `Response` object.
25
+ */
26
+ export interface WithRawResponse<T> {
27
+ readonly data: T;
28
+ readonly rawResponse: RawResponse;
29
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unknownRawResponse = exports.abortRawResponse = void 0;
4
+ exports.toRawResponse = toRawResponse;
5
+ const Headers_1 = require("./Headers");
6
+ /**
7
+ * A raw response indicating that the request was aborted.
8
+ */
9
+ exports.abortRawResponse = {
10
+ headers: new Headers_1.Headers(),
11
+ redirected: false,
12
+ status: 499,
13
+ statusText: "Client Closed Request",
14
+ type: "error",
15
+ url: "",
16
+ };
17
+ /**
18
+ * A raw response indicating an unknown error.
19
+ */
20
+ exports.unknownRawResponse = {
21
+ headers: new Headers_1.Headers(),
22
+ redirected: false,
23
+ status: 0,
24
+ statusText: "Unknown Error",
25
+ type: "error",
26
+ url: "",
27
+ };
28
+ /**
29
+ * Converts a `RawResponse` object into a `RawResponse` by extracting its properties,
30
+ * excluding the `body` and `bodyUsed` fields.
31
+ *
32
+ * @param response - The `RawResponse` object to convert.
33
+ * @returns A `RawResponse` object containing the extracted properties of the input response.
34
+ */
35
+ function toRawResponse(response) {
36
+ return {
37
+ headers: response.headers,
38
+ redirected: response.redirected,
39
+ status: response.status,
40
+ statusText: response.statusText,
41
+ type: response.type,
42
+ url: response.url,
43
+ };
44
+ }
@@ -1 +1 @@
1
- export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[]>): string;
1
+ export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[] | null>): string;
@@ -10,10 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getRequestBody = getRequestBody;
13
+ const json_1 = require("../json");
13
14
  function getRequestBody(_a) {
14
15
  return __awaiter(this, arguments, void 0, function* ({ body, type }) {
15
16
  if (type.includes("json")) {
16
- return JSON.stringify(body);
17
+ return (0, json_1.toJson)(body);
17
18
  }
18
19
  else {
19
20
  return body;
@@ -3,3 +3,6 @@ export { fetcher } from "./Fetcher";
3
3
  export type { Fetcher, FetchFunction } from "./Fetcher";
4
4
  export { getHeader } from "./getHeader";
5
5
  export { Supplier } from "./Supplier";
6
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse";
7
+ export type { RawResponse, WithRawResponse } from "./RawResponse";
8
+ export { HttpResponsePromise } from "./HttpResponsePromise";
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Supplier = exports.getHeader = exports.fetcher = void 0;
3
+ exports.HttpResponsePromise = exports.unknownRawResponse = exports.toRawResponse = exports.abortRawResponse = exports.Supplier = exports.getHeader = exports.fetcher = void 0;
4
4
  var Fetcher_1 = require("./Fetcher");
5
5
  Object.defineProperty(exports, "fetcher", { enumerable: true, get: function () { return Fetcher_1.fetcher; } });
6
6
  var getHeader_1 = require("./getHeader");
7
7
  Object.defineProperty(exports, "getHeader", { enumerable: true, get: function () { return getHeader_1.getHeader; } });
8
8
  var Supplier_1 = require("./Supplier");
9
9
  Object.defineProperty(exports, "Supplier", { enumerable: true, get: function () { return Supplier_1.Supplier; } });
10
+ var RawResponse_1 = require("./RawResponse");
11
+ Object.defineProperty(exports, "abortRawResponse", { enumerable: true, get: function () { return RawResponse_1.abortRawResponse; } });
12
+ Object.defineProperty(exports, "toRawResponse", { enumerable: true, get: function () { return RawResponse_1.toRawResponse; } });
13
+ Object.defineProperty(exports, "unknownRawResponse", { enumerable: true, get: function () { return RawResponse_1.unknownRawResponse; } });
14
+ var HttpResponsePromise_1 = require("./HttpResponsePromise");
15
+ Object.defineProperty(exports, "HttpResponsePromise", { enumerable: true, get: function () { return HttpResponsePromise_1.HttpResponsePromise; } });
@@ -23,7 +23,7 @@ function requestWithRetries(requestFn_1) {
23
23
  return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
24
24
  let response = yield requestFn();
25
25
  for (let i = 0; i < maxRetries; ++i) {
26
- if ([408, 409, 429].includes(response.status) || response.status >= 500) {
26
+ if ([408, 429].includes(response.status) || response.status >= 500) {
27
27
  // Calculate base delay using exponential backoff (in milliseconds)
28
28
  const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
29
29
  // Add jitter to the delay
@@ -21,6 +21,7 @@ export declare class Node18FormData implements CrossPlatformFormData {
21
21
  private fd;
22
22
  setup(): Promise<void>;
23
23
  append(key: string, value: any): void;
24
+ private getFileName;
24
25
  appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
25
26
  getRequest(): Promise<FormDataRequest<unknown>>;
26
27
  }
@@ -41,6 +42,7 @@ export declare class Node16FormData implements CrossPlatformFormData {
41
42
  private fd;
42
43
  setup(): Promise<void>;
43
44
  append(key: string, value: any): void;
45
+ private getFileName;
44
46
  appendFile(key: string, value: unknown, fileName?: string): Promise<void>;
45
47
  getRequest(): FormDataRequest<Node16FormDataFd>;
46
48
  }
@@ -54,6 +56,7 @@ export declare class WebFormData implements CrossPlatformFormData {
54
56
  protected fd: WebFormDataFd;
55
57
  setup(): Promise<void>;
56
58
  append(key: string, value: any): void;
59
+ private getFileName;
57
60
  appendFile(key: string, value: any, fileName?: string): Promise<void>;
58
61
  getRequest(): FormDataRequest<WebFormDataFd>;
59
62
  }
@@ -48,6 +48,15 @@ const runtime_1 = require("../runtime");
48
48
  function isNamedValue(value) {
49
49
  return typeof value === "object" && value != null && "name" in value;
50
50
  }
51
+ function isPathedValue(value) {
52
+ return typeof value === "object" && value != null && "path" in value;
53
+ }
54
+ function getLastPathSegment(pathStr) {
55
+ const lastForwardSlash = pathStr.lastIndexOf("/");
56
+ const lastBackSlash = pathStr.lastIndexOf("\\");
57
+ const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash);
58
+ return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr;
59
+ }
51
60
  function newFormData() {
52
61
  return __awaiter(this, void 0, void 0, function* () {
53
62
  let formdata;
@@ -77,12 +86,22 @@ class Node18FormData {
77
86
  var _a;
78
87
  (_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
79
88
  }
89
+ getFileName(value, filename) {
90
+ if (filename != null) {
91
+ return filename;
92
+ }
93
+ if (isNamedValue(value)) {
94
+ return value.name;
95
+ }
96
+ if (isPathedValue(value) && value.path) {
97
+ return getLastPathSegment(value.path.toString());
98
+ }
99
+ return undefined;
100
+ }
80
101
  appendFile(key, value, fileName) {
81
102
  return __awaiter(this, void 0, void 0, function* () {
82
103
  var _a, _b;
83
- if (fileName == null && isNamedValue(value)) {
84
- fileName = value.name;
85
- }
104
+ fileName = this.getFileName(value, fileName);
86
105
  if (value instanceof Blob) {
87
106
  (_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value, fileName);
88
107
  }
@@ -123,12 +142,22 @@ class Node16FormData {
123
142
  var _a;
124
143
  (_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
125
144
  }
145
+ getFileName(value, filename) {
146
+ if (filename != null) {
147
+ return filename;
148
+ }
149
+ if (isNamedValue(value)) {
150
+ return value.name;
151
+ }
152
+ if (isPathedValue(value) && value.path) {
153
+ return getLastPathSegment(value.path.toString());
154
+ }
155
+ return undefined;
156
+ }
126
157
  appendFile(key, value, fileName) {
127
158
  return __awaiter(this, void 0, void 0, function* () {
128
159
  var _a, _b;
129
- if (fileName == null && isNamedValue(value)) {
130
- fileName = value.name;
131
- }
160
+ fileName = this.getFileName(value, fileName);
132
161
  let bufferedValue;
133
162
  if (value instanceof Blob) {
134
163
  bufferedValue = Buffer.from(yield value.arrayBuffer());
@@ -165,13 +194,27 @@ class WebFormData {
165
194
  var _a;
166
195
  (_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value);
167
196
  }
197
+ getFileName(value, filename) {
198
+ if (filename != null) {
199
+ return filename;
200
+ }
201
+ if (isNamedValue(value)) {
202
+ return value.name;
203
+ }
204
+ if (isPathedValue(value) && value.path) {
205
+ return getLastPathSegment(value.path.toString());
206
+ }
207
+ return undefined;
208
+ }
168
209
  appendFile(key, value, fileName) {
169
210
  return __awaiter(this, void 0, void 0, function* () {
170
- var _a;
171
- if (fileName == null && isNamedValue(value)) {
172
- fileName = value.name;
211
+ var _a, _b;
212
+ fileName = this.getFileName(value, fileName);
213
+ if (value instanceof Blob) {
214
+ (_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, value, fileName);
215
+ return;
173
216
  }
174
- (_a = this.fd) === null || _a === void 0 ? void 0 : _a.append(key, new Blob([value]), fileName);
217
+ (_b = this.fd) === null || _b === void 0 ? void 0 : _b.append(key, new Blob([value]), fileName);
175
218
  });
176
219
  }
177
220
  getRequest() {
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Takes an unknown value, stringifies it using qs, and parses it into a key-value record
3
+ */
4
+ export declare function encodeAsFormParameter(value: unknown): Record<string, string>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.encodeAsFormParameter = encodeAsFormParameter;
7
+ const qs_1 = __importDefault(require("qs"));
8
+ /**
9
+ * Takes an unknown value, stringifies it using qs, and parses it into a key-value record
10
+ */
11
+ function encodeAsFormParameter(value) {
12
+ const stringified = qs_1.default.stringify(value, { encode: false });
13
+ const keyValuePairs = stringified.split("&").map((pair) => {
14
+ const [key, value] = pair.split("=");
15
+ return [key, value];
16
+ });
17
+ return Object.fromEntries(keyValuePairs);
18
+ }
@@ -1 +1,2 @@
1
+ export { encodeAsFormParameter } from "./encodeAsFormParameter";
1
2
  export * from "./FormDataWrapper";
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.encodeAsFormParameter = void 0;
18
+ var encodeAsFormParameter_1 = require("./encodeAsFormParameter");
19
+ Object.defineProperty(exports, "encodeAsFormParameter", { enumerable: true, get: function () { return encodeAsFormParameter_1.encodeAsFormParameter; } });
17
20
  __exportStar(require("./FormDataWrapper"), exports);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Serialize a value to JSON
3
+ * @param value A JavaScript value, usually an object or array, to be converted.
4
+ * @param replacer A function that transforms the results.
5
+ * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
6
+ * @returns JSON string
7
+ */
8
+ export declare const toJson: (value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number) => string;
9
+ /**
10
+ * Parse JSON string to object, array, or other type
11
+ * @param text A valid JSON string.
12
+ * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
13
+ * @returns Parsed object, array, or other type
14
+ */
15
+ export declare function fromJson<T = unknown>(text: string, reviver?: (this: unknown, key: string, value: unknown) => unknown): T;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toJson = void 0;
4
+ exports.fromJson = fromJson;
5
+ /**
6
+ * Serialize a value to JSON
7
+ * @param value A JavaScript value, usually an object or array, to be converted.
8
+ * @param replacer A function that transforms the results.
9
+ * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
10
+ * @returns JSON string
11
+ */
12
+ const toJson = (value, replacer, space) => {
13
+ return JSON.stringify(value, replacer, space);
14
+ };
15
+ exports.toJson = toJson;
16
+ /**
17
+ * Parse JSON string to object, array, or other type
18
+ * @param text A valid JSON string.
19
+ * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.
20
+ * @returns Parsed object, array, or other type
21
+ */
22
+ function fromJson(text, reviver) {
23
+ return JSON.parse(text, reviver);
24
+ }
@@ -24,7 +24,9 @@ export declare const SchemaType: {
24
24
  readonly SET: "set";
25
25
  readonly UNION: "union";
26
26
  readonly UNDISCRIMINATED_UNION: "undiscriminatedUnion";
27
+ readonly NULLABLE: "nullable";
27
28
  readonly OPTIONAL: "optional";
29
+ readonly OPTIONAL_NULLABLE: "optionalNullable";
28
30
  };
29
31
  export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
30
32
  export type MaybeValid<T> = Valid<T> | Invalid;
@@ -18,5 +18,7 @@ exports.SchemaType = {
18
18
  SET: "set",
19
19
  UNION: "union",
20
20
  UNDISCRIMINATED_UNION: "undiscriminatedUnion",
21
+ NULLABLE: "nullable",
21
22
  OPTIONAL: "optional",
23
+ OPTIONAL_NULLABLE: "optionalNullable",
22
24
  };
@@ -1,2 +1,2 @@
1
1
  import { Schema } from "../../Schema";
2
- export declare function bigint(): Schema<string, bigint>;
2
+ export declare function bigint(): Schema<bigint | number, bigint>;
@@ -8,30 +8,30 @@ const schema_utils_1 = require("../schema-utils");
8
8
  function bigint() {
9
9
  const baseSchema = {
10
10
  parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
11
- if (typeof raw !== "string") {
11
+ if (typeof raw === "bigint") {
12
12
  return {
13
- ok: false,
14
- errors: [
15
- {
16
- path: breadcrumbsPrefix,
17
- message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "string"),
18
- },
19
- ],
13
+ ok: true,
14
+ value: raw,
20
15
  };
21
16
  }
22
- return {
23
- ok: true,
24
- value: BigInt(raw),
25
- };
26
- },
27
- json: (bigint, { breadcrumbsPrefix = [] } = {}) => {
28
- if (typeof bigint === "bigint") {
17
+ if (typeof raw === "number") {
29
18
  return {
30
19
  ok: true,
31
- value: bigint.toString(),
20
+ value: BigInt(raw),
32
21
  };
33
22
  }
34
- else {
23
+ return {
24
+ ok: false,
25
+ errors: [
26
+ {
27
+ path: breadcrumbsPrefix,
28
+ message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "bigint | number"),
29
+ },
30
+ ],
31
+ };
32
+ },
33
+ json: (bigint, { breadcrumbsPrefix = [] } = {}) => {
34
+ if (typeof bigint !== "bigint") {
35
35
  return {
36
36
  ok: false,
37
37
  errors: [
@@ -42,6 +42,10 @@ function bigint() {
42
42
  ],
43
43
  };
44
44
  }
45
+ return {
46
+ ok: true,
47
+ value: bigint,
48
+ };
45
49
  },
46
50
  getType: () => Schema_1.SchemaType.BIGINT,
47
51
  };
@@ -253,6 +253,7 @@ function isSchemaOptional(schema) {
253
253
  case Schema_1.SchemaType.ANY:
254
254
  case Schema_1.SchemaType.UNKNOWN:
255
255
  case Schema_1.SchemaType.OPTIONAL:
256
+ case Schema_1.SchemaType.OPTIONAL_NULLABLE:
256
257
  return true;
257
258
  default:
258
259
  return false;
@@ -56,8 +56,7 @@ function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transfo
56
56
  };
57
57
  }
58
58
  return (0, entries_1.entries)(value).reduce((accPromise, [stringKey, value]) => {
59
- // skip nullish keys
60
- if (value == null) {
59
+ if (value === undefined) {
61
60
  return accPromise;
62
61
  }
63
62
  const acc = accPromise;
@@ -1,6 +1,8 @@
1
1
  import { BaseSchema, Schema, SchemaOptions } from "../../Schema";
2
2
  export interface SchemaUtils<Raw, Parsed> {
3
+ nullable: () => Schema<Raw | null, Parsed | null>;
3
4
  optional: () => Schema<Raw | null | undefined, Parsed | undefined>;
5
+ optionalNullable: () => Schema<Raw | null | undefined, Parsed | null | undefined>;
4
6
  transform: <Transformed>(transformer: SchemaTransformer<Parsed, Transformed>) => Schema<Raw, Transformed>;
5
7
  parseOrThrow: (raw: unknown, opts?: SchemaOptions) => Parsed;
6
8
  jsonOrThrow: (raw: unknown, opts?: SchemaOptions) => Raw;
@@ -13,5 +15,7 @@ export declare function getSchemaUtils<Raw, Parsed>(schema: BaseSchema<Raw, Pars
13
15
  /**
14
16
  * schema utils are defined in one file to resolve issues with circular imports
15
17
  */
18
+ export declare function nullable<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null, Parsed | null>;
16
19
  export declare function optional<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null | undefined, Parsed | undefined>;
20
+ export declare function optionalNullable<Raw, Parsed>(schema: BaseSchema<Raw, Parsed>): Schema<Raw | null | undefined, Parsed | null | undefined>;
17
21
  export declare function transform<Raw, Parsed, Transformed>(schema: BaseSchema<Raw, Parsed>, transformer: SchemaTransformer<Parsed, Transformed>): Schema<Raw, Transformed>;
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSchemaUtils = getSchemaUtils;
4
+ exports.nullable = nullable;
4
5
  exports.optional = optional;
6
+ exports.optionalNullable = optionalNullable;
5
7
  exports.transform = transform;
6
8
  const Schema_1 = require("../../Schema");
7
9
  const JsonError_1 = require("./JsonError");
8
10
  const ParseError_1 = require("./ParseError");
9
11
  function getSchemaUtils(schema) {
10
12
  return {
13
+ nullable: () => nullable(schema),
11
14
  optional: () => optional(schema),
15
+ optionalNullable: () => optionalNullable(schema),
12
16
  transform: (transformer) => transform(schema, transformer),
13
17
  parseOrThrow: (raw, opts) => {
14
18
  const parsed = schema.parse(raw, opts);
@@ -29,6 +33,30 @@ function getSchemaUtils(schema) {
29
33
  /**
30
34
  * schema utils are defined in one file to resolve issues with circular imports
31
35
  */
36
+ function nullable(schema) {
37
+ const baseSchema = {
38
+ parse: (raw, opts) => {
39
+ if (raw == null) {
40
+ return {
41
+ ok: true,
42
+ value: null,
43
+ };
44
+ }
45
+ return schema.parse(raw, opts);
46
+ },
47
+ json: (parsed, opts) => {
48
+ if (parsed == null) {
49
+ return {
50
+ ok: true,
51
+ value: null,
52
+ };
53
+ }
54
+ return schema.json(parsed, opts);
55
+ },
56
+ getType: () => Schema_1.SchemaType.NULLABLE,
57
+ };
58
+ return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
59
+ }
32
60
  function optional(schema) {
33
61
  const baseSchema = {
34
62
  parse: (raw, opts) => {
@@ -59,6 +87,42 @@ function optional(schema) {
59
87
  };
60
88
  return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
61
89
  }
90
+ function optionalNullable(schema) {
91
+ const baseSchema = {
92
+ parse: (raw, opts) => {
93
+ if (raw === undefined) {
94
+ return {
95
+ ok: true,
96
+ value: undefined,
97
+ };
98
+ }
99
+ if (raw === null) {
100
+ return {
101
+ ok: true,
102
+ value: null,
103
+ };
104
+ }
105
+ return schema.parse(raw, opts);
106
+ },
107
+ json: (parsed, opts) => {
108
+ if (parsed === undefined) {
109
+ return {
110
+ ok: true,
111
+ value: undefined,
112
+ };
113
+ }
114
+ if (parsed === null) {
115
+ return {
116
+ ok: true,
117
+ value: null,
118
+ };
119
+ }
120
+ return schema.json(parsed, opts);
121
+ },
122
+ getType: () => Schema_1.SchemaType.OPTIONAL_NULLABLE,
123
+ };
124
+ return Object.assign(Object.assign({}, baseSchema), getSchemaUtils(baseSchema));
125
+ }
62
126
  function transform(schema, transformer) {
63
127
  const baseSchema = {
64
128
  parse: (raw, opts) => {
@@ -2,6 +2,6 @@ export type addQuestionMarksToNullableProperties<T> = {
2
2
  [K in OptionalKeys<T>]?: T[K];
3
3
  } & Pick<T, RequiredKeys<T>>;
4
4
  export type OptionalKeys<T> = {
5
- [K in keyof T]-?: undefined extends T[K] ? K : null extends T[K] ? K : 1 extends (any extends T[K] ? 0 : 1) ? never : K;
5
+ [K in keyof T]-?: undefined extends T[K] ? K : never;
6
6
  }[keyof T];
7
7
  export type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;
@@ -1,12 +1,15 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as core from "../core";
4
5
  export declare class LettaError extends Error {
5
6
  readonly statusCode?: number;
6
7
  readonly body?: unknown;
7
- constructor({ message, statusCode, body }: {
8
+ readonly rawResponse?: core.RawResponse;
9
+ constructor({ message, statusCode, body, rawResponse, }: {
8
10
  message?: string;
9
11
  statusCode?: number;
10
12
  body?: unknown;
13
+ rawResponse?: core.RawResponse;
11
14
  });
12
15
  }
@@ -4,16 +4,14 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.LettaError = void 0;
7
+ const json_1 = require("../core/json");
7
8
  class LettaError extends Error {
8
- constructor({ message, statusCode, body }) {
9
+ constructor({ message, statusCode, body, rawResponse, }) {
9
10
  super(buildMessage({ message, statusCode, body }));
10
11
  Object.setPrototypeOf(this, LettaError.prototype);
11
- if (statusCode != null) {
12
- this.statusCode = statusCode;
13
- }
14
- if (body !== undefined) {
15
- this.body = body;
16
- }
12
+ this.statusCode = statusCode;
13
+ this.body = body;
14
+ this.rawResponse = rawResponse;
17
15
  }
18
16
  }
19
17
  exports.LettaError = LettaError;
@@ -26,7 +24,7 @@ function buildMessage({ message, statusCode, body, }) {
26
24
  lines.push(`Status code: ${statusCode.toString()}`);
27
25
  }
28
26
  if (body != null) {
29
- lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`);
27
+ lines.push(`Body: ${(0, json_1.toJson)(body, undefined, 2)}`);
30
28
  }
31
29
  return lines.join("\n");
32
30
  }
@@ -55,5 +55,6 @@ export declare namespace CreateAgentRequest {
55
55
  timezone?: string | null;
56
56
  max_files_open?: number | null;
57
57
  per_file_view_window_char_limit?: number | null;
58
+ hidden?: boolean | null;
58
59
  }
59
60
  }
@@ -87,4 +87,5 @@ exports.CreateAgentRequest = core.serialization.object({
87
87
  timezone: core.serialization.string().optional(),
88
88
  maxFilesOpen: core.serialization.property("max_files_open", core.serialization.number().optional()),
89
89
  perFileViewWindowCharLimit: core.serialization.property("per_file_view_window_char_limit", core.serialization.number().optional()),
90
+ hidden: core.serialization.boolean().optional(),
90
91
  });
@@ -38,5 +38,6 @@ export declare namespace UpdateAgent {
38
38
  timezone?: string | null;
39
39
  max_files_open?: number | null;
40
40
  per_file_view_window_char_limit?: number | null;
41
+ hidden?: boolean | null;
41
42
  }
42
43
  }
@@ -70,4 +70,5 @@ exports.UpdateAgent = core.serialization.object({
70
70
  timezone: core.serialization.string().optional(),
71
71
  maxFilesOpen: core.serialization.property("max_files_open", core.serialization.number().optional()),
72
72
  perFileViewWindowCharLimit: core.serialization.property("per_file_view_window_char_limit", core.serialization.number().optional()),
73
+ hidden: core.serialization.boolean().optional(),
73
74
  });
@@ -13,7 +13,7 @@ export declare namespace PassageUpdate {
13
13
  created_at?: string | null;
14
14
  updated_at?: string | null;
15
15
  is_deleted?: boolean | null;
16
- agent_id?: string | null;
16
+ archive_id?: string | null;
17
17
  source_id?: string | null;
18
18
  file_id?: string | null;
19
19
  file_name?: string | null;