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 stage-tabbed output view for pipeline agent cards

Adam Eivy4edcdc33cb86
diff --git a/client/src/components/cos/tabs/AgentCard.jsx b/client/src/components/cos/tabs/AgentCard.jsx
index 0cb195e728..03c0e3f97f 100644
--- a/client/src/components/cos/tabs/AgentCard.jsx
+++ b/client/src/components/cos/tabs/AgentCard.jsx
@@ -98,6 +98,10 @@ export default function AgentCard({ agent, onKill, onDelete, onResume, completed
const [now, setNow] = useState(Date.now());
const [fullOutput, setFullOutput] = useState(null);
const [loadingOutput, setLoadingOutput] = useState(false);
+ // Pipeline stage output: track which stage tab is active and cached outputs per stage agentId
+ const [activeStageTab, setActiveStageTab] = useState(null);
+ const [stageOutputs, setStageOutputs] = useState({});
+ const [loadingStageId, setLoadingStageId] = useState(null);
const [processStats, setProcessStats] = useState(null);
const [killing, setKilling] = useState(false);
const [feedbackState, setFeedbackState] = useState(agent.feedback?.rating || null);
@@ -293,6 +297,50 @@ export default function AgentCard({ agent, onKill, onDelete, onResume, completed
return output.filter(o => o?.line?.startsWith('🔧')).length;
}, [output]);
+ // Pipeline stage info: build stage list with agentIds from stageResults
+ const pipelineStages = useMemo(() => {
+ const pipeline = agent.metadata?.pipeline;
+ if (!pipeline?.stages || pipeline.stages.length < 2) return null;
+ const results = pipeline.stageResults || [];
+ return pipeline.stages.map((stage, idx) => {
+ const result = results.find(r => r.stage === idx);
+ return {
+ index: idx,
+ name: stage.name,
+ agentId: result?.agentId || (idx === pipeline.currentStage ? agent.id : null),
+ success: result?.success,
+ isCurrent: idx === (pipeline.currentStage ?? 0),
+ completed: !!result
+ };
+ });
+ }, [agent.metadata?.pipeline, agent.id]);
+
+ // Initialize activeStageTab to current stage when pipeline is detected
+ useEffect(() => {
+ if (pipelineStages && activeStageTab === null) {
+ const current = pipelineStages.find(s => s.isCurrent);
+ setActiveStageTab(current?.index ?? pipelineStages.length - 1);
+ }
+ }, [pipelineStages, activeStageTab]);
+
+ // Fetch output for a prior pipeline stage agent
+ const fetchStageOutput = useCallback(async (stageAgentId) => {
+ if (!stageAgentId || stageOutputs[stageAgentId] || loadingStageId) return;
+ setLoadingStageId(stageAgentId);
+ const data = await api.getCosAgent(stageAgentId).catch(() => null);
+ setStageOutputs(prev => ({ ...prev, [stageAgentId]: data?.output || [] }));
+ setLoadingStageId(null);
+ }, [stageOutputs, loadingStageId]);
+
+ // Auto-fetch stage output when switching to a prior stage tab
+ useEffect(() => {
+ if (!pipelineStages || activeStageTab === null) return;
+ const stage = pipelineStages[activeStageTab];
+ if (!stage?.isCurrent && stage?.agentId && !stageOutputs[stage.agentId]) {
+ fetchStageOutput(stage.agentId);
+ }
+ }, [activeStageTab, pipelineStages, stageOutputs, fetchStageOutput]);
+
return (
<div className={`bg-port-card border rounded-lg overflow-hidden ${
completed
@@ -712,16 +760,75 @@ export default function AgentCard({ agent, onKill, onDelete, onResume, completed
{/* Expanded output view */}
{expanded && (
<div className="border-t border-port-border bg-port-bg/50 p-3 min-w-0 overflow-hidden">
- {loadingOutput ? (
- <div className="flex items-center gap-2 text-gray-500 text-sm">
- <Loader2 size={14} aria-hidden="true" className="animate-spin" />
- Loading full output...
+ {/* Pipeline stage tabs */}
+ {pipelineStages && (
+ <div className="flex items-center gap-1 mb-2 overflow-x-auto">
+ {pipelineStages.map((stage) => {
+ const isActive = activeStageTab === stage.index;
+ return (
+ <button
+ key={stage.index}
+ onClick={() => setActiveStageTab(stage.index)}
+ className={`flex items-center gap-1.5 px-2.5 py-1 text-xs rounded whitespace-nowrap transition-colors ${
+ isActive
+ ? 'bg-purple-500/20 text-purple-400'
+ : 'text-gray-500 hover:text-gray-300 hover:bg-port-border/30'
+ }`}
+ >
+ {stage.completed && (
+ <span className={stage.success ? 'text-port-success' : 'text-port-error'}>
+ {stage.success ? '●' : '✕'}
+ </span>
+ )}
+ {stage.isCurrent && !stage.completed && (
+ <span className="text-port-accent animate-pulse">●</span>
+ )}
+ {!stage.isCurrent && !stage.completed && (
+ <span className="text-gray-600">○</span>
+ )}
+ {stage.name}
+ </button>
+ );
+ })}
</div>
- ) : output.length > 0 ? (
- <OutputBlocks output={output} />
- ) : (
- <div className="text-gray-500 text-sm">No output captured</div>
)}
+ {/* Output content: show stage-specific output for pipeline agents */}
+ {(() => {
+ // For pipeline agents viewing a prior stage
+ const activeStage = pipelineStages?.[activeStageTab];
+ if (activeStage && !activeStage.isCurrent && activeStage.agentId) {
+ const stageOut = stageOutputs[activeStage.agentId];
+ if (loadingStageId === activeStage.agentId) {
+ return (
+ <div className="flex items-center gap-2 text-gray-500 text-sm">
+ <Loader2 size={14} aria-hidden="true" className="animate-spin" />
+ Loading stage output...
+ </div>
+ );
+ }
+ if (stageOut && stageOut.length > 0) {
+ return <OutputBlocks output={stageOut} />;
+ }
+ return <div className="text-gray-500 text-sm">No output captured for this stage</div>;
+ }
+ // For pipeline agents viewing a future stage (not yet run)
+ if (activeStage && !activeStage.isCurrent && !activeStage.agentId) {
+ return <div className="text-gray-500 text-sm">This stage has not run yet</div>;
+ }
+ // Current stage or non-pipeline agent: existing behavior
+ if (loadingOutput) {
+ return (
+ <div className="flex items-center gap-2 text-gray-500 text-sm">
+ <Loader2 size={14} aria-hidden="true" className="animate-spin" />
+ Loading full output...
+ </div>
+ );
+ }
+ if (output.length > 0) {
+ return <OutputBlocks output={output} />;
+ }
+ return <div className="text-gray-500 text-sm">No output captured</div>;
+ })()}
</div>
)}
</div>