AgentCli class
The CLI harness: agent + built-in tools + session persistence + compaction, driven by a CliIO.
Constructors
- AgentCli({required AgentCliConfig config, required CliIO io, StreamFunction? streamFunction, String prompt = 'fa> ', bool useColor = false, bool useTui = false, String version = '0.0.0'})
-
Creates an AgentCli.
streamFunctionoverrides the provider adapter (used in tests); otherwise one is built from AgentCliConfig.providerKind and AgentCliConfig.apiKey.
Properties
- agent → Agent
-
The underlying Agent driving the session.
no setter
- approval → ApprovalManager
-
The approval gate attached to the agent: mode, per-tool overrides, and
the session always-allow set (
/approval,/allow).no setter - checkpoints → CheckpointRewindController
-
The checkpoint/rewind controller: its
checkpointandrewindtools are registered on the agent, and it applies rewinds at turn end.no setter - config → AgentCliConfig
-
The static configuration.
final
- currentMode → AgentMode
-
The active mode.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- io → CliIO
-
Terminal IO.
final
- isBusy → bool
-
Whether a run is currently streaming.
no setter
- prompt → String
-
The input prompt written when the agent is idle.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- systemPrompt → String
-
The effective system prompt sent to the model.
no setter
- ttsr → TtsrController?
-
The TTSR controller, when stream rules are configured (AgentCliConfig.ttsr).
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
) → Future< void> -
Runs the REPL until
/exitor the input stream closes. -
runHeadless(
String prompt) → Future< int> -
Runs a single non-interactive prompt (headless mode:
fah "<prompt>") and returns the process exit code: 0 on success, 1 when the run ends with a provider error, 130 when aborted (Ctrl-C via CliIO.interrupts). Tool errors the agent recovers from still exit 0 — the exit code reflects the run's terminal state, like claude/pi. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited