@jsvision/core / assertEssentials
Function: assertEssentials()
assertEssentials(
caps,facts,options?):EssentialsReport
Defined in: safety/essentials.ts:139
Assert the essentials before starting: throws EssentialsNotMetError when the terminal is unusable, otherwise returns the report. Use this as the gate right before you create and start the host.
If you pass a logger, each degradation is written once at info level (a screen-safe notice — never to the terminal). This function does not touch or restore the terminal itself.
Parameters
caps
Resolved capability profile.
facts
TTY facts from detectTty(); do not pass an un-started Host.
options?
Optional { logger } to emit the one-time degradation notices.
logger?
Returns
The EssentialsReport (including any degradations) when essentials are met.
Throws
EssentialsNotMetError when the terminal lacks an essential capability.
Example
import { assertEssentials, resolveCapabilities, detectTty, createHost } from '@jsvision/core';
const caps = resolveCapabilities().profile;
assertEssentials(caps, { isTTY: detectTty() }); // throws on a non-TTY
const host = createHost({ caps });
await host.start();