Skip to content

Class: AgentEventBridge

Makaio Framework


Makaio Framework / ai-adapters-core / 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.

new AgentEventBridge(config): AgentEventBridge

Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:84

Create an event bridge with emission and correlation dependencies.

AgentEventBridgeConfig

Event bridge dependencies (emitters, tracker, and block-index accessors)

AgentEventBridge

emitContextWindowUpdate(input): Promise<void>

Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:113

Emit context window health signal.

ContextWindowInput

Raw usage and capacity metrics

Promise<void>


emitStepFinished(stepType, content): Promise<void>

Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:200

Emit step.finished and advance block index.

"text" | "reasoning" | "tool_use"

Completed step type

{ 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

{ 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

"file" | "directory" = AttachmentTypeSchema

Whether the attachment is a file or directory

string = ...

Optional human-readable display name override

string = ...

Original filename with extension (e.g. “api-spec.yaml”) — for display and type inference

string = ...

Server-side file path — always populated before message reaches adapters

{ data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; } = ContentSourceSchema

Inline content — base64 for binary, raw string for text

"attachment" = ...


{ content: string; metadata?: Record<string, unknown>; type: "reasoning"; }

Final block content

string = ...

Record<string, unknown> = ...

Optional provider/runtime metadata for reasoning blocks.

"reasoning" = ...

Promise<void>


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.

"text" | "reasoning" | "tool_use"

Block step type

{ toolCallId: string; toolName: string; type: "tool_use"; } | { type: "reasoning"; } | { type: "text"; }

Optional step metadata

{ 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

{ 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

"file" | "directory" = AttachmentTypeSchema

Whether the attachment is a file or directory

string = ...

Optional human-readable display name override

string = ...

Original filename with extension (e.g. “api-spec.yaml”) — for display and type inference

string = ...

Server-side file path — always populated before message reaches adapters

{ data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; } = ContentSourceSchema

Inline content — base64 for binary, raw string for text

"attachment" = ...


{ content: string; metadata?: Record<string, unknown>; type: "reasoning"; }

Optional immediate block content

string = ...

Record<string, unknown> = ...

Optional provider/runtime metadata for reasoning blocks.

"reasoning" = ...

Promise<void>


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.

string

Tool output text

ResolveHints

Correlation hints from adapter events

Promise<ToolOutputResult>

Resolved toolCallId, toolName (falls back to ‘unknown’), and args from the matched tool.use call


emitToolUse(toolName, args?, nativeId?): Promise<string>

Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:135

Emit tool.use event with correlation tracking.

string

Tool identifier

Record<string, unknown>

Tool arguments

string

Provider-native call ID

Promise<string>

Correlation ID for the call


trackUsage(normalized): Promise<void>

Defined in: ../../../adapters/core/src/agent/agent-event-bridge.ts:102

Emit usage event to global bus.

NormalizedCallUsage

Provider-normalized usage metrics

Promise<void>