microsoft / microsoft/mxc

Move the Node SDK to in-process execution

Open
#1,168 0 comments 0 reactions 1 assignee Claimed by @bbonaby View on GitHub
Issue-Feature Needs-Triage
Dominant language
Rust
Stars
1.3k
Forks
79
Avg merge
2d 7h
Merged PRs (30d)
117

Description

### Description of the new feature / enhancement

Move the Node SDK from spawning executor binaries to running through the shared native library. In-process execution means the SDK's primary execution path calls `mxc_ffi` in the Node process instead of launching `wxc-exec`, `lxc-exec`, or `mxc-exec-mac`.

The migration first preserves the current `SandboxPolicy` and `ContainerConfig` entry points. After execution is fully in-process, a follow-up API change will replace those internally versioned configuration types with strongly typed public APIs that do not expose internal schema or transport versioning.

**Success criteria**

- One-shot and state-aware Node APIs execute through the shared native library rather than executor binaries.
- Existing `SandboxPolicy` and `ContainerConfig` entry points remain available during the in-process migration.
- After the migration, strongly typed public APIs replace the internally versioned `SandboxPolicy` and `ContainerConfig` authoring surface.
- Schema versions, `RequestSpec`, Koffi, and native ABI types remain private implementation details in the final API.
- Pipe-based stdin, stdout, stderr, cancellation, timeout, and typed errors are supported.
- Node packages include the native library and required runtime sidecars, not standalone executors.
- Windows, Linux, and macOS build and validation coverage remains green.

### Proposed technical implementation details

- Stage `mxc_ffi` in Node build artifacts and load it with Koffi.
- Convert the existing policy/config inputs to the private native `RequestSpec` at the binding boundary.
- Add buffered, streaming, state-aware, platform, and telemetry bindings incrementally.
- Replace PTY/executor-backed Node execution with native pipe-process APIs.
- Update tests, documentation, playground usage, and npm packaging.
- After the in-process path is complete, introduce strongly typed public APIs and remove public dependency on internally versioned configuration types.

```mermaid
flowchart LR
A[SandboxPolicy or ContainerConfig] --> B[Node SDK compatibility layer]
B --> C[Private RequestSpec adapter]
C --> D[Koffi]
D --> E[mxc_ffi shared library]
E --> F[mxc-sdk / mxc_engine]
G[Follow-up strongly typed public API] -. replaces .-> A
G --> C
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.