addArgument('user-id', InputArgument::OPTIONAL, 'User/session identifier', 'cli'); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $userId = (string) $input->getArgument('user-id'); $io->success('AI Agent CLI started. Press Ctrl+C or type "exit" to quit.'); $io->writeln(''); while (true) { $prompt = $io->ask('Question'); if ($prompt === null) { // EOF (e.g. piped input ended) $io->writeln(''); return Command::SUCCESS; } $prompt = trim($prompt); if ($prompt === '' || strtolower($prompt) === 'exit') { $io->writeln(''); return Command::SUCCESS; } $io->writeln(''); $io->writeln('Answer:'); foreach ($this->agentRunner->run($prompt, $userId) as $token) { $output->write($token); } $io->writeln(''); $io->writeln(''); } } }