Skip to content

@jsvision/core / evaluateEssentials

Function: evaluateEssentials()

evaluateEssentials(caps, facts): EssentialsReport

Defined in: safety/essentials.ts:93

Evaluate the runtime essentials against a capability profile and TTY facts, without throwing. Pure — no I/O — so it is safe to call anywhere.

The only essential is an interactive TTY (facts.isTTY). Missing non-essentials appear in degradations (no mouse → keyboard-only; monochrome → monochrome; no alternate screen → inline fallback) but never make met false.

Parameters

caps

CapabilityProfile

Resolved capability profile (from resolveCapabilities()).

facts

HostFacts

TTY facts from detectTty(); do not pass an un-started Host.

Returns

EssentialsReport

The report: the met flag, the missing essentials, and the degradations.

Example

ts
import { evaluateEssentials, resolveCapabilities, detectTty } from '@jsvision/core';

const report = evaluateEssentials(resolveCapabilities().profile, { isTTY: detectTty() });
if (!report.met) console.error('unusable terminal:', report.missing);
for (const d of report.degradations) console.warn(d.message);