(
request: ApprovalRequest & { sessionId: string; agentId: string },
)
| 696 | } |
| 697 | |
| 698 | async requestApproval( |
| 699 | request: ApprovalRequest & { sessionId: string; agentId: string }, |
| 700 | ): Promise<ApprovalResponse> { |
| 701 | const handler = this.approvalHandlers.get(request.sessionId); |
| 702 | if (handler === undefined) { |
| 703 | return { |
| 704 | decision: 'cancelled', |
| 705 | feedback: 'No approval handler registered.', |
| 706 | }; |
| 707 | } |
| 708 | |
| 709 | try { |
| 710 | return await handler(request); |
| 711 | } catch (error) { |
| 712 | this.receiveEvent({ |
| 713 | type: 'error', |
| 714 | sessionId: request.sessionId, |
| 715 | agentId: request.agentId, |
| 716 | ...makeErrorPayload(ErrorCodes.SESSION_APPROVAL_HANDLER_ERROR, errorMessage(error)), |
| 717 | }); |
| 718 | return { |
| 719 | decision: 'cancelled', |
| 720 | feedback: 'Approval handler failed.', |
| 721 | }; |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | async requestQuestion( |
| 726 | request: QuestionRequest & { sessionId: string; agentId: string }, |
nothing calls this directly
no test coverage detected