Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(voice): hide FAB by default, add sidebar Voice toggle, distinct violet layer

Adam Eivy4269ff299d05
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cc2e065c9a..cbd39380c6 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -32,6 +32,7 @@
## Changed
+- **Voice agent FAB is hidden by default; sidebar Voice toggle engages, starts listening, and reads as a distinct violet layer.** The push-to-talk widget previously rendered as a floating bottom-right FAB on every page the moment voice was enabled, covering content even when not in use, and styled with the same neutral card border as everything underneath it. Three changes: (1) Replaced the sidebar/mobile-header `ThemeSwitcher` (theme picker still in Settings → General) with a new `VoiceToggleButton` that flips `localStorage.portos.voice.hidden` between `'1'` (hidden) and `'0'` (engaged), dispatches the existing `portos:voice:visibility` event for the widget to re-render on, and additionally fires `portos:voice:engage`/`portos:voice:disengage` so the widget starts/stops capture in lockstep — clicking once now both shows the controls and opens the mic, instead of forcing two clicks. (2) `VoiceWidget` defaults to hidden when the key is unset (legacy users included), so the FAB only appears after the user explicitly engages voice from the sidebar; the same toggle in Settings → Voice keeps working with matching `'0'`/`'1'` semantics. (3) The floating widget surfaces (status pill, text-input form, conversation panel, mobile FAB) now wear a `border-violet-500/50` ring with a `shadow-[0_0_24px_-4px_rgba(168,85,247,0.55)]` glow, and the primary mic button is violet-tinted (`bg-violet-500` while capturing, `bg-violet-500/20` idle), so the voice layer reads as a distinct interactive surface instead of blending into whatever card it's covering. Files: `client/src/components/Layout.jsx`, `client/src/components/voice/VoiceToggleButton.jsx` (new), `client/src/components/voice/VoiceWidget.jsx`, `client/src/components/settings/VoiceTab.jsx`.
- **Execution lanes are now priority tags, not concurrency gates.** `server/services/executionLanes.js` previously had its own `maxConcurrent` caps per lane (critical: 1, standard: 2, background: 3) on top of the user-configurable global/per-app caps in `cos.js` (`maxConcurrentAgents`, `maxConcurrentAgentsPerProject`). The lane gates were silently shadowing the user's settings — bumping `maxConcurrentAgents` to 8 still capped throughput at 6 because the lane subsystem refused to accept the 7th and 8th agents — and on backpressure `agentLifecycle` would `waitForLane` for up to 30s before bailing, which manifested as "agent stuck queueing" in the UI for tasks that should have spawned immediately. Removed the per-lane cap, the lane-internal waiting queue, the timeout/promotion-on-capacity path, and the `hasCapacity`/`waitForLane`/`updateLaneConfig` exports; `acquire` now always succeeds for known lanes, `promote` no longer rejects when the target lane is "full", and `getStats`/`getLaneStatus` drop the `maxConcurrent`/`available`/`queueLength`/`utilizationPercent` fields. Lanes still carry `priority` and per-agent `{ startedAt, taskId, metadata }` for observability. `agentLifecycle.spawnAgentForTask` now just tags the agent's lane and continues — global capacity is enforced once, upstream, where the user can actually configure it. Existing tests rewritten to match: 5 deleted (capacity/wait/queue cases), 3 reframed to assert "lane is a tag, not a gate", and the `cleanupAgentWorktree` mock simplified to remove `hasCapacity`/`waitForLane`. Files: `server/services/executionLanes.js`, `server/services/executionLanes.test.js`, `server/services/agentLifecycle.js`, `server/services/cleanupAgentWorktree.test.js`.
- **Dashboard fills the full content area on wide monitors.** The Dashboard page was wrapped in `max-w-7xl mx-auto` like the rest of the app, so on monitors wider than ~1280px there were huge empty side margins next to a relatively narrow widget grid. Since the dashboard's grid renderer is already designed to flex across whatever space it's given (12-column grid, snap-to-grid drag/resize), the cap was wasted real estate — moved the dashboard route (`/`) out of the capped branch in `Layout.jsx` so widgets now fill the full width of the main content area while keeping the existing `p-4 md:p-6` gutter for a consistent margin. No behavior change on smaller viewports (where the cap was never reached) or on other pages. File: `client/src/components/Layout.jsx`.
- **Test coverage: +89 tests across 11 previously-uncovered modules.** Added focused unit tests for low-level utilities and route handlers that had 0% coverage in the baseline coverage report: `lib/sseUtils.js` (broadcast/attach/cleanup of SSE clients and the Python-noise filter), `lib/tailscale.js` (CLI-binary discovery across PATH and well-known install paths), `lib/zipStream.js` (streaming ZIP parser — stored + DEFLATE entries, multi-chunk arrival, path-traversal sanitization, autodrain), `lib/execGit.js` (timeout, maxBuffer overflow, ignoreExitCode, spawn-error paths), `routes/avatar.js` (404 + streaming + ENOENT/EIO mid-stream errors via deferred-emit Readable), `routes/agents.js` (kill/list/info with status + body-shape assertions), `routes/notifications.js` (full CRUD, 404 propagation), `routes/usage.js` (summary/raw/session/messages/tokens/reset), `routes/backup.js` (status, run with/without dest, snapshots, restore + zod validation), `services/agentDrafts.js` (per-agent CRUD, sort by createdAt via fake timers, scoping), `services/brainGraph.js` (Jaccard threshold, bridge remap, missing-bridge dropping, dedup with memory edges, getGraphData failure fallback). Total server suite: 2633 → 2722 tests across 103 → 114 files; all pass.
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index f2f11c6d35..3cd3ff6435 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -85,7 +85,7 @@ import { useAgentFeedbackToast } from '../hooks/useAgentFeedbackToast';
import { useUpdateChecker } from '../hooks/useUpdateChecker';
import { useAIStatusNotifications } from '../hooks/useAIStatusNotifications';
import NotificationDropdown from './NotificationDropdown';
-import ThemeSwitcher from './ThemeSwitcher';
+import VoiceToggleButton from './voice/VoiceToggleButton';
import CmdKSearch from './CmdKSearch';
import KeyboardHelp from './KeyboardHelp';
import VoiceWidget from './voice/VoiceWidget';
@@ -687,7 +687,7 @@ export default function Layout() {
>
<Monitor size={18} />
</NavLink>
- <ThemeSwitcher className={collapsed ? 'lg:hidden' : ''} />
+ <VoiceToggleButton className={collapsed ? 'lg:hidden' : ''} />
<NotificationDropdown
notifications={notifications}
unreadCount={unreadCount}
@@ -729,7 +729,7 @@ export default function Layout() {
>
<Monitor size={16} />
</NavLink>
- <ThemeSwitcher position="below" />
+ <VoiceToggleButton />
<NotificationDropdown
notifications={notifications}
unreadCount={unreadCount}
diff --git a/client/src/components/settings/VoiceTab.jsx b/client/src/components/settings/VoiceTab.jsx
index da703e574a..73d504c346 100644
--- a/client/src/components/settings/VoiceTab.jsx
+++ b/client/src/components/settings/VoiceTab.jsx
@@ -6,6 +6,7 @@ import {
getVoiceStatus, getVoiceConfig, updateVoiceConfig, listVoices, testTts, fetchPiperVoice,
} from '../../services/apiVoice';
import { playWav, webSpeechSupported } from '../../services/voiceClient';
+import { readVoiceHidden, writeVoiceHidden } from '../../services/voiceVisibility';
const SERVICE_LABELS = {
whisper: 'Whisper (STT)',
@@ -34,9 +35,6 @@ const KOKORO_DTYPES = [
const ACCENT_LABELS = { 'en-US': 'American', 'en-GB': 'British' };
-const HIDDEN_KEY = 'portos.voice.hidden';
-const VISIBILITY_EVENT = 'portos:voice:visibility';
-
const formatVoiceLabel = (v, engine) => {
if (engine === 'piper') {
// Always lead with the voice ID so entries are distinguishable even if the
@@ -98,15 +96,10 @@ export function VoiceTab() {
const [testing, setTesting] = useState(false);
const [previewingVoice, setPreviewingVoice] = useState(null);
const [downloadingVoice, setDownloadingVoice] = useState(null);
- const [widgetHidden, setWidgetHidden] = useState(() => {
- if (typeof window === 'undefined') return false;
- return window.localStorage.getItem(HIDDEN_KEY) === '1';
- });
+ const [widgetHidden, setWidgetHidden] = useState(readVoiceHidden);
const toggleWidgetHidden = (next) => {
- if (next) window.localStorage.setItem(HIDDEN_KEY, '1');
- else window.localStorage.removeItem(HIDDEN_KEY);
- window.dispatchEvent(new Event(VISIBILITY_EVENT));
+ writeVoiceHidden(next);
setWidgetHidden(next);
};
diff --git a/client/src/components/voice/VoiceToggleButton.jsx b/client/src/components/voice/VoiceToggleButton.jsx
new file mode 100644
index 0000000000..40d4549721
--- /dev/null
+++ b/client/src/components/voice/VoiceToggleButton.jsx
@@ -0,0 +1,66 @@
+import { useEffect, useState } from 'react';
+import { Mic, MicOff } from 'lucide-react';
+import { getVoiceConfig } from '../../services/apiVoice';
+import { onVoiceEvent } from '../../services/voiceClient';
+import {
+ VISIBILITY_EVENT,
+ ENGAGE_EVENT,
+ DISENGAGE_EVENT,
+ readVoiceHidden,
+ writeVoiceHidden,
+ isVoiceHiddenStorageEvent,
+} from '../../services/voiceVisibility';
+
+export default function VoiceToggleButton({ className = '' }) {
+ const [enabled, setEnabled] = useState(false);
+ const [hidden, setHidden] = useState(readVoiceHidden);
+
+ useEffect(() => {
+ getVoiceConfig()
+ .then((cfg) => setEnabled(!!cfg?.enabled))
+ .catch(() => {});
+ const off = onVoiceEvent('voice:config:changed', (cfg) => {
+ if (typeof cfg?.enabled === 'boolean') setEnabled(cfg.enabled);
+ });
+ return off;
+ }, []);
+
+ useEffect(() => {
+ const sync = () => setHidden(readVoiceHidden());
+ const onStorage = (e) => { if (isVoiceHiddenStorageEvent(e)) sync(); };
+ window.addEventListener(VISIBILITY_EVENT, sync);
+ window.addEventListener('storage', onStorage);
+ return () => {
+ window.removeEventListener(VISIBILITY_EVENT, sync);
+ window.removeEventListener('storage', onStorage);
+ };
+ }, []);
+
+ if (!enabled) return null;
+
+ const engaged = !hidden;
+
+ const toggle = () => {
+ const next = !engaged;
+ writeVoiceHidden(!next);
+ window.dispatchEvent(new Event(next ? ENGAGE_EVENT : DISENGAGE_EVENT));
+ setHidden(!next);
+ };
+
+ const Icon = engaged ? Mic : MicOff;
+
+ return (
+ <button
+ type="button"
+ onClick={toggle}
+ className={`p-1.5 rounded-lg transition-colors ${
+ engaged ? 'text-port-accent' : 'text-gray-500 hover:text-white'
+ } ${className}`}
+ title={engaged ? 'Hide voice agent controls' : 'Engage voice agent controls'}
+ aria-label={engaged ? 'Hide voice agent controls' : 'Engage voice agent controls'}
+ aria-pressed={engaged}
+ >
+ <Icon size={18} />
+ </button>
+ );
+}
diff --git a/client/src/components/voice/VoiceWidget.jsx b/client/src/components/voice/VoiceWidget.jsx
index 8a2daa8bb7..b845a0b64e 100644
--- a/client/src/components/voice/VoiceWidget.jsx
+++ b/client/src/components/voice/VoiceWidget.jsx
@@ -10,13 +10,19 @@ import { getVoiceConfig } from '../../services/apiVoice';
import toast from '../ui/Toast';
import { useVoiceUiSync, pushUiIndexAfterAction } from '../../hooks/useVoiceUiSync';
import { doClick, doFill, doSelect, doSetCheckbox } from '../../services/uiInteract';
+import {
+ VISIBILITY_EVENT,
+ ENGAGE_EVENT,
+ DISENGAGE_EVENT,
+ readVoiceHidden,
+ writeVoiceHidden,
+ isVoiceHiddenStorageEvent,
+} from '../../services/voiceVisibility';
// Peak below this (0..1) is usually whisper's [BLANK_AUDIO] territory.
const QUIET_MIC_THRESHOLD = 0.02;
const HANDS_FREE_KEY = 'portos.voice.handsFree';
-const HIDDEN_KEY = 'portos.voice.hidden';
-const VISIBILITY_EVENT = 'portos:voice:visibility';
const STAGE = {
idle: { icon: Mic, label: '', tone: 'text-gray-300' },
@@ -62,10 +68,7 @@ export default function VoiceWidget() {
const stored = window.localStorage.getItem(HANDS_FREE_KEY);
return stored === null ? true : stored === '1';
});
- const [hidden, setHidden] = useState(() => {
- if (typeof window === 'undefined') return false;
- return window.localStorage.getItem(HIDDEN_KEY) === '1';
- });
+ const [hidden, setHidden] = useState(readVoiceHidden);
const [level, setLevel] = useState(0);
const scrollRef = useRef(null);
const useWebSpeech = sttEngine === 'web-speech' && webSpeechSupported;
@@ -362,14 +365,27 @@ export default function VoiceWidget() {
// Settings → Voice can toggle widget visibility without a reload. Listen for
// the custom event and the storage event (covers other tabs).
useEffect(() => {
- const sync = () => {
- setHidden(window.localStorage.getItem(HIDDEN_KEY) === '1');
- };
+ const sync = () => setHidden(readVoiceHidden());
+ const onStorage = (e) => { if (isVoiceHiddenStorageEvent(e)) sync(); };
window.addEventListener(VISIBILITY_EVENT, sync);
- window.addEventListener('storage', sync);
+ window.addEventListener('storage', onStorage);
return () => {
window.removeEventListener(VISIBILITY_EVENT, sync);
- window.removeEventListener('storage', sync);
+ window.removeEventListener('storage', onStorage);
+ };
+ }, []);
+
+ // Sidebar Voice toggle dispatches engage/disengage so engaging the widget
+ // also starts listening (and disengaging stops the mic) — without this the
+ // user would have to click the toggle, then click mic separately.
+ useEffect(() => {
+ const onEngage = () => { handleStartRef.current?.(); };
+ const onDisengage = () => { handleStopRef.current?.(); };
+ window.addEventListener(ENGAGE_EVENT, onEngage);
+ window.addEventListener(DISENGAGE_EVENT, onDisengage);
+ return () => {
+ window.removeEventListener(ENGAGE_EVENT, onEngage);
+ window.removeEventListener(DISENGAGE_EVENT, onDisengage);
};
}, []);
@@ -378,35 +394,37 @@ export default function VoiceWidget() {
if (isContinuous()) stopContinuous();
if (isCapturing()) stopCapture({ submit: false });
interrupt();
- window.localStorage.setItem(HIDDEN_KEY, '1');
- window.dispatchEvent(new Event(VISIBILITY_EVENT));
+ writeVoiceHidden(true);
setHidden(true);
- toast('Voice widget hidden. Re-enable in Settings → Voice.');
+ toast('Voice widget hidden. Re-enable from the sidebar mic or Settings → Voice.');
}, []);
if (!enabled || hidden) return null;
const { icon: Icon, label, tone } = STAGE[stage] || STAGE.idle;
const capturing = ACTIVE_STAGES.has(stage) || isWebSpeechCapturing();
+ // Distinct violet ring + soft glow so the floating widget reads as
+ // "voice agent layer" instead of blending into whatever card it's covering.
+ const fabSurface = 'border-violet-500/50 shadow-[0_0_24px_-4px_rgba(168,85,247,0.55)]';
return (
<div className="fixed bottom-4 right-4 z-50 flex flex-col items-end gap-2">
{!expanded && (
<div className="md:hidden flex items-center gap-2">
- {capturing && <span className={`text-xs ${tone} bg-port-card/95 backdrop-blur border border-port-border rounded-full px-2 py-1`}>{label}</span>}
+ {capturing && <span className={`text-xs ${tone} bg-port-card/95 backdrop-blur border rounded-full px-2 py-1 ${fabSurface}`}>{label}</span>}
<button
onClick={hideWidget}
title="Hide voice widget (restore in Settings → Voice)"
- className="p-2 rounded-full bg-port-card border border-port-border text-gray-400 hover:text-white shadow-lg"
+ className={`p-2 rounded-full bg-port-card border text-gray-400 hover:text-white ${fabSurface}`}
>
<EyeOff size={14} />
</button>
<button
onClick={() => { setExpanded(true); toggleCapture(); }}
- className={`p-3 rounded-full shadow-lg transition-colors ${
+ className={`p-3 rounded-full border transition-colors ${fabSurface} ${
capturing
- ? 'bg-port-accent text-white animate-pulse'
- : 'bg-port-card border border-port-border text-white'
+ ? 'bg-violet-500 text-white animate-pulse'
+ : 'bg-port-card text-white'
}`}
title="Open voice controls"
>
@@ -416,7 +434,7 @@ export default function VoiceWidget() {
)}
<div className={`${expanded ? 'flex' : 'hidden'} md:flex flex-col items-end gap-2 w-96 max-w-[calc(100vw-2rem)]`}>
{!collapsed && history.length > 0 && (
- <div className="bg-port-card/95 backdrop-blur border border-port-border rounded-xl shadow-lg w-full flex flex-col">
+ <div className={`bg-port-card/95 backdrop-blur border rounded-xl w-full flex flex-col ${fabSurface}`}>
<div className="flex items-center justify-between px-3 py-1.5 border-b border-port-border/50">
<span className="text-xs text-gray-400">Conversation</span>
<button
@@ -447,7 +465,7 @@ export default function VoiceWidget() {
)}
<form
onSubmit={(e) => { e.preventDefault(); handleSend(); }}
- className="flex items-center gap-1 bg-port-card/95 backdrop-blur border border-port-border rounded-full pl-4 pr-1 py-1 shadow-lg w-full"
+ className={`flex items-center gap-1 bg-port-card/95 backdrop-blur border rounded-full pl-4 pr-1 py-1 w-full ${fabSurface}`}
>
<input
type="text"
@@ -471,7 +489,7 @@ export default function VoiceWidget() {
Dictating to Daily Log — say &quot;stop dictation&quot; to end
</div>
)}
- <div className="flex items-center gap-2 bg-port-card/95 backdrop-blur border border-port-border rounded-full pl-3 pr-1 py-1 shadow-lg">
+ <div className={`flex items-center gap-2 bg-port-card/95 backdrop-blur border rounded-full pl-3 pr-1 py-1 ${fabSurface}`}>
<span className={`text-xs ${tone}`}>{label}</span>
{!useWebSpeech && handsFree && isContinuous() && (
<span
@@ -516,8 +534,8 @@ export default function VoiceWidget() {
onClick={toggleCapture}
className={`p-3 rounded-full transition-colors ${
capturing
- ? 'bg-port-accent text-white animate-pulse'
- : 'bg-port-border hover:bg-port-border/70 text-white'
+ ? 'bg-violet-500 text-white animate-pulse'
+ : 'bg-violet-500/20 hover:bg-violet-500/40 text-violet-200'
}`}
title={(() => {
if (handsFree) {
diff --git a/client/src/services/voiceVisibility.js b/client/src/services/voiceVisibility.js
new file mode 100644
index 0000000000..4f77c07242
--- /dev/null
+++ b/client/src/services/voiceVisibility.js
@@ -0,0 +1,21 @@
+export const HIDDEN_KEY = 'portos.voice.hidden';
+export const VISIBILITY_EVENT = 'portos:voice:visibility';
+export const ENGAGE_EVENT = 'portos:voice:engage';
+export const DISENGAGE_EVENT = 'portos:voice:disengage';
+
+// Sentinel '0' = explicitly engaged. Anything else (including key absent)
+// means hidden — keeps legacy users hidden by default after the flip.
+export const readVoiceHidden = () => {
+ if (typeof window === 'undefined') return true;
+ return window.localStorage.getItem(HIDDEN_KEY) !== '0';
+};
+
+export const writeVoiceHidden = (hidden) => {
+ window.localStorage.setItem(HIDDEN_KEY, hidden ? '1' : '0');
+ window.dispatchEvent(new Event(VISIBILITY_EVENT));
+};
+
+// Storage events fire for every localStorage write in any tab; gate to our key
+// (or null = clear) so unrelated writes don't churn voice components.
+export const isVoiceHiddenStorageEvent = (event) =>
+ !event || event.key === HIDDEN_KEY || event.key === null;