SessionEvent, so a switch on
event.type narrows it. Tool calls carry a normalized detail that says which tool it is and
what it was given, the same for local and cloud sessions:
plan carries the agent’s whole task list each time it changes. Cloud sessions emit it from
0.0.1-beta.9; earlier versions reported a cloud task list as a raw event.
Tool calls, the same on both agents
The local CLI and the cloud describe tools differently on the wire (typedrawInput and
cognition.ai/inferenceToolName locally; cognition.ai/eventType plus _meta details such as
cognition.ai/command and cognition.ai/fileUpdates on the cloud). ToolCall.detail normalizes
both into one discriminated union — exec, read, write, edit, list_directory,
file_search, mcp, permission_request, ask_user_question, computer_use, report_blocker,
or other — so consumers narrow on detail.tool and never see the difference. computer_use
(added in 0.0.1-beta.2) is Devin driving its browser or desktop on the cloud; detail.actions
lists the typed actions it took (key, type, screenshot, …). The raw rawInput, meta,
toolName and inferenceToolName stay on the call for anything the union does not cover.
Cognition extension notifications
Cognition-specific events (_cognition.ai/* notifications — agent stop causes, context
compaction, connection retries, …) are surfaced as a typed union via session.onExtension:
TurnStats (added in 0.0.1-beta.8) is sent by the local agent when a turn ends, with the turn’s
request id and the response dimensions the server reported. Cloud sessions do not send it. The
agent also replays one TurnStats per past turn while loadSession() is in flight; those arrive
before the session is returned, so a handler you assign to the loaded session only sees turns that
end after that. Methods the SDK does not type yet arrive as UnknownExtensionNotification with
the raw payload under params.
The same event stream is what you get from a session you did not start; see
Watch a session. The quickstart example
switches over every event type in one file.
