MCPcopy Create free account
hub / github.com/anus-dev/ANUS / newSession

Method newSession

packages/cli/src/zed-integration/zedIntegration.ts:111–140  ·  view source on GitHub ↗
({
    cwd,
    mcpServers,
  }: acp.NewSessionRequest)

Source from the content-addressed store, hash-verified

109 }
110
111 async newSession({
112 cwd,
113 mcpServers,
114 }: acp.NewSessionRequest): Promise<acp.NewSessionResponse> {
115 const sessionId = randomUUID();
116 const config = await this.newSessionConfig(sessionId, cwd, mcpServers);
117
118 let isAuthenticated = false;
119 if (this.settings.merged.selectedAuthType) {
120 try {
121 await config.refreshAuth(this.settings.merged.selectedAuthType);
122 isAuthenticated = true;
123 } catch (e) {
124 console.error(`Authentication failed: ${e}`);
125 }
126 }
127
128 if (!isAuthenticated) {
129 throw acp.RequestError.authRequired();
130 }
131
132 const anusClient = config.getAnusClient();
133 const chat = await anusClient.startChat();
134 const session = new Session(sessionId, chat, config, this.client);
135 this.sessions.set(sessionId, session);
136
137 return {
138 sessionId,
139 };
140 }
141
142 async newSessionConfig(
143 sessionId: string,

Callers

nothing calls this directly

Calls 6

newSessionConfigMethod · 0.95
refreshAuthMethod · 0.80
authRequiredMethod · 0.80
getAnusClientMethod · 0.80
startChatMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected