feat: add WebSocket session lifecycle protocol and provider rebind#186
Closed
bbsngg wants to merge 1 commit intosplit/c-server-config-migrationfrom
Closed
feat: add WebSocket session lifecycle protocol and provider rebind#186bbsngg wants to merge 1 commit intosplit/c-server-config-migrationfrom
bbsngg wants to merge 1 commit intosplit/c-server-config-migrationfrom
Conversation
Add standardized session lifecycle protocol messages to the WebSocket layer so clients can track session state transitions reliably. Server changes: - Extract session lifecycle helpers to server/utils/sessionLifecycle.js (provider inference, projectName resolution, payload enrichment) - WebSocketWriter.send() auto-enriches session events with projectName and emits session-state-changed lifecycle messages - Add sendSessionAccepted/sendSessionBusy/sendSessionStateChanged helpers in the chat connection handler - Add WebSocket writer rebind on reconnect (replaceSocket) so active sessions survive client reconnections Provider changes (all 7 providers): - Store writer reference in active session map - Add rebindXxxSessionWriter() for reconnect support - Include projectName in session-created events - Fix cursor-cli to emit cursor-complete (was claude-complete) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
3 tasks
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.
Summary
session-accepted,session-busy,session-state-changedserver/utils/sessionLifecycle.js(provider inference, projectName resolution, payload enrichment)rebindXxxSessionWriter()for reconnect, includeprojectNameinsession-createdcursor-complete(was incorrectlyclaude-complete)Part of the session lifecycle PR split (4/6). Depends on #185 (config migration) for
encodeProjectPath.Test plan
node --check server/index.js server/claude-sdk.js server/cursor-cli.js server/gemini-cli.js server/openai-codex.jspassesnpx vitest run server/__tests__/session-lifecycle.test.mjs server/__tests__/codex-session-events.test.mjspassessession-acceptedbefore provider streaming begins🤖 Generated with Claude Code