| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | namespace Nexus\Mcp\Core\Schema; |
| 15: | |
| 16: | use Nexus\Assert\Assert; |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | final readonly class ProtocolVersion |
| 24: | { |
| 25: | public const string LATEST_VERSION = '2026-07-28'; |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | public const array PREVIOUS_VERSIONS = [ |
| 31: | '2025-11-25', |
| 32: | '2025-06-18', |
| 33: | '2025-03-26', |
| 34: | '2024-11-05', |
| 35: | ]; |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | public const array SUPPORTED_VERSIONS = [self::LATEST_VERSION]; |
| 41: | |
| 42: | |
| 43: | |
| 44: | |
| 45: | public string $version; |
| 46: | |
| 47: | public function __construct(string $version) |
| 48: | { |
| 49: | Assert::that($version) |
| 50: | ->isNonEmptyString('"protocolVersion" must be a non-empty string.') |
| 51: | ->matchesRegularExpression('/\A\d{4}-\d{2}-\d{2}\z/', '"protocolVersion" must be in the format "YYYY-MM-DD".') |
| 52: | ; |
| 53: | |
| 54: | $this->version = $version; |
| 55: | } |
| 56: | } |
| 57: | |