MCPcopy Create free account
hub / github.com/coder/mux / registerSession

Method registerSession

src/node/services/workspaceService.ts:2807–2817  ·  view source on GitHub ↗

* Register an externally-created AgentSession so that WorkspaceService * operations (sendMessage, resumeStream, remove, etc.) reuse it instead of * creating a duplicate. Used by `mux run` CLI to keep a single session * instance for the parent workspace.

(workspaceId: string, session: AgentSession)

Source from the content-addressed store, hash-verified

2805 * instance for the parent workspace.
2806 */
2807 public registerSession(workspaceId: string, session: AgentSession): void {
2808 workspaceId = workspaceId.trim();
2809 assert(workspaceId.length > 0, "workspaceId must not be empty");
2810 assert(!this.sessions.has(workspaceId), `session already registered for ${workspaceId}`);
2811 if (this.transientStartupRecoverySessions.get(workspaceId) === session) {
2812 this.transientStartupRecoverySessions.delete(workspaceId);
2813 }
2814
2815 this.sessions.set(workspaceId, session);
2816 this.attachSessionSubscriptions(workspaceId, session);
2817 }
2818
2819 public emitChatEvent(workspaceId: string, message: WorkspaceChatMessage): void {
2820 const trimmed = workspaceId.trim();

Callers 2

startStartupRecoveryMethod · 0.95

Calls 6

setMethod · 0.80
getMethod · 0.65
assertFunction · 0.50
hasMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected