parseImagesSection function

ImageRegistryConfig? parseImagesSection(
  1. Object? node
)

Parses the images: section (session image registry, issue #171): registry (kill switch), maxPerRequest (per-request unique-image cap) and perModel (per-model cap overrides, issue #1750). Strict — a bad schema throws ConfigException instead of silently keeping the defaults. Public so the settings flow's reload-after-write (issue #395) reuses the same parser the boot runs.

Implementation

ImageRegistryConfig? parseImagesSection(Object? node) {
  if (node == null) return null;
  if (node is! YamlMap) {
    throw ConfigException('images must be a map, got: $node');
  }
  final (registry, maxPerRequest, perModel) = _parseImagesEntries(node);
  if (registry == null && maxPerRequest == null && perModel == null) {
    return null;
  }
  return ImageRegistryConfig(
    enabled: registry ?? true,
    maxPerRequest: maxPerRequest ?? defaultMaxImagesPerRequest,
    perModel: perModel ?? const {},
  );
}