(
request: FormElicitation | UrlElicitation,
formatResult: (response: {
action: string;
content?: Record<string, unknown>;
meta?: { readonly persist?: string };
}) => unknown = (r) => r.action,
)
| 196 | |
| 197 | /** Build an engine whose execute triggers one elicitation and returns the handler's result. */ |
| 198 | const makeElicitingEngine = ( |
| 199 | request: FormElicitation | UrlElicitation, |
| 200 | formatResult: (response: { |
| 201 | action: string; |
| 202 | content?: Record<string, unknown>; |
| 203 | meta?: { readonly persist?: string }; |
| 204 | }) => unknown = (r) => r.action, |
| 205 | ): ExecutionEngine => |
| 206 | makeStubEngine({ |
| 207 | execute: (_code, { onElicitation }) => |
| 208 | Effect.gen(function* () { |
| 209 | const response = yield* onElicitation({ |
| 210 | address: STUB_TOOL_ADDRESS, |
| 211 | args: {}, |
| 212 | request, |
| 213 | }); |
| 214 | return { result: formatResult(response) }; |
| 215 | }), |
| 216 | }); |
| 217 | |
| 218 | // --------------------------------------------------------------------------- |
| 219 | // Explicit native elicitation mode |
no test coverage detected