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

feat(cos): add per-task unblock buttons to blocked tasks banner

Adam Eivydbb19689d3d7
diff --git a/client/src/components/cos/ActionableInsightsBanner.jsx b/client/src/components/cos/ActionableInsightsBanner.jsx
index e22b25417d..c8d28aebe2 100644
--- a/client/src/components/cos/ActionableInsightsBanner.jsx
+++ b/client/src/components/cos/ActionableInsightsBanner.jsx
@@ -1,5 +1,6 @@
import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
+import { toast } from 'react-hot-toast';
import {
AlertCircle,
AlertTriangle,
@@ -8,8 +9,10 @@ import {
Newspaper,
ListTodo,
ChevronRight,
+ ChevronDown,
X,
- Zap
+ Zap,
+ Unlock
} from 'lucide-react';
import * as api from '../../services/api';
@@ -59,18 +62,18 @@ const PRIORITY_STYLES = {
export default function ActionableInsightsBanner() {
const [data, setData] = useState(null);
const [dismissed, setDismissed] = useState([]);
+ const [expanded, setExpanded] = useState({});
const [loading, setLoading] = useState(true);
const navigate = useNavigate();
- useEffect(() => {
- const loadInsights = async () => {
- const result = await api.getCosActionableInsights().catch(() => null);
- setData(result);
- setLoading(false);
- };
+ const loadInsights = async () => {
+ const result = await api.getCosActionableInsights().catch(() => null);
+ setData(result);
+ setLoading(false);
+ };
+ useEffect(() => {
loadInsights();
- // Refresh every 60 seconds
const interval = setInterval(loadInsights, 60000);
return () => clearInterval(interval);
}, []);
@@ -79,28 +82,44 @@ export default function ActionableInsightsBanner() {
setDismissed(prev => [...prev, type]);
};
- const handleAction = (route) => {
- navigate(route);
+ const handleAction = (insight) => {
+ // For blocked insights, toggle expand to show individual tasks
+ if (insight.type === 'blocked' && insight.tasks?.length > 0) {
+ setExpanded(prev => ({ ...prev, [insight.type]: !prev[insight.type] }));
+ return;
+ }
+ if (insight.action?.route) {
+ navigate(insight.action.route);
+ }
+ };
+
+ const handleUnblockTask = async (taskId) => {
+ await api.updateCosTask(taskId, { status: 'pending' }).catch(err => {
+ toast.error(err.message);
+ return null;
+ });
+ toast.success('Task unblocked and moved to pending');
+ // Refresh insights to reflect change
+ await loadInsights();
};
if (loading || !data) {
return null;
}
- // Filter out dismissed insights
const visibleInsights = data.insights.filter(i => !dismissed.includes(i.type));
- // Don't render if no insights to show
if (visibleInsights.length === 0) {
return null;
}
- // Show only the top insight if there are many
const primaryInsight = visibleInsights[0];
const remainingCount = visibleInsights.length - 1;
const styles = PRIORITY_STYLES[primaryInsight.priority] || PRIORITY_STYLES.info;
const Icon = ICON_MAP[primaryInsight.icon] || AlertCircle;
+ const isExpanded = expanded[primaryInsight.type];
+ const hasBlockedTasks = primaryInsight.type === 'blocked' && primaryInsight.tasks?.length > 0;
return (
<div className={`${styles.bg} border ${styles.border} rounded-lg p-3 mb-4 transition-all`}>
@@ -122,12 +141,33 @@ export default function ActionableInsightsBanner() {
</span>
)}
</div>
- {primaryInsight.description && (
+ {primaryInsight.description && !isExpanded && (
<p className="text-xs text-gray-400 mt-0.5 line-clamp-1">
{primaryInsight.description}
</p>
)}
+ {/* Expanded blocked tasks list */}
+ {hasBlockedTasks && isExpanded && (
+ <div className="mt-2 space-y-1.5">
+ {primaryInsight.tasks.map(task => (
+ <div key={task.id} className="flex items-center gap-2 bg-black/20 rounded px-2 py-1.5">
+ <span className="flex-1 text-xs text-gray-300 truncate" title={task.description}>
+ {task.description}
+ </span>
+ <button
+ onClick={() => handleUnblockTask(task.id)}
+ className="flex items-center gap-1 px-2 py-1 text-xs font-medium bg-port-success/20 hover:bg-port-success/30 text-port-success rounded transition-colors shrink-0 min-h-[28px]"
+ title="Unblock and move to pending"
+ >
+ <Unlock size={11} />
+ Unblock
+ </button>
+ </div>
+ ))}
+ </div>
+ )}
+
{/* Additional insights indicator */}
{remainingCount > 0 && (
<div className="flex items-center gap-1 mt-1.5 text-xs text-gray-500">
@@ -141,11 +181,14 @@ export default function ActionableInsightsBanner() {
<div className="flex items-center gap-2 shrink-0">
{primaryInsight.action && (
<button
- onClick={() => handleAction(primaryInsight.action.route)}
+ onClick={() => handleAction(primaryInsight)}
className="flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium bg-white/10 hover:bg-white/20 text-white rounded transition-colors min-h-[32px]"
>
{primaryInsight.action.label}
- <ChevronRight size={12} />
+ {hasBlockedTasks
+ ? (isExpanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />)
+ : <ChevronRight size={12} />
+ }
</button>
)}
<button
diff --git a/server/routes/cos.js b/server/routes/cos.js
index ab65f4d10d..341c6a986f 100644
--- a/server/routes/cos.js
+++ b/server/routes/cos.js
@@ -1083,6 +1083,11 @@ router.get('/actionable-insights', asyncHandler(async (req, res) => {
const blockedCount = blockedUser.length + blockedCos.length;
if (blockedCount > 0) {
const firstBlocked = blockedUser[0] || blockedCos[0];
+ const blockedTasks = [...blockedUser, ...blockedCos].map(t => ({
+ id: t.id,
+ description: t.description?.substring(0, 80) || 'Unknown task',
+ blocker: t.metadata?.blocker || null
+ }));
insights.push({
type: 'blocked',
priority: 'high',
@@ -1090,7 +1095,8 @@ router.get('/actionable-insights', asyncHandler(async (req, res) => {
title: `${blockedCount} blocked task${blockedCount > 1 ? 's' : ''}`,
description: firstBlocked?.metadata?.blocker || firstBlocked?.description?.substring(0, 80) || 'Task is blocked',
action: { label: 'Unblock', route: '/cos/tasks' },
- count: blockedCount
+ count: blockedCount,
+ tasks: blockedTasks
});
}