(
host: HostConnection,
message: Extract<RuntimeHostToMainMessage, { type: 'response' }>,
)
| 230 | } |
| 231 | |
| 232 | function handleHostResponseMessage( |
| 233 | host: HostConnection, |
| 234 | message: Extract<RuntimeHostToMainMessage, { type: 'response' }>, |
| 235 | ) { |
| 236 | const pending = host.pendingRequests.get(message.id) |
| 237 | if (!pending) return |
| 238 | host.pendingRequests.delete(message.id) |
| 239 | if ( |
| 240 | pending.name === 'sendComposerPrompt' && |
| 241 | (!message.ok || getHostSendOutcome(message) !== 'sent') |
| 242 | ) { |
| 243 | host.busy = false |
| 244 | } |
| 245 | scheduleThreadHostIdleStop(host) |
| 246 | if (message.ok) { |
| 247 | pending.resolve(message.result) |
| 248 | return |
| 249 | } |
| 250 | const error = new Error(message.error) |
| 251 | if (message.stack) error.stack = message.stack |
| 252 | pending.reject(error) |
| 253 | } |
| 254 | |
| 255 | function handleHostMessage(host: HostConnection, message: RuntimeHostToMainMessage) { |
| 256 | if (!message || typeof message !== 'object') return |
no test coverage detected