@prismshadow/penguin-library-sandbox · library/sandbox/src/service.ts:394

Sandbox

interface

Confinement: settings, the active confiner, and which backends are mounted.

API

@Interface("@prismshadow/penguin-server#Sandbox")
export abstract class Sandbox {
  abstract configure(settings: SandboxSettings): void;
  abstract currentSettings(): SandboxSettings;
  abstract parkedSettings(): SandboxSettings | undefined;
  abstract backends(): Array<{
      name: string;
      dimensions: readonly SandboxDimension[];
      mechanism?: string;
      limits?: readonly SandboxLimit[];
    }>;
  abstract failures(): Array<{ name: string; reason: string }>;
  abstract declined(): string[];
  abstract origins(): Array<{ name: string; package?: string }>;
  abstract retryFailed(): Promise<void>;
  abstract confiner(): SpawnConfiner;
  abstract confinerFor(policyOf: () => SandboxSettings): SpawnConfiner;
  abstract whenReady(): Promise<void>;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use

Members (11)

configure

configure(settings: SandboxSettings): void

Replaces the active settings (the config surface's write path).

@paramsettingsSandboxSettings
@returnsvoid

currentSettings

currentSettings(): SandboxSettings

The active settings as a plain copy (the config surface's read side).

@returnsSandboxSettings

parkedSettings

parkedSettings(): SandboxSettings | undefined

The active settings as parked state, or undefined for the pristine default. The omission is load-bearing compatibility: a default deployment keeps parking { motd }, which any platform bundle's context schema accepts. Once confinement is configured the field enters the document, and from then on pushing a sandbox-ignorant bundle is BLOCKED by schema validation — the right failure: refusing the swap beats a swap that silently un-confines the deployment.

@returnsSandboxSettings | undefined

backends

backends(): Array<{ name: string; dimensions: readonly SandboxDimension[]; mechanism?: string; limits?: readonly SandboxLimit[]; }>

The mounted backends and what each implements, in routing preference: the one a policy goes to first (diagnostics / the config surface).

@returnsArray<{ name: string; dimensions: readonly SandboxDimension[]; mechanism?: string; limits?: readonly SandboxLimit[]; }>

failures

failures(): Array<{ name: string; reason: string }>

The backends that failed to load, each with why (diagnostics / the config surface).

@returnsArray<{ name: string; reason: string }>

declined

declined(): string[]

The backends that declined because this host is not theirs (the config surface).

@returnsstring[]

origins

origins(): Array<{ name: string; package?: string }>

Every registered backend in routing order, with the package of the plugin that registered it when one did: what the settings page links each backend's line to (its plugin's page).

@returnsArray<{ name: string; package?: string }>

retryFailed

retryFailed(): Promise<void>

Loads again every backend whose load failed and that registered a loader (a bare promise cannot be re-run). Called after the sandbox's settings are saved: a backend whose check failed on its own setting mounts once that setting is fixed. Resolves when those settle.

@returnsPromise<void>

confiner

confiner(): SpawnConfiner

The closure handed to the runtime: rewrites each spawn's argv under the active settings. Pure and self-contained, so the previous platform's confiner keeps serving during a hot-swap freeze window.

@returnsSpawnConfiner

confinerFor

confinerFor(policyOf: () => SandboxSettings): SpawnConfiner

The same closure under a policy the caller keeps — a Session's own snapshot. The backends are still this service's, so a backend change reaches every Session.

@parampolicyOf() => SandboxSettings
@returnsSpawnConfiner

whenReady

whenReady(): Promise<void>

Resolves when every registered backend has loaded (or failed to).

@returnsPromise<void>