luvatrix 0.1.0__tar.gz

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.
Files changed (106) hide show
  1. luvatrix-0.1.0/PKG-INFO +180 -0
  2. luvatrix-0.1.0/README.md +162 -0
  3. luvatrix-0.1.0/luvatrix.egg-info/PKG-INFO +180 -0
  4. luvatrix-0.1.0/luvatrix.egg-info/SOURCES.txt +104 -0
  5. luvatrix-0.1.0/luvatrix.egg-info/dependency_links.txt +1 -0
  6. luvatrix-0.1.0/luvatrix.egg-info/requires.txt +15 -0
  7. luvatrix-0.1.0/luvatrix.egg-info/top_level.txt +3 -0
  8. luvatrix-0.1.0/luvatrix_core/__init__.py +4 -0
  9. luvatrix-0.1.0/luvatrix_core/core/__init__.py +109 -0
  10. luvatrix-0.1.0/luvatrix_core/core/app_runtime.py +708 -0
  11. luvatrix-0.1.0/luvatrix_core/core/audit.py +137 -0
  12. luvatrix-0.1.0/luvatrix_core/core/coordinates.py +166 -0
  13. luvatrix-0.1.0/luvatrix_core/core/display_runtime.py +126 -0
  14. luvatrix-0.1.0/luvatrix_core/core/energy_safety.py +153 -0
  15. luvatrix-0.1.0/luvatrix_core/core/engine.py +112 -0
  16. luvatrix-0.1.0/luvatrix_core/core/events.py +28 -0
  17. luvatrix-0.1.0/luvatrix_core/core/frame_rate_controller.py +45 -0
  18. luvatrix-0.1.0/luvatrix_core/core/hdi_thread.py +413 -0
  19. luvatrix-0.1.0/luvatrix_core/core/protocol_governance.py +49 -0
  20. luvatrix-0.1.0/luvatrix_core/core/sensor_manager.py +199 -0
  21. luvatrix-0.1.0/luvatrix_core/core/ui_frame_renderer.py +474 -0
  22. luvatrix-0.1.0/luvatrix_core/core/unified_runtime.py +148 -0
  23. luvatrix-0.1.0/luvatrix_core/core/window_matrix.py +240 -0
  24. luvatrix-0.1.0/luvatrix_core/platform/__init__.py +12 -0
  25. luvatrix-0.1.0/luvatrix_core/platform/frame_pipeline.py +39 -0
  26. luvatrix-0.1.0/luvatrix_core/platform/macos/__init__.py +37 -0
  27. luvatrix-0.1.0/luvatrix_core/platform/macos/hdi_source.py +213 -0
  28. luvatrix-0.1.0/luvatrix_core/platform/macos/sensors.py +216 -0
  29. luvatrix-0.1.0/luvatrix_core/platform/macos/vulkan_backend.py +1555 -0
  30. luvatrix-0.1.0/luvatrix_core/platform/macos/vulkan_presenter.py +184 -0
  31. luvatrix-0.1.0/luvatrix_core/platform/macos/window_system.py +153 -0
  32. luvatrix-0.1.0/luvatrix_core/platform/vulkan_compat.py +422 -0
  33. luvatrix-0.1.0/luvatrix_core/platform/vulkan_scaling.py +114 -0
  34. luvatrix-0.1.0/luvatrix_core/render/__init__.py +4 -0
  35. luvatrix-0.1.0/luvatrix_core/render/framebuffer.py +142 -0
  36. luvatrix-0.1.0/luvatrix_core/render/svg.py +345 -0
  37. luvatrix-0.1.0/luvatrix_core/targets/__init__.py +5 -0
  38. luvatrix-0.1.0/luvatrix_core/targets/base.py +36 -0
  39. luvatrix-0.1.0/luvatrix_core/targets/vulkan_target.py +53 -0
  40. luvatrix-0.1.0/luvatrix_core/targets/web_target.py +14 -0
  41. luvatrix-0.1.0/luvatrix_core/ui/__init__.py +4 -0
  42. luvatrix-0.1.0/luvatrix_core/ui/element.py +16 -0
  43. luvatrix-0.1.0/luvatrix_core/ui/page_loader.py +51 -0
  44. luvatrix-0.1.0/luvatrix_plot/__init__.py +18 -0
  45. luvatrix-0.1.0/luvatrix_plot/adapters/__init__.py +3 -0
  46. luvatrix-0.1.0/luvatrix_plot/adapters/normalize.py +133 -0
  47. luvatrix-0.1.0/luvatrix_plot/api.py +38 -0
  48. luvatrix-0.1.0/luvatrix_plot/compile/__init__.py +13 -0
  49. luvatrix-0.1.0/luvatrix_plot/compile/app_protocol.py +64 -0
  50. luvatrix-0.1.0/luvatrix_plot/display.py +64 -0
  51. luvatrix-0.1.0/luvatrix_plot/dynamic_axis.py +187 -0
  52. luvatrix-0.1.0/luvatrix_plot/errors.py +2 -0
  53. luvatrix-0.1.0/luvatrix_plot/figure.py +1134 -0
  54. luvatrix-0.1.0/luvatrix_plot/live.py +193 -0
  55. luvatrix-0.1.0/luvatrix_plot/raster/__init__.py +18 -0
  56. luvatrix-0.1.0/luvatrix_plot/raster/canvas.py +68 -0
  57. luvatrix-0.1.0/luvatrix_plot/raster/draw_lines.py +39 -0
  58. luvatrix-0.1.0/luvatrix_plot/raster/draw_markers.py +17 -0
  59. luvatrix-0.1.0/luvatrix_plot/raster/draw_text.py +205 -0
  60. luvatrix-0.1.0/luvatrix_plot/raster/layers.py +31 -0
  61. luvatrix-0.1.0/luvatrix_plot/scales.py +218 -0
  62. luvatrix-0.1.0/luvatrix_plot/series.py +32 -0
  63. luvatrix-0.1.0/luvatrix_ui/__init__.py +79 -0
  64. luvatrix-0.1.0/luvatrix_ui/component_schema.py +154 -0
  65. luvatrix-0.1.0/luvatrix_ui/controls/__init__.py +16 -0
  66. luvatrix-0.1.0/luvatrix_ui/controls/button.py +68 -0
  67. luvatrix-0.1.0/luvatrix_ui/controls/interaction.py +56 -0
  68. luvatrix-0.1.0/luvatrix_ui/controls/svg_component.py +67 -0
  69. luvatrix-0.1.0/luvatrix_ui/controls/svg_renderer.py +34 -0
  70. luvatrix-0.1.0/luvatrix_ui/style/__init__.py +5 -0
  71. luvatrix-0.1.0/luvatrix_ui/style/theme.py +66 -0
  72. luvatrix-0.1.0/luvatrix_ui/text/__init__.py +25 -0
  73. luvatrix-0.1.0/luvatrix_ui/text/component.py +106 -0
  74. luvatrix-0.1.0/luvatrix_ui/text/renderer.py +132 -0
  75. luvatrix-0.1.0/luvatrix_ui/ui_ir.py +674 -0
  76. luvatrix-0.1.0/pyproject.toml +31 -0
  77. luvatrix-0.1.0/setup.cfg +4 -0
  78. luvatrix-0.1.0/tests/test_app_runtime.py +655 -0
  79. luvatrix-0.1.0/tests/test_audit_sink.py +71 -0
  80. luvatrix-0.1.0/tests/test_coordinates.py +41 -0
  81. luvatrix-0.1.0/tests/test_demo_app_protocol_example.py +25 -0
  82. luvatrix-0.1.0/tests/test_display_runtime.py +171 -0
  83. luvatrix-0.1.0/tests/test_energy_safety.py +77 -0
  84. luvatrix-0.1.0/tests/test_frame_pipeline.py +47 -0
  85. luvatrix-0.1.0/tests/test_frame_rate_controller.py +51 -0
  86. luvatrix-0.1.0/tests/test_full_suite_interactive_example.py +80 -0
  87. luvatrix-0.1.0/tests/test_hdi_thread.py +390 -0
  88. luvatrix-0.1.0/tests/test_luvatrix_plot.py +497 -0
  89. luvatrix-0.1.0/tests/test_luvatrix_ui_button.py +62 -0
  90. luvatrix-0.1.0/tests/test_luvatrix_ui_component_schema.py +56 -0
  91. luvatrix-0.1.0/tests/test_luvatrix_ui_ir.py +105 -0
  92. luvatrix-0.1.0/tests/test_luvatrix_ui_svg_renderer.py +48 -0
  93. luvatrix-0.1.0/tests/test_luvatrix_ui_text_renderer.py +54 -0
  94. luvatrix-0.1.0/tests/test_luvatrix_ui_theme.py +31 -0
  95. luvatrix-0.1.0/tests/test_macos_hdi_source.py +18 -0
  96. luvatrix-0.1.0/tests/test_macos_sensors.py +132 -0
  97. luvatrix-0.1.0/tests/test_macos_vulkan_backend.py +1291 -0
  98. luvatrix-0.1.0/tests/test_macos_vulkan_presenter.py +166 -0
  99. luvatrix-0.1.0/tests/test_plot_app_protocol_example.py +91 -0
  100. luvatrix-0.1.0/tests/test_protocol_governance.py +27 -0
  101. luvatrix-0.1.0/tests/test_renderer_e2e.py +68 -0
  102. luvatrix-0.1.0/tests/test_sensor_manager.py +87 -0
  103. luvatrix-0.1.0/tests/test_ui_frame_renderer.py +161 -0
  104. luvatrix-0.1.0/tests/test_unified_runtime.py +300 -0
  105. luvatrix-0.1.0/tests/test_vulkan_scaling.py +67 -0
  106. luvatrix-0.1.0/tests/test_window_matrix_protocol.py +201 -0
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: luvatrix
3
+ Version: 0.1.0
4
+ Summary: Luvatrix runtime and plotting toolkit
5
+ Requires-Python: <3.15,>=3.14
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy>=2.4.2
8
+ Requires-Dist: torch>=2.4.0
9
+ Provides-Extra: plot
10
+ Provides-Extra: macos
11
+ Requires-Dist: pyobjc-core>=12.1; extra == "macos"
12
+ Requires-Dist: pyobjc-framework-cocoa>=12.1; extra == "macos"
13
+ Requires-Dist: pyobjc-framework-quartz>=12.1; extra == "macos"
14
+ Provides-Extra: vulkan
15
+ Requires-Dist: vulkan>=1.3.275.1; extra == "vulkan"
16
+ Provides-Extra: dev
17
+ Requires-Dist: matplotlib>=3.10.8; extra == "dev"
18
+
19
+ # Luvatrix
20
+
21
+ Custom app protocol + custom rendering protocol runtime in Python.
22
+
23
+ ## Current Focus
24
+
25
+ Phase 1 is a macOS-first OS-level renderer:
26
+ - Window Matrix protocol (`H x W x 4` RGBA255, PyTorch)
27
+ - Vulkan presentation loop (`init -> loop -> stop`)
28
+ - HDI thread + Sensor manager thread
29
+ - In-process app protocol (`app.toml` + Python entrypoint)
30
+
31
+ ## Planning Document
32
+
33
+ See `planning.md` for the integrated Phase 1 spec and visual TLDR protocol models.
34
+
35
+ ## Repository Layout
36
+
37
+ - Core engine/runtime source lives in `luvatrix_core/`.
38
+ - In-repo UI contracts/components live in `luvatrix_ui/` (`text/`, `controls/`, `style/`).
39
+
40
+ ## `luvatrix_ui` (In-Repo, v0)
41
+
42
+ `luvatrix_ui` is a first-party in-repo UI layer with explicit, future-extractable boundaries.
43
+
44
+ Current v0 surface:
45
+
46
+ - `TextRenderer` + text command/style contracts in `luvatrix_ui/text/renderer.py`.
47
+ - `SVGRenderer` + `SVGComponent` contracts in `luvatrix_ui/controls/svg_renderer.py` and
48
+ `luvatrix_ui/controls/svg_component.py`.
49
+ - `ButtonModel` state machine in `luvatrix_ui/controls/button.py`:
50
+ `idle`, `hover`, `press_down`, `press_hold`, `disabled`.
51
+ - `ThemeTokens` + validation/default merging in `luvatrix_ui/style/theme.py`.
52
+
53
+ Runtime-side compiler:
54
+
55
+ - `MatrixUIFrameRenderer` in `luvatrix_core/core/ui_frame_renderer.py` compiles first-party
56
+ component batches (including SVG) into matrix frame tensors for `WriteBatch` submission.
57
+
58
+ Interaction model:
59
+
60
+ - Consumes standardized HDI `press` phases (`down`, `hold_start`, `hold_tick`, `up`, `cancel`, etc.).
61
+ - Keeps runtime/platform internals out of `luvatrix_ui`; integrations should adapt events/renderers at the boundary.
62
+
63
+ See:
64
+
65
+ - `docs/ui_component_protocol.md` for component contracts
66
+ - `docs/app_protocol.md` for runtime contract
67
+ - `docs/json_ui_compiler.md` for JSON page/lottie-oriented compiler design
68
+
69
+ ## macOS Visualizer Examples
70
+
71
+ Run stretch mode:
72
+ ```bash
73
+ uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
74
+ ```
75
+
76
+ Run preserve-aspect mode (black bars when needed):
77
+ ```bash
78
+ uv run --python 3.14 python examples/macos_visualizer/preserve_aspect_mode.py
79
+ ```
80
+
81
+ Run the full interactive suite app-protocol example (runs until window closes):
82
+ ```bash
83
+ uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect stretch
84
+ uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect preserve
85
+ ```
86
+
87
+ Force experimental Vulkan path:
88
+ ```bash
89
+ LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN=1 uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
90
+ ```
91
+
92
+ Force fallback layer-blit path:
93
+ ```bash
94
+ unset LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN
95
+ uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
96
+ ```
97
+
98
+ Quick Vulkan environment probe (no window):
99
+ ```bash
100
+ uv run --python 3.14 python examples/macos_visualizer/vulkan_probe.py
101
+ ```
102
+
103
+ ## App Protocol Example
104
+
105
+ Minimal input + sensor logger app:
106
+ ```bash
107
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py --simulate-hdi --simulate-sensors
108
+ ```
109
+
110
+ Choose which sensors to log:
111
+ ```bash
112
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
113
+ --simulate-hdi \
114
+ --sensor thermal.temperature \
115
+ --sensor power.voltage_current
116
+ ```
117
+
118
+ Additional available sensor metadata types:
119
+ `sensor.motion`, `camera.device`, `microphone.device`, `speaker.device`.
120
+
121
+ Open a macOS logger window and report real mouse hover coordinates (window-relative only, gated by active/focused window):
122
+ ```bash
123
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
124
+ --open-window \
125
+ --sensor thermal.temperature \
126
+ --sensor power.voltage_current
127
+ ```
128
+
129
+ Notes:
130
+ - `--simulate-hdi` intentionally emits synthetic keyboard events (`key='a'`) for test visibility.
131
+ - With `--open-window` and without `--simulate-hdi`, logger emits real window-gated mouse and keyboard input.
132
+
133
+ ## Unified Runtime CLI
134
+
135
+ App manifests can now include optional `platform_support` and `[[variants]]` blocks so runtime picks only the host-compatible variant entrypoint/module root.
136
+
137
+ Run any app protocol folder (`app.toml` + entrypoint) headless:
138
+ ```bash
139
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --ticks 300
140
+ ```
141
+
142
+ Run it with macOS window rendering:
143
+ ```bash
144
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render macos --width 640 --height 360
145
+ ```
146
+
147
+ Use real macOS sensor providers:
148
+ ```bash
149
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --sensor-backend macos
150
+ ```
151
+
152
+ Enable runtime energy safety monitoring (throttles on warn, can enforce shutdown on sustained critical telemetry):
153
+ ```bash
154
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
155
+ --sensor-backend macos \
156
+ --energy-safety monitor
157
+ ```
158
+
159
+ Enforce shutdown instead of monitor-only mode:
160
+ ```bash
161
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
162
+ --sensor-backend macos \
163
+ --energy-safety enforce \
164
+ --energy-critical-streak 3
165
+ ```
166
+
167
+ Persist audit events to SQLite or JSONL:
168
+ ```bash
169
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-sqlite ./.luvatrix/audit.db
170
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-jsonl ./.luvatrix/audit.jsonl
171
+ ```
172
+
173
+ With the logger example, you can explicitly include motion:
174
+ ```bash
175
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
176
+ --open-window \
177
+ --sensor sensor.motion \
178
+ --sensor thermal.temperature \
179
+ --simulate-sensors
180
+ ```
@@ -0,0 +1,162 @@
1
+ # Luvatrix
2
+
3
+ Custom app protocol + custom rendering protocol runtime in Python.
4
+
5
+ ## Current Focus
6
+
7
+ Phase 1 is a macOS-first OS-level renderer:
8
+ - Window Matrix protocol (`H x W x 4` RGBA255, PyTorch)
9
+ - Vulkan presentation loop (`init -> loop -> stop`)
10
+ - HDI thread + Sensor manager thread
11
+ - In-process app protocol (`app.toml` + Python entrypoint)
12
+
13
+ ## Planning Document
14
+
15
+ See `planning.md` for the integrated Phase 1 spec and visual TLDR protocol models.
16
+
17
+ ## Repository Layout
18
+
19
+ - Core engine/runtime source lives in `luvatrix_core/`.
20
+ - In-repo UI contracts/components live in `luvatrix_ui/` (`text/`, `controls/`, `style/`).
21
+
22
+ ## `luvatrix_ui` (In-Repo, v0)
23
+
24
+ `luvatrix_ui` is a first-party in-repo UI layer with explicit, future-extractable boundaries.
25
+
26
+ Current v0 surface:
27
+
28
+ - `TextRenderer` + text command/style contracts in `luvatrix_ui/text/renderer.py`.
29
+ - `SVGRenderer` + `SVGComponent` contracts in `luvatrix_ui/controls/svg_renderer.py` and
30
+ `luvatrix_ui/controls/svg_component.py`.
31
+ - `ButtonModel` state machine in `luvatrix_ui/controls/button.py`:
32
+ `idle`, `hover`, `press_down`, `press_hold`, `disabled`.
33
+ - `ThemeTokens` + validation/default merging in `luvatrix_ui/style/theme.py`.
34
+
35
+ Runtime-side compiler:
36
+
37
+ - `MatrixUIFrameRenderer` in `luvatrix_core/core/ui_frame_renderer.py` compiles first-party
38
+ component batches (including SVG) into matrix frame tensors for `WriteBatch` submission.
39
+
40
+ Interaction model:
41
+
42
+ - Consumes standardized HDI `press` phases (`down`, `hold_start`, `hold_tick`, `up`, `cancel`, etc.).
43
+ - Keeps runtime/platform internals out of `luvatrix_ui`; integrations should adapt events/renderers at the boundary.
44
+
45
+ See:
46
+
47
+ - `docs/ui_component_protocol.md` for component contracts
48
+ - `docs/app_protocol.md` for runtime contract
49
+ - `docs/json_ui_compiler.md` for JSON page/lottie-oriented compiler design
50
+
51
+ ## macOS Visualizer Examples
52
+
53
+ Run stretch mode:
54
+ ```bash
55
+ uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
56
+ ```
57
+
58
+ Run preserve-aspect mode (black bars when needed):
59
+ ```bash
60
+ uv run --python 3.14 python examples/macos_visualizer/preserve_aspect_mode.py
61
+ ```
62
+
63
+ Run the full interactive suite app-protocol example (runs until window closes):
64
+ ```bash
65
+ uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect stretch
66
+ uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect preserve
67
+ ```
68
+
69
+ Force experimental Vulkan path:
70
+ ```bash
71
+ LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN=1 uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
72
+ ```
73
+
74
+ Force fallback layer-blit path:
75
+ ```bash
76
+ unset LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN
77
+ uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
78
+ ```
79
+
80
+ Quick Vulkan environment probe (no window):
81
+ ```bash
82
+ uv run --python 3.14 python examples/macos_visualizer/vulkan_probe.py
83
+ ```
84
+
85
+ ## App Protocol Example
86
+
87
+ Minimal input + sensor logger app:
88
+ ```bash
89
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py --simulate-hdi --simulate-sensors
90
+ ```
91
+
92
+ Choose which sensors to log:
93
+ ```bash
94
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
95
+ --simulate-hdi \
96
+ --sensor thermal.temperature \
97
+ --sensor power.voltage_current
98
+ ```
99
+
100
+ Additional available sensor metadata types:
101
+ `sensor.motion`, `camera.device`, `microphone.device`, `speaker.device`.
102
+
103
+ Open a macOS logger window and report real mouse hover coordinates (window-relative only, gated by active/focused window):
104
+ ```bash
105
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
106
+ --open-window \
107
+ --sensor thermal.temperature \
108
+ --sensor power.voltage_current
109
+ ```
110
+
111
+ Notes:
112
+ - `--simulate-hdi` intentionally emits synthetic keyboard events (`key='a'`) for test visibility.
113
+ - With `--open-window` and without `--simulate-hdi`, logger emits real window-gated mouse and keyboard input.
114
+
115
+ ## Unified Runtime CLI
116
+
117
+ App manifests can now include optional `platform_support` and `[[variants]]` blocks so runtime picks only the host-compatible variant entrypoint/module root.
118
+
119
+ Run any app protocol folder (`app.toml` + entrypoint) headless:
120
+ ```bash
121
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --ticks 300
122
+ ```
123
+
124
+ Run it with macOS window rendering:
125
+ ```bash
126
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render macos --width 640 --height 360
127
+ ```
128
+
129
+ Use real macOS sensor providers:
130
+ ```bash
131
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --sensor-backend macos
132
+ ```
133
+
134
+ Enable runtime energy safety monitoring (throttles on warn, can enforce shutdown on sustained critical telemetry):
135
+ ```bash
136
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
137
+ --sensor-backend macos \
138
+ --energy-safety monitor
139
+ ```
140
+
141
+ Enforce shutdown instead of monitor-only mode:
142
+ ```bash
143
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
144
+ --sensor-backend macos \
145
+ --energy-safety enforce \
146
+ --energy-critical-streak 3
147
+ ```
148
+
149
+ Persist audit events to SQLite or JSONL:
150
+ ```bash
151
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-sqlite ./.luvatrix/audit.db
152
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-jsonl ./.luvatrix/audit.jsonl
153
+ ```
154
+
155
+ With the logger example, you can explicitly include motion:
156
+ ```bash
157
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
158
+ --open-window \
159
+ --sensor sensor.motion \
160
+ --sensor thermal.temperature \
161
+ --simulate-sensors
162
+ ```
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: luvatrix
3
+ Version: 0.1.0
4
+ Summary: Luvatrix runtime and plotting toolkit
5
+ Requires-Python: <3.15,>=3.14
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy>=2.4.2
8
+ Requires-Dist: torch>=2.4.0
9
+ Provides-Extra: plot
10
+ Provides-Extra: macos
11
+ Requires-Dist: pyobjc-core>=12.1; extra == "macos"
12
+ Requires-Dist: pyobjc-framework-cocoa>=12.1; extra == "macos"
13
+ Requires-Dist: pyobjc-framework-quartz>=12.1; extra == "macos"
14
+ Provides-Extra: vulkan
15
+ Requires-Dist: vulkan>=1.3.275.1; extra == "vulkan"
16
+ Provides-Extra: dev
17
+ Requires-Dist: matplotlib>=3.10.8; extra == "dev"
18
+
19
+ # Luvatrix
20
+
21
+ Custom app protocol + custom rendering protocol runtime in Python.
22
+
23
+ ## Current Focus
24
+
25
+ Phase 1 is a macOS-first OS-level renderer:
26
+ - Window Matrix protocol (`H x W x 4` RGBA255, PyTorch)
27
+ - Vulkan presentation loop (`init -> loop -> stop`)
28
+ - HDI thread + Sensor manager thread
29
+ - In-process app protocol (`app.toml` + Python entrypoint)
30
+
31
+ ## Planning Document
32
+
33
+ See `planning.md` for the integrated Phase 1 spec and visual TLDR protocol models.
34
+
35
+ ## Repository Layout
36
+
37
+ - Core engine/runtime source lives in `luvatrix_core/`.
38
+ - In-repo UI contracts/components live in `luvatrix_ui/` (`text/`, `controls/`, `style/`).
39
+
40
+ ## `luvatrix_ui` (In-Repo, v0)
41
+
42
+ `luvatrix_ui` is a first-party in-repo UI layer with explicit, future-extractable boundaries.
43
+
44
+ Current v0 surface:
45
+
46
+ - `TextRenderer` + text command/style contracts in `luvatrix_ui/text/renderer.py`.
47
+ - `SVGRenderer` + `SVGComponent` contracts in `luvatrix_ui/controls/svg_renderer.py` and
48
+ `luvatrix_ui/controls/svg_component.py`.
49
+ - `ButtonModel` state machine in `luvatrix_ui/controls/button.py`:
50
+ `idle`, `hover`, `press_down`, `press_hold`, `disabled`.
51
+ - `ThemeTokens` + validation/default merging in `luvatrix_ui/style/theme.py`.
52
+
53
+ Runtime-side compiler:
54
+
55
+ - `MatrixUIFrameRenderer` in `luvatrix_core/core/ui_frame_renderer.py` compiles first-party
56
+ component batches (including SVG) into matrix frame tensors for `WriteBatch` submission.
57
+
58
+ Interaction model:
59
+
60
+ - Consumes standardized HDI `press` phases (`down`, `hold_start`, `hold_tick`, `up`, `cancel`, etc.).
61
+ - Keeps runtime/platform internals out of `luvatrix_ui`; integrations should adapt events/renderers at the boundary.
62
+
63
+ See:
64
+
65
+ - `docs/ui_component_protocol.md` for component contracts
66
+ - `docs/app_protocol.md` for runtime contract
67
+ - `docs/json_ui_compiler.md` for JSON page/lottie-oriented compiler design
68
+
69
+ ## macOS Visualizer Examples
70
+
71
+ Run stretch mode:
72
+ ```bash
73
+ uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
74
+ ```
75
+
76
+ Run preserve-aspect mode (black bars when needed):
77
+ ```bash
78
+ uv run --python 3.14 python examples/macos_visualizer/preserve_aspect_mode.py
79
+ ```
80
+
81
+ Run the full interactive suite app-protocol example (runs until window closes):
82
+ ```bash
83
+ uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect stretch
84
+ uv run --python 3.14 python examples/app_protocol/run_full_suite_interactive.py --aspect preserve
85
+ ```
86
+
87
+ Force experimental Vulkan path:
88
+ ```bash
89
+ LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN=1 uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
90
+ ```
91
+
92
+ Force fallback layer-blit path:
93
+ ```bash
94
+ unset LUVATRIX_ENABLE_EXPERIMENTAL_VULKAN
95
+ uv run --python 3.14 python examples/macos_visualizer/stretch_mode.py
96
+ ```
97
+
98
+ Quick Vulkan environment probe (no window):
99
+ ```bash
100
+ uv run --python 3.14 python examples/macos_visualizer/vulkan_probe.py
101
+ ```
102
+
103
+ ## App Protocol Example
104
+
105
+ Minimal input + sensor logger app:
106
+ ```bash
107
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py --simulate-hdi --simulate-sensors
108
+ ```
109
+
110
+ Choose which sensors to log:
111
+ ```bash
112
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
113
+ --simulate-hdi \
114
+ --sensor thermal.temperature \
115
+ --sensor power.voltage_current
116
+ ```
117
+
118
+ Additional available sensor metadata types:
119
+ `sensor.motion`, `camera.device`, `microphone.device`, `speaker.device`.
120
+
121
+ Open a macOS logger window and report real mouse hover coordinates (window-relative only, gated by active/focused window):
122
+ ```bash
123
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
124
+ --open-window \
125
+ --sensor thermal.temperature \
126
+ --sensor power.voltage_current
127
+ ```
128
+
129
+ Notes:
130
+ - `--simulate-hdi` intentionally emits synthetic keyboard events (`key='a'`) for test visibility.
131
+ - With `--open-window` and without `--simulate-hdi`, logger emits real window-gated mouse and keyboard input.
132
+
133
+ ## Unified Runtime CLI
134
+
135
+ App manifests can now include optional `platform_support` and `[[variants]]` blocks so runtime picks only the host-compatible variant entrypoint/module root.
136
+
137
+ Run any app protocol folder (`app.toml` + entrypoint) headless:
138
+ ```bash
139
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --ticks 300
140
+ ```
141
+
142
+ Run it with macOS window rendering:
143
+ ```bash
144
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render macos --width 640 --height 360
145
+ ```
146
+
147
+ Use real macOS sensor providers:
148
+ ```bash
149
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --render headless --sensor-backend macos
150
+ ```
151
+
152
+ Enable runtime energy safety monitoring (throttles on warn, can enforce shutdown on sustained critical telemetry):
153
+ ```bash
154
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
155
+ --sensor-backend macos \
156
+ --energy-safety monitor
157
+ ```
158
+
159
+ Enforce shutdown instead of monitor-only mode:
160
+ ```bash
161
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger \
162
+ --sensor-backend macos \
163
+ --energy-safety enforce \
164
+ --energy-critical-streak 3
165
+ ```
166
+
167
+ Persist audit events to SQLite or JSONL:
168
+ ```bash
169
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-sqlite ./.luvatrix/audit.db
170
+ uv run --python 3.14 python main.py run-app examples/app_protocol/input_sensor_logger --audit-jsonl ./.luvatrix/audit.jsonl
171
+ ```
172
+
173
+ With the logger example, you can explicitly include motion:
174
+ ```bash
175
+ uv run --python 3.14 python examples/app_protocol/run_input_sensor_logger.py \
176
+ --open-window \
177
+ --sensor sensor.motion \
178
+ --sensor thermal.temperature \
179
+ --simulate-sensors
180
+ ```
@@ -0,0 +1,104 @@
1
+ README.md
2
+ pyproject.toml
3
+ luvatrix.egg-info/PKG-INFO
4
+ luvatrix.egg-info/SOURCES.txt
5
+ luvatrix.egg-info/dependency_links.txt
6
+ luvatrix.egg-info/requires.txt
7
+ luvatrix.egg-info/top_level.txt
8
+ luvatrix_core/__init__.py
9
+ luvatrix_core/core/__init__.py
10
+ luvatrix_core/core/app_runtime.py
11
+ luvatrix_core/core/audit.py
12
+ luvatrix_core/core/coordinates.py
13
+ luvatrix_core/core/display_runtime.py
14
+ luvatrix_core/core/energy_safety.py
15
+ luvatrix_core/core/engine.py
16
+ luvatrix_core/core/events.py
17
+ luvatrix_core/core/frame_rate_controller.py
18
+ luvatrix_core/core/hdi_thread.py
19
+ luvatrix_core/core/protocol_governance.py
20
+ luvatrix_core/core/sensor_manager.py
21
+ luvatrix_core/core/ui_frame_renderer.py
22
+ luvatrix_core/core/unified_runtime.py
23
+ luvatrix_core/core/window_matrix.py
24
+ luvatrix_core/platform/__init__.py
25
+ luvatrix_core/platform/frame_pipeline.py
26
+ luvatrix_core/platform/vulkan_compat.py
27
+ luvatrix_core/platform/vulkan_scaling.py
28
+ luvatrix_core/platform/macos/__init__.py
29
+ luvatrix_core/platform/macos/hdi_source.py
30
+ luvatrix_core/platform/macos/sensors.py
31
+ luvatrix_core/platform/macos/vulkan_backend.py
32
+ luvatrix_core/platform/macos/vulkan_presenter.py
33
+ luvatrix_core/platform/macos/window_system.py
34
+ luvatrix_core/render/__init__.py
35
+ luvatrix_core/render/framebuffer.py
36
+ luvatrix_core/render/svg.py
37
+ luvatrix_core/targets/__init__.py
38
+ luvatrix_core/targets/base.py
39
+ luvatrix_core/targets/vulkan_target.py
40
+ luvatrix_core/targets/web_target.py
41
+ luvatrix_core/ui/__init__.py
42
+ luvatrix_core/ui/element.py
43
+ luvatrix_core/ui/page_loader.py
44
+ luvatrix_plot/__init__.py
45
+ luvatrix_plot/api.py
46
+ luvatrix_plot/display.py
47
+ luvatrix_plot/dynamic_axis.py
48
+ luvatrix_plot/errors.py
49
+ luvatrix_plot/figure.py
50
+ luvatrix_plot/live.py
51
+ luvatrix_plot/scales.py
52
+ luvatrix_plot/series.py
53
+ luvatrix_plot/adapters/__init__.py
54
+ luvatrix_plot/adapters/normalize.py
55
+ luvatrix_plot/compile/__init__.py
56
+ luvatrix_plot/compile/app_protocol.py
57
+ luvatrix_plot/raster/__init__.py
58
+ luvatrix_plot/raster/canvas.py
59
+ luvatrix_plot/raster/draw_lines.py
60
+ luvatrix_plot/raster/draw_markers.py
61
+ luvatrix_plot/raster/draw_text.py
62
+ luvatrix_plot/raster/layers.py
63
+ luvatrix_ui/__init__.py
64
+ luvatrix_ui/component_schema.py
65
+ luvatrix_ui/ui_ir.py
66
+ luvatrix_ui/controls/__init__.py
67
+ luvatrix_ui/controls/button.py
68
+ luvatrix_ui/controls/interaction.py
69
+ luvatrix_ui/controls/svg_component.py
70
+ luvatrix_ui/controls/svg_renderer.py
71
+ luvatrix_ui/style/__init__.py
72
+ luvatrix_ui/style/theme.py
73
+ luvatrix_ui/text/__init__.py
74
+ luvatrix_ui/text/component.py
75
+ luvatrix_ui/text/renderer.py
76
+ tests/test_app_runtime.py
77
+ tests/test_audit_sink.py
78
+ tests/test_coordinates.py
79
+ tests/test_demo_app_protocol_example.py
80
+ tests/test_display_runtime.py
81
+ tests/test_energy_safety.py
82
+ tests/test_frame_pipeline.py
83
+ tests/test_frame_rate_controller.py
84
+ tests/test_full_suite_interactive_example.py
85
+ tests/test_hdi_thread.py
86
+ tests/test_luvatrix_plot.py
87
+ tests/test_luvatrix_ui_button.py
88
+ tests/test_luvatrix_ui_component_schema.py
89
+ tests/test_luvatrix_ui_ir.py
90
+ tests/test_luvatrix_ui_svg_renderer.py
91
+ tests/test_luvatrix_ui_text_renderer.py
92
+ tests/test_luvatrix_ui_theme.py
93
+ tests/test_macos_hdi_source.py
94
+ tests/test_macos_sensors.py
95
+ tests/test_macos_vulkan_backend.py
96
+ tests/test_macos_vulkan_presenter.py
97
+ tests/test_plot_app_protocol_example.py
98
+ tests/test_protocol_governance.py
99
+ tests/test_renderer_e2e.py
100
+ tests/test_sensor_manager.py
101
+ tests/test_ui_frame_renderer.py
102
+ tests/test_unified_runtime.py
103
+ tests/test_vulkan_scaling.py
104
+ tests/test_window_matrix_protocol.py
@@ -0,0 +1,15 @@
1
+ numpy>=2.4.2
2
+ torch>=2.4.0
3
+
4
+ [dev]
5
+ matplotlib>=3.10.8
6
+
7
+ [macos]
8
+ pyobjc-core>=12.1
9
+ pyobjc-framework-cocoa>=12.1
10
+ pyobjc-framework-quartz>=12.1
11
+
12
+ [plot]
13
+
14
+ [vulkan]
15
+ vulkan>=1.3.275.1
@@ -0,0 +1,3 @@
1
+ luvatrix_core
2
+ luvatrix_plot
3
+ luvatrix_ui
@@ -0,0 +1,4 @@
1
+ """Luvatrix runtime."""
2
+
3
+ __all__ = ["__version__"]
4
+ __version__ = "0.1.0"