Skip to content

@jsvision/core / resolveCapabilitiesAsync

Function: resolveCapabilitiesAsync()

resolveCapabilitiesAsync(options?): Promise<CapabilityResolution>

Defined in: capability/index.ts:135

Detect the running terminal's capabilities asynchronously, additionally probing the terminal live when you pass a TerminalQuery seam (the most accurate detection available).

Always resolves, never rejects: a terminal that stays silent, replies with too much data, or sends garbage simply falls back to environment/table detection. This path never touches the sync cache — a live probe is always a fresh, per-call result.

If the probe captured bytes the user typed while it was in flight, they are returned as resolution.passthrough — feed those into your input decoder first, before reading further stdin, so no keystrokes are lost.

Parameters

options?

ResolveOptions = {}

override, injected env/platform, the live-query query seam, and timeoutMs (the probe's whole-step timeout).

Returns

Promise<CapabilityResolution>

A promise of a deep-frozen { profile, reasons } (plus optional passthrough).

Example

ts
import { resolveCapabilitiesAsync, createTerminalQuery } from '@jsvision/core';

// Requires the input stream in raw mode and flowing.
const query = createTerminalQuery(); // defaults to process std streams
try {
  const { profile } = await resolveCapabilitiesAsync({ query, timeoutMs: 200 });
  if (profile.sync2026) { ... } // terminal supports synchronized output
} finally {
  query.close();
}