Runtime data model
These TypeScript contracts describe in-memory state in v0.2.7. Persistence stores only a subset.
Cell state
Section titled “Cell state”export type CellState = "idle" | "running" | "error" | "success";| Value | Meaning |
|---|---|
idle |
The cell is not executing and has no current success/error transition. |
running |
The frontend has started an execution request and exposes the interrupt control. |
success |
The last request returned without an error field. |
error |
Kernel startup, invoke, transport, or Python execution produced an error. |
Cell state is not persisted.
Kernel state
Section titled “Kernel state”export type KernelState = "starting" | "idle" | "busy" | "stopped" | "error";| Value | Meaning |
|---|---|
starting |
Frontend is ensuring or restarting a process. |
idle |
Backend process is available. |
busy |
The frontend coordinator has reserved the tab for an execution sequence. |
stopped |
No usable process is available, or a stopped sentinel was installed. |
error |
Process or communication failure. |
Cell output
Section titled “Cell output”export interface CellOutput { outputType: "stream" | "error" | "image/png"; streamName?: "stdout" | "stderr"; text?: string; imageData?: string;}streamusesstreamNameto distinguish stdout and stderr.errorusestextfor the traceback or transport error.image/pngandimageDataare reserved. The current renderer returnsnullfor this type, and the Python server never emits it.
export interface Cell { id: string; type: "code" | "markdown"; source: string; executionCount: number | null; outputs: CellOutput[]; state: CellState;}| Field | Durable? | Notes |
|---|---|---|
id |
Yes | Generated with crypto.randomUUID() for new cells. |
type |
Yes | New cells are code; markdown is reserved. |
source |
Yes | Raw editor text. |
executionCount |
No | Assigned optimistically before invoking Rust. |
outputs |
No | Replaced on every run and cleared on restart. |
state |
No | Session-only UI state. |
Notebook
Section titled “Notebook”export interface Notebook { tabIndex: number; cells: Cell[]; kernelState: KernelState; executionCounter: number;}The store initializes notebook indices 0 through 3. Only cell identity, type, source, order, and the tab index are serialized.
Kernel response
Section titled “Kernel response”export type KernelResponse = { id: string; type: string; stdout: string; stderr: string; error: string | null; output_type: string;};The response uses snake case for output_type because it mirrors the Python JSON protocol. The frontend currently ignores that field when creating output records and derives streams from stdout, stderr, and error.
Store-wide state
Section titled “Store-wide state”The Zustand store also holds:
| Field | Type | Meaning |
|---|---|---|
notebooks |
Notebook[] |
Four notebook states. |
activeTab |
number |
Current zero-based tab index; begins at 0. |
focusedCellId |
string | null |
Temporary request to focus a newly created or advanced-to cell. |
isCommandMode |
boolean |
Intended command-mode flag set by Escape. |
Neither active-tab nor focus state is persisted.
