(
address: ToolAddress,
args: unknown,
handler: ElicitationHandler,
)
| 6244 | : defaultElicitationHandler; |
| 6245 | |
| 6246 | const buildElicit = ( |
| 6247 | address: ToolAddress, |
| 6248 | args: unknown, |
| 6249 | handler: ElicitationHandler, |
| 6250 | ): Elicit => { |
| 6251 | return (request: ElicitationRequest) => |
| 6252 | Effect.gen(function* () { |
| 6253 | const response: ElicitationResponse = yield* handler({ |
| 6254 | address, |
| 6255 | args, |
| 6256 | request, |
| 6257 | source: "tool", |
| 6258 | }); |
| 6259 | if (response.action !== "accept") { |
| 6260 | return yield* new ElicitationDeclinedError({ |
| 6261 | address, |
| 6262 | action: response.action, |
| 6263 | }); |
| 6264 | } |
| 6265 | return response; |
| 6266 | }); |
| 6267 | }; |
| 6268 | |
| 6269 | // The single source of truth for "will enforceApproval pause this call". |
| 6270 | // Read before pre-approval arg validation so the extra validation pass |
no test coverage detected