docs(hooks/bundled/readme): cover session compaction and message events

The bundled hooks README listed only command/agent/gateway events and
ended with a stale "More event types coming soon (session lifecycle,
agent errors, etc.)" line, but production code now triggers:

- session:compact:before / session:compact:after via
  src/agents/pi-embedded-runner/compaction-hooks.ts
- message:received via src/auto-reply/reply/dispatch-from-config.ts
- message:sent via src/infra/outbound/deliver.ts

Updates the "Event Types" list with the four real production event
names, drops the stale coming-soon line, and aligns the InternalHookEvent
interface example with the actual InternalHookEventType union (adds
"message" and refreshes the action examples). HOOK.md authors that target
session lifecycle or message routing now have a real surface to subscribe
to instead of relying on tribal knowledge or the type definitions.
This commit is contained in:
Vincent Koc
2026-04-29 00:29:09 -07:00
parent 34bd962a20
commit b69b508d20

View File

@@ -170,8 +170,10 @@ Currently supported events:
- **command:stop**: `/stop` command
- **agent:bootstrap**: Before workspace bootstrap files are injected
- **gateway:startup**: Gateway startup (after channels start)
More event types coming soon (session lifecycle, agent errors, etc.).
- **session:compact:before**: Pre-compaction snapshot before the embedded runner rewrites session context
- **session:compact:after**: Post-compaction snapshot after the runner replaces session context
- **message:received**: Inbound channel message accepted for dispatch
- **message:sent**: Outbound channel message delivered (canonical payload only)
## Handler API
@@ -179,8 +181,8 @@ Hook handlers receive an `InternalHookEvent` object:
```typescript
interface InternalHookEvent {
type: "command" | "session" | "agent" | "gateway";
action: string; // e.g., 'new', 'reset', 'stop'
type: "command" | "session" | "agent" | "gateway" | "message";
action: string; // e.g., 'new', 'reset', 'stop', 'compact:before', 'received', 'sent'
sessionKey: string;
context: Record<string, unknown>;
timestamp: Date;