Documentation Index
Fetch the complete documentation index at: https://kawax.biz/llms.txt
Use this file to discover all available pages before exploring further.
SessionEvent
All messages from Copilot are represented byRevolution\Copilot\Types\SessionEvent.
This is the class you will use most often, so it includes Laravel-style conveniences.
content()
Get the most important response message from the AI.
__toString() triggers implicit casting, it also returns the message content.
Event type checks
isAssistantMessage(), isUserMessage(), isIdle(), and isAssistantMessageDelta() are available.
More helpers can be added for commonly used event types.
You can check any EventType with is().
type() returns the string value of the SessionEventType enum.
failed() / successful()
If the event type is SESSION_ERROR, failed() returns true.
successful() is the opposite.
This was renamed from isError() to follow Laravel conventions.
throw()
Like Laravel HTTP and Process APIs, errors are held and then thrown with throw().
When there is no error, throw() does nothing, so you can write code like this:
SESSION_ERROR, it throws Revolution\Copilot\Exceptions\SessionErrorException.
On timeout, it throws Revolution\Copilot\Exceptions\SessionTimeoutException.
For JSON-RPC errors, it throws Revolution\Copilot\Exceptions\JsonRpcException.
Conditionable
You can usewhen() and unless().
Dumpable
You can usedump() and dd().
Tappable
You can usetap().
InteractsWithData
This feature applies to the SessionEvent$data property only.
You get familiar helpers such as all(), has(), only(), and collect().
For details, see InteractsWithData.
Because SessionEvent $data differs by EventType, these helpers are useful when accessing event-specific fields.
content() also uses InteractsWithData internally.
toArray() / toJson()
Convert the full SessionEvent to an array or JSON.
collect() method because InteractsWithData already provides one for $data.
If you need collection operations for the whole event, use Laravel’s collect() helper.
broadcast() / broadcastNow()
You can broadcast with the same interface as Laravel AI SDK StreamEvent.
AI SDK uses this during streaming, but with SessionEvent you can use it for any EventType.
broadcastNow() broadcasts immediately without going through a queue.
For the latest updates, see the GitHub repository.