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: add tooltips and edit/delete to Brain inbox
Adam Eivye3d6c79811e5
diff --git a/client/src/components/brain/tabs/InboxTab.jsx b/client/src/components/brain/tabs/InboxTab.jsxindex 4dc4fcf94b..40f9f859b0 100644--- a/client/src/components/brain/tabs/InboxTab.jsx+++ b/client/src/components/brain/tabs/InboxTab.jsx@@ -8,7 +8,10 @@ import {Edit2,ChevronDown,ChevronRight,- ExternalLink+ ExternalLink,+ Trash2,+ Save,+ X} from 'lucide-react';import toast from 'react-hot-toast';@@ -29,6 +32,9 @@ export default function InboxTab({ onRefresh, settings }) {const [showFiled, setShowFiled] = useState(true);const [fixingId, setFixingId] = useState(null);const [fixDestination, setFixDestination] = useState('');+ const [editingId, setEditingId] = useState(null);+ const [editText, setEditText] = useState('');+ const [confirmingDeleteId, setConfirmingDeleteId] = useState(null);const inputRef = useRef(null);const fetchInbox = useCallback(async () => {@@ -107,6 +113,48 @@ export default function InboxTab({ onRefresh, settings }) {}};+ const handleEdit = (entry) => {+ setEditingId(entry.id);+ setEditText(entry.capturedText);+ };++ const handleSaveEdit = async (entryId) => {+ if (!editText.trim()) {+ toast.error('Text cannot be empty');+ return;+ }++ const result = await api.updateBrainInboxEntry(entryId, editText.trim()).catch(err => {+ toast.error(err.message || 'Failed to update');+ return null;+ });++ if (result) {+ toast.success('Entry updated');+ setEditingId(null);+ setEditText('');+ fetchInbox();+ onRefresh?.();+ }+ };++ const handleCancelEdit = () => {+ setEditingId(null);+ setEditText('');+ };++ const handleDelete = async (entryId) => {+ await api.deleteBrainInboxEntry(entryId).catch(err => {+ toast.error(err.message || 'Failed to delete');+ return null;+ });++ toast.success('Entry deleted');+ setConfirmingDeleteId(null);+ fetchInbox();+ onRefresh?.();+ };+const needsReviewEntries = entries.filter(e => e.status === 'needs_review');const filedEntries = entries.filter(e => e.status === 'filed' || e.status === 'corrected');const errorEntries = entries.filter(e => e.status === 'error');@@ -137,6 +185,7 @@ export default function InboxTab({ onRefresh, settings }) {type="submit"disabled={sending || !inputText.trim()}className="px-4 py-3 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"+ title={sending ? "Capturing..." : "Capture thought"}>{sending ? (<RefreshCw className="w-5 h-5 animate-spin" />@@ -173,7 +222,53 @@ export default function InboxTab({ onRefresh, settings }) {className="p-3 bg-port-card border border-port-warning/30 rounded-lg"><div className="flex items-start justify-between gap-2 mb-2">- <p className="text-white flex-1">{entry.capturedText}</p>+ {editingId === entry.id ? (+ <div className="flex-1 flex gap-2">+ <textarea+ value={editText}+ onChange={(e) => setEditText(e.target.value)}+ className="flex-1 px-2 py-1 bg-port-bg border border-port-border rounded text-white text-sm resize-none"+ rows={3}+ autoFocus+ />+ <div className="flex flex-col gap-1">+ <button+ onClick={() => handleSaveEdit(entry.id)}+ className="p-1 text-port-success hover:bg-port-success/20 rounded transition-colors"+ title="Save changes"+ >+ <Save size={14} />+ </button>+ <button+ onClick={handleCancelEdit}+ className="p-1 text-gray-400 hover:bg-port-border/50 rounded transition-colors"+ title="Cancel editing"+ >+ <X size={14} />+ </button>+ </div>+ </div>+ ) : (+ <>+ <p className="text-white flex-1">{entry.capturedText}</p>+ <div className="flex gap-1">+ <button+ onClick={() => handleEdit(entry)}+ className="p-1 text-gray-400 hover:text-white transition-colors"+ title="Edit text"+ >+ <Edit2 size={14} />+ </button>+ <button+ onClick={() => setConfirmingDeleteId(entry.id)}+ className="p-1 text-gray-400 hover:text-port-error transition-colors"+ title="Delete entry"+ >+ <Trash2 size={14} />+ </button>+ </div>+ </>+ )}<span className="text-xs text-gray-500 whitespace-nowrap">{formatRelativeTime(entry.capturedAt)}</span>@@ -185,30 +280,52 @@ export default function InboxTab({ onRefresh, settings }) {</p>)}- <div className="flex items-center gap-2 flex-wrap">- <span className="text-xs text-gray-500">Route to:</span>- {['people', 'projects', 'ideas', 'admin'].map(dest => {- const destInfo = DESTINATIONS[dest];- const Icon = destInfo.icon;- return (- <button- key={dest}- onClick={() => handleResolve(entry.id, dest)}- className={`flex items-center gap-1 px-2 py-1 text-xs rounded border ${destInfo.color} hover:opacity-80 transition-opacity`}- >- <Icon size={12} />- {destInfo.label}- </button>- );- })}- <button- onClick={() => handleRetry(entry.id)}- className="flex items-center gap-1 px-2 py-1 text-xs rounded border border-port-border text-gray-400 hover:text-white transition-colors"- >- <RefreshCw size={12} />- Retry AI- </button>- </div>+ {confirmingDeleteId === entry.id ? (+ <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded">+ <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>+ <button+ onClick={() => handleDelete(entry.id)}+ className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"+ title="Confirm delete"+ >+ Delete+ </button>+ <button+ onClick={() => setConfirmingDeleteId(null)}+ className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"+ title="Cancel delete"+ >+ Cancel+ </button>+ </div>+ ) : editingId !== entry.id && (+ <div className="flex items-center gap-2 flex-wrap">+ <span className="text-xs text-gray-500">Route to:</span>+ {['people', 'projects', 'ideas', 'admin'].map(dest => {+ const destInfo = DESTINATIONS[dest];+ const Icon = destInfo.icon;+ return (+ <button+ key={dest}+ onClick={() => handleResolve(entry.id, dest)}+ className={`flex items-center gap-1 px-2 py-1 text-xs rounded border ${destInfo.color} hover:opacity-80 transition-opacity`}+ title={`Route to ${destInfo.label}`}+ >+ <Icon size={12} />+ {destInfo.label}+ </button>+ );+ })}+ <button+ onClick={() => handleRetry(entry.id)}+ className="flex items-center gap-1 px-2 py-1 text-xs rounded border border-port-border text-gray-400 hover:text-white transition-colors"+ title="Retry AI classification"+ >+ <RefreshCw size={12} />+ Retry AI+ </button>+ </div>+ )}</div>))}</div>@@ -229,15 +346,84 @@ export default function InboxTab({ onRefresh, settings }) {key={entry.id}className="p-3 bg-port-card border border-port-error/30 rounded-lg">- <p className="text-white mb-1">{entry.capturedText}</p>- <p className="text-xs text-port-error">{entry.error?.message || 'Unknown error'}</p>- <button- onClick={() => handleRetry(entry.id)}- className="mt-2 flex items-center gap-1 px-2 py-1 text-xs rounded border border-port-border text-gray-400 hover:text-white transition-colors"- >- <RefreshCw size={12} />- Retry- </button>+ <div className="flex items-start justify-between gap-2 mb-1">+ {editingId === entry.id ? (+ <div className="flex-1 flex gap-2">+ <textarea+ value={editText}+ onChange={(e) => setEditText(e.target.value)}+ className="flex-1 px-2 py-1 bg-port-bg border border-port-border rounded text-white text-sm resize-none"+ rows={3}+ autoFocus+ />+ <div className="flex flex-col gap-1">+ <button+ onClick={() => handleSaveEdit(entry.id)}+ className="p-1 text-port-success hover:bg-port-success/20 rounded transition-colors"+ title="Save changes"+ >+ <Save size={14} />+ </button>+ <button+ onClick={handleCancelEdit}+ className="p-1 text-gray-400 hover:bg-port-border/50 rounded transition-colors"+ title="Cancel editing"+ >+ <X size={14} />+ </button>+ </div>+ </div>+ ) : (+ <>+ <p className="text-white flex-1">{entry.capturedText}</p>+ <div className="flex gap-1">+ <button+ onClick={() => handleEdit(entry)}+ className="p-1 text-gray-400 hover:text-white transition-colors"+ title="Edit text"+ >+ <Edit2 size={14} />+ </button>+ <button+ onClick={() => setConfirmingDeleteId(entry.id)}+ className="p-1 text-gray-400 hover:text-port-error transition-colors"+ title="Delete entry"+ >+ <Trash2 size={14} />+ </button>+ </div>+ </>+ )}+ </div>+ <p className="text-xs text-port-error mb-2">{entry.error?.message || 'Unknown error'}</p>+ {confirmingDeleteId === entry.id ? (+ <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded">+ <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>+ <button+ onClick={() => handleDelete(entry.id)}+ className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"+ title="Confirm delete"+ >+ Delete+ </button>+ <button+ onClick={() => setConfirmingDeleteId(null)}+ className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"+ title="Cancel delete"+ >+ Cancel+ </button>+ </div>+ ) : editingId !== entry.id && (+ <button+ onClick={() => handleRetry(entry.id)}+ className="flex items-center gap-1 px-2 py-1 text-xs rounded border border-port-border text-gray-400 hover:text-white transition-colors"+ title="Retry AI classification"+ >+ <RefreshCw size={12} />+ Retry+ </button>+ )}</div>))}</div>@@ -279,11 +465,40 @@ export default function InboxTab({ onRefresh, settings }) {</p>)}</div>- <span className="text-xs text-gray-500 whitespace-nowrap">- {formatRelativeTime(entry.capturedAt)}- </span>+ <div className="flex gap-1">+ <button+ onClick={() => setConfirmingDeleteId(entry.id)}+ className="p-1 text-gray-400 hover:text-port-error transition-colors"+ title="Delete entry"+ >+ <Trash2 size={14} />+ </button>+ <span className="text-xs text-gray-500 whitespace-nowrap">+ {formatRelativeTime(entry.capturedAt)}+ </span>+ </div></div>+ {confirmingDeleteId === entry.id && (+ <div className="flex items-center gap-2 p-2 bg-port-error/10 border border-port-error/30 rounded mb-2">+ <span className="text-xs text-white flex-1">Delete this entry? This cannot be undone.</span>+ <button+ onClick={() => handleDelete(entry.id)}+ className="px-2 py-1 text-xs bg-port-error text-white rounded hover:bg-port-error/80 transition-colors"+ title="Confirm delete"+ >+ Delete+ </button>+ <button+ onClick={() => setConfirmingDeleteId(null)}+ className="px-2 py-1 text-xs text-gray-400 hover:text-white transition-colors"+ title="Cancel delete"+ >+ Cancel+ </button>+ </div>+ )}+<div className="flex items-center gap-2 flex-wrap"><span className={`flex items-center gap-1 px-2 py-1 text-xs rounded border ${destInfo.color}`}><DestIcon size={12} />@@ -307,6 +522,7 @@ export default function InboxTab({ onRefresh, settings }) {window.location.href = `/brain/memory?type=${entry.filed.destination}&id=${entry.filed.destinationId}`;}}className="flex items-center gap-1 px-2 py-1 text-xs rounded border border-port-border text-gray-400 hover:text-white transition-colors"+ title="View in Memory"><ExternalLink size={12} />View@@ -320,6 +536,7 @@ export default function InboxTab({ onRefresh, settings }) {value={fixDestination}onChange={(e) => setFixDestination(e.target.value)}className="px-2 py-1 text-xs bg-port-bg border border-port-border rounded text-white"+ title="Select new destination"><option value="">Select...</option>{['people', 'projects', 'ideas', 'admin']@@ -331,12 +548,14 @@ export default function InboxTab({ onRefresh, settings }) {<buttononClick={() => handleFix(entry.id)}className="px-2 py-1 text-xs rounded bg-port-accent/20 text-port-accent hover:bg-port-accent/30"+ title="Move to selected destination">Move</button><buttononClick={() => { setFixingId(null); setFixDestination(''); }}className="px-2 py-1 text-xs text-gray-400 hover:text-white"+ title="Cancel fix">Cancel</button>@@ -345,6 +564,7 @@ export default function InboxTab({ onRefresh, settings }) {<buttononClick={() => setFixingId(entry.id)}className="flex items-center gap-1 px-2 py-1 text-xs rounded border border-port-border text-gray-400 hover:text-white transition-colors"+ title="Fix/move to different destination"><Edit2 size={12} />Fixdiff --git a/client/src/services/api.js b/client/src/services/api.jsindex f3a1b9257a..be9d0e62b6 100644--- a/client/src/services/api.js+++ b/client/src/services/api.js@@ -448,6 +448,11 @@ export const retryBrainClassification = (id, providerOverride, modelOverride) =>method: 'POST',body: JSON.stringify({ providerOverride, modelOverride })});+export const updateBrainInboxEntry = (id, capturedText) => request(`/brain/inbox/${id}`, {+ method: 'PUT',+ body: JSON.stringify({ capturedText })+});+export const deleteBrainInboxEntry = (id) => request(`/brain/inbox/${id}`, { method: 'DELETE' });// Brain - Peopleexport const getBrainPeople = () => request('/brain/people');diff --git a/server/lib/brainValidation.js b/server/lib/brainValidation.jsindex c73440457a..6033f0ce58 100644--- a/server/lib/brainValidation.js+++ b/server/lib/brainValidation.js@@ -171,6 +171,11 @@ export const fixInputSchema = z.object({note: z.string().max(500).optional()});+// Update inbox entry input schema+export const updateInboxInputSchema = z.object({+ capturedText: z.string().min(1).max(10000)+});+// Create/Update People input schemaexport const peopleInputSchema = z.object({name: z.string().min(1).max(200),diff --git a/server/routes/brain.js b/server/routes/brain.jsindex b8f42ed7ab..36d67991f8 100644--- a/server/routes/brain.js+++ b/server/routes/brain.js@@ -17,6 +17,7 @@ import {captureInputSchema,resolveReviewInputSchema,fixInputSchema,+ updateInboxInputSchema,inboxQuerySchema,peopleInputSchema,projectInputSchema,@@ -129,6 +130,39 @@ router.post('/inbox/:id/retry', asyncHandler(async (req, res) => {res.json(result);}));+/**+ * PUT /api/brain/inbox/:id+ * Update an inbox entry (edit captured text)+ */+router.put('/inbox/:id', asyncHandler(async (req, res) => {+ const validation = validate(updateInboxInputSchema, req.body);+ if (!validation.success) {+ throw new ServerError('Validation failed', {+ status: 400,+ code: 'VALIDATION_ERROR',+ context: { details: validation.errors }+ });+ }++ const result = await brainService.updateInboxEntry(req.params.id, validation.data);+ if (!result) {+ throw new ServerError('Inbox entry not found', { status: 404, code: 'NOT_FOUND' });+ }+ res.json(result);+}));++/**+ * DELETE /api/brain/inbox/:id+ * Delete an inbox entry+ */+router.delete('/inbox/:id', asyncHandler(async (req, res) => {+ const deleted = await brainService.deleteInboxEntry(req.params.id);+ if (!deleted) {+ throw new ServerError('Inbox entry not found', { status: 404, code: 'NOT_FOUND' });+ }+ res.status(204).send();+}));+// =============================================================================// PEOPLE CRUD// =============================================================================diff --git a/server/services/brain.js b/server/services/brain.jsindex 2158aabb3e..140f01730e 100644--- a/server/services/brain.js+++ b/server/services/brain.js@@ -617,6 +617,32 @@ export async function retryClassification(inboxLogId, providerOverride, modelOve};}+/**+ * Update inbox entry (edit captured text)+ */+export async function updateInboxEntry(inboxLogId, updates) {+ const updated = await storage.updateInboxLog(inboxLogId, updates);+ if (!updated) {+ return null;+ }++ console.log(`🧠 Updated inbox entry text: ${inboxLogId}`);+ return updated;+}++/**+ * Delete inbox entry+ */+export async function deleteInboxEntry(inboxLogId) {+ const deleted = await storage.deleteInboxLog(inboxLogId);+ if (!deleted) {+ return false;+ }++ console.log(`🧠 Deleted inbox entry: ${inboxLogId}`);+ return true;+}+// Re-export storage functions for convenienceexport const loadMeta = storage.loadMeta;export const updateMeta = storage.updateMeta;diff --git a/server/services/brainStorage.js b/server/services/brainStorage.jsindex 10f088badd..ecd2db4119 100644--- a/server/services/brainStorage.js+++ b/server/services/brainStorage.js@@ -386,6 +386,24 @@ export async function updateInboxLog(id, updates) {return records[index];}+/**+ * Delete inbox log entry+ */+export async function deleteInboxLog(id) {+ const records = await loadJsonlStore('inboxLog');+ const index = records.findIndex(r => r.id === id);++ if (index === -1) {+ return false;+ }++ records.splice(index, 1);+ await rewriteJsonl('inboxLog', records);++ console.log(`🧠 Deleted inbox log: ${id}`);+ return true;+}+/*** Get inbox log count by status*/