@farukada/aws-langgraph-dynamodb-ts 0.8.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 (482) 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 +94 -61
  8. package/dist/checkpointer/actions/put-writes.d.ts +5 -5
  9. package/dist/checkpointer/actions/put-writes.js +12 -40
  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 +31 -6
  23. package/dist/checkpointer/internal/item-reader.js +54 -15
  24. package/dist/checkpointer/internal/item-writer.d.ts +12 -3
  25. package/dist/checkpointer/internal/item-writer.js +26 -10
  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 +29 -0
  39. package/dist/checkpointer/internal/special-write-cas.js +104 -0
  40. package/dist/checkpointer/internal/special-write-cleanup.d.ts +19 -14
  41. package/dist/checkpointer/internal/special-write-cleanup.js +35 -87
  42. package/dist/checkpointer/internal/special-write-verify.d.ts +53 -0
  43. package/dist/checkpointer/internal/special-write-verify.js +80 -0
  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 -9
  49. package/dist/checkpointer/internal/write-guard.js +16 -16
  50. package/dist/checkpointer/internal/write-index.d.ts +8 -1
  51. package/dist/checkpointer/internal/write-index.js +6 -3
  52. package/dist/checkpointer/saver.d.ts +50 -10
  53. package/dist/checkpointer/saver.js +59 -17
  54. package/dist/checkpointer/types.d.ts +14 -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 +68 -5
  149. package/dist/shared/constants.js +70 -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 +67 -0
  161. package/dist/shared/dynamodb/conditional-put.js +76 -0
  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 +14 -6
  199. package/dist/shared/logging/redaction.js +19 -4
  200. package/dist/shared/logging/secret-patterns.d.ts +54 -3
  201. package/dist/shared/logging/secret-patterns.js +67 -8
  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 +27 -28
  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 +14 -7
  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 +25 -6
  230. package/dist/store/internal/index-reconcile.d.ts +5 -6
  231. package/dist/store/internal/index-reconcile.js +32 -13
  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 +6 -3
  235. package/dist/store/internal/item-mapper.js +16 -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 +32 -0
  243. package/dist/store/internal/overwrite-swap.js +68 -0
  244. package/dist/store/internal/persist.d.ts +24 -7
  245. package/dist/store/internal/persist.js +49 -19
  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 +23 -0
  251. package/dist/store/internal/read-existing.js +41 -0
  252. package/dist/store/internal/score-direction.d.ts +31 -0
  253. package/dist/store/internal/score-direction.js +38 -0
  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 +6 -12
  259. package/dist/store/internal/setup.js +12 -24
  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 +27 -9
  265. package/dist/store/internal/write-verify.js +35 -19
  266. package/dist/store/store.d.ts +37 -9
  267. package/dist/store/store.js +52 -17
  268. package/dist/store/types.d.ts +22 -2
  269. package/dist/store/types.js +0 -1
  270. package/dist/store/vector-backend.d.ts +6 -7
  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-cleanup.d.ts.map +0 -1
  302. package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
  303. package/dist/checkpointer/internal/validation.d.ts.map +0 -1
  304. package/dist/checkpointer/internal/validation.js.map +0 -1
  305. package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
  306. package/dist/checkpointer/internal/write-guard.js.map +0 -1
  307. package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
  308. package/dist/checkpointer/internal/write-index.js.map +0 -1
  309. package/dist/checkpointer/saver.d.ts.map +0 -1
  310. package/dist/checkpointer/saver.js.map +0 -1
  311. package/dist/checkpointer/types.d.ts.map +0 -1
  312. package/dist/checkpointer/types.js.map +0 -1
  313. package/dist/factory/factory.d.ts.map +0 -1
  314. package/dist/factory/factory.js.map +0 -1
  315. package/dist/history/actions/add-messages.d.ts.map +0 -1
  316. package/dist/history/actions/add-messages.js.map +0 -1
  317. package/dist/history/actions/clear.d.ts.map +0 -1
  318. package/dist/history/actions/clear.js.map +0 -1
  319. package/dist/history/actions/get-messages.d.ts.map +0 -1
  320. package/dist/history/actions/get-messages.js.map +0 -1
  321. package/dist/history/actions/list-sessions.d.ts.map +0 -1
  322. package/dist/history/actions/list-sessions.js.map +0 -1
  323. package/dist/history/actions/reconcile-count.d.ts.map +0 -1
  324. package/dist/history/actions/reconcile-count.js.map +0 -1
  325. package/dist/history/chat-message-history.d.ts.map +0 -1
  326. package/dist/history/chat-message-history.js.map +0 -1
  327. package/dist/history/internal/append-saga.d.ts.map +0 -1
  328. package/dist/history/internal/append-saga.js.map +0 -1
  329. package/dist/history/internal/compensation.d.ts.map +0 -1
  330. package/dist/history/internal/compensation.js.map +0 -1
  331. package/dist/history/internal/item-mapper.d.ts.map +0 -1
  332. package/dist/history/internal/item-mapper.js.map +0 -1
  333. package/dist/history/internal/keys.d.ts.map +0 -1
  334. package/dist/history/internal/keys.js.map +0 -1
  335. package/dist/history/internal/message-chunker.d.ts.map +0 -1
  336. package/dist/history/internal/message-chunker.js.map +0 -1
  337. package/dist/history/internal/message-transaction.d.ts.map +0 -1
  338. package/dist/history/internal/message-transaction.js.map +0 -1
  339. package/dist/history/internal/query.d.ts.map +0 -1
  340. package/dist/history/internal/query.js.map +0 -1
  341. package/dist/history/internal/session-count.d.ts.map +0 -1
  342. package/dist/history/internal/session-count.js.map +0 -1
  343. package/dist/history/internal/session-title.d.ts.map +0 -1
  344. package/dist/history/internal/session-title.js.map +0 -1
  345. package/dist/history/internal/session-update.d.ts.map +0 -1
  346. package/dist/history/internal/session-update.js.map +0 -1
  347. package/dist/history/internal/setup.d.ts.map +0 -1
  348. package/dist/history/internal/setup.js.map +0 -1
  349. package/dist/history/internal/title-generator.d.ts.map +0 -1
  350. package/dist/history/internal/title-generator.js.map +0 -1
  351. package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
  352. package/dist/history/internal/ttl-anchor.js.map +0 -1
  353. package/dist/history/internal/validation.d.ts.map +0 -1
  354. package/dist/history/internal/validation.js.map +0 -1
  355. package/dist/history/session-adapter.d.ts.map +0 -1
  356. package/dist/history/session-adapter.js.map +0 -1
  357. package/dist/history/types.d.ts.map +0 -1
  358. package/dist/history/types.js.map +0 -1
  359. package/dist/index.d.ts.map +0 -1
  360. package/dist/index.js.map +0 -1
  361. package/dist/shared/clock.d.ts.map +0 -1
  362. package/dist/shared/clock.js.map +0 -1
  363. package/dist/shared/codec/codec.d.ts.map +0 -1
  364. package/dist/shared/codec/codec.js.map +0 -1
  365. package/dist/shared/codec/compression.d.ts.map +0 -1
  366. package/dist/shared/codec/compression.js.map +0 -1
  367. package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
  368. package/dist/shared/codec/descriptor-keys.js.map +0 -1
  369. package/dist/shared/codec/json-serde.d.ts.map +0 -1
  370. package/dist/shared/codec/json-serde.js.map +0 -1
  371. package/dist/shared/codec/s3/client.d.ts.map +0 -1
  372. package/dist/shared/codec/s3/client.js.map +0 -1
  373. package/dist/shared/codec/s3/config.d.ts.map +0 -1
  374. package/dist/shared/codec/s3/config.js.map +0 -1
  375. package/dist/shared/codec/s3/delete.d.ts.map +0 -1
  376. package/dist/shared/codec/s3/delete.js.map +0 -1
  377. package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
  378. package/dist/shared/codec/s3/lifecycle.js.map +0 -1
  379. package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
  380. package/dist/shared/codec/s3/offloader.js.map +0 -1
  381. package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
  382. package/dist/shared/codec/s3/orphans.js.map +0 -1
  383. package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
  384. package/dist/shared/codec/s3/read-write.js.map +0 -1
  385. package/dist/shared/codec/s3/retry.d.ts.map +0 -1
  386. package/dist/shared/codec/s3/retry.js.map +0 -1
  387. package/dist/shared/constants.d.ts.map +0 -1
  388. package/dist/shared/constants.js.map +0 -1
  389. package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
  390. package/dist/shared/dynamodb/backoff.js.map +0 -1
  391. package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
  392. package/dist/shared/dynamodb/batch-write.js.map +0 -1
  393. package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
  394. package/dist/shared/dynamodb/cancellation.js.map +0 -1
  395. package/dist/shared/dynamodb/client.d.ts.map +0 -1
  396. package/dist/shared/dynamodb/client.js.map +0 -1
  397. package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
  398. package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
  399. package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
  400. package/dist/shared/dynamodb/paginate-core.js.map +0 -1
  401. package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
  402. package/dist/shared/dynamodb/paginate.js.map +0 -1
  403. package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
  404. package/dist/shared/dynamodb/partition-delete.js.map +0 -1
  405. package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
  406. package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
  407. package/dist/shared/dynamodb/retry.d.ts.map +0 -1
  408. package/dist/shared/dynamodb/retry.js.map +0 -1
  409. package/dist/shared/dynamodb/scan.d.ts.map +0 -1
  410. package/dist/shared/dynamodb/scan.js.map +0 -1
  411. package/dist/shared/dynamodb/types.d.ts.map +0 -1
  412. package/dist/shared/dynamodb/types.js.map +0 -1
  413. package/dist/shared/errors/base-error.d.ts.map +0 -1
  414. package/dist/shared/errors/base-error.js.map +0 -1
  415. package/dist/shared/errors/error-code.d.ts.map +0 -1
  416. package/dist/shared/errors/error-code.js.map +0 -1
  417. package/dist/shared/errors/errors.d.ts.map +0 -1
  418. package/dist/shared/errors/errors.js.map +0 -1
  419. package/dist/shared/errors/wrap-error.d.ts.map +0 -1
  420. package/dist/shared/errors/wrap-error.js.map +0 -1
  421. package/dist/shared/logging/logger.d.ts.map +0 -1
  422. package/dist/shared/logging/logger.js.map +0 -1
  423. package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
  424. package/dist/shared/logging/redaction-walk.js.map +0 -1
  425. package/dist/shared/logging/redaction.d.ts.map +0 -1
  426. package/dist/shared/logging/redaction.js.map +0 -1
  427. package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
  428. package/dist/shared/logging/secret-patterns.js.map +0 -1
  429. package/dist/shared/options.d.ts.map +0 -1
  430. package/dist/shared/options.js.map +0 -1
  431. package/dist/shared/ulid.d.ts.map +0 -1
  432. package/dist/shared/ulid.js.map +0 -1
  433. package/dist/shared/validation/primitives.d.ts.map +0 -1
  434. package/dist/shared/validation/primitives.js.map +0 -1
  435. package/dist/shared/validation/ttl.d.ts.map +0 -1
  436. package/dist/shared/validation/ttl.js.map +0 -1
  437. package/dist/store/actions/get.d.ts.map +0 -1
  438. package/dist/store/actions/get.js.map +0 -1
  439. package/dist/store/actions/list-namespaces.d.ts.map +0 -1
  440. package/dist/store/actions/list-namespaces.js.map +0 -1
  441. package/dist/store/actions/put.d.ts.map +0 -1
  442. package/dist/store/actions/put.js.map +0 -1
  443. package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
  444. package/dist/store/actions/reconcile-vector-index.js.map +0 -1
  445. package/dist/store/actions/search.d.ts.map +0 -1
  446. package/dist/store/actions/search.js.map +0 -1
  447. package/dist/store/internal/backend-search.d.ts.map +0 -1
  448. package/dist/store/internal/backend-search.js.map +0 -1
  449. package/dist/store/internal/filter.d.ts.map +0 -1
  450. package/dist/store/internal/filter.js.map +0 -1
  451. package/dist/store/internal/index-reconcile.d.ts.map +0 -1
  452. package/dist/store/internal/index-reconcile.js.map +0 -1
  453. package/dist/store/internal/index-sync.d.ts.map +0 -1
  454. package/dist/store/internal/index-sync.js.map +0 -1
  455. package/dist/store/internal/item-mapper.d.ts.map +0 -1
  456. package/dist/store/internal/item-mapper.js.map +0 -1
  457. package/dist/store/internal/keys.d.ts.map +0 -1
  458. package/dist/store/internal/keys.js.map +0 -1
  459. package/dist/store/internal/namespace-match.d.ts.map +0 -1
  460. package/dist/store/internal/namespace-match.js.map +0 -1
  461. package/dist/store/internal/persist.d.ts.map +0 -1
  462. package/dist/store/internal/persist.js.map +0 -1
  463. package/dist/store/internal/query.d.ts.map +0 -1
  464. package/dist/store/internal/query.js.map +0 -1
  465. package/dist/store/internal/ranker.d.ts.map +0 -1
  466. package/dist/store/internal/ranker.js.map +0 -1
  467. package/dist/store/internal/search-filter.d.ts.map +0 -1
  468. package/dist/store/internal/search-filter.js.map +0 -1
  469. package/dist/store/internal/semantic-search.d.ts.map +0 -1
  470. package/dist/store/internal/semantic-search.js.map +0 -1
  471. package/dist/store/internal/setup.d.ts.map +0 -1
  472. package/dist/store/internal/setup.js.map +0 -1
  473. package/dist/store/internal/validation.d.ts.map +0 -1
  474. package/dist/store/internal/validation.js.map +0 -1
  475. package/dist/store/internal/write-verify.d.ts.map +0 -1
  476. package/dist/store/internal/write-verify.js.map +0 -1
  477. package/dist/store/store.d.ts.map +0 -1
  478. package/dist/store/store.js.map +0 -1
  479. package/dist/store/types.d.ts.map +0 -1
  480. package/dist/store/types.js.map +0 -1
  481. package/dist/store/vector-backend.d.ts.map +0 -1
  482. package/dist/store/vector-backend.js.map +0 -1
@@ -1,10 +1,19 @@
1
1
  import type { CheckpointPendingWrite } from '@langchain/langgraph-checkpoint';
2
2
  import type { CheckpointMetaItem, CheckpointPayloadItem } from '../types';
3
3
  import type { CheckpointerContext } from './setup';
4
- /** Fetch the target META item: by id when given, else the newest in the namespace. */
5
- export declare function fetchTargetMeta(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId?: string): Promise<CheckpointMetaItem | undefined>;
4
+ /** Per-read options for the payload and writes reads. */
5
+ export interface ReadOptions {
6
+ signal?: AbortSignal;
7
+ /** `false` for bulk reads (`list`) that trade read-your-writes for half the read cost. */
8
+ consistent?: boolean;
9
+ }
10
+ /**
11
+ * Fetch the target META item: by id when given, else the newest in the
12
+ * namespace. The newest-first read pages one row at a time past any foreign
13
+ * row until it finds a real checkpoint.
14
+ */
15
+ export declare function fetchTargetMeta(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId?: string, signal?: AbortSignal): Promise<CheckpointMetaItem | undefined>;
6
16
  /** Fetch the PAYLOAD item for a checkpoint. */
7
- export declare function fetchPayload(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string): Promise<CheckpointPayloadItem | undefined>;
17
+ export declare function fetchPayload(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, read?: ReadOptions): Promise<CheckpointPayloadItem | undefined>;
8
18
  /** Fetch and decode every pending write for a checkpoint, in write order. */
9
- export declare function fetchPendingWrites(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string): Promise<CheckpointPendingWrite[]>;
10
- //# sourceMappingURL=fetch.d.ts.map
19
+ export declare function fetchPendingWrites(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, read?: ReadOptions): Promise<CheckpointPendingWrite[]>;
@@ -3,44 +3,86 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchTargetMeta = fetchTargetMeta;
4
4
  exports.fetchPayload = fetchPayload;
5
5
  exports.fetchPendingWrites = fetchPendingWrites;
6
+ const clock_1 = require("../../shared/clock");
7
+ const constants_1 = require("../../shared/constants");
8
+ const expiry_1 = require("../../shared/dynamodb/expiry");
6
9
  const paginate_1 = require("../../shared/dynamodb/paginate");
7
10
  const retry_1 = require("../../shared/dynamodb/retry");
11
+ const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
8
12
  const item_reader_1 = require("./item-reader");
9
13
  const keys_1 = require("./keys");
10
14
  const query_1 = require("./query");
11
- /** Fetch the target META item: by id when given, else the newest in the namespace. */
12
- async function fetchTargetMeta(context, threadId, checkpointNs, checkpointId) {
15
+ /**
16
+ * Fetch the target META item: by id when given, else the newest in the
17
+ * namespace. The newest-first read pages one row at a time past any foreign
18
+ * row until it finds a real checkpoint.
19
+ */
20
+ async function fetchTargetMeta(context, threadId, checkpointNs, checkpointId, signal) {
21
+ /** Expired rows are absent to every reader, however long DynamoDB's sweep lags. */
22
+ const now = (0, clock_1.nowSeconds)();
13
23
  if (checkpointId !== undefined) {
14
24
  const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
15
25
  TableName: context.tableName,
16
26
  Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.metaSortKey)(checkpointNs, checkpointId) },
17
27
  ConsistentRead: true,
18
- }));
19
- return result.Item;
28
+ }), (0, retry_policy_1.retryFor)(context, signal));
29
+ const meta = (0, item_reader_1.narrowHead)(context, result.Item);
30
+ return meta && !(0, expiry_1.isExpiredRow)(meta, now) ? meta : undefined;
20
31
  }
21
32
  const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.metaSortKeyPrefix)(checkpointNs), {
22
33
  limit: 1,
23
34
  consistent: true,
24
35
  });
25
- const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.query(params));
26
- return result.Items?.[0];
36
+ const rows = (0, paginate_1.paginateQuery)({
37
+ retry: (0, retry_policy_1.retryFor)(context, signal),
38
+ signal,
39
+ client: context.client,
40
+ params: (0, expiry_1.withoutExpired)(params, now),
41
+ maxItems: Number.POSITIVE_INFINITY,
42
+ maxIterations: Number.POSITIVE_INFINITY,
43
+ });
44
+ for await (const raw of rows) {
45
+ const meta = (0, item_reader_1.narrowHead)(context, raw);
46
+ if (meta && !(0, expiry_1.isExpiredRow)(meta, now))
47
+ return meta;
48
+ }
49
+ return undefined;
27
50
  }
28
51
  /** Fetch the PAYLOAD item for a checkpoint. */
29
- async function fetchPayload(context, threadId, checkpointNs, checkpointId) {
52
+ async function fetchPayload(context, threadId, checkpointNs, checkpointId, read = {}) {
30
53
  const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
31
54
  TableName: context.tableName,
32
55
  Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.payloadSortKey)(checkpointNs, checkpointId) },
33
- ConsistentRead: true,
34
- }));
56
+ ConsistentRead: read.consistent ?? true,
57
+ }), (0, retry_policy_1.retryFor)(context, read.signal));
35
58
  return result.Item;
36
59
  }
37
60
  /** Fetch and decode every pending write for a checkpoint, in write order. */
38
- async function fetchPendingWrites(context, threadId, checkpointNs, checkpointId) {
39
- const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.writeSortKeyPrefix)(checkpointNs, checkpointId), { ascending: true, consistent: true });
61
+ async function fetchPendingWrites(context, threadId, checkpointNs, checkpointId, read = {}) {
62
+ const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.writeSortKeyPrefix)(checkpointNs, checkpointId), { ascending: true, consistent: read.consistent ?? true });
63
+ /**
64
+ * Unbounded: the read must be complete to be correct, and a Send fan-out
65
+ * retried with a changed write order leaves superseded rows behind that
66
+ * count toward any cap. Past the warning threshold the read still succeeds,
67
+ * but an operator is told the checkpoint is unusually heavy.
68
+ */
40
69
  const items = [];
41
- for await (const item of (0, paginate_1.paginateQuery)({ client: context.client, params })) {
70
+ for await (const item of (0, paginate_1.paginateQuery)({
71
+ retry: (0, retry_policy_1.retryFor)(context, read.signal),
72
+ signal: read.signal,
73
+ client: context.client,
74
+ params,
75
+ maxItems: Number.POSITIVE_INFINITY,
76
+ maxIterations: Number.POSITIVE_INFINITY,
77
+ })) {
42
78
  items.push(item);
43
79
  }
44
- return (0, item_reader_1.toPendingWrites)(context, items);
80
+ if (items.length >= constants_1.LIST_SCAN_WARN_THRESHOLD) {
81
+ context.logger.warn('getTuple: a checkpoint carries very many pending-write rows; the read is complete but slow', {
82
+ threadId,
83
+ checkpointId,
84
+ rows: items.length,
85
+ });
86
+ }
87
+ return (0, item_reader_1.toPendingWrites)(context, items, threadId);
45
88
  }
46
- //# sourceMappingURL=fetch.js.map
@@ -6,7 +6,8 @@ export type FilterValue = string | number | boolean | null | FilterValue[] | {
6
6
  * True when every key in `filter` is present in `metadata` with a deeply equal
7
7
  * value. Equality is structural and key-order-independent for nested objects,
8
8
  * order-significant for arrays, and type-strict (no `3` vs `'3'` coercion). An
9
- * empty filter matches everything.
9
+ * empty filter matches everything. Only own properties count: a filter on
10
+ * `constructor` or `toString` compares against nothing, not against the
11
+ * prototype's function, the same rule the store's filter applies.
10
12
  */
11
13
  export declare function matchesFilter(metadata: Record<string, FilterValue>, filter: Record<string, FilterValue>): boolean;
12
- //# sourceMappingURL=filter-match.d.ts.map
@@ -6,9 +6,10 @@ const node_util_1 = require("node:util");
6
6
  * True when every key in `filter` is present in `metadata` with a deeply equal
7
7
  * value. Equality is structural and key-order-independent for nested objects,
8
8
  * order-significant for arrays, and type-strict (no `3` vs `'3'` coercion). An
9
- * empty filter matches everything.
9
+ * empty filter matches everything. Only own properties count: a filter on
10
+ * `constructor` or `toString` compares against nothing, not against the
11
+ * prototype's function, the same rule the store's filter applies.
10
12
  */
11
13
  function matchesFilter(metadata, filter) {
12
- return Object.entries(filter).every(([key, value]) => (0, node_util_1.isDeepStrictEqual)(metadata[key], value));
14
+ return Object.entries(filter).every(([key, value]) => (0, node_util_1.isDeepStrictEqual)(Object.hasOwn(metadata, key) ? metadata[key] : undefined, value));
13
15
  }
14
- //# sourceMappingURL=filter-match.js.map
@@ -8,10 +8,22 @@ import type { CheckpointerContext } from './setup';
8
8
  * at the one boundary where a row may not have been written by this adapter.
9
9
  */
10
10
  export declare function narrowMetaItem(raw: DocItem): CheckpointMetaItem | undefined;
11
- /** Decode the checkpoint stored in a PAYLOAD item. */
12
- export declare function readCheckpoint(context: CheckpointerContext, item: CheckpointPayloadItem): Promise<Checkpoint>;
13
- /** Decode the metadata stored in a META item. */
14
- export declare function readMetadata(context: CheckpointerContext, item: CheckpointMetaItem): Promise<CheckpointMetadata>;
11
+ /**
12
+ * Narrow a candidate head row, warning when a row that merely shares the
13
+ * `META#` prefix is not a checkpoint meta item. Returning such a row used to
14
+ * make `assembleTuple` miss its payload and report the thread as empty, so
15
+ * LangGraph started a new run on top of the real history; a foreign row is
16
+ * skipped and logged instead, exactly as `list()` treats it.
17
+ */
18
+ export declare function narrowHead(context: CheckpointerContext, raw: DocItem | undefined): CheckpointMetaItem | undefined;
19
+ /**
20
+ * Decode the checkpoint stored in a PAYLOAD item. `threadId` is the caller's
21
+ * (from the config), never the row's: it scopes which S3 object the row may
22
+ * point at, so it must come from the partition the caller asked for.
23
+ */
24
+ export declare function readCheckpoint(context: CheckpointerContext, item: CheckpointPayloadItem, threadId: string): Promise<Checkpoint>;
25
+ /** Decode the metadata stored in a META item; see {@link readCheckpoint} for `threadId`. */
26
+ export declare function readMetadata(context: CheckpointerContext, item: CheckpointMetaItem, threadId: string): Promise<CheckpointMetadata>;
15
27
  /**
16
28
  * Drop rows a later `putWrites` call added for a task and channel an earlier
17
29
  * call had already committed.
@@ -34,8 +46,21 @@ export declare function readMetadata(context: CheckpointerContext, item: Checkpo
34
46
  * original row and would hand back the later call's value instead. The
35
47
  * superseded row stays in DynamoDB and is removed by `deleteThread` or TTL
36
48
  * like any other.
49
+ *
50
+ * Identity is `(task, channel, occurrence)`, not `(task, channel)`. Keying on
51
+ * the channel alone treated *any* second row for a channel as a superseding
52
+ * duplicate — including one a retry added at an occurrence no earlier call had
53
+ * ever written, which the write-side guard accepted cleanly. That row was then
54
+ * discarded on read, silently returning fewer values than were written, with
55
+ * `putWrites()` having reported success. For that specific shape — a retry
56
+ * that legitimately emits a channel *more* often than the original call —
57
+ * keeping the occurrence restores the upstream outcome: `MemorySaver` keys
58
+ * first-write-wins on `(taskId, idx)`, so a grown retry keeps both values
59
+ * there too. That is not a claim of parity in general: a retry that reorders
60
+ * or shrinks its writes is still resolved to the earliest call per `(task,
61
+ * channel, occurrence)` as above, which is what keeps an accumulating channel
62
+ * from being double-counted — a case `MemorySaver` does not have to handle.
37
63
  */
38
64
  export declare function dropSupersededWrites(items: CheckpointWriteItem[]): CheckpointWriteItem[];
39
65
  /** Decode WRITE items into `[taskId, channel, value]` pending-write tuples. */
40
- export declare function toPendingWrites(context: CheckpointerContext, items: CheckpointWriteItem[]): Promise<CheckpointPendingWrite[]>;
41
- //# sourceMappingURL=item-reader.d.ts.map
66
+ export declare function toPendingWrites(context: CheckpointerContext, items: CheckpointWriteItem[], threadId: string): Promise<CheckpointPendingWrite[]>;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.narrowMetaItem = narrowMetaItem;
4
+ exports.narrowHead = narrowHead;
4
5
  exports.readCheckpoint = readCheckpoint;
5
6
  exports.readMetadata = readMetadata;
6
7
  exports.dropSupersededWrites = dropSupersededWrites;
7
8
  exports.toPendingWrites = toPendingWrites;
8
9
  const codec_1 = require("../../shared/codec/codec");
10
+ const concurrency_1 = require("../../shared/concurrency");
11
+ const constants_1 = require("../../shared/constants");
9
12
  const item_writer_1 = require("./item-writer");
10
13
  /**
11
14
  * Narrow a raw row to a {@link CheckpointMetaItem}, or `undefined` for a row
@@ -19,13 +22,35 @@ function narrowMetaItem(raw) {
19
22
  ? raw
20
23
  : undefined;
21
24
  }
22
- /** Decode the checkpoint stored in a PAYLOAD item. */
23
- async function readCheckpoint(context, item) {
24
- return (0, codec_1.decodePayload)(item.checkpoint, (0, item_writer_1.codecDeps)(context));
25
+ /**
26
+ * Narrow a candidate head row, warning when a row that merely shares the
27
+ * `META#` prefix is not a checkpoint meta item. Returning such a row used to
28
+ * make `assembleTuple` miss its payload and report the thread as empty, so
29
+ * LangGraph started a new run on top of the real history; a foreign row is
30
+ * skipped and logged instead, exactly as `list()` treats it.
31
+ */
32
+ function narrowHead(context, raw) {
33
+ if (raw === undefined)
34
+ return undefined;
35
+ const meta = narrowMetaItem(raw);
36
+ if (!meta) {
37
+ context.logger.warn('getTuple: skipped a row that is not a checkpoint meta item', {
38
+ sortKey: raw.SK,
39
+ });
40
+ }
41
+ return meta;
42
+ }
43
+ /**
44
+ * Decode the checkpoint stored in a PAYLOAD item. `threadId` is the caller's
45
+ * (from the config), never the row's: it scopes which S3 object the row may
46
+ * point at, so it must come from the partition the caller asked for.
47
+ */
48
+ async function readCheckpoint(context, item, threadId) {
49
+ return (0, codec_1.decodePayload)(item.checkpoint, (0, item_writer_1.codecDeps)(context), [threadId]);
25
50
  }
26
- /** Decode the metadata stored in a META item. */
27
- async function readMetadata(context, item) {
28
- return (0, codec_1.decodePayload)(item.metadata, (0, item_writer_1.codecDeps)(context));
51
+ /** Decode the metadata stored in a META item; see {@link readCheckpoint} for `threadId`. */
52
+ async function readMetadata(context, item, threadId) {
53
+ return (0, codec_1.decodePayload)(item.metadata, (0, item_writer_1.codecDeps)(context), [threadId]);
29
54
  }
30
55
  /**
31
56
  * Drop rows a later `putWrites` call added for a task and channel an earlier
@@ -49,9 +74,23 @@ async function readMetadata(context, item) {
49
74
  * original row and would hand back the later call's value instead. The
50
75
  * superseded row stays in DynamoDB and is removed by `deleteThread` or TTL
51
76
  * like any other.
77
+ *
78
+ * Identity is `(task, channel, occurrence)`, not `(task, channel)`. Keying on
79
+ * the channel alone treated *any* second row for a channel as a superseding
80
+ * duplicate — including one a retry added at an occurrence no earlier call had
81
+ * ever written, which the write-side guard accepted cleanly. That row was then
82
+ * discarded on read, silently returning fewer values than were written, with
83
+ * `putWrites()` having reported success. For that specific shape — a retry
84
+ * that legitimately emits a channel *more* often than the original call —
85
+ * keeping the occurrence restores the upstream outcome: `MemorySaver` keys
86
+ * first-write-wins on `(taskId, idx)`, so a grown retry keeps both values
87
+ * there too. That is not a claim of parity in general: a retry that reorders
88
+ * or shrinks its writes is still resolved to the earliest call per `(task,
89
+ * channel, occurrence)` as above, which is what keeps an accumulating channel
90
+ * from being double-counted — a case `MemorySaver` does not have to handle.
52
91
  */
53
92
  function dropSupersededWrites(items) {
54
- const identity = (item) => `${item.taskId}\u0000${item.channel}`;
93
+ const identity = (item) => JSON.stringify([item.taskId, item.channel, item.occurrence ?? 0]);
55
94
  const earliestGroup = new Map();
56
95
  for (const item of items) {
57
96
  const id = identity(item);
@@ -62,13 +101,13 @@ function dropSupersededWrites(items) {
62
101
  return items.filter((item) => earliestGroup.get(identity(item)) === item.writeGroup);
63
102
  }
64
103
  /** Decode WRITE items into `[taskId, channel, value]` pending-write tuples. */
65
- async function toPendingWrites(context, items) {
104
+ async function toPendingWrites(context, items, threadId) {
66
105
  const deps = (0, item_writer_1.codecDeps)(context);
67
- const pending = [];
68
- for (const item of dropSupersededWrites(items)) {
69
- const value = await (0, codec_1.decodePayload)(item.value, deps);
70
- pending.push([item.taskId, item.channel, value]);
71
- }
72
- return pending;
106
+ const live = dropSupersededWrites(items);
107
+ const values = await (0, concurrency_1.mapWithConcurrency)(live, constants_1.DEFAULT_READ_CONCURRENCY, (item) => (0, codec_1.decodePayload)(item.value, deps, [threadId]));
108
+ return live.map((item, index) => [
109
+ item.taskId,
110
+ item.channel,
111
+ values[index],
112
+ ]);
73
113
  }
74
- //# sourceMappingURL=item-reader.js.map
@@ -4,8 +4,18 @@ import type { CheckpointMetaItem, CheckpointPayloadItem, CheckpointWriteItem } f
4
4
  import type { CheckpointerContext } from './setup';
5
5
  /** Map a context to the codec collaborators. */
6
6
  export declare function codecDeps(context: CheckpointerContext): CodecDeps;
7
- /** Encode a checkpoint + metadata into its META and PAYLOAD items. */
8
- export declare function buildCheckpointItems(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpoint: Checkpoint, metadata: CheckpointMetadata, parentCheckpointId?: string, ttlTimestamp?: number): Promise<{
7
+ /**
8
+ * Encode a checkpoint + metadata into its META and PAYLOAD items. `nonce` is
9
+ * unique per `put()` call and is appended to both S3 key part lists, so a
10
+ * second put of the same checkpoint id — a retry after a lost response, or a
11
+ * repair tool re-writing a checkpoint — never shares an object with the first.
12
+ * That is what makes "the row holds my key" equivalent to "my write is live"
13
+ * for the post-failure verification in `put.ts`, and what keeps a failed
14
+ * re-put's cleanup from deleting the object the first, successful put's rows
15
+ * point at. `storedChannels` narrows the stored `channel_values` (see
16
+ * `selectStoredChannels`); by default every value is stored.
17
+ */
18
+ export declare function buildCheckpointItems(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpoint: Checkpoint, metadata: CheckpointMetadata, nonce: string, parentCheckpointId?: string, ttlTimestamp?: number, storedChannels?: readonly string[]): Promise<{
9
19
  meta: CheckpointMetaItem;
10
20
  payload: CheckpointPayloadItem;
11
21
  }>;
@@ -23,4 +33,3 @@ export declare function buildCheckpointItems(context: CheckpointerContext, threa
23
33
  * place, nonce every upload" shape.
24
34
  */
25
35
  export declare function buildWriteItems(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, taskId: string, writes: PendingWrite[], nonce: string, ttlTimestamp?: number): Promise<CheckpointWriteItem[]>;
26
- //# sourceMappingURL=item-writer.d.ts.map
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.codecDeps = codecDeps;
4
4
  exports.buildCheckpointItems = buildCheckpointItems;
5
5
  exports.buildWriteItems = buildWriteItems;
6
- const codec_1 = require("../../shared/codec/codec");
6
+ const encode_1 = require("../../shared/codec/encode");
7
7
  const keys_1 = require("./keys");
8
+ const stored_channels_1 = require("./stored-channels");
9
+ const validation_1 = require("./validation");
8
10
  const write_index_1 = require("./write-index");
9
11
  /** Map a context to the codec collaborators. */
10
12
  function codecDeps(context) {
@@ -15,15 +17,25 @@ function withTtl(item, ttlTimestamp) {
15
17
  item.ttl = ttlTimestamp;
16
18
  return item;
17
19
  }
18
- /** Encode a checkpoint + metadata into its META and PAYLOAD items. */
19
- async function buildCheckpointItems(context, threadId, checkpointNs, checkpoint, metadata, parentCheckpointId, ttlTimestamp) {
20
+ /**
21
+ * Encode a checkpoint + metadata into its META and PAYLOAD items. `nonce` is
22
+ * unique per `put()` call and is appended to both S3 key part lists, so a
23
+ * second put of the same checkpoint id — a retry after a lost response, or a
24
+ * repair tool re-writing a checkpoint — never shares an object with the first.
25
+ * That is what makes "the row holds my key" equivalent to "my write is live"
26
+ * for the post-failure verification in `put.ts`, and what keeps a failed
27
+ * re-put's cleanup from deleting the object the first, successful put's rows
28
+ * point at. `storedChannels` narrows the stored `channel_values` (see
29
+ * `selectStoredChannels`); by default every value is stored.
30
+ */
31
+ async function buildCheckpointItems(context, threadId, checkpointNs, checkpoint, metadata, nonce, parentCheckpointId, ttlTimestamp, storedChannels = Object.keys(checkpoint.channel_values)) {
20
32
  const deps = codecDeps(context);
21
33
  const pk = (0, keys_1.partitionKey)(threadId);
22
- const checkpointDescriptor = await (0, codec_1.encodePayload)(checkpoint, deps, {
23
- keyParts: [threadId, checkpointNs, checkpoint.id, 'checkpoint'],
34
+ const checkpointDescriptor = await (0, encode_1.encodePayload)((0, stored_channels_1.withStoredChannels)(checkpoint, storedChannels), deps, {
35
+ keyParts: [threadId, checkpointNs, checkpoint.id, 'checkpoint', nonce],
24
36
  });
25
- const metadataDescriptor = await (0, codec_1.encodePayload)(metadata, deps, {
26
- keyParts: [threadId, checkpointNs, checkpoint.id, 'metadata'],
37
+ const metadataDescriptor = await (0, encode_1.encodePayload)(metadata, deps, {
38
+ keyParts: [threadId, checkpointNs, checkpoint.id, 'metadata', nonce],
27
39
  });
28
40
  const meta = {
29
41
  PK: pk,
@@ -32,6 +44,7 @@ async function buildCheckpointItems(context, threadId, checkpointNs, checkpoint,
32
44
  checkpointNs,
33
45
  checkpointId: checkpoint.id,
34
46
  metadata: metadataDescriptor,
47
+ storedChannels: [...storedChannels],
35
48
  };
36
49
  if (parentCheckpointId !== undefined)
37
50
  meta.parentCheckpointId = parentCheckpointId;
@@ -56,16 +69,19 @@ async function buildCheckpointItems(context, threadId, checkpointNs, checkpoint,
56
69
  * place, nonce every upload" shape.
57
70
  */
58
71
  async function buildWriteItems(context, threadId, checkpointNs, checkpointId, taskId, writes, nonce, ttlTimestamp) {
72
+ /** Reject a bad channel before any payload is encoded or uploaded. */
73
+ for (const [channel] of writes)
74
+ (0, validation_1.validateChannel)(channel);
59
75
  const deps = codecDeps(context);
60
76
  const pk = (0, keys_1.partitionKey)(threadId);
61
77
  const items = [];
62
- for (const { channel, value, index } of (0, write_index_1.resolveWriteIndices)(writes)) {
78
+ for (const { channel, value, index, occurrence } of (0, write_index_1.resolveWriteIndices)(writes)) {
63
79
  /**
64
80
  * `channel` is part of the key as well as the index: two channels can
65
81
  * share an index (each channel's first occurrence is 0), so without it
66
82
  * their uploads would collide on one S3 object within a single call.
67
83
  */
68
- const descriptor = await (0, codec_1.encodePayload)(value, deps, {
84
+ const descriptor = await (0, encode_1.encodePayload)(value, deps, {
69
85
  keyParts: [threadId, checkpointNs, checkpointId, taskId, `write-${index}`, channel, nonce],
70
86
  });
71
87
  const item = {
@@ -82,10 +98,10 @@ async function buildWriteItems(context, threadId, checkpointNs, checkpointId, ta
82
98
  * call legitimately wrote more than once.
83
99
  */
84
100
  writeGroup: nonce,
101
+ occurrence,
85
102
  value: descriptor,
86
103
  };
87
104
  items.push(withTtl(item, ttlTimestamp));
88
105
  }
89
106
  return items;
90
107
  }
91
- //# sourceMappingURL=item-writer.js.map
@@ -1,11 +1,22 @@
1
1
  /** Reserved separator joining sort-key segments; forbidden inside any segment. */
2
2
  export declare const SORT_KEY_SEPARATOR = "#";
3
+ /**
4
+ * The most negative write index the sort key can encode, `-WRITE_INDEX_OFFSET`.
5
+ * A static test pins it against the peer's `WRITES_IDX_MAP`, so a peer bump
6
+ * that adds a more negative special slot fails loudly instead of producing
7
+ * unsortable keys.
8
+ */
9
+ export declare const MIN_ENCODABLE_WRITE_INDEX: number;
10
+ /** The tag every checkpointer partition key starts with, for a table-wide `begins_with`. */
11
+ export declare function checkpointerPartitionPrefix(): string;
3
12
  /** Partition key for a thread: the adapter tag plus the thread id. */
4
13
  export declare function partitionKey(threadId: string): string;
5
14
  /** Sort key for a checkpoint's lightweight metadata item. */
6
15
  export declare function metaSortKey(checkpointNs: string, checkpointId: string): string;
7
16
  /** `begins_with` prefix selecting every META item in a namespace (for list). */
8
17
  export declare function metaSortKeyPrefix(checkpointNs: string): string;
18
+ /** `begins_with` prefix selecting every META item of a thread, whatever its namespace. */
19
+ export declare function metaAnyNamespacePrefix(): string;
9
20
  /** Sort key for a checkpoint's heavy payload item. */
10
21
  export declare function payloadSortKey(checkpointNs: string, checkpointId: string): string;
11
22
  /**
@@ -28,4 +39,3 @@ export declare function writeSortKey(checkpointNs: string, checkpointId: string,
28
39
  export declare function isCheckpointerSortKey(sortKey: string): boolean;
29
40
  /** `begins_with` prefix selecting every WRITE item for one checkpoint. */
30
41
  export declare function writeSortKeyPrefix(checkpointNs: string, checkpointId: string): string;
31
- //# sourceMappingURL=keys.d.ts.map
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SORT_KEY_SEPARATOR = void 0;
3
+ exports.MIN_ENCODABLE_WRITE_INDEX = exports.SORT_KEY_SEPARATOR = void 0;
4
+ exports.checkpointerPartitionPrefix = checkpointerPartitionPrefix;
4
5
  exports.partitionKey = partitionKey;
5
6
  exports.metaSortKey = metaSortKey;
6
7
  exports.metaSortKeyPrefix = metaSortKeyPrefix;
8
+ exports.metaAnyNamespacePrefix = metaAnyNamespacePrefix;
7
9
  exports.payloadSortKey = payloadSortKey;
8
10
  exports.writeSortKey = writeSortKey;
9
11
  exports.isCheckpointerSortKey = isCheckpointerSortKey;
10
12
  exports.writeSortKeyPrefix = writeSortKeyPrefix;
13
+ const constants_1 = require("../../shared/constants");
11
14
  const errors_1 = require("../../shared/errors/errors");
12
15
  /** Reserved separator joining sort-key segments; forbidden inside any segment. */
13
16
  exports.SORT_KEY_SEPARATOR = '#';
@@ -19,6 +22,13 @@ const WRITE_INDEX_PAD_WIDTH = 10;
19
22
  * integers that order below positional (0+) writes.
20
23
  */
21
24
  const WRITE_INDEX_OFFSET = 8;
25
+ /**
26
+ * The most negative write index the sort key can encode, `-WRITE_INDEX_OFFSET`.
27
+ * A static test pins it against the peer's `WRITES_IDX_MAP`, so a peer bump
28
+ * that adds a more negative special slot fails loudly instead of producing
29
+ * unsortable keys.
30
+ */
31
+ exports.MIN_ENCODABLE_WRITE_INDEX = -WRITE_INDEX_OFFSET;
22
32
  /** Sort-key kinds for the checkpoints table (the approved SK separation). */
23
33
  var CheckpointItemKind;
24
34
  (function (CheckpointItemKind) {
@@ -36,6 +46,10 @@ var CheckpointItemKind;
36
46
  * spaces are disjoint by construction.
37
47
  */
38
48
  const ADAPTER_PARTITION_PREFIX = `CHKPT${exports.SORT_KEY_SEPARATOR}`;
49
+ /** The tag every checkpointer partition key starts with, for a table-wide `begins_with`. */
50
+ function checkpointerPartitionPrefix() {
51
+ return ADAPTER_PARTITION_PREFIX;
52
+ }
39
53
  /** Partition key for a thread: the adapter tag plus the thread id. */
40
54
  function partitionKey(threadId) {
41
55
  return `${ADAPTER_PARTITION_PREFIX}${threadId}`;
@@ -48,6 +62,10 @@ function metaSortKey(checkpointNs, checkpointId) {
48
62
  function metaSortKeyPrefix(checkpointNs) {
49
63
  return `${CheckpointItemKind.META}${exports.SORT_KEY_SEPARATOR}${checkpointNs}${exports.SORT_KEY_SEPARATOR}`;
50
64
  }
65
+ /** `begins_with` prefix selecting every META item of a thread, whatever its namespace. */
66
+ function metaAnyNamespacePrefix() {
67
+ return `${CheckpointItemKind.META}${exports.SORT_KEY_SEPARATOR}`;
68
+ }
51
69
  /** Sort key for a checkpoint's heavy payload item. */
52
70
  function payloadSortKey(checkpointNs, checkpointId) {
53
71
  return `${CheckpointItemKind.PAYLOAD}${exports.SORT_KEY_SEPARATOR}${checkpointNs}${exports.SORT_KEY_SEPARATOR}${checkpointId}`;
@@ -70,7 +88,20 @@ function writeSortKey(checkpointNs, checkpointId, taskId, index, channel) {
70
88
  `with ${WRITE_INDEX_PAD_WIDTH} digits`, 'index');
71
89
  }
72
90
  const paddedIndex = offsetIndex.toString().padStart(WRITE_INDEX_PAD_WIDTH, '0');
73
- return [CheckpointItemKind.WRITE, checkpointNs, checkpointId, taskId, paddedIndex, channel].join(exports.SORT_KEY_SEPARATOR);
91
+ const sortKey = [
92
+ CheckpointItemKind.WRITE,
93
+ checkpointNs,
94
+ checkpointId,
95
+ taskId,
96
+ paddedIndex,
97
+ channel,
98
+ ].join(exports.SORT_KEY_SEPARATOR);
99
+ const bytes = Buffer.byteLength(sortKey, 'utf8');
100
+ if (bytes > constants_1.MAX_SORT_KEY_BYTES) {
101
+ throw new errors_1.ValidationError(`checkpoint_ns, checkpoint_id, taskId and channel compose a ${bytes}-byte sort key; ` +
102
+ `DynamoDB caps sort keys at ${constants_1.MAX_SORT_KEY_BYTES} bytes`, 'sortKey');
103
+ }
104
+ return sortKey;
74
105
  }
75
106
  /**
76
107
  * True when `sortKey` is one this adapter writes. A partition query carries no
@@ -84,4 +115,3 @@ function isCheckpointerSortKey(sortKey) {
84
115
  function writeSortKeyPrefix(checkpointNs, checkpointId) {
85
116
  return `${CheckpointItemKind.WRITE}${exports.SORT_KEY_SEPARATOR}${checkpointNs}${exports.SORT_KEY_SEPARATOR}${checkpointId}${exports.SORT_KEY_SEPARATOR}`;
86
117
  }
87
- //# sourceMappingURL=keys.js.map
@@ -0,0 +1,61 @@
1
+ import type { QueryCommandInput, ScanCommandInput } from '@aws-sdk/lib-dynamodb';
2
+ import type { RunnableConfig } from '@langchain/core/runnables';
3
+ import type { CheckpointListOptions, CheckpointMetadata } from '@langchain/langgraph-checkpoint';
4
+ import type { CheckpointMetaItem } from '../types';
5
+ import { type FilterValue } from './filter-match';
6
+ import type { CheckpointerContext } from './setup';
7
+ /** What one `list()` call covers, read once from its config and options. */
8
+ export interface ListScope {
9
+ /** Undefined when the caller gave no `thread_id`: every thread in the table is listed. */
10
+ threadId: string | undefined;
11
+ /** Undefined when the caller gave no `checkpoint_ns`: every namespace of the thread is listed. */
12
+ checkpointNs: string | undefined;
13
+ checkpointId: string | undefined;
14
+ before: string | undefined;
15
+ filter: Record<string, FilterValue> | undefined;
16
+ limit: number | undefined;
17
+ signal: AbortSignal | undefined;
18
+ }
19
+ /**
20
+ * Read the scope. Unlike `getTuple`, which addresses the root namespace when
21
+ * none is given, `list()` without a `checkpoint_ns` covers every namespace,
22
+ * and without a `thread_id` every thread, as the reference savers do; the
23
+ * identifiers that are given are validated either way.
24
+ */
25
+ export declare function readListScope(config: RunnableConfig, options?: CheckpointListOptions): ListScope;
26
+ /**
27
+ * The META query for a scope. A metadata filter means rows may be dropped
28
+ * client-side, so only an unfiltered list passes the caller's limit through as
29
+ * the page size. With an explicit namespace `before` bounds the key range so
30
+ * rows newer than it are never read; across namespaces ids do not share one
31
+ * order and `before` is applied in-process.
32
+ */
33
+ export declare function listQuery(context: CheckpointerContext, scope: ListScope & {
34
+ threadId: string;
35
+ }): QueryCommandInput;
36
+ /**
37
+ * The table `Scan` a thread-less `list()` runs: every checkpointer META row,
38
+ * narrowed to one namespace when the caller gave one. It is what the
39
+ * reference savers do for a config without a thread, and on DynamoDB it costs
40
+ * a read of the whole table.
41
+ */
42
+ export declare function listScan(context: CheckpointerContext, scope: ListScope): ScanCommandInput;
43
+ /**
44
+ * True when `meta` passes the key-level filters: strictly older than `before`,
45
+ * and — on a table scan, where the key condition cannot narrow them — in the
46
+ * requested namespace and, when one is given, the requested checkpoint.
47
+ */
48
+ export declare function passesKeyFilters(meta: CheckpointMetaItem, scope: ListScope): boolean;
49
+ /** Outcome of the metadata filter: rejected, or accepted with any metadata decoded on the way. */
50
+ export type MetadataVerdict = {
51
+ pass: false;
52
+ } | {
53
+ pass: true;
54
+ metadata?: CheckpointMetadata;
55
+ };
56
+ /**
57
+ * Apply the optional metadata-equality filter. The metadata decoded here is
58
+ * handed to the tuple assembly, so a filtered list decodes (and, when offloaded,
59
+ * downloads) each metadata blob once instead of twice.
60
+ */
61
+ export declare function passesMetadataFilter(context: CheckpointerContext, meta: CheckpointMetaItem, scope: ListScope): Promise<MetadataVerdict>;