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(ui): add pipeline stage visualization and tabbed prompt viewer to schedule tab
Adam Eivy621bfbf5f14c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 0384646fac..3f4b9a5bd9 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -10,6 +10,8 @@- PR reviewer now runs as a 2-stage pipeline: security scan (read-only) → code review + merge- Pipeline stage badge on agent cards showing current stage progress- `getStagePrompt()` export in taskSchedule for resolving pipeline stage-specific prompts+- Pipeline UI: collapsed row shows purple "2-stage" badge, expanded view shows stage flow visualization+- Pipeline UI: tabbed prompt viewer shows each stage's full prompt with stage name tabs## Changeddiff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsxindex 7a545eae72..4bbec9e60a 100644--- a/client/src/components/cos/tabs/ScheduleTab.jsx+++ b/client/src/components/cos/tabs/ScheduleTab.jsx@@ -1,5 +1,5 @@import { useState, useEffect, useCallback, useRef } from 'react';-import { Play, RotateCcw, ChevronDown, ChevronRight, AlertCircle, RefreshCw, Package, Info } from 'lucide-react';+import { Play, RotateCcw, ChevronDown, ChevronRight, AlertCircle, RefreshCw, Package, Info, GitMerge } from 'lucide-react';import toast from 'react-hot-toast';import * as api from '../../../services/api';import AppIcon from '../../AppIcon';@@ -77,6 +77,86 @@ function IntervalBadge({ type, cronExpression }) {);}+function PromptEditor({ config, promptValue, setPromptValue, editingPrompt, setEditingPrompt, handleSavePrompt, updating, activeApps }) {+ const stages = config.taskMetadata?.pipeline?.stages;+ const stagePrompts = config.stagePrompts;+ const hasPipeline = stages?.length > 0 && stagePrompts?.length > 0;+ const [activeTab, setActiveTab] = useState(0);++ useEffect(() => {+ if (activeTab >= (stages?.length || 1)) setActiveTab(0);+ }, [stages?.length, activeTab]);++ if (!hasPipeline) {+ // Standard single prompt editor+ return (+ <div>+ <div className="flex items-center justify-between mb-2">+ <label className="text-sm text-gray-400">Task Prompt</label>+ {!editingPrompt && (+ <button onClick={() => setEditingPrompt(true)} className="text-xs text-port-accent hover:text-port-accent/80">Edit</button>+ )}+ </div>+ {editingPrompt ? (+ <div className="space-y-2">+ <textarea+ value={promptValue}+ onChange={(e) => setPromptValue(e.target.value)}+ disabled={updating}+ rows={12}+ className="w-full bg-port-bg border border-port-border rounded px-3 py-2 text-white text-sm font-mono"+ placeholder="Enter task prompt"+ />+ <div className="flex gap-2">+ <button onClick={handleSavePrompt} disabled={updating} className="px-3 py-1.5 text-sm bg-port-accent hover:bg-port-accent/80 text-white rounded transition-colors">Save Prompt</button>+ <button onClick={() => { setPromptValue(config.prompt || ''); setEditingPrompt(false); }} disabled={updating} className="px-3 py-1.5 text-sm bg-port-border hover:bg-port-border/80 text-white rounded transition-colors">Cancel</button>+ </div>+ {activeApps.length > 0 && (+ <p className="text-xs text-gray-500">+ Use <code className="bg-port-border px-1 rounded">{'{appName}'}</code> and <code className="bg-port-border px-1 rounded">{'{repoPath}'}</code> as placeholders.+ </p>+ )}+ </div>+ ) : (+ <div className="bg-port-bg border border-port-border rounded px-3 py-2 text-xs text-gray-400 font-mono max-h-32 overflow-y-auto cursor-pointer hover:border-port-accent/50" onClick={() => setEditingPrompt(true)} title="Click to edit prompt">+ <pre className="whitespace-pre-wrap">{promptValue || 'No prompt configured'}</pre>+ </div>+ )}+ </div>+ );+ }++ // Pipeline tabbed prompt viewer+ return (+ <div>+ <label className="text-sm text-gray-400 block mb-2">Stage Prompts</label>+ <div className="border border-port-border rounded-lg overflow-hidden">+ <div className="flex border-b border-port-border bg-port-card">+ {stages.map((stage, i) => (+ <button+ key={i}+ onClick={() => setActiveTab(i)}+ className={`flex-1 px-3 py-2 text-xs font-medium transition-colors ${+ activeTab === i+ ? 'text-purple-400 bg-purple-500/10 border-b-2 border-purple-400'+ : 'text-gray-400 hover:text-gray-300 hover:bg-port-border/30'+ }`}+ >+ <span className="text-[10px] text-gray-500 mr-1">Stage {i + 1}</span>+ {stage.name}+ {stage.readOnly && <span className="ml-1 text-[10px] text-gray-500">(read-only)</span>}+ </button>+ ))}+ </div>+ <div className="bg-port-bg px-3 py-2 text-xs text-gray-400 font-mono max-h-64 overflow-y-auto">+ <pre className="whitespace-pre-wrap">{stagePrompts[activeTab] || 'No prompt configured'}</pre>+ </div>+ </div>+ <p className="text-xs text-gray-500 mt-2">Stage prompts use the default templates. Edit the main task prompt to override all stages with a single prompt.</p>+ </div>+ );+}+function GlobalConfigControls({ taskType, config, onUpdate, onTrigger, onReset, category: _category, providers, apps, updating, setUpdating, allTaskTypes }) {const [selectedType, setSelectedType] = useState(config.type);const [selectedProviderId, setSelectedProviderId] = useState(config.providerId || '');@@ -267,55 +347,16 @@ function GlobalConfigControls({ taskType, config, onUpdate, onTrigger, onReset,<p className="text-xs text-gray-500 mt-1">Leave as default to use the provider's default model</p></div>- <div>- <div className="flex items-center justify-between mb-2">- <label className="text-sm text-gray-400">Task Prompt</label>- {!editingPrompt && (- <button onClick={() => setEditingPrompt(true)} className="text-xs text-port-accent hover:text-port-accent/80">Edit</button>- )}- </div>- {editingPrompt ? (- <div className="space-y-2">- <textarea- value={promptValue}- onChange={(e) => setPromptValue(e.target.value)}- disabled={updating}- rows={12}- className="w-full bg-port-bg border border-port-border rounded px-3 py-2 text-white text-sm font-mono"- placeholder="Enter task prompt"- />- <div className="flex gap-2">- <button- onClick={handleSavePrompt}- disabled={updating}- className="px-3 py-1.5 text-sm bg-port-accent hover:bg-port-accent/80 text-white rounded transition-colors"- >- Save Prompt- </button>- <button- onClick={() => { setPromptValue(config.prompt || ''); setEditingPrompt(false); }}- disabled={updating}- className="px-3 py-1.5 text-sm bg-port-border hover:bg-port-border/80 text-white rounded transition-colors"- >- Cancel- </button>- </div>- {activeApps.length > 0 && (- <p className="text-xs text-gray-500">- Use <code className="bg-port-border px-1 rounded">{'{appName}'}</code> and <code className="bg-port-border px-1 rounded">{'{repoPath}'}</code> as placeholders.- </p>- )}- </div>- ) : (- <div- className="bg-port-bg border border-port-border rounded px-3 py-2 text-xs text-gray-400 font-mono max-h-32 overflow-y-auto cursor-pointer hover:border-port-accent/50"- onClick={() => setEditingPrompt(true)}- title="Click to edit prompt"- >- <pre className="whitespace-pre-wrap">{promptValue || 'No prompt configured'}</pre>- </div>- )}- </div>+ <PromptEditor+ config={config}+ promptValue={promptValue}+ setPromptValue={setPromptValue}+ editingPrompt={editingPrompt}+ setEditingPrompt={setEditingPrompt}+ handleSavePrompt={handleSavePrompt}+ updating={updating}+ activeApps={activeApps}+ /><div><label className="text-sm text-gray-400 block mb-2">Agent Options</label>@@ -647,6 +688,12 @@ function AppTaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, provid</div><div className="flex items-center gap-2 shrink-0">+ {config.taskMetadata?.pipeline?.stages?.length > 0 && (+ <span className={badge('purple')} title={config.taskMetadata.pipeline.stages.map(s => s.name).join(' → ')}>+ <GitMerge size={11} className="inline mr-1" />+ {config.taskMetadata.pipeline.stages.length}-stage+ </span>+ )}{totalCount > 0 && (<span className={badge(enabledCount === totalCount ? 'success' :@@ -661,6 +708,34 @@ function AppTaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, provid{expanded && (<div className="p-4 border-t border-port-border bg-port-bg/50 space-y-6">+ {config.taskMetadata?.pipeline?.stages?.length > 0 && (+ <div>+ <h4 className="text-sm font-medium text-gray-400 mb-3">Pipeline Stages</h4>+ <div className="flex items-stretch gap-0">+ {config.taskMetadata.pipeline.stages.map((stage, i) => (+ <div key={i} className="flex items-stretch">+ <div className="flex flex-col items-center px-4 py-3 bg-port-card border border-port-border rounded-lg min-w-[140px]">+ <div className="flex items-center gap-1.5 mb-1">+ <span className="text-xs font-medium text-purple-400">Stage {i + 1}</span>+ {stage.readOnly && (+ <span className="text-[10px] px-1 py-0.5 bg-gray-600/30 text-gray-400 rounded">read-only</span>+ )}+ </div>+ <span className="text-sm text-white text-center">{stage.name}</span>+ {stage.promptKey && (+ <span className="text-[10px] text-gray-500 mt-1 font-mono">{stage.promptKey}</span>+ )}+ </div>+ {i < config.taskMetadata.pipeline.stages.length - 1 && (+ <div className="flex items-center px-2 text-gray-500">→</div>+ )}+ </div>+ ))}+ </div>+ <p className="text-xs text-gray-500 mt-2">Each stage runs as a separate agent. The next stage only runs if the previous stage succeeds.</p>+ </div>+ )}+<div><h4 className="text-sm font-medium text-gray-400 mb-3">Global Defaults</h4><GlobalConfigControlsdiff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex bc289e91d0..f30aef4070 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -1783,7 +1783,7 @@ export async function getScheduleStatus() {}}- status.tasks[taskType] = {+ const taskStatus = {...interval,lastRun: execution.lastRun,runCount: execution.count,@@ -1802,6 +1802,15 @@ export async function getScheduleStatus() {recommendation: learningInfo.recommendation};+ // Include default stage prompts for pipeline tasks so UI can display them+ if (interval.taskMetadata?.pipeline?.stages?.length > 0) {+ taskStatus.stagePrompts = interval.taskMetadata.pipeline.stages.map(stage =>+ DEFAULT_TASK_PROMPTS[stage.promptKey] || null+ );+ }++ status.tasks[taskType] = taskStatus;+if (learningInfo.adjusted) {status.learningAdjustmentsActive++;}