Cross SDK public API surface alignment for creating containers
Description of the task
Right now we have the following matrix of API support:
| Capability | Rust | .NET | Node |
|---|---|---|---|
| One-shot request model | SandboxRequestSandboxPolicy |
SandboxRequestSandboxPolicy |
ContainerConfig |
| Run to completion | run() |
Run()RunAsync() |
spawnSandboxAsync() |
| Native streaming | spawn_sandbox() |
Spawn() |
SpawnSandbox / SpawnSandboxFromConfig – uses executables and not the mxc_ffi foundation that was added to the node sdk and returns either a Node ChildProcess or IPty interface |
| State-aware lifecycle | run_state_aware_json() |
ProvisionSandbox()StartSandbox()StopSandbox()DeprovisionSandbox() |
provisionSandbox()startSandbox()stopSandbox()deprovisionSandbox() |
| State-aware streaming exec | exec_sandbox() |
ExecInSandbox()ExecInSandboxAsync() |
execInSandbox()execInSandboxAsync() |
| Attached state-aware exec | exec_attached() |
ExecInSandboxAttached() |
Missing |
What we want at the completion of this issue
All node rust SDKs should use in proc mxc_ffi shared library for their api calls. Node is now set up to use the mxc_ffi layer however, the public facing APIs need to be updated to call into them rather than the mxc executables. NOTE: rust can stay synchronous for v1 while the other SDKs can have their both synchronous and *Async functions.
| Capability | Rust | .NET | Node |
|---|---|---|---|
| One-shot request model | SandboxRequestV1 |
SandboxRequestV1 |
SandboxRequestV1 |
| Run to completion | run() | Run()RunAsync() |
Run()RunAsync() |
| Native streaming | spawn() |
Spawn() |
Spawn() |
| State-aware lifecycle | provision_sandbox()start_sandbox()stop_sandbox()deprovision_sandbox() |
ProvisionSandbox()StartSandbox()StopSandbox()DeprovisionSandbox() |
provisionSandbox()startSandbox()stopSandbox()deprovisionSandbox() |
| State-aware streaming exec | exec_in_sandbox() |
ExecInSandbox()ExecInSandboxAsync() |
execInSandbox()execInSandboxAsync() |
| Attached state-aware exec | exec_in_attached() |
ExecInSandboxAttached() |
execInSandboxAttached() |
Additional context
No response
Let's not do the attached variant
We need some solution for customers like OpenClaw who want to run their sandboxed command(s) in a fully interactive terminal with a text user interface. Simply handling the stdio pipes back isn't enough. I'm open to options that remove exec_attached, but that's the variant that wires up this interactivity on top of the pty support for isolation sessions.
@jsidewhite to confirm, when you say "Let's not do the attached variant" you mean, simply not to have a separate public API, but to instead collapse its functionality into the current ExecInSandbox API right? Simply adding a function parameter to that API that gets the attach behavior. So, in this case it's not removing this functionality we're just removing the need to expose a separate API for it.
Decision: ExecInAttach to move to private surface of the SDK and we will expose a flag in the current ExecInSandbox API to allow this behavior instead of having the separate API.
EDIT: Moving attach to private for now and going the pseudo terminal route. Callers can then access stdio, and resize options for the returned PTY