Class: AgentEventBridge
Makaio Framework / ai-adapters-core / AgentEventBridge
Class: AgentEventBridge
Section titled “Class: AgentEventBridge”Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:67
Event-focused helper for AIAgent.
Keeps event payload formatting, correlation warnings, and block-indexed step emissions out of the base class while preserving existing behavior.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AgentEventBridge(
config):AgentEventBridge
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:84
Create an event bridge with emission and correlation dependencies.
Parameters
Section titled “Parameters”config
Section titled “config”Event bridge dependencies (emitters, tracker, and block-index accessors)
Returns
Section titled “Returns”AgentEventBridge
Methods
Section titled “Methods”emitContextWindowUpdate()
Section titled “emitContextWindowUpdate()”emitContextWindowUpdate(
input):Promise<void>
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:113
Emit context window health signal.
Parameters
Section titled “Parameters”ContextWindowInput
Raw usage and capacity metrics
Returns
Section titled “Returns”Promise<void>
emitStepFinished()
Section titled “emitStepFinished()”emitStepFinished(
stepType,content):Promise<void>
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:200
Emit step.finished and advance block index.
Parameters
Section titled “Parameters”stepType
Section titled “stepType”"text" | "reasoning" | "tool_use"
Completed step type
content
Section titled “content”{ content: string; type: "text"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "image"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "document"; } | { attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; } | { content: string; metadata?: Record<string, unknown>; type: "reasoning"; } | { args: Record<string, unknown>; name: string; toolCallId: string; type: "tool_call"; } | { isError?: boolean; output: string; toolCallId: string; type: "tool_output"; }
Final block content
Type Literal
Section titled “Type Literal”{ attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; }
Final block content
attachmentType
Section titled “attachmentType”"file" | "directory" = AttachmentTypeSchema
Whether the attachment is a file or directory
displayName?
Section titled “displayName?”string = ...
Optional human-readable display name override
fileName
Section titled “fileName”string = ...
Original filename with extension (e.g. “api-spec.yaml”) — for display and type inference
filePath
Section titled “filePath”string = ...
Server-side file path — always populated before message reaches adapters
source
Section titled “source”{ data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; } = ContentSourceSchema
Inline content — base64 for binary, raw string for text
"attachment" = ...
Type Literal
Section titled “Type Literal”{ content: string; metadata?: Record<string, unknown>; type: "reasoning"; }
Final block content
content
Section titled “content”string = ...
metadata?
Section titled “metadata?”Record<string, unknown> = ...
Optional provider/runtime metadata for reasoning blocks.
"reasoning" = ...
Returns
Section titled “Returns”Promise<void>
emitStepStarted()
Section titled “emitStepStarted()”emitStepStarted(
stepType,blockData?,content?):Promise<void>
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:182
Emit step.started for the current block index.
Parameters
Section titled “Parameters”stepType
Section titled “stepType”"text" | "reasoning" | "tool_use"
Block step type
blockData?
Section titled “blockData?”{ toolCallId: string; toolName: string; type: "tool_use"; } | { type: "reasoning"; } | { type: "text"; }
Optional step metadata
content?
Section titled “content?”{ content: string; type: "text"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "image"; } | { source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "document"; } | { attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; } | { content: string; metadata?: Record<string, unknown>; type: "reasoning"; } | { args: Record<string, unknown>; name: string; toolCallId: string; type: "tool_call"; } | { isError?: boolean; output: string; toolCallId: string; type: "tool_output"; }
Optional immediate block content
Type Literal
Section titled “Type Literal”{ attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; }
Optional immediate block content
attachmentType
Section titled “attachmentType”"file" | "directory" = AttachmentTypeSchema
Whether the attachment is a file or directory
displayName?
Section titled “displayName?”string = ...
Optional human-readable display name override
fileName
Section titled “fileName”string = ...
Original filename with extension (e.g. “api-spec.yaml”) — for display and type inference
filePath
Section titled “filePath”string = ...
Server-side file path — always populated before message reaches adapters
source
Section titled “source”{ data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; } = ContentSourceSchema
Inline content — base64 for binary, raw string for text
"attachment" = ...
Type Literal
Section titled “Type Literal”{ content: string; metadata?: Record<string, unknown>; type: "reasoning"; }
Optional immediate block content
content
Section titled “content”string = ...
metadata?
Section titled “metadata?”Record<string, unknown> = ...
Optional provider/runtime metadata for reasoning blocks.
"reasoning" = ...
Returns
Section titled “Returns”Promise<void>
emitToolOutput()
Section titled “emitToolOutput()”emitToolOutput(
output,hints):Promise<ToolOutputResult>
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:151
Emit tool.output event with best-effort correlation resolution.
Parameters
Section titled “Parameters”output
Section titled “output”string
Tool output text
Correlation hints from adapter events
Returns
Section titled “Returns”Promise<ToolOutputResult>
Resolved toolCallId, toolName (falls back to ‘unknown’), and args from the matched tool.use call
emitToolUse()
Section titled “emitToolUse()”emitToolUse(
toolName,args?,nativeId?):Promise<string>
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:135
Emit tool.use event with correlation tracking.
Parameters
Section titled “Parameters”toolName
Section titled “toolName”string
Tool identifier
Record<string, unknown>
Tool arguments
nativeId?
Section titled “nativeId?”string
Provider-native call ID
Returns
Section titled “Returns”Promise<string>
Correlation ID for the call
trackUsage()
Section titled “trackUsage()”trackUsage(
normalized):Promise<void>
Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:102
Emit usage event to global bus.
Parameters
Section titled “Parameters”normalized
Section titled “normalized”Provider-normalized usage metrics
Returns
Section titled “Returns”Promise<void>