Skip to content

AgentEventMapping

Category: Acp

Source: agent_event_mapping.dart

Maps Glue's current [AgentEvent] vocabulary into ACP session/update payloads.

This is the translation the ACP server uses today, while the proposed [SessionEvent] hierarchy in glue_core is wired through the harness. Once the harness emits [SessionEvent] directly, this mapper can be retired in favour of event_mapping.dart's SessionEvent variant.

Tool-call events here only carry the visible side of the loop — the server is responsible for synthesising tool-call status updates (pendingin_progresscompleted/failed) around its own permission gate and execution.

Functions

SessionUpdate? agentEventToAcpUpdate(AgentEvent event)

Maps a single [AgentEvent] to a [SessionUpdate], or returns null when the event has no session/update representation today (the server handles tool-call status separately).

ToolCallKind toolNameToAcpKind(String toolName)

Maps Glue's [Tool] kind heuristic (by tool name) onto ACP's [ToolCallKind] enum. Falls back to [ToolCallKind.other] for unknown tools.

Released under the MIT License.