feat: add reusable multi-turn agent kit

Merged
KH
4mo ago
+2429-5

Summary

  • add @agentworkforce/turn-kit, a transport-neutral lifecycle for multi-turn agents
  • centralize conversation identity, chronological memory, deterministic context providers, interim acknowledgements, receipt-gated actions/final delivery, and post-delivery persistence
  • reuse @agent-assistant/turn-context through the optional @agentworkforce/turn-kit/assistant subpath for canonical identity/context assembly, guardrails, provenance, and harness projection
  • align deterministic Workforce context blocks with the Agent Assistant prepared-context contract while keeping the base package lightweight
  • add a typed persona helper, runnable Relay example, package docs, and publish/verify wiring
  • keep transport parsing, domain mutations, exact pending/idempotency state, and grounding policy in application adapters

The abstraction is based on the shared lifecycle in life-agent and joke-bot, while preserving hn-monitor's important boundary: exact digest/thread grounding belongs in deterministic state/context providers, not semantic conversation memory. Agent Assistant sessions, memory stores, and continuations remain explicit opt-ins because they are richer contracts than Workforce's current managed ctx.memory and callback responder surfaces.

Validation

  • pnpm --filter @agentworkforce/turn-kit test (13 tests)
  • pnpm run typecheck:examples
  • pnpm -r build
  • AGENT_WORKFORCE_HOME=<empty temp dir> pnpm check (full monorepo lint, typecheck, release tests, and package tests; 331 CLI tests)
  • package tarball verified with workspace dependencies rewritten to 4.1.34
  • base tarball import verified without installing the optional Agent Assistant peer

The unisolated CLI test run can pick up the developer machine's personal Workforce source config; the full validation above used an isolated temporary AGENT_WORKFORCE_HOME.