feat!: migrate personas to the relay SDK AgentEvent (Unit C, agents codemod)
Merged
KH
5mo ago+1906+1906+0123456789012345678901234567890123456789-486-486-012345678901234567890123456789
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.typechecks now provider-qualified (github.pull_request.opened, …); payload expanded once and passed to the existingunknown-typed helpers - linear-slack: source guard →
event.type.startsWith('slack.'); payload via expand - linear:
handleLinearEventexpands once and threads payload through helpers; alllinear.*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 newdefine-agentnarrowing turned the formerly-silentevent.typesuffix 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')).dataand 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.
- Dropped source guards; switched to provider-qualified types (e.g.,
-
Dependencies
- Bumped
@agentworkforce/runtimeand@agentworkforce/persona-kitto 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.
- Bumped