Skip to content

feat(history): "Added support for maintaning sequence in ai response … - #778

Merged
murdore merged 1 commit into
juspay:releasefrom
naynisinghal1008:BZ-47962-add-support-in-neurolink-to-maintain-sequence-of-hitl-and-uicomponents-in-ai-response-in-chat-history
Jan 15, 2026
Merged

murdore merged 1 commit into
juspay:releasefrom
naynisinghal1008:BZ-47962-add-support-in-neurolink-to-maintain-sequence-of-hitl-and-uicomponents-in-ai-response-in-chat-history

Conversation

@naynisinghal1008

@naynisinghal1008 naynisinghal1008 commented Jan 15, 2026 •

Copy link
Copy Markdown
Contributor

…in Chat History"

Pull Request

Description

What does this PR do?

A clear and concise description of the changes in this pull request.

Related Issues

Does this PR close any issues?

Fixes #(issue number)
Closes #(issue number)
Relates to #(issue number)

Type of Change

Please select the type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement
  • Build/CI configuration
  • Other (please describe):

Motivation and Context

Why is this change needed? What problem does it solve?

Provide context for reviewers:

  • Background information
  • Use case or scenario
  • Links to relevant discussions or documentation
  • Screenshots/GIFs (if UI-related)

Changes Made

What specific changes were made?

Provide a bullet-point list of the key changes:

  • Added X functionality to Y component
  • Modified Z behavior to handle edge case A
  • Updated documentation in file B
  • Refactored C for better performance

Breaking Changes

Does this PR introduce breaking changes?

  • No breaking changes
  • Yes, breaking changes (describe below)

If yes, describe:

  • What breaks?
  • Migration path for users
  • Deprecation warnings added?

Testing

How has this been tested?

Please describe the tests you ran and their results:

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests pass
  • Manual testing completed
  • Tested with multiple providers: [list providers]
  • Tested on multiple platforms: [list platforms]

Test Coverage

  • All new code is covered by tests
  • Existing tests pass
  • Coverage percentage maintained or improved

Manual Testing Steps

Provide steps for manual testing:

  1. Set up environment with [...]
  2. Run command [...]
  3. Verify that [...]
  4. Check that [...]

Code Quality

Have you followed code quality standards?

  • Code follows the project's style guidelines (ESLint passes)
  • Code is properly formatted (Prettier applied)
  • Self-review of code completed
  • No console.log statements (using logger instead)
  • No hardcoded API keys or secrets
  • TypeScript strict mode compliance
  • Proper error handling implemented
  • TODO/FIXME comments reference issues

Documentation

Have you updated documentation?

  • JSDoc comments added/updated for public APIs
  • README.md updated (if needed)
  • Documentation in /docs updated (if needed)
  • Code examples added/updated (if needed)
  • CHANGELOG.md updated (if applicable)
  • Migration guide provided (if breaking changes)

Commit Message Format

Does your commit follow semantic commit conventions?

  • Commit message follows format: type(scope): description
  • Valid type used: feat, fix, docs, style, refactor, test, chore, build, ci, perf, revert
  • Scope specified (e.g., providers, cli, docs, middleware)

Example: feat(providers): add support for LiteLLM proxy

Dependencies

Does this PR add, update, or remove dependencies?

  • No dependency changes
  • Dependencies added (list below)
  • Dependencies updated (list below)
  • Dependencies removed (list below)

If yes, list dependencies and justification:

package-name@version - Reason for adding/updating

Performance Impact

Does this change affect performance?

  • No performance impact
  • Performance improved (provide metrics)
  • Performance degraded (justify why acceptable)

If applicable, provide benchmark results:

Before: X ms
After: Y ms
Improvement: Z%

Security Considerations

Are there any security implications?

  • No security implications
  • Security review needed
  • Security vulnerability fixed

If applicable, describe:

  • Security measures implemented
  • Potential risks mitigated
  • Compliance considerations (HIPAA, SOC2, GDPR)

Deployment Notes

Special deployment instructions?

  • No special deployment steps
  • Requires environment variable changes (list below)
  • Requires database migration
  • Requires Redis schema update
  • Other (describe below)

Screenshots / Videos

If applicable, add screenshots or videos to demonstrate changes:

[Add screenshots or videos here]

Reviewer Checklist

For reviewers:

  • Code follows project style and conventions
  • Changes are well-documented
  • Tests provide adequate coverage
  • No obvious performance issues
  • No security vulnerabilities introduced
  • Breaking changes are properly documented
  • Documentation is clear and accurate

Additional Notes

Any additional information for reviewers:

[Add any extra context, concerns, or questions here]


Pre-submission Checklist

Before submitting, ensure you have:

  • Read and followed the Contributing Guidelines
  • Verified all automated pre-commit checks pass
  • Tested changes locally with pnpm test
  • Built the project successfully with pnpm build
  • Run pnpm run validate:all and all checks pass
  • Reviewed your own code for obvious issues
  • Ensured commit messages follow semantic format
  • Updated relevant documentation
  • Added tests for new functionality
  • Checked that CI/CD pipeline passes (after creating PR)

Thank you for contributing to NeuroLink!

Summary by CodeRabbit

New Features

  • Stream operations now capture and propagate detailed event sequences through conversation memory, enhancing observability, debugging, and message history reconstruction.
  • Added support for registering in-memory MCP servers, expanding integration capabilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes add event tracking and propagation throughout the streaming and conversation storage pipeline. A new StreamEventSequence type captures ordered events during streaming, which are recorded via event listeners and propagated to conversation memory managers for persistence in message history and stream results.

Changes

Cohort / File(s) Summary
Type Definitions
src/lib/types/conversation.ts, src/lib/types/streamTypes.ts, src/lib/types/sdkTypes.ts
Added new public type StreamEventSequence with fields for type, sequence number, and timestamp. Extended ChatMessage and StoreConversationTurnOptions with optional events field. Updated StreamResult interface to include optional events array.
Memory Managers
src/lib/core/conversationMemoryManager.ts, src/lib/core/redisConversationMemoryManager.ts
Both managers now propagate optional events field to assistant messages during storeConversationTurn, preserving event traces in persisted conversation history.
Streaming Core
src/lib/neurolink.ts
Introduced event capture mechanism with listeners for response chunks, tool lifecycle events, and UI components. Events are accumulated in eventSequence during streaming and threaded through to memory storage and stream results. Added new public method addInMemoryMCPServer(). Updated createStreamResponse signature to accept and return optional events array.

Sequence Diagram

sequenceDiagram
    participant Stream as Stream Handler
    participant Listeners as Event Listeners
    participant EventSeq as Event Sequence
    participant Memory as Memory Manager
    participant Result as Stream Result

    Stream->>Listeners: Register event listeners (response:chunk, tool:start/end, etc.)
    
    loop During Streaming
        Stream->>Listeners: Emit events
        Listeners->>EventSeq: captureEvent(type, data)
        EventSeq->>EventSeq: Store {type, seq, timestamp, ...data}
    end
    
    Stream->>Stream: processedStream complete
    EventSeq->>Memory: storeConversationTurn({events: eventSequence})
    Memory->>Memory: Persist assistant message with events
    
    EventSeq->>Result: Attach events to StreamResult
    Listeners->>Listeners: Detach all listeners
    Result->>Result: Return StreamResult with events array
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

released

Suggested reviewers

  • murdore

Poem

🐰 Events now flow like streams through rabbit warren,
Each moment captured, no trace shall be forsaken,
From tool to tool and turn to memory's keeping,
The rabbit whispers secrets, forever deep in safekeeping! 🐇✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions maintaining sequence in AI response in Chat History, which directly corresponds to the core changes: adding event tracking and propagation through streaming paths to preserve observable event context in conversation history.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@naynisinghal1008
naynisinghal1008 force-pushed the BZ-47962-add-support-in-neurolink-to-maintain-sequence-of-hitl-and-uicomponents-in-ai-response-in-chat-history branch from 9777b60 to 85625e9 Compare January 15, 2026 18:51
@murdore
murdore force-pushed the BZ-47962-add-support-in-neurolink-to-maintain-sequence-of-hitl-and-uicomponents-in-ai-response-in-chat-history branch from 85625e9 to 33ac197 Compare January 15, 2026 19:58
@murdore
murdore merged commit e29fcae into juspay:release Jan 15, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 8.35.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants