events

Event-bus shapes.

agent-shutdown

Emitted once per run during teardown. :error is present for crashed paths.

Fields for agent-shutdown event contract
FieldTypeRequiredSummary
:agent AgentyesAgent instance associated with the event.
:error stringCrash details when shutdown follows an error path.
:reason keywordyes:normal | :crashed
:type :agent-shutdownyesEvent discriminator for :agent-shutdown events.

agent-started

Emitted once per run after setup and before the first new step.

Fields for agent-started event contract
FieldTypeRequiredSummary
:agent AgentyesAgent instance associated with the event.
:cwd stringyesWorking directory for the active agent run.
:model stringyesModel identifier selected for the active run.
:provider keyword|stringyesProvider name selected for the active run.
:type :agent-startedyesEvent discriminator for :agent-started events.

agent-turn-complete

Emitted once per submitted user turn after the agent coroutine finishes and the presenter busy flag has been cleared.

Fields for agent-turn-complete event contract
FieldTypeRequiredSummary
:agent AgentyesAgent instance associated with the completed turn.
:error stringError summary when the turn ended with :status :error.
:message-count numberyesConversation message count after the turn finished.
:result stringFinal visible assistant text for successful or cancelled turns, when available.
:status keywordyes:ok | :cancelled | :error
:type :agent-turn-completeyesEvent discriminator for :agent-turn-complete events.

assistant-stream-end

Stream finished. Emitted once after all per-block end events for a single AssistantMessage.

Fields for assistant-stream-end event contract
FieldTypeRequiredSummary
:type :assistant-stream-endyesEvent discriminator for :assistant-stream-end events.

assistant-text

Final visible text emitted by the assistant. One per AssistantMessage with text blocks.

Fields for assistant-text event contract
FieldTypeRequiredSummary
:final? booleanTrue when this is the final aggregate payload for the current block.
:text stringyesComplete assistant text payload for this event.
:type :assistant-textyesEvent discriminator for :assistant-text events.

assistant-text-delta

Streaming text token. Aggregated by presenters during a stream.

Fields for assistant-text-delta event contract
FieldTypeRequiredSummary
:delta stringyesIncremental streamed text fragment for the open content block.
:type :assistant-text-deltayesEvent discriminator for :assistant-text-delta events.

assistant-thinking

Final reasoning text from the assistant (for providers that surface reasoning content).

Fields for assistant-thinking event contract
FieldTypeRequiredSummary
:final? booleanTrue when this is the final aggregate payload for the current block.
:text stringyesComplete assistant text payload for this event.
:type :assistant-thinkingyesEvent discriminator for :assistant-thinking events.

assistant-thinking-delta

Streaming reasoning token.

Fields for assistant-thinking-delta event contract
FieldTypeRequiredSummary
:delta stringyesIncremental streamed text fragment for the open content block.
:type :assistant-thinking-deltayesEvent discriminator for :assistant-thinking-delta events.

cancelled

Cooperative cancel observed; the current step appended an aborted assistant message.

Fields for cancelled event contract
FieldTypeRequiredSummary
:type :cancelledyesEvent discriminator for :cancelled events.

compaction-summary

Context compaction completed and produced a summary for older messages.

Fields for compaction-summary event contract
FieldTypeRequiredSummary
:guidance stringOptional user guidance supplied to /compact.
:messages-kept numberNumber of recent messages kept verbatim.
:messages-summarized numberNumber of older messages summarized.
:summary stringyesSummary text installed into the compacted model context.
:tokens-after numberApproximate context tokens after compaction.
:tokens-before numberApproximate context tokens before compaction.
:trigger keywordWhy compaction ran, such as :manual.
:type :compaction-summaryyesEvent discriminator for :compaction-summary events.

dismiss

Presenter signal that an open overlay/picker should close.

Fields for dismiss event contract
FieldTypeRequiredSummary
:type :dismissyesEvent discriminator for :dismiss events.

done

Provider stream: terminal event for a successful AssistantMessage.

Fields for done event contract
FieldTypeRequiredSummary
:message AssistantMessageyesCanonical assistant message produced by the provider stream.
:type :doneyesEvent discriminator for :done events.

error

Generic surface error — typically command-dispatch or user-input failures.

Fields for error event contract
FieldTypeRequiredSummary
:error stringyesHuman-readable error message for presenters and logs.
:type :erroryesEvent discriminator for :error events.

extension-error

Emitted when an extension event handler raises. Suppressed for recursive extension-error events to prevent loops.

Fields for extension-error event contract
FieldTypeRequiredSummary
:error stringyesHuman-readable error message for presenters and logs.
:event keyword|stringOriginal event being handled when the extension error occurred.
:owner keyword|stringExtension owner whose handler raised, when known.
:type :extension-erroryesEvent discriminator for :extension-error events.

extension-loaded

Emitted by the loader for each successfully loaded extension manifest.

Fields for extension-loaded event contract
FieldTypeRequiredSummary
:first-party? booleanTrue when the loaded extension came from fen's bundled extension set.
:name stringyesExtension manifest name that was loaded.
:type :extension-loadedyesEvent discriminator for :extension-loaded events.

info

Transient informational message intended for the presenter status row or panel.

Fields for info event contract
FieldTypeRequiredSummary
:info stringHuman-readable informational message payload.
:text stringAlternative human-readable informational text.
:type :infoyesEvent discriminator for :info events.

llm-end

Provider call completed (success or error). The :message field carries the canonical AssistantMessage.

Fields for llm-end event contract
FieldTypeRequiredSummary
:message AssistantMessageyesCanonical assistant message produced by the provider stream.
:type :llm-endyesEvent discriminator for :llm-end events.

llm-start

Provider call beginning.

Fields for llm-start event contract
FieldTypeRequiredSummary
:model stringModel identifier used for the provider request, when known.
:provider keywordProvider name for the outbound LLM call, when known.
:type :llm-startyesEvent discriminator for :llm-start events.

message-appended

Emitted by fen.core.agent immediately after agent.messages grows.

Fields for message-appended event contract
FieldTypeRequiredSummary
:agent AgentyesAgent instance associated with the event.
:index numberyes1-based index of the appended message.
:message MessageyesCanonical message that was appended to the conversation.
:type :message-appendedyesEvent discriminator for :message-appended events.

queued

User-line queued while the agent is busy. Consumed by the agent on natural-stop.

Fields for queued event contract
FieldTypeRequiredSummary
:line stringyesRaw user input line associated with the event.
:type :queuedyesEvent discriminator for :queued events.

redraw

Presenter hint that a registered panel needs to be repainted.

Fields for redraw event contract
FieldTypeRequiredSummary
:type :redrawyesEvent discriminator for :redraw events.

reinit-presenter

Presenter signal that the UI should be torn down and re-initialized (used by /reload).

Fields for reinit-presenter event contract
FieldTypeRequiredSummary
:type :reinit-presenteryesEvent discriminator for :reinit-presenter events.

reset-conversation

Presenter signal that the active conversation should be cleared (used by /new).

Fields for reset-conversation event contract
FieldTypeRequiredSummary
:type :reset-conversationyesEvent discriminator for :reset-conversation events.

set-status-info

Presenter-level status hint. Owners post a transient status line; nil clears.

Fields for set-status-info event contract
FieldTypeRequiredSummary
:info string|nilTransient status text to show, or nil to clear it.
:type :set-status-infoyesEvent discriminator for :set-status-info events.

start

Provider stream opened. Marker event emitted before any block events.

Fields for start event contract
FieldTypeRequiredSummary
:type :startyesEvent discriminator for :start events.

text-delta

Provider stream: incremental text token within the open block.

Fields for text-delta event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:delta stringyesIncremental streamed text fragment for the open content block.
:type :text-deltayesEvent discriminator for :text-delta events.

text-end

Provider stream: TextContent block closed; full text supplied.

Fields for text-end event contract
FieldTypeRequiredSummary
:content stringyesComplete text or thinking content for the closed stream block.
:content-index numberyesPosition within the assistant's content array.
:type :text-endyesEvent discriminator for :text-end events.

text-start

Provider stream: a TextContent block is starting.

Fields for text-start event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:type :text-startyesEvent discriminator for :text-start events.

thinking-delta

Provider stream: incremental reasoning token within the open block.

Fields for thinking-delta event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:delta stringyesIncremental streamed text fragment for the open content block.
:type :thinking-deltayesEvent discriminator for :thinking-delta events.

thinking-end

Provider stream: ThinkingContent block closed; full text supplied.

Fields for thinking-end event contract
FieldTypeRequiredSummary
:content stringyesComplete text or thinking content for the closed stream block.
:content-index numberyesPosition within the assistant's content array.
:type :thinking-endyesEvent discriminator for :thinking-end events.

thinking-start

Provider stream: a ThinkingContent block is starting.

Fields for thinking-start event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:type :thinking-startyesEvent discriminator for :thinking-start events.

tool-call

Tool call about to execute. Carries the canonical ToolCall block.

Fields for tool-call event contract
FieldTypeRequiredSummary
:tool-call ToolCallyesCanonical tool-call block associated with this event.
:type :tool-callyesEvent discriminator for :tool-call events.

tool-call-delta

Provider stream: incremental JSON-text fragment for the open ToolCall arguments. Some providers stream arguments token-by-token; consumers may concatenate.

Fields for tool-call-delta event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:delta stringyesIncremental streamed text fragment for the open content block.
:type :tool-call-deltayesEvent discriminator for :tool-call-delta events.

tool-call-end

Provider stream: ToolCall block closed; complete canonical ToolCall block supplied.

Fields for tool-call-end event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:tool-call ToolCallyesCanonical tool-call block associated with this event.
:type :tool-call-endyesEvent discriminator for :tool-call-end events.

tool-call-start

Provider stream: a ToolCall block is starting; arguments not yet known.

Fields for tool-call-start event contract
FieldTypeRequiredSummary
:content-index numberyesPosition within the assistant's content array.
:type :tool-call-startyesEvent discriminator for :tool-call-start events.

tool-result

Tool execution finished. Carries the canonical ToolResultMessage.

Fields for tool-result event contract
FieldTypeRequiredSummary
:result ToolResultMessageyesCanonical tool-result message produced by the tool executor.
:type :tool-resultyesEvent discriminator for :tool-result events.

user

User-submitted line accepted by the presenter input layer. Distinct from :queued (which fires when the line is queued during a busy turn).

Fields for user event contract
FieldTypeRequiredSummary
:line stringyesRaw user input line associated with the event.
:type :useryesEvent discriminator for :user events.