Skip to content

API Reference: Data Types ​

Every type on this page comes from the core package manim-live (EnvironmentStatus, Surface, RunResult and friends) — this plugin defines no outward types of its own. The page gives each type's full fields and value semantics; finer behavioural detail lives in the core package's docs.

TypeDefined byPurposeDetail
EnvironmentStatusCore packageEnvironment status snapshotThis page
EnvironmentCapabilitiesCore packageBrowser capabilities inside the snapshotThis page
RuntimePhase / KatexPhaseCore packageTwo lifecycle phasesThis page
CheckResultCore packageOutcome of one precheckThis page
SurfaceCore packageOne canvasCore package: Canvas
RunResultCore packageOutcome of one renderCore package: Canvas

Where types come from ​

The core package exports the types, so a normal value import is the right move — it is this plugin's only runtime dependency:

ts
import { environmentStatus, type EnvironmentStatus, type Surface } from 'manim-live'

This plugin's own code reads it exactly that way (see src/client/runtime-status.ts): both the snapshot and the subscription of environment status come straight from that package.

EnvironmentStatus ​

The environment status snapshot: the return of environmentStatus() and the value delivered to subscription callbacks. Four condition components plus a list of hints:

ts
interface EnvironmentStatus {
  capabilities: EnvironmentCapabilities
  runtime: { phase: RuntimePhase; error?: string; indexURL: string | null }
  katex: { baseURL: string | null; phase: KatexPhase; error?: string }
  packages: { fetching: string[]; lastError?: string }
  hints: string[]
}

capabilities ​

The result of a one-off probe of browser capabilities, cached for the lifetime of the page. It does not change with page state, only with the browser environment (a different machine or browser changes it).

ts
interface EnvironmentCapabilities {
  wasm: boolean
  webgl: boolean
  videoExport: boolean
}
FieldConsequence when missing
wasmThe Python interpreter cannot start; no rendering is available
webglmanim-web cannot produce a picture; no rendering is available

runtime ​

The lifecycle of the Pyodide runtime.

FieldMeaning
phaseSee the table below
errorFailure text when phase is error
indexURLThe currently registered fetch root. This plugin always uses bundled assets, so it points at the plugin's same-origin route; null if a loader was never installed
phaseMeaningWhat you can do
idleNot loaded. The normal initial state before the first renderWait
loadingLoadingShow a progress hint
readyReady, rendering is possibleProceed normally
errorLoad failedRead error; hints already carries a matching suggestion

idle is not an error. It means "not yet" rather than "something is wrong"; warning on it produces false positives.

katex ​

The state of the stylesheet used by formulas typeset with MathTex / Tex.

FieldMeaning
baseURLThe directory holding the stylesheet and fonts; null when unconfigured
phaseSee the table below
errorFailure text when phase is error
phaseMeaning
unconfiguredNo katexBaseURL was given when the renderer was created, so this plugin injects no stylesheet. Formulas still render, but as unstyled plain typesetting
loadingThe stylesheet is being injected
loadedLoaded
errorThe stylesheet failed to load (hints will suggest checking whether katex.min.css and the font files are present in that directory)

This plugin always configures katexBaseURL, so inside the host this field is only ever loading, loaded or error, never unconfigured.

packages ​

Progress of on-demand fetches of third-party Python packages (packages not bundled but fetched once online, such as import pandas).

FieldMeaning
fetchingNames currently being fetched; an empty array when nothing is in flight
lastErrorA plain-language reason for the most recent fetch failure (including the tiered diagnosis conclusion). It stops appearing once a fetch succeeds

hints ​

One actionable sentence per unmet condition; an empty array when everything is satisfied. It covers only hard unmet conditions:

  • Missing WASM / WebGL / MediaRecorder;
  • Runtime startup failure;
  • Formula stylesheet load failure;
  • Package fetch failure.

"Formula stylesheet not configured" is not among them — that is a configuration choice rather than a fault, and it speaks only through the warnings of check(). The sentences in hints can be shown to users as-is; this plugin's Settings panel uses exactly these.

ts
const status = environmentStatus()
if (status.hints.length > 0) showBanner(status.hints)

CheckResult ​

The return of the renderer's check(): the outcome of one precheck.

ts
interface CheckResult {
  ok: boolean
  error?: string
  /** Non-blocking reminders (e.g. "the code contains formulas but KaTeX is not configured"); absent when there are none */
  warnings?: string[]
}

This plugin does not consume this type: the precheck on the tool side goes through runPython(python, createDryRunBridge()) and hands only ok and error to the model — warnings is neither passed through the tool nor shown in the UI (see Host Tool). It is listed here because its shape is easy to confuse with this plugin's precheck path.

Surface and RunResult ​

These two types belong to the core package; this plugin only passes them through, so their fields and behavioural contracts follow the core package docs:

  • Surface: one canvas, with five members run / replay / canvas / isRendered / dispose, all obtained from the instance returned by createSurface(). See Core package: Canvas.
  • RunResult: the outcome of one render, { ok, error?, cancelled? }. Note that cancelled being true means the canvas was destroyed and this piece of code never ran; it is not an error and nothing should be shown to the user.
ts
const result = await surface.run(python)
if (result.cancelled === true) return
if (!result.ok) showError(result.error)

DeepSeek Harness 插件系列 · 运行时与渲染引擎见核心包 manim-live