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

Revert "Merge pull request #916 from atomantic/claim/issue-712"

Adam Eivyaa5794ea5eff
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 34d6077c57..7b6ca022e0 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -6,7 +6,6 @@
- **[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 16152c65da..94f99c05d8 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -88,7 +88,6 @@ 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 = () => (
@@ -165,8 +164,6 @@ 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 f91508eb3c..ff215fda5d 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -46,7 +46,6 @@ import {
Network,
Flame,
Monitor,
- Smartphone,
Cigarette,
Skull,
HeartPulse,
@@ -124,7 +123,6 @@ 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: [] },
{
@@ -1061,9 +1059,6 @@ 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
deleted file mode 100644
index 0b42974709..0000000000
--- a/client/src/components/mobile/MobileApproveFlow.jsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { useState } from 'react';
-import { Check, X, Inbox, AlertTriangle } 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);
-
- const approve = async (task) => {
- setBusyId(task.id);
- // silent: this flow owns the error toast in the catch below.
- const result = await api.approveCosTask(task.id, { silent: true }).catch((err) => {
- toast.error(`Approve failed: ${err.message}`);
- return null;
- });
- setBusyId(null);
- if (!result) return; // approve rejects on failure → handled by the catch above
- toast.success('Approved');
- refetch();
- };
-
- const reject = async (task) => {
- setBusyId(task.id);
- // silent: this flow owns the error toast in the catch below.
- const result = await api.deleteCosTask(task.id, 'internal', { silent: true }).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>;
- }
-
- // useAutoRefetch preserves the last good snapshot on error, so a null `data`
- // after the initial load means the fetch never succeeded — distinguish that
- // from a genuinely-empty queue so a failed fetch doesn't read as "all clear".
- if (!data) {
- return (
- <div className="flex flex-col items-center gap-2 py-12 text-center text-gray-500">
- <AlertTriangle size={40} aria-hidden="true" />
- <p className="text-base">Approvals are unavailable right now.</p>
- </div>
- );
- }
-
- // GET /api/cos/tasks returns { user, cos } — awaiting-approval lives on cos.
- const awaiting = data.cos?.awaitingApproval || [];
-
- 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
deleted file mode 100644
index fc270b8156..0000000000
--- a/client/src/components/mobile/MobileAskFlow.jsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { useState, useRef, useCallback, useEffect } 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 mountedRef = useRef(true);
-
- // Abort any in-flight stream when the flow unmounts (back to hub / nav away).
- useEffect(() => () => { mountedRef.current = false; controllerRef.current?.abort(); }, []);
-
- 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');
- });
- // Skip the state write if the flow unmounted mid-stream.
- if (mountedRef.current) 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
deleted file mode 100644
index fc264c95e5..0000000000
--- a/client/src/components/mobile/MobileCaptureFlow.jsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import { useState, useCallback, useRef, useEffect } 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 savedTimerRef = useRef(null);
-
- useEffect(() => () => clearTimeout(savedTimerRef.current), []);
-
- const onTranscript = useCallback((chunk) => {
- setText((prev) => (prev ? `${prev} ${chunk}`.trim() : chunk));
- }, []);
-
- const submit = async () => {
- const trimmed = text.trim();
- if (!trimmed || saving) return;
- setSaving(true);
- // silent: this flow owns the error toast in the catch below.
- const result = await api.captureBrainThought(trimmed, undefined, undefined, { silent: true }).catch((err) => {
- toast.error(`Capture failed: ${err.message}`);
- return null;
- });
- setSaving(false);
- if (!result) return;
- setText('');
- setJustSaved(true);
- clearTimeout(savedTimerRef.current);
- savedTimerRef.current = 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
deleted file mode 100644
index c81e304d33..0000000000
--- a/client/src/components/mobile/MobileHealthFlow.jsx
+++ /dev/null
@@ -1,154 +0,0 @@
-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' },
- unknown: { color: 'text-gray-400', Icon: AlertTriangle, label: 'Unknown' },
-};
-
-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);
- // silent: this flow owns the error toast in the catch below.
- const result = await api.restartApp(app.id, { silent: true }).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>;
- }
-
- // useAutoRefetch preserves the last good snapshot on error, so a null `health`
- // after the initial load means the fetch has never succeeded — show an
- // explicit unavailable state rather than a misleading "Healthy".
- if (!health) {
- return (
- <div className="flex flex-col items-center gap-2 py-12 text-center text-gray-500">
- <AlertTriangle size={32} aria-hidden="true" />
- <p className="text-base">System health is unavailable right now.</p>
- </div>
- );
- }
-
- // Unrecognized overallHealth falls to a neutral "unknown" style, never "healthy".
- const style = HEALTH_STYLE[health.overallHealth] || HEALTH_STYLE.unknown;
- const StatusIcon = style.Icon;
- const mem = health?.system?.memory;
- const disk = health?.system?.disk;
- const cpu = health?.system?.cpu;
- const thresholds = health?.thresholds || {};
-
- // Only active, PM2-managed apps can be restarted; archived apps and
- // others (Xcode/native, overallStatus 'n/a') have no restartable runtime.
- const restartable = (apps || []).filter((a) => !a.archived && 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
deleted file mode 100644
index f48067a845..0000000000
--- a/client/src/components/mobile/MobileLogFlow.jsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { useState, useRef, useEffect } 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);
- const flashTimerRef = useRef(null);
-
- useEffect(() => () => clearTimeout(flashTimerRef.current), []);
-
- // 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);
-
- // busyKey uniquely identifies the tapped button (value signature + index) so
- // two presets with identical values don't disable together during one tap.
- const logDrink = async (drink, busyKey) => {
- setBusy(busyKey);
- // silent: this flow owns the error toast in the catch below.
- const result = await api.logAlcoholDrink({ name: drink.name, oz: drink.oz, abv: drink.abv }, { silent: true }).catch((err) => {
- toast.error(`Log failed: ${err.message}`);
- return null;
- });
- setBusy(null);
- if (!result) return;
- flash(`${drink.name} logged`);
- };
-
- const logNic = async (product, busyKey) => {
- setBusy(busyKey);
- // silent: this flow owns the error toast in the catch below.
- const result = await api.logNicotine({ product: product.product, mgPerUnit: product.mgPerUnit }, { silent: true }).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);
- clearTimeout(flashTimerRef.current);
- flashTimerRef.current = setTimeout(() => setLastLogged(null), 2500);
- };
-
- // Normalize both kinds into one button shape { key, label, detail, onTap }
- // so a single grid renders either tab.
- const buttons = tab === 'alcohol'
- ? [...DRINK_PRESETS, ...(Array.isArray(customDrinks) ? customDrinks : [])].map((d, i) => {
- const key = `${d.name}-${d.oz}-${d.abv}-${i}`;
- return { key, label: d.name, detail: `${d.oz}oz · ${d.abv}%`, onTap: () => logDrink(d, key) };
- })
- : [...NICOTINE_PRESETS, ...(Array.isArray(customNicotine)
- ? customNicotine.map((p) => ({ product: p.name, mgPerUnit: p.mgPerUnit }))
- : [])].map((p, i) => {
- const key = `${p.product}-${p.mgPerUnit}-${i}`;
- return { key, label: p.product, detail: `${p.mgPerUnit}mg`, onTap: () => logNic(p, key) };
- });
-
- 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>
- )}
-
- <div className="grid grid-cols-2 gap-3">
- {buttons.map((b) => (
- <button
- key={b.key}
- onClick={b.onTap}
- disabled={busy === b.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">{b.label}</span>
- <span className="text-xs text-gray-500">{b.detail}</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
deleted file mode 100644
index 556e441840..0000000000
--- a/client/src/components/mobile/flows.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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
deleted file mode 100644
index d5b62b2d7a..0000000000
--- a/client/src/pages/Mobile.jsx
+++ /dev/null
@@ -1,81 +0,0 @@
-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
deleted file mode 100644
index d6670fe8a9..0000000000
--- a/client/src/pages/Mobile.test.jsx
+++ /dev/null
@@ -1,125 +0,0 @@
-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' },
- { id: 'old', name: 'OldApp', overallStatus: 'stopped', archived: true },
- ]),
- 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 silently on tap', async () => {
- renderAt('/mobile/log');
- const beerBtn = await screen.findByText('Beer');
- fireEvent.click(beerBtn.closest('button'));
- await waitFor(() => {
- // Flow owns its own error toast, so the API call must be silent.
- expect(api.logAlcoholDrink).toHaveBeenCalledWith({ name: 'Beer', oz: 12, abv: 5 }, { silent: true });
- });
- });
-
- 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, non-archived apps only', async () => {
- renderAt('/mobile/health');
- expect(await screen.findByText('BookLoom')).toBeTruthy();
- // n/a (native) and archived apps are filtered out of the restartable list.
- expect(screen.queryByText('iOSApp')).toBeNull();
- expect(screen.queryByText('OldApp')).toBeNull();
- fireEvent.click(screen.getByLabelText('Restart BookLoom'));
- await waitFor(() => expect(api.restartApp).toHaveBeenCalledWith('app1', { silent: true }));
- });
-
- it('redirects an unknown flow slug back to the hub', () => {
- renderAt('/mobile/bogus');
- expect(screen.getByText('Quick Actions')).toBeTruthy();
- });
-
- it('shows an explicit unavailable state when health never loads (not a false "Healthy")', async () => {
- // useAutoRefetch keeps data null when the fetch rejects.
- api.getSystemHealth.mockRejectedValueOnce(new Error('boom'));
- renderAt('/mobile/health');
- expect(await screen.findByText(/System health is unavailable/i)).toBeTruthy();
- expect(screen.queryByText('Healthy')).toBeNull();
- });
-
- it('shows an unavailable state for approvals when the queue fetch fails (not "Nothing awaiting")', async () => {
- api.getCosTasks.mockRejectedValueOnce(new Error('boom'));
- renderAt('/mobile/approve');
- expect(await screen.findByText(/Approvals are unavailable/i)).toBeTruthy();
- expect(screen.queryByText(/Nothing awaiting approval/i)).toBeNull();
- });
-});
diff --git a/client/src/services/apiAgents.js b/client/src/services/apiAgents.js
index 5df3856c49..f3f72cb3d0 100644
--- a/client/src/services/apiAgents.js
+++ b/client/src/services/apiAgents.js
@@ -67,12 +67,12 @@ export const updateCosTask = (id, updates) => request(`/cos/tasks/${id}`, {
method: 'PUT',
body: JSON.stringify(updates)
});
-export const deleteCosTask = (id, taskType = 'user', options) => request(`/cos/tasks/${id}?type=${taskType}`, { method: 'DELETE', ...options });
+export const deleteCosTask = (id, taskType = 'user') => request(`/cos/tasks/${id}?type=${taskType}`, { method: 'DELETE' });
export const reorderCosTasks = (taskIds) => request('/cos/tasks/reorder', {
method: 'POST',
body: JSON.stringify({ taskIds })
});
-export const approveCosTask = (id, options) => request(`/cos/tasks/${id}/approve`, { method: 'POST', ...options });
+export const approveCosTask = (id) => request(`/cos/tasks/${id}/approve`, { method: 'POST' });
export const forceCosEvaluate = () => request('/cos/evaluate', { method: 'POST' });
export const forceSpawnTask = (taskId) => request(`/cos/tasks/${taskId}/spawn`, { method: 'POST' });
export const getCosHealth = () => request('/cos/health');
diff --git a/client/src/services/apiApps.js b/client/src/services/apiApps.js
index edd17ea04c..8994d79531 100644
--- a/client/src/services/apiApps.js
+++ b/client/src/services/apiApps.js
@@ -17,7 +17,7 @@ export const deleteApp = (id) => request(`/apps/${id}`, { method: 'DELETE' });
// App actions
export const startApp = (id) => request(`/apps/${id}/start`, { method: 'POST' });
export const stopApp = (id) => request(`/apps/${id}/stop`, { method: 'POST' });
-export const restartApp = (id, options) => request(`/apps/${id}/restart`, { method: 'POST', ...options });
+export const restartApp = (id) => request(`/apps/${id}/restart`, { method: 'POST' });
export const upgradeAppTls = (id, body) => request(`/apps/${id}/upgrade-tls`, {
method: 'POST',
body: JSON.stringify(body),
diff --git a/client/src/services/apiBrain.js b/client/src/services/apiBrain.js
index 238223cb43..ddc5b0e67f 100644
--- a/client/src/services/apiBrain.js
+++ b/client/src/services/apiBrain.js
@@ -9,10 +9,9 @@ export const updateBrainSettings = (settings) => request('/brain/settings', {
});
// Brain - Capture & Inbox
-export const captureBrainThought = (text, providerOverride, modelOverride, options) => request('/brain/capture', {
+export const captureBrainThought = (text, providerOverride, modelOverride) => request('/brain/capture', {
method: 'POST',
- body: JSON.stringify({ text, providerOverride, modelOverride }),
- ...options
+ body: JSON.stringify({ text, providerOverride, modelOverride })
});
export const getBrainInbox = (options = {}) => {
const params = new URLSearchParams();
diff --git a/client/src/services/apiMeatspace.js b/client/src/services/apiMeatspace.js
index a20ed9609f..ac3c6770f7 100644
--- a/client/src/services/apiMeatspace.js
+++ b/client/src/services/apiMeatspace.js
@@ -75,10 +75,9 @@ export const getDailyAlcohol = (from, to) => {
if (to) params.set('to', to);
return request(`/meatspace/alcohol/daily?${params}`);
};
-export const logAlcoholDrink = (data, options) => request('/meatspace/alcohol/log', {
+export const logAlcoholDrink = (data) => request('/meatspace/alcohol/log', {
method: 'POST',
- body: JSON.stringify(data),
- ...options
+ body: JSON.stringify(data)
});
export const updateAlcoholDrink = (date, index, data) => request(`/meatspace/alcohol/log/${date}/${index}`, {
method: 'PUT',
@@ -87,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 = (options) => request('/meatspace/alcohol/custom-drinks', options);
+export const getCustomDrinks = () => request('/meatspace/alcohol/custom-drinks');
export const addCustomDrink = (data) => request('/meatspace/alcohol/custom-drinks', {
method: 'POST',
body: JSON.stringify(data)
@@ -106,10 +105,9 @@ export const getDailyNicotine = (from, to) => {
if (to) params.set('to', to);
return request(`/meatspace/nicotine/daily?${params}`);
};
-export const logNicotine = (data, options) => request('/meatspace/nicotine/log', {
+export const logNicotine = (data) => request('/meatspace/nicotine/log', {
method: 'POST',
- body: JSON.stringify(data),
- ...options
+ body: JSON.stringify(data)
});
export const updateNicotineEntry = (date, index, data) => request(`/meatspace/nicotine/log/${date}/${index}`, {
method: 'PUT',
@@ -118,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 = (options) => request('/meatspace/nicotine/custom-products', options);
+export const getCustomNicotineProducts = () => request('/meatspace/nicotine/custom-products');
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 be89be3f09..a4793b4f21 100644
--- a/server/lib/navManifest.js
+++ b/server/lib/navManifest.js
@@ -9,7 +9,6 @@ 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'] },