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

Function joinSession

nodejs/src/extension.ts:47–71  ·  view source on GitHub ↗
(config: JoinSessionConfig = {})

Source from the content-addressed store, hash-verified

45 * ```
46 */
47export async function joinSession(config: JoinSessionConfig = {}): Promise<CopilotSession> {
48 const sessionId = process.env.SESSION_ID;
49 if (!sessionId) {
50 throw new Error(
51 "joinSession() is intended for extensions running as child processes of the Copilot CLI."
52 );
53 }
54
55 const client = new CopilotClient({ _internalConnection: { kind: "parent-process" } });
56
57 // Strip `extensionSdkPath` at runtime even though `JoinSessionConfig` omits it
58 // at the type level — untyped (JS) callers can still slip it through, and
59 // honoring it here would be misleading since the extension subprocess has
60 // already been forked by the host with the SDK the host chose.
61 const { extensionSdkPath: _stripped, ...rest } = config as JoinSessionConfig & {
62 extensionSdkPath?: string;
63 };
64 void _stripped;
65
66 return client.resumeSession(sessionId, {
67 ...rest,
68 onPermissionRequest: config.onPermissionRequest ?? defaultJoinSessionPermissionHandler,
69 suppressResumeEvent: config.suppressResumeEvent ?? true,
70 });
71}

Callers 1

extension.test.tsFile · 0.90

Calls 1

resumeSessionMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…