You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(chat): Transcripts API + rename message history cache to thread_history (vercel/chat#448)
Port of upstream 46d183b (chat@4.29.0).
Rename (with back-compat, mirroring upstream):
- message_history.py -> thread_history.py; MessageHistoryCache ->
ThreadHistoryCache. Old module path kept as a deprecated re-export shim.
- ChatConfig.thread_history added; deprecated ChatConfig.message_history
still read, thread_history wins when both are set.
- Adapter.persist_thread_history added; deprecated persist_message_history
still honored (either flag enables persistence). Telegram and WhatsApp
adapters switch to the new flag, matching upstream.
- State storage key prefix "msg-history:" is deliberately unchanged so
existing persisted data is not orphaned.
New Transcripts API:
- transcripts.py: TranscriptsApiImpl (append/list/count/delete) keyed by a
cross-platform user key, backed by StateAdapter.append_to_list. delete()
writes a tombstone via append_to_list(max_length=1) because state.delete
only addresses the k/v namespace on non-memory adapters.
- ChatConfig.transcripts + ChatConfig.identity (IdentityResolver); the
constructor raises when transcripts is set without identity. Inbound
dispatch resolves message.user_key once per message via the resolver.
- chat.transcripts accessor raises when not configured (fail loudly).
- New types: TranscriptEntry, TranscriptsConfig, TranscriptRole,
AppendInput, AppendOptions, ListQuery, CountQuery, DeleteTarget,
DeleteResult, IdentityContext, IdentityResolver, DurationString.
Tests: test_message_history.py renamed to test_thread_history.py (names
aligned to thread-history.test.ts titles, deprecated-alias test added);
chat.test.ts persistThreadHistory block ported into test_chat_faithful.py;
new test_transcripts.py and test_transcripts_wiring.py port
transcripts.test.ts and transcripts-wiring.test.ts 1:1.
https://claude.ai/code/session_013zwTcMek5rNqBTQvs2oF64
(cherry picked from commit 765420dc4d21804b19f1d8eccddebc3a392b0e61)
0 commit comments