vs2convert 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,371 @@
1
+ """
2
+ Headless render verification for VS-2 shaders.
3
+
4
+ Requires moderngl + numpy + Pillow. Optional: the CLI degrades to a clear
5
+ "skipped" message when they are absent, rather than reporting a pass.
6
+
7
+ What this actually checks
8
+ -------------------------
9
+ The structural validator checks *shape*: manifest, API names, output
10
+ assignments. A shader can satisfy every structural rule and still render
11
+ nothing - that exact failure is in the skill's lessons log (2026-09-18). So
12
+ this renders actual frames and looks at the pixels.
13
+
14
+ It renders 3 frames at increasing `time` and reports:
15
+
16
+ luminance/alpha statistics per frame, and flags:
17
+ empty nothing was drawn (transparent or black everywhere)
18
+ flat something was drawn, but one colour in every pixel
19
+ dark visible but very dim at every sample
20
+ motion mean absolute luminance difference between frames. A shader can be
21
+ bright and high-contrast and still be broken if every frame is
22
+ identical - the body ignores `time`. No per-frame statistic can
23
+ see that; only comparing frames can.
24
+
25
+ A previous version of this module could not fail: it tested `rgba.size > 0`,
26
+ which is always true for a successfully created texture, so `--verify`
27
+ reported success without rendering anything meaningful. It also declared
28
+ `#version 300 es` while compiling a VS-2 body that uses `fragColor` and
29
+ `#ifdef GL_ES`. Both are fixed.
30
+
31
+ Exit semantics: `passed` is False if anything is flagged, if motion is below
32
+ the floor, or if the context/shader could not be created at all. There is no
33
+ code path that returns passed=True without having rendered and measured.
34
+ """
35
+ import re
36
+
37
+ # Mean absolute luminance difference (0-255) below which a multi-frame
38
+ # render counts as frozen.
39
+ MIN_MOTION = 1.0
40
+ WIDTH, HEIGHT = 256, 256
41
+ # Motion probe. A single pair of frames 1s apart is the wrong instrument for
42
+ # a shader whose animation is discrete rather than smooth: a per-frame random
43
+ # glitch (real Shadertoy case: the seed is quantised by mytrunc() to 6 levels)
44
+ # renders identically at t=0,1,2 and genuinely animates between them. Sampling
45
+ # 3 far-apart frames called that "frozen" and rejected a working shader.
46
+ # So: WIDE_SAMPLES catch a body that truly ignores time, while DENSE_FRAMES at
47
+ # frame rate catch discrete per-frame animation the wide probe cannot see.
48
+ TIME_SAMPLES = (0.0, 1.0, 2.0)
49
+ DENSE_FRAMES = 60
50
+ DENSE_SPAN = 1.0
51
+
52
+ # VS-2 emits a GLES-flavoured body (fragColor, #ifdef GL_ES) but the host
53
+ # context is desktop GL, so compile as 330 and let the engine's helpers in.
54
+ VERTEX_SHADER = """#version 330
55
+ in vec2 in_position;
56
+ out vec2 texCoord;
57
+ void main() {
58
+ texCoord = in_position * 0.5 + 0.5;
59
+ gl_Position = vec4(in_position, 0.0, 1.0);
60
+ }
61
+ """
62
+
63
+
64
+ def _manifest_params(source: str) -> list:
65
+ """Parameter names from the leading JSON manifest, if present."""
66
+ import json
67
+ m = re.search(r'/\*(.*?)\*/', source, re.DOTALL)
68
+ if not m:
69
+ return []
70
+ try:
71
+ data = json.loads(m.group(1).strip())
72
+ except (json.JSONDecodeError, ValueError):
73
+ return []
74
+ if not isinstance(data, dict):
75
+ return []
76
+ return [p.get('name', '') for p in data.get('parameters', []) if p.get('name')]
77
+
78
+
79
+ def _adapt(source: str) -> str:
80
+ """Adapt a VS-2 .frag body to a desktop GLSL 330 compile.
81
+
82
+ VS-2's engine injects precision guards, `fragColor`, `texCoord`, the
83
+ colour/alpha/resolution uniforms, and one uniform per manifest parameter.
84
+ On the host we declare them ourselves, or the body will not compile.
85
+ """
86
+ lines = [
87
+ '#version 330',
88
+ '',
89
+ '// Engine-provided uniforms (injected by VS-2, declared here for headless rendering)',
90
+ 'uniform vec2 resolution;',
91
+ 'uniform float time;',
92
+ 'uniform vec3 color;',
93
+ 'uniform float alpha;',
94
+ 'in vec2 texCoord;',
95
+ 'out vec4 fragColor;',
96
+ ]
97
+ # Image-input shaders need the engine's sampler and its resolution.
98
+ # VS-2 injects these; declare them only when the body uses them so we do
99
+ # not trip the "sampler not bound" path on procedural shaders.
100
+ if 'imageTex' in source:
101
+ lines += ['uniform sampler2D imageTex;',
102
+ 'uniform vec2 imageResolution;']
103
+ lines += ['', '// Custom parameters from manifest']
104
+ for pname in _manifest_params(source):
105
+ lines.append('uniform float %s;' % pname)
106
+ lines += ['', '// Original shader source follows', '']
107
+
108
+ # Strip a UTF-8 BOM if present: it lands on the `/*` of the manifest
109
+ # comment and the GLSL compiler rejects it with a bare syntax error.
110
+ source = source.lstrip('\ufeff')
111
+
112
+ # Strip the host-dictated #version and the GLES precision block.
113
+ body = re.sub(r'^\s*#version.*$', '', source, flags=re.MULTILINE)
114
+ body = re.sub(
115
+ r'#ifdef\s+GL_ES\s*\n\s*precision\s+highp\s+float\s*;\s*\n\s*#endif\s*\n?',
116
+ '', body)
117
+ return '\n'.join(lines) + body
118
+
119
+
120
+ def _manifest(source: str) -> dict:
121
+ import json
122
+ m = re.search(r'/\*(.*?)\*/', source, re.DOTALL)
123
+ if not m:
124
+ return {}
125
+ try:
126
+ data = json.loads(m.group(1).strip())
127
+ except (json.JSONDecodeError, ValueError):
128
+ return {}
129
+ return data if isinstance(data, dict) else {}
130
+
131
+
132
+ def _param_values(source: str) -> dict:
133
+ """Uniform values to send for the manifest's parameters.
134
+
135
+ VS-2 exposes each parameter as a normalized knob positioned at `default`
136
+ and maps that position onto the parameter's declared [min, max]. So when
137
+ a manifest declares min/max, `default` is a POSITION, not a magnitude:
138
+ uniform = min + default * (max - min). Sending the raw default instead
139
+ makes fly_through's `light` (default 1, max 40) run a single raymarch
140
+ iteration and render pure black.
141
+
142
+ A no-op for our own conversions, which never emit min/max.
143
+ """
144
+ data = _manifest(source)
145
+ out = {}
146
+ for p in data.get('parameters', []):
147
+ name = p.get('name')
148
+ if not name:
149
+ continue
150
+ default = float(p.get('default', 0.5))
151
+ if 'max' in p:
152
+ lo = float(p.get('min', 0.0))
153
+ hi = float(p['max'])
154
+ out[name] = lo + default * (hi - lo) if hi != lo else lo
155
+ else:
156
+ out[name] = default
157
+ return out
158
+
159
+
160
+ def _declares_movement(source: str) -> bool:
161
+ """Manifest `movement` flag. False means the shader is static by design
162
+ and must not be motion-checked (e.g. hiding_squares)."""
163
+ return _manifest(source).get('movement', True) is not False
164
+
165
+
166
+ def _load_default_texture(ctx):
167
+ """Bind a default image for image-input shaders.
168
+
169
+ VS-2's gallery renders image-input shaders against a default image, so
170
+ the headless gate does the same: it is what makes a preview comparable
171
+ to the app rather than a black frame. Returns None if the asset is
172
+ missing, in which case the sampler reads the driver's zero texture and
173
+ the shader takes whatever fallback branch it has.
174
+ """
175
+ try:
176
+ import importlib.resources as resources
177
+
178
+ from PIL import Image
179
+ except ImportError:
180
+ return None
181
+ try:
182
+ asset = (resources.files('vs2convert.renderer')
183
+ / 'assets' / 'default_texture.png')
184
+ with resources.as_file(asset) as path:
185
+ img = Image.open(path).convert('RGBA')
186
+ size, data = img.size, img.tobytes()
187
+ except (FileNotFoundError, ModuleNotFoundError):
188
+ return None
189
+ return ctx.texture(size, 4, data)
190
+
191
+
192
+ def _stats(arr):
193
+ """(mean, std, alpha) over an HxWx4 float array, 0-255 luminance."""
194
+ lum = arr[..., :3].mean(axis=2)
195
+ return float(lum.mean()), float(lum.std()), float(arr[..., 3].mean())
196
+
197
+
198
+ def run_verification(shader_content: str, shader_name: str) -> dict:
199
+ """Render `shader_content` headlessly and judge the pixels.
200
+
201
+ Returns {'passed': bool, 'errors': [...], 'metrics': {...}}.
202
+ `passed` is True only if frames were rendered AND measured AND looked
203
+ like a visible, animating shader.
204
+ """
205
+ try:
206
+ import moderngl
207
+ import numpy as np
208
+ except ImportError as e:
209
+ return {
210
+ "passed": False,
211
+ "errors": ["render verification unavailable: %s "
212
+ "(rendering needs moderngl+numpy+Pillow; "
213
+ "install vs2convert[render])" % e],
214
+ "metrics": {},
215
+ }
216
+
217
+ errors = []
218
+ metrics = {}
219
+
220
+ try:
221
+ ctx = moderngl.create_standalone_context()
222
+ except Exception as e:
223
+ return {"passed": False,
224
+ "errors": ["could not create a GL context: %s" % e],
225
+ "metrics": {}}
226
+
227
+ try:
228
+ try:
229
+ # Pass sources as strings: compiling the vertex shader to its own
230
+ # object first and then linking it again loses its `out` varying.
231
+ prog = ctx.program(vertex_shader=VERTEX_SHADER,
232
+ fragment_shader=_adapt(shader_content))
233
+ except Exception as e:
234
+ return {"passed": False,
235
+ "errors": ["shader failed to compile: %s" % e],
236
+ "metrics": {}}
237
+
238
+ # Fullscreen triangle in clip space (covers the viewport with 3 verts).
239
+ tri = ctx.buffer(np.array(
240
+ [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0], dtype='f4').tobytes())
241
+ vao = ctx.vertex_array(prog, [(tri, '2f', 'in_position')])
242
+
243
+ texture = ctx.texture((WIDTH, HEIGHT), 4, dtype='f1')
244
+ fbo = ctx.framebuffer([texture])
245
+ texture.filter = (moderngl.NEAREST, moderngl.NEAREST)
246
+
247
+ # Image-input shaders sample `imageTex`. VS-2 binds the layer's
248
+ # configured image to that sampler, and the gallery previews these
249
+ # shaders against a default image, so binding one here mirrors the
250
+ # engine. VS-2 reports imageResolution = (0,0) when no image is set,
251
+ # which is how a shader tells "procedural fallback" from "has image";
252
+ # we bind a real image, so we report its true size.
253
+ img_tex = None
254
+ if 'imageTex' in prog:
255
+ img_tex = _load_default_texture(ctx)
256
+ if img_tex is not None:
257
+ img_tex.use(0)
258
+ prog['imageTex'].value = 0
259
+ if 'imageResolution' in prog:
260
+ prog['imageResolution'].value = tuple(
261
+ float(v) for v in img_tex.size)
262
+
263
+ param_defaults = _param_values(shader_content)
264
+ animated = _declares_movement(shader_content)
265
+ metrics['params'] = len(param_defaults)
266
+ metrics['movement'] = animated
267
+
268
+ frames = []
269
+ for t in list(TIME_SAMPLES) + [i * DENSE_SPAN / DENSE_FRAMES
270
+ for i in range(DENSE_FRAMES)]:
271
+ fbo.use()
272
+ fbo.clear(0.0, 0.0, 0.0, 0.0)
273
+ if 'resolution' in prog:
274
+ prog['resolution'].value = (WIDTH, HEIGHT)
275
+ if 'color' in prog:
276
+ prog['color'].value = (1.0, 1.0, 1.0)
277
+ if 'time' in prog:
278
+ prog['time'].value = t
279
+ if 'alpha' in prog:
280
+ prog['alpha'].value = 1.0
281
+ # Manifest parameters MUST be set: VS-2 initialises each knob to
282
+ # its manifest default. Leaving them at 0 renders many shaders
283
+ # black (e.g. acid_jelly scales its output by `level`).
284
+ for pname, pval in param_defaults.items():
285
+ if pname in prog:
286
+ prog[pname].value = pval
287
+ vao.render(moderngl.TRIANGLES)
288
+ buf = fbo.read(components=4, dtype='f1')
289
+ arr = np.frombuffer(buf, dtype=np.uint8).reshape(
290
+ HEIGHT, WIDTH, 4).astype(np.float32)
291
+ frames.append(arr)
292
+
293
+ # The wide probe uses only the first len(TIME_SAMPLES) frames.
294
+ wide = frames[:len(TIME_SAMPLES)]
295
+ dense = frames[len(TIME_SAMPLES):]
296
+ means, stds, alphas = zip(*[_stats(f) for f in wide])
297
+ mean, std, alpha = max(means), max(stds), max(alphas)
298
+ def _delta(imgs, consecutive=False):
299
+ if len(imgs) < 2:
300
+ return 0.0
301
+ lums = [f[..., :3].mean(axis=2) for f in imgs]
302
+ if consecutive:
303
+ return max(float(np.abs(lums[i] - lums[i + 1]).mean())
304
+ for i in range(len(lums) - 1))
305
+ return max(float(np.abs(lums[i] - lums[j]).mean())
306
+ for i in range(len(lums))
307
+ for j in range(i + 1, len(lums)))
308
+
309
+ wide_motion = _delta(wide)
310
+ # the dense run is 60 one-per-frame samples: what the probe looks for
311
+ # is per-frame animation, i.e. the consecutive delta, while all-pairs
312
+ # costs C(60,2)=1770 pixel diffs. Slow drift between distant frames
313
+ # is the wide probe's job (3 frames, still all-pairs).
314
+ # test_shader_pipeline.test_verify_fails_a_frozen_animated_shader
315
+ # keeps a motionless shader failing this gate.
316
+ dense_motion = _delta(dense, consecutive=True)
317
+ distinct = len({f.tobytes() for f in dense})
318
+ # A shader animates if EITHER probe sees change: smooth shaders show it
319
+ # across wide samples, discrete per-frame ones within the dense run.
320
+ motion = max(wide_motion, dense_motion)
321
+
322
+ metrics = {
323
+ "resolution": (WIDTH, HEIGHT),
324
+ "frames": len(frames),
325
+ "mean": round(mean, 2),
326
+ "std": round(std, 2),
327
+ "alpha": round(alpha, 2),
328
+ "motion": round(motion, 2),
329
+ "wide_motion": round(wide_motion, 2),
330
+ "dense_motion": round(dense_motion, 2),
331
+ "distinct_dense_frames": distinct,
332
+ }
333
+
334
+ if mean < 1.0 and alpha < 1.0:
335
+ errors.append("empty: nothing was drawn (mean=%.2f alpha=%.2f)"
336
+ % (mean, alpha))
337
+ elif std < 1.0:
338
+ errors.append("flat: one colour in every pixel (std=%.2f)" % std)
339
+ elif mean < 3.0:
340
+ errors.append("dark: visible but very dim (mean=%.2f)" % mean)
341
+ # Only motion-check shaders that declare movement. A static shader
342
+ # rendering identical frames is correct, not broken.
343
+ #
344
+ # Two thresholds, because the two probes measure different things.
345
+ # A smooth shader drifts in mean luminance between frames 1s apart, so
346
+ # the wide probe keeps the original 1.0 floor. A discrete per-frame
347
+ # shader barely moves mean luminance but produces a different image
348
+ # every frame, so for the dense probe the honest test is whether the
349
+ # frames are byte-identical - and the floor scales down to match, since
350
+ # 60 per-frame deltas each contribute 1/60 of the wide average.
351
+ if animated:
352
+ if wide_motion < MIN_MOTION and distinct < DENSE_FRAMES:
353
+ errors.append(
354
+ "frozen: neither the wide probe (motion=%.2f < %.1f over "
355
+ "%ds) nor the dense probe (%d/%d distinct frames) sees the "
356
+ "body change - it appears to ignore `time`"
357
+ % (wide_motion, MIN_MOTION, len(wide), distinct,
358
+ DENSE_FRAMES))
359
+
360
+ metrics['gl_version'] = ctx.info.get('GL_VERSION')
361
+ return {"passed": not errors, "errors": errors, "metrics": metrics}
362
+
363
+ except Exception as e:
364
+ return {"passed": False,
365
+ "errors": ["render verification failed: %s" % e],
366
+ "metrics": metrics}
367
+ finally:
368
+ try:
369
+ ctx.release()
370
+ except Exception:
371
+ pass
@@ -0,0 +1,3 @@
1
+ """
2
+ Validation modules for VS-2 shaders.
3
+ """
@@ -0,0 +1,197 @@
1
+ """
2
+ Structural validation for VS-2 shaders.
3
+
4
+ Bundled rules from validation-checklist.md and golden examples.
5
+ """
6
+
7
+ import json
8
+ import re
9
+
10
+ from ..core.textutil import code_only, ENGINE_VARS, ENGINE_VAR_RE
11
+
12
+
13
+ def run_validation(content: str, shader_name: str) -> dict:
14
+ """
15
+ Run structural validation on a VS-2 shader.
16
+
17
+ Args:
18
+ content: Full .frag file content
19
+ shader_name: Name of the shader
20
+
21
+ Returns:
22
+ dict with keys:
23
+ - passed: bool
24
+ - errors: list[str]
25
+ - warnings: list[str]
26
+ """
27
+ errors = []
28
+ warnings = []
29
+
30
+ # Check for HLSL leftovers / bundled textures
31
+ code = code_only(content)
32
+ if _has_hlsl_leftovers(code):
33
+ if re.search(r'\btexture2D\s*\(|\btex2D\s*\(', code):
34
+ errors.append(
35
+ "texture2D()/tex2D() present - bundled texture input is a "
36
+ "hard gate; convert it by hand")
37
+ else:
38
+ errors.append("Contains HLSL functions (frac, lerp) or gl_FragColor")
39
+
40
+ # Check for engine variable redeclaration
41
+ if _has_engine_var_redecl(content):
42
+ errors.append("Engine variables redeclared at global scope")
43
+
44
+ # Check for custom speed parameters
45
+ if _has_custom_speed_params(content):
46
+ warnings.append("Contains custom speed parameter (should use native 'time')")
47
+
48
+ # Check for >7 parameters
49
+ param_count = _count_parameters(content)
50
+ if param_count > 7:
51
+ errors.append(f"Too many parameters: {param_count} (max 7)")
52
+
53
+ # Check parameter names are snake_case
54
+ if _has_non_snake_case_params(content):
55
+ errors.append("Parameter names are not snake_case")
56
+
57
+ # Check for uniform declarations
58
+ if _has_uniform_declarations(content):
59
+ errors.append("Contains uniform/varying declarations "
60
+ "(engine injects these; not allowed)")
61
+
62
+ # Check for missing output pattern
63
+ if not _has_output_pattern(content):
64
+ warnings.append("Missing coloredPixels or image alpha output pattern")
65
+
66
+ # Check for missing coordinate setup
67
+ if not _has_coordinate_setup(content):
68
+ warnings.append("Missing coordinate setup (aspect ratio, pan)")
69
+
70
+ # Check for missing manifest
71
+ if not _has_manifest(content):
72
+ warnings.append("Missing JSON manifest header")
73
+
74
+ passed = len(errors) == 0
75
+
76
+ return {
77
+ "passed": passed,
78
+ "errors": errors,
79
+ "warnings": warnings
80
+ }
81
+
82
+
83
+ def _has_hlsl_leftovers(content: str) -> bool:
84
+ """Check for HLSL-specific functions. Pass code_only(content)."""
85
+ if re.search(r'\btexture2D\s*\(|\btex2D\s*\(', content):
86
+ return True
87
+ return any(re.search(p, content) for p in [
88
+ r'\bfrac\s*\(',
89
+ r'\blerp\s*\(',
90
+ r'gl_FragColor',
91
+ ])
92
+
93
+
94
+ def _has_engine_var_redecl(content: str) -> bool:
95
+ """Check for engine variable redeclaration."""
96
+ for line in content.split('\n'):
97
+ if line and not line[0].isspace() and ENGINE_VAR_RE.match(line):
98
+ return True
99
+ return False
100
+
101
+
102
+ def _has_custom_speed_params(content: str) -> bool:
103
+ """Check for custom speed parameters in manifest."""
104
+ speed_patterns = ['speed', 'rate', 'frequency', 'freq', 'twist_speed']
105
+ for data in _iter_manifests(content):
106
+ if 'parameters' not in data:
107
+ continue
108
+ for p in data.get('parameters', []):
109
+ name = p.get('name', '')
110
+ if any(kw in name.lower() for kw in speed_patterns):
111
+ return True
112
+ return False
113
+
114
+
115
+ def _iter_manifests(content: str):
116
+ """Yield parsed JSON dicts from all /* {json} */ comment blocks.
117
+ Strip delimiters, try each block."""
118
+ for block in re.findall(r'/\*(.*?)\*/', content, re.DOTALL):
119
+ try:
120
+ data = json.loads(block.strip())
121
+ except (json.JSONDecodeError, ValueError):
122
+ continue
123
+ if isinstance(data, dict):
124
+ yield data
125
+
126
+
127
+ def _count_parameters(content: str) -> int:
128
+ """Count parameters in manifest."""
129
+ for data in _iter_manifests(content):
130
+ if 'parameters' in data:
131
+ return len(data.get('parameters', []))
132
+
133
+ # Fallback: count uniform declarations (GLSL order: uniform <type> <name>;)
134
+ uniform_re = re.compile(
135
+ r'uniform\s+(?:float|vec2|vec3|vec4|int|mat2|mat3|sampler2D)\s+\w+')
136
+ return len(uniform_re.findall(content))
137
+
138
+
139
+ def _has_non_snake_case_params(content: str) -> bool:
140
+ """Check if parameter names are not snake_case."""
141
+ for data in _iter_manifests(content):
142
+ if 'parameters' not in data:
143
+ continue
144
+ for p in data.get('parameters', []):
145
+ name = p.get('name', '')
146
+ if not re.match(r'^[a-z][a-z0-9_]*$', name):
147
+ return True
148
+ return False # manifest found and parsed: its names are the truth
149
+ return False # no manifest: missing-manifest warning already covers this
150
+
151
+
152
+ def _has_uniform_declarations(content: str) -> bool:
153
+ """Check for uniform/varying declarations.
154
+
155
+ VS-2 injects its own uniforms and varyings; ANY declaration in the body
156
+ shadows engine-injected state. This is an error, not a warning, and it
157
+ applies to *custom* uniforms too - the engine owns the whole uniform
158
+ namespace. Matches the external validator's rule (validate_shader.py:125)
159
+ which matches `^\\s*(uniform|varying)\\s+`.
160
+ """
161
+ decl_re = re.compile(r'^\s*(uniform|varying)\s+')
162
+ for line in content.split('\n'):
163
+ if line and not line.lstrip().startswith('//') and decl_re.match(line):
164
+ return True
165
+ return False
166
+
167
+
168
+ def _has_output_pattern(content: str) -> bool:
169
+ """Check for output pattern (coloredPixels or image alpha)."""
170
+ if 'coloredPixels' in content:
171
+ return True
172
+ if 'fragColor' in content and ('alpha' in content or 'imgMask' in content):
173
+ return True
174
+ return False
175
+
176
+
177
+ # Every real spelling: both ratio orders (`resolution.x / resolution.y`, used by
178
+ # 10 of the 72 shipped conversions), the `resolution.xy / resolution.y` vec2 form
179
+ # (3d_grid, circle_tunnel), and `resolution / resolution.y`. The backreference
180
+ # rejects self-division, e.g. `resolution.x / resolution.x`.
181
+ _ASPECT_RE = re.compile(
182
+ r'resolution\.(x|y|xy)\s*/\s*resolution\.(?!\1\b)(?:x|y|xy)'
183
+ r'|resolution\s*/\s*resolution\.y')
184
+
185
+
186
+ def _has_coordinate_setup(content: str) -> bool:
187
+ """Check for coordinate setup (aspect ratio, pan)."""
188
+ if 'aspect' in content and 'div' in content:
189
+ return True
190
+ if 'uv =' in content:
191
+ return True
192
+ return bool(_ASPECT_RE.search(content))
193
+
194
+
195
+ def _has_manifest(content: str) -> bool:
196
+ """Check for JSON manifest header."""
197
+ return any('parameters' in data for data in _iter_manifests(content))