feat: add managed cloud turn primitives

Merged
KH
4mo ago
+1721-53

Summary

  • attach a managed Cloud ctx.schedule implementation with active-receipt registration, stable cancellation names, and durable list / get helpers
  • make Telegram delivery prefer Cloud's direct provider proxy and require Bot API message receipts, with shared normalization, owner guards, threading, and chunking
  • add a Telegram adapter to turn-kit plus assistant-only proactive memory helpers
  • complete the existing @agent-assistant/proactive scheduler bridge using named dynamic schedules

This extracts the reusable boundaries proven by khaliqgant/life-agent. Domain task semantics, prompts, provider mutations, and private-context lookup remain application-owned.

Closes #300.

Why

Deployed agents currently repeat three unsafe workarounds:

  1. calling the Cloud dynamic-schedule route directly because the managed runner leaves ctx.schedule unavailable;
  2. bypassing Relayfile Telegram writeback because it can return a successful-looking result without sending a Bot API message;
  3. hand-rolling Telegram envelope parsing, private-chat guards, reply threading, chunking, receipt checks, and proactive memory records.

The new APIs keep those platform and transport contracts in Workforce while leaving the generic turn runner transport-neutral.

Validation

  • pnpm -r build
  • pnpm lint
  • pnpm typecheck
  • HOME=/tmp/workforce-test-home.MNLPgJ pnpm test
  • focused suites: runtime 157, delivery 26, turn-kit 17

The isolated HOME keeps the CLI cascade suite from reading the developer's personal Workforce source configuration, matching CI.