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.

Export only the commands the browser builds (#11297)

Trevor Manz462d3100abed
diff --git a/frontend/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx b/frontend/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx
index 40672be6b9..2246f087ac 100644
--- a/frontend/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx
+++ b/frontend/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx
@@ -10,6 +10,7 @@ import {
import { Provider } from "jotai";
import type React from "react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { requestId } from "@/__tests__/branded";
import { MockRequestClient } from "@/__mocks__/requests";
import { ModalProvider } from "@/components/modal/ImperativeModal";
import { TooltipProvider } from "@/components/ui/tooltip";
@@ -129,7 +130,7 @@ describe("NotebookMenuDropdown", () => {
}));
invalidateDataSourceDiscovery();
vi.spyOn(DiscoverDataSources, "request").mockResolvedValue({
- request_id: "request-id",
+ request_id: requestId("request-id"),
sources: [],
});
});
@@ -142,7 +143,7 @@ describe("NotebookMenuDropdown", () => {
it("shows detected databases in the add connection submenu", async () => {
vi.mocked(DiscoverDataSources.request).mockResolvedValue({
- request_id: "request-id",
+ request_id: requestId("request-id"),
sources: [POSTGRES_SOURCE],
});
@@ -172,7 +173,7 @@ describe("NotebookMenuDropdown", () => {
it("shows detected storage in the add remote storage submenu", async () => {
vi.mocked(DiscoverDataSources.request).mockResolvedValue({
- request_id: "request-id",
+ request_id: requestId("request-id"),
sources: [S3_SOURCE],
});
diff --git a/frontend/src/components/storage/__tests__/storage-file-viewer.test.tsx b/frontend/src/components/storage/__tests__/storage-file-viewer.test.tsx
index 296a481616..4846284547 100644
--- a/frontend/src/components/storage/__tests__/storage-file-viewer.test.tsx
+++ b/frontend/src/components/storage/__tests__/storage-file-viewer.test.tsx
@@ -2,6 +2,7 @@
import { render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
+import { requestId } from "@/__tests__/branded";
import { TooltipProvider } from "@/components/ui/tooltip";
import { DownloadStorage } from "@/core/storage/request-registry";
import { StorageFileViewer } from "../storage-file-viewer";
@@ -41,7 +42,7 @@ describe("StorageFileViewer", () => {
it("renders TOML from generic storage metadata as read-only TOML", async () => {
const request = vi.spyOn(DownloadStorage, "request").mockResolvedValue({
- request_id: "request-id",
+ request_id: requestId("request-id"),
url: "https://example.com/pyproject.toml?signature=secret",
});
vi.stubGlobal(
diff --git a/frontend/src/core/codemirror/language/__tests__/sql.test.ts b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
index de08befa82..a7e9be0f69 100644
--- a/frontend/src/core/codemirror/language/__tests__/sql.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
@@ -8,6 +8,7 @@ import { EditorState, type Extension } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { DuckDBDialect } from "@marimo-team/codemirror-sql/dialects";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { requestId } from "@/__tests__/branded";
import type { CellId } from "@/core/cells/ids";
import type {
CompletionConfig,
@@ -1106,7 +1107,7 @@ describe("CustomSqlParser", () => {
const request = vi.spyOn(ValidateSQL, "request").mockResolvedValue({
error: null,
parse_result: { success: false, errors: [error] },
- request_id: "request-id",
+ request_id: requestId("request-id"),
validate_result: null,
});
const state = EditorState.create({
@@ -1150,7 +1151,7 @@ describe("CustomSqlParser", () => {
vi.spyOn(ValidateSQL, "request").mockResolvedValue({
error: null,
parse_result: { success: false, errors: [error] },
- request_id: "request-id",
+ request_id: requestId("request-id"),
validate_result: null,
});
const state = EditorState.create({
@@ -1194,7 +1195,7 @@ describe("CustomSqlParser", () => {
const request = vi.spyOn(ValidateSQL, "request").mockResolvedValue({
error: null,
parse_result: { success: false, errors: [error] },
- request_id: "request-id",
+ request_id: requestId("request-id"),
validate_result: null,
});
const state = createNamedConnectionState({
diff --git a/frontend/src/core/datasets/__tests__/data-source-discovery.test.ts b/frontend/src/core/datasets/__tests__/data-source-discovery.test.ts
index 9179da439c..784118d525 100644
--- a/frontend/src/core/datasets/__tests__/data-source-discovery.test.ts
+++ b/frontend/src/core/datasets/__tests__/data-source-discovery.test.ts
@@ -1,5 +1,7 @@
/* Copyright 2026 Marimo. All rights reserved. */
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { requestId } from "@/__tests__/branded";
+import type { DataSourceDiscoveryResult } from "@/core/kernel/messages";
import { connectionAtom } from "@/core/network/connection";
import { store } from "@/core/state/jotai";
import { ConnectionState } from "@/core/websocket/types";
@@ -41,7 +43,7 @@ describe("fetchDataSourceDiscovery", () => {
it("shares a single in-flight request across concurrent callers", async () => {
const request = vi
.spyOn(DiscoverDataSources, "request")
- .mockResolvedValue({ request_id: "request-id", sources: [] });
+ .mockResolvedValue({ request_id: requestId("request-id"), sources: [] });
await Promise.all([
fetchDataSourceDiscovery(),
@@ -55,7 +57,7 @@ describe("fetchDataSourceDiscovery", () => {
it("re-runs discovery after the cache is invalidated", async () => {
const request = vi
.spyOn(DiscoverDataSources, "request")
- .mockResolvedValue({ request_id: "request-id", sources: [] });
+ .mockResolvedValue({ request_id: requestId("request-id"), sources: [] });
await fetchDataSourceDiscovery();
invalidateDataSourceDiscovery();
@@ -68,7 +70,10 @@ describe("fetchDataSourceDiscovery", () => {
const request = vi
.spyOn(DiscoverDataSources, "request")
.mockRejectedValueOnce(new Error("boom"))
- .mockResolvedValueOnce({ request_id: "request-id", sources: [] });
+ .mockResolvedValueOnce({
+ request_id: requestId("request-id"),
+ sources: [],
+ });
await expect(fetchDataSourceDiscovery()).rejects.toThrow("boom");
await expect(fetchDataSourceDiscovery()).resolves.toEqual([]);
@@ -77,16 +82,18 @@ describe("fetchDataSourceDiscovery", () => {
it("does not clear a newer cache entry when an invalidated request fails", async () => {
let rejectFirstRequest: ((error: Error) => void) | undefined;
- const firstRequest = new Promise<{
- request_id: string;
- sources: DetectedDataSource[];
- }>((_resolve, reject) => {
- rejectFirstRequest = reject;
- });
+ const firstRequest = new Promise<DataSourceDiscoveryResult>(
+ (_resolve, reject) => {
+ rejectFirstRequest = reject;
+ },
+ );
const request = vi
.spyOn(DiscoverDataSources, "request")
.mockReturnValueOnce(firstRequest)
- .mockResolvedValueOnce({ request_id: "request-id", sources: [] });
+ .mockResolvedValueOnce({
+ request_id: requestId("request-id"),
+ sources: [],
+ });
const staleResult = fetchDataSourceDiscovery().catch((error) => error);
await vi.waitFor(() => expect(request).toHaveBeenCalledTimes(1));
@@ -116,7 +123,7 @@ describe("fetchDataSourceDiscovery", () => {
}),
];
vi.spyOn(DiscoverDataSources, "request").mockResolvedValue({
- request_id: "request-id",
+ request_id: requestId("request-id"),
sources,
});
diff --git a/frontend/src/core/islands/bridge.ts b/frontend/src/core/islands/bridge.ts
index f22960128d..dcf2a7d996 100644
--- a/frontend/src/core/islands/bridge.ts
+++ b/frontend/src/core/islands/bridge.ts
@@ -7,7 +7,7 @@ import { throwNotImplemented } from "@/utils/functions";
import { Logger } from "@/utils/Logger";
import { generateUUID } from "@/utils/uuid";
import { initialNotebookState, notebookAtom } from "../cells/cells";
-import type { CommandMessage } from "../kernel/messages";
+import type { ClientCommand } from "../kernel/messages";
import type { EditRequests, RunRequests } from "../network/types";
import { store as defaultStore } from "../state/jotai";
import { getMarimoExportContext } from "../static/export-context";
@@ -392,7 +392,7 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
// The kernel uses msgspec to parse control requests, which requires a 'type'
// field for discriminated union deserialization.
private async putControlRequest(
- operation: CommandMessage,
+ operation: ClientCommand,
session?: AppSession,
): Promise<void> {
session ??= await this.getActiveSession();
diff --git a/frontend/src/core/kernel/messages.ts b/frontend/src/core/kernel/messages.ts
index 6d074bfe99..76b420d489 100644
--- a/frontend/src/core/kernel/messages.ts
+++ b/frontend/src/core/kernel/messages.ts
@@ -55,7 +55,7 @@ export type Capabilities =
export type CacheInfoFetched = NotificationMessageData<"cache-info">;
export type NotificationMessage = schemas["KnownUnions"]["notification"];
-export type CommandMessage = schemas["KnownUnions"]["command"];
+export type ClientCommand = schemas["KnownUnions"]["command"];
export type NotificationMessageType = NotificationMessage["op"];
export interface NotificationPayload {
diff --git a/frontend/src/core/wasm/bridge.ts b/frontend/src/core/wasm/bridge.ts
index 8e3ebf0735..5fc8ca87df 100644
--- a/frontend/src/core/wasm/bridge.ts
+++ b/frontend/src/core/wasm/bridge.ts
@@ -11,7 +11,7 @@ import { reloadSafe } from "@/utils/reload-safe";
import { generateUUID } from "@/utils/uuid";
import { createModuleWorker } from "@/utils/worker";
import { notebookIsRunningAtom } from "../cells/cells";
-import type { CommandMessage } from "../kernel/messages";
+import type { ClientCommand } from "../kernel/messages";
import { getInitialAppMode } from "../mode";
import { API } from "../network/api";
import { withDevAssetUrl } from "../network/export-asset-url";
@@ -711,7 +711,7 @@ export class PyodideBridge implements RunRequests, EditRequests {
public listStorageEntries = throwNotImplemented;
public downloadStorage = throwNotImplemented;
- private async putControlRequest(operation: CommandMessage) {
+ private async putControlRequest(operation: ClientCommand) {
await this.rpc.proxy.request.bridge({
functionName: "put_control_request",
payload: operation,
diff --git a/frontend/src/core/wasm/worker/types.ts b/frontend/src/core/wasm/worker/types.ts
index 041b95877c..1e36394698 100644
--- a/frontend/src/core/wasm/worker/types.ts
+++ b/frontend/src/core/wasm/worker/types.ts
@@ -3,7 +3,7 @@ import type { PyodideInterface } from "pyodide";
import type { WasmRuntimeConfig } from "../runtime-config";
import type { UserConfig } from "@/core/config/config-schema";
import type {
- CommandMessage,
+ ClientCommand,
NotificationPayload,
} from "@/core/kernel/messages";
import type { JsonString } from "@/utils/json/base64";
@@ -74,7 +74,7 @@ export interface WasmController {
}
export interface RawBridge {
- put_control_request(operation: CommandMessage): Promise<string>;
+ put_control_request(operation: ClientCommand): Promise<string>;
put_input(input: string): Promise<string>;
code_complete(request: CodeCompletionRequest): Promise<string>;
read_code(): Promise<{ contents: string }>;
diff --git a/marimo/_cli/development/commands.py b/marimo/_cli/development/commands.py
index a97c5cc345..40148d0d76 100644
--- a/marimo/_cli/development/commands.py
+++ b/marimo/_cli/development/commands.py
@@ -18,7 +18,7 @@ from marimo._cli.help_formatter import ColoredCommand, ColoredGroup
from marimo._data.models import DataType
from marimo._messaging.errors import Error as MarimoError
from marimo._messaging.notification import NotificationMessage
-from marimo._runtime.commands import CommandMessage
+from marimo._runtime.commands import ClientCommand
if TYPE_CHECKING:
import psutil
@@ -232,7 +232,6 @@ def _generate_server_api_schema() -> dict[str, Any]:
from marimo._messaging.cell_output import CellChannel, CellOutput
from marimo._messaging.mimetypes import KnownMimeType
from marimo._metadata import opengraph
- from marimo._runtime import commands
from marimo._runtime.packages.package_manager import PackageDescription
from marimo._schemas import export
from marimo._server.ai.tools.types import ToolDefinition
@@ -341,11 +340,9 @@ def _generate_server_api_schema() -> dict[str, Any]:
opengraph.OpenGraphMetadata,
files.FileInfo,
files.FileRoot,
- commands.ExecuteCellCommand,
snippets.SnippetSection,
snippets.Snippet,
snippets.Snippets,
- commands.UpdateUIElementCommand,
# Requests/responses
completion.VariableContext,
completion.SchemaColumn,
@@ -405,32 +402,6 @@ def _generate_server_api_schema() -> dict[str, Any]:
home.ShutdownSessionRequest,
home.WorkspaceFilesRequest,
home.WorkspaceFilesResponse,
- commands.ClearCacheCommand,
- commands.CodeCompletionCommand,
- commands.DebugCellCommand,
- commands.DeleteCellCommand,
- commands.DiscoverDataSourcesCommand,
- commands.ExecuteCellsCommand,
- commands.ExecuteScratchpadCommand,
- commands.ExecuteStaleCellsCommand,
- commands.ExecuteCellCommand,
- commands.GetCacheInfoCommand,
- commands.HTTPRequest,
- commands.InstallPackagesCommand,
- commands.InvokeFunctionCommand,
- commands.ListDataSourceConnectionCommand,
- commands.ListSecretKeysCommand,
- commands.ListSQLTablesCommand,
- commands.ListSQLSchemasCommand,
- commands.ModelMessage,
- commands.PreviewDatasetColumnCommand,
- commands.PreviewSQLTableCommand,
- commands.RenameNotebookCommand,
- commands.StopKernelCommand,
- commands.UpdateCellConfigCommand,
- commands.UpdateUserConfigCommand,
- commands.ModelCommand,
- commands.ValidateSQLCommand,
models.BaseResponse,
models.ClearCacheRequest,
models.CodeCompletionRequest,
@@ -478,19 +449,21 @@ def _generate_server_api_schema() -> dict[str, Any]:
models.ValidateSQLRequest,
]
- # Hack to get the unions to be included in the schema
+ # Hack to get the unions included in the schema.
class KnownUnions(msgspec.Struct):
notification: NotificationMessage
- command: CommandMessage
+ # Commands are exported only through ClientCommand and its dependencies.
+ command: ClientCommand
error: MarimoError
data_type: DataType
+ roots = [*MODELS, KnownUnions]
_defs, component_schemas = msgspec.json.schema_components(
- MODELS + [KnownUnions],
+ roots,
ref_template="#/components/schemas/{name}",
)
- _enrich_branded_types(component_schemas, MODELS)
+ _enrich_branded_types(component_schemas, roots)
schemas_generator = SchemaGenerator(
{
diff --git a/marimo/_runtime/commands.py b/marimo/_runtime/commands.py
index a9ab67de00..161ebc1979 100644
--- a/marimo/_runtime/commands.py
+++ b/marimo/_runtime/commands.py
@@ -243,6 +243,7 @@ class SetBreakpointsCommand(Command):
return f"SetBreakpointsCommand(count={count})"
+# TODO(MO-8007): Remove when run commands use document revisions.
class ExecuteCellCommand(Command):
"""Execute a single cell.
@@ -269,6 +270,7 @@ class ExecuteCellCommand(Command):
)
+# TODO(MO-8007): Have the host compute and run stale cells.
class ExecuteStaleCellsCommand(Command):
"""Execute all stale cells.
@@ -282,6 +284,7 @@ class ExecuteStaleCellsCommand(Command):
request: HTTPRequest | None = None
+# TODO(MO-8007): Run roots against a document revision.
class ExecuteCellsCommand(Command):
"""Execute multiple cells in a batch.
@@ -330,6 +333,7 @@ class ExecuteCellsCommand(Command):
)
+# TODO(MO-8007): Reconcile the graph as part of a run.
class SyncGraphCommand(Command):
"""Synchronize the kernel graph with file manager state.
@@ -370,13 +374,10 @@ class SyncGraphCommand(Command):
]
+# TODO(MO-8007): Apply the edited revision with a rootless run.
class EditCellsCommand(Command):
"""Apply one edit of the notebook's cells to the kernel.
- TODO(MO-8002): Replace this temporary command with synchronization of
- a versioned notebook document replica in the kernel. Replica updates
- must be applied before any execution trigger.
-
Sent when the notebook changes without a run, as a host edit does.
Changed code is registered without running, so no later run uses
code the notebook no longer has. Deletions and configs take effect
@@ -394,6 +395,7 @@ class EditCellsCommand(Command):
delete_ids: list[CellId_t]
+# TODO(MO-8007): Run the scratch cell against a document revision.
class ExecuteScratchpadCommand(Command):
"""Execute code in the scratchpad.
@@ -433,6 +435,7 @@ class ExecuteScratchpadCommand(Command):
allow_stdin: bool = True
+# TODO(MO-8007): Move renaming to the notebook entry.
class RenameNotebookCommand(Command):
"""Rename or move the notebook file.
@@ -555,6 +558,7 @@ class AppMetadata(msgspec.Struct, rename="camel"):
docstring: str | None = None
+# TODO(MO-8007): Replace with graph reconciliation against the revision.
class UpdateCellConfigCommand(Command):
"""Update cell configuration.
@@ -585,6 +589,7 @@ class UpdateUserConfigCommand(Command):
return "UpdateUserConfigCommand(config=...)"
+# TODO(MO-8007): Run all cells, or no roots for a lazy start.
class CreateNotebookCommand(Command):
"""Instantiate and initialize a notebook.
@@ -605,6 +610,7 @@ class CreateNotebookCommand(Command):
request: HTTPRequest | None = None
+# TODO(MO-8007): Replace with graph reconciliation against the revision.
class DeleteCellCommand(Command):
"""Delete a cell from the notebook.
@@ -618,6 +624,7 @@ class DeleteCellCommand(Command):
cell_id: CellId_t
+# TODO(MO-8007): Replace with Backend.stop.
class StopKernelCommand(Command):
"""Stop kernel execution.
@@ -969,30 +976,15 @@ class GetCacheInfoCommand(Command):
"""
-CommandMessage = (
- # Notebook operations
- CreateNotebookCommand
- | RenameNotebookCommand
- | CodeCompletionCommand
- # Cell execution and management
- | ExecuteCellsCommand
+ClientCommand = (
+ ExecuteCellsCommand
| ExecuteScratchpadCommand
- | ExecuteStaleCellsCommand
- | DebugCellCommand
- | SetBreakpointsCommand
| DeleteCellCommand
- | SyncGraphCommand
- | EditCellsCommand
| UpdateCellConfigCommand
- # Package management
- | InstallPackagesCommand
- # UI element and widget model operations
| UpdateUIElementCommand
| ModelCommand
| InvokeFunctionCommand
- # User/configuration operations
- | UpdateUserConfigCommand
- # Data SQL operations
+ | InstallPackagesCommand
| PreviewDatasetColumnCommand
| PreviewSQLTableCommand
| ListSQLTablesCommand
@@ -1000,17 +992,37 @@ CommandMessage = (
| ValidateSQLCommand
| ListDataSourceConnectionCommand
| DiscoverDataSourcesCommand
- # Storage operations
+ | ListSecretKeysCommand
+)
+"""Kernel commands the frontend can construct and submit directly."""
+
+# TODO(MO-8007): Consolidate into revision-based run, start, and stop.
+NotebookCommand = (
+ CreateNotebookCommand
+ | SyncGraphCommand
+ | EditCellsCommand
+ | ExecuteStaleCellsCommand
+ | RenameNotebookCommand
+ | StopKernelCommand
+)
+"""Commands whose subject is the whole notebook, issued by its owner.
+
+Only the server builds these, from the document it holds. They are the
+kernel side of the core `Backend` interface.
+"""
+CommandMessage = (
+ ClientCommand
+ | NotebookCommand
+ # Requests the server converts to commands
+ | CodeCompletionCommand
+ | DebugCellCommand
+ | SetBreakpointsCommand
+ | UpdateUserConfigCommand
| StorageListEntriesCommand
| StorageDownloadCommand
- # Secrets management
- | ListSecretKeysCommand
| RefreshSecretsCommand
- # Cache management
| ClearCacheCommand
| GetCacheInfoCommand
- # Kernel operations
- | StopKernelCommand
)
"""Union of all command messages.
diff --git a/packages/openapi/api.yaml b/packages/openapi/api.yaml
index 401ce507f8..f4247af772 100644
--- a/packages/openapi/api.yaml
+++ b/packages/openapi/api.yaml
@@ -717,45 +717,11 @@ components:
- uiMessages
title: ChatRequest
type: object
- ClearCacheCommand:
- description: "Clear all cached data.\n\n Clears all cache contexts, freeing\
- \ memory and disk space.\n Affects all cells using the @cache decorator."
- properties:
- type:
- enum:
- - clear-cache
- required:
- - type
- title: ClearCacheCommand
- type: object
ClearCacheRequest:
properties: {}
required: []
title: ClearCacheRequest
type: object
- CodeCompletionCommand:
- description: "Request code completion suggestions.\n\n Sent when the user\
- \ requests autocomplete. Provides code context up to\n the cursor position\
- \ for the language server.\n\n Attributes:\n id: Unique identifier\
- \ for this request.\n document: Source code up to the cursor position.\n\
- \ cell_id: Cell where completion is requested."
- properties:
- cellId:
- $ref: '#/components/schemas/CellId'
- document:
- type: string
- id:
- $ref: '#/components/schemas/RequestId'
- type:
- enum:
- - code-completion
- required:
- - type
- - id
- - document
- - cellId
- title: CodeCompletionCommand
- type: object
CodeCompletionRequest:
properties:
cellId:
@@ -1033,42 +999,6 @@ components:
- config
title: CreateCell
type: object
- CreateNotebookCommand:
- description: "Instantiate and initialize a notebook.\n\n Sent when a notebook\
- \ is first loaded. Contains all cells and initial UI element values.\n\n \
- \ Attributes:\n execution_requests: ExecuteCellCommand for each notebook\
- \ cell.\n cell_ids: Initial cell IDs in the notebook.\n set_ui_element_value_request:\
- \ Initial UI element values.\n auto_run: Whether to automatically execute\
- \ cells on instantiation.\n request: HTTP request context if available."
- properties:
- autoRun:
- type: boolean
- cellIds:
- items:
- type: string
- type: array
- executionRequests:
- items:
- $ref: '#/components/schemas/ExecuteCellCommand'
- type: array
- request:
- anyOf:
- - $ref: '#/components/schemas/HTTPRequest'
- - type: 'null'
- default: null
- setUiElementValueRequest:
- $ref: '#/components/schemas/UpdateUIElementCommand'
- type:
- enum:
- - create-notebook
- required:
- - type
- - executionRequests
- - cellIds
- - setUiElementValueRequest
- - autoRun
- title: CreateNotebookCommand
- type: object
CreateSecretRequest:
properties:
key:
@@ -1222,7 +1152,7 @@ components:
enum:
- data-source-discovery-result
request_id:
- type: string
+ $ref: '#/components/schemas/RequestId'
sources:
items:
$ref: '#/components/schemas/DetectedDataSource'
@@ -1418,26 +1348,6 @@ components:
required: []
title: DatasourcesConfig
type: object
- DebugCellCommand:
- description: "Enter debugger mode for a cell.\n\n Starts the Python debugger\
- \ (pdb) for the specified cell.\n\n Attributes:\n cell_id: Cell\
- \ to debug.\n request: HTTP request context if available."
- properties:
- cellId:
- $ref: '#/components/schemas/CellId'
- request:
- anyOf:
- - $ref: '#/components/schemas/HTTPRequest'
- - type: 'null'
- default: null
- type:
- enum:
- - debug-cell
- required:
- - type
- - cellId
- title: DebugCellCommand
- type: object
DebugCellRequest:
properties:
cellId:
@@ -1741,41 +1651,6 @@ components:
- theme
title: DisplayConfig
type: object
- EditCellsCommand:
- description: "Apply one edit of the notebook's cells to the kernel.\n\n TODO(MO-8002):\
- \ Replace this temporary command with synchronization of\n a versioned\
- \ notebook document replica in the kernel. Replica updates\n must be applied\
- \ before any execution trigger.\n\n Sent when the notebook changes without\
- \ a run, as a host edit does.\n Changed code is registered without running,\
- \ so no later run uses\n code the notebook no longer has. Deletions and\
- \ configs take effect\n together, before any cell runs because of them,\
- \ so a cell the edit\n deletes or disables does not run when a cell it\
- \ depended on goes.\n\n Attributes:\n codes: New code for each cell\
- \ the edit created or changed.\n configs: New config for each cell\
- \ the edit created or reconfigured.\n delete_ids: Cells the edit removed."
- properties:
- codes:
- additionalProperties:
- type: string
- type: object
- configs:
- additionalProperties:
- type: object
- type: object
- deleteIds:
- items:
- type: string
- type: array
- type:
- enum:
- - edit-cells
- required:
- - type
- - codes
- - configs
- - deleteIds
- title: EditCellsCommand
- type: object
EnvironmentOperation:
description: Current progress and logs for one execution of environment work.
properties:
@@ -1956,33 +1831,6 @@ components:
- hash
title: EsmSpec
type: object
- ExecuteCellCommand:
- description: "Execute a single cell.\n\n Executes a cell with the provided\
- \ code. Dependent cells may be\n re-executed based on the reactive execution\
- \ mode.\n\n Attributes:\n cell_id: Cell to execute.\n code:\
- \ Python code to execute.\n request: HTTP request context if available.\n\
- \ timestamp: Unix timestamp when command was created."
- properties:
- cellId:
- $ref: '#/components/schemas/CellId'
- code:
- type: string
- request:
- anyOf:
- - $ref: '#/components/schemas/HTTPRequest'
- - type: 'null'
- default: null
- timestamp:
- type: number
- type:
- enum:
- - execute-cell
- required:
- - type
- - cellId
- - code
- title: ExecuteCellCommand
- type: object
ExecuteCellsCommand:
description: "Execute multiple cells in a batch.\n\n Executes multiple cells\
\ with their corresponding code. The kernel manages\n dependency tracking\
@@ -2124,24 +1972,6 @@ components:
- code
title: ExecuteScratchpadRequest
type: object
- ExecuteStaleCellsCommand:
- description: "Execute all stale cells.\n\n Cells become stale when their\
- \ dependencies change but haven't been\n re-executed yet. Brings the notebook\
- \ to a consistent state.\n\n Attributes:\n request: HTTP request\
- \ context if available."
- properties:
- request:
- anyOf:
- - $ref: '#/components/schemas/HTTPRequest'
- - type: 'null'
- default: null
- type:
- enum:
- - execute-stale-cells
- required:
- - type
- title: ExecuteStaleCellsCommand
- type: object
ExecutionNotification:
description: "An attempt's lifecycle, independent of a cell's displayed status.\n\
\n `planned` supplies the source and identity before output is reported.\n\
@@ -2155,7 +1985,7 @@ components:
- type: 'null'
default: null
cell_id:
- type: string
+ $ref: '#/components/schemas/CellId'
code:
anyOf:
- type: string
@@ -2789,17 +2619,6 @@ components:
- found
title: FunctionCallResultNotification
type: object
- GetCacheInfoCommand:
- description: "Retrieve cache statistics.\n\n Collects cache usage info across\
- \ all contexts (hit/miss rates, time saved, disk usage)."
- properties:
- type:
- enum:
- - get-cache-info
- required:
- - type
- title: GetCacheInfoCommand
- type: object
GetCacheInfoRequest:
properties: {}
required: []
@@ -3269,23 +3088,14 @@ components:
properties:
command:
anyOf:
- - $ref: '#/components/schemas/CreateNotebookCommand'
- - $ref: '#/components/schemas/RenameNotebookCommand'
- - $ref: '#/components/schemas/CodeCompletionCommand'
- $ref: '#/components/schemas/ExecuteCellsCommand'
- $ref: '#/components/schemas/ExecuteScratchpadCommand'
- - $ref: '#/components/schemas/ExecuteStaleCellsCommand'
- - $ref: '#/components/schemas/DebugCellCommand'
- - $ref: '#/components/schemas/SetBreakpointsCommand'
- $ref: '#/components/schemas/DeleteCellCommand'
- - $ref: '#/components/schemas/SyncGraphCommand'
- - $ref: '#/components/schemas/EditCellsCommand'
- $ref: '#/components/schemas/UpdateCellConfigCommand'
- - $ref: '#/components/schemas/InstallPackagesCommand'
- $ref: '#/components/schemas/UpdateUIElementCommand'
- $ref: '#/components/schemas/ModelCommand'
- $ref: '#/components/schemas/InvokeFunctionCommand'
- - $ref: '#/components/schemas/UpdateUserConfigCommand'
+ - $ref: '#/components/schemas/InstallPackagesCommand'
- $ref: '#/components/schemas/PreviewDatasetColumnCommand'
- $ref: '#/components/schemas/PreviewSQLTableCommand'
- $ref: '#/components/schemas/ListSQLTablesCommand'
@@ -3293,26 +3103,13 @@ components:
- $ref: '#/components/schemas/ValidateSQLCommand'
- $ref: '#/components/schemas/ListDataSourceConnectionCommand'
- $ref: '#/components/schemas/DiscoverDataSourcesCommand'
- - $ref: '#/components/schemas/StorageListEntriesCommand'
- - $ref: '#/components/schemas/StorageDownloadCommand'
- $ref: '#/components/schemas/ListSecretKeysCommand'
- - $ref: '#/components/schemas/RefreshSecretsCommand'
- - $ref: '#/components/schemas/ClearCacheCommand'
- - $ref: '#/components/schemas/GetCacheInfoCommand'
- - $ref: '#/components/schemas/StopKernelCommand'
discriminator:
mapping:
- clear-cache: '#/components/schemas/ClearCacheCommand'
- code-completion: '#/components/schemas/CodeCompletionCommand'
- create-notebook: '#/components/schemas/CreateNotebookCommand'
- debug-cell: '#/components/schemas/DebugCellCommand'
delete-cell: '#/components/schemas/DeleteCellCommand'
discover-data-sources: '#/components/schemas/DiscoverDataSourcesCommand'
- edit-cells: '#/components/schemas/EditCellsCommand'
execute-cells: '#/components/schemas/ExecuteCellsCommand'
execute-scratchpad: '#/components/schemas/ExecuteScratchpadCommand'
- execute-stale-cells: '#/components/schemas/ExecuteStaleCellsCommand'
- get-cache-info: '#/components/schemas/GetCacheInfoCommand'
install-packages: '#/components/schemas/InstallPackagesCommand'
invoke-function: '#/components/schemas/InvokeFunctionCommand'
list-data-source-connection: '#/components/schemas/ListDataSourceConnectionCommand'
@@ -3322,16 +3119,8 @@ components:
model: '#/components/schemas/ModelCommand'
preview-dataset-column: '#/components/schemas/PreviewDatasetColumnCommand'
preview-sql-table: '#/components/schemas/PreviewSQLTableCommand'
- refresh-secrets: '#/components/schemas/RefreshSecretsCommand'
- rename-notebook: '#/components/schemas/RenameNotebookCommand'
- set-breakpoints: '#/components/schemas/SetBreakpointsCommand'
- stop-kernel: '#/components/schemas/StopKernelCommand'
- storage-download: '#/components/schemas/StorageDownloadCommand'
- storage-list-entries: '#/components/schemas/StorageListEntriesCommand'
- sync-graph: '#/components/schemas/SyncGraphCommand'
update-cell-config: '#/components/schemas/UpdateCellConfigCommand'
update-ui-element: '#/components/schemas/UpdateUIElementCommand'
- update-user-config: '#/components/schemas/UpdateUserConfigCommand'
validate-sql: '#/components/schemas/ValidateSQLCommand'
propertyName: type
data_type:
@@ -4216,7 +4005,7 @@ components:
update: '#/components/schemas/ModelUpdate'
propertyName: method
model_id:
- type: string
+ $ref: '#/components/schemas/WidgetModelId'
op:
enum:
- model-lifecycle
@@ -4900,17 +4689,6 @@ components:
- op
title: ReconnectedNotification
type: object
- RefreshSecretsCommand:
- description: "Refresh secrets from the secrets store.\n\n Reloads secrets\
- \ from the provider without restarting the kernel."
- properties:
- type:
- enum:
- - refresh-secrets
- required:
- - type
- title: RefreshSecretsCommand
- type: object
ReloadNotification:
description: Instructs frontend to reload the page.
properties:
@@ -4949,21 +4727,6 @@ components:
- cell_id
title: RemoveUIElementsNotification
type: object
- RenameNotebookCommand:
- description: "Rename or move the notebook file.\n\n Updates the notebook's\
- \ filename in the kernel metadata.\n\n Attributes:\n filename: New\
- \ filename or path for the notebook."
- properties:
- filename:
- type: string
- type:
- enum:
- - rename-notebook
- required:
- - type
- - filename
- title: RenameNotebookCommand
- type: object
RenameNotebookRequest:
properties:
filename:
@@ -5500,33 +5263,6 @@ components:
SessionId:
format: session-id
type: string
- SetBreakpointsCommand:
- description: "Set the live debugger's breakpoints (session-scoped, not persisted).\n\
- \n Replaces the full breakpoint set: the frontend always sends the complete\n\
- \ map of cell id -> 1-based line numbers. Only meaningful when the\n \
- \ `debugger` experimental feature is enabled.\n\n Attributes:\n \
- \ breakpoints: Map of cell id to lines that have a breakpoint.\n request:\
- \ HTTP request context if available."
- properties:
- breakpoints:
- additionalProperties:
- items:
- type: integer
- type: array
- type: object
- request:
- anyOf:
- - $ref: '#/components/schemas/HTTPRequest'
- - type: 'null'
- default: null
- type:
- enum:
- - set-breakpoints
- required:
- - type
- - breakpoints
- title: SetBreakpointsCommand
- type: object
SetBreakpointsRequest:
properties:
breakpoints:
@@ -5828,46 +5564,6 @@ components:
- text
title: StdinRequest
type: object
- StopKernelCommand:
- description: "Stop kernel execution.\n\n Signals the kernel to stop processing\
- \ and shut down gracefully.\n Used when closing a notebook or terminating\
- \ a session."
- properties:
- type:
- enum:
- - stop-kernel
- required:
- - type
- title: StopKernelCommand
- type: object
- StorageDownloadCommand:
- description: "Download a storage entry.\n\n Obtains a pre-signed URL or downloads\
- \ the file locally and returns a virtual file URL\n so the frontend can\
- \ fetch the contents.\n\n Attributes:\n request_id: Unique identifier\
- \ for this request.\n namespace: Variable name identifying the storage\
- \ backend.\n path: Full path of the entry to download.\n preview:\
- \ If true, a local preview of the file is returned.\n This is useful\
- \ if you need to bypass CORS."
- properties:
- namespace:
- type: string
- path:
- type: string
- preview:
- default: false
- type: boolean
- requestId:
- type: string
- type:
- enum:
- - storage-download
- required:
- - type
- - requestId
- - namespace
- - path
- title: StorageDownloadCommand
- type: object
StorageDownloadReadyNotification:
description: "Signals that a storage file download is ready.\n\n The url\
\ may be a signed cloud URL (preferred) or a virtual file URL\n (fallback\
@@ -5890,7 +5586,7 @@ components:
enum:
- storage-download-ready
request_id:
- type: string
+ $ref: '#/components/schemas/RequestId'
url:
anyOf:
- type: string
@@ -5957,7 +5653,7 @@ components:
- type: 'null'
default: null
request_id:
- type: string
+ $ref: '#/components/schemas/RequestId'
required:
- op
- request_id
@@ -6021,41 +5717,6 @@ components:
- backendTypes
title: StorageHidesWhen
type: object
- StorageListEntriesCommand:
- description: "List storage entries at a prefix.\n\n Navigates storage like\
- \ a folder tree using delimiter-based listing.\n Returns entries (files/objects)\
- \ and virtual directories at one level.\n\n Attributes:\n request_id:\
- \ Unique identifier for this request.\n namespace: Variable name identifying\
- \ the storage backend.\n limit: Max entries to return.\n prefix:\
- \ Path prefix to list (None = root).\n page_token: Token for the next\
- \ page of entries."
- properties:
- limit:
- type: integer
- namespace:
- type: string
- pageToken:
- anyOf:
- - type: string
- - type: 'null'
- default: null
- prefix:
- anyOf:
- - type: string
- - type: 'null'
- default: null
- requestId:
- type: string
- type:
- enum:
- - storage-list-entries
- required:
- - type
- - requestId
- - namespace
- - limit
- title: StorageListEntriesCommand
- type: object
StorageListEntriesRequest:
properties:
limit:
@@ -6153,39 +5814,6 @@ components:
required: []
title: SuccessResponse
type: object
- SyncGraphCommand:
- description: "Synchronize the kernel graph with file manager state.\n\n Used\
- \ when the notebook file changes externally (e.g., file reload or version\
- \ control).\n Updates changed cells, deletes removed cells, and optionally\
- \ executes modified cells.\n\n Attributes:\n cells: All cells known\
- \ to file manager, mapping cell_id to code.\n run_ids: Cells to execute\
- \ or update.\n delete_ids: Cells to delete from the graph.\n \
- \ timestamp: Unix timestamp when command was created."
- properties:
- cells:
- additionalProperties:
- type: string
- type: object
- deleteIds:
- items:
- type: string
- type: array
- runIds:
- items:
- type: string
- type: array
- timestamp:
- type: number
- type:
- enum:
- - sync-graph
- required:
- - type
- - cells
- - runIds
- - deleteIds
- title: SyncGraphCommand
- type: object
SyncSandboxResponse:
properties:
error:
@@ -6484,21 +6112,6 @@ components:
- values
title: UpdateUIElementValuesRequest
type: object
- UpdateUserConfigCommand:
- description: "Update user configuration.\n\n Updates global marimo configuration\
- \ (runtime settings, display options, editor preferences).\n\n Attributes:\n\
- \ config: Complete user configuration."
- properties:
- config:
- $ref: '#/components/schemas/MarimoConfig'
- type:
- enum:
- - update-user-config
- required:
- - type
- - config
- title: UpdateUserConfigCommand
- type: object
UpdateUserConfigRequest:
properties:
config:
@@ -6586,7 +6199,7 @@ components:
- type: 'null'
default: null
request_id:
- type: string
+ $ref: '#/components/schemas/RequestId'
validate_result:
anyOf:
- $ref: '#/components/schemas/SqlCatalogCheckResult'
diff --git a/packages/openapi/src/api.ts b/packages/openapi/src/api.ts
index c30d4afefb..f616c699c5 100644
--- a/packages/openapi/src/api.ts
+++ b/packages/openapi/src/api.ts
@@ -4281,38 +4281,8 @@ export interface components {
/** @default null */
variables?: (string | components["schemas"]["VariableContext"])[] | null;
};
- /**
- * ClearCacheCommand
- * @description Clear all cached data.
- *
- * Clears all cache contexts, freeing memory and disk space.
- * Affects all cells using the @cache decorator.
- */
- ClearCacheCommand: {
- /** @enum {unknown} */
- type: "clear-cache";
- };
/** ClearCacheRequest */
ClearCacheRequest: Record<string, any>;
- /**
- * CodeCompletionCommand
- * @description Request code completion suggestions.
- *
- * Sent when the user requests autocomplete. Provides code context up to
- * the cursor position for the language server.
- *
- * Attributes:
- * id: Unique identifier for this request.
- * document: Source code up to the cursor position.
- * cell_id: Cell where completion is requested.
- */
- CodeCompletionCommand: {
- cellId: components["schemas"]["CellId"];
- document: string;
- id: components["schemas"]["RequestId"];
- /** @enum {unknown} */
- type: "code-completion";
- };
/** CodeCompletionRequest */
CodeCompletionRequest: {
cellId: components["schemas"]["CellId"];
@@ -4469,29 +4439,6 @@ export interface components {
/** @enum {unknown} */
type: "create-cell";
};
- /**
- * CreateNotebookCommand
- * @description Instantiate and initialize a notebook.
- *
- * Sent when a notebook is first loaded. Contains all cells and initial UI element values.
- *
- * Attributes:
- * execution_requests: ExecuteCellCommand for each notebook cell.
- * cell_ids: Initial cell IDs in the notebook.
- * set_ui_element_value_request: Initial UI element values.
- * auto_run: Whether to automatically execute cells on instantiation.
- * request: HTTP request context if available.
- */
- CreateNotebookCommand: {
- autoRun: boolean;
- cellIds: string[];
- executionRequests: components["schemas"]["ExecuteCellCommand"][];
- /** @default null */
- request?: components["schemas"]["HTTPRequest"] | null;
- setUiElementValueRequest: components["schemas"]["UpdateUIElementCommand"];
- /** @enum {unknown} */
- type: "create-notebook";
- };
/** CreateSecretRequest */
CreateSecretRequest: {
key: string;
@@ -4579,7 +4526,7 @@ export interface components {
DataSourceDiscoveryResultNotification: {
/** @enum {unknown} */
op: "data-source-discovery-result";
- request_id: string;
+ request_id: components["schemas"]["RequestId"];
sources: components["schemas"]["DetectedDataSource"][];
};
/**
@@ -4697,23 +4644,6 @@ export interface components {
auto_discover_schemas?: boolean | "auto";
auto_discover_tables?: boolean | "auto";
};
- /**
- * DebugCellCommand
- * @description Enter debugger mode for a cell.
- *
- * Starts the Python debugger (pdb) for the specified cell.
- *
- * Attributes:
- * cell_id: Cell to debug.
- * request: HTTP request context if available.
- */
- DebugCellCommand: {
- cellId: components["schemas"]["CellId"];
- /** @default null */
- request?: components["schemas"]["HTTPRequest"] | null;
- /** @enum {unknown} */
- type: "debug-cell";
- };
/** DebugCellRequest */
DebugCellRequest: {
cellId: components["schemas"]["CellId"];
@@ -4876,36 +4806,6 @@ export interface components {
/** @enum {unknown} */
theme: "dark" | "light" | "system";
};
- /**
- * EditCellsCommand
- * @description Apply one edit of the notebook's cells to the kernel.
- *
- * TODO(MO-8002): Replace this temporary command with synchronization of
- * a versioned notebook document replica in the kernel. Replica updates
- * must be applied before any execution trigger.
- *
- * Sent when the notebook changes without a run, as a host edit does.
- * Changed code is registered without running, so no later run uses
- * code the notebook no longer has. Deletions and configs take effect
- * together, before any cell runs because of them, so a cell the edit
- * deletes or disables does not run when a cell it depended on goes.
- *
- * Attributes:
- * codes: New code for each cell the edit created or changed.
- * configs: New config for each cell the edit created or reconfigured.
- * delete_ids: Cells the edit removed.
- */
- EditCellsCommand: {
- codes: {
- [key: string]: string;
- };
- configs: {
- [key: string]: Record<string, any>;
- };
- deleteIds: string[];
- /** @enum {unknown} */
- type: "edit-cells";
- };
/**
* EnvironmentOperation
* @description Current progress and logs for one execution of environment work.
@@ -5016,28 +4916,6 @@ export interface components {
hash: string;
url: string;
};
- /**
- * ExecuteCellCommand
- * @description Execute a single cell.
- *
- * Executes a cell with the provided code. Dependent cells may be
- * re-executed based on the reactive execution mode.
- *
- * Attributes:
- * cell_id: Cell to execute.
- * code: Python code to execute.
- * request: HTTP request context if available.
- * timestamp: Unix timestamp when command was created.
- */
- ExecuteCellCommand: {
- cellId: components["schemas"]["CellId"];
- code: string;
- /** @default null */
- request?: components["schemas"]["HTTPRequest"] | null;
- timestamp?: number;
- /** @enum {unknown} */
- type: "execute-cell";
- };
/**
* ExecuteCellsCommand
* @description Execute multiple cells in a batch.
@@ -5124,22 +5002,6 @@ export interface components {
/** @default null */
runId?: string | null;
};
- /**
- * ExecuteStaleCellsCommand
- * @description Execute all stale cells.
- *
- * Cells become stale when their dependencies change but haven't been
- * re-executed yet. Brings the notebook to a consistent state.
- *
- * Attributes:
- * request: HTTP request context if available.
- */
- ExecuteStaleCellsCommand: {
- /** @default null */
- request?: components["schemas"]["HTTPRequest"] | null;
- /** @enum {unknown} */
- type: "execute-stale-cells";
- };
/**
* ExecutionNotification
* @description An attempt's lifecycle, independent of a cell's displayed status.
@@ -5152,7 +5014,7 @@ export interface components {
ExecutionNotification: {
/** @default null */
caused_by?: string | null;
- cell_id: string;
+ cell_id: components["schemas"]["CellId"];
/** @default null */
code?: string | null;
execution_id: string;
@@ -5486,16 +5348,6 @@ export interface components {
return_value: unknown;
status: components["schemas"]["HumanReadableStatus"];
};
- /**
- * GetCacheInfoCommand
- * @description Retrieve cache statistics.
- *
- * Collects cache usage info across all contexts (hit/miss rates, time saved, disk usage).
- */
- GetCacheInfoCommand: {
- /** @enum {unknown} */
- type: "get-cache-info";
- };
/** GetCacheInfoRequest */
GetCacheInfoRequest: Record<string, any>;
/**
@@ -5807,23 +5659,14 @@ export interface components {
/** KnownUnions */
KnownUnions: {
command:
- | components["schemas"]["CreateNotebookCommand"]
- | components["schemas"]["RenameNotebookCommand"]
- | components["schemas"]["CodeCompletionCommand"]
| components["schemas"]["ExecuteCellsCommand"]
| components["schemas"]["ExecuteScratchpadCommand"]
- | components["schemas"]["ExecuteStaleCellsCommand"]
- | components["schemas"]["DebugCellCommand"]
- | components["schemas"]["SetBreakpointsCommand"]
| components["schemas"]["DeleteCellCommand"]
- | components["schemas"]["SyncGraphCommand"]
- | components["schemas"]["EditCellsCommand"]
| components["schemas"]["UpdateCellConfigCommand"]
- | components["schemas"]["InstallPackagesCommand"]
| components["schemas"]["UpdateUIElementCommand"]
| components["schemas"]["ModelCommand"]
| components["schemas"]["InvokeFunctionCommand"]
- | components["schemas"]["UpdateUserConfigCommand"]
+ | components["schemas"]["InstallPackagesCommand"]
| components["schemas"]["PreviewDatasetColumnCommand"]
| components["schemas"]["PreviewSQLTableCommand"]
| components["schemas"]["ListSQLTablesCommand"]
@@ -5831,13 +5674,7 @@ export interface components {
| components["schemas"]["ValidateSQLCommand"]
| components["schemas"]["ListDataSourceConnectionCommand"]
| components["schemas"]["DiscoverDataSourcesCommand"]
- | components["schemas"]["StorageListEntriesCommand"]
- | components["schemas"]["StorageDownloadCommand"]
- | components["schemas"]["ListSecretKeysCommand"]
- | components["schemas"]["RefreshSecretsCommand"]
- | components["schemas"]["ClearCacheCommand"]
- | components["schemas"]["GetCacheInfoCommand"]
- | components["schemas"]["StopKernelCommand"];
+ | components["schemas"]["ListSecretKeysCommand"];
/** @enum {unknown} */
data_type:
| "boolean"
@@ -6354,7 +6191,7 @@ export interface components {
| components["schemas"]["ModelUpdate"]
| components["schemas"]["ModelCustom"]
| components["schemas"]["ModelClose"];
- model_id: string;
+ model_id: components["schemas"]["WidgetModelId"];
/** @enum {unknown} */
op: "model-lifecycle";
};
@@ -6766,16 +6603,6 @@ export interface components {
/** @enum {unknown} */
op: "reconnected";
};
- /**
- * RefreshSecretsCommand
- * @description Refresh secrets from the secrets store.
- *
- * Reloads secrets from the provider without restarting the kernel.
- */
- RefreshSecretsCommand: {
- /** @enum {unknown} */
- type: "refresh-secrets";
- };
/**
* ReloadNotification
* @description Instructs frontend to reload the page.
@@ -6804,20 +6631,6 @@ export interface components {
/** @enum {unknown} */
op: "remove-ui-elements";
};
- /**
- * RenameNotebookCommand
- * @description Rename or move the notebook file.
- *
- * Updates the notebook's filename in the kernel metadata.
- *
- * Attributes:
- * filename: New filename or path for the notebook.
- */
- RenameNotebookCommand: {
- filename: string;
- /** @enum {unknown} */
- type: "rename-notebook";
- };
/** RenameNotebookRequest */
RenameNotebookRequest: {
filename: string;
@@ -7161,27 +6974,6 @@ export interface components {
};
/** Format: session-id */
SessionId: TypedString<"SessionId">;
- /**
- * SetBreakpointsCommand
- * @description Set the live debugger's breakpoints (session-scoped, not persisted).
- *
- * Replaces the full breakpoint set: the frontend always sends the complete
- * map of cell id -> 1-based line numbers. Only meaningful when the
- * `debugger` experimental feature is enabled.
- *
- * Attributes:
- * breakpoints: Map of cell id to lines that have a breakpoint.
- * request: HTTP request context if available.
- */
- SetBreakpointsCommand: {
- breakpoints: {
- [key: string]: number[];
- };
- /** @default null */
- request?: components["schemas"]["HTTPRequest"] | null;
- /** @enum {unknown} */
- type: "set-breakpoints";
- };
/** SetBreakpointsRequest */
SetBreakpointsRequest: {
breakpoints: {
@@ -7365,40 +7157,6 @@ export interface components {
StdinRequest: {
text: string;
};
- /**
- * StopKernelCommand
- * @description Stop kernel execution.
- *
- * Signals the kernel to stop processing and shut down gracefully.
- * Used when closing a notebook or terminating a session.
- */
- StopKernelCommand: {
- /** @enum {unknown} */
- type: "stop-kernel";
- };
- /**
- * StorageDownloadCommand
- * @description Download a storage entry.
- *
- * Obtains a pre-signed URL or downloads the file locally and returns a virtual file URL
- * so the frontend can fetch the contents.
- *
- * Attributes:
- * request_id: Unique identifier for this request.
- * namespace: Variable name identifying the storage backend.
- * path: Full path of the entry to download.
- * preview: If true, a local preview of the file is returned.
- * This is useful if you need to bypass CORS.
- */
- StorageDownloadCommand: {
- namespace: string;
- path: string;
- /** @default false */
- preview?: boolean;
- requestId: string;
- /** @enum {unknown} */
- type: "storage-download";
- };
/**
* StorageDownloadReadyNotification
* @description Signals that a storage file download is ready.
@@ -7419,7 +7177,7 @@ export interface components {
filename?: string | null;
/** @enum {unknown} */
op: "storage-download-ready";
- request_id: string;
+ request_id: components["schemas"]["RequestId"];
/** @default null */
url?: string | null;
};
@@ -7457,7 +7215,7 @@ export interface components {
prefix?: string | null;
/** @default null */
query?: string | null;
- request_id: string;
+ request_id: components["schemas"]["RequestId"];
};
/**
* StorageEntry
@@ -7492,31 +7250,6 @@ export interface components {
kind: "storage";
protocols: string[];
};
- /**
- * StorageListEntriesCommand
- * @description List storage entries at a prefix.
- *
- * Navigates storage like a folder tree using delimiter-based listing.
- * Returns entries (files/objects) and virtual directories at one level.
- *
- * Attributes:
- * request_id: Unique identifier for this request.
- * namespace: Variable name identifying the storage backend.
- * limit: Max entries to return.
- * prefix: Path prefix to list (None = root).
- * page_token: Token for the next page of entries.
- */
- StorageListEntriesCommand: {
- limit: number;
- namespace: string;
- /** @default null */
- pageToken?: string | null;
- /** @default null */
- prefix?: string | null;
- requestId: string;
- /** @enum {unknown} */
- type: "storage-list-entries";
- };
/** StorageListEntriesRequest */
StorageListEntriesRequest: {
limit: number;
@@ -7574,29 +7307,6 @@ export interface components {
/** @default true */
success?: boolean;
};
- /**
- * SyncGraphCommand
- * @description Synchronize the kernel graph with file manager state.
- *
- * Used when the notebook file changes externally (e.g., file reload or version control).
- * Updates changed cells, deletes removed cells, and optionally executes modified cells.
- *
- * Attributes:
- * cells: All cells known to file manager, mapping cell_id to code.
- * run_ids: Cells to execute or update.
- * delete_ids: Cells to delete from the graph.
- * timestamp: Unix timestamp when command was created.
- */
- SyncGraphCommand: {
- cells: {
- [key: string]: string;
- };
- deleteIds: string[];
- runIds: string[];
- timestamp?: number;
- /** @enum {unknown} */
- type: "sync-graph";
- };
/** SyncSandboxResponse */
SyncSandboxResponse: {
/** @default null */
@@ -7784,20 +7494,6 @@ export interface components {
objectIds: components["schemas"]["UIElementId"][];
values: unknown[];
};
- /**
- * UpdateUserConfigCommand
- * @description Update user configuration.
- *
- * Updates global marimo configuration (runtime settings, display options, editor preferences).
- *
- * Attributes:
- * config: Complete user configuration.
- */
- UpdateUserConfigCommand: {
- config: components["schemas"]["MarimoConfig"];
- /** @enum {unknown} */
- type: "update-user-config";
- };
/** UpdateUserConfigRequest */
UpdateUserConfigRequest: {
config: components["schemas"]["MarimoConfig"];
@@ -7854,7 +7550,7 @@ export interface components {
op: "validate-sql-result";
/** @default null */
parse_result?: components["schemas"]["SqlParseResult"] | null;
- request_id: string;
+ request_id: components["schemas"]["RequestId"];
/** @default null */
validate_result?: components["schemas"]["SqlCatalogCheckResult"] | null;
};
diff --git a/tests/_cli/test_cli_development.py b/tests/_cli/test_cli_development.py
index 3794e669ef..3c35179838 100644
--- a/tests/_cli/test_cli_development.py
+++ b/tests/_cli/test_cli_development.py
@@ -3,10 +3,39 @@ from __future__ import annotations
import json
import subprocess
-from typing import Any
+from typing import Any, get_args
import yaml
+from marimo._cli.development.commands import _generate_server_api_schema
+from marimo._runtime import commands
+
+
+def test_openapi_exports_only_client_commands() -> None:
+ schemas = _generate_server_api_schema()["components"]["schemas"]
+ command_names = {
+ model.__name__
+ for model in vars(commands).values()
+ if isinstance(model, type) and issubclass(model, commands.Command)
+ }
+
+ assert command_names & schemas.keys() == {
+ command.__name__ for command in get_args(commands.ClientCommand)
+ }
+
+
+def test_openapi_preserves_brands_in_client_commands() -> None:
+ schemas = _generate_server_api_schema()["components"]["schemas"]
+
+ assert schemas["ExecuteCellsCommand"]["properties"]["cellIds"] == {
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/CellId"},
+ }
+ assert schemas["UpdateUIElementCommand"]["properties"]["objectIds"] == {
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/UIElementId"},
+ }
+
def _normalize_union_order(schema: Any) -> Any:
if isinstance(schema, list):
diff --git a/tests/_session/test_capabilities.py b/tests/_session/test_capabilities.py
index 7ca35704dd..bdcb822b93 100644
--- a/tests/_session/test_capabilities.py
+++ b/tests/_session/test_capabilities.py
@@ -113,3 +113,12 @@ def test_editor_can_do_everything() -> None:
assert consumer_can(EDITOR, commands.ExecuteCellsCommand) is True
assert consumer_can(EDITOR, commands.UpdateUIElementCommand) is True
assert consumer_can(EDITOR, commands.InvokeFunctionCommand) is True
+
+
+def test_client_and_notebook_commands_are_disjoint() -> None:
+ client = set(typing.get_args(commands.ClientCommand))
+ notebook = set(typing.get_args(commands.NotebookCommand))
+
+ assert not (client & notebook), sorted(
+ c.__name__ for c in client & notebook
+ )