MingaAgent.Event (Minga v0.1.0)

Copy Markdown View Source

Provider-agnostic event types for agent communication.

These structs represent the events that flow from a provider backend to the Agent.Session. The session uses them to update conversation state, status, and UI without knowing anything about the underlying provider protocol.

Summary

Types

Agent has started processing a prompt.

Pre-send estimated context usage.

An error occurred in the agent, with structured kind/provider metadata.

A provider-emitted system message for the chat transcript.

t()

Union of all agent event types.

A chunk of assistant response text.

A chunk of the agent's internal reasoning.

The agent's current todo plan.

Token usage statistics from a completed response.

A destructive tool call needs user approval before executing.

A tool call has completed.

A file-modifying tool captured before/after content for diff review.

A tool call has started.

Partial progress on a running tool call.

The agent reached its per-prompt turn limit.

Types

agent_end()

@type agent_end() :: %MingaAgent.Event.AgentEnd{
  outcome: MingaAgent.Session.Outcome.t() | nil,
  usage: token_usage() | nil
}

agent_start()

@type agent_start() :: %MingaAgent.Event.AgentStart{}

Agent has started processing a prompt.

context_usage()

@type context_usage() :: %MingaAgent.Event.ContextUsage{
  context_limit: non_neg_integer() | nil,
  estimated_tokens: non_neg_integer()
}

Pre-send estimated context usage.

error()

@type error() :: %MingaAgent.Event.Error{
  kind: MingaAgent.Event.Error.kind(),
  message: String.t(),
  provider: String.t() | nil
}

An error occurred in the agent, with structured kind/provider metadata.

system_message()

@type system_message() :: %MingaAgent.Event.SystemMessage{
  level: MingaAgent.Message.system_level(),
  message: String.t()
}

A provider-emitted system message for the chat transcript.

t()

Union of all agent event types.

text_delta()

@type text_delta() :: %MingaAgent.Event.TextDelta{delta: String.t()}

A chunk of assistant response text.

thinking_delta()

@type thinking_delta() :: %MingaAgent.Event.ThinkingDelta{delta: String.t()}

A chunk of the agent's internal reasoning.

todo_plan()

@type todo_plan() :: MingaAgent.Event.TodoPlan.t()

The agent's current todo plan.

token_usage()

@type token_usage() :: MingaAgent.TurnUsage.t()

Token usage statistics from a completed response.

tool_approval()

@type tool_approval() :: %MingaAgent.Event.ToolApproval{
  args: map(),
  name: String.t(),
  reply_to: pid(),
  tool_call_id: String.t()
}

A destructive tool call needs user approval before executing.

tool_end()

@type tool_end() :: %MingaAgent.Event.ToolEnd{
  is_error: boolean(),
  name: String.t(),
  output: MingaAgent.Tool.Output.t() | nil,
  result: String.t(),
  tool_call_id: String.t()
}

A tool call has completed.

tool_file_changed()

@type tool_file_changed() :: %MingaAgent.Event.ToolFileChanged{
  after_content: String.t(),
  before_content: String.t(),
  path: String.t(),
  tool_call_id: String.t()
}

A file-modifying tool captured before/after content for diff review.

tool_start()

@type tool_start() :: %MingaAgent.Event.ToolStart{
  args: map(),
  name: String.t(),
  tool_call_id: String.t()
}

A tool call has started.

tool_update()

@type tool_update() :: %MingaAgent.Event.ToolUpdate{
  name: String.t(),
  partial_result: String.t(),
  tool_call_id: String.t()
}

Partial progress on a running tool call.

turn_limit_reached()

@type turn_limit_reached() :: %MingaAgent.Event.TurnLimitReached{
  current: non_neg_integer(),
  limit: pos_integer()
}

The agent reached its per-prompt turn limit.