()
| 2498 | } |
| 2499 | |
| 2500 | private attachConnectionHandlers(): void { |
| 2501 | if (!this.connection) { |
| 2502 | return; |
| 2503 | } |
| 2504 | |
| 2505 | this.connection.onNotification("session.event", (notification: unknown) => { |
| 2506 | this.handleSessionEventNotification(notification); |
| 2507 | }); |
| 2508 | |
| 2509 | this.connection.onNotification("session.lifecycle", (notification: unknown) => { |
| 2510 | this.handleSessionLifecycleNotification(notification); |
| 2511 | }); |
| 2512 | |
| 2513 | this.connection.onRequest( |
| 2514 | "userInput.request", |
| 2515 | async (params: { |
| 2516 | sessionId: string; |
| 2517 | question: string; |
| 2518 | choices?: string[]; |
| 2519 | allowFreeform?: boolean; |
| 2520 | }): Promise<{ answer: string; wasFreeform: boolean }> => |
| 2521 | await this.handleUserInputRequest(params) |
| 2522 | ); |
| 2523 | |
| 2524 | this.connection.onRequest( |
| 2525 | "exitPlanMode.request", |
| 2526 | async ( |
| 2527 | params: ExitPlanModeRequest & { sessionId: string } |
| 2528 | ): Promise<ExitPlanModeResult> => await this.handleExitPlanModeRequest(params) |
| 2529 | ); |
| 2530 | |
| 2531 | this.connection.onRequest( |
| 2532 | "autoModeSwitch.request", |
| 2533 | async ( |
| 2534 | params: AutoModeSwitchRequest & { sessionId: string } |
| 2535 | ): Promise<{ response: AutoModeSwitchResponse }> => |
| 2536 | await this.handleAutoModeSwitchRequest(params) |
| 2537 | ); |
| 2538 | |
| 2539 | this.connection.onRequest( |
| 2540 | "hooks.invoke", |
| 2541 | async (params: { |
| 2542 | sessionId: string; |
| 2543 | hookType: string; |
| 2544 | input: unknown; |
| 2545 | }): Promise<{ output?: unknown }> => await this.handleHooksInvoke(params) |
| 2546 | ); |
| 2547 | |
| 2548 | this.connection.onRequest( |
| 2549 | "systemMessage.transform", |
| 2550 | async (params: { |
| 2551 | sessionId: string; |
| 2552 | sections: Record<string, { content: string }>; |
| 2553 | }): Promise<{ sections: Record<string, { content: string }> }> => |
| 2554 | await this.handleSystemMessageTransform(params) |
| 2555 | ); |
| 2556 | |
| 2557 | // Register client session API handlers. |
no test coverage detected