feat(delivery): add @agentworkforce/delivery โ€” unified multi-target messaging

Merged
KH
4mo ago
+555-0

Summary

New @agentworkforce/delivery package that provides a configuration-driven, unified messaging client for agent handlers.

Why

  • Duplication: 4 agent pairs exist as separate Slack/Telegram directories with identical business logic
  • No shared Slack transport: shared/telegram.ts exists but Slack equivalents are copy-pasted across agents
  • Feature drift: Telegram variants have improvements (fetch timeout, pending recovery, fallbacks) Slack variants lack
  • No cross-transport memory sharing: Memory tags differ between variants

API

import { createDelivery, input, list, withTimeout, fetchWithTimeout } from '@agentworkforce/delivery';

const delivery = createDelivery(ctx);

// Blocking mode (waits for receipt)
const heads = await delivery.send(header);
await delivery.send(body, { replyTo: heads });

// Non-blocking parentRef mode (x-reply-radar pattern, zero receipt round-trips)
const heads = await delivery.publish(header);
await delivery.send(body, { replyTo: heads, nonBlocking: true });

Shared helpers

Exports input(), list(), withTimeout(), fetchWithTimeout() โ€” previously copy-pasted across 10+ agent files.