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

Method handleSessionLifecycleNotification

nodejs/src/client.ts:2596–2649  ·  view source on GitHub ↗
(notification: unknown)

Source from the content-addressed store, hash-verified

2594 }
2595
2596 private handleSessionLifecycleNotification(notification: unknown): void {
2597 if (
2598 typeof notification !== "object" ||
2599 !notification ||
2600 !("type" in notification) ||
2601 typeof (notification as { type?: unknown }).type !== "string" ||
2602 !("sessionId" in notification) ||
2603 typeof (notification as { sessionId?: unknown }).sessionId !== "string"
2604 ) {
2605 return;
2606 }
2607
2608 const raw = notification as {
2609 type: SessionLifecycleEventType;
2610 sessionId: string;
2611 metadata?: { startTime?: string; modifiedTime?: string; summary?: string };
2612 };
2613
2614 let metadata: SessionLifecycleEvent["metadata"];
2615 if (raw.metadata && raw.metadata.startTime && raw.metadata.modifiedTime) {
2616 metadata = {
2617 startTime: new Date(raw.metadata.startTime),
2618 modifiedTime: new Date(raw.metadata.modifiedTime),
2619 summary: raw.metadata.summary,
2620 };
2621 }
2622
2623 const event = {
2624 type: raw.type,
2625 sessionId: raw.sessionId,
2626 metadata,
2627 } as SessionLifecycleEvent;
2628
2629 // Dispatch to typed handlers for this specific event type
2630 const typedHandlers = this.typedLifecycleHandlers.get(event.type);
2631 if (typedHandlers) {
2632 for (const handler of typedHandlers) {
2633 try {
2634 handler(event);
2635 } catch {
2636 // Ignore handler errors
2637 }
2638 }
2639 }
2640
2641 // Dispatch to wildcard handlers
2642 for (const handler of this.sessionLifecycleHandlers) {
2643 try {
2644 handler(event);
2645 } catch {
2646 // Ignore handler errors
2647 }
2648 }
2649 }
2650
2651 private async handleUserInputRequest(params: {
2652 sessionId: string;

Callers 1

Calls 2

handlerFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected