error_code = $code; $this->http_status = $http_status; } /** * An error of the manager's own AI provider (message already redacted by the brain's adapters; escaped where printed). * * @param string $code Machine code. * @param string $message Plain text. */ public static function from_provider( string $code, string $message ): self { return new self( $code, $message ); } /** * Machine code. */ public function get_error_code(): string { return $this->error_code; } /** * HTTP status. */ public function get_http_status(): int { return $this->http_status; } /** * Whether retrying later may help. */ public function is_retryable(): bool { return in_array( $this->error_code, array( 'rate_limited', 'overloaded', 'server', 'network' ), true ); } }