refactor: separate voice controls and configurable Realtime connections

This commit is contained in:
Sameh Khamis committed 2026-09-13 21:54:51 -07:00
1 parent 0ba00f4662
commit 1a1cbadf5b
21 files changed
+3126 -2793

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
/** Read layer lifecycle through the supplied manager. */
export function readLayerLifecycleSummary(
dataManager,
layerId,
{ fallbackEnabled = false } = {},
) {
let lifecycle = null;
try {
lifecycle = dataManager?.getLayerLifecycleState?.(layerId) || null;
} catch {
lifecycle = null;
}
if (lifecycle) {
const enabled = Boolean(lifecycle.enabled);
return {
enabled,
lifecycleState:
lifecycle.lifecycleState || (enabled ? 'enabled' : 'disabled'),
lifecycleUncertain: Boolean(
lifecycle.uncertain ?? lifecycle.lifecycleUncertain,
),
};
}
let enabled = Boolean(fallbackEnabled);
try {
const managerEnabled = dataManager?.isEnabled?.(layerId);
if (typeof managerEnabled === 'boolean') enabled = managerEnabled;
} catch {
// Retain the caller's observed fallback when the lightweight adapter fails.
}
return {
enabled,
lifecycleState: enabled ? 'enabled' : 'disabled',
lifecycleUncertain: false,
};
}