Audience: MXC consumers
Public entrypoint: @microsoft/mxc-sdk/v1. Types | Overview
Signatures describe the typed consumer API and omit implementation bodies. Callers do not supply JSON or a schema version.
| Output | Create and run a container | Run in an existing container | Result |
|---|---|---|---|
| Capture stdout and stderr | run |
runInContainer |
Promise<ExecutionResult> |
| Live standard pipes | spawn |
spawnInContainer |
Promise<MxcProcess> |
| Interactive terminal | spawnWithPty |
spawnInContainerWithPty |
Promise<MxcPtyProcess> |
Creation takes ContainerRequest and operation options. Existing-container
execution takes the ContainerId returned by provision, ExecutionRequest,
and operation options. PTY operations are asynchronous. One-shot PTY support
covers IsolationSession, Bubblewrap, LXC, and Seatbelt direct execution.
Existing-container PTY support remains IsolationSession-only. Seatbelt PTY
rejects guiAccess and legacy launchMethod: "open".
Terminal handles give the caller explicit input, output, resize, and process
ownership; there is no separate attached-console or raw-JSON launch API.
| Operation | Use it to |
|---|---|
getPlatformSupport |
Check whether the SDK can launch on this host and which backends it supports. |
getAvailableBackends |
Discover native host-available backends, capabilities, tiers, and warnings. Availability is advisory; not every reported backend has a V1 creation API. |
probe (Windows) |
Evaluate an optional ProcessContainer request, including the isolation tier and request-specific compatibility diagnostics, without creating a container. |
validate* |
Perform native dry-run validation for a typed lifecycle operation without provisioning, starting, executing, stopping, or deprovisioning a container. |
Validation returns ValidationResult with warnings, not execution output.
It does not guarantee that a later operation will succeed on a changed host.
Releases all backend resources associated with a provisioned container.
export async function deprovisionContainer<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, options: DeprovisionOptions = {}): Promise<LifecycleResult>;Discover tool and SDK directories from the environment and return them as policy paths.
export function getAvailableToolsPolicy(environment?: {
[key: string]: string | undefined;
}, options?: ToolsPolicyOptions): FilesystemPolicyResult;Get platform support information.
export function getPlatformSupport(): PlatformSupport;Read every native host-available backend, including its isolation tier, capabilities, and warnings. Host availability is advisory and does not imply that V1 creation can launch every reported backend. Native failures and malformed payloads throw.
export function getAvailableBackends(): AvailableBackend[];Return the existing host temporary directory as read-write policy; no directories are created.
export function getTemporaryFilesPolicy(environment?: {
[key: string]: string | undefined;
}): FilesystemPolicyResult;Build read-only policy for standard user profile application data locations.
export function getUserProfilePolicy(environment?: { [key: string]: string | undefined }): FilesystemPolicyResult;Constructs an MxcError from a wire-format error code.
export function mxcErrorFromCode(code: string, message: string, details?: Record<string, unknown>): MxcError;Probe which Windows ProcessContainer tier can serve an optional request.
export function probe(request?: ContainerRequest): ProbeOutput;Provision a container from a closed backend-specific request.
export async function provisionContainer<C extends LifecycleContainmentKind>(request: ProvisionRequest<C> & {
containment: C;
}, options: ProvisionOptions = {}): Promise<ProvisionResult<C>>;Read persisted/effective consent and policy without blocking the event loop.
export async function getTelemetryConsentStatus(): Promise<TelemetryConsentStatus>;Request consent with the versioned canonical consent resource.
export async function requestTelemetryConsent(presenter: TelemetryConsentPresenter, locale?: string): Promise<TelemetryConsentOutcome>;Run a container request asynchronously and capture its output.
export async function run(request: ContainerRequest, options: RunOptions = {}): Promise<ExecutionResult>;Execute in an existing IsolationSession or WSLC container and capture output.
Dispatch failures reject with MxcError; workload exit codes and timeouts are
returned in ExecutionResult.
export async function runInContainer<C extends PipedExecuteBackend>(containerId: ContainerId<C>, request: ExecutionRequest<C>, options?: RunInContainerOptions): Promise<ExecutionResult>;Create a container request and asynchronously return its live process.
export async function spawn(request: ContainerRequest, options: SpawnOptions = {}): Promise<MxcProcess>;Spawn a workload asynchronously inside a started IsolationSession or WSLC container with live standard pipes.
export async function spawnInContainer<C extends PipedExecuteBackend>(containerId: ContainerId<C>, request: ExecutionRequest<C>, options: SpawnInContainerOptions = {}): Promise<MxcProcess>;Execute a request in an existing container with an MXC-owned PTY.
export async function spawnInContainerWithPty<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, request: ExecutionRequest<C>, options: SpawnInContainerWithPtyOptions = {}): Promise<MxcPtyProcess>;Create a container request attached to an MXC-owned pseudo-terminal.
export async function spawnWithPty(request: ContainerRequest, options: SpawnWithPtyOptions = {}): Promise<MxcPtyProcess>;Starts a previously provisioned container.
export async function startContainer<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, options: StartOptions = {}): Promise<LifecycleResult>;Stops a started container without releasing its provision-side resources.
export async function stopContainer<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, options: StopOptions = {}): Promise<LifecycleResult>;Validate deprovision without releasing the container.
export async function validateDeprovision<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, options: DeprovisionOptions = {}): Promise<ValidationResult>;Validate a process request without starting a workload.
export async function validateProcess<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, request: ExecutionRequest<C>, options: SpawnInContainerOptions = {}): Promise<ValidationResult>;Validate provision without allocating a container or returning an identity.
export async function validateProvision<C extends LifecycleContainmentKind>(request: ProvisionRequest<C> & {
containment: C;
}, options: ProvisionOptions = {}): Promise<ValidationResult>;Validate a start request without starting the container.
export async function validateStart<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, options: StartOptions = {}): Promise<ValidationResult>;Validate a stop request without stopping the container.
export async function validateStop<C extends LifecycleContainmentKind>(containerId: ContainerId<C>, options: StopOptions = {}): Promise<ValidationResult>;Idempotently withdraw telemetry consent without blocking the event loop.
export async function withdrawTelemetryConsent(): Promise<TelemetryConsentOutcome>;