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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat(voice): add feeds_mark_read tool to pair with feeds_digest
Adam Eivy6abcfc68b2eb
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5a07d8d064..1a5f6a5fc4 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,6 +2,7 @@## Added+- **Voice agent: `feeds_mark_read` tool.** Pairs with the existing `feeds_digest` so the user can say "mark that one read" / "mark them all read" / "mark all of Hacker News as read" without leaving the conversation. Two ways to call: `query` fuzzy-matches a single unread item by title (exact → substring → all-tokens fallback) using titles the LLM just spoke from `feeds_digest`; `all: true` marks every unread item read, optionally scoped to one feed via `feedQuery` (fuzzy-matched against feed title). The `feeds` intent regex was loosened to also match phrasings like "mark that one read" / "mark them all as read" / "headlines" so the tool is offered to the LLM on the right turns; the bare word "read" alone is intentionally NOT a feeds trigger (it collides with "read my log"). 11 new tests in `server/services/voice/tools.test.js` cover ok/error paths, feed scoping, fuzzy matching, and the new regex behavior. Files: `server/services/voice/tools.js`, `server/services/voice/tools.test.js`.- **Reimagined theme system — four named themes with full design tokens.** Replaced the five ad-hoc color-only themes (Midnight, Phosphor, Ember, Arctic, Synthwave) with a structured manifest of four themes that each carry a complete design system, not just a color palette: **Classic Midnight** (the existing baseline, kept stable), **Lumen Glass** (translucent glass panes with backdrop-blur), **Black ICE Terminal** (dense cyberpunk terminal with scanlines and monospace UI), and **Blueprint Ops** (drafting-grid systems-map aesthetic). Each theme manifest declares colors (`--port-bg`, `--port-card`, etc), per-channel "on-X" foreground colors for accessible contrast on accent/success/warning/error pills, and a tokens block covering radii, font stacks (UI/display/mono), motion durations, shadow variants, backdrop-filter, body gradient/texture, control surfaces, hover/active states, terminal styling, and chart colors. A new runtime layer in `client/src/index.css` keys off `html[data-port-theme="<id>"]` so theme switches restyle the entire UI in one paint — including transitions on inputs/buttons, toaster border/shadow tokens (`client/src/main.jsx`), per-theme card backgrounds, sidebar treatments, and theme-specific flourishes (Black ICE scanline overlay, Blueprint Ops grid-pattern card backgrounds + heading rules, Lumen Glass focus glows). The theme picker has two surfaces: a redesigned dropdown in the bottom-bar `ThemeSwitcher` (portal-rendered, viewport-clamped, rAF-throttled scroll/resize repositioning, with family icons + accent swatch) and a new card-grid `ThemePickerPanel` in Settings → General that shows each theme's concept, density, four-color swatch row, and an active-state check. Legacy theme ids stored in `localStorage` or server settings are normalized via `LEGACY_THEME_ALIASES` (`midnight` → `classic-midnight`, `phosphor`/`synthwave` → `black-ice-terminal`, `arctic` → `lumen-glass`, `ember` → `blueprint-ops`) so existing users don't lose their preference; the migrated id is written back so future loads are direct. A new `npm run theme:check` script (`scripts/check-themes.js`, runs at any time) enforces the theme contract: every theme must declare every required color/token var with valid RGB channels, must point at a doc under `docs/themes/<id>.md` containing the four required sections (`## Intent`, `## Integration Rules`, `## Component Notes`, `## Validation`), every legacy alias must resolve to a real theme, and `index.css` must include a theme-specific selector for each non-default theme. Files: `client/src/themes/portosThemes.js` (new), `client/src/themes/familyIcons.js` (new), `client/src/components/ThemePickerPanel.jsx` (new), `client/src/components/ThemeSwitcher.jsx`, `client/src/components/ThemeContext.jsx`, `client/src/components/settings/GeneralTab.jsx`, `client/src/hooks/useTheme.js`, `client/src/index.css`, `client/src/main.jsx`, `docs/themes/*.md` (new — one per theme + README), `scripts/check-themes.js` (new), `package.json` (new `theme:check` script).- **3D Chief of Staff avatars are draggable to re-orient.** All five 3D avatar styles (Cyber, Sigil, Esoteric, Nexus, Muse) now respond to typical mouse/touch drag controls — click-and-drag rotates the avatar around its center, with damping for a smooth feel. Pan and zoom are intentionally disabled so the framing stays consistent on the small avatar tile. Wrapper divs use `cursor-grab`/`active:cursor-grabbing` and `touch-none` so the affordance is visible and touch drags don't fight page scroll. Implemented via drei's `OrbitControls` inside each avatar's `<Scene>`. Files: `client/src/components/cos/CyberCoSAvatar.jsx`, `client/src/components/cos/SigilCoSAvatar.jsx`, `client/src/components/cos/EsotericCoSAvatar.jsx`, `client/src/components/cos/NexusCoSAvatar.jsx`, `client/src/components/cos/MuseCoSAvatar.jsx`.- **Live AI operation status — toasts + server logs for every model call.** The user had no idea when a feature like Digital Twin → Taste → "Generate Summary" was actually doing work versus hung; the button just animated and silently waited up to a minute while LM Studio loaded a model on demand. New `server/services/aiStatusEvents.js` exports an `EventEmitter` + `startAIOp({ op, label, providerId, providerName, model })` helper that emits phase-tagged events (`start`, `model:loading`, `model:loaded`, `complete`, `error`) with provider/model/op metadata. `server/services/socket.js` bridges the emitter onto a new `ai:status` Socket.IO channel broadcast to all clients. `server/lib/aiProvider.js` — `callProviderAISimple()` now starts a status op for every API call (logs always; toasts when the caller passes `op`/`opLabel`, plus model-loading/error always), and the LM Studio auto-load path emits `model:loading` ("Loading openai/gpt-oss-20b into LM Studio…") + `model:loaded` ("openai/gpt-oss-20b loaded (4.2s)") so the user sees what's happening instead of a frozen button. `server/services/taste-questionnaire.js` passes labeled ops for the three taste AI calls (section summary, overall summary, deeper personalized question) so toasts read "Generating Movies & Film taste summary…" rather than a generic provider name. New `client/src/hooks/useAIStatusNotifications.js` subscribes to `ai:status`, renders one mutating toast per op id (`toast.loading` → `toast.success`/`toast.error` with the same id so phases update the same toast), and is mounted globally in `client/src/components/Layout.jsx`. Silent (uninstrumented) ops only toast when something user-visible happens (model load, error, or call exceeds 2.5s) so background calls don't spam the UI; explicit user-triggered ops toast immediately. Server logs are single-line emoji-prefixed with op slug, phase, message, provider, model, and elapsed time per CLAUDE.md style. Files: `server/services/aiStatusEvents.js` (new), `server/lib/aiProvider.js`, `server/services/socket.js`, `server/services/taste-questionnaire.js`, `client/src/hooks/useAIStatusNotifications.js` (new), `client/src/components/Layout.jsx`.diff --git a/PLAN.md b/PLAN.mdindex 9f07cb6877..0a4bf978b4 100644--- a/PLAN.md+++ b/PLAN.md@@ -134,12 +134,11 @@ Three high-value work items drawn from an inventory of the current app surface (- Promote action also sets `conversation.promoted = true` (already wired) so the conversation is exempt from 30-day auto-expiry once anything from it has been saved elsewhere.- Add `Ask` to the palette action whitelist (`server/routes/palette.js`) once the voice tool exists, so `⌘K` → "ask: …" can fire a prompt without leaving the current page.-- [ ] **Voice CoS tool expansion** — tools now include the original domain set plus `ui_navigate`, `ui_list_interactables`, `ui_click`, `ui_fill`, `ui_select`, `ui_check` for accessibility-style page driving. Remaining candidates:+- [ ] **Voice CoS tool expansion** — tools now include the original domain set plus `ui_navigate`, `ui_list_interactables`, `ui_click`, `ui_fill`, `ui_select`, `ui_check` for accessibility-style page driving, and `feeds_mark_read` (pairs with `feeds_digest` — fuzzy-matches an unread item by title or marks all read, optionally scoped to a feed). Remaining candidates:- `calendar_today` / `calendar_next` — surface today's Google Calendar events through the existing Google MCP integration- `meatspace_log_workout` — wrap `meatspaceHealth.js` workout/activity exports- `weather_now` — needs an external API choice (OpenWeather / Apple WeatherKit / NWS)- `timer_set` — set a voice-triggered reminder; likely reuses `agentActionExecutor.js` scheduled actions- - `feeds_mark_read` — pair with `feeds_digest` for "mark that one read"- [ ] **Voice agent — next power-ups** (follow-ons to the ui_* accessibility layer):- `ui_read` — extract visible page text (not just interactables) so "what does this say?" / "summarize this page" works without hand-navigation. Complements `ui_list_interactables`.diff --git a/server/services/voice/tools.js b/server/services/voice/tools.jsindex 628fd55f66..794b3b94f4 100644--- a/server/services/voice/tools.js+++ b/server/services/voice/tools.js@@ -8,7 +8,7 @@ import { logNicotine, getNicotineSummary } from '../meatspaceNicotine.js';import { addBodyEntry } from '../meatspaceHealth.js';import { getGoals, updateGoalProgress, addProgressEntry } from '../identity.js';import { listProcesses, restartApp } from '../pm2.js';-import { getItems, getFeeds } from '../feeds.js';+import { getItems, getFeeds, markItemRead, markAllRead } from '../feeds.js';import { getUserTimezone, todayInTimezone, getLocalParts } from '../../lib/timezone.js';import * as journal from '../brainJournal.js';import { resolveNavCommand, normalizeLabel } from '../../lib/navManifest.js';@@ -54,6 +54,7 @@ const TOOL_GROUPS = {pm2_status: 'system',pm2_restart: 'system',feeds_digest: 'feeds',+ feeds_mark_read: 'feeds',daily_log_open: 'dailylog',daily_log_start_dictation: 'dailylog',daily_log_stop_dictation: 'dailylog',@@ -89,7 +90,11 @@ const GROUP_INTENT = {meatspace: /\b(drink|drank|beer|wine|whiskey|shot|cocktail|cigarette|vape|pouch|nicotine|weigh|pound|kilo|kg|smoke|smoking|how am I|summary today|log (?:a|my) (?:drink|weight|nicotine))\b/i,goals: /\b(goals?|progress|objective)\b/i,system: /\b(restart|crash(?:ed)?|pm2|process|service|is.*(?:running|down|up)|status)\b/i,- feeds: /\b(feeds?|news|unread|article|rss|digest)\b/i,+ // "mark.*read" / "mark.*unread" pairs feeds_mark_read with feeds_digest:+ // after "what's in my feeds?" the user says "mark that one read" or "mark+ // them all as read" — the bare word "read" alone is too broad (collides+ // with "read my log"), so we require it follow "mark".+ feeds: /\b(feeds?|news|unread|articles?|rss|digest|headlines?|mark\b[^.!?\n]{0,40}\bread)\b/i,// `daily ?logi?n?s?` absorbs whisper/Web-Speech transcription drift on// "daily log": variants like "daily logs" (plural), "daily login" (heard as// a familiar word), "daily logins" all gate the daily-log toolset on. The@@ -627,6 +632,84 @@ const TOOLS = [},},+ {+ name: 'feeds_mark_read',+ description:+ 'Mark RSS feed items as read. Use when the user says "mark that one read", "mark this read", "I read the second one", or "mark them all read". ' ++ 'Pass `query` with a distinctive phrase from the item\'s title (the LLM should reuse a title it just spoke from feeds_digest). ' ++ 'Pass `all: true` to mark every unread item read; combine with `feedQuery` to scope to a single feed (e.g. "mark all of Hacker News as read").',+ parameters: {+ type: 'object',+ properties: {+ query: {+ type: 'string',+ description: 'Distinctive phrase from the article title to fuzzy-match against currently unread items.',+ },+ all: {+ type: 'boolean',+ description: 'Mark every unread item as read. When true, `query` is ignored.',+ },+ feedQuery: {+ type: 'string',+ description: 'Optional: when `all` is true, restrict to a single feed by fuzzy-matching its title.',+ },+ },+ },+ execute: async ({ query, all = false, feedQuery } = {}) => {+ if (!all && (typeof query !== 'string' || !query.trim())) {+ return { ok: false, summary: 'Tell me which item — say "mark all read" or quote a phrase from the title.' };+ }++ if (all) {+ let feedId;+ let feedTitle;+ if (feedQuery && typeof feedQuery === 'string' && feedQuery.trim()) {+ const feeds = await getFeeds();+ const fq = feedQuery.trim().toLowerCase();+ const feed = feeds.find((f) => (f.title || '').toLowerCase() === fq)+ || feeds.find((f) => (f.title || '').toLowerCase().includes(fq));+ if (!feed) {+ return { ok: false, summary: `No feed matched "${feedQuery}".` };+ }+ feedId = feed.id;+ feedTitle = feed.title;+ }+ const result = await markAllRead(feedId);+ const scope = feedTitle ? ` from ${feedTitle}` : '';+ return {+ ok: true,+ marked: result.marked,+ summary: result.marked+ ? `Marked ${result.marked} item${result.marked === 1 ? '' : 's'}${scope} as read.`+ : `Nothing unread${scope}.`,+ };+ }++ // Fuzzy-match a single item by title against currently unread.+ const q = query.trim().toLowerCase();+ const unread = await getItems({ unreadOnly: true, limit: 200 });+ const exact = unread.find((i) => (i.title || '').toLowerCase() === q);+ const match = exact+ || unread.find((i) => (i.title || '').toLowerCase().includes(q))+ || unread.find((i) => {+ const tokens = q.split(/\s+/).filter((t) => t.length >= 3);+ return tokens.length && tokens.every((t) => (i.title || '').toLowerCase().includes(t));+ });+ if (!match) {+ return { ok: false, summary: `No unread item matched "${query}".` };+ }+ const result = await markItemRead(match.id);+ if (result?.error) {+ return { ok: false, summary: `Couldn't mark "${match.title}" — ${result.error}.` };+ }+ return {+ ok: true,+ title: match.title,+ summary: `Marked "${match.title}" as read.`,+ };+ },+ },+{name: 'daily_log_open',description:diff --git a/server/services/voice/tools.test.js b/server/services/voice/tools.test.jsindex 9c52e906be..b239be2acf 100644--- a/server/services/voice/tools.test.js+++ b/server/services/voice/tools.test.js@@ -29,6 +29,8 @@ vi.mock('../pm2.js', () => ({vi.mock('../feeds.js', () => ({getItems: vi.fn(async () => []),getFeeds: vi.fn(async () => []),+ markItemRead: vi.fn(async () => ({ updated: true })),+ markAllRead: vi.fn(async () => ({ marked: 0 })),}));const { dispatchTool, getToolSpecs, getToolSpecsForIntent, classifyIntent } = await import('./tools.js');@@ -199,3 +201,91 @@ describe('classifyIntent — brain regex expansions', () => {expect(classifyIntent('click the save button').has('brain')).toBe(false);});});++describe('classifyIntent — feeds regex covers mark-read phrasings', () => {+ it('matches "what\'s in my feeds"', () => {+ expect(classifyIntent("what's in my feeds today").has('feeds')).toBe(true);+ });+ it('matches "mark that one read"', () => {+ expect(classifyIntent('mark that one read').has('feeds')).toBe(true);+ });+ it('matches "mark them all as read"', () => {+ expect(classifyIntent('mark them all as read').has('feeds')).toBe(true);+ });+ it('does NOT match "read my daily log" (read alone is too broad)', () => {+ expect(classifyIntent('read my daily log').has('feeds')).toBe(false);+ });+});++describe('feeds_mark_read', () => {+ it('returns ok:false when neither query nor all is provided', async () => {+ const r = await dispatchTool('feeds_mark_read', {});+ expect(r.ok).toBe(false);+ expect(r.summary).toMatch(/which item|mark all/i);+ });++ it('marks all unread when all=true', async () => {+ const feeds = await import('../feeds.js');+ feeds.markAllRead.mockResolvedValueOnce({ marked: 7 });+ const r = await dispatchTool('feeds_mark_read', { all: true });+ expect(r.ok).toBe(true);+ expect(r.marked).toBe(7);+ expect(r.summary).toMatch(/Marked 7 items? as read/);+ expect(feeds.markAllRead).toHaveBeenLastCalledWith(undefined);+ });++ it('reports nothing-unread when markAll returns 0', async () => {+ const feeds = await import('../feeds.js');+ feeds.markAllRead.mockResolvedValueOnce({ marked: 0 });+ const r = await dispatchTool('feeds_mark_read', { all: true });+ expect(r.ok).toBe(true);+ expect(r.summary).toMatch(/Nothing unread/);+ });++ it('scopes all=true to a feed when feedQuery matches', async () => {+ const feeds = await import('../feeds.js');+ feeds.getFeeds.mockResolvedValueOnce([+ { id: 'f1', title: 'Hacker News' },+ { id: 'f2', title: 'Daring Fireball' },+ ]);+ feeds.markAllRead.mockResolvedValueOnce({ marked: 3 });+ const r = await dispatchTool('feeds_mark_read', { all: true, feedQuery: 'hacker' });+ expect(r.ok).toBe(true);+ expect(r.marked).toBe(3);+ expect(feeds.markAllRead).toHaveBeenLastCalledWith('f1');+ expect(r.summary).toMatch(/from Hacker News/);+ });++ it('returns ok:false when feedQuery does not match any feed', async () => {+ const feeds = await import('../feeds.js');+ feeds.getFeeds.mockResolvedValueOnce([{ id: 'f1', title: 'Hacker News' }]);+ const r = await dispatchTool('feeds_mark_read', { all: true, feedQuery: 'nothing-like-that' });+ expect(r.ok).toBe(false);+ expect(r.summary).toMatch(/No feed matched/);+ });++ it('fuzzy-matches an unread item by title substring and marks it read', async () => {+ const feeds = await import('../feeds.js');+ feeds.getItems.mockResolvedValueOnce([+ { id: 'i1', title: 'Why React is fast', read: false },+ { id: 'i2', title: 'Tailwind v5 ships', read: false },+ ]);+ const r = await dispatchTool('feeds_mark_read', { query: 'tailwind' });+ expect(r.ok).toBe(true);+ expect(r.title).toBe('Tailwind v5 ships');+ expect(feeds.markItemRead).toHaveBeenLastCalledWith('i2');+ });++ it('returns ok:false when no unread item matches query', async () => {+ const feeds = await import('../feeds.js');+ feeds.getItems.mockResolvedValueOnce([{ id: 'i1', title: 'Something else', read: false }]);+ const r = await dispatchTool('feeds_mark_read', { query: 'nothing-like-that' });+ expect(r.ok).toBe(false);+ expect(r.summary).toMatch(/No unread item matched/);+ });++ it('rejects whitespace-only query without all', async () => {+ const r = await dispatchTool('feeds_mark_read', { query: ' ' });+ expect(r.ok).toBe(false);+ });+});