MCPcopy
hub / github.com/coder/mux / getOrCreateSession

Method getOrCreateSession

src/node/services/workspaceService.ts:2745–2768  ·  view source on GitHub ↗
(workspaceId: string)

Source from the content-addressed store, hash-verified

2743 }
2744
2745 public getOrCreateSession(workspaceId: string): AgentSession {
2746 assert(typeof workspaceId === "string", "workspaceId must be a string");
2747 const trimmed = workspaceId.trim();
2748 assert(trimmed.length > 0, "workspaceId must not be empty");
2749
2750 let session = this.sessions.get(trimmed);
2751 if (session) {
2752 return session;
2753 }
2754
2755 session = this.transientStartupRecoverySessions.get(trimmed);
2756 if (session) {
2757 this.transientStartupRecoverySessions.delete(trimmed);
2758 this.sessions.set(trimmed, session);
2759 this.attachSessionSubscriptions(trimmed, session);
2760 return session;
2761 }
2762
2763 session = this.createSession(trimmed);
2764 this.sessions.set(trimmed, session);
2765 this.attachSessionSubscriptions(trimmed, session);
2766
2767 return session;
2768 }
2769
2770 async waitForWorkspaceIdle(
2771 workspaceId: string,

Callers 15

createMethod · 0.95
createMultiProjectMethod · 0.95
forkMethod · 0.95
sendMessageMethod · 0.95
resumeStreamMethod · 0.95
setAutoRetryEnabledMethod · 0.95
interruptStreamMethod · 0.95
answerAskUserQuestionMethod · 0.95
clearQueueMethod · 0.95

Calls 6

createSessionMethod · 0.95
setMethod · 0.80
getMethod · 0.65
assertFunction · 0.50
deleteMethod · 0.45

Tested by

no test coverage detected