pub async fn post_exec(
configuration: &Configuration,
code_run: CodeRun,
) -> Result<CodeResult, Error<PostExecError>>Expand description
Executes a program in a throwaway sandbox and answers with what it printed and what it left behind. lang names one of the thirteen the sandbox image carries — py, js, ts, bash, r, php, go, rs, c, cpp, java, d, f90 — and code is the whole program, not a fragment: a compiled language is compiled and then run, an interpreted one is interpreted, and args becomes the program’s own argv either way. Nothing is installed for you; the image is the environment. A PROGRAM THAT FAILS IS A SUCCESSFUL CALL. A non-zero exit answers 200 with the diagnostics on stderr, because "the code threw" and "the interpreter is down" are different facts a caller renders differently. Only the second is an error status. Runs are stateful through session_id. Omit it and the run gets a fresh sandbox whose id comes back on the answer; pass that id again and the next run sees the same filesystem, so a program can write a file one call and read it the next. files names bytes already uploaded to a session (POST /v1/exec/upload), copied in before the program starts. files on the ANSWER is what the program created or changed, by comparison against a marker taken at start — so it is the run’s real output, not a listing of the directory — and each is fetched from GET /v1/exec/download/{session}/{name}. The tenant is the caller’s, never the body’s, at every entry point. A typed op is also an MCP tool and an op-plane op; MCP’s tools/call invokes it directly, with no route and therefore no middleware, so nothing there could have checked a credential. tenantOf refuses a context carrying neither a validated principal nor exec’s own admission marker, so those entry points fail closed without a second gate to keep in step.