(
address: ToolAddress,
args: unknown,
handler: ElicitationHandler,
)
| 6336 | : defaultElicitationHandler; |
| 6337 | |
| 6338 | const buildElicit = ( |
| 6339 | address: ToolAddress, |
| 6340 | args: unknown, |
| 6341 | handler: ElicitationHandler, |
| 6342 | ): Elicit => { |
| 6343 | return (request: ElicitationRequest) => |
| 6344 | Effect.gen(function* () { |
| 6345 | const response: ElicitationResponse = yield* handler({ |
| 6346 | address, |
| 6347 | args, |
| 6348 | request, |
| 6349 | source: "tool", |
| 6350 | }); |
| 6351 | if (response.action !== "accept") { |
| 6352 | return yield* new ElicitationDeclinedError({ |
| 6353 | address, |
| 6354 | action: response.action, |
| 6355 | }); |
| 6356 | } |
| 6357 | return response; |
| 6358 | }); |
| 6359 | }; |
| 6360 | |
| 6361 | // The single source of truth for "will enforceApproval pause this call". |
| 6362 | // Read before pre-approval arg validation so the extra validation pass |
no test coverage detected