Tesla is a corporation. It does not have an operating agreement.
It's certificate of incorporation was most recently updated by the proxy statement soliciting the vote for the split (
https://www.sec.gov/Archives/edgar/data/1318605/000156459022024064/tsla-def14a_20220804.htm). You can read it in full there.
While you are right that some Delaware corporations can create special statements of purpose and include them in their Certificate, Tesla has not, so the default rules apply.
That means that the CEO's (and the Board's) primary fiduciary duty is to the shareholders (it's more complicated than that but that's the subject of a whole lot of corporate law).
The obvious fiduciary duty that is implicated is the duty of loyalty (i.e., the CEO is supposed to be dedicate his time to the corporation). The board long ago addressed that (and probably continues to do so with each new outside project) given his multiple business interests.
However, if the media reports of Tesla engineers working at Twitter are accurate, then there is also a corporate waste problem (again, this is more nuanced, but it's easier to characterize this way). Quite literally, Tesla's assets (those engineers) are being wasted on an endeavor that only serves the business purposes of one director and shareholder of Tesla.
At the very least, Twitter needs to be paying Tesla for the use of those engineers (in the same way Tesla likely needs to pay SpaceX when they get help there). Not big dollars presumably, but still an issue.
But, given the problem of hiring quality software engineers at Tesla and its all-out focus on a huge backlog of software tasks, I'm not even sure money can compensate Tesla.
At the very least, the independent members of the board need to be discussing this and confronting Elon on this point. At worst, a plaintiffs' firm is going to consider a derivative class action on this very issue.
(I think SpaceX is very different btw, because Tesla and SpaceX clearly get help from each other -- there is no evidence that anything done at Twitter will help Tesla's engineering efforts).