MCPcopy Index your code
hub / github.com/github/copilot-sdk / initializeSession

Method initializeSession

nodejs/src/client.ts:1324–1363  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

1322 // Creates the session object, wires up handlers, and registers it in
1323 // the sessions map.
1324 const initializeSession = (sessionId: string): CopilotSession => {
1325 const s = new CopilotSession(
1326 sessionId,
1327 this.connection!,
1328 undefined,
1329 this.onGetTraceContext,
1330 { mcpAuthHandler: config.onMcpAuthRequest }
1331 );
1332 s.registerTools(config.tools);
1333 s.registerCanvases(config.canvases);
1334 s.registerCommands(config.commands);
1335 if (bearerTokenCallbacks.size > 0) {
1336 s.registerBearerTokenProviders(bearerTokenCallbacks);
1337 }
1338 s.registerPermissionHandler(config.onPermissionRequest);
1339 if (config.onUserInputRequest) {
1340 s.registerUserInputHandler(config.onUserInputRequest);
1341 }
1342 if (config.onElicitationRequest) {
1343 s.registerElicitationHandler(config.onElicitationRequest);
1344 }
1345 if (config.onExitPlanModeRequest) {
1346 s.registerExitPlanModeHandler(config.onExitPlanModeRequest);
1347 }
1348 if (config.onAutoModeSwitchRequest) {
1349 s.registerAutoModeSwitchHandler(config.onAutoModeSwitchRequest);
1350 }
1351 if (config.hooks) {
1352 s.registerHooks(config.hooks);
1353 }
1354 if (transformCallbacks) {
1355 s.registerTransformCallbacks(transformCallbacks);
1356 }
1357 if (config.onEvent) {
1358 s.on(config.onEvent);
1359 }
1360 this.sessions.set(sessionId, s);
1361 this.setupSessionFs(s, config);
1362 return s;
1363 };
1364
1365 let session: CopilotSession | undefined;
1366 let registeredId: string | undefined;

Callers

nothing calls this directly

Calls 14

registerToolsMethod · 0.95
registerCanvasesMethod · 0.95
registerCommandsMethod · 0.95
registerHooksMethod · 0.95
onMethod · 0.95

Tested by

no test coverage detected