( companion: Companion, onReaction: (reaction: string) => void, )
| 482 | } |
| 483 | |
| 484 | export async function fireHatchReaction( |
| 485 | companion: Companion, |
| 486 | onReaction: (reaction: string) => void, |
| 487 | ): Promise<void> { |
| 488 | if (getGlobalConfig().companionMuted) { |
| 489 | return |
| 490 | } |
| 491 | |
| 492 | lastReactionAt = Date.now() |
| 493 | try { |
| 494 | const reaction = await postBuddyReaction( |
| 495 | companion, |
| 496 | (await buildHatchContext()) || '(fresh project, nothing to see yet)', |
| 497 | 'hatch', |
| 498 | [], |
| 499 | false, |
| 500 | AbortSignal.timeout(BUDDY_REQUEST_TIMEOUT_MS), |
| 501 | ) |
| 502 | if (!reaction) { |
| 503 | return |
| 504 | } |
| 505 | pushRecentReaction(reaction) |
| 506 | onReaction(reaction) |
| 507 | } catch {} |
| 508 | } |
| 509 | |
| 510 | export async function firePetReaction( |
| 511 | onReaction: (reaction: string) => void, |
no test coverage detected