Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ The ref is seeded from whatever is on the session at mount, which is an earlier
`start()` clears it, but this route mounts before it runs.

**Stealth mode lives on the live control bar and nowhere else.** It was in the titlebar menu and
the command palette, both reachable from the login screen and the payment page, where hiding the
window from a screen capture answers a question nobody is asking - the screen share it exists for
the command palette, both reachable from the login screen and the payment page, where pulling the
window off the taskbar and making it click-through answers a question nobody is asking - the screen share it exists for
only happens during a real call. Entering is a click; leaving is the global hotkey, because that
bar does not render in stealth mode, which is the point of it.

Expand Down Expand Up @@ -606,7 +606,7 @@ second one at the end of every session.
**And a session that ends takes stealth with it.** `refreshWindowSurfaces()` drops it when the
running state leaves `Running`, which is the one place in main every start and end passes through.
The renderer's stop path already asked for that, but it is one of several ways a session ends, and
any of the others missing it leaves the window click-through, invisible to a screen capture and
any of the others missing it leaves the window click-through, off the taskbar and
unfocusable, with no interview on screen to explain why.

### The mock interview turn
Expand Down Expand Up @@ -786,7 +786,11 @@ The Dock half has a failure mode of its own: **macOS drops a Dock call made with

Whether the *shell* actually acts on `setSkipTaskbar` is not something a unit test can reach, and it fails without an error. `test/manual/taskbar-probe.mjs` drives the real service in a real Electron process and reads the taskbar back through UI Automation - Windows only, run by hand (`pnpm exec electron test/manual/taskbar-probe.mjs`), deliberately not in `test/run.mjs`.

Stealth mode hides the window from screen capture via `setContentProtection`. The main process emits `stealth-changed`; the preload script toggles a `stealth` CSS class on `document.body`. Content protection is on by default. The `allowScreenCapture` setting (Configuration, off by default) lifts it outside stealth mode, and so does `--disable-content-protection` at launch (dev/testing only). Stealth always protects, whatever either says: a window made capturable for a demo must not stay capturable on the screen share stealth exists for. `applyContentProtection()` runs inside `applySurfaceVisibility()` so the setting applies live and every stealth toggle re-evaluates it, and it skips no-op calls like the z-order does. The app's own action-suggestion screenshot goes through `withContentProtection()`, which protects the window for the capture and waits `CAPTURE_PROTECTION_SETTLE_MS` when it had to switch: the setting is about other apps seeing the window, and that screenshot exists to show the model what is behind it - with the window in it, it can cover the question and feed the model its own earlier answers. `test/content-protection.test.mjs` pins it.
Stealth mode does **not** decide screen capture. The main process emits `stealth-changed`; the preload script toggles a `stealth` CSS class on `document.body`, and stealth means taskbar/Dock hiding, the on-top pin and click-through - nothing about capture. Whether other apps can capture the window is the `allowScreenCapture` setting alone (Configuration, off by default), applied through `setContentProtection` by `applyContentProtection()` inside `applySurfaceVisibility()`, so the setting applies live and skips no-op calls like the z-order does. Stealth used to force protection on, which implied a promise the OS does not keep: on macOS `setContentProtection` sets `NSWindowSharingNone`, and apps built on ScreenCaptureKit (newer recorders, several meeting apps) capture the window anyway, by design. The old `--disable-content-protection` launch flag is gone with it.

The app is honest about it instead. `useScreenCaptureStatus()` reports `capturable` (setting on), `protected` (setting off on Windows) or `limited` (setting off anywhere else - macOS for the ScreenCaptureKit reason, Linux because Electron has no protection there at all). Anything but `protected` raises `ScreenCaptureNoticeDialog` before a live start - after the headphone notice, before the save prompt, with Cancel going home the same way - offering *Hide and start* (turns the setting off) beside *Start anyway*. During the session `ScreenCaptureBadge` sits on the control bar and in the stealth `StatusPanel` and shows all three states - red, amber, and a green "Invisible to capture" - so protection can be confirmed at a glance rather than inferred from a missing warning. Green is only ever shown where the OS honours the protection, which is why macOS reads as amber. `test/screen-capture-notice.test.mjs` pins the ordering and both badges.

The app's own action-suggestion screenshot still goes through `withContentProtection()`, which protects the window for the capture and waits `CAPTURE_PROTECTION_SETTLE_MS` when it had to switch: the setting is about other apps seeing the window, and that screenshot exists to show the model what is behind it - with the window in it, it can cover the question and feed the model its own earlier answers. `test/content-protection.test.mjs` pins that stealth leaves protection alone and that the own capture still protects.

Background throttling is disabled globally (via `app.commandLine` switches and `backgroundThrottling: false` in `webPreferences`) so audio keeps running when the window is occluded.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Stay on top of the conversation with live ASR:

### Staying Out of Sight

The app keeps itself off the surfaces a screen share exposes. There is no desktop shortcut, and the window is hidden from screen capture by default. To show it in screen shares, recordings and screenshots, turn on "Allow screen capture" in Configuration; stealth mode hides it again whatever that setting says, and also removes the Windows taskbar button and the macOS Dock icon and Cmd+Tab entry. Outside stealth mode the app otherwise behaves like any other window, taskbar button and Dock icon included, unless you turn on "Hide taskbar icon during live interviews" in Configuration.
The app keeps itself off the surfaces a screen share exposes. There is no desktop shortcut, and the window is hidden from screen capture by default. To show it in screen shares, recordings and screenshots, turn on "Allow screen capture" in Configuration. That setting alone decides capture: stealth mode does not override it, and the app warns before a live interview and shows a badge during one whenever the window can be captured. Hiding is best effort: on macOS, apps built on ScreenCaptureKit (newer recorders and some meeting apps) can capture the window even with the setting off. Stealth mode removes the Windows taskbar button and the macOS Dock icon and Cmd+Tab entry, and makes the window click-through. Outside stealth mode the app otherwise behaves like any other window, taskbar button and Dock icon included, unless you turn on "Hide taskbar icon during live interviews" in Configuration.

**Lost the window?** Launch Power Interview again. It does not start a second copy - the running app brings its window back and focuses it.

Expand Down
2 changes: 1 addition & 1 deletion nodemon.show.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"watch": ["electron-dist"],
"ext": "js,cjs,json",
"delay": 1000,
"exec": "cross-env NODE_ENV=development electron . --disable-content-protection"
"exec": "cross-env NODE_ENV=development electron ."
}
19 changes: 9 additions & 10 deletions src/main/services/window-control.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ let _stealth = configStore.getStealth();
let _hideTaskbarWhileRunning = readHideTaskbarSetting();
let _allowScreenCapture = readAllowScreenCaptureSetting();

// Dev/testing override, kept from before the setting existed: launching with it allows capture
// outside stealth whatever the setting says.
const captureForcedByFlag = process.argv.includes('--disable-content-protection');

// While surfaces are hidden the window is re-raised on this interval, since something else
// (a call app, a fullscreen share) can still end up above it.
let raiseTimer: NodeJS.Timeout | null = null;
Expand Down Expand Up @@ -200,11 +196,13 @@ export function canMinimize(): boolean {
}

/**
* Whether the window is hidden from screen capture. Stealth always protects: it is the explicit
* request to be invisible, and a capture setting chosen for an ordinary window must not undo it.
* Whether the window is hidden from other apps' screen capture. The setting alone decides it -
* stealth does not, because protection is not something the app can promise: on macOS,
* ScreenCaptureKit recorders ignore it by design. The renderer warns before a live session and
* shows the state during one instead of implying stealth makes the window invisible.
*/
function shouldProtectContent(): boolean {
return _stealth || ownCaptures > 0 || !(_allowScreenCapture || captureForcedByFlag);
return ownCaptures > 0 || !_allowScreenCapture;
}

/**
Expand Down Expand Up @@ -399,7 +397,7 @@ export function refreshWindowSurfaces(): void {
// `stealthUnavailableReason()` - so a run that ends takes it with it, and this is the one place
// every ending passes through. Left to the renderer's stop path alone it would be one of
// several: the stop hotkey, a teardown decided in main, a session that ends while the window is
// hidden. Any of those missing it leaves the app click-through, invisible to a screen capture
// hidden. Any of those missing it leaves the app click-through, off the taskbar
// and unfocusable, with no interview on screen to explain why and only a global hotkey out.
if (_stealth && !isAssistantRunning()) {
// Applies the surfaces itself, so returning here is not skipping that.
Expand Down Expand Up @@ -741,8 +739,9 @@ export function disableStealth(): void {
* Why entering stealth is refused right now, or `null` when it is available.
*
* **Stealth is a live-interview control, and this is where that is enforced.** What it does is
* hide the window from a screen capture and pin it over the call; the screen share it hides from
* only exists during a real interview. Everywhere else it is a mode with nothing to hide that
* take the window off the taskbar and pin it over the call; the screen share it stays out of
* the way of only exists during a real interview. Everywhere else it is a mode with nothing to
* hide that
* takes the taskbar button, the Dock icon, the traffic lights and mouse input away - so a hotkey
* pressed on the home screen, on the account page or on the login form left the app apparently
* gone, with the same hotkey as the only way back. The button on the control bar was already
Expand Down
2 changes: 1 addition & 1 deletion src/main/store/config.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface RuntimeConfig {
hideTaskbarWhileRunning: boolean;

// Let screen capture see the main window. Off by default: content protection is on unless the
// user opts out here, and stealth mode protects the window whatever this says.
// user opts out here. This is the only input - stealth mode does not override it.
allowScreenCapture: boolean;
}

Expand Down
32 changes: 29 additions & 3 deletions src/renderer/components/custom/control-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useEndLiveSession } from '@/hooks/use-end-live-session';
import useIsStealthMode from '@/hooks/use-is-stealth-mode';
import { useLowBalanceWarning } from '@/hooks/use-low-balance-warning';
import { useSaveHistoryGuard } from '@/hooks/use-save-history-guard';
import { useScreenCaptureStatus } from '@/hooks/use-screen-capture-status';
import { useT } from '@/i18n';
import { isMac } from '@/lib/consts';
import { canStartSession } from '@/lib/credit-gate';
Expand All @@ -19,6 +20,8 @@ import { RunningState } from '@/types/app-state';

import HeadphoneNoticeDialog from '../headphone-notice-dialog';
import PermissionGateDialog from '../permission-gate-dialog';
import { ScreenCaptureBadge } from '../screen-capture-badge';
import ScreenCaptureNoticeDialog from '../screen-capture-notice-dialog';
import ZoomControl from '../zoom-control';
import { AudioGroup } from './audio-group';
import { LanguageGroup } from './language-group';
Expand All @@ -39,6 +42,8 @@ export default function ControlPanel() {
const { confirmDiscard } = useSaveHistoryGuard();
const [permGateOpen, setPermGateOpen] = useState(false);
const [headphoneNoticeOpen, setHeadphoneNoticeOpen] = useState(false);
const [captureNoticeOpen, setCaptureNoticeOpen] = useState(false);
const captureStatus = useScreenCaptureStatus();
const [returnHomePending, setReturnHomePending] = useState(false);

const { devices: audioInputDevices, ready: audioDevicesReady } = useAudioInputDevices();
Expand Down Expand Up @@ -225,8 +230,18 @@ export default function ControlPanel() {
if (returnHomePending && runningState === RunningState.Idle) navigate('/');
}, [returnHomePending, runningState, navigate]);

// Everything after the headphone notice. Split out so the notice can hand the start back once
// the user acknowledges it, without duplicating what follows.
// Second notice, after headphones: a screen share is the other thing that can go wrong
// silently, and it is decided by a setting the user may have turned on and forgotten.
const handleHeadphonesConfirmed = () => {
if (captureStatus === 'protected') {
void startAfterNotice();
return;
}
setCaptureNoticeOpen(true);
};

// Everything after the notices. Split out so they can hand the start back once the user
// acknowledges them, without duplicating what follows.
const startAfterNotice = async () => {
// `startAssistant` opens with `clearAll()`, so the previous interview is gone the moment
// this goes ahead. Asked before the permission gate rather than after: a user who is about
Expand Down Expand Up @@ -348,6 +363,7 @@ export default function ControlPanel() {
{/* Status, then view: whether the session can hear sits beside zoom at the right edge,
apart from the controls, because it is something to glance at rather than press. */}
<div className="ml-auto flex items-center gap-2">
{runningState === RunningState.Running && <ScreenCaptureBadge variant="bar" />}
<LiveSignal />
<ZoomControl />
</div>
Expand All @@ -356,10 +372,20 @@ export default function ControlPanel() {
<HeadphoneNoticeDialog
open={headphoneNoticeOpen}
onOpenChange={setHeadphoneNoticeOpen}
onProceed={() => void startAfterNotice()}
onProceed={handleHeadphonesConfirmed}
onCancel={handleStartCancelled}
/>

{captureStatus !== 'protected' && (
<ScreenCaptureNoticeDialog
open={captureNoticeOpen}
status={captureStatus}
onOpenChange={setCaptureNoticeOpen}
onProceed={() => void startAfterNotice()}
onCancel={handleStartCancelled}
/>
)}

{isMac && (
<PermissionGateDialog
open={permGateOpen}
Expand Down
71 changes: 71 additions & 0 deletions src/renderer/components/custom/screen-capture-badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { ScreenShare, ShieldAlert, ShieldCheck } from 'lucide-react';

import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { useScreenCaptureStatus } from '@/hooks/use-screen-capture-status';
import { useT } from '@/i18n';
import { cn } from '@/lib/utils';

interface ScreenCaptureBadgeProps {
/**
* `bar` is icon-only, because the control bar is already full at the 840px minimum width.
* `status` adds a label from 1000px up, sized for the stealth status panel's badge row. That row
* is already full at the 840px minimum in German and Russian, so below it the icon and the
* tooltip carry the state.
*/
variant: 'bar' | 'status';
className?: string;
}

/**
* Says whether a screen share or recording can see the window. All three states render, so the
* candidate can confirm protection at a glance rather than inferring it from an absent warning.
* `protected` is only reported where the OS honours it; macOS reads as `limited`.
*/
export function ScreenCaptureBadge({ variant, className }: ScreenCaptureBadgeProps) {
const t = useT();
const status = useScreenCaptureStatus();
const { label, hint, Icon, tone } = {
capturable: {
label: t.screenCapture.capturableLabel,
hint: t.screenCapture.capturableHint,
Icon: ScreenShare,
tone: 'border-destructive/40 bg-destructive/15 text-destructive',
},
limited: {
label: t.screenCapture.limitedLabel,
hint: t.screenCapture.limitedHint,
Icon: ShieldAlert,
tone: 'border-amber-500/40 bg-amber-500/15 text-amber-600 dark:text-amber-400',
},
protected: {
label: t.screenCapture.protectedLabel,
hint: t.screenCapture.protectedHint,
Icon: ShieldCheck,
tone: 'border-emerald-500/40 bg-emerald-500/15 text-emerald-600 dark:text-emerald-400',
},
}[status];

return (
<Tooltip>
<TooltipTrigger asChild>
<div
role="status"
aria-label={`${label}. ${hint}`}
className={cn(
'flex items-center gap-1 font-medium',
variant === 'bar' ? 'h-8 rounded-lg border px-2' : 'h-6 rounded px-2 text-xs',
tone,
className
)}
>
<Icon className="h-3.5 w-3.5 shrink-0" />
{variant === 'status' && <span className="hidden min-[1000px]:inline">{label}</span>}
</div>
</TooltipTrigger>
<TooltipContent sideOffset={4} className="max-w-xs">
<p>{label}</p>
<p className="text-xs text-muted-foreground">{hint}</p>
</TooltipContent>
</Tooltip>
);
}
Loading