* Gets metadata for a specific session by ID. * * This provides an efficient O(1) lookup of a single session's metadata * instead of listing all sessions. Returns undefined if the session is not found. * * @param sessionId - The ID of the session to look up * @returns A
(sessionId: string)
| 1980 | * ``` |
| 1981 | */ |
| 1982 | async getSessionMetadata(sessionId: string): Promise<SessionMetadata | undefined> { |
| 1983 | if (!this.connection) { |
| 1984 | throw new Error("Client not connected"); |
| 1985 | } |
| 1986 | |
| 1987 | const response = await this.connection.sendRequest("session.getMetadata", { sessionId }); |
| 1988 | const { session } = response as { |
| 1989 | session?: { |
| 1990 | sessionId: string; |
| 1991 | startTime: string; |
| 1992 | modifiedTime: string; |
| 1993 | summary?: string; |
| 1994 | isRemote: boolean; |
| 1995 | context?: { cwd: string; gitRoot?: string; repository?: string; branch?: string }; |
| 1996 | }; |
| 1997 | }; |
| 1998 | |
| 1999 | if (!session) { |
| 2000 | return undefined; |
| 2001 | } |
| 2002 | |
| 2003 | return CopilotClient.toSessionMetadata(session); |
| 2004 | } |
| 2005 | |
| 2006 | private static toSessionMetadata(raw: { |
| 2007 | sessionId: string; |
no test coverage detected