Skip to content

Dev/georgeng/agentserver session#2130

Open
GeorgeNgMsft wants to merge 13 commits intomainfrom
dev/georgeng/agentserver_session
Open

Dev/georgeng/agentserver session#2130
GeorgeNgMsft wants to merge 13 commits intomainfrom
dev/georgeng/agentserver_session

Conversation

@GeorgeNgMsft
Copy link
Copy Markdown
Contributor

@GeorgeNgMsft GeorgeNgMsft commented Apr 3, 2026

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
image

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)
image

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SessionManager with persisted sessions.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.

@GeorgeNgMsft GeorgeNgMsft marked this pull request as ready for review April 4, 2026 02:32
@GeorgeNgMsft GeorgeNgMsft requested a review from Copilot April 4, 2026 02:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hillary-mutisya
Copy link
Copy Markdown
Collaborator

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 image

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. image

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

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

@GeorgeNgMsft
Copy link
Copy Markdown
Contributor Author

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 image
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. image
CLI + Shell session commands will be added in a separate PR to demonstrate session isolation.

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.

@GeorgeNgMsft GeorgeNgMsft deployed to development-fork April 4, 2026 06:59 — with GitHub Actions Active
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.

4 participants