Post a picker and wait until an interaction in this conversation resolves it.
(ui: Renderable)
| 274 | |
| 275 | /** Post a picker and wait until an interaction in this conversation resolves it. */ |
| 276 | async awaitChoice<T = unknown>(ui: Renderable): Promise<T> { |
| 277 | const p = new Promise<T>((resolve) => |
| 278 | this.deps.registerWaiter( |
| 279 | this.deps.conversationKey, |
| 280 | resolve as (value: unknown) => void, |
| 281 | ), |
| 282 | ); |
| 283 | await this.post(ui); |
| 284 | return p; |
| 285 | } |
| 286 | |
| 287 | async runAgent(input?: { |
| 288 | context?: ContextEntry[]; |