feat(persona,agent): move triggers/schedules/watch to agent.ts (defineAgent)#175
Conversation
…ent.ts
Per the May 29 persona-vs-agent architecture decision: a persona describes
what an agent IS (model, harness, skills, mcp, integration connections); the
agent (agent.ts) describes when/how it fires (triggers, schedules, watch) and
what it does (handler).
- persona-kit: remove triggers from PersonaIntegrationConfig and
schedules/watch from PersonaSpec; parser hard-throws on persona-level
listeners. Add AgentSpec + parseAgentSpec, TypedTriggerMap, retarget
lintTriggers to AgentSpec, emit agent.schema.json.
- runtime: new defineAgent({ triggers, schedules, watch, handler }) with
per-provider trigger autocomplete and handler event-type narrowing;
startRunner logs from the agent spec.
- deploy: extract-agent.ts evaluates defineAgent (runtime stubbed) to read
listeners; preflight gates on agent listeners + provider↔integration
coverage; bundle runner reads default.handler; cloud POST gains a top-level
`agent` block; runtime-credentials request re-merges agent triggers.
- examples: migrate review-agent/linear-shipper/notion-essay-pr/
proactive-issue-resolver/weekly-digest to defineAgent.
Cloud-side read of the new agent block tracked in cloud#1643.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Main advanced (sandbox-client integrations passthrough, new sandbox tests); merge resolved cleanly. Update the merged/adjacent test fixtures to the connection-only persona + defineAgent agent shape: - sandbox(.client).test: mint integrations are connection-only; launch input carries the agent block. - cli persona-compile: persona.ts integrations connection-only. - cli deploy dry-run: schedule moved from persona.ts into a defineAgent agent.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reached
More reviews will be available in 55 minutes and 1 second. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (64)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
1 issue found across 62 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Reviewed and fixed PR #175 locally. Changes made:
Local checks run:
|
|
✅ pr-reviewer applied fixes — committed and pushed Reviewed and fixed PR #175 locally. Changes made:
Local checks run:
|
There was a problem hiding this comment.
✅ pr-reviewer applied fixes — committed and pushed e0a3b92 to this PR. The notes below describe what changed.
Reviewed and fixed PR #175 locally.
Changes made:
- Exported the new
agent.schema.jsonfrom@agentworkforce/persona-kit. - Updated cloud launcher proactive/watch tests to assert the new contract:
watchlives on the top-levelagentblock, not onpersona.
Local checks run:
corepack pnpm --filter @agentworkforce/persona-kit testcorepack pnpm --filter @agentworkforce/deploy testcorepack pnpm --filter @agentworkforce/runtime testcorepack pnpm --filter @agentworkforce/cli testcorepack pnpm run typecheck:examples- Smoke import for
@agentworkforce/persona-kit/schemas/agent.schema.json
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. Reviewed PR #175 against the provided diff/context and traced the listener move through persona-kit, runtime, deploy, cli tests, examples, and launch payloads. I did not find breakage requiring code changes. Local verification completed:
Note: I had to build local workspace package outputs first so dependent packages resolved current local types instead of stale missing |
There was a problem hiding this comment.
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.
Reviewed PR #175 against the provided diff/context and traced the listener move through persona-kit, runtime, deploy, cli tests, examples, and launch payloads. I did not find breakage requiring code changes.
Local verification completed:
corepack pnpm run typecheckcorepack pnpm run lintcorepack pnpm run test
Note: I had to build local workspace package outputs first so dependent packages resolved current local types instead of stale missing dist artifacts.
* feat: move triggers/schedules from persona into agent.ts (defineAgent) Mirrors the workforce persona-vs-agent split (AgentWorkforce/workforce#175): the persona declares integration *connections* only; triggers and cron schedules move into agent.ts via defineAgent({ triggers, schedules, handler }). All 7 agents migrated (granola, vendor-monitor, spotify-releases, linear, review, repo-hygiene, hn-monitor). persona.ts integrations are connection-only; repo-hygiene/persona.json updated to match. Stacked on the @agentworkforce/{persona-kit,runtime,deploy} release that ships defineAgent — will not typecheck until those publish. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: note defineAgent for triggers/schedules Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump @agentworkforce/{runtime,persona-kit} to ^3.0.38 (ships defineAgent) The defineAgent-aware packages are now published, so this migration resolves. Also drop a now-dead `event.source === 'cron'` guard in granola (defineAgent narrows event to the declared granola trigger). Note: the pre-existing ctx.<provider> typed-client usages (ctx.linear/ctx.github) are unrelated to this PR and predate it; this repo does not tsc-gate in CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: drop stray .claude/settings.json (preserve pr-reviewer cleanup) * chore: bump @agentworkforce/{runtime,persona-kit} to ^3.0.39 Latest published; defineAgent resolves cleanly so the pr-reviewer bot no longer sees an unresolved import to 'fix' (which is what reverted this PR before). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: drop 'watch' from defineAgent feature line (no agent here uses it) Addresses cubic P3 — this repo's 7 agents use triggers/schedules only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Moves triggers, cron schedules, and relayfile watch rules out of the persona and into the agent (
agent.ts), per the May 29 persona-vs-agent architecture decision.integrations[provider] = { source?, scope? }).agent.ts) = when/how it fires:triggers,schedules,watch, and the handler — authored with a new typeddefineAgent({...}).Why
The old split coupled "I connect to github" (persona) with "ping me on
pull_request.opened" (agent), and the handler had no idea which triggers activated it. One portableagent.tsnow fully defines the agent's behavior, anddefineAgentnarrows the handler'seventto exactly the declared triggers/schedules.Changes
triggersfromPersonaIntegrationConfigandschedules/watchfromPersonaSpec; parser hard-throws on persona-level listeners with a migration message. AddAgentSpec+parseAgentSpec,TypedTriggerMap, retargetlintTriggerstoAgentSpec, emitagent.schema.json.defineAgent(+isWorkforceAgent,AgentDefinition,AgentEvent) with per-provider trigger autocomplete and best-effort handler event-narrowing;startRunnerlogs from the agent spec.extract-agent.tsevaluatesdefineAgentwith the runtime stubbed (fast, side-effect-free) to read listeners; preflight gates on agent listeners + requires every triggered provider to be a declared persona connection; bundle runner readsdefault.handler; cloud deploy POST gains a top-levelagentblock; the runtime-credentials request re-merges agent triggers so its scoping contract is unchanged.defineAgent.Cloud / cross-repo
The wire contract gains a top-level
agentblock; cloud must read triggers/schedules/watch fromagent.*instead ofpersona.*. Tracked in AgentWorkforce/cloud#1643 (lands lockstep with the persona-kit publish). Sibling agent repos (AgentWorkforce/agents,AgentWorkforce/watchdog-agents) and docs get follow-up PRs once these packages publish.Test
All workspace packages green (persona-kit 243, runtime 57, deploy 164, cli 211, …). Verified end-to-end by running deploy preflight on
examples/review-agent(extracts github×4 + slack×1, integrations[github, slack]). New tests cover: parser rejects persona-level listeners,parseAgentSpec,defineAgentbranding + event-narrowing, preflight provider-coverage gate, and the cloudagentblock in the POST body.🤖 Generated with Claude Code