Single source of truth for serializing an MJCLIResult per format.
Both the runtime host's Emit and the usage commands call this so JSON/MD
envelopes are always rendered identically. Returns the empty string for
text — in text mode the plugin renders its own human output, not a result
blob. No trailing newline; callers add one.
Always stamps MJ_CLI_RESULT_VERSION (respecting an explicit version
already on the result), so every machine-readable envelope on the wire carries
a contract version even though constructing one doesn't require it.
Single source of truth for serializing an MJCLIResult per format. Both the runtime host's
Emitand the usage commands call this so JSON/MD envelopes are always rendered identically. Returns the empty string fortext— in text mode the plugin renders its own human output, not a result blob. No trailing newline; callers add one.Always stamps MJ_CLI_RESULT_VERSION (respecting an explicit
versionalready on the result), so every machine-readable envelope on the wire carries a contract version even though constructing one doesn't require it.