summaryrefslogtreecommitdiff
path: root/makima/frontend/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'makima/frontend/src/routes')
-rw-r--r--makima/frontend/src/routes/mesh.tsx25
1 files changed, 24 insertions, 1 deletions
diff --git a/makima/frontend/src/routes/mesh.tsx b/makima/frontend/src/routes/mesh.tsx
index cc09bca..a8d3574 100644
--- a/makima/frontend/src/routes/mesh.tsx
+++ b/makima/frontend/src/routes/mesh.tsx
@@ -7,7 +7,7 @@ import { TaskOutput } from "../components/mesh/TaskOutput";
import { UnifiedMeshChatInput } from "../components/mesh/UnifiedMeshChatInput";
import { useTasks } from "../hooks/useTasks";
import { useTaskSubscription, type TaskUpdateEvent, type TaskOutputEvent } from "../hooks/useTaskSubscription";
-import type { TaskWithSubtasks, MeshChatContext, ContractSummary, ContractWithRelations, DaemonDirectory } from "../lib/api";
+import type { TaskWithSubtasks, MeshChatContext, ContractSummary, ContractWithRelations, DaemonDirectory, TaskSummary } from "../lib/api";
import { startTask as startTaskApi, stopTask as stopTaskApi, getTaskOutput, listContracts, getContract, getDaemonDirectories, continueTask as continueTaskApi, resumeSupervisor } from "../lib/api";
import { DirectoryInput } from "../components/mesh/DirectoryInput";
import { useAuth } from "../contexts/AuthContext";
@@ -119,6 +119,8 @@ export default function MeshPage() {
// Track which subtask's output we're viewing (null = parent task)
const [viewingSubtaskId, setViewingSubtaskId] = useState<string | null>(null);
const [viewingSubtaskName, setViewingSubtaskName] = useState<string | null>(null);
+ // For supervisor tasks: all tasks in the contract (excluding the supervisor itself)
+ const [contractTasks, setContractTasks] = useState<TaskSummary[]>([]);
// View mode for the split panel layout
const [viewMode, setViewMode] = useState<ViewMode>("split");
// Width of the task panel as a percentage (0-100)
@@ -309,6 +311,26 @@ export default function MeshPage() {
}
}, [id, fetchTask]);
+ // For supervisor tasks: fetch all tasks in the contract (excluding the supervisor itself)
+ useEffect(() => {
+ if (taskDetail?.isSupervisor && taskDetail.contractId) {
+ getContract(taskDetail.contractId)
+ .then((contract) => {
+ // Filter out the supervisor task itself
+ const tasksExcludingSupervisor = contract.tasks.filter(
+ (t) => t.id !== taskDetail.id
+ );
+ setContractTasks(tasksExcludingSupervisor);
+ })
+ .catch((err) => {
+ console.error("Failed to fetch contract tasks for supervisor:", err);
+ setContractTasks([]);
+ });
+ } else {
+ setContractTasks([]);
+ }
+ }, [taskDetail?.isSupervisor, taskDetail?.contractId, taskDetail?.id]);
+
const handleSelectTask = useCallback(
(taskId: string) => {
navigate(`/mesh/${taskId}`);
@@ -711,6 +733,7 @@ export default function MeshPage() {
onToggleSubtaskOutput={handleToggleSubtaskOutput}
viewingSubtaskId={viewingSubtaskId}
onViewContract={(contractId) => navigate(`/contracts/${contractId}`)}
+ contractTasks={taskDetail.isSupervisor ? contractTasks : undefined}
/>
</div>
)}