euv-cli 0.51.0

Cross-platform CLI tool for the euv native UI framework supporting run, build, check, fmt, doctor, new, and Hyperlane SSE dynamic updates across all supported platforms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
use super::*;

/// Configuration for `euv blender doctor`.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct BlenderDoctorConfig {
    /// Optional explicit path to a Blender executable overriding environment and PATH discovery.
    pub(crate) blender_bin: Option<PathBuf>,
    /// Localhost TCP port probed for the official Blender Lab MCP bridge (default `9876`).
    #[get(type(copy))]
    pub(crate) mcp_port: u16,
    /// Whether to invoke Blender in background mode to verify `io_scene_gltf2` readiness.
    #[get(type(copy))]
    pub(crate) probe_gltf_exporter: bool,
}

/// Structured host readiness report produced by `euv blender doctor`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderDoctorReport {
    /// Whether a Blender binary was detected on this machine.
    #[get(type(copy))]
    pub(crate) blender_found: bool,
    /// Resolved absolute path to the Blender binary, if found.
    pub(crate) blender_path: Option<String>,
    /// Discovery origin (`cli-flag`, `env-var`, `path`, `os-install`, or `not-found`).
    #[get(type(copy))]
    pub(crate) binary_source: BlenderBinarySource,
    /// Raw version line reported by `blender --version`, if available.
    pub(crate) version_raw: Option<String>,
    /// Parsed major version (`4`, `5`, etc.).
    #[get(type(copy))]
    pub(crate) version_major: Option<u16>,
    /// Parsed minor version (`0`, `1`, `2`, etc.).
    #[get(type(copy))]
    pub(crate) version_minor: Option<u16>,
    /// Parsed patch version.
    #[get(type(copy))]
    pub(crate) version_patch: Option<u16>,
    /// Whether the detected Blender version meets the `4.0+` glTF 2.0 / Principled BSDF floor.
    #[get(type(copy))]
    pub(crate) supports_gltf_exporter: bool,
    /// Whether Blender's `io_scene_gltf2` operator responded ready.
    #[get(type(copy))]
    pub(crate) gltf_exporter_ready: bool,
    /// Whether the detected Blender version meets the `5.1+` Blender Lab MCP requirement.
    #[get(type(copy))]
    pub(crate) supports_blender_mcp_version: bool,
    /// Whether the `euv_live_link.py` add-on file was detected in a Blender user add-ons directory.
    #[get(type(copy))]
    pub(crate) live_link_addon_installed: bool,
    /// Discovered path to an installed `euv_live_link.py` add-on, if present.
    pub(crate) live_link_addon_path: Option<String>,
    /// Default port used by `euv blender live-sync` (`9877`).
    #[get(type(copy))]
    pub(crate) live_sync_default_port: u16,
    /// Probed localhost TCP port for the official Blender Lab MCP bridge (`9876`).
    #[get(type(copy))]
    pub(crate) mcp_port: u16,
    /// Whether the official Blender Lab MCP TCP bridge answered on `127.0.0.1:<mcp_port>`.
    #[get(type(copy))]
    pub(crate) mcp_reachable: bool,
    /// Actionable setup hints when Blender, the Live-Link add-on, or MCP is not yet configured.
    pub(crate) hints: Vec<String>,
}

/// Summary of one 64-byte-aligned binary section inside an `.euv3d` archive.
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct BlenderEuv3dSectionSummary {
    /// Semantic section label.
    pub(crate) kind: String,
    /// Starting byte offset inside the archive.
    #[get(type(copy))]
    pub(crate) offset: u64,
    /// Payload byte length excluding trailing alignment padding.
    #[get(type(copy))]
    pub(crate) byte_length: u64,
    /// Number of logical elements stored in the section.
    #[get(type(copy))]
    pub(crate) element_count: u32,
    /// Whether `offset` is aligned to `64` bytes.
    #[get(type(copy))]
    pub(crate) aligned_64: bool,
}

/// Native `.blend` inspection summary embedded inside `BlenderInspectReport`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderNativeBlendSummary {
    /// Formatted Blender version string (`"4.2"`, `"5.1"`, etc.).
    pub(crate) version: String,
    /// Pointer width in bytes (`4` or `8`).
    #[get(type(copy))]
    pub(crate) pointer_size_bytes: u8,
    /// Whether the file uses little-endian byte order.
    #[get(type(copy))]
    pub(crate) is_little_endian: bool,
    /// Whether the file uses Blender 5.0+ extended large headers (`LargeBHead8`).
    #[get(type(copy))]
    pub(crate) is_large_header_v5: bool,
    /// Detected container compression (`"none"`, `"gzip"`, or `"zstd"`).
    pub(crate) compression: String,
    /// Total number of `BHead` blocks scanned.
    #[get(type(copy))]
    pub(crate) block_count: usize,
    /// Number of SDNA struct definitions parsed from `DNA1`.
    #[get(type(copy))]
    pub(crate) dna_struct_count: usize,
    /// Discovered Scene (`SC`) names.
    pub(crate) scenes: Vec<String>,
    /// Discovered Collection (`GR`) names.
    pub(crate) collections: Vec<String>,
    /// Discovered Object (`OB`) names.
    pub(crate) objects: Vec<String>,
    /// Discovered Mesh (`ME`) names.
    pub(crate) meshes: Vec<String>,
    /// Discovered Material (`MA`) names.
    pub(crate) materials: Vec<String>,
    /// Discovered Camera (`CA`) names.
    pub(crate) cameras: Vec<String>,
    /// Discovered Light (`LA`) names.
    pub(crate) lights: Vec<String>,
    /// Discovered Armature (`AR`) names.
    pub(crate) armatures: Vec<String>,
    /// Discovered Animation Action (`AC`) names.
    pub(crate) actions: Vec<String>,
    /// Discovered Image (`IM`) names.
    pub(crate) images: Vec<String>,
    /// Discovered NodeTree (`NT`) names.
    pub(crate) node_trees: Vec<String>,
    /// Non-fatal structural warnings recorded during inspection.
    pub(crate) warnings: Vec<String>,
}

/// Scene-level geometry, material, rig, and animation inventory for `.glb`, `.gltf`, `.euv3d`, and `.obj` files.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderSceneSummary {
    /// Scene or root asset name.
    pub(crate) name: String,
    /// Generator tool string (e.g., `"Khronos glTF Blender I/O"`).
    pub(crate) generator: String,
    /// Total hierarchical scene nodes.
    #[get(type(copy))]
    pub(crate) node_count: usize,
    /// Blender Collection names discovered in `extras.euv`.
    pub(crate) collections: Vec<String>,
    /// Total mesh primitives.
    #[get(type(copy))]
    pub(crate) mesh_count: usize,
    /// Sum of `LOD0` vertices across all meshes.
    #[get(type(copy))]
    pub(crate) total_vertices: usize,
    /// Sum of `LOD0` triangles across all meshes.
    #[get(type(copy))]
    pub(crate) total_triangles: usize,
    /// Total Principled BSDF materials.
    #[get(type(copy))]
    pub(crate) material_count: usize,
    /// Ordered material names.
    pub(crate) material_names: Vec<String>,
    /// Total decoded textures.
    #[get(type(copy))]
    pub(crate) texture_count: usize,
    /// Total skeletal armature skins.
    #[get(type(copy))]
    pub(crate) skin_count: usize,
    /// Total animation clips.
    #[get(type(copy))]
    pub(crate) animation_count: usize,
    /// Ordered animation clip names.
    pub(crate) animation_names: Vec<String>,
    /// Total imported cameras.
    #[get(type(copy))]
    pub(crate) camera_count: usize,
    /// Total imported punctual and area lights.
    #[get(type(copy))]
    pub(crate) light_count: usize,
}

/// Baked `.euv3d` archive summary embedded inside `BlenderInspectReport`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderEuv3dSummary {
    /// `.euv3d` format specification version.
    #[get(type(copy))]
    pub(crate) format_version: u32,
    /// Header CRC32 checksum of the payload section bytes.
    #[get(type(copy))]
    pub(crate) content_crc32: u32,
    /// Deterministic 64-bit FNV-1a archive digest.
    #[get(type(copy))]
    pub(crate) digest_fnv1a: u64,
    /// Whether pre-baked SIMD BVH4 acceleration sections are present.
    #[get(type(copy))]
    pub(crate) has_bvh4: bool,
    /// Whether spatial meshlet cluster sections are present.
    #[get(type(copy))]
    pub(crate) has_meshlets: bool,
    /// Whether multi-level QEM LOD chains are present.
    #[get(type(copy))]
    pub(crate) has_lods: bool,
    /// Maximum LOD count across meshes inside the archive.
    #[get(type(copy))]
    pub(crate) max_lod_levels: usize,
    /// Total pre-baked local BVH4 acceleration trees restored without rebuild.
    #[get(type(copy))]
    pub(crate) bvh_count: usize,
    /// Per-section alignment and byte-size breakdown.
    pub(crate) sections: Vec<BlenderEuv3dSectionSummary>,
}

/// Unified pure-Rust inspection report produced by `euv blender inspect <file>`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderInspectReport {
    /// Inspected file path.
    pub(crate) path: String,
    /// Detected 3D asset format (`blend`, `glb`, `gltf`, `euv3d`, `obj`).
    #[get(type(copy))]
    pub(crate) format: BlenderAssetFormat,
    /// File size on disk in bytes.
    #[get(type(copy))]
    pub(crate) file_bytes: u64,
    /// Native `.blend` inspection details when `format == Blend`.
    pub(crate) blend: Option<BlenderNativeBlendSummary>,
    /// Scene inventory for `.glb`, `.gltf`, `.euv3d`, and `.obj` files.
    pub(crate) scene: Option<BlenderSceneSummary>,
    /// Binary package details when `format == Euv3d`.
    pub(crate) euv3d: Option<BlenderEuv3dSummary>,
}

/// Configuration for `euv blender import`.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct BlenderImportConfig {
    /// Source `.blend`, `.glb`, `.gltf`, or `.obj` file path.
    pub(crate) input: PathBuf,
    /// Output directory receiving the imported `.glb`, manifest, and optional `.euv3d`.
    pub(crate) out_dir: PathBuf,
    /// Optional explicit Blender binary override for `.blend` files.
    pub(crate) blender_bin: Option<PathBuf>,
    /// Whether to also compile an optimized `.euv3d` archive into `out_dir`.
    #[get(type(copy))]
    pub(crate) bake: bool,
    /// Target QEM LOD chain depth when `bake` is enabled (`1..=4`).
    #[get(type(copy))]
    pub(crate) lods: usize,
    /// Whether to build spatial meshlets when `bake` is enabled.
    #[get(type(copy))]
    pub(crate) build_meshlets: bool,
    /// Whether to pre-bake SIMD BVH4 acceleration trees when `bake` is enabled.
    #[get(type(copy))]
    pub(crate) bake_bvh4: bool,
    /// Return a dry-run execution plan without invoking Blender or writing files.
    #[get(type(copy))]
    pub(crate) plan: bool,
}

/// Machine-readable report produced by `euv blender import`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderImportReport {
    /// Source asset path.
    pub(crate) input_path: String,
    /// Detected source format.
    #[get(type(copy))]
    pub(crate) input_format: BlenderAssetFormat,
    /// Output directory path.
    pub(crate) out_dir: String,
    /// Path to the exported or copied `.glb`/`.gltf`/`.obj` file inside `out_dir`, if written.
    pub(crate) asset_output_path: Option<String>,
    /// Path to the compiled `.euv3d` file inside `out_dir`, if `--bake` was enabled.
    pub(crate) baked_euv3d_path: Option<String>,
    /// Path to the generated `asset-manifest.json` file, if written.
    pub(crate) manifest_path: Option<String>,
    /// Planned headless Blender invocation when `--plan` is used or `.blend` was exported.
    pub(crate) planned_command: Vec<String>,
    /// Imported scene inventory summary, when executed.
    pub(crate) scene: Option<BlenderSceneSummary>,
    /// Elapsed wall-clock duration in milliseconds.
    #[get(type(copy))]
    pub(crate) elapsed_ms: u64,
}

/// Configuration for `euv blender bake`.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct BlenderBakeConfig {
    /// Source `.blend`, `.glb`, `.gltf`, or `.obj` file path.
    pub(crate) input: PathBuf,
    /// Destination `.euv3d` output file path.
    pub(crate) out_file: PathBuf,
    /// Optional explicit Blender binary override for `.blend` files.
    pub(crate) blender_bin: Option<PathBuf>,
    /// Number of Garland-Heckbert QEM LOD levels (`1..=4`).
    #[get(type(copy))]
    pub(crate) lods: usize,
    /// Whether to generate spatially clustered meshlets.
    #[get(type(copy))]
    pub(crate) build_meshlets: bool,
    /// Whether to pre-bake local SIMD BVH4 acceleration trees.
    #[get(type(copy))]
    pub(crate) bake_bvh4: bool,
    /// Return a dry-run execution plan without running Blender or writing output.
    #[get(type(copy))]
    pub(crate) plan: bool,
}

/// Machine-readable report produced by `euv blender bake`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderBakeReport {
    /// Source asset path.
    pub(crate) input_path: String,
    /// Detected source format.
    #[get(type(copy))]
    pub(crate) input_format: BlenderAssetFormat,
    /// Written `.euv3d` output file path.
    pub(crate) out_file: String,
    /// Input file size in bytes.
    #[get(type(copy))]
    pub(crate) input_bytes: u64,
    /// Compiled `.euv3d` archive size in bytes.
    #[get(type(copy))]
    pub(crate) output_bytes: u64,
    /// Configured QEM LOD levels.
    #[get(type(copy))]
    pub(crate) lod_levels: usize,
    /// Whether spatial meshlets were enabled.
    #[get(type(copy))]
    pub(crate) meshlets_enabled: bool,
    /// Whether pre-baked SIMD BVH4 trees were enabled.
    #[get(type(copy))]
    pub(crate) bvh4_enabled: bool,
    /// Verified CRC32 checksum of the `.euv3d` payload.
    #[get(type(copy))]
    pub(crate) content_crc32: u32,
    /// Verified FNV-1a 64-bit content digest of the `.euv3d` payload.
    #[get(type(copy))]
    pub(crate) digest_fnv1a: u64,
    /// Total section entries written into the `.euv3d` table.
    #[get(type(copy))]
    pub(crate) section_count: usize,
    /// Imported scene inventory summary.
    pub(crate) scene: Option<BlenderSceneSummary>,
    /// Planned commands when `--plan` is set.
    pub(crate) planned_command: Vec<String>,
    /// Elapsed wall-clock bake time in milliseconds.
    #[get(type(copy))]
    pub(crate) elapsed_ms: u64,
}

/// Configuration for `euv blender addon-install`.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct BlenderAddonInstallConfig {
    /// Explicit destination file or directory path for `euv_live_link.py`.
    pub(crate) out: Option<PathBuf>,
    /// When `true`, returns the raw Python source without writing to disk.
    #[get(type(copy))]
    pub(crate) print_only: bool,
}

/// Result report produced by `euv blender addon-install`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderAddonInstallReport {
    /// Canonical add-on filename (`euv_live_link.py`).
    pub(crate) filename: String,
    /// Destination path written on disk, or `None` when `--print` was requested.
    pub(crate) installed_path: Option<String>,
    /// Byte length of the add-on Python source.
    #[get(type(copy))]
    pub(crate) byte_length: usize,
    /// SHA-256 hex digest of the add-on Python source.
    pub(crate) sha256: String,
    /// Target Live-Link port embedded by default in the add-on (`9877`).
    #[get(type(copy))]
    pub(crate) default_port: u16,
    /// Human-readable activation steps inside Blender Preferences -> Add-ons.
    pub(crate) instructions: String,
}

/// Configuration for `euv blender live-sync`.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct BlenderLiveSyncConfig {
    /// Host bind address (default `127.0.0.1`).
    pub(crate) host: String,
    /// TCP bind port (`9877` default; `0` allocates an ephemeral port).
    #[get(type(copy))]
    pub(crate) port: u16,
    /// Optional directory where hot-swapped `.glb` / `.euv3d` binaries are also persisted.
    pub(crate) out_dir: Option<PathBuf>,
    /// SSE keep-alive heartbeat interval in milliseconds.
    #[get(type(copy))]
    pub(crate) heartbeat_ms: u64,
    /// Bounded replay capacity for `GET /blender/events` reconnects.
    #[get(type(copy))]
    pub(crate) replay_capacity: usize,
    /// Maximum accepted binary asset upload size in bytes.
    #[get(type(copy))]
    pub(crate) max_asset_bytes: usize,
    /// Validate listener startup and exit immediately when `true`.
    #[get(type(copy))]
    pub(crate) once: bool,
}

/// Configuration for `euv blender watch`.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct BlenderWatchConfig {
    /// Watched `.blend`, `.glb`, `.gltf`, `.obj` file or directory path.
    pub(crate) path: PathBuf,
    /// Output directory receiving compiled `.euv3d` and manifest artifacts.
    pub(crate) out_dir: PathBuf,
    /// Live-Link server bind host.
    pub(crate) host: String,
    /// Live-Link server bind port (`9877` default; `0` ephemeral).
    #[get(type(copy))]
    pub(crate) port: u16,
    /// Optional explicit Blender binary override for `.blend` sources.
    pub(crate) blender_bin: Option<PathBuf>,
    /// Polling cadence in milliseconds.
    #[get(type(copy))]
    pub(crate) poll_ms: u64,
    /// QEM LOD depth for baked `.euv3d` outputs (`1..=4`).
    #[get(type(copy))]
    pub(crate) lods: usize,
    /// Run a single watch/bake + server check pass then exit cleanly.
    #[get(type(copy))]
    pub(crate) once: bool,
}

/// Machine-readable report produced by `euv blender watch --once` or startup diagnostics.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderWatchReport {
    /// Watched source file or directory path.
    pub(crate) watch_path: String,
    /// Output artifact directory path.
    pub(crate) out_dir: String,
    /// Active Live-Link base URL when the `update-server` feature is active.
    pub(crate) live_sync_url: Option<String>,
    /// Active SSE stream URL (`<base>/blender/events`), if running.
    pub(crate) events_url: Option<String>,
    /// Baked asset reports from the initial synchronization pass.
    pub(crate) baked_assets: Vec<BlenderBakeReport>,
    /// Whether the command exited after a single pass (`--once`).
    #[get(type(copy))]
    pub(crate) once: bool,
}

/// Single object transform delta entry posted by `euv_live_link.py` to `POST /blender/delta`.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BlenderLiveTransformDelta {
    /// Blender object or scene node name.
    pub(crate) name: String,
    /// Optional world/local Y-up translation `[x, y, z]`.
    #[get(type(copy))]
    pub(crate) translation: Option<[f32; 3]>,
    /// Optional unit Hamilton quaternion `[x, y, z, w]`.
    #[get(type(copy))]
    pub(crate) rotation: Option<[f32; 4]>,
    /// Optional non-uniform scale `[sx, sy, sz]`.
    #[get(type(copy))]
    pub(crate) scale: Option<[f32; 3]>,
    /// Optional viewport visibility toggle.
    #[get(type(copy))]
    pub(crate) visible: Option<bool>,
    /// Optional Blender collection names containing this object.
    #[serde(default)]
    pub(crate) collections: Vec<String>,
}

/// Single camera delta entry posted to `POST /blender/delta`.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BlenderLiveCameraDelta {
    /// Camera name.
    pub(crate) name: String,
    /// `true` for perspective projection, `false` for orthographic.
    #[get(type(copy))]
    pub(crate) is_perspective: Option<bool>,
    /// Vertical field of view in degrees.
    #[get(type(copy))]
    pub(crate) fov_deg: Option<f32>,
    /// Orthographic scale width.
    #[get(type(copy))]
    pub(crate) ortho_scale: Option<f32>,
    /// Near clipping plane distance.
    #[get(type(copy))]
    pub(crate) clip_start: Option<f32>,
    /// Far clipping plane distance.
    #[get(type(copy))]
    pub(crate) clip_end: Option<f32>,
    /// Optional camera translation `[x, y, z]`.
    #[get(type(copy))]
    pub(crate) translation: Option<[f32; 3]>,
    /// Optional camera quaternion `[x, y, z, w]`.
    #[get(type(copy))]
    pub(crate) rotation: Option<[f32; 4]>,
}

/// Single light delta entry posted to `POST /blender/delta`.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BlenderLiveLightDelta {
    /// Light name.
    pub(crate) name: String,
    /// Light kind (`sun`, `point`, `spot`, `area`, `directional`).
    pub(crate) kind: Option<String>,
    /// Linear RGB light color `[r, g, b]`.
    #[get(type(copy))]
    pub(crate) color: Option<[f32; 3]>,
    /// Light intensity / energy scalar.
    #[get(type(copy))]
    pub(crate) intensity: Option<f32>,
    /// Optional area-light width in meters.
    #[get(type(copy))]
    pub(crate) width: Option<f32>,
    /// Optional area-light height in meters.
    #[get(type(copy))]
    pub(crate) height: Option<f32>,
    /// Optional light translation `[x, y, z]`.
    #[get(type(copy))]
    pub(crate) translation: Option<[f32; 3]>,
    /// Optional light quaternion `[x, y, z, w]`.
    #[get(type(copy))]
    pub(crate) rotation: Option<[f32; 4]>,
}

/// Single Principled BSDF material slider delta posted to `POST /blender/delta`.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BlenderLiveMaterialDelta {
    /// Material name.
    pub(crate) name: String,
    /// Optional RGBA base color multiplier.
    #[get(type(copy))]
    pub(crate) base_color: Option<[f32; 4]>,
    /// Optional metallic slider in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) metallic: Option<f32>,
    /// Optional roughness slider in `[0.0, 1.0]`.
    #[get(type(copy))]
    pub(crate) roughness: Option<f32>,
    /// Optional dielectric index of refraction.
    #[get(type(copy))]
    pub(crate) ior: Option<f32>,
    /// Optional specular IOR level factor.
    #[get(type(copy))]
    pub(crate) specular: Option<f32>,
    /// Optional clearcoat weight.
    #[get(type(copy))]
    pub(crate) clearcoat: Option<f32>,
    /// Optional clearcoat roughness.
    #[get(type(copy))]
    pub(crate) clearcoat_roughness: Option<f32>,
    /// Optional optical transmission weight.
    #[get(type(copy))]
    pub(crate) transmission: Option<f32>,
    /// Optional grazing sheen weight.
    #[get(type(copy))]
    pub(crate) sheen: Option<f32>,
    /// Optional sheen roughness.
    #[get(type(copy))]
    pub(crate) sheen_roughness: Option<f32>,
    /// Optional linear emissive RGB.
    #[get(type(copy))]
    pub(crate) emissive: Option<[f32; 3]>,
    /// Optional HDR emissive strength multiplier.
    #[get(type(copy))]
    pub(crate) emissive_strength: Option<f32>,
}

/// Single shape-key / morph-target weights delta posted to `POST /blender/delta`.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BlenderLiveMorphDelta {
    /// Target mesh object name.
    pub(crate) name: String,
    /// Ordered shape-key morph weights.
    #[serde(default)]
    pub(crate) weights: Vec<f32>,
}

/// Structured JSON delta packet posted to `POST /blender/delta` and fanned out via SSE.
#[derive(Clone, Data, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct BlenderLiveDeltaPayload {
    /// Active Blender scene name.
    #[serde(default)]
    pub(crate) scene_name: String,
    /// Optional Blender version string reported by the add-on.
    pub(crate) blender_version: Option<String>,
    /// Optional timeline frame index.
    #[get(type(copy))]
    pub(crate) frame: Option<i32>,
    /// Optional client-side monotonic sequence counter.
    #[get(type(copy))]
    pub(crate) client_seq: Option<u64>,
    /// Optional client UNIX millisecond timestamp.
    #[get(type(copy))]
    pub(crate) timestamp_ms: Option<u64>,
    /// Updated object transforms.
    #[serde(default)]
    pub(crate) transforms: Vec<BlenderLiveTransformDelta>,
    /// Updated cameras.
    #[serde(default)]
    pub(crate) cameras: Vec<BlenderLiveCameraDelta>,
    /// Updated punctual and area lights.
    #[serde(default)]
    pub(crate) lights: Vec<BlenderLiveLightDelta>,
    /// Updated Principled BSDF materials.
    #[serde(default)]
    pub(crate) materials: Vec<BlenderLiveMaterialDelta>,
    /// Updated shape-key morph target weights.
    #[serde(default)]
    pub(crate) morph_weights: Vec<BlenderLiveMorphDelta>,
}

/// Metadata broadcast over SSE when a binary `.glb` or `.euv3d` asset is hot-swapped via `POST /blender/asset/{id}`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderLiveAssetNotice {
    /// Monotonic Live-Link event sequence number.
    #[get(type(copy))]
    pub(crate) seq: u64,
    /// Sanitized asset identifier (`{id}`).
    pub(crate) asset_id: String,
    /// Detected binary format (`glb` or `euv3d`).
    #[get(type(copy))]
    pub(crate) format: BlenderAssetFormat,
    /// Raw asset size in bytes.
    #[get(type(copy))]
    pub(crate) size_bytes: usize,
    /// SHA-256 hex digest of the binary asset bytes.
    pub(crate) sha256: String,
    /// Number of meshes verified in the uploaded binary.
    #[get(type(copy))]
    pub(crate) mesh_count: usize,
    /// Number of triangles verified in the uploaded binary.
    #[get(type(copy))]
    pub(crate) triangle_count: usize,
    /// Relative HTTP fetch route (`/blender/asset/{id}`).
    pub(crate) asset_url: String,
    /// Optional persisted path on disk when `--out-dir` is configured.
    pub(crate) disk_path: Option<String>,
}

/// Stored Live-Link event record cached in the bounded replay buffer for `Last-Event-ID` SSE reconnects.
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct BlenderLiveEventRecord {
    /// Monotonic event sequence number used as SSE `id:`.
    #[get(type(copy))]
    pub(crate) seq: u64,
    /// Event kind (`delta` or `asset`).
    #[get(type(copy))]
    pub(crate) kind: BlenderLiveEventKind,
    /// SSE `event:` name (`blender.delta` or `blender.asset`).
    pub(crate) event_name: String,
    /// Serialized UTF-8 JSON data payload.
    pub(crate) json_data: String,
}

/// Stored binary asset entry held in memory by `BlenderLiveSyncState`.
#[derive(Clone, Data, Debug, Eq, PartialEq)]
pub struct BlenderStoredAsset {
    /// Verified metadata notice for this asset.
    pub(crate) notice: BlenderLiveAssetNotice,
    /// Raw `.glb` or `.euv3d` payload bytes served by `GET /blender/asset/{id}`.
    pub(crate) bytes: Vec<u8>,
}

/// Machine-readable startup and diagnostics report for `euv blender live-sync`.
#[derive(Clone, Data, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct BlenderLiveSyncReport {
    /// Base HTTP URL (`http://host:port`).
    pub(crate) url: String,
    /// Delta ingest endpoint (`POST <url>/blender/delta`).
    pub(crate) delta_url: String,
    /// Binary asset hot-swap endpoint template (`POST/GET <url>/blender/asset/{id}`).
    pub(crate) asset_url: String,
    /// Live SSE event stream endpoint (`GET <url>/blender/events`).
    pub(crate) events_url: String,
    /// Status diagnostics endpoint (`GET <url>/blender/status`).
    pub(crate) status_url: String,
    /// Current monotonic event sequence number.
    #[get(type(copy))]
    pub(crate) latest_seq: u64,
    /// Total deltas received since startup.
    #[get(type(copy))]
    pub(crate) delta_count: u64,
    /// Total binary asset hot-swaps received since startup.
    #[get(type(copy))]
    pub(crate) asset_count: u64,
    /// Currently cached asset identifiers.
    pub(crate) asset_ids: Vec<String>,
    /// Whether the server exited immediately after verifying startup (`--once`).
    #[get(type(copy))]
    pub(crate) once: bool,
}

/// Shared concurrent runtime state backing the Hyperlane `euv blender live-sync` daemon.
#[cfg(feature = "update-server")]
#[derive(CustomDebug)]
pub struct BlenderLiveSyncState {
    /// Shared Hyperlane SSE pub/sub hub fanning out `blender.delta` and `blender.asset` frames.
    #[debug(skip)]
    pub(crate) sse_hub: SseHub,
    /// Active Hyperlane SSE heartbeat and retry configuration.
    pub(crate) sse_config: SseConfig,
    /// Optional directory where uploaded binary assets are mirrored to disk.
    pub(crate) out_dir: Option<PathBuf>,
    /// Maximum allowed binary upload size in bytes.
    pub(crate) max_asset_bytes: usize,
    /// Maximum number of replay events retained in memory.
    pub(crate) replay_capacity: usize,
    /// Monotonic event sequence counter.
    pub(crate) next_seq: AtomicU64,
    /// Total accepted JSON delta packets.
    pub(crate) delta_count: AtomicU64,
    /// Total accepted binary asset hot-swaps.
    pub(crate) asset_count: AtomicU64,
    /// Bounded ring buffer of recent serialized SSE events for `Last-Event-ID` replay.
    pub(crate) event_log: Mutex<Vec<BlenderLiveEventRecord>>,
    /// In-memory cache of latest hot-swapped `.glb` / `.euv3d` binaries keyed by asset ID.
    pub(crate) assets: RwLock<BTreeMap<String, BlenderStoredAsset>>,
    /// Most recent JSON delta payload received from Blender.
    pub(crate) latest_delta: RwLock<Option<BlenderLiveDeltaPayload>>,
    /// Running flag cleared on shutdown.
    pub(crate) running: AtomicBool,
}

/// Running handle for an embedded or CLI `euv blender live-sync` Hyperlane HTTP+SSE server.
#[cfg(feature = "update-server")]
#[derive(Debug)]
pub struct BlenderLiveSyncHandle {
    /// Bound socket address (concrete port even when configured with `port == 0`).
    pub(crate) address: SocketAddr,
    /// Shared concurrent Live-Link state.
    pub(crate) state: Arc<BlenderLiveSyncState>,
    /// Hyperlane shutdown control hook.
    pub(crate) control: Option<ServerControlHook>,
    /// Dedicated Tokio runtime driving the Hyperlane listener.
    pub(crate) runtime: Option<runtime::Runtime>,
}

/// Stateless Hyperlane route hook handling `POST /blender/delta`.
#[cfg(feature = "update-server")]
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct BlenderDeltaRouteHook;

/// Stateless Hyperlane route hook handling `POST /blender/asset/{id}` and `GET /blender/asset/{id}`.
#[cfg(feature = "update-server")]
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct BlenderAssetRouteHook;

/// Stateless Hyperlane route hook handling `GET /blender/events` SSE streaming.
#[cfg(feature = "update-server")]
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct BlenderEventsRouteHook;

/// Stateless Hyperlane route hook handling `GET /blender/status` and `GET /healthz`.
#[cfg(feature = "update-server")]
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct BlenderStatusRouteHook;