Skip to content
Merged
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ the MCP core behind it (up to 0.20 also the ChatGPT Site it published). It follo
[Keep a Changelog](https://keepachangelog.com). Each `## [X.Y.Z]` section becomes the notes of the
GitHub release vX.Y.Z.

## [Unreleased]

### Added

- **Claude voice button.** A second voice button, off until **Claude voice in Paseo** is turned on: one
tap brings the Claude desktop app forward and presses its voice mode button through Accessibility,
opening a new chat first when Claude is elsewhere. It finds the button by several signals, not only
its label, in English, Russian and Ukrainian. On a phone it opens a new Claude chat. See
docs/claude-voice-button.md.
- **Each voice button's name and places on the screen.** Under **Voice buttons**, once a button is on:
its name (the label, Command Center title and slash command) and where it shows (workspace header,
every chat, sidebar, Command Center, slash command).

## [1.1.1] - 2026-11-17

### Fixed
Expand Down
190 changes: 167 additions & 23 deletions client/voice-button-section.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,185 @@
// The voice button, reduced to one switch: on, Paseo shows a button that opens ChatGPT's own voice
// chat. Everything else keeps its default: ChatGPT's own shortcut on a Mac, and on an iPhone the
// Apple Shortcut named after the button.
// The voice buttons' settings: for each one a switch, and once it is on a summary row that opens its name
// and where it shows.
// ChatGPT's button opens ChatGPT's own voice chat (its own shortcut on a Mac, on an iPhone the Apple
// Shortcut named after the button); Claude's presses Claude's voice mode button through Accessibility
// on a Mac and opens a new Claude chat on a phone.
import type { PluginTheme } from "@getpaseo/plugin";
import { useRpc } from "@getpaseo/plugin/client";
import { SettingsCard, SettingsRow, SettingsSection, SettingsSwitch } from "@getpaseo/plugin/client/ui";
import { SettingsAction, SettingsCard, SettingsInput, SettingsRow, SettingsSection, SettingsSwitch } from "@getpaseo/plugin/client/ui";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { defaultVoiceButtonSettings, getVoiceButtonRpc, setVoiceButtonRpc } from "../shared/voice-button.ts";
import { publishVoiceButton } from "./voice-button.tsx";
import { useEffect, useRef, useState } from "react";
import { type ClaudeVoiceSettings, claudeVoiceStatusRpc, getClaudeVoiceRpc, setClaudeVoiceRpc } from "../shared/claude-voice.ts";
import { type VoiceButtonSettings, getVoiceButtonRpc, setVoiceButtonRpc } from "../shared/voice-button.ts";
import { publishClaudeVoice, publishVoiceButton, voiceSlashFor } from "./voice-button.tsx";

const SETTINGS_KEY = ["god-mode", "voice-button"];
const errorText = (error: unknown) => String((error as Error)?.message ?? error);

export function VoiceButtonStep(_props: { theme: PluginTheme }) {
type Placement = keyof VoiceButtonSettings["placements"];
type ButtonSettings = VoiceButtonSettings | ClaudeVoiceSettings;

const PLACEMENTS: { key: Placement; label: string; hint: string }[] = [
{ key: "header", label: "Workspace header", hint: "A button at the top of every workspace." },
{ key: "chats", label: "Every chat", hint: "A pill above the message box of every chat." },
{ key: "sidebar", label: "Sidebar", hint: "A row at the bottom of the sidebar." },
{ key: "commandCenter", label: "Command Center", hint: "An item in Command Center." },
{ key: "slashCommand", label: "Slash command", hint: "A command typed in a chat." },
];

/** A name a button can take: what the schema allows, so the input never saves one the daemon refuses. */
const nameProblem = (name: string) => (!name.trim() ? "Give the button a name." : name.trim().length > 24 ? "At most 24 characters." : null);

function VoiceButtonCard<S extends ButtonSettings>(props: {
title: string;
hint: string;
settings: S | undefined;
loadError: unknown;
save: (settings: S) => void;
saving: boolean;
saveError: unknown;
slashFor: (name: string) => string;
placeholder: string;
warning?: string | null;
}) {
const { settings } = props;
const [name, setName] = useState<string | null>(null);
const [open, setOpen] = useState(false);
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
// The name is saved after a pause; by then a switch may have changed, so it merges into the latest.
const latest = useRef(settings);
latest.current = settings;
useEffect(() => () => void (timer.current && clearTimeout(timer.current)), []);

const change = (patch: Partial<S>) => {
if (latest.current) props.save({ ...latest.current, ...patch });
};
// Saved half a second after the last key, so the buttons are not renamed letter by letter.
const typeName = (text: string) => {
setName(text);
if (timer.current) clearTimeout(timer.current);
if (nameProblem(text)) return;
timer.current = setTimeout(() => change({ name: text.trim() } as Partial<S>), 500);
};
const shownName = name ?? settings?.name ?? "";
const slash = props.slashFor(shownName);

return (
<SettingsCard>
<SettingsSwitch
label={props.title}
hint={props.hint}
value={settings?.enabled ?? false}
disabled={!settings || props.saving}
onValueChange={(enabled) => change({ enabled } as Partial<S>)}
error={props.loadError ? errorText(props.loadError) : props.saveError ? errorText(props.saveError) : null}
/>
{!settings && !props.loadError ? <SettingsRow label="Loading…" /> : null}
{props.warning ? <SettingsRow label="Needs attention" error={props.warning} /> : null}
{settings?.enabled ? (
<SettingsAction
label={shownName.trim() || settings.name}
hint={PLACEMENTS.filter((p) => settings.placements[p.key]).map((p) => (p.key === "slashCommand" ? `/${slash}` : p.label)).join(", ") || "Shown nowhere"}
actionLabel={open ? "Done" : "Edit"}
onPress={() => setOpen(!open)}
/>
) : null}
{settings?.enabled && open ? (
<>
<SettingsInput
label="Name"
hint="On the button and in Command Center; one plain word is also its slash command."
initialValue={settings.name}
placeholder={props.placeholder}
onChangeText={typeName}
error={name === null ? null : nameProblem(name)}
/>
{PLACEMENTS.map((p) => (
<SettingsSwitch
key={p.key}
label={p.key === "slashCommand" ? `Slash command /${slash}` : p.label}
hint={p.hint}
value={settings.placements[p.key]}
disabled={props.saving}
onValueChange={(value) => change({ placements: { ...settings.placements, [p.key]: value } } as Partial<S>)}
/>
))}
</>
) : null}
</SettingsCard>
);
}

const CHATGPT_KEY = ["god-mode", "voice-button"];
const CLAUDE_KEY = ["god-mode", "claude-voice"];
const CLAUDE_STATUS_KEY = ["god-mode", "claude-voice", "status"];

function ChatGptVoiceCard() {
const get = useRpc(getVoiceButtonRpc);
const set = useRpc(setVoiceButtonRpc);
const queryClient = useQueryClient();
const loaded = useQuery({ queryKey: SETTINGS_KEY, queryFn: () => get({}) });
const loaded = useQuery({ queryKey: CHATGPT_KEY, queryFn: () => get({}) });
const save = useMutation({
mutationFn: (enabled: boolean) => set({ settings: { ...(loaded.data?.settings ?? defaultVoiceButtonSettings()), enabled } }),
mutationFn: (settings: VoiceButtonSettings) => set({ settings }),
onSuccess: ({ settings }) => {
publishVoiceButton(settings);
void queryClient.invalidateQueries({ queryKey: SETTINGS_KEY });
queryClient.setQueryData(CHATGPT_KEY, { settings });
},
});
return (
<SettingsSection title="Voice button">
<SettingsCard>
<SettingsSwitch
label="ChatGPT voice in Paseo"
hint="A button in Paseo that opens ChatGPT's voice chat."
value={loaded.data?.settings.enabled ?? false}
disabled={!loaded.data || save.isPending}
onValueChange={(value) => save.mutate(value)}
error={loaded.isError ? errorText(loaded.error) : save.isError ? errorText(save.error) : null}
/>
{loaded.isPending ? <SettingsRow label="Loading…" /> : null}
</SettingsCard>
<VoiceButtonCard
title="ChatGPT voice in Paseo"
hint="A button in Paseo that opens ChatGPT's voice chat. On an iPhone it runs the Apple Shortcut named after the button."
settings={loaded.data?.settings}
loadError={loaded.isError ? loaded.error : null}
save={(settings) => save.mutate(settings)}
saving={save.isPending}
saveError={save.isError ? save.error : null}
slashFor={voiceSlashFor.chatgpt}
placeholder="Jarvis"
/>
);
}

function ClaudeVoiceCard() {
const get = useRpc(getClaudeVoiceRpc);
const set = useRpc(setClaudeVoiceRpc);
const status = useRpc(claudeVoiceStatusRpc);
const queryClient = useQueryClient();
const loaded = useQuery({ queryKey: CLAUDE_KEY, queryFn: () => get({}) });
const mac = useQuery({ queryKey: CLAUDE_STATUS_KEY, queryFn: () => status({}), enabled: loaded.data?.settings.enabled === true });
const save = useMutation({
mutationFn: (settings: ClaudeVoiceSettings) => set({ settings }),
onSuccess: ({ settings }) => {
publishClaudeVoice(settings);
queryClient.setQueryData(CLAUDE_KEY, { settings });
},
});
const warning =
mac.data?.platform === "darwin" && !mac.data.claude
? "The Claude app is not in Applications."
: mac.data?.accessibilityTrusted === false
? "Allow Paseo in System Settings → Privacy & Security → Accessibility, or you tap Claude's voice button yourself."
: null;
return (
<VoiceButtonCard
title="Claude voice in Paseo"
hint="A button in Paseo that starts Claude's voice mode in the Claude app."
settings={loaded.data?.settings}
loadError={loaded.isError ? loaded.error : null}
save={(settings) => save.mutate(settings)}
saving={save.isPending}
saveError={save.isError ? save.error : null}
slashFor={voiceSlashFor.claude}
placeholder="Claude"
warning={warning}
/>
);
}

export function VoiceButtonStep(_props: { theme: PluginTheme }) {
return (
<SettingsSection title="Voice buttons">
<ChatGptVoiceCard />
<ClaudeVoiceCard />
</SettingsSection>
);
}
Loading
Loading