1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9: *
10: * For the full copyright and license information, please view
11: * the LICENSE file that was distributed with this source code.
12: */
13:
14: namespace Nexus\Mcp\Extension\Tasks\Client\Exception;
15:
16: use Nexus\Mcp\Core\Exception\McpExceptionInterface;
17: use Nexus\Mcp\Core\SafeDisplay;
18:
19: /**
20: * Thrown when a polled task stays `input_required` with no new input requests for the poll loop's stall ceiling.
21: */
22: final class StalledTaskException extends \RuntimeException implements McpExceptionInterface
23: {
24: /**
25: * @param non-empty-string $taskId
26: */
27: public function __construct(string $taskId, int $polls)
28: {
29: parent::__construct(\sprintf(
30: 'Task "%s" stayed input_required for %d polls without new input requests.',
31: SafeDisplay::sanitise($taskId),
32: $polls,
33: ));
34: }
35: }
36: