Rezi
    Preparing search index...

    Interface RuntimeBackend

    Backend interface for the app runtime.

    The app runtime is backend-agnostic but requires a backend with explicit buffer ownership. The Node backend's worker protocol is one implementation of this contract.

    docs/backend/worker-model.md for the Node implementation details.

    interface RuntimeBackend {
        getTerminalProfile?: () => Promise<
            Readonly<
                {
                    cellHeightPx: number;
                    cellWidthPx: number;
                    id: string;
                    supportsColoredUnderlines: boolean;
                    supportsHyperlinks: boolean;
                    supportsIterm2Images: boolean;
                    supportsKittyGraphics: boolean;
                    supportsSixel: boolean;
                    supportsUnderlineStyles: boolean;
                    versionString: string;
                },
            >,
        >;
        dispose(): void;
        getCaps(): Promise<
            Readonly<
                {
                    colorMode: ColorMode;
                    sgrAttrsSupported: number;
                    supportsBracketedPaste: boolean;
                    supportsColoredUnderlines: boolean;
                    supportsCursorShape: boolean;
                    supportsFocusEvents: boolean;
                    supportsHyperlinks: boolean;
                    supportsMouse: boolean;
                    supportsOsc52: boolean;
                    supportsOutputWaitWritable: boolean;
                    supportsScrollRegion: boolean;
                    supportsSyncUpdate: boolean;
                    supportsUnderlineStyles: boolean;
                },
            >,
        >;
        pollEvents(): Promise<
            Readonly<
                { bytes: Uint8Array; droppedBatches: number; release: () => void },
            >,
        >;
        postUserEvent(tag: number, payload: Uint8Array): void;
        requestFrame(drawlist: Uint8Array): Promise<void>;
        start(): Promise<void>;
        stop(): Promise<void>;
    }
    Index

    Properties

    getTerminalProfile?: () => Promise<
        Readonly<
            {
                cellHeightPx: number;
                cellWidthPx: number;
                id: string;
                supportsColoredUnderlines: boolean;
                supportsHyperlinks: boolean;
                supportsIterm2Images: boolean;
                supportsKittyGraphics: boolean;
                supportsSixel: boolean;
                supportsUnderlineStyles: boolean;
                versionString: string;
            },
        >,
    >

    Optional detailed terminal profile.

    Backends that do not expose this may omit it; callers should fall back to getCaps() and derive a conservative profile.

    Methods

    • Get terminal capabilities.

      Resolves with the terminal's capability snapshot. Should be called after start() to get accurate values.

      Returns Promise<
          Readonly<
              {
                  colorMode: ColorMode;
                  sgrAttrsSupported: number;
                  supportsBracketedPaste: boolean;
                  supportsColoredUnderlines: boolean;
                  supportsCursorShape: boolean;
                  supportsFocusEvents: boolean;
                  supportsHyperlinks: boolean;
                  supportsMouse: boolean;
                  supportsOsc52: boolean;
                  supportsOutputWaitWritable: boolean;
                  supportsScrollRegion: boolean;
                  supportsSyncUpdate: boolean;
                  supportsUnderlineStyles: boolean;
              },
          >,
      >

      Terminal capabilities

    • Poll for the next event batch.

      This is poll-based rather than callback-based to avoid callbacks from native. Resolves with the next batch when available.

      Returns Promise<
          Readonly<
              { bytes: Uint8Array; droppedBatches: number; release: () => void },
          >,
      >

    • Post a user event without blocking.

      This is thread-safe and can wake a blocking engine poll.

      Parameters

      • tag: number

        User-defined tag for the event

      • payload: Uint8Array

        Arbitrary payload bytes

      Returns void

    • Submit a frame to be rendered.

      Frame submission is async and must not block the main thread. Drawlist bytes MUST match the backend's negotiated ZRDL version and MUST be treated as immutable by the backend.

      Parameters

      • drawlist: Uint8Array

        ZRDL drawlist bytes

      Returns Promise<void>

    • Start the backend (initialize engine, enter raw mode, etc.). Resolves when the backend is ready to process frames.

      Returns Promise<void>

    • Stop the backend (exit raw mode, cleanup). Resolves when stopped.

      Returns Promise<void>