Skip to content

NW-1694 Add support for capturing laravel/ai events#325

Draft
philliphartin wants to merge 2 commits into1.xfrom
feature/nw-1694-capture-ai-package-events
Draft

NW-1694 Add support for capturing laravel/ai events#325
philliphartin wants to merge 2 commits into1.xfrom
feature/nw-1694-capture-ai-package-events

Conversation

@philliphartin
Copy link
Contributor

@philliphartin philliphartin commented Feb 5, 2026

Summary

Adds foundational support for capturing events from the laravel/ai package. AI events (prompts, responses, tool invocations, audio generation, etc.) are now tracked.

Changes

  • Add AiEvent record class for storing AI event data
  • Add AiEventSensor to handle event lifecycle (start/end) and calculate duration
  • Add AiEventListener hook with proper error handling
  • Wire through SensorManager and CapturesState
  • Add aiEvents counter to RequestState and CommandState
  • Add Compatibility::$aiEventsAvailable flag for conditional registration
  • Update PHPStan config to ignore optional Laravel\Ai dependency

Test Plan

  • PHPStan passes at max level
  • Pint formatting passes
  • Unit tests pass
  • Integration test with laravel/ai package

- Add AiEvent record for AI event data
- Add AiEventSensor to track event lifecycle and calculate duration
- Add AiEventListener hook with try-catch error handling
- Wire sensor through SensorManager and CapturesState
- Add aiEvents counter to RequestState and CommandState
- Add Compatibility flag for conditional AI event registration
- Update PHPStan config to ignore Laravel\Ai classes (optional dep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments