vibe.runtime_models.common

Common validation helpers and base models.

Provides shared utilities for runtime validation across all boundary types: - Base model configurations - Common field validators - Validation helpers for nested structures - Type aliases for common patterns

StrictModel

Base model with strict validation settings for VIBE runtime boundaries.

Configuration: - extra="forbid": Reject unknown fields to catch typos and schema drift - validate_assignment=True: Validate on attribute assignment, not just construction - frozen=False: Allow mutation after validation (needed for session updates) - arbitrary_types_allowed=True: Support NestedValue and other custom types

FlexibleModel

Base model with lenient validation for external/legacy data.

Use this when validating data from external sources that may have additional fields we don't care about (e.g., LLM provider responses).

Configuration: - extra="ignore": Silently ignore unknown fields - validate_assignment=False: Only validate on construction - frozen=False: Allow mutation - arbitrary_types_allowed=True: Support custom types

validate_non_empty_string

validate_non_empty_string(v: object) -> str

Validate that a string is not empty or whitespace-only.

Use with field_validator

@field_validator('field_name') @classmethod def validate_field(cls, v: Any) -> str: return validate_non_empty_string(v)

Parameters:
  • v (object) –

    Value to validate

Returns:
  • str

    The validated string (stripped of whitespace)

Raises:
  • TypeError

    If value is not a string

  • ValueError

    If string is empty or whitespace-only

validate_dict_keys_are_strings

validate_dict_keys_are_strings(v: object) -> dict[str, Any]

Validate that a dictionary has string keys.

Parameters:
  • v (object) –

    Value to validate

Returns:
  • dict[str, Any]

    The validated dictionary

Raises:
  • TypeError

    If value is not a dict or if any key is not a string