Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

770 B
Raw Blame
/* Copyright 2026 Marimo. All rights reserved. */

/** A notebook's events and commands, from a host or a stand-in for one. */

import type { NotebookClient, NotebookTransport } from "@marimo-team/client";
import type { NotebookId } from "@marimo-team/client/protocol";

/** Events and commands for a notebook, independent of React or a replica. */
export interface NotebookBackend {
  readonly transport: NotebookTransport;
  /**
   * Commands for a notebook the transport reported.
   *
   * Method presence is not permission. The notebook advertises its operations.
   */
  notebook(id: NotebookId): Pick<NotebookClient, "edit" | "save">;
  /** Whether the host is reachable before an explicit reconnect. Absent means always. */
  checkHealth?(): Promise<boolean>;
}