import React, { useMemo, useState } from 'react'; import { BrainCircuit, GitBranch, ShieldAlert, Sparkles } from 'lucide-react'; import { buildMindwalkGraph, buildNovaActPrompt, limitationFunctions, MindwalkNode } from '../services/mindwalkAdapter'; import { publishTabEvent } from '../services/tabBus'; interface MindwalkGraphViewProps { activeTab?: string; activeView?: string; } const stateColor: Record = { unvisited: 'bg-gray-800 border-gray-700 text-gray-400', seen: 'bg-emerald-500/15 border-emerald-400/30 text-emerald-200', read: 'bg-sky-500/15 border-sky-300/40 text-sky-100', edited: 'bg-amber-500/20 border-amber-300/50 text-amber-100 shadow-amber-900/40', limited: 'bg-rose-500/20 border-rose-300/50 text-rose-100 shadow-rose-950/40', }; const MindwalkGraphView: React.FC = ({ activeTab = 'nova-act', activeView = 'mindwalk' }) => { const graph = useMemo(() => buildMindwalkGraph(activeTab, activeView), [activeTab, activeView]); const [selected, setSelected] = useState(graph.nodes.find((node) => node.id === `${activeTab}:${activeView}`) || graph.nodes[0]); const prompt = buildNovaActPrompt(selected); const injectLimitations = () => { fetch('/api/nova-act/limitations', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ limitationIds: selected.limitationIds, prompt }), }).catch((error) => console.error('Failed to inject Nova Act limitations:', error)); publishTabEvent({ source: 'mindwalk', target: 'nova-act', action: 'limitations.inject', payload: { nodeId: selected.id, prompt, limitationIds: selected.limitationIds, }, }); }; return (
Mindwalk + OmniParser adapter

Parse UI into LLM language, then steer navigation.

Mindwalk keeps the navigation graph and touch-state memory; OmniParser is the UI-to-LLM transitioner that converts screen elements into grounded language Nova Act can use for actions and guardrails.

{graph.edges.map((edge, index) => { const source = graph.nodes.find((node) => node.id === edge.source); const target = graph.nodes.find((node) => node.id === edge.target); if (!source || !target) return null; return ; })} {graph.nodes.map((node) => ( ))}
Selected OmniParser UI-to-LLM node

{selected.label}

{selected.llmPhrase}

{selected.omniParserPhrase}

{prompt}
Limitation functions
{limitationFunctions.map((limitation) => (
{limitation.label}

{limitation.guardrail}

))}
); }; export default MindwalkGraphView;