Skip to main content

Module validation

Module validation 

Source
Expand description

Shared validation helpers for extension capability identifiers.

Centralizes the rules for capability IDs (tool names, provider IDs, model IDs, plugin IDs) so tools, providers, and hooks share consistent validation behavior. New capability authors should reuse these helpers rather than re-deriving the rules inline.

Enums§

IdValidationError

Constants§

MAX_ID_LENGTH
Maximum length for any capability identifier segment.
RESERVED_CHARS
Reserved characters that must not appear in capability IDs. Currently : (used as namespace separator).

Functions§

sanitize_display_string
Strip control characters from a display string (tool descriptions, help text, etc.). Preserves newlines and tabs but removes ESC, BEL, and other C0/C1 control codes that could inject ANSI escape sequences into the TUI.
validate_id_segment
Validate a capability ID segment. Used for tool names, provider IDs, model IDs.
validation_error
Build a context-prefixed error message for validation failures.