/** * CodeEditorWorkflowsPage * * Lists CodeEditor workflows for the current feature instance. * Uses the codeeditor-specific API endpoint instead of the generic /api/workflows/. */ import React, { useState, useEffect, useCallback } from 'react'; import { useCurrentInstance } from '../../../hooks/useCurrentInstance'; import api from '../../../api'; import styles from './CodeEditor.module.css'; interface WorkflowItem { id: string; label?: string; status?: string; workflowMode?: string; startedAt?: number; lastActivity?: number; } export const CodeEditorWorkflowsPage: React.FC = () => { const { instance } = useCurrentInstance(); const instanceId = instance?.id || ''; const [workflows, setWorkflows] = useState([]); const [loading, setLoading] = useState(false); const loadWorkflows = useCallback(() => { if (!instanceId) return; setLoading(true); api.get(`/api/codeeditor/${instanceId}/workflows`) .then(res => { const items = res.data?.items || res.data?.workflows || []; setWorkflows(Array.isArray(items) ? items : []); }) .catch(err => console.error('Failed to load workflows:', err)) .finally(() => setLoading(false)); }, [instanceId]); useEffect(() => { loadWorkflows(); }, [loadWorkflows]); return (

CodeEditor Workflows

{workflows.length === 0 ? (
{loading ? 'Loading workflows...' : 'No workflows yet. Start a conversation in the Editor view.'}
) : ( {workflows.map(wf => ( ))}
Label Status Started Last Activity
{wf.label || wf.id.slice(0, 8)} {wf.status || 'unknown'} {wf.startedAt ? new Date(wf.startedAt * 1000).toLocaleString() : '-'} {wf.lastActivity ? new Date(wf.lastActivity * 1000).toLocaleString() : '-'}
)}
); };