Repository navigation
0.9.0
Neuron TUI 0.9.0 adds support for Neuron AI 4 and Neuron Interaction 0.9.
Installation
Requires PHP 8.4.1+ and an interactive terminal.
composer require asterixcapri/neuron-tuiApplications using Neuron AI 3 should continue using asterixcapri/neuron-tui:^0.8.
Conversations
Starting the TUI remains straightforward:
Tui::make($agent)->run();The TUI automatically creates a Session for the conversation. Automatic session titles now also work with the default in-memory configuration.
Use the new $tui->agent() accessor when your application needs the Agent currently answering, including after switching conversations or replacing the Agent through a custom command.
Upgrading: if your application previously passed an Agent with an existing conversation, pass that conversation as session: together with its matching sessionStore:. The TUI no longer imports the Agent's existing history automatically.
Stopping a response with Escape
Applications that enable response stopping must update their HTTP client configuration for Neuron AI 4:
use NeuronAI\HttpClient\Amp\AmpHttpClient;
use NeuronAI\HttpClient\StoppableHttpClient;
use NeuronInteraction\Interruption\StopSignal;
use function Amp\delay;
$stopSignal = new StopSignal($storage, 'chatKey');
$client = new StoppableHttpClient(
client: new AmpHttpClient(),
shouldStop: $stopSignal->stopCallback(
onPoll: static function (): void {
delay(0);
},
),
);Configure your AI provider with $client, then pass the same signal to the TUI:
Tui::make($agent, stopSignal: $stopSignal)->run();Install amphp/http-client in your application. The polling callback lets the TUI process Escape while a response is streaming.
When upgrading, replace the old NeuronInteraction\Http imports with those shown above. HTTP client arguments change from inner: and stopSignal: to client: and shouldStop:; onPoll: and pollInterval: belong to stopCallback().
Escape keeps the partial response when text has already arrived. It does not cancel local tools or guarantee that remote model generation has stopped.
Custom commands
Commands can change the answering Agent while keeping the conversation:
$adapter->useAgent($replacementAgent);To select another saved conversation while keeping the Agent's configuration:
$adapter->useSession($session);For other application changes required by the dependency upgrade, see the Neuron Interaction 0.9.0 migration notes and Neuron AI 4 migration guides.
Full changelog: 0.8.11...0.9.0