@farukada/aws-langgraph-dynamodb-ts 0.9.0 → 1.0.0-rc.1

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 (494) hide show
  1. package/README.md +282 -49
  2. package/dist/checkpointer/actions/delete-thread.d.ts +3 -2
  3. package/dist/checkpointer/actions/delete-thread.js +5 -2
  4. package/dist/checkpointer/actions/get-tuple.d.ts +3 -2
  5. package/dist/checkpointer/actions/get-tuple.js +10 -4
  6. package/dist/checkpointer/actions/list.d.ts +14 -4
  7. package/dist/checkpointer/actions/list.js +89 -63
  8. package/dist/checkpointer/actions/put-writes.d.ts +5 -5
  9. package/dist/checkpointer/actions/put-writes.js +12 -41
  10. package/dist/checkpointer/actions/put.d.ts +10 -3
  11. package/dist/checkpointer/actions/put.js +42 -12
  12. package/dist/checkpointer/internal/assemble.d.ts +10 -3
  13. package/dist/checkpointer/internal/assemble.js +7 -6
  14. package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +24 -0
  15. package/dist/checkpointer/internal/checkpoint-write-verify.js +67 -0
  16. package/dist/checkpointer/internal/configurable.d.ts +0 -1
  17. package/dist/checkpointer/internal/configurable.js +10 -9
  18. package/dist/checkpointer/internal/fetch.d.ts +14 -5
  19. package/dist/checkpointer/internal/fetch.js +56 -14
  20. package/dist/checkpointer/internal/filter-match.d.ts +3 -2
  21. package/dist/checkpointer/internal/filter-match.js +4 -3
  22. package/dist/checkpointer/internal/item-reader.d.ts +17 -6
  23. package/dist/checkpointer/internal/item-reader.js +39 -14
  24. package/dist/checkpointer/internal/item-writer.d.ts +12 -3
  25. package/dist/checkpointer/internal/item-writer.js +24 -9
  26. package/dist/checkpointer/internal/keys.d.ts +11 -1
  27. package/dist/checkpointer/internal/keys.js +33 -3
  28. package/dist/checkpointer/internal/list-scope.d.ts +61 -0
  29. package/dist/checkpointer/internal/list-scope.js +108 -0
  30. package/dist/checkpointer/internal/pending-sends.d.ts +13 -0
  31. package/dist/checkpointer/internal/pending-sends.js +29 -0
  32. package/dist/checkpointer/internal/query.d.ts +2 -1
  33. package/dist/checkpointer/internal/query.js +9 -3
  34. package/dist/checkpointer/internal/regular-write.d.ts +28 -0
  35. package/dist/checkpointer/internal/regular-write.js +66 -0
  36. package/dist/checkpointer/internal/setup.d.ts +3 -1
  37. package/dist/checkpointer/internal/setup.js +10 -8
  38. package/dist/checkpointer/internal/special-write-cas.d.ts +1 -2
  39. package/dist/checkpointer/internal/special-write-cas.js +9 -9
  40. package/dist/checkpointer/internal/special-write-cleanup.d.ts +1 -2
  41. package/dist/checkpointer/internal/special-write-cleanup.js +10 -7
  42. package/dist/checkpointer/internal/special-write-verify.d.ts +0 -1
  43. package/dist/checkpointer/internal/special-write-verify.js +18 -3
  44. package/dist/checkpointer/internal/stored-channels.d.ts +31 -0
  45. package/dist/checkpointer/internal/stored-channels.js +70 -0
  46. package/dist/checkpointer/internal/validation.d.ts +11 -6
  47. package/dist/checkpointer/internal/validation.js +19 -9
  48. package/dist/checkpointer/internal/write-guard.d.ts +8 -1
  49. package/dist/checkpointer/internal/write-guard.js +16 -7
  50. package/dist/checkpointer/internal/write-index.d.ts +0 -1
  51. package/dist/checkpointer/internal/write-index.js +0 -1
  52. package/dist/checkpointer/saver.d.ts +50 -10
  53. package/dist/checkpointer/saver.js +59 -17
  54. package/dist/checkpointer/types.d.ts +8 -1
  55. package/dist/checkpointer/types.js +0 -1
  56. package/dist/factory/factory.d.ts +22 -25
  57. package/dist/factory/factory.js +58 -18
  58. package/dist/factory/types.d.ts +57 -0
  59. package/dist/factory/types.js +2 -0
  60. package/dist/history/actions/add-messages.d.ts +1 -2
  61. package/dist/history/actions/add-messages.js +4 -4
  62. package/dist/history/actions/clear.d.ts +3 -2
  63. package/dist/history/actions/clear.js +5 -2
  64. package/dist/history/actions/get-messages.d.ts +13 -6
  65. package/dist/history/actions/get-messages.js +63 -42
  66. package/dist/history/actions/list-sessions.d.ts +1 -1
  67. package/dist/history/actions/list-sessions.js +8 -12
  68. package/dist/history/actions/reconcile-count.d.ts +1 -2
  69. package/dist/history/actions/reconcile-count.js +20 -7
  70. package/dist/history/chat-message-history.d.ts +51 -26
  71. package/dist/history/chat-message-history.js +60 -30
  72. package/dist/history/internal/append-saga.d.ts +7 -2
  73. package/dist/history/internal/append-saga.js +58 -14
  74. package/dist/history/internal/compensation.d.ts +6 -2
  75. package/dist/history/internal/compensation.js +14 -6
  76. package/dist/history/internal/item-mapper.d.ts +0 -3
  77. package/dist/history/internal/item-mapper.js +2 -8
  78. package/dist/history/internal/keys.d.ts +0 -1
  79. package/dist/history/internal/keys.js +0 -1
  80. package/dist/history/internal/message-chunker.d.ts +0 -1
  81. package/dist/history/internal/message-chunker.js +0 -1
  82. package/dist/history/internal/message-transaction.d.ts +0 -1
  83. package/dist/history/internal/message-transaction.js +3 -2
  84. package/dist/history/internal/message-window.d.ts +17 -0
  85. package/dist/history/internal/message-window.js +49 -0
  86. package/dist/history/internal/query.d.ts +16 -3
  87. package/dist/history/internal/query.js +13 -5
  88. package/dist/history/internal/session-count.d.ts +8 -2
  89. package/dist/history/internal/session-count.js +14 -8
  90. package/dist/history/internal/session-title.d.ts +0 -1
  91. package/dist/history/internal/session-title.js +1 -2
  92. package/dist/history/internal/session-update.d.ts +0 -1
  93. package/dist/history/internal/session-update.js +0 -1
  94. package/dist/history/internal/setup.d.ts +3 -1
  95. package/dist/history/internal/setup.js +16 -8
  96. package/dist/history/internal/title-generator.d.ts +0 -1
  97. package/dist/history/internal/title-generator.js +19 -3
  98. package/dist/history/internal/ttl-anchor.d.ts +1 -2
  99. package/dist/history/internal/ttl-anchor.js +5 -5
  100. package/dist/history/internal/validation.d.ts +19 -3
  101. package/dist/history/internal/validation.js +41 -4
  102. package/dist/history/session-adapter.d.ts +9 -3
  103. package/dist/history/session-adapter.js +6 -3
  104. package/dist/history/types.d.ts +23 -2
  105. package/dist/history/types.js +0 -1
  106. package/dist/index.d.ts +12 -5
  107. package/dist/index.js +5 -3
  108. package/dist/shared/clock.d.ts +6 -1
  109. package/dist/shared/clock.js +9 -1
  110. package/dist/shared/codec/codec.d.ts +26 -17
  111. package/dist/shared/codec/codec.js +46 -24
  112. package/dist/shared/codec/compression.d.ts +1 -2
  113. package/dist/shared/codec/compression.js +2 -3
  114. package/dist/shared/codec/descriptor-keys.d.ts +11 -3
  115. package/dist/shared/codec/descriptor-keys.js +2 -2
  116. package/dist/shared/codec/encode.d.ts +13 -0
  117. package/dist/shared/codec/encode.js +43 -0
  118. package/dist/shared/codec/json-serde.d.ts +0 -1
  119. package/dist/shared/codec/json-serde.js +0 -1
  120. package/dist/shared/codec/payload-loss.d.ts +12 -0
  121. package/dist/shared/codec/payload-loss.js +38 -0
  122. package/dist/shared/codec/s3/adapter-config.d.ts +13 -0
  123. package/dist/shared/codec/s3/adapter-config.js +22 -0
  124. package/dist/shared/codec/s3/bounded-body.d.ts +14 -0
  125. package/dist/shared/codec/s3/bounded-body.js +47 -0
  126. package/dist/shared/codec/s3/client-types.d.ts +34 -0
  127. package/dist/shared/codec/s3/client-types.js +7 -0
  128. package/dist/shared/codec/s3/client.d.ts +11 -5
  129. package/dist/shared/codec/s3/client.js +25 -3
  130. package/dist/shared/codec/s3/config.d.ts +32 -5
  131. package/dist/shared/codec/s3/config.js +37 -5
  132. package/dist/shared/codec/s3/delete.d.ts +0 -1
  133. package/dist/shared/codec/s3/delete.js +0 -1
  134. package/dist/shared/codec/s3/key-scope.d.ts +23 -0
  135. package/dist/shared/codec/s3/key-scope.js +44 -0
  136. package/dist/shared/codec/s3/lifecycle.d.ts +11 -5
  137. package/dist/shared/codec/s3/lifecycle.js +32 -16
  138. package/dist/shared/codec/s3/offloader.d.ts +6 -2
  139. package/dist/shared/codec/s3/offloader.js +21 -3
  140. package/dist/shared/codec/s3/orphans.d.ts +6 -1
  141. package/dist/shared/codec/s3/orphans.js +15 -2
  142. package/dist/shared/codec/s3/read-write.d.ts +7 -3
  143. package/dist/shared/codec/s3/read-write.js +16 -8
  144. package/dist/shared/codec/s3/retry.d.ts +4 -4
  145. package/dist/shared/codec/s3/retry.js +13 -16
  146. package/dist/shared/concurrency.d.ts +6 -0
  147. package/dist/shared/concurrency.js +30 -0
  148. package/dist/shared/constants.d.ts +53 -5
  149. package/dist/shared/constants.js +55 -7
  150. package/dist/shared/dynamodb/abort.d.ts +9 -0
  151. package/dist/shared/dynamodb/abort.js +27 -0
  152. package/dist/shared/dynamodb/backoff.d.ts +4 -4
  153. package/dist/shared/dynamodb/backoff.js +7 -7
  154. package/dist/shared/dynamodb/batch-write.d.ts +0 -1
  155. package/dist/shared/dynamodb/batch-write.js +0 -1
  156. package/dist/shared/dynamodb/cancellation.d.ts +0 -1
  157. package/dist/shared/dynamodb/cancellation.js +0 -1
  158. package/dist/shared/dynamodb/client.d.ts +9 -2
  159. package/dist/shared/dynamodb/client.js +24 -1
  160. package/dist/shared/dynamodb/conditional-put.d.ts +18 -2
  161. package/dist/shared/dynamodb/conditional-put.js +19 -2
  162. package/dist/shared/dynamodb/drain-unprocessed.d.ts +3 -1
  163. package/dist/shared/dynamodb/drain-unprocessed.js +1 -2
  164. package/dist/shared/dynamodb/expiry.d.ts +16 -0
  165. package/dist/shared/dynamodb/expiry.js +29 -0
  166. package/dist/shared/dynamodb/paginate-core.d.ts +5 -3
  167. package/dist/shared/dynamodb/paginate-core.js +47 -17
  168. package/dist/shared/dynamodb/paginate.d.ts +0 -1
  169. package/dist/shared/dynamodb/paginate.js +1 -2
  170. package/dist/shared/dynamodb/partition-delete.d.ts +7 -1
  171. package/dist/shared/dynamodb/partition-delete.js +4 -3
  172. package/dist/shared/dynamodb/retry-classifier.d.ts +10 -2
  173. package/dist/shared/dynamodb/retry-classifier.js +42 -11
  174. package/dist/shared/dynamodb/retry-policy.d.ts +26 -0
  175. package/dist/shared/dynamodb/retry-policy.js +22 -0
  176. package/dist/shared/dynamodb/retry.d.ts +14 -1
  177. package/dist/shared/dynamodb/retry.js +11 -7
  178. package/dist/shared/dynamodb/scan.d.ts +0 -1
  179. package/dist/shared/dynamodb/scan.js +1 -2
  180. package/dist/shared/dynamodb/types.d.ts +1 -2
  181. package/dist/shared/dynamodb/types.js +0 -1
  182. package/dist/shared/errors/base-error.d.ts +14 -6
  183. package/dist/shared/errors/base-error.js +8 -9
  184. package/dist/shared/errors/boundary.d.ts +18 -0
  185. package/dist/shared/errors/boundary.js +46 -0
  186. package/dist/shared/errors/error-code.d.ts +2 -2
  187. package/dist/shared/errors/error-code.js +1 -1
  188. package/dist/shared/errors/errors.d.ts +13 -13
  189. package/dist/shared/errors/errors.js +18 -16
  190. package/dist/shared/errors/upstream-error.d.ts +16 -0
  191. package/dist/shared/errors/upstream-error.js +27 -0
  192. package/dist/shared/errors/wrap-error.d.ts +0 -9
  193. package/dist/shared/errors/wrap-error.js +0 -15
  194. package/dist/shared/logging/logger.d.ts +6 -2
  195. package/dist/shared/logging/logger.js +0 -1
  196. package/dist/shared/logging/redaction-walk.d.ts +2 -2
  197. package/dist/shared/logging/redaction-walk.js +38 -18
  198. package/dist/shared/logging/redaction.d.ts +9 -5
  199. package/dist/shared/logging/redaction.js +19 -4
  200. package/dist/shared/logging/secret-patterns.d.ts +21 -3
  201. package/dist/shared/logging/secret-patterns.js +32 -6
  202. package/dist/shared/options.d.ts +9 -4
  203. package/dist/shared/options.js +0 -1
  204. package/dist/shared/ulid.d.ts +15 -2
  205. package/dist/shared/ulid.js +35 -3
  206. package/dist/shared/validation/options.d.ts +8 -0
  207. package/dist/shared/validation/options.js +90 -0
  208. package/dist/shared/validation/primitives.d.ts +14 -10
  209. package/dist/shared/validation/primitives.js +23 -25
  210. package/dist/shared/validation/ttl.d.ts +14 -7
  211. package/dist/shared/validation/ttl.js +29 -11
  212. package/dist/store/actions/get.d.ts +11 -3
  213. package/dist/store/actions/get.js +52 -14
  214. package/dist/store/actions/list-namespaces.d.ts +0 -1
  215. package/dist/store/actions/list-namespaces.js +10 -6
  216. package/dist/store/actions/put.d.ts +0 -1
  217. package/dist/store/actions/put.js +24 -13
  218. package/dist/store/actions/reconcile-vector-index.d.ts +3 -2
  219. package/dist/store/actions/reconcile-vector-index.js +2 -3
  220. package/dist/store/actions/search.d.ts +1 -2
  221. package/dist/store/actions/search.js +11 -38
  222. package/dist/store/internal/backend-search.d.ts +1 -2
  223. package/dist/store/internal/backend-search.js +12 -6
  224. package/dist/store/internal/batch-plan.d.ts +11 -0
  225. package/dist/store/internal/batch-plan.js +52 -0
  226. package/dist/store/internal/candidates.d.ts +23 -0
  227. package/dist/store/internal/candidates.js +94 -0
  228. package/dist/store/internal/filter.d.ts +0 -1
  229. package/dist/store/internal/filter.js +0 -1
  230. package/dist/store/internal/index-reconcile.d.ts +5 -6
  231. package/dist/store/internal/index-reconcile.js +25 -12
  232. package/dist/store/internal/index-sync.d.ts +0 -1
  233. package/dist/store/internal/index-sync.js +0 -1
  234. package/dist/store/internal/item-mapper.d.ts +5 -3
  235. package/dist/store/internal/item-mapper.js +14 -6
  236. package/dist/store/internal/keys.d.ts +0 -1
  237. package/dist/store/internal/keys.js +0 -1
  238. package/dist/store/internal/namespace-match.d.ts +0 -1
  239. package/dist/store/internal/namespace-match.js +0 -1
  240. package/dist/store/internal/option-validation.d.ts +13 -0
  241. package/dist/store/internal/option-validation.js +77 -0
  242. package/dist/store/internal/overwrite-swap.d.ts +0 -1
  243. package/dist/store/internal/overwrite-swap.js +10 -4
  244. package/dist/store/internal/persist.d.ts +3 -2
  245. package/dist/store/internal/persist.js +16 -11
  246. package/dist/store/internal/query.d.ts +6 -1
  247. package/dist/store/internal/query.js +17 -1
  248. package/dist/store/internal/ranker.d.ts +7 -2
  249. package/dist/store/internal/ranker.js +10 -2
  250. package/dist/store/internal/read-existing.d.ts +9 -5
  251. package/dist/store/internal/read-existing.js +22 -10
  252. package/dist/store/internal/score-direction.d.ts +0 -1
  253. package/dist/store/internal/score-direction.js +0 -1
  254. package/dist/store/internal/search-filter.d.ts +0 -1
  255. package/dist/store/internal/search-filter.js +0 -1
  256. package/dist/store/internal/semantic-search.d.ts +26 -5
  257. package/dist/store/internal/semantic-search.js +59 -19
  258. package/dist/store/internal/setup.d.ts +5 -13
  259. package/dist/store/internal/setup.js +11 -63
  260. package/dist/store/internal/text-path.d.ts +17 -0
  261. package/dist/store/internal/text-path.js +147 -0
  262. package/dist/store/internal/validation.d.ts +8 -3
  263. package/dist/store/internal/validation.js +21 -5
  264. package/dist/store/internal/write-verify.d.ts +15 -10
  265. package/dist/store/internal/write-verify.js +24 -21
  266. package/dist/store/store.d.ts +37 -9
  267. package/dist/store/store.js +52 -17
  268. package/dist/store/types.d.ts +6 -2
  269. package/dist/store/types.js +0 -1
  270. package/dist/store/vector-backend.d.ts +0 -1
  271. package/dist/store/vector-backend.js +0 -1
  272. package/package.json +21 -15
  273. package/dist/checkpointer/actions/delete-thread.d.ts.map +0 -1
  274. package/dist/checkpointer/actions/delete-thread.js.map +0 -1
  275. package/dist/checkpointer/actions/get-tuple.d.ts.map +0 -1
  276. package/dist/checkpointer/actions/get-tuple.js.map +0 -1
  277. package/dist/checkpointer/actions/list.d.ts.map +0 -1
  278. package/dist/checkpointer/actions/list.js.map +0 -1
  279. package/dist/checkpointer/actions/put-writes.d.ts.map +0 -1
  280. package/dist/checkpointer/actions/put-writes.js.map +0 -1
  281. package/dist/checkpointer/actions/put.d.ts.map +0 -1
  282. package/dist/checkpointer/actions/put.js.map +0 -1
  283. package/dist/checkpointer/internal/assemble.d.ts.map +0 -1
  284. package/dist/checkpointer/internal/assemble.js.map +0 -1
  285. package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
  286. package/dist/checkpointer/internal/configurable.js.map +0 -1
  287. package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
  288. package/dist/checkpointer/internal/fetch.js.map +0 -1
  289. package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
  290. package/dist/checkpointer/internal/filter-match.js.map +0 -1
  291. package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
  292. package/dist/checkpointer/internal/item-reader.js.map +0 -1
  293. package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
  294. package/dist/checkpointer/internal/item-writer.js.map +0 -1
  295. package/dist/checkpointer/internal/keys.d.ts.map +0 -1
  296. package/dist/checkpointer/internal/keys.js.map +0 -1
  297. package/dist/checkpointer/internal/query.d.ts.map +0 -1
  298. package/dist/checkpointer/internal/query.js.map +0 -1
  299. package/dist/checkpointer/internal/setup.d.ts.map +0 -1
  300. package/dist/checkpointer/internal/setup.js.map +0 -1
  301. package/dist/checkpointer/internal/special-write-cas.d.ts.map +0 -1
  302. package/dist/checkpointer/internal/special-write-cas.js.map +0 -1
  303. package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
  304. package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
  305. package/dist/checkpointer/internal/special-write-verify.d.ts.map +0 -1
  306. package/dist/checkpointer/internal/special-write-verify.js.map +0 -1
  307. package/dist/checkpointer/internal/validation.d.ts.map +0 -1
  308. package/dist/checkpointer/internal/validation.js.map +0 -1
  309. package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
  310. package/dist/checkpointer/internal/write-guard.js.map +0 -1
  311. package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
  312. package/dist/checkpointer/internal/write-index.js.map +0 -1
  313. package/dist/checkpointer/saver.d.ts.map +0 -1
  314. package/dist/checkpointer/saver.js.map +0 -1
  315. package/dist/checkpointer/types.d.ts.map +0 -1
  316. package/dist/checkpointer/types.js.map +0 -1
  317. package/dist/factory/factory.d.ts.map +0 -1
  318. package/dist/factory/factory.js.map +0 -1
  319. package/dist/history/actions/add-messages.d.ts.map +0 -1
  320. package/dist/history/actions/add-messages.js.map +0 -1
  321. package/dist/history/actions/clear.d.ts.map +0 -1
  322. package/dist/history/actions/clear.js.map +0 -1
  323. package/dist/history/actions/get-messages.d.ts.map +0 -1
  324. package/dist/history/actions/get-messages.js.map +0 -1
  325. package/dist/history/actions/list-sessions.d.ts.map +0 -1
  326. package/dist/history/actions/list-sessions.js.map +0 -1
  327. package/dist/history/actions/reconcile-count.d.ts.map +0 -1
  328. package/dist/history/actions/reconcile-count.js.map +0 -1
  329. package/dist/history/chat-message-history.d.ts.map +0 -1
  330. package/dist/history/chat-message-history.js.map +0 -1
  331. package/dist/history/internal/append-saga.d.ts.map +0 -1
  332. package/dist/history/internal/append-saga.js.map +0 -1
  333. package/dist/history/internal/compensation.d.ts.map +0 -1
  334. package/dist/history/internal/compensation.js.map +0 -1
  335. package/dist/history/internal/item-mapper.d.ts.map +0 -1
  336. package/dist/history/internal/item-mapper.js.map +0 -1
  337. package/dist/history/internal/keys.d.ts.map +0 -1
  338. package/dist/history/internal/keys.js.map +0 -1
  339. package/dist/history/internal/message-chunker.d.ts.map +0 -1
  340. package/dist/history/internal/message-chunker.js.map +0 -1
  341. package/dist/history/internal/message-transaction.d.ts.map +0 -1
  342. package/dist/history/internal/message-transaction.js.map +0 -1
  343. package/dist/history/internal/query.d.ts.map +0 -1
  344. package/dist/history/internal/query.js.map +0 -1
  345. package/dist/history/internal/session-count.d.ts.map +0 -1
  346. package/dist/history/internal/session-count.js.map +0 -1
  347. package/dist/history/internal/session-title.d.ts.map +0 -1
  348. package/dist/history/internal/session-title.js.map +0 -1
  349. package/dist/history/internal/session-update.d.ts.map +0 -1
  350. package/dist/history/internal/session-update.js.map +0 -1
  351. package/dist/history/internal/setup.d.ts.map +0 -1
  352. package/dist/history/internal/setup.js.map +0 -1
  353. package/dist/history/internal/title-generator.d.ts.map +0 -1
  354. package/dist/history/internal/title-generator.js.map +0 -1
  355. package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
  356. package/dist/history/internal/ttl-anchor.js.map +0 -1
  357. package/dist/history/internal/validation.d.ts.map +0 -1
  358. package/dist/history/internal/validation.js.map +0 -1
  359. package/dist/history/session-adapter.d.ts.map +0 -1
  360. package/dist/history/session-adapter.js.map +0 -1
  361. package/dist/history/types.d.ts.map +0 -1
  362. package/dist/history/types.js.map +0 -1
  363. package/dist/index.d.ts.map +0 -1
  364. package/dist/index.js.map +0 -1
  365. package/dist/shared/clock.d.ts.map +0 -1
  366. package/dist/shared/clock.js.map +0 -1
  367. package/dist/shared/codec/codec.d.ts.map +0 -1
  368. package/dist/shared/codec/codec.js.map +0 -1
  369. package/dist/shared/codec/compression.d.ts.map +0 -1
  370. package/dist/shared/codec/compression.js.map +0 -1
  371. package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
  372. package/dist/shared/codec/descriptor-keys.js.map +0 -1
  373. package/dist/shared/codec/json-serde.d.ts.map +0 -1
  374. package/dist/shared/codec/json-serde.js.map +0 -1
  375. package/dist/shared/codec/s3/client.d.ts.map +0 -1
  376. package/dist/shared/codec/s3/client.js.map +0 -1
  377. package/dist/shared/codec/s3/config.d.ts.map +0 -1
  378. package/dist/shared/codec/s3/config.js.map +0 -1
  379. package/dist/shared/codec/s3/delete.d.ts.map +0 -1
  380. package/dist/shared/codec/s3/delete.js.map +0 -1
  381. package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
  382. package/dist/shared/codec/s3/lifecycle.js.map +0 -1
  383. package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
  384. package/dist/shared/codec/s3/offloader.js.map +0 -1
  385. package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
  386. package/dist/shared/codec/s3/orphans.js.map +0 -1
  387. package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
  388. package/dist/shared/codec/s3/read-write.js.map +0 -1
  389. package/dist/shared/codec/s3/retry.d.ts.map +0 -1
  390. package/dist/shared/codec/s3/retry.js.map +0 -1
  391. package/dist/shared/constants.d.ts.map +0 -1
  392. package/dist/shared/constants.js.map +0 -1
  393. package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
  394. package/dist/shared/dynamodb/backoff.js.map +0 -1
  395. package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
  396. package/dist/shared/dynamodb/batch-write.js.map +0 -1
  397. package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
  398. package/dist/shared/dynamodb/cancellation.js.map +0 -1
  399. package/dist/shared/dynamodb/client.d.ts.map +0 -1
  400. package/dist/shared/dynamodb/client.js.map +0 -1
  401. package/dist/shared/dynamodb/conditional-put.d.ts.map +0 -1
  402. package/dist/shared/dynamodb/conditional-put.js.map +0 -1
  403. package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
  404. package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
  405. package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
  406. package/dist/shared/dynamodb/paginate-core.js.map +0 -1
  407. package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
  408. package/dist/shared/dynamodb/paginate.js.map +0 -1
  409. package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
  410. package/dist/shared/dynamodb/partition-delete.js.map +0 -1
  411. package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
  412. package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
  413. package/dist/shared/dynamodb/retry.d.ts.map +0 -1
  414. package/dist/shared/dynamodb/retry.js.map +0 -1
  415. package/dist/shared/dynamodb/scan.d.ts.map +0 -1
  416. package/dist/shared/dynamodb/scan.js.map +0 -1
  417. package/dist/shared/dynamodb/types.d.ts.map +0 -1
  418. package/dist/shared/dynamodb/types.js.map +0 -1
  419. package/dist/shared/errors/base-error.d.ts.map +0 -1
  420. package/dist/shared/errors/base-error.js.map +0 -1
  421. package/dist/shared/errors/error-code.d.ts.map +0 -1
  422. package/dist/shared/errors/error-code.js.map +0 -1
  423. package/dist/shared/errors/errors.d.ts.map +0 -1
  424. package/dist/shared/errors/errors.js.map +0 -1
  425. package/dist/shared/errors/wrap-error.d.ts.map +0 -1
  426. package/dist/shared/errors/wrap-error.js.map +0 -1
  427. package/dist/shared/logging/logger.d.ts.map +0 -1
  428. package/dist/shared/logging/logger.js.map +0 -1
  429. package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
  430. package/dist/shared/logging/redaction-walk.js.map +0 -1
  431. package/dist/shared/logging/redaction.d.ts.map +0 -1
  432. package/dist/shared/logging/redaction.js.map +0 -1
  433. package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
  434. package/dist/shared/logging/secret-patterns.js.map +0 -1
  435. package/dist/shared/options.d.ts.map +0 -1
  436. package/dist/shared/options.js.map +0 -1
  437. package/dist/shared/ulid.d.ts.map +0 -1
  438. package/dist/shared/ulid.js.map +0 -1
  439. package/dist/shared/validation/primitives.d.ts.map +0 -1
  440. package/dist/shared/validation/primitives.js.map +0 -1
  441. package/dist/shared/validation/ttl.d.ts.map +0 -1
  442. package/dist/shared/validation/ttl.js.map +0 -1
  443. package/dist/store/actions/get.d.ts.map +0 -1
  444. package/dist/store/actions/get.js.map +0 -1
  445. package/dist/store/actions/list-namespaces.d.ts.map +0 -1
  446. package/dist/store/actions/list-namespaces.js.map +0 -1
  447. package/dist/store/actions/put.d.ts.map +0 -1
  448. package/dist/store/actions/put.js.map +0 -1
  449. package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
  450. package/dist/store/actions/reconcile-vector-index.js.map +0 -1
  451. package/dist/store/actions/search.d.ts.map +0 -1
  452. package/dist/store/actions/search.js.map +0 -1
  453. package/dist/store/internal/backend-search.d.ts.map +0 -1
  454. package/dist/store/internal/backend-search.js.map +0 -1
  455. package/dist/store/internal/filter.d.ts.map +0 -1
  456. package/dist/store/internal/filter.js.map +0 -1
  457. package/dist/store/internal/index-reconcile.d.ts.map +0 -1
  458. package/dist/store/internal/index-reconcile.js.map +0 -1
  459. package/dist/store/internal/index-sync.d.ts.map +0 -1
  460. package/dist/store/internal/index-sync.js.map +0 -1
  461. package/dist/store/internal/item-mapper.d.ts.map +0 -1
  462. package/dist/store/internal/item-mapper.js.map +0 -1
  463. package/dist/store/internal/keys.d.ts.map +0 -1
  464. package/dist/store/internal/keys.js.map +0 -1
  465. package/dist/store/internal/namespace-match.d.ts.map +0 -1
  466. package/dist/store/internal/namespace-match.js.map +0 -1
  467. package/dist/store/internal/overwrite-swap.d.ts.map +0 -1
  468. package/dist/store/internal/overwrite-swap.js.map +0 -1
  469. package/dist/store/internal/persist.d.ts.map +0 -1
  470. package/dist/store/internal/persist.js.map +0 -1
  471. package/dist/store/internal/query.d.ts.map +0 -1
  472. package/dist/store/internal/query.js.map +0 -1
  473. package/dist/store/internal/ranker.d.ts.map +0 -1
  474. package/dist/store/internal/ranker.js.map +0 -1
  475. package/dist/store/internal/read-existing.d.ts.map +0 -1
  476. package/dist/store/internal/read-existing.js.map +0 -1
  477. package/dist/store/internal/score-direction.d.ts.map +0 -1
  478. package/dist/store/internal/score-direction.js.map +0 -1
  479. package/dist/store/internal/search-filter.d.ts.map +0 -1
  480. package/dist/store/internal/search-filter.js.map +0 -1
  481. package/dist/store/internal/semantic-search.d.ts.map +0 -1
  482. package/dist/store/internal/semantic-search.js.map +0 -1
  483. package/dist/store/internal/setup.d.ts.map +0 -1
  484. package/dist/store/internal/setup.js.map +0 -1
  485. package/dist/store/internal/validation.d.ts.map +0 -1
  486. package/dist/store/internal/validation.js.map +0 -1
  487. package/dist/store/internal/write-verify.d.ts.map +0 -1
  488. package/dist/store/internal/write-verify.js.map +0 -1
  489. package/dist/store/store.d.ts.map +0 -1
  490. package/dist/store/store.js.map +0 -1
  491. package/dist/store/types.d.ts.map +0 -1
  492. package/dist/store/types.js.map +0 -1
  493. package/dist/store/vector-backend.d.ts.map +0 -1
  494. package/dist/store/vector-backend.js.map +0 -1
@@ -7,13 +7,19 @@ const fetch_1 = require("../internal/fetch");
7
7
  /**
8
8
  * Load a checkpoint tuple: the target checkpoint (by id, or the newest in the
9
9
  * namespace), its metadata, its pending writes, and a parent config when the
10
- * checkpoint has a parent. Returns undefined when no matching checkpoint exists.
10
+ * checkpoint has a parent. Returns undefined when no matching checkpoint
11
+ * exists — including for a config that names no thread at all, which the
12
+ * reference savers answer with "nothing" rather than an error.
11
13
  */
12
14
  async function getCheckpointTuple(context, config) {
15
+ if (config.configurable?.thread_id === undefined)
16
+ return undefined;
13
17
  const { threadId, checkpointNs, checkpointId } = (0, configurable_1.readConfigurable)(config);
14
- const meta = await (0, fetch_1.fetchTargetMeta)(context, threadId, checkpointNs, checkpointId);
18
+ const meta = await (0, fetch_1.fetchTargetMeta)(context, threadId, checkpointNs, checkpointId, config.signal);
15
19
  if (!meta)
16
20
  return undefined;
17
- return (0, assemble_1.assembleTuple)(context, threadId, checkpointNs, meta);
21
+ return (0, assemble_1.assembleTuple)(context, threadId, checkpointNs, meta, {
22
+ signal: config.signal,
23
+ consistent: true,
24
+ });
18
25
  }
19
- //# sourceMappingURL=get-tuple.js.map
@@ -2,9 +2,19 @@ import type { RunnableConfig } from '@langchain/core/runnables';
2
2
  import type { CheckpointListOptions, CheckpointTuple } from '@langchain/langgraph-checkpoint';
3
3
  import type { CheckpointerContext } from '../internal/setup';
4
4
  /**
5
- * Yield checkpoint tuples for a thread/namespace, newest first. Honors
6
- * `options.before` (only checkpoints older than the given id), `options.filter`
7
- * (metadata equality), and `options.limit` (max tuples yielded).
5
+ * Yield checkpoint tuples for a thread, newest first: every namespace when the
6
+ * config names none (grouped by namespace, newest first within each), else the
7
+ * one namespace given. Without a `thread_id` every thread in the table is
8
+ * listed through a table scan, as the reference savers do; that read is
9
+ * unordered across threads and cross-tenant by construction. Honors
10
+ * `options.before` (only checkpoints older than the given id),
11
+ * `options.filter` (metadata equality), and `options.limit` (max tuples
12
+ * yielded; the read stops right after the yield that reaches it).
13
+ *
14
+ * The scan is deliberately unbounded: this generator streams and never
15
+ * accumulates, `limit` returns early, and a raw-row cap would turn a caller
16
+ * asking for a handful of rare matches over a large thread into a hard error
17
+ * instead of the true (possibly empty) answer. Past the warning threshold an
18
+ * operator is told to narrow the filter or pass a limit.
8
19
  */
9
20
  export declare function listCheckpoints(context: CheckpointerContext, config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
10
- //# sourceMappingURL=list.d.ts.map
@@ -1,87 +1,113 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listCheckpoints = listCheckpoints;
4
+ const clock_1 = require("../../shared/clock");
4
5
  const constants_1 = require("../../shared/constants");
6
+ const expiry_1 = require("../../shared/dynamodb/expiry");
5
7
  const paginate_1 = require("../../shared/dynamodb/paginate");
8
+ const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
9
+ const scan_1 = require("../../shared/dynamodb/scan");
6
10
  const assemble_1 = require("../internal/assemble");
7
- const configurable_1 = require("../internal/configurable");
8
- const filter_match_1 = require("../internal/filter-match");
11
+ const fetch_1 = require("../internal/fetch");
9
12
  const item_reader_1 = require("../internal/item-reader");
10
- const keys_1 = require("../internal/keys");
11
- const query_1 = require("../internal/query");
12
- /** Read list options into a flat, typed shape. */
13
- function readListOptions(options) {
14
- return {
15
- before: options?.before?.configurable?.checkpoint_id,
16
- filter: options?.filter,
17
- limit: options?.limit,
18
- };
19
- }
13
+ const list_scope_1 = require("../internal/list-scope");
20
14
  /**
21
- * True when `meta` passes the key-level list filters: `before` (strictly older
22
- * checkpoints) and an explicitly requested `checkpoint_id`. Split out from the
23
- * loop so each filter stays independently readable.
15
+ * The tuple for one META item that passes every filter, assembled eventually
16
+ * consistently (a history listing tolerates a replica lag `getTuple` does not)
17
+ * and reusing the metadata the filter already decoded. Undefined when the row
18
+ * is filtered out or its payload is missing.
24
19
  */
25
- function passesKeyFilters(meta, checkpointId, before) {
26
- if (checkpointId !== undefined && meta.checkpointId !== checkpointId)
27
- return false;
28
- return before === undefined || meta.checkpointId < before;
20
+ async function tupleFor(context, meta, scope) {
21
+ if (!(0, list_scope_1.passesKeyFilters)(meta, scope))
22
+ return undefined;
23
+ const verdict = await (0, list_scope_1.passesMetadataFilter)(context, meta, scope);
24
+ if (!verdict.pass)
25
+ return undefined;
26
+ return (0, assemble_1.assembleTuple)(context, meta.threadId, meta.checkpointNs, meta, {
27
+ signal: scope.signal,
28
+ consistent: false,
29
+ metadata: verdict.metadata,
30
+ });
31
+ }
32
+ /** A `checkpoint_id` addresses one row: read it directly instead of scanning the namespace for it. */
33
+ async function* listOne(context, scope) {
34
+ const meta = await (0, fetch_1.fetchTargetMeta)(context, scope.threadId, scope.checkpointNs ?? '', scope.checkpointId, scope.signal);
35
+ if (!meta)
36
+ return;
37
+ const tuple = await tupleFor(context, meta, scope);
38
+ if (tuple)
39
+ yield tuple;
29
40
  }
30
- /** True when `meta` passes the (optional) metadata-equality filter. */
31
- async function passesMetadataFilter(context, meta, filter) {
32
- if (!filter)
33
- return true;
34
- const metadata = (await (0, item_reader_1.readMetadata)(context, meta));
35
- return (0, filter_match_1.matchesFilter)(metadata, filter);
41
+ /** Narrow a scanned row, warning about (and skipping) one that is not a checkpoint meta item. */
42
+ function narrowOrWarn(context, raw) {
43
+ const meta = (0, item_reader_1.narrowMetaItem)(raw);
44
+ if (!meta) {
45
+ context.logger.warn('list: skipped a row that is not a checkpoint meta item', {
46
+ sortKey: raw.SK,
47
+ });
48
+ }
49
+ return meta;
50
+ }
51
+ /** The META rows a scope covers: a partition query for a thread, a table scan without one. */
52
+ function metaRows(context, scope, now) {
53
+ const retry = (0, retry_policy_1.retryFor)(context, scope.signal);
54
+ const bounds = { maxItems: Number.POSITIVE_INFINITY, maxIterations: Number.POSITIVE_INFINITY };
55
+ return scope.threadId === undefined
56
+ ? (0, scan_1.paginateScan)({
57
+ retry,
58
+ signal: scope.signal,
59
+ client: context.client,
60
+ params: (0, expiry_1.withoutExpired)((0, list_scope_1.listScan)(context, scope), now),
61
+ ...bounds,
62
+ })
63
+ : (0, paginate_1.paginateQuery)({
64
+ retry,
65
+ signal: scope.signal,
66
+ client: context.client,
67
+ params: (0, expiry_1.withoutExpired)((0, list_scope_1.listQuery)(context, { ...scope, threadId: scope.threadId }), now),
68
+ ...bounds,
69
+ });
36
70
  }
37
71
  /**
38
- * Yield checkpoint tuples for a thread/namespace, newest first. Honors
39
- * `options.before` (only checkpoints older than the given id), `options.filter`
40
- * (metadata equality), and `options.limit` (max tuples yielded).
72
+ * Yield checkpoint tuples for a thread, newest first: every namespace when the
73
+ * config names none (grouped by namespace, newest first within each), else the
74
+ * one namespace given. Without a `thread_id` every thread in the table is
75
+ * listed through a table scan, as the reference savers do; that read is
76
+ * unordered across threads and cross-tenant by construction. Honors
77
+ * `options.before` (only checkpoints older than the given id),
78
+ * `options.filter` (metadata equality), and `options.limit` (max tuples
79
+ * yielded; the read stops right after the yield that reaches it).
80
+ *
81
+ * The scan is deliberately unbounded: this generator streams and never
82
+ * accumulates, `limit` returns early, and a raw-row cap would turn a caller
83
+ * asking for a handful of rare matches over a large thread into a hard error
84
+ * instead of the true (possibly empty) answer. Past the warning threshold an
85
+ * operator is told to narrow the filter or pass a limit.
41
86
  */
42
87
  async function* listCheckpoints(context, config, options) {
43
- const { threadId, checkpointNs, checkpointId } = (0, configurable_1.readConfigurable)(config);
44
- const { before, filter, limit } = readListOptions(options);
45
- const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.metaSortKeyPrefix)(checkpointNs));
88
+ const scope = (0, list_scope_1.readListScope)(config, options);
89
+ if (scope.threadId !== undefined && scope.checkpointId !== undefined) {
90
+ yield* listOne(context, { ...scope, threadId: scope.threadId });
91
+ return;
92
+ }
93
+ const now = (0, clock_1.nowSeconds)();
46
94
  let yielded = 0;
47
95
  let scanned = 0;
48
- /**
49
- * Unbounded: this is a generator that streams and never accumulates, and
50
- * `limit` already returns early, so the caller's own bound is what stops the
51
- * read. The shared in-memory cap counts *raw rows pulled*, not
52
- * filter-matched ones, so leaving it in place turned a caller asking for a
53
- * handful of rare matches over a large thread into a hard
54
- * ResultTruncatedError instead of the true (possibly empty) answer.
55
- */
56
- for await (const raw of (0, paginate_1.paginateQuery)({
57
- client: context.client,
58
- params,
59
- maxItems: Number.POSITIVE_INFINITY,
60
- maxIterations: Number.POSITIVE_INFINITY,
61
- })) {
96
+ for await (const raw of metaRows(context, scope, now)) {
62
97
  scanned += 1;
63
98
  if (scanned === constants_1.LIST_SCAN_WARN_THRESHOLD) {
64
99
  context.logger.warn('list: scanned a large number of rows without the caller stopping; this read is ' +
65
- 'deliberately unbounded, so narrow the filter or pass options.limit', { threadId, checkpointNs, scanned });
100
+ 'deliberately unbounded, so narrow the filter or pass options.limit', { threadId: scope.threadId, checkpointNs: scope.checkpointNs, scanned });
66
101
  }
67
- if (limit !== undefined && yielded >= limit)
68
- return;
69
- const meta = (0, item_reader_1.narrowMetaItem)(raw);
70
- if (!meta) {
71
- context.logger.warn('list: skipped a row that is not a checkpoint meta item', {
72
- sortKey: raw.SK,
73
- });
74
- continue;
75
- }
76
- if (!passesKeyFilters(meta, checkpointId, before))
102
+ const meta = narrowOrWarn(context, raw);
103
+ if (!meta || (0, expiry_1.isExpiredRow)(meta, now))
77
104
  continue;
78
- if (!(await passesMetadataFilter(context, meta, filter)))
105
+ const tuple = await tupleFor(context, meta, scope);
106
+ if (!tuple)
79
107
  continue;
80
- const tuple = await (0, assemble_1.assembleTuple)(context, threadId, checkpointNs, meta);
81
- if (tuple) {
82
- yield tuple;
83
- yielded += 1;
84
- }
108
+ yield tuple;
109
+ yielded += 1;
110
+ if (scope.limit !== undefined && yielded >= scope.limit)
111
+ return;
85
112
  }
86
113
  }
87
- //# sourceMappingURL=list.js.map
@@ -6,10 +6,10 @@ import type { CheckpointerContext } from '../internal/setup';
6
6
  * Requires `checkpoint_id` in the config — writes always attach to a checkpoint.
7
7
  * Regular writes are first-write-wins (matching the reference checkpointer
8
8
  * contract); special negative-index writes always overwrite (see
9
- * {@link writeSpecialItemsWithCleanup}). Regular-write failure cleanup only
10
- * ever targets items known never to have committed (see
11
- * {@link RegularWriteOutcome}) — never a lost guard, so an upload can leak
12
- * but a live row can never be stranded pointing at a deleted object.
9
+ * {@link writeSpecialItemsWithCleanup}). Regular-write cleanup only ever
10
+ * targets uploads confirmed unreferenced (see {@link writeRegularItems}): a
11
+ * verified non-commit, or a guard rejection whose returned row provably
12
+ * belongs to another call. An upload can leak but a live row can never be
13
+ * stranded pointing at a deleted object.
13
14
  */
14
15
  export declare function putWrites(context: CheckpointerContext, config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
15
- //# sourceMappingURL=put-writes.d.ts.map
@@ -3,16 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.putWrites = putWrites;
4
4
  const descriptor_keys_1 = require("../../shared/codec/descriptor-keys");
5
5
  const orphans_1 = require("../../shared/codec/s3/orphans");
6
- const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
7
- const retry_1 = require("../../shared/dynamodb/retry");
8
6
  const errors_1 = require("../../shared/errors/errors");
9
7
  const ulid_1 = require("../../shared/ulid");
10
8
  const ttl_1 = require("../../shared/validation/ttl");
11
9
  const configurable_1 = require("../internal/configurable");
12
10
  const item_writer_1 = require("../internal/item-writer");
11
+ const regular_write_1 = require("../internal/regular-write");
13
12
  const special_write_cleanup_1 = require("../internal/special-write-cleanup");
14
13
  const validation_1 = require("../internal/validation");
15
- const write_guard_1 = require("../internal/write-guard");
16
14
  /**
17
15
  * Stamps each `putWrites` call, serving two purposes at once. It nonces every
18
16
  * S3 upload, so a repeated write never shares an object with an earlier
@@ -29,46 +27,21 @@ async function cleanUpItems(context, items) {
29
27
  return;
30
28
  await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)(items.map((item) => item.value)), 'putWrites', context.logger);
31
29
  }
32
- /**
33
- * Write regular items with a first-write-wins guard. Every `PutCommand` fully
34
- * settles (`Promise.allSettled`) before this resolves and never rejects; a
35
- * genuine failure is reported via `error`, not thrown.
36
- */
37
- async function writeRegularItems(context, items) {
38
- const failed = [];
39
- let error;
40
- const results = await Promise.allSettled(items.map((item) => (0, retry_1.withDynamoDBRetry)(() => context.client.put({
41
- TableName: context.tableName,
42
- Item: item,
43
- ConditionExpression: 'attribute_not_exists(PK)',
44
- ReturnValuesOnConditionCheckFailure: 'ALL_OLD',
45
- }))));
46
- results.forEach((result, index) => {
47
- if (result.status === 'fulfilled')
48
- return;
49
- const reason = result.reason;
50
- if ((0, conditional_put_1.isConditionalCheckFailed)(reason)) {
51
- (0, write_guard_1.reportGuardRejection)(context, items[index], reason);
52
- return;
53
- }
54
- failed.push(items[index]);
55
- error = error ?? reason;
56
- });
57
- return { failed, error };
58
- }
59
30
  /**
60
31
  * Persist a task's intermediate writes for a checkpoint as one item per write.
61
32
  * Requires `checkpoint_id` in the config — writes always attach to a checkpoint.
62
33
  * Regular writes are first-write-wins (matching the reference checkpointer
63
34
  * contract); special negative-index writes always overwrite (see
64
- * {@link writeSpecialItemsWithCleanup}). Regular-write failure cleanup only
65
- * ever targets items known never to have committed (see
66
- * {@link RegularWriteOutcome}) — never a lost guard, so an upload can leak
67
- * but a live row can never be stranded pointing at a deleted object.
35
+ * {@link writeSpecialItemsWithCleanup}). Regular-write cleanup only ever
36
+ * targets uploads confirmed unreferenced (see {@link writeRegularItems}): a
37
+ * verified non-commit, or a guard rejection whose returned row provably
38
+ * belongs to another call. An upload can leak but a live row can never be
39
+ * stranded pointing at a deleted object.
68
40
  */
69
41
  async function putWrites(context, config, writes, taskId) {
70
42
  (0, validation_1.validateTaskId)(taskId);
71
43
  const { threadId, checkpointNs, checkpointId } = (0, configurable_1.readConfigurable)(config);
44
+ const signal = config.signal;
72
45
  if (checkpointId === undefined) {
73
46
  throw new errors_1.ValidationError('checkpoint_id is required to store writes', 'checkpoint_id');
74
47
  }
@@ -79,13 +52,11 @@ async function putWrites(context, config, writes, taskId) {
79
52
  const special = items.filter((item) => item.index < 0);
80
53
  const regular = items.filter((item) => item.index >= 0);
81
54
  const [specialError, regularOutcome] = await Promise.all([
82
- (0, special_write_cleanup_1.writeSpecialItemsWithCleanup)(context, special),
83
- writeRegularItems(context, regular),
55
+ (0, special_write_cleanup_1.writeSpecialItemsWithCleanup)(context, threadId, special, signal),
56
+ (0, regular_write_1.writeRegularItems)(context, regular, signal),
84
57
  ]);
58
+ await cleanUpItems(context, regularOutcome.deadUploads);
85
59
  const firstError = specialError ?? regularOutcome.error;
86
- if (!firstError)
87
- return;
88
- await cleanUpItems(context, regularOutcome.failed);
89
- throw firstError;
60
+ if (firstError)
61
+ throw firstError;
90
62
  }
91
- //# sourceMappingURL=put-writes.js.map
@@ -1,10 +1,17 @@
1
1
  import type { RunnableConfig } from '@langchain/core/runnables';
2
- import type { Checkpoint, CheckpointMetadata } from '@langchain/langgraph-checkpoint';
2
+ import type { ChannelVersions, Checkpoint, CheckpointMetadata } from '@langchain/langgraph-checkpoint';
3
3
  import type { CheckpointerContext } from '../internal/setup';
4
4
  /**
5
5
  * Persist a checkpoint and its metadata as a transactional pair of META and
6
6
  * PAYLOAD items, returning the config that addresses the stored checkpoint. The
7
7
  * incoming `checkpoint_id` (if any) becomes the new checkpoint's parent.
8
+ * `newVersions` names the channels that changed in this step: only those and
9
+ * the ones the parent stored are persisted (see `storedChannelsFor`).
10
+ *
11
+ * On failure with S3 offload configured, the rows are read back before any
12
+ * upload is deleted (see {@link verifyCheckpointLanded}): a transaction that
13
+ * committed and lost its response is reported as success, a confirmed
14
+ * non-commit cleans up this call's own nonced uploads, and an unverifiable
15
+ * outcome leaks them rather than risk stranding a live row.
8
16
  */
9
- export declare function putCheckpoint(context: CheckpointerContext, config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;
10
- //# sourceMappingURL=put.d.ts.map
17
+ export declare function putCheckpoint(context: CheckpointerContext, config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, newVersions?: ChannelVersions): Promise<RunnableConfig>;
@@ -4,40 +4,70 @@ exports.putCheckpoint = putCheckpoint;
4
4
  const descriptor_keys_1 = require("../../shared/codec/descriptor-keys");
5
5
  const orphans_1 = require("../../shared/codec/s3/orphans");
6
6
  const retry_1 = require("../../shared/dynamodb/retry");
7
+ const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
8
+ const ulid_1 = require("../../shared/ulid");
7
9
  const ttl_1 = require("../../shared/validation/ttl");
10
+ const checkpoint_write_verify_1 = require("../internal/checkpoint-write-verify");
8
11
  const configurable_1 = require("../internal/configurable");
9
12
  const item_writer_1 = require("../internal/item-writer");
13
+ const stored_channels_1 = require("../internal/stored-channels");
10
14
  const validation_1 = require("../internal/validation");
15
+ /**
16
+ * Nonces every put's S3 uploads (see {@link buildCheckpointItems}). A ULID
17
+ * rather than a UUID because it sorts by time, which keeps a bucket listing of
18
+ * one checkpoint's objects readable.
19
+ */
20
+ const nextPutNonce = (0, ulid_1.createUlidFactory)();
11
21
  /**
12
22
  * Persist a checkpoint and its metadata as a transactional pair of META and
13
23
  * PAYLOAD items, returning the config that addresses the stored checkpoint. The
14
24
  * incoming `checkpoint_id` (if any) becomes the new checkpoint's parent.
25
+ * `newVersions` names the channels that changed in this step: only those and
26
+ * the ones the parent stored are persisted (see `storedChannelsFor`).
27
+ *
28
+ * On failure with S3 offload configured, the rows are read back before any
29
+ * upload is deleted (see {@link verifyCheckpointLanded}): a transaction that
30
+ * committed and lost its response is reported as success, a confirmed
31
+ * non-commit cleans up this call's own nonced uploads, and an unverifiable
32
+ * outcome leaks them rather than risk stranding a live row.
15
33
  */
16
- async function putCheckpoint(context, config, checkpoint, metadata) {
34
+ async function putCheckpoint(context, config, checkpoint, metadata, newVersions) {
17
35
  const { threadId, checkpointNs, checkpointId: parentCheckpointId } = (0, configurable_1.readConfigurable)(config);
36
+ const signal = config.signal;
18
37
  (0, validation_1.validateCheckpointId)(checkpoint.id);
19
38
  const ttlTimestamp = context.ttl ? (0, ttl_1.calculateTtlTimestamp)(context.ttl) : undefined;
20
- const { meta, payload } = await (0, item_writer_1.buildCheckpointItems)(context, threadId, checkpointNs, checkpoint, metadata, parentCheckpointId, ttlTimestamp);
39
+ const storedChannels = await (0, stored_channels_1.storedChannelsFor)(context, threadId, checkpointNs, checkpoint, newVersions, parentCheckpointId, signal);
40
+ const { meta, payload } = await (0, item_writer_1.buildCheckpointItems)(context, threadId, checkpointNs, checkpoint, metadata, nextPutNonce(), parentCheckpointId, ttlTimestamp, storedChannels);
41
+ const stored = {
42
+ configurable: {
43
+ thread_id: threadId,
44
+ checkpoint_ns: checkpointNs,
45
+ checkpoint_id: checkpoint.id,
46
+ },
47
+ };
21
48
  try {
22
49
  await (0, retry_1.withDynamoDBRetry)(() => context.client.transactWrite({
23
50
  TransactItems: [
24
51
  { Put: { TableName: context.tableName, Item: meta } },
25
52
  { Put: { TableName: context.tableName, Item: payload } },
26
53
  ],
27
- }));
54
+ }), (0, retry_policy_1.retryFor)(context, signal));
28
55
  }
29
56
  catch (error) {
30
- if (context.offloader) {
57
+ if (!context.offloader)
58
+ throw error;
59
+ const verdict = await (0, checkpoint_write_verify_1.verifyCheckpointLanded)(context, meta, payload);
60
+ if (verdict === 'landed') {
61
+ context.logger.debug('put: transaction committed although its response was lost', {
62
+ threadId,
63
+ checkpointId: checkpoint.id,
64
+ });
65
+ return stored;
66
+ }
67
+ if (verdict === 'not-landed') {
31
68
  await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)([meta.metadata, payload.checkpoint]), 'put', context.logger);
32
69
  }
33
70
  throw error;
34
71
  }
35
- return {
36
- configurable: {
37
- thread_id: threadId,
38
- checkpoint_ns: checkpointNs,
39
- checkpoint_id: checkpoint.id,
40
- },
41
- };
72
+ return stored;
42
73
  }
43
- //# sourceMappingURL=put.js.map
@@ -1,10 +1,17 @@
1
- import type { CheckpointTuple } from '@langchain/langgraph-checkpoint';
1
+ import type { CheckpointMetadata, CheckpointTuple } from '@langchain/langgraph-checkpoint';
2
2
  import type { CheckpointMetaItem } from '../types';
3
3
  import type { CheckpointerContext } from './setup';
4
+ /** How a tuple is assembled: cancellation, read consistency, and metadata already decoded by the caller. */
5
+ export interface AssembleOptions {
6
+ signal?: AbortSignal;
7
+ /** `true` for `getTuple` (read-your-writes), `false` for the eventually-consistent `list` path. */
8
+ consistent: boolean;
9
+ /** Metadata the caller decoded to apply a filter, so it is not decoded (or downloaded) twice. */
10
+ metadata?: CheckpointMetadata;
11
+ }
4
12
  /**
5
13
  * Assemble a full {@link CheckpointTuple} from a META item: fetch and decode its
6
14
  * payload, metadata, and pending writes, attaching a parent config when present.
7
15
  * Returns undefined when the payload item is missing (inconsistent state).
8
16
  */
9
- export declare function assembleTuple(context: CheckpointerContext, threadId: string, checkpointNs: string, meta: CheckpointMetaItem): Promise<CheckpointTuple | undefined>;
10
- //# sourceMappingURL=assemble.d.ts.map
17
+ export declare function assembleTuple(context: CheckpointerContext, threadId: string, checkpointNs: string, meta: CheckpointMetaItem, options: AssembleOptions): Promise<CheckpointTuple | undefined>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assembleTuple = assembleTuple;
4
4
  const fetch_1 = require("./fetch");
5
5
  const item_reader_1 = require("./item-reader");
6
+ const pending_sends_1 = require("./pending-sends");
6
7
  /** Build a config that addresses a specific checkpoint. */
7
8
  function configFor(threadId, checkpointNs, checkpointId) {
8
9
  return {
@@ -14,14 +15,15 @@ function configFor(threadId, checkpointNs, checkpointId) {
14
15
  * payload, metadata, and pending writes, attaching a parent config when present.
15
16
  * Returns undefined when the payload item is missing (inconsistent state).
16
17
  */
17
- async function assembleTuple(context, threadId, checkpointNs, meta) {
18
- const payload = await (0, fetch_1.fetchPayload)(context, threadId, checkpointNs, meta.checkpointId);
18
+ async function assembleTuple(context, threadId, checkpointNs, meta, options) {
19
+ const read = { signal: options.signal, consistent: options.consistent };
20
+ const payload = await (0, fetch_1.fetchPayload)(context, threadId, checkpointNs, meta.checkpointId, read);
19
21
  if (!payload)
20
22
  return undefined;
21
23
  const [checkpoint, metadata, pendingWrites] = await Promise.all([
22
- (0, item_reader_1.readCheckpoint)(context, payload),
23
- (0, item_reader_1.readMetadata)(context, meta),
24
- (0, fetch_1.fetchPendingWrites)(context, threadId, checkpointNs, meta.checkpointId),
24
+ (0, item_reader_1.readCheckpoint)(context, payload, threadId).then((stored) => (0, pending_sends_1.migratePendingSends)(context, stored, threadId, checkpointNs, meta.parentCheckpointId, read)),
25
+ options.metadata ?? (0, item_reader_1.readMetadata)(context, meta, threadId),
26
+ (0, fetch_1.fetchPendingWrites)(context, threadId, checkpointNs, meta.checkpointId, read),
25
27
  ]);
26
28
  const tuple = {
27
29
  config: configFor(threadId, checkpointNs, meta.checkpointId),
@@ -34,4 +36,3 @@ async function assembleTuple(context, threadId, checkpointNs, meta) {
34
36
  }
35
37
  return tuple;
36
38
  }
37
- //# sourceMappingURL=assemble.js.map
@@ -0,0 +1,24 @@
1
+ import type { CheckpointMetaItem, CheckpointPayloadItem } from '../types';
2
+ import type { CheckpointerContext } from './setup';
3
+ /** What a post-failure verification read could establish about a put. */
4
+ export type CheckpointWriteVerdict = 'landed' | 'not-landed' | 'unverified';
5
+ /**
6
+ * Read one of the two rows back after the META+PAYLOAD transaction failed and
7
+ * report what that failure actually did — never assuming it did nothing.
8
+ *
9
+ * No rejection is proof of a non-commit: `withDynamoDBRetry` re-issues a
10
+ * transaction whose response was lost, and the re-issues can time out at the
11
+ * transport without reaching DynamoDB, so the budget is spent on a
12
+ * `RetryExhaustedError` while the rows are committed. Deleting the uploads on
13
+ * that basis stranded the head checkpoint of a thread on a `NoSuchKey`.
14
+ *
15
+ * Keys are nonced per call (see `buildCheckpointItems`), so "the row holds
16
+ * this attempt's key" is the same statement as "this attempt's write is
17
+ * live". When neither descriptor is offloaded there is nothing to delete, so
18
+ * the answer is simply "safe to clean up", a no-op for the caller.
19
+ *
20
+ * A read failure establishes nothing; the caller then leaks one object at
21
+ * worst (reclaimed by `ensureS3LifecycleRule`) rather than deleting one a live
22
+ * row may point at — the same trade `store/internal/persist.ts` makes.
23
+ */
24
+ export declare function verifyCheckpointLanded(context: CheckpointerContext, meta: CheckpointMetaItem, payload: CheckpointPayloadItem): Promise<CheckpointWriteVerdict>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyCheckpointLanded = verifyCheckpointLanded;
4
+ const codec_1 = require("../../shared/codec/codec");
5
+ const retry_1 = require("../../shared/dynamodb/retry");
6
+ /** The S3 key an offloaded descriptor points at, or undefined for inline/absent. */
7
+ function offloadedKey(descriptor) {
8
+ return descriptor?.location === codec_1.PayloadLocation.S3 ? descriptor.s3Key : undefined;
9
+ }
10
+ /**
11
+ * Pick the row carrying an offloaded descriptor. The META and PAYLOAD rows
12
+ * commit in one transaction, so one of them is enough; with neither offloaded
13
+ * there is nothing to protect and no read to spend.
14
+ */
15
+ function chooseProbe(meta, payload) {
16
+ const metaKey = offloadedKey(meta.metadata);
17
+ if (metaKey !== undefined) {
18
+ return { key: { PK: meta.PK, SK: meta.SK }, attribute: 'metadata', expected: metaKey };
19
+ }
20
+ const payloadKey = offloadedKey(payload.checkpoint);
21
+ if (payloadKey !== undefined) {
22
+ return {
23
+ key: { PK: payload.PK, SK: payload.SK },
24
+ attribute: 'checkpoint',
25
+ expected: payloadKey,
26
+ };
27
+ }
28
+ return undefined;
29
+ }
30
+ /**
31
+ * Read one of the two rows back after the META+PAYLOAD transaction failed and
32
+ * report what that failure actually did — never assuming it did nothing.
33
+ *
34
+ * No rejection is proof of a non-commit: `withDynamoDBRetry` re-issues a
35
+ * transaction whose response was lost, and the re-issues can time out at the
36
+ * transport without reaching DynamoDB, so the budget is spent on a
37
+ * `RetryExhaustedError` while the rows are committed. Deleting the uploads on
38
+ * that basis stranded the head checkpoint of a thread on a `NoSuchKey`.
39
+ *
40
+ * Keys are nonced per call (see `buildCheckpointItems`), so "the row holds
41
+ * this attempt's key" is the same statement as "this attempt's write is
42
+ * live". When neither descriptor is offloaded there is nothing to delete, so
43
+ * the answer is simply "safe to clean up", a no-op for the caller.
44
+ *
45
+ * A read failure establishes nothing; the caller then leaks one object at
46
+ * worst (reclaimed by `ensureS3LifecycleRule`) rather than deleting one a live
47
+ * row may point at — the same trade `store/internal/persist.ts` makes.
48
+ */
49
+ async function verifyCheckpointLanded(context, meta, payload) {
50
+ const probe = chooseProbe(meta, payload);
51
+ if (!probe)
52
+ return 'not-landed';
53
+ try {
54
+ const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
55
+ TableName: context.tableName,
56
+ Key: probe.key,
57
+ ConsistentRead: true,
58
+ ProjectionExpression: '#d',
59
+ ExpressionAttributeNames: { '#d': probe.attribute },
60
+ }), context.retry);
61
+ const stored = result.Item?.[probe.attribute];
62
+ return offloadedKey(stored) === probe.expected ? 'landed' : 'not-landed';
63
+ }
64
+ catch {
65
+ return 'unverified';
66
+ }
67
+ }
@@ -10,4 +10,3 @@ export interface ResolvedConfigurable {
10
10
  * defaulting the namespace to empty and validating that a thread id is present.
11
11
  */
12
12
  export declare function readConfigurable(config: RunnableConfig): ResolvedConfigurable;
13
- //# sourceMappingURL=configurable.d.ts.map
@@ -11,13 +11,14 @@ function readConfigurable(config) {
11
11
  (0, validation_1.validateThreadId)(configurable.thread_id);
12
12
  const checkpointNs = configurable.checkpoint_ns ?? '';
13
13
  (0, validation_1.validateCheckpointNs)(checkpointNs);
14
- if (configurable.checkpoint_id !== undefined) {
15
- (0, validation_1.validateCheckpointId)(configurable.checkpoint_id);
16
- }
17
- return {
18
- threadId: configurable.thread_id,
19
- checkpointNs,
20
- checkpointId: configurable.checkpoint_id,
21
- };
14
+ /**
15
+ * `null`, `''` and the legacy `thread_ts` alias resolve the way the reference's
16
+ * `getCheckpointId` does: a falsy id addresses the latest checkpoint rather
17
+ * than failing a config that was built from JSON or ported from another saver.
18
+ */
19
+ const rawId = configurable.checkpoint_id ?? configurable.thread_ts;
20
+ const checkpointId = rawId ? rawId : undefined;
21
+ if (checkpointId !== undefined)
22
+ (0, validation_1.validateCheckpointId)(checkpointId);
23
+ return { threadId: configurable.thread_id, checkpointNs, checkpointId };
22
24
  }
23
- //# sourceMappingURL=configurable.js.map