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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ GitHub release vX.Y.Z.

### Added

- **Linux server.** God Mode runs on a Linux Paseo daemon: Address → Connect finds a packaged or
Linuxbrew `cloudflared`, or downloads Cloudflare's Linux build (amd64, arm64, arm, 386) instead of
the macOS archive, which could not run there. The sign-in link opens on the device you pressed the
button on, so a server without a desktop needs nothing more. The voice buttons stay Mac and iPhone only.
- **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
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ your phone, your car or a walk, while your Mac does the work.
[![Licence](https://img.shields.io/github/license/devXpro/paseo-god-mode-plugin?style=flat-square&color=111111&labelColor=111111&label=licence)](LICENSE)
[![Status](https://img.shields.io/badge/status-building%20in%20public-ffb020?style=flat-square&labelColor=111111)](#status)

🎙️ **Voice or chat, in Claude or ChatGPT** · 🧠 **Every agent, every project** · 🧩 **Your Paseo plugins too** · 🔘 **Three buttons, no terminal** · 🔐 **Your own tunnel and sign-in** · ⚡ **Straight to Paseo on your Mac or Windows**
🎙️ **Voice or chat, in Claude or ChatGPT** · 🧠 **Every agent, every project** · 🧩 **Your Paseo plugins too** · 🔘 **Three buttons, no terminal** · 🔐 **Your own tunnel and sign-in** · ⚡ **Straight to Paseo on your Mac, Windows or Linux server**

</div>

Expand All @@ -36,7 +36,8 @@ The same works in ChatGPT, typed or in its voice mode.
## Quick start

You need:
- a Mac running **Paseo 0.15.4** or newer, awake and online while you use God Mode;
- a Mac, a Windows PC or a Linux server running **Paseo 0.15.4** or newer, awake and online while you
use God Mode (on Linux everything but the voice buttons);
- a domain in your own **Cloudflare** account (the free plan is enough): God Mode puts its address
there, for example `gm.example.com`;
- **Claude** (custom connectors; voice mode in the phone app), **ChatGPT** Plus or Pro (custom MCP
Expand Down
20 changes: 15 additions & 5 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ button on its screen does, what it needs, and what God Mode keeps on the Mac.

## What you need

- A Mac running **Paseo 0.15.4** or newer with plugins on. The Mac has to be awake and online while
Claude or ChatGPT uses God Mode.
- A Mac, a Windows PC or a Linux server running **Paseo 0.15.4** or newer with plugins on. It has to
be awake and online while Claude or ChatGPT uses God Mode. On a Linux server everything but the voice
buttons works: the address, Claude and ChatGPT, and every tool; see [Linux server](#linux-server).
- A domain in your own **Cloudflare** account. The free plan is enough; Cloudflare Registrar sells
domains at cost. Keep that account to yourself and protect it with two-factor sign-in: whoever can
edit its DNS or tunnels controls the address (see [security](security.md#the-tunnel-and-cloudflare)).
Expand All @@ -20,9 +21,10 @@ button on its screen does, what it needs, and what God Mode keeps on the Mac.

**Address → Connect** on God Mode's screen:

1. God Mode looks for `cloudflared` (Homebrew's, or its own copy in `~/.paseo/god-mode/bin/`). If it
is missing, it installs it with `brew install cloudflared`, or without Homebrew (and always on
Windows) downloads Cloudflare's release build.
1. God Mode looks for `cloudflared` (Homebrew's, on Linux also a package's in `/usr/local/bin` or
`/usr/bin`, or its own copy in `~/.paseo/god-mode/bin/`). If it is missing, it installs it with
`brew install cloudflared`, or without Homebrew (and always on Windows) downloads Cloudflare's
release build for the system: `cloudflared-linux-amd64` or `-arm64` on Linux.
2. Cloudflare's sign-in page opens on the device where you pressed the button. Sign in, pick the
domain, press **Authorize**. The link is good for about ten minutes; press Connect again for a new one.
3. God Mode creates a tunnel named `god-mode`, points `gm.<your domain>` at it, deletes the sign-in
Expand Down Expand Up @@ -62,6 +64,14 @@ ChatGPT's voice mode uses the plugins of your account, God Mode included.
connected again with a new code. Removing the connector in Claude or ChatGPT does not sign it out on
the Mac; use Disconnect for that.

## Linux server

God Mode runs the same on a Linux server with the Paseo daemon, for example a VPS kept apart from your
own computer. Nothing opens a browser on the server: press **Address → Connect** in Paseo on your Mac
or phone, and Cloudflare's sign-in link opens there. God Mode downloads `cloudflared` into its data
directory unless one is already installed (a `.deb`/`.rpm` from Cloudflare, or Linuxbrew). The voice
buttons need a Mac or an iPhone, so on a Linux daemon they report that they are not supported.

## What God Mode keeps on the Mac

Everything is in `~/.paseo/god-mode/` (under `PASEO_HOME` if Paseo uses another home), readable only by
Expand Down
18 changes: 17 additions & 1 deletion server/tunnel/cloudflared.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import { configText, routedHostname } from "./cloudflared.ts";
import { cloudflaredPaths, configText, releaseAsset, routedHostname } from "./cloudflared.ts";

test("each system downloads its own cloudflared build, packed only on macOS", () => {
assert.deepEqual(releaseAsset("darwin", "arm64"), { name: "cloudflared-darwin-arm64.tgz", packed: true });
assert.deepEqual(releaseAsset("darwin", "x64"), { name: "cloudflared-darwin-amd64.tgz", packed: true });
assert.deepEqual(releaseAsset("win32", "arm64"), { name: "cloudflared-windows-amd64.exe", packed: false });
assert.deepEqual(releaseAsset("linux", "x64"), { name: "cloudflared-linux-amd64", packed: false });
assert.deepEqual(releaseAsset("linux", "arm64"), { name: "cloudflared-linux-arm64", packed: false });
assert.deepEqual(releaseAsset("linux", "arm"), { name: "cloudflared-linux-arm", packed: false });
assert.throws(() => releaseAsset("linux", "riscv64"), /no cloudflared build for Linux on riscv64/);
});

test("Linux finds a packaged or Linuxbrew cloudflared before downloading one; macOS looks where it did", () => {
const own = "/home/me/.paseo/god-mode/bin/cloudflared";
assert.deepEqual(cloudflaredPaths("linux", own), ["/usr/local/bin/cloudflared", "/usr/bin/cloudflared", "/home/linuxbrew/.linuxbrew/bin/cloudflared", own]);
assert.deepEqual(cloudflaredPaths("darwin", own), ["/opt/homebrew/bin/cloudflared", "/usr/local/bin/cloudflared", own]);
});

test("the hostname comes out of what `tunnel route dns` says, new or already there", () => {
assert.equal(routedHostname("2026-11-16T13:24:33Z INF Added CNAME gm.devxpro.net which will route to this tunnel tunnelID=5f54"), "gm.devxpro.net");
Expand Down
42 changes: 34 additions & 8 deletions server/tunnel/cloudflared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export interface TunnelStatus {

const LOGIN_WAIT_MS = 10 * 60_000;
const WINDOWS = process.platform === "win32";
const BREW = ["/opt/homebrew/bin/brew", "/usr/local/bin/brew"];
const LINUXBREW = "/home/linuxbrew/.linuxbrew/bin";
const BREW = ["/opt/homebrew/bin/brew", "/usr/local/bin/brew", `${LINUXBREW}/brew`];
const tunnelDir = () => join(dataDir(), "tunnel");
const recordFile = () => join(dataDir(), "tunnel.json");
const configFile = () => join(tunnelDir(), "config.yml");
Expand All @@ -44,27 +45,51 @@ const pidFile = () => join(tunnelDir(), "cloudflared.pid");
const originCert = () => join(homedir(), ".cloudflared", "cert.pem");
const ownBinary = () => join(dataDir(), "bin", WINDOWS ? "cloudflared.exe" : "cloudflared");

/** Where cloudflared is: Homebrew's, or the copy God Mode downloaded. */
/** Where cloudflared may be, in order: Homebrew's, a Linux package's, then the copy God Mode downloaded. */
export function cloudflaredPaths(platform: NodeJS.Platform, own: string): string[] {
if (platform === "linux") return ["/usr/local/bin/cloudflared", "/usr/bin/cloudflared", `${LINUXBREW}/cloudflared`, own];
return ["/opt/homebrew/bin/cloudflared", "/usr/local/bin/cloudflared", own];
}

/** Where cloudflared is: Homebrew's, a Linux package's, or the copy God Mode downloaded. */
export function findCloudflared(): string | null {
return ["/opt/homebrew/bin/cloudflared", "/usr/local/bin/cloudflared", ownBinary()].find((path) => existsSync(path)) ?? null;
return cloudflaredPaths(process.platform, ownBinary()).find((path) => existsSync(path)) ?? null;
}

/** Cloudflare's release build for this system, and whether it comes packed in a .tgz. Windows has no
* arm64 build, and the amd64 one runs under emulation; Linux and Windows builds are the binary itself. */
export function releaseAsset(platform: NodeJS.Platform, cpu: string): { name: string; packed: boolean } {
if (platform === "win32") return { name: "cloudflared-windows-amd64.exe", packed: false };
if (platform === "linux") {
const builds: Record<string, string> = { x64: "amd64", arm64: "arm64", arm: "arm", ia32: "386" };
const build = builds[cpu];
if (!build) throw new Error(`Cloudflare has no cloudflared build for Linux on ${cpu}. Install cloudflared yourself, then press Connect again.`);
return { name: `cloudflared-linux-${build}`, packed: false };
}
return { name: `cloudflared-darwin-${cpu === "arm64" ? "arm64" : "amd64"}.tgz`, packed: true };
}

/** `ps` is in /bin on macOS and on most Linux systems, and only in /usr/bin on some. */
const psBinary = () => ["/bin/ps", "/usr/bin/ps"].find((path) => existsSync(path)) ?? "/bin/ps";

async function install(): Promise<string> {
const brew = BREW.find((path) => existsSync(path));
if (brew) {
const result = await run(brew, ["install", "cloudflared"], { timeoutMs: 10 * 60_000 });
if (!result.ok) throw new Error(`brew install cloudflared failed:\n${tail(result)}`);
} else {
// Without Homebrew: Cloudflare's own release build, in God Mode's data directory. On Windows it is
// the .exe itself; there is no arm64 build, and the amd64 one runs under emulation.
const asset = WINDOWS ? "cloudflared-windows-amd64.exe" : `cloudflared-darwin-${arch() === "arm64" ? "arm64" : "amd64"}.tgz`;
// Without Homebrew: Cloudflare's own release build, in God Mode's data directory.
const { name: asset, packed } = releaseAsset(process.platform, arch());
const response = await fetch(`https://github.com/cloudflare/cloudflared/releases/latest/download/${asset}`);
if (!response.ok) throw new Error(`Downloading ${asset} failed: HTTP ${response.status}`);
const dir = join(dataDir(), "bin");
await mkdir(dir, { recursive: true, mode: 0o700 });
const body = Buffer.from(await response.arrayBuffer());
if (WINDOWS) {
await writeFile(ownBinary(), body);
} else if (!packed) {
await writeFile(ownBinary(), body, { mode: 0o755 });
await chmod(ownBinary(), 0o755);
} else {
const archive = join(dir, asset);
await writeFile(archive, body, { mode: 0o600 });
Expand Down Expand Up @@ -166,7 +191,8 @@ export class Tunnel {
private signIn(binary: string): Promise<{ loginUrl: string; done: Promise<void> }> {
return new Promise((resolveLink, rejectLink) => {
// A PATH without /usr/bin keeps cloudflared from opening a browser here: the link goes to the
// device the user pressed the button on. Windows ignores the case of variable names: Node keeps
// device the user pressed the button on (on Linux it keeps xdg-open out of reach the same way, so a
// server without a desktop just prints the link). Windows ignores the case of variable names: Node keeps
// this PATH and drops the inherited Path, so cloudflared does not find cmd to open one either.
const login = spawn(binary, ["tunnel", "login"], { env: { ...process.env, PATH: "/opt/homebrew/bin" }, stdio: ["ignore", "pipe", "pipe"] });
this.login = login;
Expand Down Expand Up @@ -270,7 +296,7 @@ export class Tunnel {
private async stopStray(): Promise<void> {
const pid = Number((await readFile(pidFile(), "utf8").catch(() => "")).trim());
if (!pid) return;
const command = await run("/bin/ps", ["-o", "command=", "-p", String(pid)]);
const command = await run(psBinary(), ["-o", "command=", "-p", String(pid)]);
if (command.ok && command.stdout.includes("cloudflared") && command.stdout.includes(configFile())) {
try {
process.kill(pid);
Expand Down
Loading