Conversation
…ng on sharedDispatcher
There was a problem hiding this comment.
Pull request overview
Implements multi-session support for the TypeAgent agentServer by introducing a server-side session registry/manager, session-scoped RPC channels, and updated client/protocol APIs to join/leave and manage sessions.
Changes:
- Added
SessionManagerwith persistedsessions.json, lazy dispatcher restoration, and idle eviction. - Replaced single-join RPC with session lifecycle + CRUD RPC (
joinSession,leaveSession,create/list/rename/deleteSession) and session-namespaced channels (dispatcher:<id>,clientio:<id>). - Updated agent-server client (and browser extension connection) to use the new session protocol and channel naming.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ts/packages/agentServer/server/src/sharedDispatcher.ts | Adds per-connection dispatcher tracking and close/leave helpers for session-aware cleanup. |
| ts/packages/agentServer/server/src/sessionManager.ts | New session pool with persisted metadata, lazy dispatcher init, and idle timeout eviction. |
| ts/packages/agentServer/server/src/server.ts | Wires WebSocket RPC to SessionManager and uses session-scoped channels/methods. |
| ts/packages/agentServer/server/README.md | Updates server docs for session management and startup instructions. |
| ts/packages/agentServer/README.md | Updates top-level architecture docs to describe multi-session behavior and channels. |
| ts/packages/agentServer/protocol/src/protocol.ts | Adds session types/RPC, replaces channel enum with channel-name helpers. |
| ts/packages/agentServer/protocol/src/index.ts | Exports new session types and channel-name helper functions. |
| ts/packages/agentServer/protocol/README.md | Documents new channel naming and session RPC/types. |
| ts/packages/agentServer/client/src/index.ts | Exports connectAgentServer and session-related types. |
| ts/packages/agentServer/client/src/agentServerClient.ts | Implements multi-session client connection + deprecated single-dispatcher wrapper. |
| ts/packages/agentServer/client/README.md | Documents new multi-session client API and deprecation guidance. |
| ts/packages/agents/browser/src/extension/serviceWorker/dispatcherConnection.ts | Updates extension connection to joinSession and session-scoped channels. |
| ts/docs/architecture/agentServerSessions.md | Formatting updates aligning doc with the session protocol. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ts/packages/agents/browser/src/extension/serviceWorker/dispatcherConnection.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ah, you may want to check how displayMessage is being handled. The Chat agent returns streaming repsonses. If displaymode is appending a newline after each message, then you would end up with a linebreak after each word. Check how the regular CLI implementation handles these messages. Check also how the chatPanel in browser code handles these |
Yeah, I will address this in a follow up PR when I handle the implementation for the new behaviors on the CLI and the Shell. For now, this will add the new functionality in the agent server only. |
…d channel cleanup


Implement the agentserver session following https://github.com/microsoft/TypeAgent/blob/main/ts/docs/architecture/agentServerSessions.md
Branched from Curtis' initial implementation https://github.com/curtisman/TypeAgent/tree/session
Shared sessions seen below

Two different CLI connections sharing the existing sessions. Note that the chat history is displayed strangely in other clients which aren't the primary window (will handle it in a later PR with other client changes)

CLI + Shell session commands will be added in a separate PR to demonstrate session isolation.