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([issue-712]): five phone-native mobile quick-action flows

Adam Eivy956ebc891dac
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 7b6ca022e0..34d6077c57 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -6,6 +6,7 @@
- **[issue-711] "While You Were Away" dashboard card** — A new dashboard widget recaps what your agents did since your last visit: a count of completed runs, success/failure tally, total time worked, and the most recent wins plus anything that failed and needs a look. Each item opens the agents view, and a "Mark as seen" button resets the window to now. It appears on the Everything and Agent Watch layouts and can be added to any layout via Arrange.
- **[issue-708] Digital Twin "Appearance" tab — image identity source** — Upload a photo of yourself and a vision-capable provider extracts your visible appearance and self-presentation (apparent age range, build, hair, style, grooming, vibe, setting, expression). Review and edit the generated write-up, then save it as your "Appearance & Presentation" core identity document so the twin has a grounded sense of how you look. Use a local vision model (LM Studio / Ollama) to keep the photo on-device; the image itself is never persisted, only the derived text.
- **[issue-711] Per-domain autonomy guardrails** — The Chief of Staff config gains a "Domain Guardrails" panel that lets you set how much each domain acts on its own, independently: Brain auto-classify, Memory auto-extract, CoS auto-run, and Messages auto-send. Each is Off (never act automatically — leave it for you), Dry-run (do the thinking and surface what it would do, but don't commit the side effect), or Execute (act automatically — the default, so nothing changes unless you dial a domain back). Dry-run captures and classifies thoughts but holds them for your confirmation, routes extracted memories to pending approval instead of storing them live, lists the autonomous tasks it would have run without spawning them, and skips outbound message forwarding while logging what it would have sent.
+- **[issue-712] Quick Actions — five phone-native flows in two taps** — A new thumb-friendly "Quick Actions" hub puts five common tasks one tap apart on a phone: check system health and restart any app, capture a thought to your Brain by voice or text, ask "what should I do right now?", approve or reject results waiting on you, and log a drink or nicotine entry with a single preset tap. Each flow is its own bookmarkable link and reachable straight from the sidebar, the command palette, or by voice.
## Changed
diff --git a/client/src/App.jsx b/client/src/App.jsx
index 94f99c05d8..16152c65da 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -88,6 +88,7 @@ const PipelineSeriesRoadmap = lazyWithReload(() => import('./pages/PipelineSerie
const PipelineManuscriptEditor = lazyWithReload(() => import('./pages/PipelineManuscriptEditor'));
const PipelineIssue = lazyWithReload(() => import('./pages/PipelineIssue'));
const Login = lazyWithReload(() => import('./pages/Login'));
+const Mobile = lazyWithReload(() => import('./pages/Mobile'));
// Loading fallback for lazy-loaded pages
const PageLoader = () => (
@@ -164,6 +165,8 @@ export default function App() {
<Route path="/" element={<Layout />}>
<Route index element={<Dashboard />} />
<Route path="apps" element={<Apps />} />
+ <Route path="mobile" element={<Mobile />} />
+ <Route path="mobile/:flow" element={<Mobile />} />
<Route path="devtools" element={<Navigate to="/devtools/runs" replace />} />
<Route path="devtools/datadog" element={<DataDog />} />
<Route path="devtools/github" element={<GitHub />} />
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index ff215fda5d..f91508eb3c 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -46,6 +46,7 @@ import {
Network,
Flame,
Monitor,
+ Smartphone,
Cigarette,
Skull,
HeartPulse,
@@ -123,6 +124,7 @@ const navItems = [
{ to: '/', label: 'Dashboard', icon: Home, single: true },
{ to: '/review', label: 'Review Hub', icon: ClipboardList, single: true },
{ to: '/city', label: 'City', icon: Building2, single: true },
+ { to: '/mobile', label: 'Quick Actions', icon: Smartphone, single: true },
{ separator: true },
{ label: 'Apps', icon: Package, dynamic: 'apps', defaultTo: '/apps', children: [] },
{
@@ -1059,6 +1061,9 @@ export default function Layout() {
location.pathname.startsWith('/insights') ||
location.pathname.startsWith('/meatspace') ||
location.pathname.startsWith('/media') ||
+ // The mobile hub + flow views own their own max-w-lg scroll column.
+ location.pathname === '/mobile' ||
+ location.pathname.startsWith('/mobile/') ||
location.pathname.startsWith('/messages') ||
location.pathname.startsWith('/local-llm/') ||
location.pathname.startsWith('/pipeline/issues/') ||
diff --git a/client/src/components/mobile/MobileApproveFlow.jsx b/client/src/components/mobile/MobileApproveFlow.jsx
new file mode 100644
index 0000000000..4eb75eee77
--- /dev/null
+++ b/client/src/components/mobile/MobileApproveFlow.jsx
@@ -0,0 +1,86 @@
+import { useState } from 'react';
+import { Check, X, Inbox } from 'lucide-react';
+import * as api from '../../services/api';
+import toast from '../ui/Toast';
+import BrailleSpinner from '../BrailleSpinner';
+import { useAutoRefetch } from '../../hooks/useAutoRefetch';
+
+// Flow 4 — approve / reject a CoS result. Surfaces the same
+// awaiting-approval queue the desktop Tasks tab shows (internal tasks with
+// approvalRequired). Approve clears the flag; reject deletes the internal task.
+export default function MobileApproveFlow() {
+ const { data, loading, refetch } = useAutoRefetch(() => api.getCosTasks({ silent: true }), 20_000);
+ const [busyId, setBusyId] = useState(null);
+
+ // GET /api/cos/tasks returns { user, cos } — awaiting-approval lives on cos.
+ const awaiting = data?.cos?.awaitingApproval || [];
+
+ const approve = async (task) => {
+ setBusyId(task.id);
+ const result = await api.approveCosTask(task.id).catch((err) => {
+ toast.error(`Approve failed: ${err.message}`);
+ return null;
+ });
+ setBusyId(null);
+ if (!result || result.error) {
+ if (result?.error) toast.error(result.error);
+ return;
+ }
+ toast.success('Approved');
+ refetch();
+ };
+
+ const reject = async (task) => {
+ setBusyId(task.id);
+ const result = await api.deleteCosTask(task.id, 'internal').catch((err) => {
+ toast.error(`Reject failed: ${err.message}`);
+ return null;
+ });
+ setBusyId(null);
+ if (!result) return;
+ toast.success('Rejected');
+ refetch();
+ };
+
+ if (loading && !data) {
+ return <div className="flex justify-center py-12"><BrailleSpinner text="Loading approvals" /></div>;
+ }
+
+ if (awaiting.length === 0) {
+ return (
+ <div className="flex flex-col items-center gap-2 py-12 text-center text-gray-500">
+ <Inbox size={40} aria-hidden="true" />
+ <p className="text-base">Nothing awaiting approval.</p>
+ </div>
+ );
+ }
+
+ return (
+ <ul className="space-y-3">
+ {awaiting.map((task) => (
+ <li key={task.id} className="rounded-xl border border-port-warning/40 bg-port-card p-4">
+ <div className="mb-3 text-base font-medium text-white">{task.title || task.description || task.id}</div>
+ {task.description && task.title && (
+ <p className="mb-3 text-sm text-gray-400">{task.description}</p>
+ )}
+ <div className="flex gap-2">
+ <button
+ onClick={() => approve(task)}
+ disabled={busyId === task.id}
+ className="flex min-h-[48px] flex-1 items-center justify-center gap-2 rounded-lg bg-port-success/15 text-base font-semibold text-port-success disabled:opacity-50"
+ >
+ <Check size={18} aria-hidden="true" /> Approve
+ </button>
+ <button
+ onClick={() => reject(task)}
+ disabled={busyId === task.id}
+ className="flex min-h-[48px] flex-1 items-center justify-center gap-2 rounded-lg bg-port-error/15 text-base font-semibold text-port-error disabled:opacity-50"
+ >
+ <X size={18} aria-hidden="true" /> Reject
+ </button>
+ </div>
+ </li>
+ ))}
+ </ul>
+ );
+}
diff --git a/client/src/components/mobile/MobileAskFlow.jsx b/client/src/components/mobile/MobileAskFlow.jsx
new file mode 100644
index 0000000000..668040a774
--- /dev/null
+++ b/client/src/components/mobile/MobileAskFlow.jsx
@@ -0,0 +1,86 @@
+import { useState, useRef, useCallback } from 'react';
+import { Send, Sparkles } from 'lucide-react';
+import * as api from '../../services/api';
+import toast from '../ui/Toast';
+
+const NOW_PROMPT = 'What should I do right now?';
+
+// Flow 3 — "what should I do now?" Ask. Streams a single turn against
+// /api/ask in 'advise' mode. A one-tap suggestion chip fills the canonical
+// "what should I do now" question so the answer is reachable in two taps
+// (open flow → tap chip), or the user can type their own question.
+export default function MobileAskFlow() {
+ const [question, setQuestion] = useState('');
+ const [answer, setAnswer] = useState('');
+ const [streaming, setStreaming] = useState(false);
+ const controllerRef = useRef(null);
+
+ const ask = useCallback(async (q) => {
+ const trimmed = (q ?? question).trim();
+ if (!trimmed || streaming) return;
+ controllerRef.current?.abort();
+ const controller = new AbortController();
+ controllerRef.current = controller;
+ setAnswer('');
+ setStreaming(true);
+ const chunks = [];
+ await api.streamAskTurn(
+ { question: trimmed, mode: 'advise' },
+ {
+ signal: controller.signal,
+ onEvent: ({ event, data }) => {
+ if (controller.signal.aborted) return;
+ if (event === 'delta' && data.text) {
+ chunks.push(data.text);
+ setAnswer(chunks.join(''));
+ } else if (event === 'error') {
+ toast.error(data.error || 'Ask failed');
+ }
+ },
+ },
+ ).catch((err) => {
+ if (err.name !== 'AbortError') toast.error(err.message || 'Ask failed');
+ });
+ setStreaming(false);
+ }, [question, streaming]);
+
+ return (
+ <div className="space-y-4">
+ <button
+ onClick={() => { setQuestion(NOW_PROMPT); ask(NOW_PROMPT); }}
+ disabled={streaming}
+ className="flex w-full items-center justify-center gap-2 rounded-xl border border-port-accent/40 bg-port-accent/10 px-4 py-3 text-base font-semibold text-port-accent disabled:opacity-50"
+ >
+ <Sparkles size={18} aria-hidden="true" />
+ {NOW_PROMPT}
+ </button>
+
+ <form onSubmit={(e) => { e.preventDefault(); ask(); }} className="flex items-end gap-2">
+ <label htmlFor="mobile-ask" className="sr-only">Ask your digital twin</label>
+ <textarea
+ id="mobile-ask"
+ value={question}
+ onChange={(e) => setQuestion(e.target.value)}
+ rows={2}
+ placeholder="Ask anything…"
+ className="flex-1 resize-none rounded-xl border border-port-border bg-port-card p-3 text-base text-white placeholder-gray-600 focus:border-port-accent focus:outline-none"
+ />
+ <button
+ type="submit"
+ disabled={!question.trim() || streaming}
+ className="flex min-h-[52px] items-center justify-center rounded-xl bg-port-accent px-5 text-white disabled:opacity-40"
+ aria-label="Ask"
+ >
+ <Send size={18} aria-hidden="true" />
+ </button>
+ </form>
+
+ {(answer || streaming) && (
+ <div className="rounded-xl border border-port-border bg-port-card p-4 text-base leading-relaxed text-gray-200 whitespace-pre-wrap">
+ {answer || <span className="text-gray-500">Thinking…</span>}
+ {streaming && answer && <span className="ml-0.5 animate-pulse">▋</span>}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/client/src/components/mobile/MobileCaptureFlow.jsx b/client/src/components/mobile/MobileCaptureFlow.jsx
new file mode 100644
index 0000000000..799e366655
--- /dev/null
+++ b/client/src/components/mobile/MobileCaptureFlow.jsx
@@ -0,0 +1,62 @@
+import { useState, useCallback } from 'react';
+import { Send, Check } from 'lucide-react';
+import * as api from '../../services/api';
+import toast from '../ui/Toast';
+import VoiceCapture from '../brain/VoiceCapture';
+
+// Flow 2 — one-tap voice/text Brain capture. Text area + the existing
+// Web-Speech VoiceCapture button feeding /brain/capture. Optimized for a
+// single thumb: big input, big send button, instant clear after capture.
+export default function MobileCaptureFlow() {
+ const [text, setText] = useState('');
+ const [saving, setSaving] = useState(false);
+ const [justSaved, setJustSaved] = useState(false);
+
+ const onTranscript = useCallback((chunk) => {
+ setText((prev) => (prev ? `${prev} ${chunk}`.trim() : chunk));
+ }, []);
+
+ const submit = async () => {
+ const trimmed = text.trim();
+ if (!trimmed || saving) return;
+ setSaving(true);
+ const result = await api.captureBrainThought(trimmed).catch((err) => {
+ toast.error(`Capture failed: ${err.message}`);
+ return null;
+ });
+ setSaving(false);
+ if (!result) return;
+ setText('');
+ setJustSaved(true);
+ setTimeout(() => setJustSaved(false), 2000);
+ toast.success('Captured to Brain');
+ };
+
+ return (
+ <div className="space-y-4">
+ <label htmlFor="mobile-capture" className="block text-sm text-gray-400">
+ What&apos;s on your mind?
+ </label>
+ <textarea
+ id="mobile-capture"
+ value={text}
+ onChange={(e) => setText(e.target.value)}
+ rows={6}
+ placeholder="Type or tap the mic to speak…"
+ className="w-full resize-none rounded-xl border border-port-border bg-port-card p-3 text-base text-white placeholder-gray-600 focus:border-port-accent focus:outline-none"
+ autoFocus
+ />
+ <div className="flex items-center gap-3">
+ <VoiceCapture onTranscript={onTranscript} disabled={saving} />
+ <button
+ onClick={submit}
+ disabled={!text.trim() || saving}
+ className="flex min-h-[52px] flex-1 items-center justify-center gap-2 rounded-xl bg-port-accent text-base font-semibold text-white disabled:opacity-40"
+ >
+ {justSaved ? <Check size={20} aria-hidden="true" /> : <Send size={18} aria-hidden="true" />}
+ {justSaved ? 'Saved' : saving ? 'Saving…' : 'Capture'}
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/components/mobile/MobileHealthFlow.jsx b/client/src/components/mobile/MobileHealthFlow.jsx
new file mode 100644
index 0000000000..f375ea0a73
--- /dev/null
+++ b/client/src/components/mobile/MobileHealthFlow.jsx
@@ -0,0 +1,138 @@
+import { useState } from 'react';
+import { Activity, RotateCw, CheckCircle, AlertTriangle, XCircle } from 'lucide-react';
+import * as api from '../../services/api';
+import toast from '../ui/Toast';
+import BrailleSpinner from '../BrailleSpinner';
+import { useAutoRefetch } from '../../hooks/useAutoRefetch';
+import { formatBytes } from '../../utils/formatters';
+
+const HEALTH_STYLE = {
+ healthy: { color: 'text-port-success', Icon: CheckCircle, label: 'Healthy' },
+ warning: { color: 'text-port-warning', Icon: AlertTriangle, label: 'Warning' },
+ critical: { color: 'text-port-error', Icon: XCircle, label: 'Critical' },
+};
+
+function tone(pct, warn, critical) {
+ if (pct >= critical) return 'text-port-error';
+ if (pct >= warn) return 'text-port-warning';
+ return 'text-port-success';
+}
+
+// Flow 1 — system health + one-tap restart of an app. Reuses the same
+// /system/health/details + /apps endpoints the desktop pages use; nothing
+// here is mobile-specific on the server side.
+export default function MobileHealthFlow() {
+ const { data: health, loading } = useAutoRefetch(() => api.getSystemHealth({ silent: true }), 15_000);
+ const { data: apps, loading: appsLoading } = useAutoRefetch(() => api.getApps({ silent: true }), 30_000);
+ const [restartingId, setRestartingId] = useState(null);
+
+ const restart = async (app) => {
+ setRestartingId(app.id);
+ const result = await api.restartApp(app.id).catch((err) => {
+ toast.error(`Restart failed: ${err.message}`);
+ return null;
+ });
+ setRestartingId(null);
+ if (!result) return;
+ if (result.selfRestart) {
+ api.handleSelfRestart();
+ return;
+ }
+ toast.success(`Restarting ${app.name}`);
+ };
+
+ if (loading && !health) {
+ return <div className="flex justify-center py-12"><BrailleSpinner text="Loading health" /></div>;
+ }
+
+ const style = HEALTH_STYLE[health?.overallHealth] || HEALTH_STYLE.healthy;
+ const StatusIcon = style.Icon;
+ const mem = health?.system?.memory;
+ const disk = health?.system?.disk;
+ const cpu = health?.system?.cpu;
+ const thresholds = health?.thresholds || {};
+
+ // Only PM2-managed apps can be restarted; others (Xcode/native) have no runtime.
+ const restartable = (apps || []).filter((a) => a.overallStatus && a.overallStatus !== 'n/a');
+
+ return (
+ <div className="space-y-4">
+ <div className="flex items-center gap-3 rounded-xl border border-port-border bg-port-card p-4">
+ <StatusIcon size={32} className={style.color} aria-hidden="true" />
+ <div>
+ <div className={`text-lg font-bold ${style.color}`}>{style.label}</div>
+ <div className="text-xs text-gray-400">{health?.hostname} · up {health?.system?.uptimeFormatted}</div>
+ </div>
+ </div>
+
+ <div className="grid grid-cols-3 gap-2">
+ {mem && (
+ <Metric label="Memory" pct={mem.usagePercent} cls={tone(mem.usagePercent, thresholds.memoryWarn, thresholds.memoryCritical)}
+ detail={`${formatBytes(mem.used)} / ${formatBytes(mem.total)}`} />
+ )}
+ {cpu && (
+ <Metric label="CPU" pct={cpu.usagePercent} cls={tone(cpu.usagePercent, 80, 100)} detail={`${cpu.cores} cores`} />
+ )}
+ {disk && (
+ <Metric label="Disk" pct={disk.usagePercent} cls={tone(disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}
+ detail={`${formatBytes(disk.free)} free`} />
+ )}
+ </div>
+
+ {health?.warnings?.length > 0 && (
+ <ul className="space-y-1">
+ {health.warnings.map((w, i) => (
+ <li key={i} className="flex items-center gap-2 rounded-lg bg-port-warning/10 px-3 py-2 text-sm text-port-warning">
+ <AlertTriangle size={14} className="shrink-0" aria-hidden="true" />
+ <span>{w.message}</span>
+ </li>
+ ))}
+ </ul>
+ )}
+
+ <div>
+ <div className="mb-2 flex items-center gap-2 text-sm font-semibold text-gray-300">
+ <Activity size={16} aria-hidden="true" /> Apps
+ </div>
+ {appsLoading && !apps ? (
+ <div className="flex justify-center py-6"><BrailleSpinner text="Loading apps" /></div>
+ ) : restartable.length === 0 ? (
+ <p className="py-4 text-center text-sm text-gray-500">No restartable apps.</p>
+ ) : (
+ <ul className="space-y-2">
+ {restartable.map((app) => {
+ const online = app.overallStatus === 'online';
+ return (
+ <li key={app.id} className="flex items-center justify-between gap-3 rounded-xl border border-port-border bg-port-card p-3">
+ <div className="min-w-0">
+ <div className="truncate font-medium text-white">{app.name}</div>
+ <div className={`text-xs ${online ? 'text-port-success' : 'text-gray-500'}`}>{app.overallStatus}</div>
+ </div>
+ <button
+ onClick={() => restart(app)}
+ disabled={restartingId === app.id}
+ className="inline-flex min-h-[44px] items-center gap-1.5 rounded-lg bg-port-accent/15 px-4 text-sm font-medium text-port-accent disabled:opacity-50"
+ aria-label={`Restart ${app.name}`}
+ >
+ <RotateCw size={16} className={restartingId === app.id ? 'animate-spin' : ''} aria-hidden="true" />
+ Restart
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
+ </div>
+ );
+}
+
+function Metric({ label, pct, cls, detail }) {
+ return (
+ <div className="rounded-xl border border-port-border bg-port-card p-3 text-center">
+ <div className="text-[11px] uppercase tracking-wide text-gray-500">{label}</div>
+ <div className={`text-xl font-bold ${cls}`}>{pct}%</div>
+ <div className="truncate text-[10px] text-gray-500">{detail}</div>
+ </div>
+ );
+}
diff --git a/client/src/components/mobile/MobileLogFlow.jsx b/client/src/components/mobile/MobileLogFlow.jsx
new file mode 100644
index 0000000000..d4d5df08b8
--- /dev/null
+++ b/client/src/components/mobile/MobileLogFlow.jsx
@@ -0,0 +1,131 @@
+import { useState } from 'react';
+import { Wine, Cigarette, Check } from 'lucide-react';
+import * as api from '../../services/api';
+import toast from '../ui/Toast';
+import { useAutoRefetch } from '../../hooks/useAutoRefetch';
+
+// One-tap presets so the common case is a single tap (the ≤10-second goal).
+// These mirror standard servings; custom items still surface from the user's
+// saved presets below.
+const DRINK_PRESETS = [
+ { name: 'Beer', oz: 12, abv: 5 },
+ { name: 'Wine', oz: 5, abv: 12 },
+ { name: 'Shot', oz: 1.5, abv: 40 },
+];
+const NICOTINE_PRESETS = [
+ { product: 'Cigarette', mgPerUnit: 12 },
+ { product: 'Pouch', mgPerUnit: 6 },
+ { product: 'Vape', mgPerUnit: 3 },
+];
+
+// Flow 5 — log a health/lifestyle event in ≤10 seconds. Tap a preset → it
+// POSTs immediately to /meatspace/{alcohol,nicotine}/log. Reuses the user's
+// saved custom drinks/products as extra one-tap buttons.
+export default function MobileLogFlow() {
+ const [tab, setTab] = useState('alcohol');
+ const [busy, setBusy] = useState(null);
+ const [lastLogged, setLastLogged] = useState(null);
+
+ // Custom presets change rarely — poll slowly just to pick up edits made elsewhere.
+ const { data: customDrinks } = useAutoRefetch(() => api.getCustomDrinks({ silent: true }), 300_000);
+ const { data: customNicotine } = useAutoRefetch(() => api.getCustomNicotineProducts({ silent: true }), 300_000);
+
+ const logDrink = async (drink) => {
+ const key = `${drink.name}-${drink.oz}-${drink.abv}`;
+ setBusy(key);
+ const result = await api.logAlcoholDrink({ name: drink.name, oz: drink.oz, abv: drink.abv }).catch((err) => {
+ toast.error(`Log failed: ${err.message}`);
+ return null;
+ });
+ setBusy(null);
+ if (!result) return;
+ flash(`${drink.name} logged`);
+ };
+
+ const logNic = async (product) => {
+ const key = `${product.product}-${product.mgPerUnit}`;
+ setBusy(key);
+ const result = await api.logNicotine({ product: product.product, mgPerUnit: product.mgPerUnit }).catch((err) => {
+ toast.error(`Log failed: ${err.message}`);
+ return null;
+ });
+ setBusy(null);
+ if (!result) return;
+ flash(`${product.product} logged`);
+ };
+
+ const flash = (msg) => {
+ setLastLogged(msg);
+ toast.success(msg);
+ setTimeout(() => setLastLogged(null), 2500);
+ };
+
+ const drinkButtons = [...DRINK_PRESETS, ...(Array.isArray(customDrinks) ? customDrinks : [])];
+ const nicButtons = [...NICOTINE_PRESETS, ...(Array.isArray(customNicotine)
+ ? customNicotine.map((p) => ({ product: p.name, mgPerUnit: p.mgPerUnit }))
+ : [])];
+
+ return (
+ <div className="space-y-4">
+ <div className="grid grid-cols-2 gap-2 rounded-xl bg-port-card p-1">
+ <TabBtn active={tab === 'alcohol'} onClick={() => setTab('alcohol')} Icon={Wine} label="Alcohol" />
+ <TabBtn active={tab === 'nicotine'} onClick={() => setTab('nicotine')} Icon={Cigarette} label="Nicotine" />
+ </div>
+
+ {lastLogged && (
+ <div className="flex items-center justify-center gap-2 rounded-lg bg-port-success/10 py-2 text-sm text-port-success">
+ <Check size={16} aria-hidden="true" /> {lastLogged}
+ </div>
+ )}
+
+ {tab === 'alcohol' ? (
+ <div className="grid grid-cols-2 gap-3">
+ {drinkButtons.map((d, i) => {
+ const key = `${d.name}-${d.oz}-${d.abv}`;
+ return (
+ <button
+ key={`${key}-${i}`}
+ onClick={() => logDrink(d)}
+ disabled={busy === key}
+ className="flex min-h-[72px] flex-col items-center justify-center rounded-xl border border-port-border bg-port-card disabled:opacity-50"
+ >
+ <span className="text-base font-semibold text-white">{d.name}</span>
+ <span className="text-xs text-gray-500">{d.oz}oz · {d.abv}%</span>
+ </button>
+ );
+ })}
+ </div>
+ ) : (
+ <div className="grid grid-cols-2 gap-3">
+ {nicButtons.map((p, i) => {
+ const key = `${p.product}-${p.mgPerUnit}`;
+ return (
+ <button
+ key={`${key}-${i}`}
+ onClick={() => logNic(p)}
+ disabled={busy === key}
+ className="flex min-h-[72px] flex-col items-center justify-center rounded-xl border border-port-border bg-port-card disabled:opacity-50"
+ >
+ <span className="text-base font-semibold text-white">{p.product}</span>
+ <span className="text-xs text-gray-500">{p.mgPerUnit}mg</span>
+ </button>
+ );
+ })}
+ </div>
+ )}
+ </div>
+ );
+}
+
+function TabBtn({ active, onClick, Icon, label }) {
+ return (
+ <button
+ onClick={onClick}
+ className={`flex min-h-[44px] items-center justify-center gap-2 rounded-lg text-sm font-medium transition-colors ${
+ active ? 'bg-port-accent text-white' : 'text-gray-400'
+ }`}
+ >
+ <Icon size={16} aria-hidden="true" /> {label}
+ </button>
+ );
+}
diff --git a/client/src/components/mobile/flows.js b/client/src/components/mobile/flows.js
new file mode 100644
index 0000000000..556e441840
--- /dev/null
+++ b/client/src/components/mobile/flows.js
@@ -0,0 +1,14 @@
+// Shared definition of the five phone-native flows. Single source of truth so
+// the hub tiles, the route dispatcher, and the nav manifest stay aligned.
+// Each entry: { slug, label, sub, icon, accent }. `slug` is the /mobile/:flow
+// route segment; `icon` is a lucide component name resolved by the consumer.
+
+export const MOBILE_FLOWS = [
+ { slug: 'health', label: 'Health & Restart', sub: 'System status, one-tap restart' },
+ { slug: 'capture', label: 'Capture', sub: 'Drop a thought into your Brain' },
+ { slug: 'ask', label: 'Ask', sub: 'What should I do now?' },
+ { slug: 'approve', label: 'Approve', sub: 'Review CoS results' },
+ { slug: 'log', label: 'Quick Log', sub: 'Log a drink or nicotine in seconds' },
+];
+
+export const MOBILE_FLOW_SLUGS = MOBILE_FLOWS.map((f) => f.slug);
diff --git a/client/src/pages/Mobile.jsx b/client/src/pages/Mobile.jsx
new file mode 100644
index 0000000000..d5b62b2d7a
--- /dev/null
+++ b/client/src/pages/Mobile.jsx
@@ -0,0 +1,81 @@
+import { useParams, Navigate, Link } from 'react-router-dom';
+import { Activity, MessageSquarePlus, Sparkles, CheckSquare, ClipboardList, ChevronLeft, Smartphone } from 'lucide-react';
+import { MOBILE_FLOWS } from '../components/mobile/flows';
+import MobileHealthFlow from '../components/mobile/MobileHealthFlow';
+import MobileCaptureFlow from '../components/mobile/MobileCaptureFlow';
+import MobileAskFlow from '../components/mobile/MobileAskFlow';
+import MobileApproveFlow from '../components/mobile/MobileApproveFlow';
+import MobileLogFlow from '../components/mobile/MobileLogFlow';
+
+// Icon + view component per flow slug. Kept here (not in flows.js) so the
+// shared flow definition stays free of React/JSX imports for the nav manifest
+// and tests that consume it.
+const FLOW_UI = {
+ health: { Icon: Activity, View: MobileHealthFlow },
+ capture: { Icon: MessageSquarePlus, View: MobileCaptureFlow },
+ ask: { Icon: Sparkles, View: MobileAskFlow },
+ approve: { Icon: CheckSquare, View: MobileApproveFlow },
+ log: { Icon: ClipboardList, View: MobileLogFlow },
+};
+
+// Phone-native quick-actions hub. `/mobile` shows the five tiles; each flow
+// is its own deep-linkable route `/mobile/:flow` (≤2 taps to any action, and
+// every flow is bookmarkable / shareable). All five flows reuse existing
+// PortOS APIs — this page is a thumb-friendly surface, not new backend logic.
+export default function Mobile() {
+ const { flow } = useParams();
+
+ if (flow) {
+ const entry = MOBILE_FLOWS.find((f) => f.slug === flow);
+ const ui = FLOW_UI[flow];
+ if (!entry || !ui) {
+ return <Navigate to="/mobile" replace />;
+ }
+ const { View, Icon } = ui;
+ return (
+ <div className="mx-auto h-full max-w-lg overflow-y-auto p-4">
+ <div className="mb-4 flex items-center gap-2">
+ <Link
+ to="/mobile"
+ className="inline-flex min-h-[44px] min-w-[44px] items-center justify-center -ml-2 rounded-lg text-gray-400 hover:text-white"
+ aria-label="Back to mobile hub"
+ >
+ <ChevronLeft size={22} aria-hidden="true" />
+ </Link>
+ <Icon size={20} className="text-port-accent" aria-hidden="true" />
+ <h1 className="text-lg font-bold text-white">{entry.label}</h1>
+ </div>
+ <View />
+ </div>
+ );
+ }
+
+ return (
+ <div className="mx-auto h-full max-w-lg overflow-y-auto p-4">
+ <div className="mb-4 flex items-center gap-2">
+ <Smartphone size={22} className="text-port-accent" aria-hidden="true" />
+ <h1 className="text-xl font-bold text-white">Quick Actions</h1>
+ </div>
+ <div className="grid grid-cols-1 gap-3">
+ {MOBILE_FLOWS.map((f) => {
+ const Icon = FLOW_UI[f.slug]?.Icon || Smartphone;
+ return (
+ <Link
+ key={f.slug}
+ to={`/mobile/${f.slug}`}
+ className="flex items-center gap-4 rounded-2xl border border-port-border bg-port-card p-4 active:bg-port-border/40"
+ >
+ <span className="flex h-12 w-12 shrink-0 items-center justify-center rounded-xl bg-port-accent/15 text-port-accent">
+ <Icon size={24} aria-hidden="true" />
+ </span>
+ <span className="min-w-0">
+ <span className="block text-base font-semibold text-white">{f.label}</span>
+ <span className="block truncate text-sm text-gray-500">{f.sub}</span>
+ </span>
+ </Link>
+ );
+ })}
+ </div>
+ </div>
+ );
+}
diff --git a/client/src/pages/Mobile.test.jsx b/client/src/pages/Mobile.test.jsx
new file mode 100644
index 0000000000..7191f50954
--- /dev/null
+++ b/client/src/pages/Mobile.test.jsx
@@ -0,0 +1,107 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import { MemoryRouter, Routes, Route } from 'react-router-dom';
+
+// All five flows reuse the shared API barrel. Stub the functions each flow
+// touches so the hub + flow dispatch can be exercised without a server.
+vi.mock('../services/api', () => ({
+ getSystemHealth: vi.fn().mockResolvedValue({
+ overallHealth: 'healthy',
+ hostname: 'void',
+ system: {
+ uptimeFormatted: '2h 3m',
+ memory: { used: 8e9, total: 16e9, usagePercent: 50 },
+ cpu: { cores: 8, usagePercent: 20 },
+ disk: { free: 5e11, usagePercent: 40 },
+ },
+ thresholds: {},
+ warnings: [],
+ }),
+ getApps: vi.fn().mockResolvedValue([
+ { id: 'app1', name: 'BookLoom', overallStatus: 'online' },
+ { id: 'native', name: 'iOSApp', overallStatus: 'n/a' },
+ ]),
+ restartApp: vi.fn().mockResolvedValue({ ok: true }),
+ handleSelfRestart: vi.fn(),
+ captureBrainThought: vi.fn().mockResolvedValue({ id: 'log1' }),
+ streamAskTurn: vi.fn().mockResolvedValue(undefined),
+ getCosTasks: vi.fn().mockResolvedValue({ cos: { awaitingApproval: [] } }),
+ approveCosTask: vi.fn().mockResolvedValue({ id: 't1' }),
+ deleteCosTask: vi.fn().mockResolvedValue({ ok: true }),
+ logAlcoholDrink: vi.fn().mockResolvedValue({ ok: true }),
+ logNicotine: vi.fn().mockResolvedValue({ ok: true }),
+ getCustomDrinks: vi.fn().mockResolvedValue([]),
+ getCustomNicotineProducts: vi.fn().mockResolvedValue([]),
+}));
+
+vi.mock('../components/ui/Toast', () => ({
+ default: { success: vi.fn(), error: vi.fn(), loading: vi.fn() },
+}));
+
+// VoiceCapture uses Web Speech; stub to a no-op button.
+vi.mock('../components/brain/VoiceCapture', () => ({
+ default: () => <button type="button">mic</button>,
+}));
+
+import Mobile from './Mobile';
+import * as api from '../services/api';
+import { MOBILE_FLOWS } from '../components/mobile/flows';
+
+function renderAt(path) {
+ return render(
+ <MemoryRouter initialEntries={[path]}>
+ <Routes>
+ <Route path="/mobile" element={<Mobile />} />
+ <Route path="/mobile/:flow" element={<Mobile />} />
+ </Routes>
+ </MemoryRouter>,
+ );
+}
+
+beforeEach(() => vi.clearAllMocks());
+
+describe('Mobile hub', () => {
+ it('renders a tile for every flow', () => {
+ renderAt('/mobile');
+ expect(screen.getByText('Quick Actions')).toBeTruthy();
+ for (const f of MOBILE_FLOWS) {
+ expect(screen.getByText(f.label)).toBeTruthy();
+ }
+ });
+
+ it('links each tile to its deep-linkable flow route', () => {
+ renderAt('/mobile');
+ const link = screen.getByText('Capture').closest('a');
+ expect(link.getAttribute('href')).toBe('/mobile/capture');
+ });
+});
+
+describe('Mobile flow dispatch', () => {
+ it('renders the log flow with one-tap presets and posts on tap', async () => {
+ renderAt('/mobile/log');
+ const beerBtn = await screen.findByText('Beer');
+ fireEvent.click(beerBtn.closest('button'));
+ await waitFor(() => {
+ expect(api.logAlcoholDrink).toHaveBeenCalledWith({ name: 'Beer', oz: 12, abv: 5 });
+ });
+ });
+
+ it('renders the approve flow empty state when nothing awaits approval', async () => {
+ renderAt('/mobile/approve');
+ expect(await screen.findByText(/Nothing awaiting approval/i)).toBeTruthy();
+ });
+
+ it('renders the health flow with a restart button for managed apps only', async () => {
+ renderAt('/mobile/health');
+ expect(await screen.findByText('BookLoom')).toBeTruthy();
+ // n/a (native) app is filtered out of the restartable list.
+ expect(screen.queryByText('iOSApp')).toBeNull();
+ fireEvent.click(screen.getByLabelText('Restart BookLoom'));
+ await waitFor(() => expect(api.restartApp).toHaveBeenCalledWith('app1'));
+ });
+
+ it('redirects an unknown flow slug back to the hub', () => {
+ renderAt('/mobile/bogus');
+ expect(screen.getByText('Quick Actions')).toBeTruthy();
+ });
+});
diff --git a/client/src/services/apiMeatspace.js b/client/src/services/apiMeatspace.js
index ac3c6770f7..18b51d70b9 100644
--- a/client/src/services/apiMeatspace.js
+++ b/client/src/services/apiMeatspace.js
@@ -86,7 +86,7 @@ export const updateAlcoholDrink = (date, index, data) => request(`/meatspace/alc
export const removeAlcoholDrink = (date, index) => request(`/meatspace/alcohol/log/${date}/${index}`, {
method: 'DELETE'
});
-export const getCustomDrinks = () => request('/meatspace/alcohol/custom-drinks');
+export const getCustomDrinks = (options) => request('/meatspace/alcohol/custom-drinks', options);
export const addCustomDrink = (data) => request('/meatspace/alcohol/custom-drinks', {
method: 'POST',
body: JSON.stringify(data)
@@ -116,7 +116,7 @@ export const updateNicotineEntry = (date, index, data) => request(`/meatspace/ni
export const removeNicotineEntry = (date, index) => request(`/meatspace/nicotine/log/${date}/${index}`, {
method: 'DELETE'
});
-export const getCustomNicotineProducts = () => request('/meatspace/nicotine/custom-products');
+export const getCustomNicotineProducts = (options) => request('/meatspace/nicotine/custom-products', options);
export const addCustomNicotineProduct = (data) => request('/meatspace/nicotine/custom-products', {
method: 'POST',
body: JSON.stringify(data)
diff --git a/server/lib/navManifest.js b/server/lib/navManifest.js
index a4793b4f21..be89be3f09 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -9,6 +9,7 @@ export const NAV_COMMANDS = [
{ id: 'nav.cybercity', path: '/city', label: 'City', section: 'Main', aliases: ['city', 'cybercity'], keywords: ['3d', 'visualization', 'cybercity'] },
{ id: 'nav.cybercity.settings', path: '/city/settings', label: 'City Settings', section: 'Main', aliases: ['city settings', 'cybercity settings', 'city-settings', 'cybercity-config'], keywords: ['cybercity', 'settings', '3d', 'configure'] },
{ id: 'nav.apps', path: '/apps', label: 'Apps', section: 'Main', aliases: ['apps'] },
+ { id: 'nav.mobile', path: '/mobile', label: 'Quick Actions', section: 'Main', aliases: ['mobile', 'quick-actions', 'quick'], keywords: ['phone', 'mobile', 'thumb', 'on the go', 'capture', 'log', 'approve', 'restart', 'ask', 'quick actions'] },
{ id: 'nav.catalog', path: '/catalog', label: 'Catalog', section: 'Create', aliases: ['catalog', 'ingredients', 'cast', 'creative-catalog'], keywords: ['character', 'place', 'object', 'idea', 'scene', 'concept', 'inventory', 'reference', 'creative'] },
{ id: 'nav.catalog.ingest', path: '/catalog/ingest', label: 'Catalog Ingest', section: 'Create', aliases: ['catalog-ingest', 'ingest', 'paste-scrap', 'extract-ingredients'], keywords: ['paste', 'snippet', 'scene', 'idea', 'extract', 'scrap', 'import-catalog'] },