feat(chat): introduce unified History API with user, thread, and chan…#592
Open
oss-polar-bear wants to merge 2 commits into
Open
feat(chat): introduce unified History API with user, thread, and chan…#592oss-polar-bear wants to merge 2 commits into
oss-polar-bear wants to merge 2 commits into
Conversation
…nel scopes Add bot.history as the canonical entry point while keeping bot.transcripts as a deprecated alias, with docs, tests, and a changeset for the migration path.
Contributor
|
@oss-polar-bear is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Introduces a unified bot.history API (user/thread/channel scopes) and migrates existing transcripts functionality to the new namespace while keeping bot.transcripts as a deprecated alias.
Changes:
- Add
HistoryApitypes + implementations (history.user,history.thread,history.channel) and wire them intoChat. - Deprecate
transcripts/identitytop-level config in favor ofhistory.user.identity, with runtime compatibility preserved. - Update AI tools, tests, examples, and docs to use the new History API.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/chat/src/types.ts | Adds unified History types/config + deprecations/aliases. |
| packages/chat/src/chat.ts | Wires HistoryApiImpl into Chat, makes transcripts delegate to history.user. |
| packages/chat/src/history/index.ts | Implements HistoryApiImpl facade composing user/thread/channel sub-APIs. |
| packages/chat/src/history/user.ts | Moves transcripts storage impl to UserHistoryApiImpl (same storage keys). |
| packages/chat/src/history/thread.ts | Adds per-thread history helper with adapter delegation + cache fallback. |
| packages/chat/src/history/channel.ts | Adds channel history helper incl. thread listing + convenience fetch. |
| packages/chat/src/transcripts.ts | Replaces legacy module with deprecated alias export. |
| packages/chat/src/*test.ts | Migrates tests and adds coverage for new history modules. |
| packages/chat/src/ai/tools/threads.ts | Refactors tools to call chat.history.* APIs. |
| apps/docs/content/docs/** | Adds History guide/reference and updates existing pages for migration. |
| examples/nextjs-chat/src/lib/bot.tsx | Updates example bot to use history.user and HistoryEntry. |
| .changeset/history-api.md | Declares minor version bump for new History API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix test module imports, clamp collect() page size, clarify types and transcripts module docs, and align ChannelHistoryApi throw documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add bot.history as the canonical entry point while keeping bot.transcripts as a deprecated alias, with docs, tests, and a changeset for the migration path.