Navigated to /docs/core/api/runtime-contracts

Runtime contracts API

Shared state helpers, storage and unsubscribe contracts, diagnostics, and API stability metadata.

Runtime contracts exports

16 public exports, grouped under their canonical import boundary.

@tavojs/core

Canonical import boundary for every symbol in this section.

ApiStability#

type ApiStability = "stable" | "experimental";

Defines the api stability contract used by the application runtime.

Related guide

ApiStabilityEntry#

type ApiStabilityEntry = {
    level: ApiStability;
    since: string;
    note: string;
};

Describes one entry in api stability in the application runtime.

Related guide

formatTavoError#

formatTavoError(error: TavoError): string

Produces a human-readable diagnostic while preserving the stable code for logs and tooling.

Related guide

getApiStability#

getApiStability(entryPoint: "@tavojs/core" | "@tavojs/core/config" | "@tavojs/core/dev" | "@tavojs/core/jsx-dev-runtime" | "@tavojs/core/jsx-runtime" | "@tavojs/core/plugin" | "@tavojs/core/router" | "@tavojs/core/server" | "@tavojs/core/server-only"): ApiStabilityEntry

Reads api stability for the application runtime.

Related guide

isTavoError#

isTavoError(error: unknown): error is TavoError

Reports whether the current value satisfies tavo error for the application runtime.

Related guide

shallowEqual#

shallowEqual(left: unknown, right: unknown): boolean

Provides shallow equal behavior for the application runtime.

Related guide

StatePatch#

type StatePatch<T extends Record<string, unknown>> = Partial<T> | ((previous: T) => Partial<T>);

Defines the state patch contract used by the application runtime.

Related guide

StateUpdater#

type StateUpdater<T extends Record<string, unknown>> = T | ((previous: T) => T);

Defines the state updater contract used by the application runtime.

Related guide

StorageLike#

type StorageLike = {
    getItem(key: string): string | null;
    setItem(key: string, value: string): void;
    removeItem?(key: string): void;
};

Defines the storage like contract used by the application runtime.

Related guide

TAVO_API_STABILITY#

TAVO_API_STABILITY: Readonly<{ "@tavojs/core": { level: "stable"; since: string; note: string; }; "@tavojs/core/config": { level: "stable"; since: string; note: string; }; "@tavojs/core/dev": { level: "experimental"; since: string; note: string; }; "@tavojs/core/jsx-dev-runtime": { level: "stable"; since: string; note: string; }; "@tavojs/core/jsx-runtime": { level: "stable"; since: string; note: string; }; "@tavojs/core/plugin": { level: "stable"; since: string; note: string; }; "@tavojs/core/router": { level: "stable"; since: string; note: string; }; "@tavojs/core/server": { level: "stable"; since: string; note: string; }; "@tavojs/core/server-only": { level: "stable"; since: string; note: string; }; }>

Machine-readable stability contract for public package entry points. Stable entry points follow semantic versioning from Tavo.js 1.0 onward.

Related guide

TAVO_DIAGNOSTIC_MESSAGES#

TAVO_DIAGNOSTIC_MESSAGES: Readonly<{ readonly TAVO_PAGES_001: "The resolved page cache limit is invalid."; readonly TAVO_PAGES_002: "The client root element is missing."; readonly TAVO_PAGES_003: "The auto-discovery pattern is unsupported."; readonly TAVO_PAGES_004: "The bundler page-discovery API is unavailable."; readonly TAVO_PAGES_005: "Server bootstrap is missing page modules."; readonly TAVO_PAGES_006: "A page module declares conflicting static generation options."; readonly TAVO_SSR_001: "The canonical SSR origin is invalid."; readonly TAVO_CONFIG_001: "A server-only module reached the client bundle."; readonly TAVO_CONFIG_002: "A likely secret environment value is referenced by client code."; readonly TAVO_PLUGIN_001: "A plugin targets an unsupported Tavo.js plugin API version."; readonly TAVO_PLUGIN_002: "A plugin manifest or identity is invalid."; readonly TAVO_PLUGIN_003: "Plugin ownership or contribution is duplicated."; readonly TAVO_PLUGIN_004: "A plugin dependency or capability requirement is not satisfied."; readonly TAVO_PLUGIN_005: "A plugin dependency or ordering graph contains a cycle."; readonly TAVO_PLUGIN_006: "A plugin requested a reserved resource or missing permission."; readonly TAVO_PLUGIN_007: "A plugin phase does not implement its declared manifest."; readonly TAVO_PLUGIN_008: "A plugin failed during initialization or build."; readonly TAVO_PLUGIN_009: "A plugin failed while handling or disposing a request."; readonly TAVO_HYDRATION_001: "Strict hydration detected a server/client mismatch."; }>

Exposes the tavo diagnostic messages constant used by the application runtime.

Related guide

TavoDiagnosticCode#

type TavoDiagnosticCode = keyof typeof TAVO_DIAGNOSTIC_MESSAGES;

Defines the tavo diagnostic code contract used by the application runtime.

Related guide

TavoError#

class TavoError extends Error {
    readonly code: TavoDiagnosticCode;
    readonly details?: Readonly<Record<string, unknown>>;
    readonly hint?: string;
    constructor(code: TavoDiagnosticCode, message?: string, options?: TavoErrorOptions);
}

Framework error with a stable code and optional structured remediation context.

Related guide

TavoErrorOptions#

type TavoErrorOptions = {
    cause?: unknown;
    details?: Readonly<Record<string, unknown>>;
    hint?: string;
};

Configures tavo error in the application runtime.

Related guide

TavoPublicEntryPoint#

type TavoPublicEntryPoint = keyof typeof TAVO_API_STABILITY;

Defines the tavo public entry point contract used by the application runtime.

Related guide

Unsubscribe#

type Unsubscribe = () => void;

Defines the unsubscribe contract used by the application runtime.

Related guide