feat: Enhanced data capture with new hooks and session tracking

Phase 1 of v2 upgrade:
- Add PreToolUse hook for true "running" state before tool execution
- Add UserPromptSubmit hook to track user prompts and idle state
- Add Stop hook for idle detection when Claude finishes responding
- Add PreCompact hook to track context compaction events
- Enrich capture-event.sh with permission_mode, transcript_path, cwd
- Add CostTracker for session cost estimation
- Add SessionInfo type for tracking session state
- Show idle indicator (💤/) and permission mode in header
- Show cost estimate when significant
- Show compaction count warning
- Show last user prompt preview

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jarrod Watts
2026-01-02 14:10:21 +11:00
parent 617c90df3a
commit bb77dd7cc3
10 changed files with 468 additions and 151 deletions

View File

@@ -7,9 +7,14 @@ if [ -p "$EVENT_FIFO" ]; then
echo "$INPUT" | jq -c '{
event: .hook_event_name,
tool: .tool_name,
toolUseId: .tool_use_id,
input: .tool_input,
response: .tool_response,
session: .session_id,
permissionMode: .permission_mode,
transcriptPath: .transcript_path,
cwd: .cwd,
prompt: .prompt,
ts: (now | floor)
}' >> "$EVENT_FIFO" 2>/dev/null || true
fi