MCPcopy Create free account
hub / github.com/github/copilot-sdk / getFinalAssistantMessage

Function getFinalAssistantMessage

nodejs/test/e2e/harness/sdkTestHelper.ts:7–23  ·  view source on GitHub ↗
(
    session: CopilotSession,
    { alreadyIdle = false }: { alreadyIdle?: boolean } = {}
)

Source from the content-addressed store, hash-verified

5import { AssistantMessageEvent, CopilotSession, SessionEvent } from "../../../src";
6
7export async function getFinalAssistantMessage(
8 session: CopilotSession,
9 { alreadyIdle = false }: { alreadyIdle?: boolean } = {}
10): Promise<AssistantMessageEvent> {
11 // Install the live subscription (via getFutureFinalResponse) before issuing the
12 // existing-messages RPC so we don't miss events that arrive while that RPC is in flight.
13 const futurePromise = getFutureFinalResponse(session);
14 // We may end up returning from the existing-messages path; attach a noop handler so
15 // the unawaited future-response rejection doesn't surface as an unhandled rejection.
16 futurePromise.catch(() => {});
17
18 const existing = await getExistingFinalResponse(session, alreadyIdle);
19 if (existing) {
20 return existing;
21 }
22 return futurePromise;
23}
24
25async function getExistingFinalResponse(
26 session: CopilotSession,

Callers 3

Calls 2

getFutureFinalResponseFunction · 0.85
getExistingFinalResponseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…