@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.
- package/README.md +282 -49
- package/dist/checkpointer/actions/delete-thread.d.ts +3 -2
- package/dist/checkpointer/actions/delete-thread.js +5 -2
- package/dist/checkpointer/actions/get-tuple.d.ts +3 -2
- package/dist/checkpointer/actions/get-tuple.js +10 -4
- package/dist/checkpointer/actions/list.d.ts +14 -4
- package/dist/checkpointer/actions/list.js +94 -61
- package/dist/checkpointer/actions/put-writes.d.ts +5 -5
- package/dist/checkpointer/actions/put-writes.js +12 -40
- package/dist/checkpointer/actions/put.d.ts +10 -3
- package/dist/checkpointer/actions/put.js +42 -12
- package/dist/checkpointer/internal/assemble.d.ts +10 -3
- package/dist/checkpointer/internal/assemble.js +7 -6
- package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +24 -0
- package/dist/checkpointer/internal/checkpoint-write-verify.js +67 -0
- package/dist/checkpointer/internal/configurable.d.ts +0 -1
- package/dist/checkpointer/internal/configurable.js +10 -9
- package/dist/checkpointer/internal/fetch.d.ts +14 -5
- package/dist/checkpointer/internal/fetch.js +56 -14
- package/dist/checkpointer/internal/filter-match.d.ts +3 -2
- package/dist/checkpointer/internal/filter-match.js +4 -3
- package/dist/checkpointer/internal/item-reader.d.ts +31 -6
- package/dist/checkpointer/internal/item-reader.js +54 -15
- package/dist/checkpointer/internal/item-writer.d.ts +12 -3
- package/dist/checkpointer/internal/item-writer.js +26 -10
- package/dist/checkpointer/internal/keys.d.ts +11 -1
- package/dist/checkpointer/internal/keys.js +33 -3
- package/dist/checkpointer/internal/list-scope.d.ts +61 -0
- package/dist/checkpointer/internal/list-scope.js +108 -0
- package/dist/checkpointer/internal/pending-sends.d.ts +13 -0
- package/dist/checkpointer/internal/pending-sends.js +29 -0
- package/dist/checkpointer/internal/query.d.ts +2 -1
- package/dist/checkpointer/internal/query.js +9 -3
- package/dist/checkpointer/internal/regular-write.d.ts +28 -0
- package/dist/checkpointer/internal/regular-write.js +66 -0
- package/dist/checkpointer/internal/setup.d.ts +3 -1
- package/dist/checkpointer/internal/setup.js +10 -8
- package/dist/checkpointer/internal/special-write-cas.d.ts +29 -0
- package/dist/checkpointer/internal/special-write-cas.js +104 -0
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +19 -14
- package/dist/checkpointer/internal/special-write-cleanup.js +35 -87
- package/dist/checkpointer/internal/special-write-verify.d.ts +53 -0
- package/dist/checkpointer/internal/special-write-verify.js +80 -0
- package/dist/checkpointer/internal/stored-channels.d.ts +31 -0
- package/dist/checkpointer/internal/stored-channels.js +70 -0
- package/dist/checkpointer/internal/validation.d.ts +11 -6
- package/dist/checkpointer/internal/validation.js +19 -9
- package/dist/checkpointer/internal/write-guard.d.ts +8 -9
- package/dist/checkpointer/internal/write-guard.js +16 -16
- package/dist/checkpointer/internal/write-index.d.ts +8 -1
- package/dist/checkpointer/internal/write-index.js +6 -3
- package/dist/checkpointer/saver.d.ts +50 -10
- package/dist/checkpointer/saver.js +59 -17
- package/dist/checkpointer/types.d.ts +14 -1
- package/dist/checkpointer/types.js +0 -1
- package/dist/factory/factory.d.ts +22 -25
- package/dist/factory/factory.js +58 -18
- package/dist/factory/types.d.ts +57 -0
- package/dist/factory/types.js +2 -0
- package/dist/history/actions/add-messages.d.ts +1 -2
- package/dist/history/actions/add-messages.js +4 -4
- package/dist/history/actions/clear.d.ts +3 -2
- package/dist/history/actions/clear.js +5 -2
- package/dist/history/actions/get-messages.d.ts +13 -6
- package/dist/history/actions/get-messages.js +63 -42
- package/dist/history/actions/list-sessions.d.ts +1 -1
- package/dist/history/actions/list-sessions.js +8 -12
- package/dist/history/actions/reconcile-count.d.ts +1 -2
- package/dist/history/actions/reconcile-count.js +20 -7
- package/dist/history/chat-message-history.d.ts +51 -26
- package/dist/history/chat-message-history.js +60 -30
- package/dist/history/internal/append-saga.d.ts +7 -2
- package/dist/history/internal/append-saga.js +58 -14
- package/dist/history/internal/compensation.d.ts +6 -2
- package/dist/history/internal/compensation.js +14 -6
- package/dist/history/internal/item-mapper.d.ts +0 -3
- package/dist/history/internal/item-mapper.js +2 -8
- package/dist/history/internal/keys.d.ts +0 -1
- package/dist/history/internal/keys.js +0 -1
- package/dist/history/internal/message-chunker.d.ts +0 -1
- package/dist/history/internal/message-chunker.js +0 -1
- package/dist/history/internal/message-transaction.d.ts +0 -1
- package/dist/history/internal/message-transaction.js +3 -2
- package/dist/history/internal/message-window.d.ts +17 -0
- package/dist/history/internal/message-window.js +49 -0
- package/dist/history/internal/query.d.ts +16 -3
- package/dist/history/internal/query.js +13 -5
- package/dist/history/internal/session-count.d.ts +8 -2
- package/dist/history/internal/session-count.js +14 -8
- package/dist/history/internal/session-title.d.ts +0 -1
- package/dist/history/internal/session-title.js +1 -2
- package/dist/history/internal/session-update.d.ts +0 -1
- package/dist/history/internal/session-update.js +0 -1
- package/dist/history/internal/setup.d.ts +3 -1
- package/dist/history/internal/setup.js +16 -8
- package/dist/history/internal/title-generator.d.ts +0 -1
- package/dist/history/internal/title-generator.js +19 -3
- package/dist/history/internal/ttl-anchor.d.ts +1 -2
- package/dist/history/internal/ttl-anchor.js +5 -5
- package/dist/history/internal/validation.d.ts +19 -3
- package/dist/history/internal/validation.js +41 -4
- package/dist/history/session-adapter.d.ts +9 -3
- package/dist/history/session-adapter.js +6 -3
- package/dist/history/types.d.ts +23 -2
- package/dist/history/types.js +0 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.js +5 -3
- package/dist/shared/clock.d.ts +6 -1
- package/dist/shared/clock.js +9 -1
- package/dist/shared/codec/codec.d.ts +26 -17
- package/dist/shared/codec/codec.js +46 -24
- package/dist/shared/codec/compression.d.ts +1 -2
- package/dist/shared/codec/compression.js +2 -3
- package/dist/shared/codec/descriptor-keys.d.ts +11 -3
- package/dist/shared/codec/descriptor-keys.js +2 -2
- package/dist/shared/codec/encode.d.ts +13 -0
- package/dist/shared/codec/encode.js +43 -0
- package/dist/shared/codec/json-serde.d.ts +0 -1
- package/dist/shared/codec/json-serde.js +0 -1
- package/dist/shared/codec/payload-loss.d.ts +12 -0
- package/dist/shared/codec/payload-loss.js +38 -0
- package/dist/shared/codec/s3/adapter-config.d.ts +13 -0
- package/dist/shared/codec/s3/adapter-config.js +22 -0
- package/dist/shared/codec/s3/bounded-body.d.ts +14 -0
- package/dist/shared/codec/s3/bounded-body.js +47 -0
- package/dist/shared/codec/s3/client-types.d.ts +34 -0
- package/dist/shared/codec/s3/client-types.js +7 -0
- package/dist/shared/codec/s3/client.d.ts +11 -5
- package/dist/shared/codec/s3/client.js +25 -3
- package/dist/shared/codec/s3/config.d.ts +32 -5
- package/dist/shared/codec/s3/config.js +37 -5
- package/dist/shared/codec/s3/delete.d.ts +0 -1
- package/dist/shared/codec/s3/delete.js +0 -1
- package/dist/shared/codec/s3/key-scope.d.ts +23 -0
- package/dist/shared/codec/s3/key-scope.js +44 -0
- package/dist/shared/codec/s3/lifecycle.d.ts +11 -5
- package/dist/shared/codec/s3/lifecycle.js +32 -16
- package/dist/shared/codec/s3/offloader.d.ts +6 -2
- package/dist/shared/codec/s3/offloader.js +21 -3
- package/dist/shared/codec/s3/orphans.d.ts +6 -1
- package/dist/shared/codec/s3/orphans.js +15 -2
- package/dist/shared/codec/s3/read-write.d.ts +7 -3
- package/dist/shared/codec/s3/read-write.js +16 -8
- package/dist/shared/codec/s3/retry.d.ts +4 -4
- package/dist/shared/codec/s3/retry.js +13 -16
- package/dist/shared/concurrency.d.ts +6 -0
- package/dist/shared/concurrency.js +30 -0
- package/dist/shared/constants.d.ts +68 -5
- package/dist/shared/constants.js +70 -7
- package/dist/shared/dynamodb/abort.d.ts +9 -0
- package/dist/shared/dynamodb/abort.js +27 -0
- package/dist/shared/dynamodb/backoff.d.ts +4 -4
- package/dist/shared/dynamodb/backoff.js +7 -7
- package/dist/shared/dynamodb/batch-write.d.ts +0 -1
- package/dist/shared/dynamodb/batch-write.js +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts +0 -1
- package/dist/shared/dynamodb/cancellation.js +0 -1
- package/dist/shared/dynamodb/client.d.ts +9 -2
- package/dist/shared/dynamodb/client.js +24 -1
- package/dist/shared/dynamodb/conditional-put.d.ts +67 -0
- package/dist/shared/dynamodb/conditional-put.js +76 -0
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +3 -1
- package/dist/shared/dynamodb/drain-unprocessed.js +1 -2
- package/dist/shared/dynamodb/expiry.d.ts +16 -0
- package/dist/shared/dynamodb/expiry.js +29 -0
- package/dist/shared/dynamodb/paginate-core.d.ts +5 -3
- package/dist/shared/dynamodb/paginate-core.js +47 -17
- package/dist/shared/dynamodb/paginate.d.ts +0 -1
- package/dist/shared/dynamodb/paginate.js +1 -2
- package/dist/shared/dynamodb/partition-delete.d.ts +7 -1
- package/dist/shared/dynamodb/partition-delete.js +4 -3
- package/dist/shared/dynamodb/retry-classifier.d.ts +10 -2
- package/dist/shared/dynamodb/retry-classifier.js +42 -11
- package/dist/shared/dynamodb/retry-policy.d.ts +26 -0
- package/dist/shared/dynamodb/retry-policy.js +22 -0
- package/dist/shared/dynamodb/retry.d.ts +14 -1
- package/dist/shared/dynamodb/retry.js +11 -7
- package/dist/shared/dynamodb/scan.d.ts +0 -1
- package/dist/shared/dynamodb/scan.js +1 -2
- package/dist/shared/dynamodb/types.d.ts +1 -2
- package/dist/shared/dynamodb/types.js +0 -1
- package/dist/shared/errors/base-error.d.ts +14 -6
- package/dist/shared/errors/base-error.js +8 -9
- package/dist/shared/errors/boundary.d.ts +18 -0
- package/dist/shared/errors/boundary.js +46 -0
- package/dist/shared/errors/error-code.d.ts +2 -2
- package/dist/shared/errors/error-code.js +1 -1
- package/dist/shared/errors/errors.d.ts +13 -13
- package/dist/shared/errors/errors.js +18 -16
- package/dist/shared/errors/upstream-error.d.ts +16 -0
- package/dist/shared/errors/upstream-error.js +27 -0
- package/dist/shared/errors/wrap-error.d.ts +0 -9
- package/dist/shared/errors/wrap-error.js +0 -15
- package/dist/shared/logging/logger.d.ts +6 -2
- package/dist/shared/logging/logger.js +0 -1
- package/dist/shared/logging/redaction-walk.d.ts +2 -2
- package/dist/shared/logging/redaction-walk.js +38 -18
- package/dist/shared/logging/redaction.d.ts +14 -6
- package/dist/shared/logging/redaction.js +19 -4
- package/dist/shared/logging/secret-patterns.d.ts +54 -3
- package/dist/shared/logging/secret-patterns.js +67 -8
- package/dist/shared/options.d.ts +9 -4
- package/dist/shared/options.js +0 -1
- package/dist/shared/ulid.d.ts +15 -2
- package/dist/shared/ulid.js +35 -3
- package/dist/shared/validation/options.d.ts +8 -0
- package/dist/shared/validation/options.js +90 -0
- package/dist/shared/validation/primitives.d.ts +14 -10
- package/dist/shared/validation/primitives.js +23 -25
- package/dist/shared/validation/ttl.d.ts +14 -7
- package/dist/shared/validation/ttl.js +29 -11
- package/dist/store/actions/get.d.ts +11 -3
- package/dist/store/actions/get.js +52 -14
- package/dist/store/actions/list-namespaces.d.ts +0 -1
- package/dist/store/actions/list-namespaces.js +10 -6
- package/dist/store/actions/put.d.ts +0 -1
- package/dist/store/actions/put.js +27 -28
- package/dist/store/actions/reconcile-vector-index.d.ts +3 -2
- package/dist/store/actions/reconcile-vector-index.js +2 -3
- package/dist/store/actions/search.d.ts +1 -2
- package/dist/store/actions/search.js +11 -38
- package/dist/store/internal/backend-search.d.ts +1 -2
- package/dist/store/internal/backend-search.js +14 -7
- package/dist/store/internal/batch-plan.d.ts +11 -0
- package/dist/store/internal/batch-plan.js +52 -0
- package/dist/store/internal/candidates.d.ts +23 -0
- package/dist/store/internal/candidates.js +94 -0
- package/dist/store/internal/filter.d.ts +0 -1
- package/dist/store/internal/filter.js +25 -6
- package/dist/store/internal/index-reconcile.d.ts +5 -6
- package/dist/store/internal/index-reconcile.js +32 -13
- package/dist/store/internal/index-sync.d.ts +0 -1
- package/dist/store/internal/index-sync.js +0 -1
- package/dist/store/internal/item-mapper.d.ts +6 -3
- package/dist/store/internal/item-mapper.js +16 -6
- package/dist/store/internal/keys.d.ts +0 -1
- package/dist/store/internal/keys.js +0 -1
- package/dist/store/internal/namespace-match.d.ts +0 -1
- package/dist/store/internal/namespace-match.js +0 -1
- package/dist/store/internal/option-validation.d.ts +13 -0
- package/dist/store/internal/option-validation.js +77 -0
- package/dist/store/internal/overwrite-swap.d.ts +32 -0
- package/dist/store/internal/overwrite-swap.js +68 -0
- package/dist/store/internal/persist.d.ts +24 -7
- package/dist/store/internal/persist.js +49 -19
- package/dist/store/internal/query.d.ts +6 -1
- package/dist/store/internal/query.js +17 -1
- package/dist/store/internal/ranker.d.ts +7 -2
- package/dist/store/internal/ranker.js +10 -2
- package/dist/store/internal/read-existing.d.ts +23 -0
- package/dist/store/internal/read-existing.js +41 -0
- package/dist/store/internal/score-direction.d.ts +31 -0
- package/dist/store/internal/score-direction.js +38 -0
- package/dist/store/internal/search-filter.d.ts +0 -1
- package/dist/store/internal/search-filter.js +0 -1
- package/dist/store/internal/semantic-search.d.ts +26 -5
- package/dist/store/internal/semantic-search.js +59 -19
- package/dist/store/internal/setup.d.ts +6 -12
- package/dist/store/internal/setup.js +12 -24
- package/dist/store/internal/text-path.d.ts +17 -0
- package/dist/store/internal/text-path.js +147 -0
- package/dist/store/internal/validation.d.ts +8 -3
- package/dist/store/internal/validation.js +21 -5
- package/dist/store/internal/write-verify.d.ts +27 -9
- package/dist/store/internal/write-verify.js +35 -19
- package/dist/store/store.d.ts +37 -9
- package/dist/store/store.js +52 -17
- package/dist/store/types.d.ts +22 -2
- package/dist/store/types.js +0 -1
- package/dist/store/vector-backend.d.ts +6 -7
- package/dist/store/vector-backend.js +0 -1
- package/package.json +21 -15
- package/dist/checkpointer/actions/delete-thread.d.ts.map +0 -1
- package/dist/checkpointer/actions/delete-thread.js.map +0 -1
- package/dist/checkpointer/actions/get-tuple.d.ts.map +0 -1
- package/dist/checkpointer/actions/get-tuple.js.map +0 -1
- package/dist/checkpointer/actions/list.d.ts.map +0 -1
- package/dist/checkpointer/actions/list.js.map +0 -1
- package/dist/checkpointer/actions/put-writes.d.ts.map +0 -1
- package/dist/checkpointer/actions/put-writes.js.map +0 -1
- package/dist/checkpointer/actions/put.d.ts.map +0 -1
- package/dist/checkpointer/actions/put.js.map +0 -1
- package/dist/checkpointer/internal/assemble.d.ts.map +0 -1
- package/dist/checkpointer/internal/assemble.js.map +0 -1
- package/dist/checkpointer/internal/configurable.d.ts.map +0 -1
- package/dist/checkpointer/internal/configurable.js.map +0 -1
- package/dist/checkpointer/internal/fetch.d.ts.map +0 -1
- package/dist/checkpointer/internal/fetch.js.map +0 -1
- package/dist/checkpointer/internal/filter-match.d.ts.map +0 -1
- package/dist/checkpointer/internal/filter-match.js.map +0 -1
- package/dist/checkpointer/internal/item-reader.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-reader.js.map +0 -1
- package/dist/checkpointer/internal/item-writer.d.ts.map +0 -1
- package/dist/checkpointer/internal/item-writer.js.map +0 -1
- package/dist/checkpointer/internal/keys.d.ts.map +0 -1
- package/dist/checkpointer/internal/keys.js.map +0 -1
- package/dist/checkpointer/internal/query.d.ts.map +0 -1
- package/dist/checkpointer/internal/query.js.map +0 -1
- package/dist/checkpointer/internal/setup.d.ts.map +0 -1
- package/dist/checkpointer/internal/setup.js.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.d.ts.map +0 -1
- package/dist/checkpointer/internal/special-write-cleanup.js.map +0 -1
- package/dist/checkpointer/internal/validation.d.ts.map +0 -1
- package/dist/checkpointer/internal/validation.js.map +0 -1
- package/dist/checkpointer/internal/write-guard.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-guard.js.map +0 -1
- package/dist/checkpointer/internal/write-index.d.ts.map +0 -1
- package/dist/checkpointer/internal/write-index.js.map +0 -1
- package/dist/checkpointer/saver.d.ts.map +0 -1
- package/dist/checkpointer/saver.js.map +0 -1
- package/dist/checkpointer/types.d.ts.map +0 -1
- package/dist/checkpointer/types.js.map +0 -1
- package/dist/factory/factory.d.ts.map +0 -1
- package/dist/factory/factory.js.map +0 -1
- package/dist/history/actions/add-messages.d.ts.map +0 -1
- package/dist/history/actions/add-messages.js.map +0 -1
- package/dist/history/actions/clear.d.ts.map +0 -1
- package/dist/history/actions/clear.js.map +0 -1
- package/dist/history/actions/get-messages.d.ts.map +0 -1
- package/dist/history/actions/get-messages.js.map +0 -1
- package/dist/history/actions/list-sessions.d.ts.map +0 -1
- package/dist/history/actions/list-sessions.js.map +0 -1
- package/dist/history/actions/reconcile-count.d.ts.map +0 -1
- package/dist/history/actions/reconcile-count.js.map +0 -1
- package/dist/history/chat-message-history.d.ts.map +0 -1
- package/dist/history/chat-message-history.js.map +0 -1
- package/dist/history/internal/append-saga.d.ts.map +0 -1
- package/dist/history/internal/append-saga.js.map +0 -1
- package/dist/history/internal/compensation.d.ts.map +0 -1
- package/dist/history/internal/compensation.js.map +0 -1
- package/dist/history/internal/item-mapper.d.ts.map +0 -1
- package/dist/history/internal/item-mapper.js.map +0 -1
- package/dist/history/internal/keys.d.ts.map +0 -1
- package/dist/history/internal/keys.js.map +0 -1
- package/dist/history/internal/message-chunker.d.ts.map +0 -1
- package/dist/history/internal/message-chunker.js.map +0 -1
- package/dist/history/internal/message-transaction.d.ts.map +0 -1
- package/dist/history/internal/message-transaction.js.map +0 -1
- package/dist/history/internal/query.d.ts.map +0 -1
- package/dist/history/internal/query.js.map +0 -1
- package/dist/history/internal/session-count.d.ts.map +0 -1
- package/dist/history/internal/session-count.js.map +0 -1
- package/dist/history/internal/session-title.d.ts.map +0 -1
- package/dist/history/internal/session-title.js.map +0 -1
- package/dist/history/internal/session-update.d.ts.map +0 -1
- package/dist/history/internal/session-update.js.map +0 -1
- package/dist/history/internal/setup.d.ts.map +0 -1
- package/dist/history/internal/setup.js.map +0 -1
- package/dist/history/internal/title-generator.d.ts.map +0 -1
- package/dist/history/internal/title-generator.js.map +0 -1
- package/dist/history/internal/ttl-anchor.d.ts.map +0 -1
- package/dist/history/internal/ttl-anchor.js.map +0 -1
- package/dist/history/internal/validation.d.ts.map +0 -1
- package/dist/history/internal/validation.js.map +0 -1
- package/dist/history/session-adapter.d.ts.map +0 -1
- package/dist/history/session-adapter.js.map +0 -1
- package/dist/history/types.d.ts.map +0 -1
- package/dist/history/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/shared/clock.d.ts.map +0 -1
- package/dist/shared/clock.js.map +0 -1
- package/dist/shared/codec/codec.d.ts.map +0 -1
- package/dist/shared/codec/codec.js.map +0 -1
- package/dist/shared/codec/compression.d.ts.map +0 -1
- package/dist/shared/codec/compression.js.map +0 -1
- package/dist/shared/codec/descriptor-keys.d.ts.map +0 -1
- package/dist/shared/codec/descriptor-keys.js.map +0 -1
- package/dist/shared/codec/json-serde.d.ts.map +0 -1
- package/dist/shared/codec/json-serde.js.map +0 -1
- package/dist/shared/codec/s3/client.d.ts.map +0 -1
- package/dist/shared/codec/s3/client.js.map +0 -1
- package/dist/shared/codec/s3/config.d.ts.map +0 -1
- package/dist/shared/codec/s3/config.js.map +0 -1
- package/dist/shared/codec/s3/delete.d.ts.map +0 -1
- package/dist/shared/codec/s3/delete.js.map +0 -1
- package/dist/shared/codec/s3/lifecycle.d.ts.map +0 -1
- package/dist/shared/codec/s3/lifecycle.js.map +0 -1
- package/dist/shared/codec/s3/offloader.d.ts.map +0 -1
- package/dist/shared/codec/s3/offloader.js.map +0 -1
- package/dist/shared/codec/s3/orphans.d.ts.map +0 -1
- package/dist/shared/codec/s3/orphans.js.map +0 -1
- package/dist/shared/codec/s3/read-write.d.ts.map +0 -1
- package/dist/shared/codec/s3/read-write.js.map +0 -1
- package/dist/shared/codec/s3/retry.d.ts.map +0 -1
- package/dist/shared/codec/s3/retry.js.map +0 -1
- package/dist/shared/constants.d.ts.map +0 -1
- package/dist/shared/constants.js.map +0 -1
- package/dist/shared/dynamodb/backoff.d.ts.map +0 -1
- package/dist/shared/dynamodb/backoff.js.map +0 -1
- package/dist/shared/dynamodb/batch-write.d.ts.map +0 -1
- package/dist/shared/dynamodb/batch-write.js.map +0 -1
- package/dist/shared/dynamodb/cancellation.d.ts.map +0 -1
- package/dist/shared/dynamodb/cancellation.js.map +0 -1
- package/dist/shared/dynamodb/client.d.ts.map +0 -1
- package/dist/shared/dynamodb/client.js.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.d.ts.map +0 -1
- package/dist/shared/dynamodb/drain-unprocessed.js.map +0 -1
- package/dist/shared/dynamodb/paginate-core.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate-core.js.map +0 -1
- package/dist/shared/dynamodb/paginate.d.ts.map +0 -1
- package/dist/shared/dynamodb/paginate.js.map +0 -1
- package/dist/shared/dynamodb/partition-delete.d.ts.map +0 -1
- package/dist/shared/dynamodb/partition-delete.js.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry-classifier.js.map +0 -1
- package/dist/shared/dynamodb/retry.d.ts.map +0 -1
- package/dist/shared/dynamodb/retry.js.map +0 -1
- package/dist/shared/dynamodb/scan.d.ts.map +0 -1
- package/dist/shared/dynamodb/scan.js.map +0 -1
- package/dist/shared/dynamodb/types.d.ts.map +0 -1
- package/dist/shared/dynamodb/types.js.map +0 -1
- package/dist/shared/errors/base-error.d.ts.map +0 -1
- package/dist/shared/errors/base-error.js.map +0 -1
- package/dist/shared/errors/error-code.d.ts.map +0 -1
- package/dist/shared/errors/error-code.js.map +0 -1
- package/dist/shared/errors/errors.d.ts.map +0 -1
- package/dist/shared/errors/errors.js.map +0 -1
- package/dist/shared/errors/wrap-error.d.ts.map +0 -1
- package/dist/shared/errors/wrap-error.js.map +0 -1
- package/dist/shared/logging/logger.d.ts.map +0 -1
- package/dist/shared/logging/logger.js.map +0 -1
- package/dist/shared/logging/redaction-walk.d.ts.map +0 -1
- package/dist/shared/logging/redaction-walk.js.map +0 -1
- package/dist/shared/logging/redaction.d.ts.map +0 -1
- package/dist/shared/logging/redaction.js.map +0 -1
- package/dist/shared/logging/secret-patterns.d.ts.map +0 -1
- package/dist/shared/logging/secret-patterns.js.map +0 -1
- package/dist/shared/options.d.ts.map +0 -1
- package/dist/shared/options.js.map +0 -1
- package/dist/shared/ulid.d.ts.map +0 -1
- package/dist/shared/ulid.js.map +0 -1
- package/dist/shared/validation/primitives.d.ts.map +0 -1
- package/dist/shared/validation/primitives.js.map +0 -1
- package/dist/shared/validation/ttl.d.ts.map +0 -1
- package/dist/shared/validation/ttl.js.map +0 -1
- package/dist/store/actions/get.d.ts.map +0 -1
- package/dist/store/actions/get.js.map +0 -1
- package/dist/store/actions/list-namespaces.d.ts.map +0 -1
- package/dist/store/actions/list-namespaces.js.map +0 -1
- package/dist/store/actions/put.d.ts.map +0 -1
- package/dist/store/actions/put.js.map +0 -1
- package/dist/store/actions/reconcile-vector-index.d.ts.map +0 -1
- package/dist/store/actions/reconcile-vector-index.js.map +0 -1
- package/dist/store/actions/search.d.ts.map +0 -1
- package/dist/store/actions/search.js.map +0 -1
- package/dist/store/internal/backend-search.d.ts.map +0 -1
- package/dist/store/internal/backend-search.js.map +0 -1
- package/dist/store/internal/filter.d.ts.map +0 -1
- package/dist/store/internal/filter.js.map +0 -1
- package/dist/store/internal/index-reconcile.d.ts.map +0 -1
- package/dist/store/internal/index-reconcile.js.map +0 -1
- package/dist/store/internal/index-sync.d.ts.map +0 -1
- package/dist/store/internal/index-sync.js.map +0 -1
- package/dist/store/internal/item-mapper.d.ts.map +0 -1
- package/dist/store/internal/item-mapper.js.map +0 -1
- package/dist/store/internal/keys.d.ts.map +0 -1
- package/dist/store/internal/keys.js.map +0 -1
- package/dist/store/internal/namespace-match.d.ts.map +0 -1
- package/dist/store/internal/namespace-match.js.map +0 -1
- package/dist/store/internal/persist.d.ts.map +0 -1
- package/dist/store/internal/persist.js.map +0 -1
- package/dist/store/internal/query.d.ts.map +0 -1
- package/dist/store/internal/query.js.map +0 -1
- package/dist/store/internal/ranker.d.ts.map +0 -1
- package/dist/store/internal/ranker.js.map +0 -1
- package/dist/store/internal/search-filter.d.ts.map +0 -1
- package/dist/store/internal/search-filter.js.map +0 -1
- package/dist/store/internal/semantic-search.d.ts.map +0 -1
- package/dist/store/internal/semantic-search.js.map +0 -1
- package/dist/store/internal/setup.d.ts.map +0 -1
- package/dist/store/internal/setup.js.map +0 -1
- package/dist/store/internal/validation.d.ts.map +0 -1
- package/dist/store/internal/validation.js.map +0 -1
- package/dist/store/internal/write-verify.d.ts.map +0 -1
- package/dist/store/internal/write-verify.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/types.d.ts.map +0 -1
- package/dist/store/types.js.map +0 -1
- package/dist/store/vector-backend.d.ts.map +0 -1
- package/dist/store/vector-backend.js.map +0 -1
|
@@ -7,13 +7,19 @@ const fetch_1 = require("../internal/fetch");
|
|
|
7
7
|
/**
|
|
8
8
|
* Load a checkpoint tuple: the target checkpoint (by id, or the newest in the
|
|
9
9
|
* namespace), its metadata, its pending writes, and a parent config when the
|
|
10
|
-
* checkpoint has a parent. Returns undefined when no matching checkpoint
|
|
10
|
+
* checkpoint has a parent. Returns undefined when no matching checkpoint
|
|
11
|
+
* exists — including for a config that names no thread at all, which the
|
|
12
|
+
* reference savers answer with "nothing" rather than an error.
|
|
11
13
|
*/
|
|
12
14
|
async function getCheckpointTuple(context, config) {
|
|
15
|
+
if (config.configurable?.thread_id === undefined)
|
|
16
|
+
return undefined;
|
|
13
17
|
const { threadId, checkpointNs, checkpointId } = (0, configurable_1.readConfigurable)(config);
|
|
14
|
-
const meta = await (0, fetch_1.fetchTargetMeta)(context, threadId, checkpointNs, checkpointId);
|
|
18
|
+
const meta = await (0, fetch_1.fetchTargetMeta)(context, threadId, checkpointNs, checkpointId, config.signal);
|
|
15
19
|
if (!meta)
|
|
16
20
|
return undefined;
|
|
17
|
-
return (0, assemble_1.assembleTuple)(context, threadId, checkpointNs, meta
|
|
21
|
+
return (0, assemble_1.assembleTuple)(context, threadId, checkpointNs, meta, {
|
|
22
|
+
signal: config.signal,
|
|
23
|
+
consistent: true,
|
|
24
|
+
});
|
|
18
25
|
}
|
|
19
|
-
//# sourceMappingURL=get-tuple.js.map
|
|
@@ -2,9 +2,19 @@ import type { RunnableConfig } from '@langchain/core/runnables';
|
|
|
2
2
|
import type { CheckpointListOptions, CheckpointTuple } from '@langchain/langgraph-checkpoint';
|
|
3
3
|
import type { CheckpointerContext } from '../internal/setup';
|
|
4
4
|
/**
|
|
5
|
-
* Yield checkpoint tuples for a thread
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Yield checkpoint tuples for a thread, newest first: every namespace when the
|
|
6
|
+
* config names none (grouped by namespace, newest first within each), else the
|
|
7
|
+
* one namespace given. Without a `thread_id` every thread in the table is
|
|
8
|
+
* listed through a table scan, as the reference savers do; that read is
|
|
9
|
+
* unordered across threads and cross-tenant by construction. Honors
|
|
10
|
+
* `options.before` (only checkpoints older than the given id),
|
|
11
|
+
* `options.filter` (metadata equality), and `options.limit` (max tuples
|
|
12
|
+
* yielded; the read stops right after the yield that reaches it).
|
|
13
|
+
*
|
|
14
|
+
* The scan is deliberately unbounded: this generator streams and never
|
|
15
|
+
* accumulates, `limit` returns early, and a raw-row cap would turn a caller
|
|
16
|
+
* asking for a handful of rare matches over a large thread into a hard error
|
|
17
|
+
* instead of the true (possibly empty) answer. Past the warning threshold an
|
|
18
|
+
* operator is told to narrow the filter or pass a limit.
|
|
8
19
|
*/
|
|
9
20
|
export declare function listCheckpoints(context: CheckpointerContext, config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
|
|
10
|
-
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1,80 +1,113 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listCheckpoints = listCheckpoints;
|
|
4
|
+
const clock_1 = require("../../shared/clock");
|
|
5
|
+
const constants_1 = require("../../shared/constants");
|
|
6
|
+
const expiry_1 = require("../../shared/dynamodb/expiry");
|
|
4
7
|
const paginate_1 = require("../../shared/dynamodb/paginate");
|
|
8
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
9
|
+
const scan_1 = require("../../shared/dynamodb/scan");
|
|
5
10
|
const assemble_1 = require("../internal/assemble");
|
|
6
|
-
const
|
|
7
|
-
const filter_match_1 = require("../internal/filter-match");
|
|
11
|
+
const fetch_1 = require("../internal/fetch");
|
|
8
12
|
const item_reader_1 = require("../internal/item-reader");
|
|
9
|
-
const
|
|
10
|
-
const query_1 = require("../internal/query");
|
|
11
|
-
/** Read list options into a flat, typed shape. */
|
|
12
|
-
function readListOptions(options) {
|
|
13
|
-
return {
|
|
14
|
-
before: options?.before?.configurable?.checkpoint_id,
|
|
15
|
-
filter: options?.filter,
|
|
16
|
-
limit: options?.limit,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
13
|
+
const list_scope_1 = require("../internal/list-scope");
|
|
19
14
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* The tuple for one META item that passes every filter, assembled eventually
|
|
16
|
+
* consistently (a history listing tolerates a replica lag `getTuple` does not)
|
|
17
|
+
* and reusing the metadata the filter already decoded. Undefined when the row
|
|
18
|
+
* is filtered out or its payload is missing.
|
|
23
19
|
*/
|
|
24
|
-
function
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
27
|
-
|
|
20
|
+
async function tupleFor(context, meta, scope) {
|
|
21
|
+
if (!(0, list_scope_1.passesKeyFilters)(meta, scope))
|
|
22
|
+
return undefined;
|
|
23
|
+
const verdict = await (0, list_scope_1.passesMetadataFilter)(context, meta, scope);
|
|
24
|
+
if (!verdict.pass)
|
|
25
|
+
return undefined;
|
|
26
|
+
return (0, assemble_1.assembleTuple)(context, meta.threadId, meta.checkpointNs, meta, {
|
|
27
|
+
signal: scope.signal,
|
|
28
|
+
consistent: false,
|
|
29
|
+
metadata: verdict.metadata,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** A `checkpoint_id` addresses one row: read it directly instead of scanning the namespace for it. */
|
|
33
|
+
async function* listOne(context, scope) {
|
|
34
|
+
const meta = await (0, fetch_1.fetchTargetMeta)(context, scope.threadId, scope.checkpointNs ?? '', scope.checkpointId, scope.signal);
|
|
35
|
+
if (!meta)
|
|
36
|
+
return;
|
|
37
|
+
const tuple = await tupleFor(context, meta, scope);
|
|
38
|
+
if (tuple)
|
|
39
|
+
yield tuple;
|
|
28
40
|
}
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
/** Narrow a scanned row, warning about (and skipping) one that is not a checkpoint meta item. */
|
|
42
|
+
function narrowOrWarn(context, raw) {
|
|
43
|
+
const meta = (0, item_reader_1.narrowMetaItem)(raw);
|
|
44
|
+
if (!meta) {
|
|
45
|
+
context.logger.warn('list: skipped a row that is not a checkpoint meta item', {
|
|
46
|
+
sortKey: raw.SK,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return meta;
|
|
50
|
+
}
|
|
51
|
+
/** The META rows a scope covers: a partition query for a thread, a table scan without one. */
|
|
52
|
+
function metaRows(context, scope, now) {
|
|
53
|
+
const retry = (0, retry_policy_1.retryFor)(context, scope.signal);
|
|
54
|
+
const bounds = { maxItems: Number.POSITIVE_INFINITY, maxIterations: Number.POSITIVE_INFINITY };
|
|
55
|
+
return scope.threadId === undefined
|
|
56
|
+
? (0, scan_1.paginateScan)({
|
|
57
|
+
retry,
|
|
58
|
+
signal: scope.signal,
|
|
59
|
+
client: context.client,
|
|
60
|
+
params: (0, expiry_1.withoutExpired)((0, list_scope_1.listScan)(context, scope), now),
|
|
61
|
+
...bounds,
|
|
62
|
+
})
|
|
63
|
+
: (0, paginate_1.paginateQuery)({
|
|
64
|
+
retry,
|
|
65
|
+
signal: scope.signal,
|
|
66
|
+
client: context.client,
|
|
67
|
+
params: (0, expiry_1.withoutExpired)((0, list_scope_1.listQuery)(context, { ...scope, threadId: scope.threadId }), now),
|
|
68
|
+
...bounds,
|
|
69
|
+
});
|
|
35
70
|
}
|
|
36
71
|
/**
|
|
37
|
-
* Yield checkpoint tuples for a thread
|
|
38
|
-
*
|
|
39
|
-
*
|
|
72
|
+
* Yield checkpoint tuples for a thread, newest first: every namespace when the
|
|
73
|
+
* config names none (grouped by namespace, newest first within each), else the
|
|
74
|
+
* one namespace given. Without a `thread_id` every thread in the table is
|
|
75
|
+
* listed through a table scan, as the reference savers do; that read is
|
|
76
|
+
* unordered across threads and cross-tenant by construction. Honors
|
|
77
|
+
* `options.before` (only checkpoints older than the given id),
|
|
78
|
+
* `options.filter` (metadata equality), and `options.limit` (max tuples
|
|
79
|
+
* yielded; the read stops right after the yield that reaches it).
|
|
80
|
+
*
|
|
81
|
+
* The scan is deliberately unbounded: this generator streams and never
|
|
82
|
+
* accumulates, `limit` returns early, and a raw-row cap would turn a caller
|
|
83
|
+
* asking for a handful of rare matches over a large thread into a hard error
|
|
84
|
+
* instead of the true (possibly empty) answer. Past the warning threshold an
|
|
85
|
+
* operator is told to narrow the filter or pass a limit.
|
|
40
86
|
*/
|
|
41
87
|
async function* listCheckpoints(context, config, options) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
88
|
+
const scope = (0, list_scope_1.readListScope)(config, options);
|
|
89
|
+
if (scope.threadId !== undefined && scope.checkpointId !== undefined) {
|
|
90
|
+
yield* listOne(context, { ...scope, threadId: scope.threadId });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const now = (0, clock_1.nowSeconds)();
|
|
45
94
|
let yielded = 0;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* ResultTruncatedError instead of the true (possibly empty) answer.
|
|
53
|
-
*/
|
|
54
|
-
for await (const raw of (0, paginate_1.paginateQuery)({
|
|
55
|
-
client: context.client,
|
|
56
|
-
params,
|
|
57
|
-
maxItems: Number.POSITIVE_INFINITY,
|
|
58
|
-
maxIterations: Number.POSITIVE_INFINITY,
|
|
59
|
-
})) {
|
|
60
|
-
if (limit !== undefined && yielded >= limit)
|
|
61
|
-
return;
|
|
62
|
-
const meta = (0, item_reader_1.narrowMetaItem)(raw);
|
|
63
|
-
if (!meta) {
|
|
64
|
-
context.logger.warn('list: skipped a row that is not a checkpoint meta item', {
|
|
65
|
-
sortKey: raw.SK,
|
|
66
|
-
});
|
|
67
|
-
continue;
|
|
95
|
+
let scanned = 0;
|
|
96
|
+
for await (const raw of metaRows(context, scope, now)) {
|
|
97
|
+
scanned += 1;
|
|
98
|
+
if (scanned === constants_1.LIST_SCAN_WARN_THRESHOLD) {
|
|
99
|
+
context.logger.warn('list: scanned a large number of rows without the caller stopping; this read is ' +
|
|
100
|
+
'deliberately unbounded, so narrow the filter or pass options.limit', { threadId: scope.threadId, checkpointNs: scope.checkpointNs, scanned });
|
|
68
101
|
}
|
|
69
|
-
|
|
102
|
+
const meta = narrowOrWarn(context, raw);
|
|
103
|
+
if (!meta || (0, expiry_1.isExpiredRow)(meta, now))
|
|
70
104
|
continue;
|
|
71
|
-
|
|
105
|
+
const tuple = await tupleFor(context, meta, scope);
|
|
106
|
+
if (!tuple)
|
|
72
107
|
continue;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
108
|
+
yield tuple;
|
|
109
|
+
yielded += 1;
|
|
110
|
+
if (scope.limit !== undefined && yielded >= scope.limit)
|
|
111
|
+
return;
|
|
78
112
|
}
|
|
79
113
|
}
|
|
80
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -6,10 +6,10 @@ import type { CheckpointerContext } from '../internal/setup';
|
|
|
6
6
|
* Requires `checkpoint_id` in the config — writes always attach to a checkpoint.
|
|
7
7
|
* Regular writes are first-write-wins (matching the reference checkpointer
|
|
8
8
|
* contract); special negative-index writes always overwrite (see
|
|
9
|
-
* {@link writeSpecialItemsWithCleanup}). Regular-write
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* but a live row can never be
|
|
9
|
+
* {@link writeSpecialItemsWithCleanup}). Regular-write cleanup only ever
|
|
10
|
+
* targets uploads confirmed unreferenced (see {@link writeRegularItems}): a
|
|
11
|
+
* verified non-commit, or a guard rejection whose returned row provably
|
|
12
|
+
* belongs to another call. An upload can leak but a live row can never be
|
|
13
|
+
* stranded pointing at a deleted object.
|
|
13
14
|
*/
|
|
14
15
|
export declare function putWrites(context: CheckpointerContext, config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
|
|
15
|
-
//# sourceMappingURL=put-writes.d.ts.map
|
|
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.putWrites = putWrites;
|
|
4
4
|
const descriptor_keys_1 = require("../../shared/codec/descriptor-keys");
|
|
5
5
|
const orphans_1 = require("../../shared/codec/s3/orphans");
|
|
6
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
7
6
|
const errors_1 = require("../../shared/errors/errors");
|
|
8
7
|
const ulid_1 = require("../../shared/ulid");
|
|
9
8
|
const ttl_1 = require("../../shared/validation/ttl");
|
|
10
9
|
const configurable_1 = require("../internal/configurable");
|
|
11
10
|
const item_writer_1 = require("../internal/item-writer");
|
|
11
|
+
const regular_write_1 = require("../internal/regular-write");
|
|
12
12
|
const special_write_cleanup_1 = require("../internal/special-write-cleanup");
|
|
13
13
|
const validation_1 = require("../internal/validation");
|
|
14
|
-
const write_guard_1 = require("../internal/write-guard");
|
|
15
14
|
/**
|
|
16
15
|
* Stamps each `putWrites` call, serving two purposes at once. It nonces every
|
|
17
16
|
* S3 upload, so a repeated write never shares an object with an earlier
|
|
@@ -28,46 +27,21 @@ async function cleanUpItems(context, items) {
|
|
|
28
27
|
return;
|
|
29
28
|
await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)(items.map((item) => item.value)), 'putWrites', context.logger);
|
|
30
29
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Write regular items with a first-write-wins guard. Every `PutCommand` fully
|
|
33
|
-
* settles (`Promise.allSettled`) before this resolves and never rejects; a
|
|
34
|
-
* genuine failure is reported via `error`, not thrown.
|
|
35
|
-
*/
|
|
36
|
-
async function writeRegularItems(context, items) {
|
|
37
|
-
const failed = [];
|
|
38
|
-
let error;
|
|
39
|
-
const results = await Promise.allSettled(items.map((item) => (0, retry_1.withDynamoDBRetry)(() => context.client.put({
|
|
40
|
-
TableName: context.tableName,
|
|
41
|
-
Item: item,
|
|
42
|
-
ConditionExpression: 'attribute_not_exists(PK)',
|
|
43
|
-
ReturnValuesOnConditionCheckFailure: 'ALL_OLD',
|
|
44
|
-
}))));
|
|
45
|
-
results.forEach((result, index) => {
|
|
46
|
-
if (result.status === 'fulfilled')
|
|
47
|
-
return;
|
|
48
|
-
const reason = result.reason;
|
|
49
|
-
if ((0, write_guard_1.isConditionalCheckFailed)(reason)) {
|
|
50
|
-
(0, write_guard_1.reportGuardRejection)(context, items[index], reason);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
failed.push(items[index]);
|
|
54
|
-
error = error ?? reason;
|
|
55
|
-
});
|
|
56
|
-
return { failed, error };
|
|
57
|
-
}
|
|
58
30
|
/**
|
|
59
31
|
* Persist a task's intermediate writes for a checkpoint as one item per write.
|
|
60
32
|
* Requires `checkpoint_id` in the config — writes always attach to a checkpoint.
|
|
61
33
|
* Regular writes are first-write-wins (matching the reference checkpointer
|
|
62
34
|
* contract); special negative-index writes always overwrite (see
|
|
63
|
-
* {@link writeSpecialItemsWithCleanup}). Regular-write
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* but a live row can never be
|
|
35
|
+
* {@link writeSpecialItemsWithCleanup}). Regular-write cleanup only ever
|
|
36
|
+
* targets uploads confirmed unreferenced (see {@link writeRegularItems}): a
|
|
37
|
+
* verified non-commit, or a guard rejection whose returned row provably
|
|
38
|
+
* belongs to another call. An upload can leak but a live row can never be
|
|
39
|
+
* stranded pointing at a deleted object.
|
|
67
40
|
*/
|
|
68
41
|
async function putWrites(context, config, writes, taskId) {
|
|
69
42
|
(0, validation_1.validateTaskId)(taskId);
|
|
70
43
|
const { threadId, checkpointNs, checkpointId } = (0, configurable_1.readConfigurable)(config);
|
|
44
|
+
const signal = config.signal;
|
|
71
45
|
if (checkpointId === undefined) {
|
|
72
46
|
throw new errors_1.ValidationError('checkpoint_id is required to store writes', 'checkpoint_id');
|
|
73
47
|
}
|
|
@@ -78,13 +52,11 @@ async function putWrites(context, config, writes, taskId) {
|
|
|
78
52
|
const special = items.filter((item) => item.index < 0);
|
|
79
53
|
const regular = items.filter((item) => item.index >= 0);
|
|
80
54
|
const [specialError, regularOutcome] = await Promise.all([
|
|
81
|
-
(0, special_write_cleanup_1.writeSpecialItemsWithCleanup)(context, special),
|
|
82
|
-
writeRegularItems(context, regular),
|
|
55
|
+
(0, special_write_cleanup_1.writeSpecialItemsWithCleanup)(context, threadId, special, signal),
|
|
56
|
+
(0, regular_write_1.writeRegularItems)(context, regular, signal),
|
|
83
57
|
]);
|
|
58
|
+
await cleanUpItems(context, regularOutcome.deadUploads);
|
|
84
59
|
const firstError = specialError ?? regularOutcome.error;
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
await cleanUpItems(context, regularOutcome.failed);
|
|
88
|
-
throw firstError;
|
|
60
|
+
if (firstError)
|
|
61
|
+
throw firstError;
|
|
89
62
|
}
|
|
90
|
-
//# sourceMappingURL=put-writes.js.map
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
-
import type { Checkpoint, CheckpointMetadata } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import type { ChannelVersions, Checkpoint, CheckpointMetadata } from '@langchain/langgraph-checkpoint';
|
|
3
3
|
import type { CheckpointerContext } from '../internal/setup';
|
|
4
4
|
/**
|
|
5
5
|
* Persist a checkpoint and its metadata as a transactional pair of META and
|
|
6
6
|
* PAYLOAD items, returning the config that addresses the stored checkpoint. The
|
|
7
7
|
* incoming `checkpoint_id` (if any) becomes the new checkpoint's parent.
|
|
8
|
+
* `newVersions` names the channels that changed in this step: only those and
|
|
9
|
+
* the ones the parent stored are persisted (see `storedChannelsFor`).
|
|
10
|
+
*
|
|
11
|
+
* On failure with S3 offload configured, the rows are read back before any
|
|
12
|
+
* upload is deleted (see {@link verifyCheckpointLanded}): a transaction that
|
|
13
|
+
* committed and lost its response is reported as success, a confirmed
|
|
14
|
+
* non-commit cleans up this call's own nonced uploads, and an unverifiable
|
|
15
|
+
* outcome leaks them rather than risk stranding a live row.
|
|
8
16
|
*/
|
|
9
|
-
export declare function putCheckpoint(context: CheckpointerContext, config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;
|
|
10
|
-
//# sourceMappingURL=put.d.ts.map
|
|
17
|
+
export declare function putCheckpoint(context: CheckpointerContext, config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, newVersions?: ChannelVersions): Promise<RunnableConfig>;
|
|
@@ -4,40 +4,70 @@ exports.putCheckpoint = putCheckpoint;
|
|
|
4
4
|
const descriptor_keys_1 = require("../../shared/codec/descriptor-keys");
|
|
5
5
|
const orphans_1 = require("../../shared/codec/s3/orphans");
|
|
6
6
|
const retry_1 = require("../../shared/dynamodb/retry");
|
|
7
|
+
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
8
|
+
const ulid_1 = require("../../shared/ulid");
|
|
7
9
|
const ttl_1 = require("../../shared/validation/ttl");
|
|
10
|
+
const checkpoint_write_verify_1 = require("../internal/checkpoint-write-verify");
|
|
8
11
|
const configurable_1 = require("../internal/configurable");
|
|
9
12
|
const item_writer_1 = require("../internal/item-writer");
|
|
13
|
+
const stored_channels_1 = require("../internal/stored-channels");
|
|
10
14
|
const validation_1 = require("../internal/validation");
|
|
15
|
+
/**
|
|
16
|
+
* Nonces every put's S3 uploads (see {@link buildCheckpointItems}). A ULID
|
|
17
|
+
* rather than a UUID because it sorts by time, which keeps a bucket listing of
|
|
18
|
+
* one checkpoint's objects readable.
|
|
19
|
+
*/
|
|
20
|
+
const nextPutNonce = (0, ulid_1.createUlidFactory)();
|
|
11
21
|
/**
|
|
12
22
|
* Persist a checkpoint and its metadata as a transactional pair of META and
|
|
13
23
|
* PAYLOAD items, returning the config that addresses the stored checkpoint. The
|
|
14
24
|
* incoming `checkpoint_id` (if any) becomes the new checkpoint's parent.
|
|
25
|
+
* `newVersions` names the channels that changed in this step: only those and
|
|
26
|
+
* the ones the parent stored are persisted (see `storedChannelsFor`).
|
|
27
|
+
*
|
|
28
|
+
* On failure with S3 offload configured, the rows are read back before any
|
|
29
|
+
* upload is deleted (see {@link verifyCheckpointLanded}): a transaction that
|
|
30
|
+
* committed and lost its response is reported as success, a confirmed
|
|
31
|
+
* non-commit cleans up this call's own nonced uploads, and an unverifiable
|
|
32
|
+
* outcome leaks them rather than risk stranding a live row.
|
|
15
33
|
*/
|
|
16
|
-
async function putCheckpoint(context, config, checkpoint, metadata) {
|
|
34
|
+
async function putCheckpoint(context, config, checkpoint, metadata, newVersions) {
|
|
17
35
|
const { threadId, checkpointNs, checkpointId: parentCheckpointId } = (0, configurable_1.readConfigurable)(config);
|
|
36
|
+
const signal = config.signal;
|
|
18
37
|
(0, validation_1.validateCheckpointId)(checkpoint.id);
|
|
19
38
|
const ttlTimestamp = context.ttl ? (0, ttl_1.calculateTtlTimestamp)(context.ttl) : undefined;
|
|
20
|
-
const
|
|
39
|
+
const storedChannels = await (0, stored_channels_1.storedChannelsFor)(context, threadId, checkpointNs, checkpoint, newVersions, parentCheckpointId, signal);
|
|
40
|
+
const { meta, payload } = await (0, item_writer_1.buildCheckpointItems)(context, threadId, checkpointNs, checkpoint, metadata, nextPutNonce(), parentCheckpointId, ttlTimestamp, storedChannels);
|
|
41
|
+
const stored = {
|
|
42
|
+
configurable: {
|
|
43
|
+
thread_id: threadId,
|
|
44
|
+
checkpoint_ns: checkpointNs,
|
|
45
|
+
checkpoint_id: checkpoint.id,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
21
48
|
try {
|
|
22
49
|
await (0, retry_1.withDynamoDBRetry)(() => context.client.transactWrite({
|
|
23
50
|
TransactItems: [
|
|
24
51
|
{ Put: { TableName: context.tableName, Item: meta } },
|
|
25
52
|
{ Put: { TableName: context.tableName, Item: payload } },
|
|
26
53
|
],
|
|
27
|
-
}));
|
|
54
|
+
}), (0, retry_policy_1.retryFor)(context, signal));
|
|
28
55
|
}
|
|
29
56
|
catch (error) {
|
|
30
|
-
if (context.offloader)
|
|
57
|
+
if (!context.offloader)
|
|
58
|
+
throw error;
|
|
59
|
+
const verdict = await (0, checkpoint_write_verify_1.verifyCheckpointLanded)(context, meta, payload);
|
|
60
|
+
if (verdict === 'landed') {
|
|
61
|
+
context.logger.debug('put: transaction committed although its response was lost', {
|
|
62
|
+
threadId,
|
|
63
|
+
checkpointId: checkpoint.id,
|
|
64
|
+
});
|
|
65
|
+
return stored;
|
|
66
|
+
}
|
|
67
|
+
if (verdict === 'not-landed') {
|
|
31
68
|
await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)([meta.metadata, payload.checkpoint]), 'put', context.logger);
|
|
32
69
|
}
|
|
33
70
|
throw error;
|
|
34
71
|
}
|
|
35
|
-
return
|
|
36
|
-
configurable: {
|
|
37
|
-
thread_id: threadId,
|
|
38
|
-
checkpoint_ns: checkpointNs,
|
|
39
|
-
checkpoint_id: checkpoint.id,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
72
|
+
return stored;
|
|
42
73
|
}
|
|
43
|
-
//# sourceMappingURL=put.js.map
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type { CheckpointTuple } from '@langchain/langgraph-checkpoint';
|
|
1
|
+
import type { CheckpointMetadata, CheckpointTuple } from '@langchain/langgraph-checkpoint';
|
|
2
2
|
import type { CheckpointMetaItem } from '../types';
|
|
3
3
|
import type { CheckpointerContext } from './setup';
|
|
4
|
+
/** How a tuple is assembled: cancellation, read consistency, and metadata already decoded by the caller. */
|
|
5
|
+
export interface AssembleOptions {
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
/** `true` for `getTuple` (read-your-writes), `false` for the eventually-consistent `list` path. */
|
|
8
|
+
consistent: boolean;
|
|
9
|
+
/** Metadata the caller decoded to apply a filter, so it is not decoded (or downloaded) twice. */
|
|
10
|
+
metadata?: CheckpointMetadata;
|
|
11
|
+
}
|
|
4
12
|
/**
|
|
5
13
|
* Assemble a full {@link CheckpointTuple} from a META item: fetch and decode its
|
|
6
14
|
* payload, metadata, and pending writes, attaching a parent config when present.
|
|
7
15
|
* Returns undefined when the payload item is missing (inconsistent state).
|
|
8
16
|
*/
|
|
9
|
-
export declare function assembleTuple(context: CheckpointerContext, threadId: string, checkpointNs: string, meta: CheckpointMetaItem): Promise<CheckpointTuple | undefined>;
|
|
10
|
-
//# sourceMappingURL=assemble.d.ts.map
|
|
17
|
+
export declare function assembleTuple(context: CheckpointerContext, threadId: string, checkpointNs: string, meta: CheckpointMetaItem, options: AssembleOptions): Promise<CheckpointTuple | undefined>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assembleTuple = assembleTuple;
|
|
4
4
|
const fetch_1 = require("./fetch");
|
|
5
5
|
const item_reader_1 = require("./item-reader");
|
|
6
|
+
const pending_sends_1 = require("./pending-sends");
|
|
6
7
|
/** Build a config that addresses a specific checkpoint. */
|
|
7
8
|
function configFor(threadId, checkpointNs, checkpointId) {
|
|
8
9
|
return {
|
|
@@ -14,14 +15,15 @@ function configFor(threadId, checkpointNs, checkpointId) {
|
|
|
14
15
|
* payload, metadata, and pending writes, attaching a parent config when present.
|
|
15
16
|
* Returns undefined when the payload item is missing (inconsistent state).
|
|
16
17
|
*/
|
|
17
|
-
async function assembleTuple(context, threadId, checkpointNs, meta) {
|
|
18
|
-
const
|
|
18
|
+
async function assembleTuple(context, threadId, checkpointNs, meta, options) {
|
|
19
|
+
const read = { signal: options.signal, consistent: options.consistent };
|
|
20
|
+
const payload = await (0, fetch_1.fetchPayload)(context, threadId, checkpointNs, meta.checkpointId, read);
|
|
19
21
|
if (!payload)
|
|
20
22
|
return undefined;
|
|
21
23
|
const [checkpoint, metadata, pendingWrites] = await Promise.all([
|
|
22
|
-
(0, item_reader_1.readCheckpoint)(context, payload),
|
|
23
|
-
(0, item_reader_1.readMetadata)(context, meta),
|
|
24
|
-
(0, fetch_1.fetchPendingWrites)(context, threadId, checkpointNs, meta.checkpointId),
|
|
24
|
+
(0, item_reader_1.readCheckpoint)(context, payload, threadId).then((stored) => (0, pending_sends_1.migratePendingSends)(context, stored, threadId, checkpointNs, meta.parentCheckpointId, read)),
|
|
25
|
+
options.metadata ?? (0, item_reader_1.readMetadata)(context, meta, threadId),
|
|
26
|
+
(0, fetch_1.fetchPendingWrites)(context, threadId, checkpointNs, meta.checkpointId, read),
|
|
25
27
|
]);
|
|
26
28
|
const tuple = {
|
|
27
29
|
config: configFor(threadId, checkpointNs, meta.checkpointId),
|
|
@@ -34,4 +36,3 @@ async function assembleTuple(context, threadId, checkpointNs, meta) {
|
|
|
34
36
|
}
|
|
35
37
|
return tuple;
|
|
36
38
|
}
|
|
37
|
-
//# sourceMappingURL=assemble.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CheckpointMetaItem, CheckpointPayloadItem } from '../types';
|
|
2
|
+
import type { CheckpointerContext } from './setup';
|
|
3
|
+
/** What a post-failure verification read could establish about a put. */
|
|
4
|
+
export type CheckpointWriteVerdict = 'landed' | 'not-landed' | 'unverified';
|
|
5
|
+
/**
|
|
6
|
+
* Read one of the two rows back after the META+PAYLOAD transaction failed and
|
|
7
|
+
* report what that failure actually did — never assuming it did nothing.
|
|
8
|
+
*
|
|
9
|
+
* No rejection is proof of a non-commit: `withDynamoDBRetry` re-issues a
|
|
10
|
+
* transaction whose response was lost, and the re-issues can time out at the
|
|
11
|
+
* transport without reaching DynamoDB, so the budget is spent on a
|
|
12
|
+
* `RetryExhaustedError` while the rows are committed. Deleting the uploads on
|
|
13
|
+
* that basis stranded the head checkpoint of a thread on a `NoSuchKey`.
|
|
14
|
+
*
|
|
15
|
+
* Keys are nonced per call (see `buildCheckpointItems`), so "the row holds
|
|
16
|
+
* this attempt's key" is the same statement as "this attempt's write is
|
|
17
|
+
* live". When neither descriptor is offloaded there is nothing to delete, so
|
|
18
|
+
* the answer is simply "safe to clean up", a no-op for the caller.
|
|
19
|
+
*
|
|
20
|
+
* A read failure establishes nothing; the caller then leaks one object at
|
|
21
|
+
* worst (reclaimed by `ensureS3LifecycleRule`) rather than deleting one a live
|
|
22
|
+
* row may point at — the same trade `store/internal/persist.ts` makes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function verifyCheckpointLanded(context: CheckpointerContext, meta: CheckpointMetaItem, payload: CheckpointPayloadItem): Promise<CheckpointWriteVerdict>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyCheckpointLanded = verifyCheckpointLanded;
|
|
4
|
+
const codec_1 = require("../../shared/codec/codec");
|
|
5
|
+
const retry_1 = require("../../shared/dynamodb/retry");
|
|
6
|
+
/** The S3 key an offloaded descriptor points at, or undefined for inline/absent. */
|
|
7
|
+
function offloadedKey(descriptor) {
|
|
8
|
+
return descriptor?.location === codec_1.PayloadLocation.S3 ? descriptor.s3Key : undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Pick the row carrying an offloaded descriptor. The META and PAYLOAD rows
|
|
12
|
+
* commit in one transaction, so one of them is enough; with neither offloaded
|
|
13
|
+
* there is nothing to protect and no read to spend.
|
|
14
|
+
*/
|
|
15
|
+
function chooseProbe(meta, payload) {
|
|
16
|
+
const metaKey = offloadedKey(meta.metadata);
|
|
17
|
+
if (metaKey !== undefined) {
|
|
18
|
+
return { key: { PK: meta.PK, SK: meta.SK }, attribute: 'metadata', expected: metaKey };
|
|
19
|
+
}
|
|
20
|
+
const payloadKey = offloadedKey(payload.checkpoint);
|
|
21
|
+
if (payloadKey !== undefined) {
|
|
22
|
+
return {
|
|
23
|
+
key: { PK: payload.PK, SK: payload.SK },
|
|
24
|
+
attribute: 'checkpoint',
|
|
25
|
+
expected: payloadKey,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Read one of the two rows back after the META+PAYLOAD transaction failed and
|
|
32
|
+
* report what that failure actually did — never assuming it did nothing.
|
|
33
|
+
*
|
|
34
|
+
* No rejection is proof of a non-commit: `withDynamoDBRetry` re-issues a
|
|
35
|
+
* transaction whose response was lost, and the re-issues can time out at the
|
|
36
|
+
* transport without reaching DynamoDB, so the budget is spent on a
|
|
37
|
+
* `RetryExhaustedError` while the rows are committed. Deleting the uploads on
|
|
38
|
+
* that basis stranded the head checkpoint of a thread on a `NoSuchKey`.
|
|
39
|
+
*
|
|
40
|
+
* Keys are nonced per call (see `buildCheckpointItems`), so "the row holds
|
|
41
|
+
* this attempt's key" is the same statement as "this attempt's write is
|
|
42
|
+
* live". When neither descriptor is offloaded there is nothing to delete, so
|
|
43
|
+
* the answer is simply "safe to clean up", a no-op for the caller.
|
|
44
|
+
*
|
|
45
|
+
* A read failure establishes nothing; the caller then leaks one object at
|
|
46
|
+
* worst (reclaimed by `ensureS3LifecycleRule`) rather than deleting one a live
|
|
47
|
+
* row may point at — the same trade `store/internal/persist.ts` makes.
|
|
48
|
+
*/
|
|
49
|
+
async function verifyCheckpointLanded(context, meta, payload) {
|
|
50
|
+
const probe = chooseProbe(meta, payload);
|
|
51
|
+
if (!probe)
|
|
52
|
+
return 'not-landed';
|
|
53
|
+
try {
|
|
54
|
+
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
55
|
+
TableName: context.tableName,
|
|
56
|
+
Key: probe.key,
|
|
57
|
+
ConsistentRead: true,
|
|
58
|
+
ProjectionExpression: '#d',
|
|
59
|
+
ExpressionAttributeNames: { '#d': probe.attribute },
|
|
60
|
+
}), context.retry);
|
|
61
|
+
const stored = result.Item?.[probe.attribute];
|
|
62
|
+
return offloadedKey(stored) === probe.expected ? 'landed' : 'not-landed';
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return 'unverified';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -11,13 +11,14 @@ function readConfigurable(config) {
|
|
|
11
11
|
(0, validation_1.validateThreadId)(configurable.thread_id);
|
|
12
12
|
const checkpointNs = configurable.checkpoint_ns ?? '';
|
|
13
13
|
(0, validation_1.validateCheckpointNs)(checkpointNs);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `null`, `''` and the legacy `thread_ts` alias resolve the way the reference's
|
|
16
|
+
* `getCheckpointId` does: a falsy id addresses the latest checkpoint rather
|
|
17
|
+
* than failing a config that was built from JSON or ported from another saver.
|
|
18
|
+
*/
|
|
19
|
+
const rawId = configurable.checkpoint_id ?? configurable.thread_ts;
|
|
20
|
+
const checkpointId = rawId ? rawId : undefined;
|
|
21
|
+
if (checkpointId !== undefined)
|
|
22
|
+
(0, validation_1.validateCheckpointId)(checkpointId);
|
|
23
|
+
return { threadId: configurable.thread_id, checkpointNs, checkpointId };
|
|
22
24
|
}
|
|
23
|
-
//# sourceMappingURL=configurable.js.map
|