Repository navigation
Releases
1.0.0
Neuron TUI 1.0.0 rebuilds the terminal interface around Neuron AI agents and Symfony TUI, removing the dependency on Neuron Interaction.
Installation
Requires PHP 8.4.1+, Neuron AI 4.x and an interactive terminal. Symfony TUI ^8.1.8, CommonMark ^2.9 and Tempest Highlight ^2.16 are installed by Composer.
composer require asterixcapri/neuron-tui:^1.0Conversation interface
- Agent responses render as Markdown, including headings, lists, links and highlighted code blocks, using a shared color theme.
- Tool calls display their names and arguments, including nested JSON values. Their status updates in place, with failures shown as errors.
- The multiline composer stays at the bottom. Enter sends trimmed input; Shift+Enter inserts a newline. You can draft the next message while the agent responds when using a nonblocking HTTP client, such as Neuron's AmpHttpClient.
- An animated working indicator appears immediately above the composer. The mouse wheel scrolls conversation history; Ctrl+C exits.
- Customize the header with setTitle() and setDescription().
The updated examples/basic.php demonstrates OpenAI Responses with AmpHttpClient and Neuron's filesystem toolkit. Copy examples/.env.example to examples/.env and set OPENAI_API_KEY to run it.
Full changelog: 0.9.0...1.0.0
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
0.8.11
Documentation update for the 0.8 series.
- Streamlines the README and reorganizes examples to follow its sections.
- Clarifies how to register user message processors with
UserMessageProcessorsand pass them toTui::make(userMessageProcessors: ...). - Explains why the stoppable HTTP client's
onPollcallback callsdelay(0): it lets the event loop process Escape while a response is streaming. - Adds file-reference usage hints to the message-processing example and clarifies the API keys needed for model selection.
Full changelog: 0.8.10...0.8.11
0.8.10
StopSignal can now be injected when creating the TUI, alongside commands, session storage and message processors.
Breaking API change
Tui::setStopSignal() has been removed. Pass stopSignal: to Tui::make() or the constructor.
Before:
Tui::make($agent)
->setStopSignal($stopSignal)
->run();After:
Tui::make(
$agent,
stopSignal: $stopSignal,
)->run();Pass the same StopSignal instance used by the provider’s StoppableHttpClient. The parameter is optional and defaults to null; applications that do not configure a stop signal require no changes.
The full and stop examples have been updated. HTTP stop behavior remains unchanged.
0.8.9
Adds automatic session titles and processing of complete user messages, including attachments and metadata.
New features
- Automatic session titles. Conversations backed by a
NeuronInteraction\Session\Sessionreceive a title after successful turns. Titles appear in/resume. Generation runs in the background and makes an additional AI request, with at most three attempts per session. Existing titles are preserved. - Complete user messages. Drafts, queued messages and input history preserve attachments and metadata alongside text. Non-text content is represented with placeholders in the conversation.
- File-reference example. Run
composer messagesfromexamples/and tryExplain @composer.json. The processor adds file contents for the Agent while displaying the original input.
Breaking API changes
User-message processors now belong to Neuron Interaction:
use NeuronInteraction\Message\UserMessageProcessorInterface;
public function forAgent(UserMessage $message): UserMessage;
public function forDisplay(UserMessage $message): UserMessage;Replace the previous NeuronTui\Conversation\UserMessageProcessorInterface, whose methods accepted and returned strings. Return new messages without modifying the original message or its content blocks.
Tui::addUserMessageProcessor() has been removed. Register processors in a collection and inject it:
$processors = (new UserMessageProcessors())->addProcessor([
new MyProcessor(),
]);
Tui::make(
$agent,
userMessageProcessors: $processors,
)->run();Preparation follows registration order; display processing follows reverse order. Commands and command-generated prompts bypass preparation. Selection labels are no longer passed through message processors.
This release requires Neuron Interaction ~0.8.7, which also changes these APIs:
- Commands: create an empty collection, then register commands with
addCommand():$commands = (new Commands())->addCommand([ new ClearCommand(), new ResumeCommand(), ]);
- Command-generated prompts:
promptAgent()now accepts aUserMessage:$adapter->promptAgent(new UserMessage($prompt));
- Input history:
record()andolder()acceptUserMessageobjects; navigation andentries()return messages instead of strings. Previously persisted string-based input history requires migration or a reset. - Session summaries: titles can be
null. Custom session listings should provide a fallback, such asNew session.
0.8.8
Moves the user-message processor interface into the conversation namespace.
Breaking API change
Update the import in custom processors:
Before:
use NeuronTui\UserMessageProcessorInterface;After:
use NeuronTui\Conversation\UserMessageProcessorInterface;The method signatures remain forAgent(string $input): string and forDisplay(string $content): string. Registration through Tui::addUserMessageProcessor() and processing behavior are unchanged.
0.8.7
Adds custom user-message processing and inline command completion.
New features
Implement NeuronTui\UserMessageProcessorInterface to prepare submitted text for the Agent and customize its displayed form:
public function forAgent(string $input): string;
public function forDisplay(string $content): string;Register one processor or an array before starting the TUI:
Tui::make($agent)
->addUserMessageProcessor($processor)
->run();Preparation follows registration order; display processing follows reverse order. Display processing covers user messages, queued messages, loaded history and picker labels without changing stored history or selection values. Commands and command-generated prompts bypass preparation. A preparation error rejects submission and preserves the draft.
Command suggestions now complete names inline with Tab or Enter while preserving the surrounding draft. Elapsed working time uses minutes, hours and days; the stop keyboard hint is simpler, and conversation areas no longer reserve an empty left column.
Behavior change
Built-in skill-invocation compaction has been removed. Applications that need compact skill labels should implement forDisplay() and register their processor before starting the TUI.
0.8.6
Adds opt-in HTTP response stopping and improves the display of streamed conversations.
New features
- Press Escape to stop HTTP streaming through a shared
StopSignalandStoppableHttpClient. Neuron retains its native partial-response history handling. - Keeps messages in order between streamed tool calls, avoids empty assistant messages before tool activity and keeps the working indicator visible during turns.
- Displays recognized skill invocations compactly, with arguments inline.
- Improves secondary text contrast and aligns notices, warnings, errors and stopped-response labels consistently.
- Keeps the input prompt aligned with the first line of multiline input.
- Adds a dedicated stop example and OpenCode Zen to the demo model selection.
Integration
Requires Neuron Interaction ~0.8.6. Response stopping is experimental and opt-in:
Tui::make($agent)
->setStopSignal($stopSignal)
->run();Use the same signal in the provider's StoppableHttpClient and configure its onPoll callback to let the TUI process keyboard input while streaming, as shown in the README.
Stopping finalizes a partial response; it does not cancel local tools or guarantee that remote generation has stopped. Applications that do not enable stopping require no changes.
0.8.5
Commands can replace the Agent's history directly, and applications can inject user preferences through ConfigurationStore.
New features
- The displayed conversation follows history replacement after a command and before its notices, warnings, errors or prompts. Existing display state is preserved when the history object is unchanged.
- Inject
configurationStore:intoTui::make()or the constructor. Commands access the same preferences through$adapter->configurationStore(). - Adds focused
basic,sessions,modelandfullexamples. The model example persists the selected model between runs.
Breaking API changes
Requires Neuron Interaction ~0.8.5.
- Custom commands now implement
run(CommandAdapterInterface $adapter, string $value): void. Replace the previousCommandArgumentsparameter with the raw string value. - Replace
SelectionRequestwithSelectionwhen callingrequestSelection(). - Replace
$adapter->useSession($session)with$adapter->agent()->setChatHistory($session). Synchronization detects replacement of the history object, not arbitrary edits inside the same object. - The new
configurationStoreparameter precedesinputHistory. If passing input history positionally, update that argument position or useinputHistory:.
Neuron Interaction configuration now uses direct preferences instead of named Configuration objects:
$settings->write('model', $model);
$model = $settings->read('model', $defaultModel);The fallback determines the expected value type. Legacy named configurations are not read automatically; migrate any saved preferences your application needs.
0.8.4
Adds distinct command notices, warnings and errors, and explicit support for commands that can run while the Agent is working.
New features
notify()displays an informational notice;warn()displays a yellow warning;error()displays a red error.- Custom commands implementing
NeuronInteraction\Command\ConcurrentCommandInterfacecan be admitted and suggested during an active turn. Help and Leave already implement it. Ordinary commands remain unavailable while the Agent is working.
Breaking API changes
Requires Neuron Interaction ~0.8.4.
Replace command calls to say() with notify(). Use warn() and error() for warnings and expected failures.
Command kits have been removed. Register command instances directly:
$commands = (new Commands())->addCommand([
new ClearCommand(),
new ResumeCommand(),
]);Custom commands intended to run during an active turn must implement ConcurrentCommandInterface and preserve state used by the active Agent work.
If using Neuron Interaction's configuration store directly, replace ConfigurationStore::save($configuration) with write($configuration).