diff --git a/marimo/_code_mode/_context.py b/marimo/_code_mode/_context.py index 767f182e121..1d2fbc93361 100644 --- a/marimo/_code_mode/_context.py +++ b/marimo/_code_mode/_context.py @@ -1590,7 +1590,7 @@ async def _apply_ops( tx = Transaction(changes=tuple(doc_ops), source="code-mode") # Apply to local snapshot so _cell_label can read names. self._document.apply(tx) - self.notify( + self.broadcast_raw_notification( NotebookDocumentTransactionNotification(transaction=tx) ) @@ -1691,8 +1691,17 @@ def enqueue_command(self, command: CommandMessage) -> None: type(command).__name__, ) - def notify(self, notification: Notification) -> None: - """Send a notification to the frontend.""" + def broadcast_raw_notification(self, notification: Notification) -> None: + """Low-level: broadcast a fully-constructed ``Notification`` to the frontend. + + Escape hatch for emitting notification payloads directly; the + payload is delivered as-is, with no validation, batching, or + debouncing. Prefer a higher-level helper on ``ctx`` when one exists. + + See ``marimo._messaging.notification`` for the full discriminated + union. Agent-facing subtypes include ``BannerNotification`` (persistent + banner) and ``AlertNotification`` (modal dialog). + """ broadcast_notification(notification, stream=self._kernel.stream) # type: ignore[arg-type]