@farukada/aws-langgraph-dynamodb-ts 1.0.0-rc.1 → 1.0.0
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 +1820 -290
- package/dist/cjs/backfill/backfill.d.ts +171 -0
- package/dist/cjs/backfill/backfill.js +177 -0
- package/dist/cjs/checkpointer/actions/delete-thread.d.ts +50 -0
- package/dist/cjs/checkpointer/actions/delete-thread.js +26 -0
- package/dist/cjs/checkpointer/actions/get-tuple.d.ts +36 -0
- package/dist/cjs/checkpointer/actions/get-tuple.js +22 -0
- package/dist/cjs/checkpointer/actions/list.d.ts +55 -0
- package/dist/cjs/checkpointer/actions/list.js +70 -0
- package/dist/cjs/checkpointer/actions/put-writes.d.ts +49 -0
- package/dist/cjs/checkpointer/actions/put-writes.js +21 -0
- package/dist/cjs/checkpointer/actions/put.d.ts +95 -0
- package/dist/cjs/checkpointer/actions/put.js +79 -0
- package/dist/cjs/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/cjs/checkpointer/internal/delta-history.js +131 -0
- package/dist/cjs/checkpointer/internal/listing.d.ts +149 -0
- package/dist/cjs/checkpointer/internal/listing.js +104 -0
- package/dist/cjs/checkpointer/internal/parse.d.ts +298 -0
- package/dist/cjs/checkpointer/internal/parse.js +184 -0
- package/dist/cjs/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/cjs/checkpointer/internal/pending-writes.js +241 -0
- package/dist/cjs/checkpointer/internal/read.d.ts +135 -0
- package/dist/cjs/checkpointer/internal/read.js +132 -0
- package/dist/cjs/checkpointer/internal/rows.d.ts +644 -0
- package/dist/cjs/checkpointer/internal/rows.js +356 -0
- package/dist/cjs/checkpointer/internal/setup.d.ts +47 -0
- package/dist/cjs/checkpointer/internal/setup.js +25 -0
- package/dist/cjs/checkpointer/saver.d.ts +306 -0
- package/dist/cjs/checkpointer/saver.js +56 -0
- package/dist/cjs/checkpointer/types.d.ts +51 -0
- package/dist/cjs/factory/factory.d.ts +154 -0
- package/dist/cjs/factory/factory.js +137 -0
- package/dist/{factory → cjs/factory}/types.d.ts +33 -14
- package/dist/cjs/history/actions/add-messages.d.ts +51 -0
- package/dist/cjs/history/actions/add-messages.js +17 -0
- package/dist/cjs/history/actions/clear.d.ts +52 -0
- package/dist/cjs/history/actions/clear.js +29 -0
- package/dist/cjs/history/actions/get-messages.d.ts +60 -0
- package/dist/cjs/history/actions/get-messages.js +58 -0
- package/dist/cjs/history/actions/list-sessions.d.ts +55 -0
- package/dist/cjs/history/actions/list-sessions.js +67 -0
- package/dist/cjs/history/actions/reconcile-count.d.ts +49 -0
- package/dist/cjs/history/actions/reconcile-count.js +8 -0
- package/dist/cjs/history/chat-message-history.d.ts +267 -0
- package/dist/cjs/history/chat-message-history.js +61 -0
- package/dist/cjs/history/internal/append.d.ts +244 -0
- package/dist/cjs/history/internal/append.js +267 -0
- package/dist/cjs/history/internal/message-read.d.ts +84 -0
- package/dist/cjs/history/internal/message-read.js +93 -0
- package/dist/cjs/history/internal/parse.d.ts +153 -0
- package/dist/cjs/history/internal/parse.js +113 -0
- package/dist/cjs/history/internal/rows.d.ts +196 -0
- package/dist/cjs/history/internal/rows.js +96 -0
- package/dist/cjs/history/internal/session.d.ts +350 -0
- package/dist/cjs/history/internal/session.js +296 -0
- package/dist/cjs/history/internal/setup.d.ts +64 -0
- package/dist/cjs/history/internal/setup.js +60 -0
- package/dist/cjs/history/session-adapter.d.ts +112 -0
- package/dist/cjs/history/session-adapter.js +38 -0
- package/dist/cjs/history/types.d.ts +102 -0
- package/dist/cjs/index.d.ts +53 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/shared/adapter.d.ts +146 -0
- package/dist/cjs/shared/adapter.js +70 -0
- package/dist/cjs/shared/clock.d.ts +52 -0
- package/dist/cjs/shared/clock.js +14 -0
- package/dist/cjs/shared/codec/codec.d.ts +336 -0
- package/dist/cjs/shared/codec/codec.js +162 -0
- package/dist/cjs/shared/codec/compression.d.ts +66 -0
- package/dist/cjs/shared/codec/compression.js +45 -0
- package/dist/cjs/shared/codec/json-serde.d.ts +80 -0
- package/dist/cjs/shared/codec/json-serde.js +58 -0
- package/dist/{shared → cjs/shared}/codec/s3/client-types.d.ts +22 -2
- package/dist/{shared → cjs/shared}/codec/s3/client-types.js +0 -1
- package/dist/cjs/shared/codec/s3/client.d.ts +63 -0
- package/dist/cjs/shared/codec/s3/client.js +78 -0
- package/dist/cjs/shared/codec/s3/config.d.ts +260 -0
- package/dist/cjs/shared/codec/s3/config.js +92 -0
- package/dist/cjs/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/cjs/shared/codec/s3/lifecycle.js +223 -0
- package/dist/cjs/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/cjs/shared/codec/s3/offloader.js +289 -0
- package/dist/cjs/shared/concurrency.d.ts +43 -0
- package/dist/{shared → cjs/shared}/concurrency.js +10 -9
- package/dist/cjs/shared/dynamodb/abort.d.ts +47 -0
- package/dist/cjs/shared/dynamodb/abort.js +16 -0
- package/dist/cjs/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/cjs/shared/dynamodb/batch-write.js +79 -0
- package/dist/cjs/shared/dynamodb/cancellation.d.ts +124 -0
- package/dist/cjs/shared/dynamodb/cancellation.js +37 -0
- package/dist/cjs/shared/dynamodb/client.d.ts +177 -0
- package/dist/{shared → cjs/shared}/dynamodb/client.js +12 -14
- package/dist/cjs/shared/dynamodb/idempotent-write.d.ts +596 -0
- package/dist/cjs/shared/dynamodb/idempotent-write.js +173 -0
- package/dist/cjs/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/cjs/shared/dynamodb/paginate.js +90 -0
- package/dist/cjs/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/cjs/shared/dynamodb/partition-delete.js +177 -0
- package/dist/cjs/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/cjs/shared/dynamodb/recency-index.js +146 -0
- package/dist/cjs/shared/dynamodb/retry.d.ts +317 -0
- package/dist/cjs/shared/dynamodb/retry.js +193 -0
- package/dist/cjs/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/cjs/shared/dynamodb/row-size.js +30 -0
- package/dist/cjs/shared/dynamodb/table-schema.d.ts +199 -0
- package/dist/cjs/shared/dynamodb/table-schema.js +52 -0
- package/dist/cjs/shared/errors/base-error.d.ts +231 -0
- package/dist/cjs/shared/errors/base-error.js +73 -0
- package/dist/cjs/shared/errors/boundary.d.ts +86 -0
- package/dist/cjs/shared/errors/boundary.js +61 -0
- package/dist/cjs/shared/errors/classify.d.ts +206 -0
- package/dist/cjs/shared/errors/classify.js +232 -0
- package/dist/cjs/shared/errors/error-code.d.ts +95 -0
- package/dist/{shared → cjs/shared}/errors/error-code.js +12 -2
- package/dist/cjs/shared/errors/errors.d.ts +233 -0
- package/dist/cjs/shared/errors/errors.js +123 -0
- package/dist/cjs/shared/logging/logger.d.ts +80 -0
- package/dist/cjs/shared/logging/logger.js +30 -0
- package/dist/cjs/shared/logging/redaction.d.ts +123 -0
- package/dist/cjs/shared/logging/redaction.js +145 -0
- package/dist/cjs/shared/logging/secret-patterns.d.ts +227 -0
- package/dist/cjs/shared/logging/secret-patterns.js +93 -0
- package/dist/cjs/shared/logging/truncate.d.ts +197 -0
- package/dist/cjs/shared/logging/truncate.js +31 -0
- package/dist/cjs/shared/options.d.ts +100 -0
- package/dist/cjs/shared/ulid.d.ts +80 -0
- package/dist/{shared → cjs/shared}/ulid.js +7 -21
- package/dist/cjs/shared/validation/collaborators.d.ts +160 -0
- package/dist/cjs/shared/validation/collaborators.js +79 -0
- package/dist/cjs/shared/validation/option-shape.d.ts +91 -0
- package/dist/cjs/shared/validation/option-shape.js +31 -0
- package/dist/cjs/shared/validation/options.d.ts +145 -0
- package/dist/cjs/shared/validation/options.js +166 -0
- package/dist/cjs/shared/validation/primitives.d.ts +292 -0
- package/dist/cjs/shared/validation/primitives.js +114 -0
- package/dist/cjs/shared/validation/ttl.d.ts +94 -0
- package/dist/cjs/shared/validation/ttl.js +52 -0
- package/dist/cjs/store/actions/list-namespaces.d.ts +79 -0
- package/dist/cjs/store/actions/list-namespaces.js +92 -0
- package/dist/cjs/store/actions/put.d.ts +43 -0
- package/dist/cjs/store/actions/put.js +49 -0
- package/dist/cjs/store/actions/reconcile-vector-index.d.ts +38 -0
- package/dist/cjs/store/actions/reconcile-vector-index.js +13 -0
- package/dist/cjs/store/actions/search.d.ts +38 -0
- package/dist/cjs/store/actions/search.js +26 -0
- package/dist/cjs/store/internal/batch-plan.d.ts +56 -0
- package/dist/cjs/store/internal/batch-plan.js +32 -0
- package/dist/cjs/store/internal/filter.d.ts +43 -0
- package/dist/cjs/store/internal/filter.js +64 -0
- package/dist/cjs/store/internal/get-item.d.ts +77 -0
- package/dist/cjs/store/internal/get-item.js +58 -0
- package/dist/cjs/store/internal/item-write.d.ts +270 -0
- package/dist/cjs/store/internal/item-write.js +181 -0
- package/dist/cjs/store/internal/parse.d.ts +230 -0
- package/dist/cjs/store/internal/parse.js +180 -0
- package/dist/cjs/store/internal/rows.d.ts +359 -0
- package/dist/cjs/store/internal/rows.js +166 -0
- package/dist/cjs/store/internal/semantic-search.d.ts +168 -0
- package/dist/{store/internal/text-path.js → cjs/store/internal/semantic-search.js} +92 -28
- package/dist/cjs/store/internal/setup.d.ts +96 -0
- package/dist/cjs/store/internal/setup.js +103 -0
- package/dist/cjs/store/internal/table-search.d.ts +100 -0
- package/dist/cjs/store/internal/table-search.js +123 -0
- package/dist/cjs/store/internal/vector-index.d.ts +258 -0
- package/dist/cjs/store/internal/vector-index.js +269 -0
- package/dist/cjs/store/store.d.ts +329 -0
- package/dist/cjs/store/store.js +97 -0
- package/dist/cjs/store/types.d.ts +111 -0
- package/dist/cjs/store/vector-backend.d.ts +104 -0
- package/dist/cjs/store/vector-backend.js +4 -0
- package/dist/esm/backfill/backfill.d.ts +171 -0
- package/dist/esm/backfill/backfill.js +170 -0
- package/dist/esm/checkpointer/actions/delete-thread.d.ts +50 -0
- package/dist/esm/checkpointer/actions/delete-thread.js +23 -0
- package/dist/esm/checkpointer/actions/get-tuple.d.ts +36 -0
- package/dist/esm/checkpointer/actions/get-tuple.js +19 -0
- package/dist/esm/checkpointer/actions/list.d.ts +55 -0
- package/dist/esm/checkpointer/actions/list.js +67 -0
- package/dist/esm/checkpointer/actions/put-writes.d.ts +49 -0
- package/dist/esm/checkpointer/actions/put-writes.js +18 -0
- package/dist/esm/checkpointer/actions/put.d.ts +95 -0
- package/dist/esm/checkpointer/actions/put.js +75 -0
- package/dist/esm/checkpointer/internal/delta-history.d.ts +124 -0
- package/dist/esm/checkpointer/internal/delta-history.js +126 -0
- package/dist/esm/checkpointer/internal/listing.d.ts +149 -0
- package/dist/esm/checkpointer/internal/listing.js +95 -0
- package/dist/esm/checkpointer/internal/parse.d.ts +298 -0
- package/dist/esm/checkpointer/internal/parse.js +169 -0
- package/dist/esm/checkpointer/internal/pending-writes.d.ts +314 -0
- package/dist/esm/checkpointer/internal/pending-writes.js +229 -0
- package/dist/esm/checkpointer/internal/read.d.ts +135 -0
- package/dist/esm/checkpointer/internal/read.js +125 -0
- package/dist/esm/checkpointer/internal/rows.d.ts +644 -0
- package/dist/esm/checkpointer/internal/rows.js +323 -0
- package/dist/esm/checkpointer/internal/setup.d.ts +47 -0
- package/dist/esm/checkpointer/internal/setup.js +21 -0
- package/dist/esm/checkpointer/saver.d.ts +306 -0
- package/dist/esm/checkpointer/saver.js +52 -0
- package/dist/esm/checkpointer/types.d.ts +51 -0
- package/dist/esm/checkpointer/types.js +1 -0
- package/dist/esm/factory/factory.d.ts +154 -0
- package/dist/esm/factory/factory.js +133 -0
- package/dist/esm/factory/types.d.ts +76 -0
- package/dist/esm/factory/types.js +1 -0
- package/dist/esm/history/actions/add-messages.d.ts +51 -0
- package/dist/esm/history/actions/add-messages.js +14 -0
- package/dist/esm/history/actions/clear.d.ts +52 -0
- package/dist/esm/history/actions/clear.js +26 -0
- package/dist/esm/history/actions/get-messages.d.ts +60 -0
- package/dist/esm/history/actions/get-messages.js +55 -0
- package/dist/esm/history/actions/list-sessions.d.ts +55 -0
- package/dist/esm/history/actions/list-sessions.js +64 -0
- package/dist/esm/history/actions/reconcile-count.d.ts +49 -0
- package/dist/esm/history/actions/reconcile-count.js +5 -0
- package/dist/esm/history/chat-message-history.d.ts +267 -0
- package/dist/esm/history/chat-message-history.js +57 -0
- package/dist/esm/history/internal/append.d.ts +244 -0
- package/dist/esm/history/internal/append.js +259 -0
- package/dist/esm/history/internal/message-read.d.ts +84 -0
- package/dist/esm/history/internal/message-read.js +89 -0
- package/dist/esm/history/internal/parse.d.ts +153 -0
- package/dist/esm/history/internal/parse.js +105 -0
- package/dist/esm/history/internal/rows.d.ts +196 -0
- package/dist/esm/history/internal/rows.js +83 -0
- package/dist/esm/history/internal/session.d.ts +350 -0
- package/dist/esm/history/internal/session.js +285 -0
- package/dist/esm/history/internal/setup.d.ts +64 -0
- package/dist/esm/history/internal/setup.js +56 -0
- package/dist/esm/history/session-adapter.d.ts +112 -0
- package/dist/esm/history/session-adapter.js +34 -0
- package/dist/esm/history/types.d.ts +102 -0
- package/dist/esm/history/types.js +1 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/shared/adapter.d.ts +146 -0
- package/dist/esm/shared/adapter.js +65 -0
- package/dist/esm/shared/clock.d.ts +52 -0
- package/dist/esm/shared/clock.js +9 -0
- package/dist/esm/shared/codec/codec.d.ts +336 -0
- package/dist/esm/shared/codec/codec.js +150 -0
- package/dist/esm/shared/codec/compression.d.ts +66 -0
- package/dist/esm/shared/codec/compression.js +40 -0
- package/dist/esm/shared/codec/json-serde.d.ts +80 -0
- package/dist/esm/shared/codec/json-serde.js +54 -0
- package/dist/esm/shared/codec/s3/client-types.d.ts +54 -0
- package/dist/esm/shared/codec/s3/client-types.js +3 -0
- package/dist/esm/shared/codec/s3/client.d.ts +63 -0
- package/dist/esm/shared/codec/s3/client.js +40 -0
- package/dist/esm/shared/codec/s3/config.d.ts +260 -0
- package/dist/esm/shared/codec/s3/config.js +79 -0
- package/dist/esm/shared/codec/s3/lifecycle.d.ts +220 -0
- package/dist/esm/shared/codec/s3/lifecycle.js +214 -0
- package/dist/esm/shared/codec/s3/offloader.d.ts +428 -0
- package/dist/esm/shared/codec/s3/offloader.js +278 -0
- package/dist/esm/shared/concurrency.d.ts +43 -0
- package/dist/esm/shared/concurrency.js +27 -0
- package/dist/esm/shared/dynamodb/abort.d.ts +47 -0
- package/dist/esm/shared/dynamodb/abort.js +12 -0
- package/dist/esm/shared/dynamodb/batch-write.d.ts +86 -0
- package/dist/esm/shared/dynamodb/batch-write.js +74 -0
- package/dist/esm/shared/dynamodb/cancellation.d.ts +124 -0
- package/dist/esm/shared/dynamodb/cancellation.js +30 -0
- package/dist/esm/shared/dynamodb/client.d.ts +177 -0
- package/dist/esm/shared/dynamodb/client.js +35 -0
- package/dist/esm/shared/dynamodb/idempotent-write.d.ts +596 -0
- package/dist/esm/shared/dynamodb/idempotent-write.js +153 -0
- package/dist/esm/shared/dynamodb/paginate.d.ts +111 -0
- package/dist/esm/shared/dynamodb/paginate.js +84 -0
- package/dist/esm/shared/dynamodb/partition-delete.d.ts +204 -0
- package/dist/esm/shared/dynamodb/partition-delete.js +171 -0
- package/dist/esm/shared/dynamodb/recency-index.d.ts +243 -0
- package/dist/esm/shared/dynamodb/recency-index.js +136 -0
- package/dist/esm/shared/dynamodb/retry.d.ts +317 -0
- package/dist/esm/shared/dynamodb/retry.js +180 -0
- package/dist/esm/shared/dynamodb/row-size.d.ts +33 -0
- package/dist/esm/shared/dynamodb/row-size.js +26 -0
- package/dist/esm/shared/dynamodb/table-schema.d.ts +199 -0
- package/dist/esm/shared/dynamodb/table-schema.js +43 -0
- package/dist/esm/shared/errors/base-error.d.ts +231 -0
- package/dist/esm/shared/errors/base-error.js +64 -0
- package/dist/esm/shared/errors/boundary.d.ts +86 -0
- package/dist/esm/shared/errors/boundary.js +54 -0
- package/dist/esm/shared/errors/classify.d.ts +206 -0
- package/dist/esm/shared/errors/classify.js +220 -0
- package/dist/esm/shared/errors/error-code.d.ts +95 -0
- package/dist/esm/shared/errors/error-code.js +24 -0
- package/dist/esm/shared/errors/errors.d.ts +233 -0
- package/dist/esm/shared/errors/errors.js +110 -0
- package/dist/esm/shared/logging/logger.d.ts +80 -0
- package/dist/esm/shared/logging/logger.js +25 -0
- package/dist/esm/shared/logging/redaction.d.ts +123 -0
- package/dist/esm/shared/logging/redaction.js +140 -0
- package/dist/esm/shared/logging/secret-patterns.d.ts +227 -0
- package/dist/esm/shared/logging/secret-patterns.js +83 -0
- package/dist/esm/shared/logging/truncate.d.ts +197 -0
- package/dist/esm/shared/logging/truncate.js +25 -0
- package/dist/esm/shared/options.d.ts +100 -0
- package/dist/esm/shared/options.js +1 -0
- package/dist/esm/shared/ulid.d.ts +80 -0
- package/dist/esm/shared/ulid.js +77 -0
- package/dist/esm/shared/validation/collaborators.d.ts +160 -0
- package/dist/esm/shared/validation/collaborators.js +70 -0
- package/dist/esm/shared/validation/option-shape.d.ts +91 -0
- package/dist/esm/shared/validation/option-shape.js +24 -0
- package/dist/esm/shared/validation/options.d.ts +145 -0
- package/dist/esm/shared/validation/options.js +156 -0
- package/dist/esm/shared/validation/primitives.d.ts +292 -0
- package/dist/esm/shared/validation/primitives.js +100 -0
- package/dist/esm/shared/validation/ttl.d.ts +94 -0
- package/dist/esm/shared/validation/ttl.js +46 -0
- package/dist/esm/store/actions/list-namespaces.d.ts +79 -0
- package/dist/esm/store/actions/list-namespaces.js +86 -0
- package/dist/esm/store/actions/put.d.ts +43 -0
- package/dist/esm/store/actions/put.js +46 -0
- package/dist/esm/store/actions/reconcile-vector-index.d.ts +38 -0
- package/dist/esm/store/actions/reconcile-vector-index.js +10 -0
- package/dist/esm/store/actions/search.d.ts +38 -0
- package/dist/esm/store/actions/search.js +23 -0
- package/dist/esm/store/internal/batch-plan.d.ts +56 -0
- package/dist/esm/store/internal/batch-plan.js +28 -0
- package/dist/esm/store/internal/filter.d.ts +43 -0
- package/dist/esm/store/internal/filter.js +60 -0
- package/dist/esm/store/internal/get-item.d.ts +77 -0
- package/dist/esm/store/internal/get-item.js +54 -0
- package/dist/esm/store/internal/item-write.d.ts +270 -0
- package/dist/esm/store/internal/item-write.js +173 -0
- package/dist/esm/store/internal/parse.d.ts +230 -0
- package/dist/esm/store/internal/parse.js +169 -0
- package/dist/esm/store/internal/rows.d.ts +359 -0
- package/dist/esm/store/internal/rows.js +147 -0
- package/dist/esm/store/internal/semantic-search.d.ts +168 -0
- package/dist/esm/store/internal/semantic-search.js +200 -0
- package/dist/esm/store/internal/setup.d.ts +96 -0
- package/dist/esm/store/internal/setup.js +98 -0
- package/dist/esm/store/internal/table-search.d.ts +100 -0
- package/dist/esm/store/internal/table-search.js +119 -0
- package/dist/esm/store/internal/vector-index.d.ts +258 -0
- package/dist/esm/store/internal/vector-index.js +256 -0
- package/dist/esm/store/store.d.ts +329 -0
- package/dist/esm/store/store.js +93 -0
- package/dist/esm/store/types.d.ts +111 -0
- package/dist/esm/store/types.js +1 -0
- package/dist/esm/store/vector-backend.d.ts +104 -0
- package/dist/esm/store/vector-backend.js +1 -0
- package/package.json +68 -46
- package/dist/checkpointer/actions/delete-thread.d.ts +0 -10
- package/dist/checkpointer/actions/delete-thread.js +0 -38
- package/dist/checkpointer/actions/get-tuple.d.ts +0 -11
- package/dist/checkpointer/actions/get-tuple.js +0 -25
- package/dist/checkpointer/actions/list.d.ts +0 -20
- package/dist/checkpointer/actions/list.js +0 -113
- package/dist/checkpointer/actions/put-writes.d.ts +0 -15
- package/dist/checkpointer/actions/put-writes.js +0 -62
- package/dist/checkpointer/actions/put.d.ts +0 -17
- package/dist/checkpointer/actions/put.js +0 -73
- package/dist/checkpointer/internal/assemble.d.ts +0 -17
- package/dist/checkpointer/internal/assemble.js +0 -38
- package/dist/checkpointer/internal/checkpoint-write-verify.d.ts +0 -24
- package/dist/checkpointer/internal/checkpoint-write-verify.js +0 -67
- package/dist/checkpointer/internal/configurable.d.ts +0 -12
- package/dist/checkpointer/internal/configurable.js +0 -24
- package/dist/checkpointer/internal/fetch.d.ts +0 -19
- package/dist/checkpointer/internal/fetch.js +0 -88
- package/dist/checkpointer/internal/filter-match.d.ts +0 -13
- package/dist/checkpointer/internal/filter-match.js +0 -15
- package/dist/checkpointer/internal/item-reader.d.ts +0 -66
- package/dist/checkpointer/internal/item-reader.js +0 -113
- package/dist/checkpointer/internal/item-writer.d.ts +0 -35
- package/dist/checkpointer/internal/item-writer.js +0 -107
- package/dist/checkpointer/internal/keys.d.ts +0 -41
- package/dist/checkpointer/internal/keys.js +0 -117
- package/dist/checkpointer/internal/list-scope.d.ts +0 -61
- package/dist/checkpointer/internal/list-scope.js +0 -108
- package/dist/checkpointer/internal/pending-sends.d.ts +0 -13
- package/dist/checkpointer/internal/pending-sends.js +0 -29
- package/dist/checkpointer/internal/query.d.ts +0 -21
- package/dist/checkpointer/internal/query.js +0 -42
- package/dist/checkpointer/internal/regular-write.d.ts +0 -28
- package/dist/checkpointer/internal/regular-write.js +0 -66
- package/dist/checkpointer/internal/setup.d.ts +0 -33
- package/dist/checkpointer/internal/setup.js +0 -38
- package/dist/checkpointer/internal/special-write-cas.d.ts +0 -29
- package/dist/checkpointer/internal/special-write-cas.js +0 -104
- package/dist/checkpointer/internal/special-write-cleanup.d.ts +0 -23
- package/dist/checkpointer/internal/special-write-cleanup.js +0 -50
- package/dist/checkpointer/internal/special-write-verify.d.ts +0 -53
- package/dist/checkpointer/internal/special-write-verify.js +0 -80
- package/dist/checkpointer/internal/stored-channels.d.ts +0 -31
- package/dist/checkpointer/internal/stored-channels.js +0 -70
- package/dist/checkpointer/internal/validation.d.ts +0 -18
- package/dist/checkpointer/internal/validation.js +0 -40
- package/dist/checkpointer/internal/write-guard.d.ts +0 -20
- package/dist/checkpointer/internal/write-guard.js +0 -48
- package/dist/checkpointer/internal/write-index.d.ts +0 -36
- package/dist/checkpointer/internal/write-index.js +0 -41
- package/dist/checkpointer/saver.d.ts +0 -70
- package/dist/checkpointer/saver.js +0 -105
- package/dist/checkpointer/types.d.ts +0 -58
- package/dist/factory/factory.d.ts +0 -40
- package/dist/factory/factory.js +0 -87
- package/dist/history/actions/add-messages.d.ts +0 -15
- package/dist/history/actions/add-messages.js +0 -77
- package/dist/history/actions/clear.d.ts +0 -10
- package/dist/history/actions/clear.js +0 -34
- package/dist/history/actions/get-messages.d.ts +0 -17
- package/dist/history/actions/get-messages.js +0 -79
- package/dist/history/actions/list-sessions.d.ts +0 -13
- package/dist/history/actions/list-sessions.js +0 -53
- package/dist/history/actions/reconcile-count.d.ts +0 -12
- package/dist/history/actions/reconcile-count.js +0 -64
- package/dist/history/chat-message-history.d.ts +0 -73
- package/dist/history/chat-message-history.js +0 -111
- package/dist/history/internal/append-saga.d.ts +0 -25
- package/dist/history/internal/append-saga.js +0 -79
- package/dist/history/internal/compensation.d.ts +0 -25
- package/dist/history/internal/compensation.js +0 -92
- package/dist/history/internal/item-mapper.d.ts +0 -9
- package/dist/history/internal/item-mapper.js +0 -27
- package/dist/history/internal/keys.d.ts +0 -16
- package/dist/history/internal/keys.js +0 -48
- package/dist/history/internal/message-chunker.d.ts +0 -13
- package/dist/history/internal/message-chunker.js +0 -67
- package/dist/history/internal/message-transaction.d.ts +0 -25
- package/dist/history/internal/message-transaction.js +0 -61
- package/dist/history/internal/message-window.d.ts +0 -17
- package/dist/history/internal/message-window.js +0 -49
- package/dist/history/internal/query.d.ts +0 -23
- package/dist/history/internal/query.js +0 -39
- package/dist/history/internal/session-count.d.ts +0 -47
- package/dist/history/internal/session-count.js +0 -115
- package/dist/history/internal/session-title.d.ts +0 -19
- package/dist/history/internal/session-title.js +0 -43
- package/dist/history/internal/session-update.d.ts +0 -27
- package/dist/history/internal/session-update.js +0 -69
- package/dist/history/internal/setup.d.ts +0 -31
- package/dist/history/internal/setup.js +0 -43
- package/dist/history/internal/title-generator.d.ts +0 -12
- package/dist/history/internal/title-generator.js +0 -41
- package/dist/history/internal/ttl-anchor.d.ts +0 -24
- package/dist/history/internal/ttl-anchor.js +0 -38
- package/dist/history/internal/validation.d.ts +0 -25
- package/dist/history/internal/validation.js +0 -53
- package/dist/history/session-adapter.d.ts +0 -29
- package/dist/history/session-adapter.js +0 -35
- package/dist/history/types.d.ts +0 -69
- package/dist/index.d.ts +0 -29
- package/dist/index.js +0 -32
- package/dist/shared/clock.d.ts +0 -8
- package/dist/shared/clock.js +0 -16
- package/dist/shared/codec/codec.d.ts +0 -53
- package/dist/shared/codec/codec.js +0 -66
- package/dist/shared/codec/compression.d.ts +0 -24
- package/dist/shared/codec/compression.js +0 -48
- package/dist/shared/codec/descriptor-keys.d.ts +0 -12
- package/dist/shared/codec/descriptor-keys.js +0 -14
- package/dist/shared/codec/encode.d.ts +0 -13
- package/dist/shared/codec/encode.js +0 -43
- package/dist/shared/codec/json-serde.d.ts +0 -7
- package/dist/shared/codec/json-serde.js +0 -17
- package/dist/shared/codec/payload-loss.d.ts +0 -12
- package/dist/shared/codec/payload-loss.js +0 -38
- package/dist/shared/codec/s3/adapter-config.d.ts +0 -13
- package/dist/shared/codec/s3/adapter-config.js +0 -22
- package/dist/shared/codec/s3/bounded-body.d.ts +0 -14
- package/dist/shared/codec/s3/bounded-body.js +0 -47
- package/dist/shared/codec/s3/client.d.ts +0 -18
- package/dist/shared/codec/s3/client.js +0 -46
- package/dist/shared/codec/s3/config.d.ts +0 -51
- package/dist/shared/codec/s3/config.js +0 -58
- package/dist/shared/codec/s3/delete.d.ts +0 -7
- package/dist/shared/codec/s3/delete.js +0 -28
- package/dist/shared/codec/s3/key-scope.d.ts +0 -23
- package/dist/shared/codec/s3/key-scope.js +0 -44
- package/dist/shared/codec/s3/lifecycle.d.ts +0 -14
- package/dist/shared/codec/s3/lifecycle.js +0 -63
- package/dist/shared/codec/s3/offloader.d.ts +0 -44
- package/dist/shared/codec/s3/offloader.js +0 -118
- package/dist/shared/codec/s3/orphans.d.ts +0 -23
- package/dist/shared/codec/s3/orphans.js +0 -71
- package/dist/shared/codec/s3/read-write.d.ts +0 -18
- package/dist/shared/codec/s3/read-write.js +0 -51
- package/dist/shared/codec/s3/retry.d.ts +0 -5
- package/dist/shared/codec/s3/retry.js +0 -22
- package/dist/shared/concurrency.d.ts +0 -6
- package/dist/shared/constants.d.ts +0 -112
- package/dist/shared/constants.js +0 -115
- package/dist/shared/dynamodb/abort.d.ts +0 -9
- package/dist/shared/dynamodb/abort.js +0 -27
- package/dist/shared/dynamodb/backoff.d.ts +0 -15
- package/dist/shared/dynamodb/backoff.js +0 -48
- package/dist/shared/dynamodb/batch-write.d.ts +0 -22
- package/dist/shared/dynamodb/batch-write.js +0 -53
- package/dist/shared/dynamodb/cancellation.d.ts +0 -6
- package/dist/shared/dynamodb/cancellation.js +0 -7
- package/dist/shared/dynamodb/client.d.ts +0 -28
- package/dist/shared/dynamodb/conditional-put.d.ts +0 -67
- package/dist/shared/dynamodb/conditional-put.js +0 -76
- package/dist/shared/dynamodb/drain-unprocessed.d.ts +0 -21
- package/dist/shared/dynamodb/drain-unprocessed.js +0 -43
- package/dist/shared/dynamodb/expiry.d.ts +0 -16
- package/dist/shared/dynamodb/expiry.js +0 -29
- package/dist/shared/dynamodb/paginate-core.d.ts +0 -24
- package/dist/shared/dynamodb/paginate-core.js +0 -82
- package/dist/shared/dynamodb/paginate.d.ts +0 -14
- package/dist/shared/dynamodb/paginate.js +0 -19
- package/dist/shared/dynamodb/partition-delete.d.ts +0 -39
- package/dist/shared/dynamodb/partition-delete.js +0 -71
- package/dist/shared/dynamodb/retry-classifier.d.ts +0 -17
- package/dist/shared/dynamodb/retry-classifier.js +0 -118
- package/dist/shared/dynamodb/retry-policy.d.ts +0 -26
- package/dist/shared/dynamodb/retry-policy.js +0 -22
- package/dist/shared/dynamodb/retry.d.ts +0 -31
- package/dist/shared/dynamodb/retry.js +0 -57
- package/dist/shared/dynamodb/scan.d.ts +0 -14
- package/dist/shared/dynamodb/scan.js +0 -19
- package/dist/shared/dynamodb/types.d.ts +0 -23
- package/dist/shared/errors/base-error.d.ts +0 -30
- package/dist/shared/errors/base-error.js +0 -27
- package/dist/shared/errors/boundary.d.ts +0 -18
- package/dist/shared/errors/boundary.js +0 -46
- package/dist/shared/errors/error-code.d.ts +0 -13
- package/dist/shared/errors/errors.d.ts +0 -68
- package/dist/shared/errors/errors.js +0 -114
- package/dist/shared/errors/upstream-error.d.ts +0 -16
- package/dist/shared/errors/upstream-error.js +0 -27
- package/dist/shared/errors/wrap-error.d.ts +0 -7
- package/dist/shared/errors/wrap-error.js +0 -15
- package/dist/shared/logging/logger.d.ts +0 -18
- package/dist/shared/logging/logger.js +0 -15
- package/dist/shared/logging/redaction-walk.d.ts +0 -23
- package/dist/shared/logging/redaction-walk.js +0 -112
- package/dist/shared/logging/redaction.d.ts +0 -39
- package/dist/shared/logging/redaction.js +0 -75
- package/dist/shared/logging/secret-patterns.d.ts +0 -92
- package/dist/shared/logging/secret-patterns.js +0 -133
- package/dist/shared/options.d.ts +0 -37
- package/dist/shared/ulid.d.ts +0 -23
- package/dist/shared/validation/options.d.ts +0 -8
- package/dist/shared/validation/options.js +0 -90
- package/dist/shared/validation/primitives.d.ts +0 -29
- package/dist/shared/validation/primitives.js +0 -82
- package/dist/shared/validation/ttl.d.ts +0 -28
- package/dist/shared/validation/ttl.js +0 -52
- package/dist/store/actions/get.d.ts +0 -13
- package/dist/store/actions/get.js +0 -73
- package/dist/store/actions/list-namespaces.d.ts +0 -8
- package/dist/store/actions/list-namespaces.js +0 -59
- package/dist/store/actions/put.d.ts +0 -10
- package/dist/store/actions/put.js +0 -96
- package/dist/store/actions/reconcile-vector-index.d.ts +0 -18
- package/dist/store/actions/reconcile-vector-index.js +0 -26
- package/dist/store/actions/search.d.ts +0 -9
- package/dist/store/actions/search.js +0 -34
- package/dist/store/internal/backend-search.d.ts +0 -4
- package/dist/store/internal/backend-search.js +0 -74
- package/dist/store/internal/batch-plan.d.ts +0 -11
- package/dist/store/internal/batch-plan.js +0 -52
- package/dist/store/internal/candidates.d.ts +0 -23
- package/dist/store/internal/candidates.js +0 -94
- package/dist/store/internal/filter.d.ts +0 -9
- package/dist/store/internal/filter.js +0 -85
- package/dist/store/internal/index-reconcile.d.ts +0 -21
- package/dist/store/internal/index-reconcile.js +0 -118
- package/dist/store/internal/index-sync.d.ts +0 -10
- package/dist/store/internal/index-sync.js +0 -25
- package/dist/store/internal/item-mapper.d.ts +0 -27
- package/dist/store/internal/item-mapper.js +0 -61
- package/dist/store/internal/keys.d.ts +0 -17
- package/dist/store/internal/keys.js +0 -41
- package/dist/store/internal/namespace-match.d.ts +0 -11
- package/dist/store/internal/namespace-match.js +0 -40
- package/dist/store/internal/option-validation.d.ts +0 -13
- package/dist/store/internal/option-validation.js +0 -77
- package/dist/store/internal/overwrite-swap.d.ts +0 -32
- package/dist/store/internal/overwrite-swap.js +0 -68
- package/dist/store/internal/persist.d.ts +0 -28
- package/dist/store/internal/persist.js +0 -64
- package/dist/store/internal/query.d.ts +0 -11
- package/dist/store/internal/query.js +0 -48
- package/dist/store/internal/ranker.d.ts +0 -18
- package/dist/store/internal/ranker.js +0 -39
- package/dist/store/internal/read-existing.d.ts +0 -23
- package/dist/store/internal/read-existing.js +0 -41
- package/dist/store/internal/score-direction.d.ts +0 -31
- package/dist/store/internal/score-direction.js +0 -38
- package/dist/store/internal/search-filter.d.ts +0 -3
- package/dist/store/internal/search-filter.js +0 -10
- package/dist/store/internal/semantic-search.d.ts +0 -34
- package/dist/store/internal/semantic-search.js +0 -87
- package/dist/store/internal/setup.d.ts +0 -36
- package/dist/store/internal/setup.js +0 -40
- package/dist/store/internal/text-path.d.ts +0 -17
- package/dist/store/internal/validation.d.ts +0 -18
- package/dist/store/internal/validation.js +0 -51
- package/dist/store/internal/write-verify.d.ts +0 -42
- package/dist/store/internal/write-verify.js +0 -71
- package/dist/store/store.d.ts +0 -61
- package/dist/store/store.js +0 -107
- package/dist/store/types.d.ts +0 -50
- package/dist/store/types.js +0 -2
- package/dist/store/vector-backend.d.ts +0 -43
- package/dist/store/vector-backend.js +0 -2
- /package/dist/{checkpointer → cjs/checkpointer}/types.js +0 -0
- /package/dist/{factory → cjs/factory}/types.js +0 -0
- /package/dist/{history → cjs/history}/types.js +0 -0
- /package/dist/{shared → cjs/shared}/options.js +0 -0
- /package/dist/{shared/dynamodb → cjs/store}/types.js +0 -0
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeSpecialItem = writeSpecialItem;
|
|
4
|
-
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
5
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
6
|
-
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
7
|
-
const special_write_verify_1 = require("./special-write-verify");
|
|
8
|
-
/**
|
|
9
|
-
* Retry a conditional put up to {@link OVERWRITE_CAS_MAX_ATTEMPTS} times,
|
|
10
|
-
* re-reading the row each time a racer's write invalidates the pinned
|
|
11
|
-
* `writeGroup`. Extracted from {@link writeSpecialItem} to keep both
|
|
12
|
-
* functions under the repo's block-nesting limit.
|
|
13
|
-
*
|
|
14
|
-
* A rejection is not proof a competitor won: `withDynamoDBRetry` retries
|
|
15
|
-
* transient errors, so an attempt can commit server-side, its response can be
|
|
16
|
-
* lost, and the retried put can hit the row it just wrote and fail the same
|
|
17
|
-
* guard — indistinguishable from a competitor's win by the rejection alone.
|
|
18
|
-
* Each attempt's pinned observation is captured in `attempted` before the
|
|
19
|
-
* put, so that when {@link verifyAfterFailure} finds the row already holding
|
|
20
|
-
* *this item's own* `writeGroup`, the outcome reports having superseded
|
|
21
|
-
* whatever `attempted` held — never the item's own just-committed payload,
|
|
22
|
-
* which would strand the live row pointing at a deleted object.
|
|
23
|
-
*
|
|
24
|
-
* Only a rejection whose re-read proves some *other* writer holds the row is
|
|
25
|
-
* retried; every other failure is already settled by the verification.
|
|
26
|
-
*/
|
|
27
|
-
async function attemptCasWrites(context, item, initial, signal) {
|
|
28
|
-
let observed = initial;
|
|
29
|
-
for (let attempt = 1; attempt <= conditional_put_1.OVERWRITE_CAS_MAX_ATTEMPTS; attempt++) {
|
|
30
|
-
const attempted = observed;
|
|
31
|
-
try {
|
|
32
|
-
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({
|
|
33
|
-
TableName: context.tableName,
|
|
34
|
-
Item: item,
|
|
35
|
-
...(0, conditional_put_1.revisionGuard)(special_write_verify_1.SPECIAL_REVISION_ATTRIBUTE, attempted),
|
|
36
|
-
}), (0, retry_policy_1.retryFor)(context, signal));
|
|
37
|
-
return { done: true, outcome: { committed: true, superseded: attempted.value } };
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
const verified = await (0, special_write_verify_1.verifyAfterFailure)(context, item, attempted, error);
|
|
41
|
-
if (!verified.observed || !(0, conditional_put_1.isConditionalCheckFailed)(error)) {
|
|
42
|
-
return { done: true, outcome: verified.outcome };
|
|
43
|
-
}
|
|
44
|
-
observed = verified.observed;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return { done: false, observed };
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Overwrite the row unconditionally once the compare-and-swap budget is spent,
|
|
51
|
-
* verifying rather than assuming if that put fails too.
|
|
52
|
-
*/
|
|
53
|
-
async function overwriteUnconditionally(context, item, observed, signal) {
|
|
54
|
-
try {
|
|
55
|
-
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({ TableName: context.tableName, Item: item }), (0, retry_policy_1.retryFor)(context, signal));
|
|
56
|
-
return { committed: true, superseded: observed.value };
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
return (await (0, special_write_verify_1.verifyAfterFailure)(context, item, observed, error)).outcome;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Overwrite one special row, pinned to the `writeGroup` this call observed, and
|
|
64
|
-
* report the descriptor it superseded.
|
|
65
|
-
*
|
|
66
|
-
* Overwriting is correct for special channels — every reference implementation
|
|
67
|
-
* does it — but two concurrent calls to the same channel both read the same
|
|
68
|
-
* previous descriptor and both delete it, orphaning the loser's upload. Pinning
|
|
69
|
-
* the observed `writeGroup` and re-reading on rejection makes each call
|
|
70
|
-
* supersede exactly one payload.
|
|
71
|
-
*
|
|
72
|
-
* `BatchWriteItem` cannot carry conditions, which is why this path issues
|
|
73
|
-
* individual puts; a call holds at most one row per special channel, so that is
|
|
74
|
-
* four writes at worst.
|
|
75
|
-
*
|
|
76
|
-
* The compare-and-swap runs only when an offloader is configured — matching
|
|
77
|
-
* `store/internal/persist.ts` — because without one there is no S3 object to
|
|
78
|
-
* orphan, so a plain unconditional put stays correct and costs no extra
|
|
79
|
-
* ConsistentRead or write capacity. That shortcut is also why the surviving
|
|
80
|
-
* `catch` may report `committed: false` without verifying: with no offloader
|
|
81
|
-
* there is no object for the caller to delete on the strength of it.
|
|
82
|
-
*
|
|
83
|
-
* Never rejects: the caller runs this concurrently with the regular writes
|
|
84
|
-
* under `Promise.all`, whose own cleanup depends on every branch resolving
|
|
85
|
-
* rather than short-circuiting.
|
|
86
|
-
*/
|
|
87
|
-
async function writeSpecialItem(context, item, signal) {
|
|
88
|
-
try {
|
|
89
|
-
if (!context.offloader) {
|
|
90
|
-
await (0, retry_1.withDynamoDBRetry)(() => context.client.put({ TableName: context.tableName, Item: item }), (0, retry_policy_1.retryFor)(context, signal));
|
|
91
|
-
return { committed: true };
|
|
92
|
-
}
|
|
93
|
-
const initial = await (0, special_write_verify_1.readSpecialRow)(context, item);
|
|
94
|
-
const attempt = await attemptCasWrites(context, item, initial, signal);
|
|
95
|
-
if (attempt.done)
|
|
96
|
-
return attempt.outcome;
|
|
97
|
-
context.logger.warn('putWrites: special-write compare-and-swap exhausted; overwriting unconditionally, which ' +
|
|
98
|
-
'can orphan one S3 object under a concurrent call (reclaimed by ensureS3LifecycleRule)', { sortKey: item.SK, channel: item.channel, attempts: conditional_put_1.OVERWRITE_CAS_MAX_ATTEMPTS });
|
|
99
|
-
return await overwriteUnconditionally(context, item, attempt.observed, signal);
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
return { committed: false, error: error };
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { CheckpointWriteItem } from '../types';
|
|
2
|
-
import type { CheckpointerContext } from './setup';
|
|
3
|
-
/**
|
|
4
|
-
* Write special (negative-index) items, then clean up the correct side of each.
|
|
5
|
-
*
|
|
6
|
-
* Overwrite is correct here, matching every reference checkpointer. Each item
|
|
7
|
-
* is written with a compare-and-swap on its row's `writeGroup` (see
|
|
8
|
-
* {@link writeSpecialItem}) so a concurrent call to the same special channel
|
|
9
|
-
* cannot make both callers delete the same superseded object and orphan one
|
|
10
|
-
* upload. A committed item cleans up the payload it actually superseded; an
|
|
11
|
-
* item confirmed never to have committed cleans up its own new upload.
|
|
12
|
-
*
|
|
13
|
-
* "Confirmed" is load-bearing, and {@link writeSpecialItem} is what earns it:
|
|
14
|
-
* an ambiguous failure is verified against the row and reported as committed
|
|
15
|
-
* unless the read proves otherwise. Deleting on *unknown* would strand a live
|
|
16
|
-
* row pointing at a deleted object; leaking one object instead is recoverable.
|
|
17
|
-
*
|
|
18
|
-
* Never rejects — a failure is reported via the return value, because the
|
|
19
|
-
* caller runs this concurrently with `writeRegularItems` under `Promise.all`,
|
|
20
|
-
* whose own cleanup depends on every branch resolving rather than
|
|
21
|
-
* short-circuiting.
|
|
22
|
-
*/
|
|
23
|
-
export declare function writeSpecialItemsWithCleanup(context: CheckpointerContext, threadId: string, items: CheckpointWriteItem[], signal?: AbortSignal): Promise<Error | undefined>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeSpecialItemsWithCleanup = writeSpecialItemsWithCleanup;
|
|
4
|
-
const descriptor_keys_1 = require("../../shared/codec/descriptor-keys");
|
|
5
|
-
const orphans_1 = require("../../shared/codec/s3/orphans");
|
|
6
|
-
const special_write_cas_1 = require("./special-write-cas");
|
|
7
|
-
/**
|
|
8
|
-
* Best-effort delete the S3 objects backing `descriptors`, if offloading is on.
|
|
9
|
-
* `scope` is given for descriptors read back from rows (the superseded values)
|
|
10
|
-
* and omitted for this call's own uploads.
|
|
11
|
-
*/
|
|
12
|
-
async function deleteDescriptors(context, descriptors, label, scope) {
|
|
13
|
-
if (!context.offloader)
|
|
14
|
-
return;
|
|
15
|
-
const present = descriptors.filter((d) => d !== undefined);
|
|
16
|
-
if (present.length === 0)
|
|
17
|
-
return;
|
|
18
|
-
await (0, orphans_1.cleanUpS3Orphans)(context.offloader, (0, descriptor_keys_1.collectS3Keys)(present), label, context.logger, scope === undefined ? {} : { scope });
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Write special (negative-index) items, then clean up the correct side of each.
|
|
22
|
-
*
|
|
23
|
-
* Overwrite is correct here, matching every reference checkpointer. Each item
|
|
24
|
-
* is written with a compare-and-swap on its row's `writeGroup` (see
|
|
25
|
-
* {@link writeSpecialItem}) so a concurrent call to the same special channel
|
|
26
|
-
* cannot make both callers delete the same superseded object and orphan one
|
|
27
|
-
* upload. A committed item cleans up the payload it actually superseded; an
|
|
28
|
-
* item confirmed never to have committed cleans up its own new upload.
|
|
29
|
-
*
|
|
30
|
-
* "Confirmed" is load-bearing, and {@link writeSpecialItem} is what earns it:
|
|
31
|
-
* an ambiguous failure is verified against the row and reported as committed
|
|
32
|
-
* unless the read proves otherwise. Deleting on *unknown* would strand a live
|
|
33
|
-
* row pointing at a deleted object; leaking one object instead is recoverable.
|
|
34
|
-
*
|
|
35
|
-
* Never rejects — a failure is reported via the return value, because the
|
|
36
|
-
* caller runs this concurrently with `writeRegularItems` under `Promise.all`,
|
|
37
|
-
* whose own cleanup depends on every branch resolving rather than
|
|
38
|
-
* short-circuiting.
|
|
39
|
-
*/
|
|
40
|
-
async function writeSpecialItemsWithCleanup(context, threadId, items, signal) {
|
|
41
|
-
if (items.length === 0)
|
|
42
|
-
return undefined;
|
|
43
|
-
const outcomes = await Promise.all(items.map(async (item) => [
|
|
44
|
-
item,
|
|
45
|
-
await (0, special_write_cas_1.writeSpecialItem)(context, item, signal),
|
|
46
|
-
]));
|
|
47
|
-
await deleteDescriptors(context, outcomes.filter(([, o]) => o.committed).map(([, o]) => o.superseded), 'putWrites.special.previous', [threadId]);
|
|
48
|
-
await deleteDescriptors(context, outcomes.filter(([, o]) => !o.committed).map(([item]) => item.value), 'putWrites.special.newUpload');
|
|
49
|
-
return outcomes.find(([, o]) => o.error)?.[1].error;
|
|
50
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { PayloadDescriptor } from '../../shared/codec/codec';
|
|
2
|
-
import type { CheckpointWriteItem } from '../types';
|
|
3
|
-
import type { CheckpointerContext } from './setup';
|
|
4
|
-
/**
|
|
5
|
-
* A special row already carries a per-call ULID in `writeGroup`, so it needs no
|
|
6
|
-
* extra revision attribute to compare and swap on.
|
|
7
|
-
*/
|
|
8
|
-
export declare const SPECIAL_REVISION_ATTRIBUTE = "writeGroup";
|
|
9
|
-
/** What a special item's row held before this call tried to overwrite it. */
|
|
10
|
-
export interface SpecialRowState {
|
|
11
|
-
exists: boolean;
|
|
12
|
-
value?: PayloadDescriptor;
|
|
13
|
-
revision?: string;
|
|
14
|
-
}
|
|
15
|
-
/** Outcome of one special item's conditional write. Never thrown, always returned. */
|
|
16
|
-
export interface SpecialWriteOutcome {
|
|
17
|
-
committed: boolean;
|
|
18
|
-
superseded?: PayloadDescriptor;
|
|
19
|
-
error?: Error;
|
|
20
|
-
}
|
|
21
|
-
/** What a post-failure verification read established about the attempt. */
|
|
22
|
-
export interface VerifiedFailure {
|
|
23
|
-
outcome: SpecialWriteOutcome;
|
|
24
|
-
/** Present only when the row was read and holds some other writer's group. */
|
|
25
|
-
observed?: SpecialRowState;
|
|
26
|
-
}
|
|
27
|
-
/** Read a special row's current descriptor and the writeGroup guarding it. */
|
|
28
|
-
export declare function readSpecialRow(context: CheckpointerContext, item: CheckpointWriteItem): Promise<SpecialRowState>;
|
|
29
|
-
/**
|
|
30
|
-
* Read the row back after a put failed, and report what that failure actually
|
|
31
|
-
* did — never assuming it did nothing.
|
|
32
|
-
*
|
|
33
|
-
* No rejection is proof of a non-commit. `withDynamoDBRetry` re-issues a put
|
|
34
|
-
* whose response was lost, and those re-issues can time out at the transport
|
|
35
|
-
* without ever reaching DynamoDB, so the budget is spent on a
|
|
36
|
-
* `RetryExhaustedError` and never on a `ConditionalCheckFailedException` — yet
|
|
37
|
-
* the row is committed. Reporting that as a confirmed non-commit let
|
|
38
|
-
* `writeSpecialItemsWithCleanup` delete the S3 object the live row points at,
|
|
39
|
-
* so every later `getTuple()` on that checkpoint failed with `NoSuchKey`,
|
|
40
|
-
* permanently.
|
|
41
|
-
*
|
|
42
|
-
* Three answers are possible:
|
|
43
|
-
* - the row holds this item's own `writeGroup`: the write landed, and the
|
|
44
|
-
* descriptor this attempt pinned is the dead one.
|
|
45
|
-
* - the row holds some other group: the write is confirmed not to be what is
|
|
46
|
-
* live, so this item's own upload is the dead one. `observed` is returned so
|
|
47
|
-
* a rejected compare-and-swap can re-pin and try again.
|
|
48
|
-
* - the read itself fails: nothing is confirmed, so the outcome still reports a
|
|
49
|
-
* commit and keeps the originating error. That leaks one S3 object at worst
|
|
50
|
-
* (reclaimed by `ensureS3LifecycleRule`) where the alternative strands a live
|
|
51
|
-
* row — the same trade `store/internal/persist.ts` makes.
|
|
52
|
-
*/
|
|
53
|
-
export declare function verifyAfterFailure(context: CheckpointerContext, item: CheckpointWriteItem, attempted: SpecialRowState, error: Error): Promise<VerifiedFailure>;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SPECIAL_REVISION_ATTRIBUTE = void 0;
|
|
4
|
-
exports.readSpecialRow = readSpecialRow;
|
|
5
|
-
exports.verifyAfterFailure = verifyAfterFailure;
|
|
6
|
-
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
7
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
8
|
-
/**
|
|
9
|
-
* A special row already carries a per-call ULID in `writeGroup`, so it needs no
|
|
10
|
-
* extra revision attribute to compare and swap on.
|
|
11
|
-
*/
|
|
12
|
-
exports.SPECIAL_REVISION_ATTRIBUTE = 'writeGroup';
|
|
13
|
-
/** Read a special row's current descriptor and the writeGroup guarding it. */
|
|
14
|
-
async function readSpecialRow(context, item) {
|
|
15
|
-
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
16
|
-
TableName: context.tableName,
|
|
17
|
-
Key: { PK: item.PK, SK: item.SK },
|
|
18
|
-
ConsistentRead: true,
|
|
19
|
-
ProjectionExpression: '#v, #g',
|
|
20
|
-
ExpressionAttributeNames: { '#v': 'value', '#g': exports.SPECIAL_REVISION_ATTRIBUTE },
|
|
21
|
-
}), context.retry);
|
|
22
|
-
if (!result.Item)
|
|
23
|
-
return { exists: false };
|
|
24
|
-
return {
|
|
25
|
-
exists: true,
|
|
26
|
-
value: result.Item.value,
|
|
27
|
-
revision: result.Item[exports.SPECIAL_REVISION_ATTRIBUTE],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The row as it stood when the put failed: a guard rejection carries it (see
|
|
32
|
-
* `rejectedItem`), so the strongly-consistent read is spent only for a failure
|
|
33
|
-
* that does not — a lost response, or a rejection whose row vanished since.
|
|
34
|
-
*/
|
|
35
|
-
async function observeRow(context, item, error) {
|
|
36
|
-
const rejected = (0, conditional_put_1.isConditionalCheckFailed)(error) ? (0, conditional_put_1.rejectedItem)(error) : undefined;
|
|
37
|
-
if (!rejected)
|
|
38
|
-
return readSpecialRow(context, item);
|
|
39
|
-
return {
|
|
40
|
-
exists: true,
|
|
41
|
-
value: rejected.value,
|
|
42
|
-
revision: rejected[exports.SPECIAL_REVISION_ATTRIBUTE],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Read the row back after a put failed, and report what that failure actually
|
|
47
|
-
* did — never assuming it did nothing.
|
|
48
|
-
*
|
|
49
|
-
* No rejection is proof of a non-commit. `withDynamoDBRetry` re-issues a put
|
|
50
|
-
* whose response was lost, and those re-issues can time out at the transport
|
|
51
|
-
* without ever reaching DynamoDB, so the budget is spent on a
|
|
52
|
-
* `RetryExhaustedError` and never on a `ConditionalCheckFailedException` — yet
|
|
53
|
-
* the row is committed. Reporting that as a confirmed non-commit let
|
|
54
|
-
* `writeSpecialItemsWithCleanup` delete the S3 object the live row points at,
|
|
55
|
-
* so every later `getTuple()` on that checkpoint failed with `NoSuchKey`,
|
|
56
|
-
* permanently.
|
|
57
|
-
*
|
|
58
|
-
* Three answers are possible:
|
|
59
|
-
* - the row holds this item's own `writeGroup`: the write landed, and the
|
|
60
|
-
* descriptor this attempt pinned is the dead one.
|
|
61
|
-
* - the row holds some other group: the write is confirmed not to be what is
|
|
62
|
-
* live, so this item's own upload is the dead one. `observed` is returned so
|
|
63
|
-
* a rejected compare-and-swap can re-pin and try again.
|
|
64
|
-
* - the read itself fails: nothing is confirmed, so the outcome still reports a
|
|
65
|
-
* commit and keeps the originating error. That leaks one S3 object at worst
|
|
66
|
-
* (reclaimed by `ensureS3LifecycleRule`) where the alternative strands a live
|
|
67
|
-
* row — the same trade `store/internal/persist.ts` makes.
|
|
68
|
-
*/
|
|
69
|
-
async function verifyAfterFailure(context, item, attempted, error) {
|
|
70
|
-
try {
|
|
71
|
-
const observed = await observeRow(context, item, error);
|
|
72
|
-
if (observed.revision === item.writeGroup) {
|
|
73
|
-
return { outcome: { committed: true, superseded: attempted.value } };
|
|
74
|
-
}
|
|
75
|
-
return { outcome: { committed: false, error }, observed };
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
return { outcome: { committed: true, error } };
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ChannelVersions, Checkpoint } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
import type { CheckpointerContext } from './setup';
|
|
3
|
-
/**
|
|
4
|
-
* The channels a put stores values for. With `newVersions` the reference
|
|
5
|
-
* savers store only the channels that changed in this step and rebuild the
|
|
6
|
-
* rest from earlier checkpoints on read; here the rest are carried into the
|
|
7
|
-
* new row directly — every channel the parent stored that this put still
|
|
8
|
-
* holds a value for — so a read never walks ancestors. A value the put holds
|
|
9
|
-
* for a channel that neither changed nor was stored before has no version of
|
|
10
|
-
* record and is not stored. Without `newVersions` (a caller predating the
|
|
11
|
-
* argument) every value given is stored, and so it is when `parentStored` is
|
|
12
|
-
* `undefined`: the parent row predates the attribute and held everything.
|
|
13
|
-
*/
|
|
14
|
-
export declare function selectStoredChannels(checkpoint: Checkpoint, newVersions: ChannelVersions | undefined, parentStored: readonly string[] | undefined): string[];
|
|
15
|
-
/** The checkpoint as it is stored: `channel_values` narrowed to `channels`, everything else untouched. */
|
|
16
|
-
export declare function withStoredChannels(checkpoint: Checkpoint, channels: readonly string[]): Checkpoint;
|
|
17
|
-
/** True when `newVersions` already names every value the checkpoint carries, so nothing needs carrying over. */
|
|
18
|
-
export declare function coversEveryChannel(checkpoint: Checkpoint, newVersions: ChannelVersions): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The parent's stored-channel list, read from its META row with a consistent
|
|
21
|
-
* projection of that one attribute. `undefined` when the parent is gone
|
|
22
|
-
* (deleted or expired) or predates the attribute: both mean "carry every
|
|
23
|
-
* value the put holds", the behaviour those rows were written under.
|
|
24
|
-
*/
|
|
25
|
-
export declare function readParentStoredChannels(context: CheckpointerContext, threadId: string, checkpointNs: string, parentCheckpointId: string, signal?: AbortSignal): Promise<readonly string[] | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Resolve the channels a put stores, spending the parent read only when it
|
|
28
|
-
* can change the answer: never without `newVersions` or a parent, and not
|
|
29
|
-
* when `newVersions` already covers every value the put carries.
|
|
30
|
-
*/
|
|
31
|
-
export declare function storedChannelsFor(context: CheckpointerContext, threadId: string, checkpointNs: string, checkpoint: Checkpoint, newVersions: ChannelVersions | undefined, parentCheckpointId: string | undefined, signal?: AbortSignal): Promise<string[]>;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.selectStoredChannels = selectStoredChannels;
|
|
4
|
-
exports.withStoredChannels = withStoredChannels;
|
|
5
|
-
exports.coversEveryChannel = coversEveryChannel;
|
|
6
|
-
exports.readParentStoredChannels = readParentStoredChannels;
|
|
7
|
-
exports.storedChannelsFor = storedChannelsFor;
|
|
8
|
-
const retry_1 = require("../../shared/dynamodb/retry");
|
|
9
|
-
const retry_policy_1 = require("../../shared/dynamodb/retry-policy");
|
|
10
|
-
const keys_1 = require("./keys");
|
|
11
|
-
/**
|
|
12
|
-
* The channels a put stores values for. With `newVersions` the reference
|
|
13
|
-
* savers store only the channels that changed in this step and rebuild the
|
|
14
|
-
* rest from earlier checkpoints on read; here the rest are carried into the
|
|
15
|
-
* new row directly — every channel the parent stored that this put still
|
|
16
|
-
* holds a value for — so a read never walks ancestors. A value the put holds
|
|
17
|
-
* for a channel that neither changed nor was stored before has no version of
|
|
18
|
-
* record and is not stored. Without `newVersions` (a caller predating the
|
|
19
|
-
* argument) every value given is stored, and so it is when `parentStored` is
|
|
20
|
-
* `undefined`: the parent row predates the attribute and held everything.
|
|
21
|
-
*/
|
|
22
|
-
function selectStoredChannels(checkpoint, newVersions, parentStored) {
|
|
23
|
-
const present = Object.keys(checkpoint.channel_values);
|
|
24
|
-
if (newVersions === undefined)
|
|
25
|
-
return present;
|
|
26
|
-
const keep = new Set([...Object.keys(newVersions), ...(parentStored ?? present)]);
|
|
27
|
-
return present.filter((channel) => keep.has(channel));
|
|
28
|
-
}
|
|
29
|
-
/** The checkpoint as it is stored: `channel_values` narrowed to `channels`, everything else untouched. */
|
|
30
|
-
function withStoredChannels(checkpoint, channels) {
|
|
31
|
-
const channelValues = {};
|
|
32
|
-
for (const channel of channels)
|
|
33
|
-
channelValues[channel] = checkpoint.channel_values[channel];
|
|
34
|
-
return { ...checkpoint, channel_values: channelValues };
|
|
35
|
-
}
|
|
36
|
-
/** True when `newVersions` already names every value the checkpoint carries, so nothing needs carrying over. */
|
|
37
|
-
function coversEveryChannel(checkpoint, newVersions) {
|
|
38
|
-
return Object.keys(checkpoint.channel_values).every((channel) => Object.hasOwn(newVersions, channel));
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The parent's stored-channel list, read from its META row with a consistent
|
|
42
|
-
* projection of that one attribute. `undefined` when the parent is gone
|
|
43
|
-
* (deleted or expired) or predates the attribute: both mean "carry every
|
|
44
|
-
* value the put holds", the behaviour those rows were written under.
|
|
45
|
-
*/
|
|
46
|
-
async function readParentStoredChannels(context, threadId, checkpointNs, parentCheckpointId, signal) {
|
|
47
|
-
const result = await (0, retry_1.withDynamoDBRetry)(() => context.client.get({
|
|
48
|
-
TableName: context.tableName,
|
|
49
|
-
Key: { PK: (0, keys_1.partitionKey)(threadId), SK: (0, keys_1.metaSortKey)(checkpointNs, parentCheckpointId) },
|
|
50
|
-
ConsistentRead: true,
|
|
51
|
-
ProjectionExpression: '#sc',
|
|
52
|
-
ExpressionAttributeNames: { '#sc': 'storedChannels' },
|
|
53
|
-
}), (0, retry_policy_1.retryFor)(context, signal));
|
|
54
|
-
const stored = result.Item?.storedChannels;
|
|
55
|
-
return Array.isArray(stored) ? stored : undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Resolve the channels a put stores, spending the parent read only when it
|
|
59
|
-
* can change the answer: never without `newVersions` or a parent, and not
|
|
60
|
-
* when `newVersions` already covers every value the put carries.
|
|
61
|
-
*/
|
|
62
|
-
async function storedChannelsFor(context, threadId, checkpointNs, checkpoint, newVersions, parentCheckpointId, signal) {
|
|
63
|
-
if (newVersions === undefined)
|
|
64
|
-
return selectStoredChannels(checkpoint, undefined, []);
|
|
65
|
-
if (parentCheckpointId === undefined || coversEveryChannel(checkpoint, newVersions)) {
|
|
66
|
-
return selectStoredChannels(checkpoint, newVersions, []);
|
|
67
|
-
}
|
|
68
|
-
const parentStored = await readParentStoredChannels(context, threadId, checkpointNs, parentCheckpointId, signal);
|
|
69
|
-
return selectStoredChannels(checkpoint, newVersions, parentStored);
|
|
70
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Validate a thread id: non-blank, separator- and control-char-free, at most 1024 bytes. */
|
|
2
|
-
export declare function validateThreadId(threadId: string): void;
|
|
3
|
-
/**
|
|
4
|
-
* Validate a checkpoint namespace. Unlike the other identifiers an empty value
|
|
5
|
-
* is legal — it is the root namespace — so only the separator, control-character
|
|
6
|
-
* and length rules apply.
|
|
7
|
-
*/
|
|
8
|
-
export declare function validateCheckpointNs(checkpointNs: string): void;
|
|
9
|
-
/** Validate a checkpoint id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
10
|
-
export declare function validateCheckpointId(checkpointId: string): void;
|
|
11
|
-
/** Validate a task id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
12
|
-
export declare function validateTaskId(taskId: string): void;
|
|
13
|
-
/**
|
|
14
|
-
* Validate a pending-write channel name. It is the trailing segment of the
|
|
15
|
-
* WRITE sort key, so it obeys the same rules as every other segment; LangGraph
|
|
16
|
-
* channel names never contain the reserved separator.
|
|
17
|
-
*/
|
|
18
|
-
export declare function validateChannel(channel: string): void;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateThreadId = validateThreadId;
|
|
4
|
-
exports.validateCheckpointNs = validateCheckpointNs;
|
|
5
|
-
exports.validateCheckpointId = validateCheckpointId;
|
|
6
|
-
exports.validateTaskId = validateTaskId;
|
|
7
|
-
exports.validateChannel = validateChannel;
|
|
8
|
-
const constants_1 = require("../../shared/constants");
|
|
9
|
-
const primitives_1 = require("../../shared/validation/primitives");
|
|
10
|
-
const keys_1 = require("./keys");
|
|
11
|
-
/** Validate a thread id: non-blank, separator- and control-char-free, at most 1024 bytes. */
|
|
12
|
-
function validateThreadId(threadId) {
|
|
13
|
-
(0, primitives_1.validateIdentifier)(threadId, keys_1.SORT_KEY_SEPARATOR, 'thread_id', constants_1.MAX_PARTITION_ID_BYTES);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Validate a checkpoint namespace. Unlike the other identifiers an empty value
|
|
17
|
-
* is legal — it is the root namespace — so only the separator, control-character
|
|
18
|
-
* and length rules apply.
|
|
19
|
-
*/
|
|
20
|
-
function validateCheckpointNs(checkpointNs) {
|
|
21
|
-
(0, primitives_1.assertNoSeparator)(checkpointNs, keys_1.SORT_KEY_SEPARATOR, 'checkpoint_ns');
|
|
22
|
-
(0, primitives_1.assertNoControlChars)(checkpointNs, 'checkpoint_ns');
|
|
23
|
-
(0, primitives_1.assertMaxBytes)(checkpointNs, 'checkpoint_ns', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
24
|
-
}
|
|
25
|
-
/** Validate a checkpoint id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
26
|
-
function validateCheckpointId(checkpointId) {
|
|
27
|
-
(0, primitives_1.validateIdentifier)(checkpointId, keys_1.SORT_KEY_SEPARATOR, 'checkpoint_id', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
28
|
-
}
|
|
29
|
-
/** Validate a task id: non-blank, separator- and control-char-free, at most 256 bytes. */
|
|
30
|
-
function validateTaskId(taskId) {
|
|
31
|
-
(0, primitives_1.validateIdentifier)(taskId, keys_1.SORT_KEY_SEPARATOR, 'taskId', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Validate a pending-write channel name. It is the trailing segment of the
|
|
35
|
-
* WRITE sort key, so it obeys the same rules as every other segment; LangGraph
|
|
36
|
-
* channel names never contain the reserved separator.
|
|
37
|
-
*/
|
|
38
|
-
function validateChannel(channel) {
|
|
39
|
-
(0, primitives_1.validateIdentifier)(channel, keys_1.SORT_KEY_SEPARATOR, 'channel', constants_1.MAX_KEY_SEGMENT_BYTES);
|
|
40
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CheckpointWriteItem } from '../types';
|
|
2
|
-
import type { CheckpointerContext } from './setup';
|
|
3
|
-
/**
|
|
4
|
-
* Report a guard rejection. Sort keys carry their channel, so a rejection
|
|
5
|
-
* normally means this exact (task, channel, occurrence) row is already
|
|
6
|
-
* committed — a genuine duplicate, and the expected outcome of a retry. A row
|
|
7
|
-
* held by a *different* channel is not something this adapter can produce, so
|
|
8
|
-
* it is reported at `warn`: the write was not persisted and something else
|
|
9
|
-
* wrote to this key space. No attributes returned means the outcome cannot be
|
|
10
|
-
* told apart, so it is treated as the ordinary duplicate.
|
|
11
|
-
*/
|
|
12
|
-
export declare function reportGuardRejection(context: CheckpointerContext, item: CheckpointWriteItem, error: Error): void;
|
|
13
|
-
/**
|
|
14
|
-
* True when the guard rejection's returned row provably belongs to another
|
|
15
|
-
* `putWrites` call, so this call's own upload is dead and safe to delete. A
|
|
16
|
-
* retried put whose response was lost can be rejected by the row it wrote
|
|
17
|
-
* itself, so an equal group — or no attributes at all — proves nothing and
|
|
18
|
-
* must not be taken as "my upload is dead".
|
|
19
|
-
*/
|
|
20
|
-
export declare function rejectionProvesForeignRow(item: CheckpointWriteItem, error: Error): boolean;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reportGuardRejection = reportGuardRejection;
|
|
4
|
-
exports.rejectionProvesForeignRow = rejectionProvesForeignRow;
|
|
5
|
-
const conditional_put_1 = require("../../shared/dynamodb/conditional-put");
|
|
6
|
-
/**
|
|
7
|
-
* The channel recorded on the row that turned a write away, or undefined when
|
|
8
|
-
* the service returned no attributes (`ReturnValuesOnConditionCheckFailure:
|
|
9
|
-
* 'ALL_OLD'` attaches the existing item to the exception at no extra round trip).
|
|
10
|
-
*/
|
|
11
|
-
function rejectedChannel(error) {
|
|
12
|
-
return (0, conditional_put_1.rejectedItem)(error)?.channel;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Report a guard rejection. Sort keys carry their channel, so a rejection
|
|
16
|
-
* normally means this exact (task, channel, occurrence) row is already
|
|
17
|
-
* committed — a genuine duplicate, and the expected outcome of a retry. A row
|
|
18
|
-
* held by a *different* channel is not something this adapter can produce, so
|
|
19
|
-
* it is reported at `warn`: the write was not persisted and something else
|
|
20
|
-
* wrote to this key space. No attributes returned means the outcome cannot be
|
|
21
|
-
* told apart, so it is treated as the ordinary duplicate.
|
|
22
|
-
*/
|
|
23
|
-
function reportGuardRejection(context, item, error) {
|
|
24
|
-
const found = rejectedChannel(error);
|
|
25
|
-
if (found !== undefined && found !== item.channel) {
|
|
26
|
-
context.logger.warn('putWrites: write row held by an unexpected channel; write not persisted', {
|
|
27
|
-
sortKey: item.SK,
|
|
28
|
-
expected: item.channel,
|
|
29
|
-
found,
|
|
30
|
-
});
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
context.logger.debug('putWrites: skipped a write already committed for this task and channel', {
|
|
34
|
-
sortKey: item.SK,
|
|
35
|
-
channel: item.channel,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* True when the guard rejection's returned row provably belongs to another
|
|
40
|
-
* `putWrites` call, so this call's own upload is dead and safe to delete. A
|
|
41
|
-
* retried put whose response was lost can be rejected by the row it wrote
|
|
42
|
-
* itself, so an equal group — or no attributes at all — proves nothing and
|
|
43
|
-
* must not be taken as "my upload is dead".
|
|
44
|
-
*/
|
|
45
|
-
function rejectionProvesForeignRow(item, error) {
|
|
46
|
-
const group = (0, conditional_put_1.rejectedItem)(error)?.writeGroup;
|
|
47
|
-
return group !== undefined && group !== item.writeGroup;
|
|
48
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { PendingWrite, PendingWriteValue } from '@langchain/langgraph-checkpoint';
|
|
2
|
-
/** One write with its sort-key index resolved exactly once. */
|
|
3
|
-
export interface ResolvedWrite {
|
|
4
|
-
channel: string;
|
|
5
|
-
value: PendingWriteValue;
|
|
6
|
-
index: number;
|
|
7
|
-
/**
|
|
8
|
-
* How many earlier writes in this same call already used this channel. A
|
|
9
|
-
* retry that emits a channel *more* often than the original call produces a
|
|
10
|
-
* row at an occurrence no earlier call ever wrote — it collides with nothing
|
|
11
|
-
* and commits cleanly, so the read-side dedup must not mistake it for a
|
|
12
|
-
* superseding duplicate.
|
|
13
|
-
*/
|
|
14
|
-
occurrence: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Assign every write in one `putWrites` call its sort-key index, in a single
|
|
18
|
-
* pass — nothing recomputes it downstream, which is what used to let the
|
|
19
|
-
* deduped array's positions disagree with the ones the caller's array
|
|
20
|
-
* produced.
|
|
21
|
-
*
|
|
22
|
-
* A regular write's index is its position in the caller's array, exactly as
|
|
23
|
-
* the reference `MemorySaver` computes it: that is what makes stored writes
|
|
24
|
-
* replay in the order the task emitted them. A special channel takes its
|
|
25
|
-
* fixed `WRITES_IDX_MAP` slot instead, and a later duplicate replaces an
|
|
26
|
-
* earlier one (last-write-wins, again matching the reference).
|
|
27
|
-
*
|
|
28
|
-
* Positions are not stable across calls, which is why the *sort key* also
|
|
29
|
-
* carries the channel and each call stamps its rows with a shared
|
|
30
|
-
* `writeGroup` — see {@link buildWriteItems} and `dropSupersededWrites`.
|
|
31
|
-
*
|
|
32
|
-
* `Object.hasOwn` guards WRITES_IDX_MAP's own `Object.prototype` chain — a
|
|
33
|
-
* channel literally named `constructor`/`toString`/etc. must be treated as
|
|
34
|
-
* regular, not resolve to an inherited function reference.
|
|
35
|
-
*/
|
|
36
|
-
export declare function resolveWriteIndices(writes: PendingWrite[]): ResolvedWrite[];
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveWriteIndices = resolveWriteIndices;
|
|
4
|
-
const langgraph_checkpoint_1 = require("@langchain/langgraph-checkpoint");
|
|
5
|
-
/**
|
|
6
|
-
* Assign every write in one `putWrites` call its sort-key index, in a single
|
|
7
|
-
* pass — nothing recomputes it downstream, which is what used to let the
|
|
8
|
-
* deduped array's positions disagree with the ones the caller's array
|
|
9
|
-
* produced.
|
|
10
|
-
*
|
|
11
|
-
* A regular write's index is its position in the caller's array, exactly as
|
|
12
|
-
* the reference `MemorySaver` computes it: that is what makes stored writes
|
|
13
|
-
* replay in the order the task emitted them. A special channel takes its
|
|
14
|
-
* fixed `WRITES_IDX_MAP` slot instead, and a later duplicate replaces an
|
|
15
|
-
* earlier one (last-write-wins, again matching the reference).
|
|
16
|
-
*
|
|
17
|
-
* Positions are not stable across calls, which is why the *sort key* also
|
|
18
|
-
* carries the channel and each call stamps its rows with a shared
|
|
19
|
-
* `writeGroup` — see {@link buildWriteItems} and `dropSupersededWrites`.
|
|
20
|
-
*
|
|
21
|
-
* `Object.hasOwn` guards WRITES_IDX_MAP's own `Object.prototype` chain — a
|
|
22
|
-
* channel literally named `constructor`/`toString`/etc. must be treated as
|
|
23
|
-
* regular, not resolve to an inherited function reference.
|
|
24
|
-
*/
|
|
25
|
-
function resolveWriteIndices(writes) {
|
|
26
|
-
const bySpecialIndex = new Map();
|
|
27
|
-
const regular = [];
|
|
28
|
-
const occurrences = new Map();
|
|
29
|
-
writes.forEach(([channel, value], positional) => {
|
|
30
|
-
if (Object.hasOwn(langgraph_checkpoint_1.WRITES_IDX_MAP, channel)) {
|
|
31
|
-
const index = langgraph_checkpoint_1.WRITES_IDX_MAP[channel];
|
|
32
|
-
/** Last write wins per special channel, so a call holds exactly one. */
|
|
33
|
-
bySpecialIndex.set(index, { channel, value, index, occurrence: 0 });
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const occurrence = occurrences.get(channel) ?? 0;
|
|
37
|
-
occurrences.set(channel, occurrence + 1);
|
|
38
|
-
regular.push({ channel, value, index: positional, occurrence });
|
|
39
|
-
});
|
|
40
|
-
return [...bySpecialIndex.values(), ...regular];
|
|
41
|
-
}
|