| 235 | async send(prompt: string): Promise<string>; |
| 236 | async send(options: MessageOptions): Promise<string>; |
| 237 | async send(optionsOrPrompt: MessageOptions | string): Promise<string> { |
| 238 | const options: MessageOptions = |
| 239 | typeof optionsOrPrompt === "string" ? { prompt: optionsOrPrompt } : optionsOrPrompt; |
| 240 | const response = await this.connection.sendRequest("session.send", { |
| 241 | ...(await getTraceContext(this.traceContextProvider)), |
| 242 | sessionId: this.sessionId, |
| 243 | prompt: options.prompt, |
| 244 | displayPrompt: options.displayPrompt, |
| 245 | attachments: options.attachments, |
| 246 | mode: options.mode, |
| 247 | agentMode: options.agentMode, |
| 248 | requestHeaders: options.requestHeaders, |
| 249 | }); |
| 250 | |
| 251 | return (response as { messageId: string }).messageId; |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Sends a message to this session and waits until the session becomes idle. |