Repository navigation
Description
Problem or use case
Plugins can subscribe to agent.status.changed, which tells them an agent entered blocked — but not why. For unattended long runs (overnight jobs, scheduled tasks) the most common blocking reason is a permission prompt, and "agent needs input" without "agent is waiting for you to approve Bash: rm -rf build/" forces the user to go read the pane before knowing how urgent it is.
The main process already has this information structurally: the agent-hooks ingest layer classifies PermissionRequest hook events across agent families (Claude — including toolUseId-keyed settlement — Codex, and the shared compatible layer) and maintains permission holds in the status store. None of it is projected to the plugin event surface today.
Concrete use case: I'm building a catalog notification plugin (Feishu bot). With only agent.status.changed it can say "🟡 agent needs your input". With a permission event it could say "🟡 approve Bash: rm -rf build/ in pane 2" — actionable from a phone. The same payload serves any dashboard or watchdog plugin, not just IM notifiers.
Proposed solution
Add one event to the closed set:
- Name:
agent.permission.requested - Capability:
agent:read— same domain asagent.status.changed; no new capability kind, no new consent surface - Payload (bounded projection, like all plugin events):
workspaceId(nullable),paneKey,toolUseId?(Claude, when the hook source provides one),toolName?,toolInput?(short preview, bounded),agentType?,receivedAt - Emission: on live (non-replay)
PermissionRequesthook events, projected from the same enriched status stream thatagent.status.changeduses — generic across providers, not per-provider
Settlement needs no new API for v1: a plugin correlates agent.status.changed on the same paneKey (and for Claude the toolUseId) to see the request resolve.
I prototyped this against current main and verified the path end to end: projection (Claude with toolUseId, Codex without, non-permission events and replays filtered), payload schema, and manifest-level gating (subscribing without agent:read is rejected with a clear message). The core patch is ~75 lines plus tests. Happy to open the PR.
Alternatives or additional context
Design questions I'd like to align on before opening the PR:
- Replay semantics — after a restart, a still-pending request is replayed to rehydrate state. Re-notify plugins, or live-only (current prototype: live-only)?
- AskUserQuestion — Claude delivers these as
PreToolUse, and the status layer already treats them as needing human attention. Surface them under the same event (e.g. a kind discriminator), or out of scope? - Settlement event — is paneKey+toolUseId correlation enough for v1, or is a
settledvariant (granted/denied) worth the same PR?
Deliberately out of scope: any write-back / approve API. That is a much bigger security conversation (consent, audit, per-agent answer channels); observation-only keeps this change small.
Activity