mapFlutterGemmaAgentEvent function
Maps one Flutter Gemma Agent event without exposing provider types.
Implementation
OmnixAgentEvent mapFlutterGemmaAgentEvent(agent.AgentEvent event) =>
switch (event) {
agent.SkillLoadEvent(:final skillName, :final found) =>
OmnixAgentSkillLoad(skillId: skillName, found: found),
agent.ToolCallEvent(:final toolName, :final args, :final skill) =>
OmnixAgentToolCall(
name: toolName,
arguments: Map<String, Object?>.from(args),
skillId: skill?.name,
),
agent.ToolResultEvent(:final toolName, :final result) =>
OmnixAgentToolResult(
name: toolName,
output: mapFlutterGemmaSkillResult(result),
),
agent.TextChunkEvent(:final text) => OmnixAgentTextDelta(text),
agent.DoneEvent(:final text) => OmnixAgentCompleted(text),
agent.MaxIterationsEvent(:final iterations) => OmnixAgentStepLimitReached(
iterations,
),
agent.AgentErrorEvent(:final message, :final toolName) =>
OmnixAgentFailure(message, toolName: toolName),
};