AgentHandlers class

Host-side interaction hooks the agent uses to talk to the user. The CLI and the web client provide their own implementations; tests provide fakes.

Constructors

AgentHandlers({required void writeLine(String line), required Future<bool> confirm(String prompt), required Future<PlanApproval> approvePlan(AgentPlan plan), Future<CommandConfirm> confirmCommand(String prompt)?, Future<String> planNotes()?, String rule()?, Future<String?> continueChat()?})
const

Properties

approvePlan Future<PlanApproval> Function(AgentPlan plan)
Presents plan and returns the user's PlanApproval.
final
confirm Future<bool> Function(String prompt)
Asks a yes/no question, returning the user's answer.
final
confirmCommand Future<CommandConfirm> Function(String prompt)?
Asks the user to confirm a command, allowing an "explain" answer. When null, command confirmation falls back to confirm (no explain option).
final
continueChat Future<String?> Function()?
Asks the user, after the agent's final answer, for a follow-up message to continue the conversation in the same context. Returns the message, or null/empty to end the agent. A null handler ends without prompting (non-interactive hosts, web, tests).
final
hashCode int
The hash code for this object.
no setterinherited
planNotes Future<String> Function()?
Reads the user's free-text notes when they choose PlanApproval.talk, so the agent can revise the plan. null (or empty) provides no guidance.
final
rule String Function()?
Returns the (uncolored) horizontal-rule string used to frame the start and end of the interaction — the host sizes it to the terminal. null omits the rule (e.g. tests, or a host that doesn't want framing).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
writeLine → void Function(String line)
Writes a line of output (assistant prose, command echoes, notices).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited