led-controller-version-3 3.0.2__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.
Files changed (52) hide show
  1. led_controller_version_3-3.0.2.dist-info/METADATA +172 -0
  2. led_controller_version_3-3.0.2.dist-info/RECORD +52 -0
  3. led_controller_version_3-3.0.2.dist-info/WHEEL +4 -0
  4. led_controller_version_3-3.0.2.dist-info/entry_points.txt +13 -0
  5. lefx/device/respeaker/__init__.py +35 -0
  6. lefx/device/respeaker/cli.py +146 -0
  7. lefx/device/respeaker/contention.py +523 -0
  8. lefx/device/respeaker/provider.py +158 -0
  9. lefx/device/respeaker/registration.py +130 -0
  10. lefx/device/respeaker/sink.py +108 -0
  11. lefx/device/respeaker/transport.py +344 -0
  12. lefx/device/respeaker/xvf.py +313 -0
  13. lefx/engine/__init__.py +110 -0
  14. lefx/engine/composer.py +203 -0
  15. lefx/engine/config.py +27 -0
  16. lefx/engine/errors.py +84 -0
  17. lefx/engine/inputs.py +196 -0
  18. lefx/engine/invocation.py +129 -0
  19. lefx/engine/layers.py +114 -0
  20. lefx/engine/library.py +181 -0
  21. lefx/engine/packages/__init__.py +45 -0
  22. lefx/engine/packages/loader.py +375 -0
  23. lefx/engine/packages/manifest.py +308 -0
  24. lefx/engine/registry.py +347 -0
  25. lefx/engine/renderer.py +63 -0
  26. lefx/engine/runtime.py +393 -0
  27. lefx/engine/store.py +125 -0
  28. lefx/interfaces/__init__.py +40 -0
  29. lefx/interfaces/api.py +301 -0
  30. lefx/interfaces/cli.py +380 -0
  31. lefx/interfaces/client.py +165 -0
  32. lefx/interfaces/config.py +305 -0
  33. lefx/interfaces/discovery.py +308 -0
  34. lefx/interfaces/hosting.py +123 -0
  35. lefx/interfaces/paths.py +79 -0
  36. lefx/interfaces/presentation.py +118 -0
  37. lefx/interfaces/service.py +468 -0
  38. lefx/sdk/__init__.py +176 -0
  39. lefx/sdk/calibration.py +202 -0
  40. lefx/sdk/color.py +108 -0
  41. lefx/sdk/context.py +72 -0
  42. lefx/sdk/definitions.py +526 -0
  43. lefx/sdk/effects.py +63 -0
  44. lefx/sdk/errors.py +90 -0
  45. lefx/sdk/parameters.py +469 -0
  46. lefx/sdk/ports.py +76 -0
  47. lefx/sdk/validation.py +150 -0
  48. lefx/sdk/values.py +212 -0
  49. lefx/sets/core_set/__init__.py +32 -0
  50. lefx/sets/core_set/core-set.lefxset +0 -0
  51. lefx/sets/smartspeaker_set/__init__.py +32 -0
  52. lefx/sets/smartspeaker_set/smartspeaker-set.lefxset +0 -0
@@ -0,0 +1,63 @@
1
+ """Composes layer frames into the single frame that reaches the hardware.
2
+
3
+ One rule governs the whole stack: a position holding ``None`` contributes
4
+ nothing and whatever was composed below stays; any colour, black included,
5
+ overwrites. That is the entire mechanism behind a direction marker sitting on
6
+ top of a state without erasing it.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from dataclasses import dataclass
12
+ from typing import Iterable
13
+
14
+ from lefx.sdk import OutputFrame, scale_color
15
+
16
+ from .composer import LayerFrame
17
+
18
+
19
+ @dataclass(slots=True)
20
+ class OutputSettings:
21
+ """Global output controls, applied after composition.
22
+
23
+ These belong to the installation, not to any definition: dimming the ring
24
+ must not change what an effect renders.
25
+ """
26
+
27
+ brightness: float = 1.0
28
+ enabled: bool = True
29
+
30
+ def with_brightness(self, level: float) -> None:
31
+ self.brightness = max(0.0, min(1.0, float(level)))
32
+
33
+ def with_enabled(self, enabled: bool) -> None:
34
+ self.enabled = bool(enabled)
35
+
36
+
37
+ class SceneRenderer:
38
+ def compose(
39
+ self,
40
+ frames: Iterable[LayerFrame],
41
+ *,
42
+ led_count: int,
43
+ timestamp: float,
44
+ settings: OutputSettings | None = None,
45
+ ) -> OutputFrame:
46
+ pixels = [0] * led_count
47
+ for frame in frames:
48
+ for index, value in enumerate(frame.pixels):
49
+ if value is None:
50
+ # Nothing contributed here — keep what the layers below composed.
51
+ continue
52
+ pixels[index] = value
53
+
54
+ if settings is not None:
55
+ if not settings.enabled:
56
+ pixels = [0] * led_count
57
+ elif settings.brightness < 1.0:
58
+ pixels = [scale_color(value, settings.brightness) for value in pixels]
59
+
60
+ return OutputFrame(leds=tuple(pixels), timestamp=timestamp)
61
+
62
+
63
+ __all__ = ["OutputSettings", "SceneRenderer"]
lefx/engine/runtime.py ADDED
@@ -0,0 +1,393 @@
1
+ """The command surface and the render step.
2
+
3
+ Every command is transport-independent and fully validated before it touches
4
+ anything: an invalid command leaves the runtime exactly as it was. The verbs
5
+ here are the same ones the CLI and the HTTP API expose, because both are
6
+ transports for these calls and hold no logic of their own.
7
+
8
+ The engine decides by form, never by identity. There is no branch anywhere below
9
+ that asks which definition it is looking at.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import time
15
+ from typing import Any, Callable, Mapping
16
+
17
+ from lefx.sdk import (
18
+ DefinitionBase,
19
+ DefinitionKind,
20
+ DefinitionType,
21
+ FrameSink,
22
+ InputMode,
23
+ OutputFrame,
24
+ StateSlot,
25
+ initial_runtime_inputs,
26
+ normalize_runtime_inputs,
27
+ resolve_configuration,
28
+ )
29
+
30
+ from .composer import InputProviderFn, SceneComposer
31
+ from .config import EngineConfig
32
+ from .errors import ChannelNotFoundError, CommandError
33
+ from .inputs import input_status
34
+ from .invocation import Invocation, duration_from_config
35
+ from .layers import COMPOSITION_ORDER, LayerId, layer_for, parse_state_slot, slot_for
36
+ from .registry import EffectRegistry, ResolvedTarget
37
+ from .renderer import OutputSettings, SceneRenderer
38
+ from .store import LayerStore
39
+
40
+ Action = str
41
+ _ACTIONS = ("on", "off", "toggle")
42
+
43
+
44
+ def normalize_channel(channel: str | None) -> str:
45
+ text = str(channel or "").strip().lower()
46
+ if not text:
47
+ raise CommandError("A controlled overlay requires a non-empty channel name")
48
+ return text
49
+
50
+
51
+ class EffectRuntime:
52
+ """Holds the layer stack and applies commands to it."""
53
+
54
+ def __init__(
55
+ self,
56
+ registry: EffectRegistry,
57
+ *,
58
+ sink: FrameSink | None = None,
59
+ config: EngineConfig | None = None,
60
+ input_providers: Mapping[str, InputProviderFn] | None = None,
61
+ clock: Callable[[], float] = time.monotonic,
62
+ ) -> None:
63
+ self.registry = registry
64
+ self.config = config or EngineConfig()
65
+ self.sink = sink
66
+ self.store = LayerStore()
67
+ self.output = OutputSettings()
68
+ self.composer = SceneComposer(registry, input_providers=input_providers)
69
+ self.renderer = SceneRenderer()
70
+ self._clock = clock
71
+ self._sequence = 0
72
+ self.last_frame: OutputFrame | None = None
73
+
74
+ def set_registry(self, registry: EffectRegistry) -> None:
75
+ """Point the runtime at a rebuilt registry after a reload.
76
+
77
+ Anything still on a layer keeps rendering only if its definition
78
+ survived the reload; the composer drops the instances either way and
79
+ rebuilds them from whatever the new registry holds.
80
+ """
81
+ self.registry = registry
82
+ self.composer.set_registry(registry)
83
+
84
+ # -- states -------------------------------------------------------------
85
+
86
+ def set_state(
87
+ self,
88
+ target: str,
89
+ config: Mapping[str, Any] | None = None,
90
+ *,
91
+ slot: str | StateSlot | None = None,
92
+ action: Action = "on",
93
+ now: float | None = None,
94
+ ) -> Invocation | None:
95
+ """Activate a state, or switch it off. Plain ``set`` always means on.
96
+
97
+ An implicit toggle would make retries and repeated API calls unsafe, so
98
+ turning something off is something a caller has to ask for.
99
+ """
100
+ resolved = self.registry.resolve(target, expected_type=DefinitionType.STATE)
101
+ chosen_slot = None if slot is None else parse_state_slot(slot)
102
+ layer = layer_for(resolved.effect.definition, slot=chosen_slot)
103
+ return self._apply_switchable(resolved, layer, config, None, action, now)
104
+
105
+ def clear_state(
106
+ self, *, slot: str | StateSlot = StateSlot.PRIMARY
107
+ ) -> list[str]:
108
+ layer = (
109
+ LayerId.BACKGROUND_STATE
110
+ if parse_state_slot(slot) is StateSlot.BACKGROUND
111
+ else LayerId.PRIMARY_STATE
112
+ )
113
+ return self.store.clear_layer(layer)
114
+
115
+ # -- overlays -----------------------------------------------------------
116
+
117
+ def set_overlay(
118
+ self,
119
+ target: str,
120
+ *,
121
+ channel: str | None = None,
122
+ config: Mapping[str, Any] | None = None,
123
+ inputs: Mapping[str, Any] | None = None,
124
+ action: Action = "on",
125
+ now: float | None = None,
126
+ ) -> Invocation | None:
127
+ resolved = self.registry.resolve(target, expected_type=DefinitionType.OVERLAY)
128
+ definition = resolved.effect.definition
129
+ layer = layer_for(definition)
130
+
131
+ if definition.kind is DefinitionKind.TIMED_OVERLAY:
132
+ if action != "on":
133
+ raise CommandError(
134
+ "A timed overlay ends by itself and supports only action 'on'"
135
+ )
136
+ if channel is not None:
137
+ raise CommandError(
138
+ "A timed overlay has no channel; only controlled overlays are addressable"
139
+ )
140
+ if inputs:
141
+ raise CommandError("A timed overlay has no runtime inputs")
142
+ return self._activate(resolved, layer, config, None, now=now)
143
+
144
+ normalized_channel = normalize_channel(channel)
145
+ return self._apply_switchable(
146
+ resolved, layer, config, inputs, action, now, channel=normalized_channel
147
+ )
148
+
149
+ def update_overlay(
150
+ self,
151
+ channel: str,
152
+ inputs: Mapping[str, Any] | None = None,
153
+ *,
154
+ now: float | None = None,
155
+ ) -> Invocation:
156
+ """Apply new runtime values, or record a heartbeat when empty.
157
+
158
+ Updates are partial: only supplied fields change. One unknown or invalid
159
+ field rejects the whole update, so an instance is never half applied.
160
+ """
161
+ moment = self._now(now)
162
+ name = normalize_channel(channel)
163
+ invocation = self.store.find_channel(name)
164
+ if invocation is None:
165
+ raise ChannelNotFoundError(name)
166
+
167
+ definition = invocation.definition
168
+ policy = definition.input_sampling
169
+ if policy is not None and policy.mode is InputMode.PULL:
170
+ raise CommandError(
171
+ f"{definition.id!r} pulls its runtime inputs"
172
+ + (f" from provider {policy.provider_id!r}" if policy.provider_id else "")
173
+ + "; it does not accept pushed updates"
174
+ )
175
+
176
+ normalized = normalize_runtime_inputs(definition, inputs)
177
+ invocation.inputs.update(normalized)
178
+ invocation.input_last_success_at = moment
179
+ invocation.input_error = None
180
+ return invocation
181
+
182
+ def clear_overlay(self, channel: str) -> list[str]:
183
+ name = normalize_channel(channel)
184
+ invocation = self.store.find_channel(name)
185
+ if invocation is None:
186
+ raise ChannelNotFoundError(name)
187
+ return self.store.clear_layer(LayerId.CONTROLLED_OVERLAY)
188
+
189
+ # -- events -------------------------------------------------------------
190
+
191
+ def emit_event(
192
+ self,
193
+ target: str,
194
+ config: Mapping[str, Any] | None = None,
195
+ *,
196
+ priority: int | None = None,
197
+ duration_ms: int | None = None,
198
+ now: float | None = None,
199
+ ) -> Invocation:
200
+ """Queue an event. A running one is never cut short by a newer one."""
201
+ moment = self._now(now)
202
+ resolved = self.registry.resolve(target, expected_type=DefinitionType.EVENT)
203
+ invocation = self._build(resolved, LayerId.EVENT, config, None, moment, duration_ms)
204
+ invocation.priority = priority
205
+ self.store.enqueue_event(invocation, moment)
206
+ return invocation
207
+
208
+ # -- output settings ----------------------------------------------------
209
+
210
+ def set_brightness(self, level: float) -> None:
211
+ self.output.with_brightness(level)
212
+
213
+ def set_enabled(self, enabled: bool) -> None:
214
+ self.output.with_enabled(enabled)
215
+
216
+ def clear_all(self) -> list[str]:
217
+ return self.store.clear_all()
218
+
219
+ # -- rendering ----------------------------------------------------------
220
+
221
+ def render_once(self, now: float | None = None) -> OutputFrame:
222
+ moment = self._now(now)
223
+ self.store.advance(moment)
224
+ frames = self.composer.compose(
225
+ self.store.ordered_active(), moment, self.config.led_count
226
+ )
227
+ frame = self.renderer.compose(
228
+ frames,
229
+ led_count=self.config.led_count,
230
+ timestamp=moment,
231
+ settings=self.output,
232
+ )
233
+ self.last_frame = frame
234
+ if self.sink is not None:
235
+ self.sink.apply_frame(frame)
236
+ return frame
237
+
238
+ def close(self) -> None:
239
+ if self.sink is not None:
240
+ self.sink.close()
241
+
242
+ # -- status -------------------------------------------------------------
243
+
244
+ def status(self, now: float | None = None) -> dict[str, Any]:
245
+ moment = self._now(now)
246
+ return {
247
+ "led_count": self.config.led_count,
248
+ "fps": self.config.fps,
249
+ "output": {
250
+ "brightness": self.output.brightness,
251
+ "enabled": self.output.enabled,
252
+ },
253
+ "sink": None if self.sink is None else self.sink.status().to_dict(),
254
+ "layers": {
255
+ layer.value: self._layer_status(layer, moment) for layer in COMPOSITION_ORDER
256
+ },
257
+ "event_queue": [
258
+ self._invocation_status(item, moment)
259
+ for item in self.store.layer(LayerId.EVENT).queue
260
+ ],
261
+ "frame": None if self.last_frame is None else list(self.last_frame.leds),
262
+ }
263
+
264
+ def _layer_status(self, layer: LayerId, now: float) -> dict[str, Any] | None:
265
+ invocation = self.store.active(layer)
266
+ if invocation is None:
267
+ return None
268
+ return self._invocation_status(invocation, now)
269
+
270
+ def _invocation_status(self, invocation: Invocation, now: float) -> dict[str, Any]:
271
+ definition = invocation.definition
272
+ slot = slot_for(invocation.layer)
273
+ payload: dict[str, Any] = {
274
+ "invocation_id": invocation.invocation_id,
275
+ "effect_id": definition.id,
276
+ "type": definition.definition_type.value,
277
+ "overlay_mode": None if definition.overlay_mode is None else definition.overlay_mode.value,
278
+ "layer": invocation.layer.value,
279
+ "slot": None if slot is None else slot.value,
280
+ "channel": invocation.channel,
281
+ "preset_id": invocation.preset_id,
282
+ "config": dict(invocation.params),
283
+ "active": invocation.is_active,
284
+ "started_at": invocation.activated_at,
285
+ "duration_ms": invocation.duration_ms,
286
+ "remaining_ms": invocation.remaining_ms(now),
287
+ "priority": invocation.effective_priority(),
288
+ }
289
+ if definition.runtime_input_schema:
290
+ payload["inputs"] = dict(invocation.inputs)
291
+ payload["input_health"] = input_status(definition, invocation, now)
292
+ return payload
293
+
294
+ # -- internals ----------------------------------------------------------
295
+
296
+ def _now(self, now: float | None) -> float:
297
+ return self._clock() if now is None else now
298
+
299
+ def _next_invocation_id(self, definition: DefinitionBase) -> str:
300
+ self._sequence += 1
301
+ return f"{definition.id}:{self._sequence}"
302
+
303
+ def _build(
304
+ self,
305
+ resolved: ResolvedTarget,
306
+ layer: LayerId,
307
+ config: Mapping[str, Any] | None,
308
+ inputs: Mapping[str, Any] | None,
309
+ now: float,
310
+ duration_ms: int | None = None,
311
+ channel: str | None = None,
312
+ ) -> Invocation:
313
+ """Resolve and validate everything before anything is placed."""
314
+ definition = resolved.effect.definition
315
+ preset_params = None if resolved.preset is None else resolved.preset.params
316
+ params = resolve_configuration(definition, preset=preset_params, overrides=config)
317
+
318
+ values = initial_runtime_inputs(definition)
319
+ supplied = False
320
+ if inputs:
321
+ if not definition.runtime_input_schema:
322
+ raise CommandError(f"{definition.id!r} declares no runtime inputs")
323
+ normalized = normalize_runtime_inputs(definition, inputs)
324
+ values.update(normalized)
325
+ supplied = bool(normalized)
326
+
327
+ return Invocation(
328
+ invocation_id=self._next_invocation_id(definition),
329
+ definition=definition,
330
+ layer=layer,
331
+ params=params,
332
+ inputs=values,
333
+ created_at=now,
334
+ inputs_supplied=supplied,
335
+ duration_ms=duration_from_config(definition, params, override_ms=duration_ms),
336
+ channel=channel,
337
+ preset_id=None if resolved.preset is None else resolved.preset.preset_id,
338
+ )
339
+
340
+ def _activate(
341
+ self,
342
+ resolved: ResolvedTarget,
343
+ layer: LayerId,
344
+ config: Mapping[str, Any] | None,
345
+ inputs: Mapping[str, Any] | None,
346
+ *,
347
+ now: float | None = None,
348
+ channel: str | None = None,
349
+ ) -> Invocation:
350
+ moment = self._now(now)
351
+ invocation = self._build(resolved, layer, config, inputs, moment, channel=channel)
352
+ self.store.set_active(invocation, moment)
353
+ return invocation
354
+
355
+ def _apply_switchable(
356
+ self,
357
+ resolved: ResolvedTarget,
358
+ layer: LayerId,
359
+ config: Mapping[str, Any] | None,
360
+ inputs: Mapping[str, Any] | None,
361
+ action: Action,
362
+ now: float | None,
363
+ *,
364
+ channel: str | None = None,
365
+ ) -> Invocation | None:
366
+ if action not in _ACTIONS:
367
+ raise CommandError(
368
+ f"Unknown action {action!r}. Expected one of: {', '.join(_ACTIONS)}"
369
+ )
370
+ active = self._is_active(layer, resolved, channel)
371
+ if action == "off" or (action == "toggle" and active):
372
+ if active:
373
+ self.store.clear_layer(layer)
374
+ return None
375
+ return self._activate(resolved, layer, config, inputs, now=now, channel=channel)
376
+
377
+ def _is_active(
378
+ self, layer: LayerId, resolved: ResolvedTarget, channel: str | None
379
+ ) -> bool:
380
+ current = self.store.active(layer)
381
+ if current is None:
382
+ return False
383
+ if current.definition.id != resolved.effect.effect_id:
384
+ return False
385
+ if channel is not None and current.channel != channel:
386
+ return False
387
+ # A preset and its bare definition are different targets: switching off
388
+ # "calm_blue" should not switch off a hand-configured activation.
389
+ expected_preset = None if resolved.preset is None else resolved.preset.preset_id
390
+ return current.preset_id == expected_preset
391
+
392
+
393
+ __all__ = ["EffectRuntime", "normalize_channel"]
lefx/engine/store.py ADDED
@@ -0,0 +1,125 @@
1
+ """Which invocation occupies which layer, and the event queue.
2
+
3
+ The store holds placement only. It carries no application state: there is no
4
+ base state name, no countdown, no direction. Those were application concepts
5
+ that had leaked into the engine and made it decide things it had no business
6
+ deciding.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from dataclasses import dataclass, field
12
+ from typing import Iterator
13
+
14
+ from .invocation import Invocation
15
+ from .layers import COMPOSITION_ORDER, LayerId
16
+
17
+
18
+ @dataclass(slots=True)
19
+ class LayerState:
20
+ """One layer: at most one visible invocation, plus a queue on the event layer."""
21
+
22
+ layer: LayerId
23
+ active: Invocation | None = None
24
+ queue: list[Invocation] = field(default_factory=list)
25
+
26
+ def clear(self) -> list[str]:
27
+ removed = [item.invocation_id for item in self.all_invocations()]
28
+ self.active = None
29
+ self.queue.clear()
30
+ return removed
31
+
32
+ def all_invocations(self) -> Iterator[Invocation]:
33
+ if self.active is not None:
34
+ yield self.active
35
+ yield from self.queue
36
+
37
+
38
+ def _queue_order(invocation: Invocation) -> tuple[int, float]:
39
+ """Higher priority first, then first come first served."""
40
+ return (-invocation.effective_priority(), invocation.created_at)
41
+
42
+
43
+ @dataclass(slots=True)
44
+ class LayerStore:
45
+ layers: dict[LayerId, LayerState] = field(
46
+ default_factory=lambda: {layer: LayerState(layer=layer) for layer in LayerId}
47
+ )
48
+
49
+ def layer(self, layer_id: LayerId) -> LayerState:
50
+ return self.layers[layer_id]
51
+
52
+ def active(self, layer_id: LayerId) -> Invocation | None:
53
+ return self.layers[layer_id].active
54
+
55
+ def ordered_active(self) -> list[Invocation]:
56
+ """Visible invocations from bottom to top."""
57
+ return [
58
+ self.layers[layer].active
59
+ for layer in COMPOSITION_ORDER
60
+ if self.layers[layer].active is not None
61
+ ] # type: ignore[misc]
62
+
63
+ def find_channel(self, channel: str) -> Invocation | None:
64
+ active = self.layers[LayerId.CONTROLLED_OVERLAY].active
65
+ if active is not None and active.channel == channel:
66
+ return active
67
+ return None
68
+
69
+ def set_active(self, invocation: Invocation, now: float) -> list[str]:
70
+ """Place an invocation, replacing whatever held the layer before."""
71
+ state = self.layers[invocation.layer]
72
+ removed = state.clear()
73
+ invocation.activate(now)
74
+ state.active = invocation
75
+ return removed
76
+
77
+ def enqueue_event(self, invocation: Invocation, now: float) -> None:
78
+ """Add an event, activating it immediately when the layer is free.
79
+
80
+ A running event is never cut short by a newer one. Priority decides the
81
+ order of what is waiting, not whether what is showing gets interrupted.
82
+ """
83
+ state = self.layers[LayerId.EVENT]
84
+ if state.active is None:
85
+ invocation.activate(now)
86
+ state.active = invocation
87
+ return
88
+ key = _queue_order(invocation)
89
+ position = len(state.queue)
90
+ for index, queued in enumerate(state.queue):
91
+ if key < _queue_order(queued):
92
+ position = index
93
+ break
94
+ state.queue.insert(position, invocation)
95
+
96
+ def clear_layer(self, layer_id: LayerId) -> list[str]:
97
+ return self.layers[layer_id].clear()
98
+
99
+ def clear_all(self) -> list[str]:
100
+ removed: list[str] = []
101
+ for state in self.layers.values():
102
+ removed.extend(state.clear())
103
+ return removed
104
+
105
+ def advance(self, now: float) -> list[str]:
106
+ """Retire everything whose time is up; promote the next event.
107
+
108
+ Finite forms end because the engine says so. A package sends no
109
+ completion signal and cannot end its own instance.
110
+ """
111
+ expired: list[str] = []
112
+ for layer_id, state in self.layers.items():
113
+ active = state.active
114
+ if active is None or not active.is_expired(now):
115
+ continue
116
+ expired.append(active.invocation_id)
117
+ state.active = None
118
+ if layer_id is LayerId.EVENT and state.queue:
119
+ promoted = state.queue.pop(0)
120
+ promoted.activate(now)
121
+ state.active = promoted
122
+ return expired
123
+
124
+
125
+ __all__ = ["LayerState", "LayerStore"]
@@ -0,0 +1,40 @@
1
+ """LEFX V3 control surface — HTTP API, CLI, client and service hosting.
2
+
3
+ CLI and API carry the same commands and hold no logic of their own. Frame sinks
4
+ and input providers are discovered through entry points, never imported, so this
5
+ package depends on neither the hardware integration nor the simulator.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from .api import API_PREFIX, create_app
11
+ from .client import ControllerClient, Result
12
+ from .discovery import (
13
+ NullSink,
14
+ available_providers,
15
+ available_sinks,
16
+ create_providers,
17
+ create_sink,
18
+ describe,
19
+ split_provider_name,
20
+ )
21
+ from .service import ControllerService, StatusListener
22
+
23
+ INTERFACES_VERSION = "3.0.0"
24
+
25
+ __all__ = [
26
+ "API_PREFIX",
27
+ "ControllerClient",
28
+ "ControllerService",
29
+ "INTERFACES_VERSION",
30
+ "NullSink",
31
+ "Result",
32
+ "StatusListener",
33
+ "available_providers",
34
+ "available_sinks",
35
+ "create_app",
36
+ "create_providers",
37
+ "create_sink",
38
+ "describe",
39
+ "split_provider_name",
40
+ ]