Skip to content

Conversation

xizhibei
Copy link
Contributor

@xizhibei xizhibei commented Oct 18, 2025

Summary

Implements session restoration for streamable HTTP transport, allowing clients to reconnect and maintain state across connections.

Key Features

  • Session Restoration: Persistent sessions with 24-hour TTL
  • Storage Organization: Subdirectory structure (server/client/transport)
  • Migration Logic: Automatic migration from flat file structure
  • Enhanced API: GET/POST/DELETE endpoints for session management

Changes

  • Added StreamableSessionRepository and StreamableSessionData interface
  • Implemented storage subdirectory organization with migration
  • Enhanced streamable HTTP endpoints with session support
  • Added comprehensive test coverage (200+ new tests)

Breaking Changes

None - maintains backward compatibility with automatic migration.

- Added StreamableSessionRepository for managing streamable HTTP session persistence, including creation, retrieval, updating access, and deletion of sessions.
- Introduced StreamableSessionData interface to define the structure of streamable session data.
- Enhanced ExpressServer to utilize StreamableSessionRepository for session handling, allowing restoration of sessions from persistent storage.
- Updated streamable HTTP routes to support session restoration and management, ensuring seamless user experience across server restarts.
- Added unit tests for StreamableSessionRepository to validate session operations and data integrity.
- Enhanced FileStorageService to support optional subdirectories for session storage, allowing better organization of session files.
- Updated SDKOAuthClientProvider and OAuthStorageService to utilize the new subdirectory feature.
- Implemented migration logic to move existing session files into appropriate subdirectories based on their prefixes.
- Added unit tests to verify correct behavior of subdirectory creation and file migration.
- Adjusted related tests to reflect changes in file path handling for session storage.
…n constants

- Added migration flag creation logic to the FileStorageService, ensuring proper handling of old file structures.
- Implemented methods to utilize FILE_PREFIX_MAPPING and STORAGE_SUBDIRS for improved file organization during migration.
- Added unit tests to verify migration behavior, including scenarios for existing flags and error handling.
- Refactored ID validation logic to use a new helper method for better maintainability.
- Updated tests to reflect changes in migration and configuration integration.
@xizhibei xizhibei changed the title Feat/session restore feat: implement session restore functionality for streamable HTTP transport Oct 19, 2025
- Updated migration logic in FileStorageService to handle independent migrations for server and client session files.
- Introduced migration flags for both server and client directories to track migration status.
- Enhanced unit tests to verify migration behavior, including scenarios for independent migrations and the handling of transport files.
- Refactored methods to improve clarity and maintainability of the migration process.
- Updated session restoration logic to retrieve session data more clearly and set the transport as initialized to allow restored sessions to function correctly.
- Enhanced unit tests for streamable HTTP routes to include new initialization checks and ensure proper setup of async orchestrator.
- Improved clarity in test assertions regarding transport creation and connection verification.
@xizhibei xizhibei changed the title feat: implement session restore functionality for streamable HTTP transport feat: session restore for streamable HTTP transport Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant