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

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 (324) hide show
  1. package/README.md +1621 -288
  2. package/dist/backfill/backfill.d.ts +168 -0
  3. package/dist/backfill/backfill.js +393 -0
  4. package/dist/checkpointer/actions/delete-thread.d.ts +44 -4
  5. package/dist/checkpointer/actions/delete-thread.js +56 -22
  6. package/dist/checkpointer/actions/get-tuple.d.ts +29 -5
  7. package/dist/checkpointer/actions/get-tuple.js +41 -13
  8. package/dist/checkpointer/actions/list.d.ts +42 -10
  9. package/dist/checkpointer/actions/list.js +86 -57
  10. package/dist/checkpointer/actions/put-writes.d.ts +41 -9
  11. package/dist/checkpointer/actions/put-writes.js +62 -48
  12. package/dist/checkpointer/actions/put.d.ts +82 -10
  13. package/dist/checkpointer/actions/put.js +166 -44
  14. package/dist/checkpointer/internal/delta-history.d.ts +112 -0
  15. package/dist/checkpointer/internal/delta-history.js +252 -0
  16. package/dist/checkpointer/internal/listing.d.ts +149 -0
  17. package/dist/checkpointer/internal/listing.js +245 -0
  18. package/dist/checkpointer/internal/parse.d.ts +262 -0
  19. package/dist/checkpointer/internal/parse.js +372 -0
  20. package/dist/checkpointer/internal/pending-writes.d.ts +275 -0
  21. package/dist/checkpointer/internal/pending-writes.js +588 -0
  22. package/dist/checkpointer/internal/read.d.ts +130 -0
  23. package/dist/checkpointer/internal/read.js +264 -0
  24. package/dist/checkpointer/internal/rows.d.ts +571 -0
  25. package/dist/checkpointer/internal/rows.js +834 -0
  26. package/dist/checkpointer/internal/setup.d.ts +42 -21
  27. package/dist/checkpointer/internal/setup.js +65 -31
  28. package/dist/checkpointer/saver.d.ts +242 -42
  29. package/dist/checkpointer/saver.js +257 -53
  30. package/dist/checkpointer/types.d.ts +37 -44
  31. package/dist/checkpointer/types.js +10 -0
  32. package/dist/factory/factory.d.ts +120 -11
  33. package/dist/factory/factory.js +195 -16
  34. package/dist/factory/types.d.ts +23 -4
  35. package/dist/factory/types.js +8 -0
  36. package/dist/history/actions/add-messages.d.ts +30 -2
  37. package/dist/history/actions/add-messages.js +37 -57
  38. package/dist/history/actions/clear.d.ts +46 -4
  39. package/dist/history/actions/clear.js +64 -15
  40. package/dist/history/actions/get-messages.d.ts +41 -0
  41. package/dist/history/actions/get-messages.js +94 -32
  42. package/dist/history/actions/list-sessions.d.ts +52 -10
  43. package/dist/history/actions/list-sessions.js +141 -38
  44. package/dist/history/actions/reconcile-count.d.ts +41 -8
  45. package/dist/history/actions/reconcile-count.js +44 -57
  46. package/dist/history/chat-message-history.d.ts +200 -38
  47. package/dist/history/chat-message-history.js +218 -51
  48. package/dist/history/internal/append.d.ts +212 -0
  49. package/dist/history/internal/append.js +500 -0
  50. package/dist/history/internal/message-read.d.ts +84 -0
  51. package/dist/history/internal/message-read.js +204 -0
  52. package/dist/history/internal/parse.d.ts +153 -0
  53. package/dist/history/internal/parse.js +252 -0
  54. package/dist/history/internal/rows.d.ts +195 -0
  55. package/dist/history/internal/rows.js +250 -0
  56. package/dist/history/internal/session.d.ts +331 -0
  57. package/dist/history/internal/session.js +628 -0
  58. package/dist/history/internal/setup.d.ts +52 -19
  59. package/dist/history/internal/setup.js +90 -27
  60. package/dist/history/session-adapter.d.ts +95 -6
  61. package/dist/history/session-adapter.js +99 -8
  62. package/dist/history/types.d.ts +61 -31
  63. package/dist/history/types.js +10 -0
  64. package/dist/index.d.ts +38 -14
  65. package/dist/index.js +31 -12
  66. package/dist/shared/adapter.d.ts +135 -0
  67. package/dist/shared/adapter.js +143 -0
  68. package/dist/shared/clock.d.ts +48 -4
  69. package/dist/shared/clock.js +51 -4
  70. package/dist/shared/codec/codec.d.ts +275 -9
  71. package/dist/shared/codec/codec.js +394 -19
  72. package/dist/shared/codec/compression.d.ts +43 -6
  73. package/dist/shared/codec/compression.js +52 -11
  74. package/dist/shared/codec/json-serde.d.ts +76 -3
  75. package/dist/shared/codec/json-serde.js +181 -7
  76. package/dist/shared/codec/s3/client-types.d.ts +20 -1
  77. package/dist/shared/codec/s3/client-types.js +20 -1
  78. package/dist/shared/codec/s3/client.d.ts +35 -8
  79. package/dist/shared/codec/s3/client.js +61 -10
  80. package/dist/shared/codec/s3/config.d.ts +226 -22
  81. package/dist/shared/codec/s3/config.js +274 -24
  82. package/dist/shared/codec/s3/lifecycle.d.ts +163 -11
  83. package/dist/shared/codec/s3/lifecycle.js +328 -36
  84. package/dist/shared/codec/s3/offloader.d.ts +390 -19
  85. package/dist/shared/codec/s3/offloader.js +590 -50
  86. package/dist/shared/concurrency.d.ts +40 -3
  87. package/dist/shared/concurrency.js +55 -7
  88. package/dist/shared/dynamodb/abort.d.ts +45 -7
  89. package/dist/shared/dynamodb/abort.js +46 -14
  90. package/dist/shared/dynamodb/batch-write.d.ts +77 -13
  91. package/dist/shared/dynamodb/batch-write.js +146 -26
  92. package/dist/shared/dynamodb/cancellation.d.ts +121 -3
  93. package/dist/shared/dynamodb/cancellation.js +147 -2
  94. package/dist/shared/dynamodb/client.d.ts +159 -12
  95. package/dist/shared/dynamodb/client.js +135 -10
  96. package/dist/shared/dynamodb/idempotent-write.d.ts +551 -0
  97. package/dist/shared/dynamodb/idempotent-write.js +593 -0
  98. package/dist/shared/dynamodb/paginate.d.ts +105 -8
  99. package/dist/shared/dynamodb/paginate.js +175 -6
  100. package/dist/shared/dynamodb/partition-delete.d.ts +181 -16
  101. package/dist/shared/dynamodb/partition-delete.js +312 -43
  102. package/dist/shared/dynamodb/recency-index.d.ts +231 -0
  103. package/dist/shared/dynamodb/recency-index.js +377 -0
  104. package/dist/shared/dynamodb/retry.d.ts +265 -10
  105. package/dist/shared/dynamodb/retry.js +426 -20
  106. package/dist/shared/dynamodb/table-schema.d.ts +190 -0
  107. package/dist/shared/dynamodb/table-schema.js +209 -0
  108. package/dist/shared/errors/base-error.d.ts +174 -8
  109. package/dist/shared/errors/base-error.js +154 -7
  110. package/dist/shared/errors/boundary.d.ts +63 -10
  111. package/dist/shared/errors/boundary.js +110 -13
  112. package/dist/shared/errors/classify.d.ts +97 -0
  113. package/dist/shared/errors/classify.js +257 -0
  114. package/dist/shared/errors/error-code.d.ts +76 -1
  115. package/dist/shared/errors/error-code.js +83 -1
  116. package/dist/shared/errors/errors.d.ts +157 -58
  117. package/dist/shared/errors/errors.js +218 -93
  118. package/dist/shared/logging/logger.d.ts +63 -1
  119. package/dist/shared/logging/logger.js +97 -2
  120. package/dist/shared/logging/redaction.d.ts +86 -6
  121. package/dist/shared/logging/redaction.js +265 -24
  122. package/dist/shared/logging/secret-patterns.d.ts +136 -24
  123. package/dist/shared/logging/secret-patterns.js +165 -30
  124. package/dist/shared/logging/truncate.d.ts +197 -0
  125. package/dist/shared/logging/truncate.js +231 -0
  126. package/dist/shared/options.d.ts +52 -5
  127. package/dist/shared/options.js +9 -0
  128. package/dist/shared/ulid.d.ts +71 -14
  129. package/dist/shared/ulid.js +77 -14
  130. package/dist/shared/validation/collaborators.d.ts +141 -0
  131. package/dist/shared/validation/collaborators.js +188 -0
  132. package/dist/shared/validation/option-shape.d.ts +89 -0
  133. package/dist/shared/validation/option-shape.js +113 -0
  134. package/dist/shared/validation/options.d.ts +142 -5
  135. package/dist/shared/validation/options.js +284 -46
  136. package/dist/shared/validation/primitives.d.ts +287 -24
  137. package/dist/shared/validation/primitives.js +347 -42
  138. package/dist/shared/validation/ttl.d.ts +61 -12
  139. package/dist/shared/validation/ttl.js +102 -22
  140. package/dist/store/actions/list-namespaces.d.ts +76 -5
  141. package/dist/store/actions/list-namespaces.js +160 -22
  142. package/dist/store/actions/put.d.ts +33 -7
  143. package/dist/store/actions/put.js +53 -71
  144. package/dist/store/actions/reconcile-vector-index.d.ts +28 -8
  145. package/dist/store/actions/reconcile-vector-index.js +33 -13
  146. package/dist/store/actions/search.d.ts +34 -5
  147. package/dist/store/actions/search.js +52 -20
  148. package/dist/store/internal/batch-plan.d.ts +24 -9
  149. package/dist/store/internal/batch-plan.js +91 -34
  150. package/dist/store/internal/filter.d.ts +36 -2
  151. package/dist/store/internal/filter.js +66 -14
  152. package/dist/store/internal/get-item.d.ts +45 -0
  153. package/dist/store/internal/get-item.js +115 -0
  154. package/dist/store/internal/item-write.d.ts +230 -0
  155. package/dist/store/internal/item-write.js +463 -0
  156. package/dist/store/internal/parse.d.ts +225 -0
  157. package/dist/store/internal/parse.js +350 -0
  158. package/dist/store/internal/rows.d.ts +355 -0
  159. package/dist/store/internal/rows.js +447 -0
  160. package/dist/store/internal/semantic-search.d.ts +146 -12
  161. package/dist/store/internal/semantic-search.js +317 -15
  162. package/dist/store/internal/setup.d.ts +86 -21
  163. package/dist/store/internal/setup.js +209 -26
  164. package/dist/store/internal/table-search.d.ts +100 -0
  165. package/dist/store/internal/table-search.js +213 -0
  166. package/dist/store/internal/vector-index.d.ts +247 -0
  167. package/dist/store/internal/vector-index.js +546 -0
  168. package/dist/store/store.d.ts +258 -33
  169. package/dist/store/store.js +309 -53
  170. package/dist/store/types.d.ts +74 -28
  171. package/dist/store/types.js +13 -0
  172. package/dist/store/vector-backend.d.ts +64 -3
  173. package/dist/store/vector-backend.js +15 -0
  174. package/package.json +41 -25
  175. package/dist/checkpointer/internal/assemble.d.ts +0 -17
  176. package/dist/checkpointer/internal/assemble.js +0 -38
  177. package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +0 -24
  178. package/dist/checkpointer/internal/checkpoint-write-verify.js +0 -67
  179. package/dist/checkpointer/internal/configurable.d.ts +0 -12
  180. package/dist/checkpointer/internal/configurable.js +0 -24
  181. package/dist/checkpointer/internal/fetch.d.ts +0 -19
  182. package/dist/checkpointer/internal/fetch.js +0 -88
  183. package/dist/checkpointer/internal/filter-match.d.ts +0 -13
  184. package/dist/checkpointer/internal/filter-match.js +0 -15
  185. package/dist/checkpointer/internal/item-reader.d.ts +0 -66
  186. package/dist/checkpointer/internal/item-reader.js +0 -113
  187. package/dist/checkpointer/internal/item-writer.d.ts +0 -35
  188. package/dist/checkpointer/internal/item-writer.js +0 -107
  189. package/dist/checkpointer/internal/keys.d.ts +0 -41
  190. package/dist/checkpointer/internal/keys.js +0 -117
  191. package/dist/checkpointer/internal/list-scope.d.ts +0 -61
  192. package/dist/checkpointer/internal/list-scope.js +0 -108
  193. package/dist/checkpointer/internal/pending-sends.d.ts +0 -13
  194. package/dist/checkpointer/internal/pending-sends.js +0 -29
  195. package/dist/checkpointer/internal/query.d.ts +0 -21
  196. package/dist/checkpointer/internal/query.js +0 -42
  197. package/dist/checkpointer/internal/regular-write.d.ts +0 -28
  198. package/dist/checkpointer/internal/regular-write.js +0 -66
  199. package/dist/checkpointer/internal/special-write-cas.d.ts +0 -29
  200. package/dist/checkpointer/internal/special-write-cas.js +0 -104
  201. package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -23
  202. package/dist/checkpointer/internal/special-write-cleanup.js +0 -50
  203. package/dist/checkpointer/internal/special-write-verify.d.ts +0 -53
  204. package/dist/checkpointer/internal/special-write-verify.js +0 -80
  205. package/dist/checkpointer/internal/stored-channels.d.ts +0 -31
  206. package/dist/checkpointer/internal/stored-channels.js +0 -70
  207. package/dist/checkpointer/internal/validation.d.ts +0 -18
  208. package/dist/checkpointer/internal/validation.js +0 -40
  209. package/dist/checkpointer/internal/write-guard.d.ts +0 -20
  210. package/dist/checkpointer/internal/write-guard.js +0 -48
  211. package/dist/checkpointer/internal/write-index.d.ts +0 -36
  212. package/dist/checkpointer/internal/write-index.js +0 -41
  213. package/dist/history/internal/append-saga.d.ts +0 -25
  214. package/dist/history/internal/append-saga.js +0 -79
  215. package/dist/history/internal/compensation.d.ts +0 -25
  216. package/dist/history/internal/compensation.js +0 -92
  217. package/dist/history/internal/item-mapper.d.ts +0 -9
  218. package/dist/history/internal/item-mapper.js +0 -27
  219. package/dist/history/internal/keys.d.ts +0 -16
  220. package/dist/history/internal/keys.js +0 -48
  221. package/dist/history/internal/message-chunker.d.ts +0 -13
  222. package/dist/history/internal/message-chunker.js +0 -67
  223. package/dist/history/internal/message-transaction.d.ts +0 -25
  224. package/dist/history/internal/message-transaction.js +0 -61
  225. package/dist/history/internal/message-window.d.ts +0 -17
  226. package/dist/history/internal/message-window.js +0 -49
  227. package/dist/history/internal/query.d.ts +0 -23
  228. package/dist/history/internal/query.js +0 -39
  229. package/dist/history/internal/session-count.d.ts +0 -47
  230. package/dist/history/internal/session-count.js +0 -115
  231. package/dist/history/internal/session-title.d.ts +0 -19
  232. package/dist/history/internal/session-title.js +0 -43
  233. package/dist/history/internal/session-update.d.ts +0 -27
  234. package/dist/history/internal/session-update.js +0 -69
  235. package/dist/history/internal/title-generator.d.ts +0 -12
  236. package/dist/history/internal/title-generator.js +0 -41
  237. package/dist/history/internal/ttl-anchor.d.ts +0 -24
  238. package/dist/history/internal/ttl-anchor.js +0 -38
  239. package/dist/history/internal/validation.d.ts +0 -25
  240. package/dist/history/internal/validation.js +0 -53
  241. package/dist/shared/codec/descriptor-keys.d.ts +0 -12
  242. package/dist/shared/codec/descriptor-keys.js +0 -14
  243. package/dist/shared/codec/encode.d.ts +0 -13
  244. package/dist/shared/codec/encode.js +0 -43
  245. package/dist/shared/codec/payload-loss.d.ts +0 -12
  246. package/dist/shared/codec/payload-loss.js +0 -38
  247. package/dist/shared/codec/s3/adapter-config.d.ts +0 -13
  248. package/dist/shared/codec/s3/adapter-config.js +0 -22
  249. package/dist/shared/codec/s3/bounded-body.d.ts +0 -14
  250. package/dist/shared/codec/s3/bounded-body.js +0 -47
  251. package/dist/shared/codec/s3/delete.d.ts +0 -7
  252. package/dist/shared/codec/s3/delete.js +0 -28
  253. package/dist/shared/codec/s3/key-scope.d.ts +0 -23
  254. package/dist/shared/codec/s3/key-scope.js +0 -44
  255. package/dist/shared/codec/s3/orphans.d.ts +0 -23
  256. package/dist/shared/codec/s3/orphans.js +0 -71
  257. package/dist/shared/codec/s3/read-write.d.ts +0 -18
  258. package/dist/shared/codec/s3/read-write.js +0 -51
  259. package/dist/shared/codec/s3/retry.d.ts +0 -5
  260. package/dist/shared/codec/s3/retry.js +0 -22
  261. package/dist/shared/constants.d.ts +0 -112
  262. package/dist/shared/constants.js +0 -115
  263. package/dist/shared/dynamodb/backoff.d.ts +0 -15
  264. package/dist/shared/dynamodb/backoff.js +0 -48
  265. package/dist/shared/dynamodb/conditional-put.d.ts +0 -67
  266. package/dist/shared/dynamodb/conditional-put.js +0 -76
  267. package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -21
  268. package/dist/shared/dynamodb/drain-unprocessed.js +0 -43
  269. package/dist/shared/dynamodb/expiry.d.ts +0 -16
  270. package/dist/shared/dynamodb/expiry.js +0 -29
  271. package/dist/shared/dynamodb/paginate-core.d.ts +0 -24
  272. package/dist/shared/dynamodb/paginate-core.js +0 -82
  273. package/dist/shared/dynamodb/retry-classifier.d.ts +0 -17
  274. package/dist/shared/dynamodb/retry-classifier.js +0 -118
  275. package/dist/shared/dynamodb/retry-policy.d.ts +0 -26
  276. package/dist/shared/dynamodb/retry-policy.js +0 -22
  277. package/dist/shared/dynamodb/scan.d.ts +0 -14
  278. package/dist/shared/dynamodb/scan.js +0 -19
  279. package/dist/shared/dynamodb/types.d.ts +0 -23
  280. package/dist/shared/dynamodb/types.js +0 -2
  281. package/dist/shared/errors/upstream-error.d.ts +0 -16
  282. package/dist/shared/errors/upstream-error.js +0 -27
  283. package/dist/shared/errors/wrap-error.d.ts +0 -7
  284. package/dist/shared/errors/wrap-error.js +0 -15
  285. package/dist/shared/logging/redaction-walk.d.ts +0 -23
  286. package/dist/shared/logging/redaction-walk.js +0 -112
  287. package/dist/store/actions/get.d.ts +0 -13
  288. package/dist/store/actions/get.js +0 -73
  289. package/dist/store/internal/backend-search.d.ts +0 -4
  290. package/dist/store/internal/backend-search.js +0 -74
  291. package/dist/store/internal/candidates.d.ts +0 -23
  292. package/dist/store/internal/candidates.js +0 -94
  293. package/dist/store/internal/index-reconcile.d.ts +0 -21
  294. package/dist/store/internal/index-reconcile.js +0 -118
  295. package/dist/store/internal/index-sync.d.ts +0 -10
  296. package/dist/store/internal/index-sync.js +0 -25
  297. package/dist/store/internal/item-mapper.d.ts +0 -27
  298. package/dist/store/internal/item-mapper.js +0 -61
  299. package/dist/store/internal/keys.d.ts +0 -17
  300. package/dist/store/internal/keys.js +0 -41
  301. package/dist/store/internal/namespace-match.d.ts +0 -11
  302. package/dist/store/internal/namespace-match.js +0 -40
  303. package/dist/store/internal/option-validation.d.ts +0 -13
  304. package/dist/store/internal/option-validation.js +0 -77
  305. package/dist/store/internal/overwrite-swap.d.ts +0 -32
  306. package/dist/store/internal/overwrite-swap.js +0 -68
  307. package/dist/store/internal/persist.d.ts +0 -28
  308. package/dist/store/internal/persist.js +0 -64
  309. package/dist/store/internal/query.d.ts +0 -11
  310. package/dist/store/internal/query.js +0 -48
  311. package/dist/store/internal/ranker.d.ts +0 -18
  312. package/dist/store/internal/ranker.js +0 -39
  313. package/dist/store/internal/read-existing.d.ts +0 -23
  314. package/dist/store/internal/read-existing.js +0 -41
  315. package/dist/store/internal/score-direction.d.ts +0 -31
  316. package/dist/store/internal/score-direction.js +0 -38
  317. package/dist/store/internal/search-filter.d.ts +0 -3
  318. package/dist/store/internal/search-filter.js +0 -10
  319. package/dist/store/internal/text-path.d.ts +0 -17
  320. package/dist/store/internal/text-path.js +0 -147
  321. package/dist/store/internal/validation.d.ts +0 -18
  322. package/dist/store/internal/validation.js +0 -51
  323. package/dist/store/internal/write-verify.d.ts +0 -42
  324. package/dist/store/internal/write-verify.js +0 -71
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
+ /**
3
+ * Hides which vector index the store talks to.
4
+ *
5
+ * The store sees only `VectorBackend` — upsert, query, delete and an optional
6
+ * listing — with what it promises and requires stated per method, so any
7
+ * index that keeps those terms plugs in without the store changing. The table
8
+ * stays the truth: a backend may lag it and may score by distance, and every
9
+ * match is re-read before a caller sees it.
10
+ */
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.VECTOR_SCORE_DIRECTIONS = void 0;
13
+ /**
14
+ * Every direction `toRelevanceScores` (store/internal/vector-index.ts)
15
+ * recognises, for validating input.
16
+ */
17
+ exports.VECTOR_SCORE_DIRECTIONS = ['relevance', 'distance'];
package/package.json CHANGED
@@ -1,25 +1,32 @@
1
1
  {
2
2
  "name": "@farukada/aws-langgraph-dynamodb-ts",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.2",
4
4
  "license": "MIT",
5
- "description": "AWS DynamoDB implementation for LangGraph Memory Store and Checkpoint Saver in TypeScript",
5
+ "description": "DynamoDB persistence for LangGraph.js: checkpoint saver, long-term memory store with semantic search, and chat message history, with optional S3 offload, compression and TTL",
6
6
  "keywords": [
7
7
  "aws",
8
8
  "dynamodb",
9
9
  "langchain",
10
10
  "langgraph",
11
11
  "checkpointer",
12
- "memory-store"
12
+ "checkpoint-saver",
13
+ "memory-store",
14
+ "long-term-memory",
15
+ "chat-history",
16
+ "semantic-search",
17
+ "s3",
18
+ "typescript"
13
19
  ],
14
20
  "author": "Faruk Ada <info@farukada.com>",
15
21
  "homepage": "https://github.com/FarukAda/aws-langgraph-dynamodb-ts",
16
22
  "repository": {
17
23
  "type": "git",
18
- "url": "https://github.com/FarukAda/aws-langgraph-dynamodb-ts"
24
+ "url": "git+https://github.com/FarukAda/aws-langgraph-dynamodb-ts.git"
19
25
  },
20
26
  "bugs": {
21
27
  "url": "https://github.com/FarukAda/aws-langgraph-dynamodb-ts/issues"
22
28
  },
29
+ "type": "commonjs",
23
30
  "main": "dist/index.js",
24
31
  "types": "dist/index.d.ts",
25
32
  "exports": {
@@ -36,7 +43,7 @@
36
43
  "npm": ">=10.0.0"
37
44
  },
38
45
  "scripts": {
39
- "build": "tsc -p tsconfig.build.json",
46
+ "build": "node scripts/clean.mjs && tsc -p tsconfig.build.json",
40
47
  "typecheck": "tsc -p tsconfig.build.json --noEmit",
41
48
  "typecheck:all": "tsc --noEmit",
42
49
  "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"*.config.ts\" \"**/*.mjs\" --no-error-on-unmatched-pattern",
@@ -48,30 +55,37 @@
48
55
  "test:conformance": "jest --config jest.conformance.config.ts",
49
56
  "test:aws": "jest --config jest.aws.config.ts",
50
57
  "test:static": "jest test/static",
58
+ "test:scripts": "node --test \"test/scripts/**/*.test.mjs\"",
51
59
  "test:package-smoke": "node --test test/package-smoke/smoke.test.mjs",
60
+ "test:consumer-types": "node --test test/package-smoke/consumer-types.test.mjs",
61
+ "test:surface": "node scripts/run-with-timeout.mjs 150 -- node --test --test-timeout=120000 test/surface/surface.test.mjs",
62
+ "test:surface:update": "node scripts/update-surface-baseline.mjs",
52
63
  "prepublishOnly": "npm run typecheck && npm run typecheck:all && npm run lint && npm run build && npm test",
53
64
  "docs": "typedoc",
54
65
  "docs:watch": "typedoc --watch",
66
+ "check:docs": "node scripts/check-doc-samples.mjs",
67
+ "check:links": "node scripts/check-doc-links.mjs",
55
68
  "unused": "knip",
56
69
  "depcheck": "depcheck .",
70
+ "peer-floors": "node scripts/peer-floors.mjs",
71
+ "ci:require-green": "node scripts/require-green-ci.mjs",
72
+ "changelog-section": "node scripts/changelog-section.mjs",
73
+ "sbom": "node scripts/generate-sbom.mjs",
57
74
  "cpd": "jscpd ./src --threshold 2 --min-lines 3 --reporters console --silent --format typescript,javascript",
58
75
  "cpd:full": "jscpd ./src --threshold 2 --min-lines 3 --reporters console-full --format typescript,javascript",
59
76
  "cpd:test": "jscpd ./test --threshold 2 --min-lines 3 --reporters console-full --format typescript,javascript",
60
77
  "pack:check": "node scripts/pack-check.mjs && publint && attw --pack . --profile node16"
61
78
  },
62
79
  "dependencies": {
63
- "@aws-sdk/client-dynamodb": "^3.1116.0",
64
- "@aws-sdk/lib-dynamodb": "^3.1116.0",
80
+ "@aws-sdk/client-dynamodb": "^3.1132.0",
81
+ "@aws-sdk/lib-dynamodb": "^3.1132.0",
65
82
  "@aws-sdk/util-dynamodb": "^3.996.9"
66
83
  },
67
84
  "peerDependencies": {
68
- "@aws-sdk/client-s3": "^3.901.0",
69
- "@langchain/core": "^1.2.9",
85
+ "@aws-sdk/client-s3": "^3.1132.0",
86
+ "@langchain/core": "^1.2.11",
70
87
  "@langchain/langgraph-checkpoint": "^1.1.5"
71
88
  },
72
- "overrides": {
73
- "uuid": ">=11.1.1"
74
- },
75
89
  "peerDependenciesMeta": {
76
90
  "@aws-sdk/client-s3": {
77
91
  "optional": true
@@ -79,37 +93,39 @@
79
93
  },
80
94
  "devDependencies": {
81
95
  "@arethetypeswrong/cli": "^0.18.5",
82
- "@aws-sdk/client-s3": "^3.1116.0",
96
+ "@aws-sdk/client-s3": "^3.1132.0",
83
97
  "@eslint/js": "^10.0.1",
84
- "@langchain/aws": "^1.4.4",
85
- "@langchain/langgraph": "^1.3.2",
98
+ "@langchain/aws": "^1.4.5",
99
+ "@langchain/langgraph": "^1.4.15",
86
100
  "@langchain/langgraph-checkpoint-validation": "^1.1.1",
87
101
  "@types/jest": "^30.0.0",
88
- "@types/node": "^26.2.0",
102
+ "@types/node": "^26.5.1",
89
103
  "@typescript/native": "npm:typescript@^7.0.2",
90
104
  "aws-sdk-client-mock": "^4.1.0",
91
105
  "depcheck": "^1.4.7",
92
- "eslint": "^10.9.0",
106
+ "eslint": "^10.10.0",
93
107
  "eslint-config-prettier": "^10.1.8",
94
108
  "eslint-plugin-no-instanceof": "^1.0.1",
95
- "eslint-plugin-perfectionist": "^5.10.1",
109
+ "eslint-plugin-perfectionist": "^5.11.0",
96
110
  "eslint-plugin-prettier": "^5.5.6",
97
111
  "eslint-plugin-unused-imports": "^4.4.1",
98
112
  "expect-type": "^1.4.0",
99
- "fast-check": "^4.9.0",
100
- "jest": "^30.4.2",
113
+ "fast-check": "^4.10.0",
114
+ "jest": "^30.5.1",
115
+ "jest-environment-node": "^30.5.1",
101
116
  "jiti": "^2.7.0",
102
- "jscpd": "^5.0.16",
103
- "knip": "^6.32.2",
117
+ "jscpd": "^5.2.0",
118
+ "knip": "^6.35.1",
119
+ "langchain": "^1.5.11",
104
120
  "prettier": "^3.9.6",
105
121
  "publint": "^0.3.24",
106
122
  "ts-jest": "^29.4.12",
107
123
  "ts-node": "^10.9.2",
108
124
  "typedoc": "^0.28.20",
109
- "typedoc-plugin-markdown": "^4.12.0",
125
+ "typedoc-plugin-markdown": "^4.13.0",
110
126
  "typescript": "npm:@typescript/typescript6@^6.0.2",
111
- "typescript-eslint": "^8.67.0",
112
- "zod": "^4.4.3"
127
+ "typescript-eslint": "^8.70.0",
128
+ "zod": "^4.6.5"
113
129
  },
114
130
  "prettier": {
115
131
  "semi": true,
@@ -1,17 +0,0 @@
1
- import type { CheckpointMetadata, CheckpointTuple } from '@langchain/langgraph-checkpoint';
2
- import type { CheckpointMetaItem } from '../types';
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
- }
12
- /**
13
- * Assemble a full {@link CheckpointTuple} from a META item: fetch and decode its
14
- * payload, metadata, and pending writes, attaching a parent config when present.
15
- * Returns undefined when the payload item is missing (inconsistent state).
16
- */
17
- export declare function assembleTuple(context: CheckpointerContext, threadId: string, checkpointNs: string, meta: CheckpointMetaItem, options: AssembleOptions): Promise<CheckpointTuple | undefined>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assembleTuple = assembleTuple;
4
- const fetch_1 = require("./fetch");
5
- const item_reader_1 = require("./item-reader");
6
- const pending_sends_1 = require("./pending-sends");
7
- /** Build a config that addresses a specific checkpoint. */
8
- function configFor(threadId, checkpointNs, checkpointId) {
9
- return {
10
- configurable: { thread_id: threadId, checkpoint_ns: checkpointNs, checkpoint_id: checkpointId },
11
- };
12
- }
13
- /**
14
- * Assemble a full {@link CheckpointTuple} from a META item: fetch and decode its
15
- * payload, metadata, and pending writes, attaching a parent config when present.
16
- * Returns undefined when the payload item is missing (inconsistent state).
17
- */
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);
21
- if (!payload)
22
- return undefined;
23
- const [checkpoint, metadata, pendingWrites] = await Promise.all([
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),
27
- ]);
28
- const tuple = {
29
- config: configFor(threadId, checkpointNs, meta.checkpointId),
30
- checkpoint,
31
- metadata,
32
- pendingWrites,
33
- };
34
- if (meta.parentCheckpointId !== undefined) {
35
- tuple.parentConfig = configFor(threadId, checkpointNs, meta.parentCheckpointId);
36
- }
37
- return tuple;
38
- }
@@ -1,24 +0,0 @@
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>;
@@ -1,67 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
1
- import type { RunnableConfig } from '@langchain/core/runnables';
2
- /** The thread/namespace/checkpoint identifiers extracted from a config. */
3
- export interface ResolvedConfigurable {
4
- threadId: string;
5
- checkpointNs: string;
6
- checkpointId?: string;
7
- }
8
- /**
9
- * Narrow `RunnableConfig.configurable` to the identifiers the saver needs,
10
- * defaulting the namespace to empty and validating that a thread id is present.
11
- */
12
- export declare function readConfigurable(config: RunnableConfig): ResolvedConfigurable;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readConfigurable = readConfigurable;
4
- const validation_1 = require("./validation");
5
- /**
6
- * Narrow `RunnableConfig.configurable` to the identifiers the saver needs,
7
- * defaulting the namespace to empty and validating that a thread id is present.
8
- */
9
- function readConfigurable(config) {
10
- const configurable = (config.configurable ?? {});
11
- (0, validation_1.validateThreadId)(configurable.thread_id);
12
- const checkpointNs = configurable.checkpoint_ns ?? '';
13
- (0, validation_1.validateCheckpointNs)(checkpointNs);
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 };
24
- }
@@ -1,19 +0,0 @@
1
- import type { CheckpointPendingWrite } from '@langchain/langgraph-checkpoint';
2
- import type { CheckpointMetaItem, CheckpointPayloadItem } from '../types';
3
- import type { CheckpointerContext } from './setup';
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>;
16
- /** Fetch the PAYLOAD item for a checkpoint. */
17
- export declare function fetchPayload(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, read?: ReadOptions): Promise<CheckpointPayloadItem | undefined>;
18
- /** Fetch and decode every pending write for a checkpoint, in write order. */
19
- export declare function fetchPendingWrites(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpointId: string, read?: ReadOptions): Promise<CheckpointPendingWrite[]>;
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchTargetMeta = fetchTargetMeta;
4
- exports.fetchPayload = fetchPayload;
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");
9
- const paginate_1 = require("../../shared/dynamodb/paginate");
10
- const retry_1 = require("../../shared/dynamodb/retry");
11
- const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
12
- const item_reader_1 = require("./item-reader");
13
- const keys_1 = require("./keys");
14
- const query_1 = require("./query");
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)();
23
- if (checkpointId !== undefined) {
24
- const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
25
- TableName: context.tableName,
26
- Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.metaSortKey)(checkpointNs, checkpointId) },
27
- ConsistentRead: true,
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;
31
- }
32
- const params = (0, query_1.beginsWithQuery)(context.tableName, (0, keys_1.partitionKey)(threadId), (0, keys_1.metaSortKeyPrefix)(checkpointNs), {
33
- limit: 1,
34
- consistent: true,
35
- });
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;
50
- }
51
- /** Fetch the PAYLOAD item for a checkpoint. */
52
- async function fetchPayload(context, threadId, checkpointNs, checkpointId, read = {}) {
53
- const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
54
- TableName: context.tableName,
55
- Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.payloadSortKey)(checkpointNs, checkpointId) },
56
- ConsistentRead: read.consistent ?? true,
57
- }), (0, retry_policy_1.retryFor)(context, read.signal));
58
- return result.Item;
59
- }
60
- /** Fetch and decode every pending write for a checkpoint, in write order. */
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
- */
69
- const items = [];
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
- })) {
78
- items.push(item);
79
- }
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);
88
- }
@@ -1,13 +0,0 @@
1
- /** A JSON-comparable value used in metadata filters. */
2
- export type FilterValue = string | number | boolean | null | FilterValue[] | {
3
- [key: string]: FilterValue;
4
- };
5
- /**
6
- * True when every key in `filter` is present in `metadata` with a deeply equal
7
- * value. Equality is structural and key-order-independent for nested objects,
8
- * order-significant for arrays, and type-strict (no `3` vs `'3'` coercion). An
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.
12
- */
13
- export declare function matchesFilter(metadata: Record<string, FilterValue>, filter: Record<string, FilterValue>): boolean;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.matchesFilter = matchesFilter;
4
- const node_util_1 = require("node:util");
5
- /**
6
- * True when every key in `filter` is present in `metadata` with a deeply equal
7
- * value. Equality is structural and key-order-independent for nested objects,
8
- * order-significant for arrays, and type-strict (no `3` vs `'3'` coercion). An
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.
12
- */
13
- function matchesFilter(metadata, filter) {
14
- return Object.entries(filter).every(([key, value]) => (0, node_util_1.isDeepStrictEqual)(Object.hasOwn(metadata, key) ? metadata[key] : undefined, value));
15
- }
@@ -1,66 +0,0 @@
1
- import type { Checkpoint, CheckpointMetadata, CheckpointPendingWrite } from '@langchain/langgraph-checkpoint';
2
- import type { DocItem } from '../../shared/dynamodb/types';
3
- import type { CheckpointMetaItem, CheckpointPayloadItem, CheckpointWriteItem } from '../types';
4
- import type { CheckpointerContext } from './setup';
5
- /**
6
- * Narrow a raw row to a {@link CheckpointMetaItem}, or `undefined` for a row
7
- * that merely shares the `META#` sort-key prefix. Replaces an unchecked cast
8
- * at the one boundary where a row may not have been written by this adapter.
9
- */
10
- export declare function narrowMetaItem(raw: DocItem): CheckpointMetaItem | undefined;
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>;
27
- /**
28
- * Drop rows a later `putWrites` call added for a task and channel an earlier
29
- * call had already committed.
30
- *
31
- * A regular write's index is its position in the caller's array, so a retried
32
- * task whose write mix changed can place an already-committed channel at a
33
- * second index — a new row, which would replay that channel's value twice. For
34
- * an accumulating channel (a `messages` add-reducer, a Topic) that
35
- * double-counts. Every row carries the `writeGroup` of the call that wrote it,
36
- * which distinguishes that case from a channel a *single* call legitimately
37
- * wrote more than once (a task emitting two Sends), where both values must
38
- * survive.
39
- *
40
- * Write groups are time-ordered ULIDs, so the smallest one for a `(task,
41
- * channel)` pair identifies the earliest committed call — first-write-wins,
42
- * the same rule the write-side guard applies, extended to the case the guard
43
- * cannot see. Selecting by *order encountered* would not do: rows arrive
44
- * sorted by index, and a retry emitting fewer writes moves an
45
- * already-committed channel to a smaller index, where it sorts ahead of the
46
- * original row and would hand back the later call's value instead. The
47
- * superseded row stays in DynamoDB and is removed by `deleteThread` or TTL
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.
63
- */
64
- export declare function dropSupersededWrites(items: CheckpointWriteItem[]): CheckpointWriteItem[];
65
- /** Decode WRITE items into `[taskId, channel, value]` pending-write tuples. */
66
- export declare function toPendingWrites(context: CheckpointerContext, items: CheckpointWriteItem[], threadId: string): Promise<CheckpointPendingWrite[]>;