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 {
        dispose(): void;
        getCaps(): Promise<
            Readonly<
                {
                    colorMode: ColorMode;
                    sgrAttrsSupported: number;
                    supportsBracketedPaste: boolean;
                    supportsCursorShape: boolean;
                    supportsFocusEvents: boolean;
                    supportsMouse: boolean;
                    supportsOsc52: boolean;
                    supportsOutputWaitWritable: boolean;
                    supportsScrollRegion: boolean;
                    supportsSyncUpdate: 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

    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;
                  supportsCursorShape: boolean;
                  supportsFocusEvents: boolean;
                  supportsMouse: boolean;
                  supportsOsc52: boolean;
                  supportsOutputWaitWritable: boolean;
                  supportsScrollRegion: boolean;
                  supportsSyncUpdate: 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 are ZRDL v1 and MUST be treated as immutable by the backend.

      Parameters

      • drawlist: Uint8Array

        ZRDL v1 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>