feat(hn-monitor): unify Slack + Telegram into single dual-transport agent

Merged
KH
4mo ago
+635-241

Summary

Replaces the separate hn-monitor and hn-monitor-telegram directories with a single agent that delivers to Slack, Telegram, or both — configuration-driven via SLACK_CHANNEL and TELEGRAM_CHAT inputs (both optional).

Depends on workforce#250 for the @agentworkforce/delivery package.

Changes

  • Single agent.ts — imports createDelivery from @agentworkforce/delivery, auto-detects configured transports
  • Non-blocking parentRef threading — header published with 0ms timeout, body threaded via parentRef (x-reply-radar pattern)
  • Backported Telegram improvements: fetchWithTimeout (8s AbortController), withTimeout for LLM, pending thread body recovery
  • Shared helpers (input, list, withTimeout, fetchWithTimeout) now imported from @agentworkforce/delivery
  • Persona declares both slack and telegram integrations, both inputs optional: true

What this enables

Once @agentworkforce/delivery is published, the same unification pattern can be applied to the remaining 3 paired agents (inbox-buddy, joke-bot, spotify-releases).


Summary by cubic

Unifies hn-monitor into one agent that sends Hacker News digests to Slack, Telegram, or both using the published @agentworkforce/delivery. Adds non‑blocking header publish, transport‑scoped Q&A (relay and Telegram), and reliable recovery for threaded posts.

  • New Features

    • Single dual-transport agent.ts using createDelivery from @agentworkforce/delivery; auto-detects SLACK_CHANNEL/TELEGRAM_CHAT.
    • Posts digests to Slack and/or Telegram; Q&A via Telegram and relay; replies scoped to the origin transport.
    • Non-blocking header publish with threaded body via parentRef/replyTo; bounded timeouts for HN fetch (8s) and LLM.
  • Bug Fixes

    • Scoped Q&A replies to the origin using createDelivery(onlyTargets) to prevent cross‑post leakage.
    • Built and persisted pending thread bodies before send; retry now checks all target refs and clears stale records if targets change. Added recovery tests and exported retryPendingThreadBody.