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
fix: use singular nouns for one-item counts in toasts and status lines
Adam Eivy61abab7d764d
diff --git a/client/src/components/agents/tabs/OverviewTab.jsx b/client/src/components/agents/tabs/OverviewTab.jsxindex 349f464a89..690fb1e3ac 100644--- a/client/src/components/agents/tabs/OverviewTab.jsx+++ b/client/src/components/agents/tabs/OverviewTab.jsx@@ -11,6 +11,7 @@ import { PERSONALITY_STYLES, DEFAULT_PERSONALITY, DEFAULT_AVATAR, PLATFORM_TYPESimport { DEFAULT_AVATAR_COLOR } from '../../../themes/portosThemes';import { useCooldownTick } from '../../../hooks/useCooldownTick';import { formatCooldown, formatDateTime } from '../../../utils/formatters';+import { pluralize } from '../../../lib/textUtils';export default function OverviewTab({ agentId, agent, onAgentUpdate }) {const navigate = useNavigate();@@ -217,7 +218,7 @@ export default function OverviewTab({ agentId, agent, onAgentUpdate }) {const result = await api.moltworldExplore({ accountId: quickAccountId, agentId }).catch(() => null);setExploring(false);if (!result) return;- toast.success(`Explored (${result.x}, ${result.y}) — ${result.nearby || 0} agents nearby`);+ toast.success(`Explored (${result.x}, ${result.y}) — ${pluralize(result.nearby || 0, 'agent')} nearby`);refetchRateLimits();};diff --git a/client/src/components/apps/AppQuality.jsx b/client/src/components/apps/AppQuality.jsxindex 133ef24927..4cf55ae294 100644--- a/client/src/components/apps/AppQuality.jsx+++ b/client/src/components/apps/AppQuality.jsx@@ -11,6 +11,7 @@ import InfoTooltip from '../ui/InfoTooltip';import OverflowMenu from '../ui/OverflowMenu';import Drawer from '../Drawer';import useDrawerTab from '../../hooks/useDrawerTab';+import { pluralize } from '../../lib/textUtils';// Run/schedule forms live in a slide-out keyed by ?qualityPanel so the page// itself stays a metrics view; the value is the drawer title.@@ -132,7 +133,7 @@ export default function AppQuality({ app, detail = false }) {<OverflowMenu label="More quality actions" items={menuItems} /></div>{(federation?.failed || federation?.unavailable > 0) && <p className="basis-full text-xs text-port-warning">- {federation.failed ? 'Peer quality could not be loaded; the score may be incomplete.' : `${federation.unavailable} peers unavailable or incompatible; the score may be incomplete.`}+ {federation.failed ? 'Peer quality could not be loaded; the score may be incomplete.' : `${pluralize(federation.unavailable, 'peer')} unavailable or incompatible; the score may be incomplete.`}</p>}{score == null && !quality?.unavailable && <p className="basis-full text-sm text-gray-400">{hasAssessments ? 'Saved assessments do not qualify for an overall score yet. See the breakdown for coverage, confidence and age.' : 'No audit assessment saved yet. Run checks to collect one.'}diff --git a/client/src/components/apps/AppQuality.test.jsx b/client/src/components/apps/AppQuality.test.jsxindex 7dc3d60acf..0e70ea27db 100644--- a/client/src/components/apps/AppQuality.test.jsx+++ b/client/src/components/apps/AppQuality.test.jsx@@ -65,7 +65,7 @@ it('identifies federated evidence and incomplete scores without linking to a loc] } };render(<MemoryRouter><AppQuality app={app} detail /></MemoryRouter>);await screen.findByText(/No scored assessments/);- expect(screen.getByText(/1 peers unavailable or incompatible/)).toBeInTheDocument();+ expect(screen.getByText(/1 peer unavailable or incompatible/)).toBeInTheDocument();fireEvent.click(screen.getByRole('button', { name: 'Security actions' }));expect(screen.getByRole('menuitem', { name: 'View instances' })).toHaveAttribute('href', '/instances');expect(screen.queryByRole('menuitem', { name: 'View audit run' })).not.toBeInTheDocument();diff --git a/client/src/components/apps/AppQualityHistory.jsx b/client/src/components/apps/AppQualityHistory.jsxindex 803f6bd88c..1b93ee4079 100644--- a/client/src/components/apps/AppQualityHistory.jsx+++ b/client/src/components/apps/AppQualityHistory.jsx@@ -4,6 +4,7 @@ import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContaiimport { RefreshCw } from 'lucide-react';import { getAppQualityHistory } from '../../services/apiApps';import InfoTooltip from '../ui/InfoTooltip';+import { pluralize } from '../../lib/textUtils';export default function AppQualityHistory({ appId, categories = [] }) {const [params, setParams] = useSearchParams();@@ -57,7 +58,7 @@ export default function AppQualityHistory({ appId, categories = [] }) {</div></div>{(state.data?.federation?.failed || state.data?.federation?.unavailable > 0) && <p className="text-xs text-port-warning">- {state.data.federation.failed ? 'Peer quality could not be loaded; history may be incomplete.' : `${state.data.federation.unavailable} peers unavailable or incompatible; history may be incomplete.`}+ {state.data.federation.failed ? 'Peer quality could not be loaded; history may be incomplete.' : `${pluralize(state.data.federation.unavailable, 'peer')} unavailable or incompatible; history may be incomplete.`}</p>}{state.loading ? <p role="status">Loading quality history…</p> : state.error ? <p role="alert">Quality history could not be loaded. Use Refresh history to retry.</p> : !measured.length ? <p className="text-sm text-gray-400">No scored assessments in this period. Run an audit to start the history.</p> : <><div className="h-56 w-full" role="img" aria-label="Daily quality scores from 0 to 100; values and evidence are available in the history table below">diff --git a/client/src/components/brain/tabs/BrainGraph.jsx b/client/src/components/brain/tabs/BrainGraph.jsxindex 95ac5c4083..538711535f 100644--- a/client/src/components/brain/tabs/BrainGraph.jsx+++ b/client/src/components/brain/tabs/BrainGraph.jsx@@ -17,6 +17,7 @@ import BrailleSpinner from '../../BrailleSpinner';import useGraphNodeDetail from '../../../hooks/useGraphNodeDetail';import usePrefersReducedMotion from '../../../hooks/usePrefersReducedMotion';import { formatDateNumeric, formatPercent } from '../../../utils/formatters';+import { pluralize } from '../../../lib/textUtils';const EDGE_COLORS = {similar: '#3b82f6',@@ -290,7 +291,7 @@ export default function BrainGraph() {setSyncing(false);if (stats) {const archivedNote = stats.archived ? `, ${stats.archived} archived` : '';- toast.success(`Synced ${stats.synced} records (${stats.skipped} skipped${archivedNote})`, { id: toastId });+ toast.success(`Synced ${pluralize(stats.synced, 'record')} (${stats.skipped} skipped${archivedNote})`, { id: toastId });// Refresh the missing-embeddings count and reload the current view to pick// up the new edges.api.getEmbeddingsStatus().then(setEmbeddingStatus).catch(() => {});diff --git a/client/src/components/brain/tabs/DailyLogTab.jsx b/client/src/components/brain/tabs/DailyLogTab.jsxindex 94a6f89954..100a60d5b3 100644--- a/client/src/components/brain/tabs/DailyLogTab.jsx+++ b/client/src/components/brain/tabs/DailyLogTab.jsx@@ -14,6 +14,7 @@ import BrailleSpinner from '../../BrailleSpinner';import useMounted from '../../../hooks/useMounted';import { useVisibilityEvent } from '../../../hooks/useVisibilityEvent';import { formatDateFull, localDateKey, shiftISODate } from '../../../utils/formatters';+import { pluralize } from '../../../lib/textUtils';// Autosave cadence. The debounce keeps us from PUTting on every keystroke;// the max-wait ceiling exists because a pure debounce never fires at all@@ -564,7 +565,7 @@ export default function DailyLogTab() {setSyncing(true);const res = await api.syncDailyLogsToObsidian({ silent: true }).catch(() => null);setSyncing(false);- if (res) toast.success(`Synced ${res.synced} entries to Obsidian`);+ if (res) toast.success(`Synced ${pluralize(res.synced, 'entry', 'entries')} to Obsidian`);else toast.error('Sync failed');};diff --git a/client/src/components/calendar/CalendarDayEvents.jsx b/client/src/components/calendar/CalendarDayEvents.jsxindex c99141ddd7..68c5ae02ad 100644--- a/client/src/components/calendar/CalendarDayEvents.jsx+++ b/client/src/components/calendar/CalendarDayEvents.jsx@@ -25,7 +25,7 @@ export default function CalendarDayEvents({open={!!date && !selectedEvent && (events.length > 0 || !loading)}onClose={onClose}title={date ? formatDateFull(date) : ''}- subtitle={`${formatCount(dayEvents.length)} events${complete ? '' : ' loaded'}`}+ subtitle={`${formatCount(dayEvents.length)} ${dayEvents.length === 1 ? 'event' : 'events'}${complete ? '' : ' loaded'}`}closeLabel="Close day events"><div className="space-y-2">diff --git a/client/src/components/calendar/calendarEventChips.test.jsx b/client/src/components/calendar/calendarEventChips.test.jsxindex 8035096c09..1eda787d4e 100644--- a/client/src/components/calendar/calendarEventChips.test.jsx+++ b/client/src/components/calendar/calendarEventChips.test.jsx@@ -675,7 +675,7 @@ it('exposes a sparse Month date separately while preserving direct chip activati}]));await act(async () => render(<MemoryRouter initialEntries={['/calendar/month?month=2027-01']}><MonthView accounts={ACCOUNTS} /></MemoryRouter>));fireEvent.click(screen.getByRole('button', { name: `View day events for ${formatDateFull(new Date(2027, 0, 12))}` }));- expect(within(screen.getByRole('dialog')).getByText('1 events')).toBeInTheDocument();+ expect(within(screen.getByRole('dialog')).getByText('1 event')).toBeInTheDocument();fireEvent.click(within(screen.getByRole('dialog')).getByRole('button', { name: /Design Review/ }));expect(screen.getByRole('dialog', { name: 'Design Review' })).toBeInTheDocument();});diff --git a/client/src/components/cos/tabs/GsdConcernsPanel.jsx b/client/src/components/cos/tabs/GsdConcernsPanel.jsxindex bd4a87d23c..a14108d530 100644--- a/client/src/components/cos/tabs/GsdConcernsPanel.jsx+++ b/client/src/components/cos/tabs/GsdConcernsPanel.jsx@@ -2,6 +2,7 @@ import { useState } from 'react';import { Bug, Shield, Zap, Package, ChevronDown, ChevronUp, Plus } from 'lucide-react';import toast from '../../ui/Toast';import * as api from '../../../services/api';+import { pluralize } from '../../../lib/textUtils';const SEVERITY_CONFIG = {CRITICAL: { color: 'text-port-error border-port-error/30 bg-port-error/10', icon: Shield, label: 'Critical' },@@ -43,7 +44,7 @@ export default function GsdConcernsPanel({ appId, concerns, onTaskCreated }) {});setCreating(null);if (result) {- toast.success(`Created ${result.created || 0} tasks from concerns`);+ toast.success(`Created ${pluralize(result.created || 0, 'task')} from concerns`);onTaskCreated?.();}};diff --git a/client/src/components/pipeline/arcCanvas/SeasonActions.jsx b/client/src/components/pipeline/arcCanvas/SeasonActions.jsxindex 99817a002f..718dc8e8d3 100644--- a/client/src/components/pipeline/arcCanvas/SeasonActions.jsx+++ b/client/src/components/pipeline/arcCanvas/SeasonActions.jsx@@ -3,6 +3,7 @@ import { Plus, Loader2, Wand2, ListChecks, X, ShieldCheck } from 'lucide-react';import toast from '../../ui/Toast';import { createPipelineIssue, listPipelineIssues } from '../../../services/api';import VerifyScopeHint from './VerifyScopeHint.jsx';+import { pluralize } from '../../../lib/textUtils';const VERIFY_VOLUME_SCOPE = {depth: 'One volume in depth — reads beat sheets (stages.idea.output) for issues that have them, falls back to synopsis depth for un-expanded issues. Boundary checks against the immediate-neighbor volumes only.',@@ -22,7 +23,7 @@ const VERIFY_VOLUME_SCOPE = {// `type` field; see server/services/pipeline/volumeBeatsRunner.js for the// frame shapes.const BEATS_FRAME_LABELS = {- start: (f) => `Starting (${f.total} issues)…`,+ start: (f) => `Starting (${pluralize(f.total, 'issue')})…`,'issue:start': (f) => `Generating ${f.ordinal}/${f.total} — ${f.issueTitle || `#${f.issueNumber}`}`,'issue:complete': (f) => `${f.ordinal}/${f.total} done`,'issue:skip': (f) => `Skipped ${f.ordinal}/${f.total}`,diff --git a/client/src/components/sharing/MergeModal.jsx b/client/src/components/sharing/MergeModal.jsxindex 1b159a7d1c..d2e6735cd8 100644--- a/client/src/components/sharing/MergeModal.jsx+++ b/client/src/components/sharing/MergeModal.jsx@@ -10,6 +10,7 @@ import { Loader2, GitMerge, Sparkles } from 'lucide-react';import Modal from '../ui/Modal';import InlineDiff from '../ui/InlineDiff';import { MERGE_CHOICE } from '../../hooks/useRecordMerge';+import { pluralize } from '../../lib/textUtils';// Conflict values can be strings or structured (arrays/objects). Render strings// as-is so InlineDiff can word-diff them; pretty-print everything else.@@ -157,8 +158,8 @@ export default function MergeModal({ merge, setMerge, onExecute, onRepreview, on{preview && (<div className="text-xs text-gray-400 border-t border-port-border pt-3">Cascade: {kind === 'universe'- ? `${cascade.seriesToRepoint?.length || 0} child series re-pointed · ${cascade.loserCollectionItemCount || 0} media items folded`- : `${cascade.issuesToRepoint || 0} issues re-pointed · ${cascade.loserCollectionItemCount || 0} media items folded`}+ ? `${cascade.seriesToRepoint?.length || 0} child series re-pointed · ${pluralize(cascade.loserCollectionItemCount || 0, 'media item')} folded`+ : `${pluralize(cascade.issuesToRepoint || 0, 'issue')} re-pointed · ${pluralize(cascade.loserCollectionItemCount || 0, 'media item')} folded`}</div>)}diff --git a/client/src/components/sprites/ImportPanel.jsx b/client/src/components/sprites/ImportPanel.jsxindex fce10a5cde..7e227f3068 100644--- a/client/src/components/sprites/ImportPanel.jsx+++ b/client/src/components/sprites/ImportPanel.jsx@@ -12,6 +12,7 @@ import Modal from '../ui/Modal.jsx';import AppContextPicker from '../AppContextPicker.jsx';import { importSprites } from '../../services/apiSprites.js';import { getApps } from '../../services/apiApps.js';+import { pluralize } from '../../lib/textUtils';export default function ImportPanel({ onImported }) {const [open, setOpen] = useState(false);@@ -44,7 +45,7 @@ export default function ImportPanel({ onImported }) {setImportErrors(results.flatMap((r) => r.errors.map((e) => `${r.id}: ${e}`)));toast.error(`Import finished with ${totals.errors} error${totals.errors === 1 ? '' : 's'} — details below`);} else {- toast.success(`Imported ${totals.subjects} subjects (${totals.files} files, ${totals.verified} hash-verified)`);+ toast.success(`Imported ${pluralize(totals.subjects, 'subject')} (${pluralize(totals.files, 'file')}, ${totals.verified} hash-verified)`);setOpen(false);}onImported();diff --git a/client/src/components/universe/CastIntegrityPanel.jsx b/client/src/components/universe/CastIntegrityPanel.jsxindex eb2a68ba42..5f65d93e80 100644--- a/client/src/components/universe/CastIntegrityPanel.jsx+++ b/client/src/components/universe/CastIntegrityPanel.jsx@@ -42,6 +42,7 @@ import {humanizeIntegrityField,incompleteCoverage,} from '../../lib/characterIntegrity';+import { pluralize } from '../../lib/textUtils';const TONE_CLASS = {emerald: 'bg-emerald-500/15 text-emerald-300 border-emerald-500/40',@@ -194,8 +195,8 @@ export default function CastIntegrityPanel({ open, universeId, onClose, onUniver<div className="flex flex-wrap items-center gap-2 justify-between"><p className="text-xs text-gray-400">{passed- ? `All ${report.castCount} characters reviewed and clean.`- : `${findings.length} finding${findings.length === 1 ? '' : 's'} across ${report.castCount} character${report.castCount === 1 ? '' : 's'}.`}+ ? `All ${pluralize(report.castCount, 'character')} reviewed and clean.`+ : `${pluralize(findings.length, 'finding')} across ${pluralize(report.castCount, 'character')}.`}{incomplete.length ? (<span className="text-gray-500"> {incomplete.length} not fully reviewed.</span>) : null}diff --git a/client/src/hooks/useBackupRun.js b/client/src/hooks/useBackupRun.jsindex e6087649a4..6a0f3eb0b9 100644--- a/client/src/hooks/useBackupRun.js+++ b/client/src/hooks/useBackupRun.js@@ -1,6 +1,7 @@import { useAsyncAction } from './useAsyncAction';import { triggerBackup } from '../services/api';import toast from '../components/ui/Toast';+import { pluralize } from '../lib/textUtils';// Both manual entry points report the completed run returned by the server.// Completion callbacks update caller-owned state only when the run wasn't skipped.@@ -14,9 +15,9 @@ export function useBackupRun(onComplete) {if (result?.pgBackup?.status === 'failed') {// The socket error toast already announces the dump failure; acknowledge// the file portion without an extra error toast or unqualified success.- toast(`Backup complete — ${filesChanged} files changed; database dump failed`, { icon: '⚠️' });+ toast(`Backup complete — ${pluralize(filesChanged, 'file')} changed; database dump failed`, { icon: '⚠️' });} else {- toast.success(`Backup complete — ${filesChanged} files changed`, { icon: '💾' });+ toast.success(`Backup complete — ${pluralize(filesChanged, 'file')} changed`, { icon: '💾' });}await onComplete?.(result);}diff --git a/client/src/lib/creativeDirectorStatus.js b/client/src/lib/creativeDirectorStatus.jsindex 63fc380360..b40b3d3029 100644--- a/client/src/lib/creativeDirectorStatus.js+++ b/client/src/lib/creativeDirectorStatus.js@@ -11,10 +11,12 @@* tab already on screen is dropped — the work is already in front of the user.*/+import { pluralize } from './textUtils.js';+const sceneProgress = (project) => {const scenes = project.treatment?.scenes || [];if (!scenes.length) return null;- return `${scenes.filter((scene) => scene.status === 'accepted').length} of ${scenes.length} scenes accepted`;+ return `${scenes.filter((scene) => scene.status === 'accepted').length} of ${pluralize(scenes.length, 'scene')} accepted`;};const videoNext = (project, { cut, activeTab }) => {diff --git a/client/src/lib/creativeDirectorStatus.test.js b/client/src/lib/creativeDirectorStatus.test.jsindex cca9873a33..aaf91b52c3 100644--- a/client/src/lib/creativeDirectorStatus.test.js+++ b/client/src/lib/creativeDirectorStatus.test.js@@ -25,6 +25,7 @@ describe('describeCreativeDirectorStatus', () => {treatment: { scenes: [{ status: 'accepted' }, { status: 'rendering' }, { status: 'pending' }] },}), { activeAgents: 2 });expect(status).toMatchObject({ tone: 'muted', headline: 'Rendering · 1 of 3 scenes accepted', next: null });+ expect(describeCreativeDirectorStatus(project({ status: 'rendering', treatment: { scenes: [{ status: 'accepted' }] } })).headline).toBe('Rendering · 1 of 1 scene accepted');expect(status.facts).toEqual([{ id: 'agents', label: '2 agents working', tone: 'muted' }]);});diff --git a/client/src/lib/universeGraphModel.js b/client/src/lib/universeGraphModel.jsindex 356cacf471..9e91d58cfe 100644--- a/client/src/lib/universeGraphModel.js+++ b/client/src/lib/universeGraphModel.js@@ -12,6 +12,7 @@*/import { EVOLUTION_STAGES, EVOLUTION_STAGE_LABELS } from './characterEvolution.js';+import { pluralize } from './textUtils.js';export { EVOLUTION_STAGES, EVOLUTION_STAGE_LABELS };@@ -233,7 +234,7 @@ export function computeUniverseGaps(index) {nodeId: a.id,otherId: b.id,title: `Define ${a.name} ↔ ${b.name}`,- detail: `They share ${shared} issues but have no typed relationship.`,+ detail: `They share ${pluralize(shared, 'issue')} but have no typed relationship.`,action: 'Add a relationship link',});}@@ -246,7 +247,7 @@ export function computeUniverseGaps(index) {color: GAP_COLORS.suggest,nodeId: node.id,title: `${node.name} has no evolution lens`,- detail: `Appears in ${count} issues with no five-stage arc authored.`,+ detail: `Appears in ${pluralize(count, 'issue')} with no five-stage arc authored.`,action: 'Author the lens',});}diff --git a/client/src/pages/PipelineReverseOutline.jsx b/client/src/pages/PipelineReverseOutline.jsxindex 2bbc77d536..db946e9cf9 100644--- a/client/src/pages/PipelineReverseOutline.jsx+++ b/client/src/pages/PipelineReverseOutline.jsx@@ -25,6 +25,7 @@ import { useSeriesRunLifecycle } from '../hooks/useSeriesRunLifecycle';import RunRecoveryBanner from '../components/pipeline/RunRecoveryBanner';import useUrlParams from '../hooks/useUrlParams';import { buildPlotlineGrid, sceneComponentCount } from '../lib/reverseOutlineGrid.js';+import { pluralize } from '../lib/textUtils';export default function PipelineReverseOutline() {const { seriesId } = useParams();@@ -65,7 +66,7 @@ export default function PipelineReverseOutline() {if (frame.type === 'complete') {reloadOutline();if (frame.status === 'no-content') toast.warning('Nothing drafted yet — write or import a manuscript first');- else toast.success(`Reverse outline ready — ${frame.sceneCount || 0} scenes`);+ else toast.success(`Reverse outline ready — ${pluralize(frame.sceneCount || 0, 'scene')}`);} else if (frame.type === 'canceled') {toast.success('Reverse outline canceled');} else {diff --git a/client/src/pages/Uploads.jsx b/client/src/pages/Uploads.jsxindex 911d3d046e..955886514c 100644--- a/client/src/pages/Uploads.jsx+++ b/client/src/pages/Uploads.jsx@@ -96,7 +96,7 @@ export default function Uploads() {});if (result?.success) {- toast.success(`Deleted ${result.deleted} files (${result.freedSpaceFormatted})`);+ toast.success(`Deleted ${pluralize(result.deleted, 'file')} (${result.freedSpaceFormatted})`);fetchUploads();}setConfirmingDeleteAll(false);