Feat/checkpoint#33
Open
gyash1512 wants to merge 6 commits into
Open
Conversation
sharananurag998
requested changes
Sep 26, 2025
|
|
||
| export const generateMessageId = (): MessageId => { | ||
| // Simple, deterministic-safe generator without external deps | ||
| const rand = Math.random().toString(36).slice(2, 10); |
Collaborator
There was a problem hiding this comment.
Math.random() is not crypto-strong. Use crypto.randomUUID()
| schema: { | ||
| body: { | ||
| type: 'object', | ||
| properties: { |
Collaborator
There was a problem hiding this comment.
the endpoint accepts multiple selectors simultaneously. enforce exactly one selector or log which was applied
Use oneOf in the schema to ensure a single selector.
| const updatedConversation: ConversationMemory = { | ||
| ...conversation, | ||
| messages: newMessages, | ||
| metadata: { |
Collaborator
There was a problem hiding this comment.
Metadata merge can overwrite fresh fields. You spread old metadata after setting updatedAt/lastActivity/totalMessages. Swap the order to preserve new values.
metadata: {
...(conversation.metadata ? { ...conversation.metadata } : {}),
createdAt: conversation.metadata?.createdAt ?? now,
updatedAt: now,
lastActivity: now,
totalMessages: newMessages.length
}
Co-authored-by: Anurag Sharan <34830688+sharananurag998@users.noreply.github.com>
…feat/checkpoint
7fbbb18 to
e05de49
Compare
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.
This pull request introduces robust support for message IDs throughout the conversation engine and memory providers, ensuring all messages (user, assistant, and tool) are consistently assigned unique identifiers. It also adds a checkpoint restoration feature to the in-memory memory provider, allowing conversations to be reverted to a specific user message using various criteria. Additionally, a demo server is provided to showcase the checkpoint functionality with helpful usage instructions.