feat!: migrate personas to the relay SDK AgentEvent (Unit C, agents codemod)

Merged
KH
5mo ago
+1906-486

Paired with @agentworkforce/runtime v4 (AgentWorkforce/workforce#220), which delivers the relay SDK AgentEvent to handlers instead of the old { source, type, payload } shape.

Per-persona migration

  • cron-only (hn-monitor, spotify-releases, vendor-monitor): event.source==='cron' → isCronTickEvent(event)
  • granola: event.payload → (await event.expand('full')).data
  • repo-hygiene / review: source guard dropped (narrowed by triggers); event.type checks now provider-qualified (github.pull_request.opened, …); payload expanded once and passed to the existing unknown-typed helpers
  • linear-slack: source guard → event.type.startsWith('slack.'); payload via expand
  • linear: handleLinearEvent expands once and threads payload through helpers; all linear.* type strings provider-qualified
  • cloud-team-{implementer,reviewer}: source/type logging off the SDK event
  • tests: linear / linear-slack fixtures rebuilt via envelopeToAgentEvent

Bumps @agentworkforce/{runtime,persona-kit} to ^4.0.0.

Verification

  • tsc --noEmit: 0 errors — the new define-agent narrowing turned the formerly-silent event.type suffix mismatches into compile errors (caught every site).
  • All 60 persona tests pass against the v4 runtime.

Note: v4 isn't published yet, so local verification overlaid the v4 runtime/persona-kit builds into node_modules. CI here should go green once workforce#220 publishes v4. Merge after workforce#220.

🤖 Generated with Claude Code


Summary by cubic

Migrates all personas to the relay SDK AgentEvent in @agentworkforce/runtime v4. Handlers now use provider-qualified event.type, read payload via await event.expand('full'), and use isCronTickEvent(event) for schedules.

  • Migration

    • Dropped source guards; switched to provider-qualified types (e.g., github.pull_request.opened, slack.message.created, linear.issue.create).
    • Read payload once via (await event.expand('full')).data and thread through helpers (granola, linear, repo-hygiene, review).
    • Linear: single expand; own-event checks and type strings updated (e.g., linear.comment.create, linear.AppUserNotification.issueCommentMention).
    • Slack: event.type.startsWith('slack.') gate; payload via expand.
    • Cron-only personas use isCronTickEvent(event) (hn-monitor, spotify-releases, vendor-monitor).
    • Cloud-team personas log source via event.resource.provider (cron fallback).
    • Tests rebuilt to use envelopeToAgentEvent.
  • Dependencies

    • Bumped @agentworkforce/runtime and @agentworkforce/persona-kit to v4 (resolves to 4.0.1; pulls in @agent-relay/events).
    • Verified on published v4: tsc clean (0 errors) and all 60 persona tests pass.