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

address review (round 5): split errors, preserve error codes, gate-doc fix, slug length

Adam Eivy252a9e053a61
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index a868a36554..b525ba0e01 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -11,7 +11,7 @@
Files: `server/lib/navManifest.js` (new), `server/routes/palette.js` (new), `server/services/voice/tools.js` (refactored), `server/index.js` (mounts `/api/palette`), `client/src/services/apiPalette.js` (new), `client/src/components/CmdKSearch.jsx` (palette behavior), `client/src/components/KeyboardHelp.jsx` (updated copy). Tests: `server/lib/navManifest.test.js`, `server/routes/palette.test.js`.
-- **Customizable Dashboard with Saved Layouts** — the Dashboard is no longer a static hardcoded widget list. A widget registry (`client/src/components/dashboard/widgetRegistry.jsx`) describes each tile (`{ id, label, Component, width, gate? }`) and the Dashboard renders the active layout's ordered widget list over a 12-column grid. Four built-in layouts ship: **Everything** (the original), **Focus** (quick-task + cos + upcoming), **Morning Review** (alerts + upcoming + review-hub + goals + death-clock), **Ops** (system-health + cos + backup + apps + quick-stats). New layouts can be created via the layout picker → "Edit layouts…" → Save as new. Widgets can be added/removed per layout, reordered with ↑/↓ buttons (keyboard- and touch-accessible), and gated so data-dependent widgets (apps grid, streak, hourly activity) auto-hide when there's nothing to show. Persisted to `data/dashboard-layouts.json` via `GET/PUT/DELETE /api/dashboard/layouts`; built-in layouts are protected from deletion. Inline-state delete/duplicate confirmations — no `window.confirm`/`prompt`.
+- **Customizable Dashboard with Saved Layouts** — the Dashboard is no longer a static hardcoded widget list. A widget registry (`client/src/components/dashboard/widgetRegistry.jsx`) describes each tile (`{ id, label, Component, width, gate? }`) and the Dashboard renders the active layout's ordered widget list over a 12-column grid. Four built-in layouts ship: **Everything** (the original), **Focus** (quick-task + cos + upcoming), **Morning Review** (alerts + upcoming + review-hub + goals + death-clock), **Ops** (system-health + cos + backup + apps + quick-stats). New layouts can be created via the layout picker → "Edit layouts…" → Save as new. Widgets can be added/removed per layout, reordered with ↑/↓ buttons (keyboard- and touch-accessible), and gated so data-dependent widgets (streak, hourly activity, quick stats) auto-hide when there's nothing to show. The Apps tile is intentionally un-gated — it renders its own "Add App" empty-state CTA on a blank install. Persisted to `data/dashboard-layouts.json` via `GET/PUT/DELETE /api/dashboard/layouts`; built-in layouts are protected from deletion. Inline-state delete/duplicate confirmations — no `window.confirm`/`prompt`.
**Palette integration**: `⌘K` synthesizes one command per layout ("Dashboard: Focus", "Dashboard: Ops", etc.) so users can switch layouts from anywhere with a keystroke. Layouts re-fetch on every palette open so newly-created or renamed layouts show up without a page remount.
diff --git a/client/src/components/dashboard/LayoutEditor.jsx b/client/src/components/dashboard/LayoutEditor.jsx
index 99a2a65297..f266d11696 100644
--- a/client/src/components/dashboard/LayoutEditor.jsx
+++ b/client/src/components/dashboard/LayoutEditor.jsx
@@ -81,7 +81,9 @@ export default function LayoutEditor({ layouts, activeLayoutId, onClose, onSave,
const commitDuplicate = async () => {
const trimmed = dupName.trim();
if (!trimmed) { toast.error('Name required'); return; }
- const baseId = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
+ // Server-side idSchema caps ids at 60 chars; reserve 4 for a `-NN` suffix
+ // so collision-dedup can't push the final id past the limit.
+ const baseId = trimmed.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 56);
if (!baseId) { toast.error('Use letters/numbers in the name'); return; }
const existingIds = new Set(layouts.map((l) => l.id));
let id = baseId;
diff --git a/client/src/components/dashboard/widgetRegistry.jsx b/client/src/components/dashboard/widgetRegistry.jsx
index 91b072c6fb..138b33e91c 100644
--- a/client/src/components/dashboard/widgetRegistry.jsx
+++ b/client/src/components/dashboard/widgetRegistry.jsx
@@ -15,7 +15,9 @@ import ActivityStreakWidget from './builtins/ActivityStreakWidget';
import HourlyActivityWidget from './builtins/HourlyActivityWidget';
// Each entry: { id, label, Component, width, gate? }. `gate(state) => bool`
-// skips the widget when it has nothing useful to show (e.g. no apps).
+// skips the widget when it has nothing useful to show. The Apps tile is
+// intentionally un-gated — it renders its own empty-state CTA so the "add
+// your first app" path is always visible on a blank install.
export const WIDGETS = [
{ id: 'quick-brain', label: 'Quick Brain Capture', Component: QuickBrainCapture, width: 'half' },
{ id: 'quick-task', label: 'Quick Task', Component: QuickTaskWidget, width: 'half' },
diff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsx
index 772120efa6..5bbe722134 100644
--- a/client/src/pages/Dashboard.jsx
+++ b/client/src/pages/Dashboard.jsx
@@ -14,16 +14,17 @@ export default function Dashboard() {
const [health, setHealth] = useState(null);
const [usage, setUsage] = useState(null);
const [loading, setLoading] = useState(true);
- const [error, setError] = useState(null);
+ const [dataError, setDataError] = useState(null);
+ const [layoutsError, setLayoutsError] = useState(null);
const [layouts, setLayouts] = useState([]);
const [activeLayoutId, setActiveLayoutId] = useState(null);
const [editorOpen, setEditorOpen] = useState(false);
const fetchData = useCallback(async () => {
- setError(null);
+ setDataError(null);
const [appsData, healthData, usageData] = await Promise.all([
- api.getApps().catch((err) => { setError(err.message); return []; }),
+ api.getApps().catch((err) => { setDataError(err.message); return []; }),
api.checkHealth().catch(() => null),
api.getUsage().catch(() => null),
]);
@@ -45,8 +46,9 @@ export default function Dashboard() {
.then((data) => {
setLayouts(data.layouts);
setActiveLayoutId(data.activeLayoutId);
+ setLayoutsError(null);
})
- .catch((err) => setError(`Layouts: ${err.message}`));
+ .catch((err) => setLayoutsError(err.message));
fetchLayouts();
@@ -164,9 +166,14 @@ export default function Dashboard() {
</div>
</div>
- {error && (
+ {dataError && (
<div className="p-4 bg-port-error/20 border border-port-error rounded-lg text-port-error">
- {error}
+ {dataError}
+ </div>
+ )}
+ {layoutsError && (
+ <div className="p-4 bg-port-error/20 border border-port-error rounded-lg text-port-error">
+ Layouts: {layoutsError}
</div>
)}
diff --git a/server/routes/dashboardLayouts.js b/server/routes/dashboardLayouts.js
index 619713eaf6..46f617191e 100644
--- a/server/routes/dashboardLayouts.js
+++ b/server/routes/dashboardLayouts.js
@@ -40,7 +40,7 @@ const SERVICE_ERROR_STATUS = {
const mapServiceError = (err) => {
const status = SERVICE_ERROR_STATUS[err?.code];
- if (status) return new ServerError(err.message, { status });
+ if (status) return new ServerError(err.message, { status, code: err.code });
return err;
};