@marimo-team/islands 0.25.3-dev446 → 0.25.3-dev453

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/{ErrorBoundary-CBvdOZsh.js → ErrorBoundary-CIYMOu2p.js} +1 -1
  2. package/dist/assets/__vite-browser-external-D2z_TiUO.js +1 -0
  3. package/dist/assets/{worker-BUqfWMtI.js → worker-DLJ9P24O.js} +2 -2
  4. package/dist/{chat-ui-9oyUBL6M.js → chat-ui-DEHpKH2l.js} +17 -19
  5. package/dist/{code-visibility-BVsBD2bm.js → code-visibility-BQE60zOk.js} +7 -7
  6. package/dist/{common-Cz5kXzjw.js → common-DfUux6zJ.js} +4902 -4893
  7. package/dist/{data-grid-overlay-editor-B-PHwg_F.js → data-grid-overlay-editor-B9zW4oN1.js} +1 -1
  8. package/dist/{error-entries-CWdDf7iZ.js → error-entries-BG7ifiDg.js} +1368 -996
  9. package/dist/{feedback-button-DKfgWMh1.js → feedback-button-BEUh4iQQ.js} +129 -129
  10. package/dist/{glide-data-editor-BMrcgCud.js → glide-data-editor-CbdIXPTZ.js} +3 -3
  11. package/dist/{globals-vjja83iL.js → globals-BkxG-Y8L.js} +1 -1
  12. package/dist/{html-to-image-CexRSGAZ.js → html-to-image-9HLBGrIx.js} +4115 -4103
  13. package/dist/main.js +6562 -6671
  14. package/dist/{number-overlay-editor-CQvIdVeX.js → number-overlay-editor-BFzdth50.js} +1 -1
  15. package/dist/{process-output-hcyVRJCC.js → process-output-B8HPq5iZ.js} +2 -2
  16. package/dist/{reveal-component-DF7VRfN2.js → reveal-component-DK_-9fAX.js} +166 -167
  17. package/package.json +1 -1
  18. package/src/__mocks__/executions.ts +7 -4
  19. package/src/__mocks__/notebook.ts +20 -4
  20. package/src/components/editor/cell/DeleteButton.tsx +2 -2
  21. package/src/components/editor/cell/StopButton.tsx +2 -2
  22. package/src/components/editor/cell/useRunCells.ts +0 -3
  23. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +1 -1
  24. package/src/components/editor/notebook-cell.tsx +4 -35
  25. package/src/components/editor/output/ansi-reduce.ts +124 -61
  26. package/src/components/editor/output/console/ConsoleOutput.tsx +7 -25
  27. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +15 -44
  28. package/src/components/editor/renderers/cells-renderer.tsx +2 -5
  29. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +1 -1
  30. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +3 -6
  31. package/src/components/editor/stdin-blocking-alert.tsx +14 -18
  32. package/src/components/scratchpad/scratchpad.test.tsx +1 -1
  33. package/src/components/scratchpad/scratchpad.tsx +5 -6
  34. package/src/components/slides/__tests__/cell-output-block.test.tsx +2 -2
  35. package/src/components/slides/__tests__/slide-cell-view.test.tsx +2 -2
  36. package/src/components/tracing/tracing-spec.ts +11 -1
  37. package/src/components/tracing/tracing.tsx +4 -0
  38. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +10 -20
  39. package/src/core/ai/context/providers/__tests__/error.test.ts +5 -27
  40. package/src/core/ai/context/providers/cell-output.ts +4 -12
  41. package/src/core/cells/__tests__/cell.test.ts +1 -169
  42. package/src/core/cells/__tests__/cells.test.ts +32 -709
  43. package/src/core/cells/__tests__/clear-outputs.test.ts +21 -14
  44. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +71 -2
  45. package/src/core/cells/__tests__/logs.test.ts +18 -29
  46. package/src/core/cells/__tests__/runs.test.ts +128 -431
  47. package/src/core/cells/__tests__/session.test.ts +9 -9
  48. package/src/core/cells/actions.ts +29 -7
  49. package/src/core/cells/cell.ts +1 -96
  50. package/src/core/cells/cells.ts +147 -117
  51. package/src/core/cells/collapseConsoleOutputs.tsx +71 -40
  52. package/src/core/cells/command-console.ts +46 -0
  53. package/src/core/cells/execution-console.ts +230 -0
  54. package/src/core/cells/focus.ts +9 -29
  55. package/src/core/cells/logs.ts +10 -2
  56. package/src/core/cells/runs.ts +62 -118
  57. package/src/core/cells/session.ts +2 -2
  58. package/src/core/cells/types.ts +30 -23
  59. package/src/core/cells/useAnswerPrompt.ts +29 -0
  60. package/src/core/errors/error-entries.ts +3 -4
  61. package/src/core/executions/__tests__/atoms.test.ts +6 -20
  62. package/src/core/executions/__tests__/input.test.ts +3 -3
  63. package/src/core/executions/__tests__/output-lifecycle.test.ts +2 -8
  64. package/src/core/executions/atoms.ts +2 -21
  65. package/src/core/executions/index.ts +2 -1
  66. package/src/core/executions/input.ts +4 -3
  67. package/src/core/executions/output.ts +3 -3
  68. package/src/core/islands/__tests__/bridge.test.ts +59 -0
  69. package/src/core/islands/bootstrap.ts +29 -12
  70. package/src/core/islands/bridge.ts +67 -13
  71. package/src/core/kernel/handlers.ts +2 -21
  72. package/src/core/kernel/messages.ts +0 -1
  73. package/src/core/network/types.ts +0 -1
  74. package/src/core/notebook/document/__tests__/codemirror.test.ts +1 -0
  75. package/src/core/notebook/replica/__tests__/executions.test.ts +1 -0
  76. package/src/core/notebook/replica/__tests__/replica.test.ts +113 -0
  77. package/src/core/notebook/replica/replica.ts +106 -12
  78. package/src/core/notebook/replica/resources/executions.ts +57 -4
  79. package/src/core/session/__tests__/backend.test.ts +2 -4
  80. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +1 -0
  81. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +601 -35
  82. package/src/core/session/useNotebookReplica.ts +20 -6
  83. package/src/core/session/useNotebookSession.tsx +63 -33
  84. package/src/core/static/virtual-file-tracker.ts +26 -8
  85. package/src/stories/layout/vertical/one-column.stories.tsx +18 -12
  86. package/dist/assets/__vite-browser-external-CpRgw4M_.js +0 -1
  87. package/src/components/editor/alerts/stdin-blocking-alert.tsx +0 -68
  88. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -703
@@ -43,8 +43,6 @@ describe("ConsoleOutput integration", () => {
43
43
  cellName: "test_cell",
44
44
  consoleOutputs: [] as WithResponse<OutputMessage>[],
45
45
  stale: false,
46
- interrupted: false,
47
- debuggerActive: false,
48
46
  onSubmitDebugger: () => {
49
47
  // noop
50
48
  },
@@ -75,16 +73,15 @@ describe("ConsoleOutput pdb history", () => {
75
73
  cellName: "test_cell",
76
74
  consoleOutputs: [] as WithResponse<OutputMessage>[],
77
75
  stale: false,
78
- interrupted: false,
79
- debuggerActive: false,
80
76
  onSubmitDebugger: vi.fn(),
81
77
  };
82
78
 
83
79
  const stdinPrompt = (
84
80
  data: string,
85
- response?: string,
81
+ response?: string | null,
86
82
  ): WithResponse<OutputMessage> => ({
87
83
  channel: "stdin" as const,
84
+ input_id: "prompt-1",
88
85
  mimetype: "text/plain",
89
86
  data,
90
87
  timestamp: 0,
@@ -140,7 +137,7 @@ describe("ConsoleOutput pdb history", () => {
140
137
  fireEvent.change(input, { target: { value: "next" } });
141
138
  fireEvent.keyDown(input, { key: "Enter" });
142
139
 
143
- expect(onSubmitDebugger).toHaveBeenCalledWith("next", 0);
140
+ expect(onSubmitDebugger).toHaveBeenCalledWith("next", "prompt-1");
144
141
 
145
142
  // Simulate server response: old stdin gets a response, new stdin prompt appears
146
143
  const outputs2: WithResponse<OutputMessage>[] = [
@@ -172,6 +169,7 @@ describe("ConsoleOutput pdb history", () => {
172
169
  it("submits passwords without making them available to input history", () => {
173
170
  const passwordPrompt: WithResponse<OutputMessage> = {
174
171
  ...stdinPrompt("Password: "),
172
+ input_id: "password-1",
175
173
  mimetype: "text/password",
176
174
  };
177
175
  const onSubmitDebugger = vi.fn();
@@ -209,7 +207,7 @@ describe("ConsoleOutput pdb history", () => {
209
207
  fireEvent.keyDown(input, { key: "Enter" });
210
208
  expect(onSubmitDebugger).toHaveBeenLastCalledWith(
211
209
  "getpass-regression-secret",
212
- 1,
210
+ passwordPrompt.input_id,
213
211
  );
214
212
  expect(input).toHaveValue("");
215
213
 
@@ -251,7 +249,7 @@ describe("ConsoleOutput pdb history", () => {
251
249
  input.value = "marimo";
252
250
  fireEvent.keyDown(input, { key: "Enter" });
253
251
 
254
- expect(onSubmitDebugger).toHaveBeenCalledWith("marimo", 0);
252
+ expect(onSubmitDebugger).toHaveBeenCalledWith("marimo", "prompt-1");
255
253
  });
256
254
 
257
255
  it("should submit an empty string when Enter is pressed with no input", () => {
@@ -272,7 +270,7 @@ describe("ConsoleOutput pdb history", () => {
272
270
  const input = screen.getByTestId("console-input");
273
271
  fireEvent.keyDown(input, { key: "Enter" });
274
272
 
275
- expect(onSubmitDebugger).toHaveBeenCalledWith("", 0);
273
+ expect(onSubmitDebugger).toHaveBeenCalledWith("", "prompt-1");
276
274
  });
277
275
 
278
276
  it("should not record empty submissions in input history", () => {
@@ -421,43 +419,18 @@ describe("ConsoleOutput pdb history", () => {
421
419
  expect(input).toHaveValue("");
422
420
  });
423
421
 
424
- it("should distinguish an interrupted prompt from a bare-Enter submission", () => {
425
- // After interrupt, cell.ts coerces pending stdin prompts to response: "".
426
- // We must render that case differently from a real bare-Enter response,
427
- // so the user isn't told they "submitted" a blank value.
428
- const interruptedOutputs: WithResponse<OutputMessage>[] = [
429
- stdinPrompt("Press Enter to continue: ", ""),
430
- ];
431
-
432
- const { rerender } = renderWithProvider(
422
+ it.each([
423
+ [null, false],
424
+ ["", true],
425
+ ] as const)("renders a closed prompt with response %s", (response, empty) => {
426
+ renderWithProvider(
433
427
  <ConsoleOutput
434
428
  {...defaultProps}
435
- consoleOutputs={interruptedOutputs}
436
- interrupted={true}
429
+ consoleOutputs={[stdinPrompt("Press Enter to continue: ", response)]}
437
430
  />,
438
431
  );
439
-
440
- // No response chunk should be rendered for an interrupted pending prompt.
441
- expect(screen.queryByLabelText("stdin response")).not.toBeInTheDocument();
442
-
443
- // Same outputs, but the cell isn't interrupted -- this is a real
444
- // bare-Enter submission, so we should render the (empty) placeholder.
445
- rerender(
446
- <Provider store={store}>
447
- <DocumentProvider model={model}>
448
- <TooltipProvider>
449
- <ConsoleOutput
450
- {...defaultProps}
451
- consoleOutputs={interruptedOutputs}
452
- interrupted={false}
453
- />
454
- </TooltipProvider>
455
- </DocumentProvider>
456
- </Provider>,
457
- );
458
-
459
- expect(screen.getByLabelText("stdin response")).toBeInTheDocument();
460
- expect(screen.getByText("(empty)")).toBeInTheDocument();
432
+ expect(screen.queryByTestId("console-input")).not.toBeInTheDocument();
433
+ expect(screen.queryByText("(empty)") !== null).toBe(empty);
461
434
  });
462
435
  });
463
436
 
@@ -486,8 +459,6 @@ describe("ConsoleOutput debounced clearing", () => {
486
459
  cellName: "test_cell",
487
460
  consoleOutputs: [] as WithResponse<OutputMessage>[],
488
461
  stale: false,
489
- interrupted: false,
490
- debuggerActive: false,
491
462
  onSubmitDebugger: vi.fn(),
492
463
  };
493
464
 
@@ -3,9 +3,8 @@
3
3
  import { useAtomValue } from "jotai";
4
4
  import type React from "react";
5
5
  import { memo, type PropsWithChildren } from "react";
6
- import { flattenTopLevelNotebookCells, useNotebook } from "@/core/cells/cells";
6
+ import { renderedNotebookCellsAtom } from "@/core/cells/cells";
7
7
  import type { AppConfig } from "@/core/config/config-schema";
8
- import { cellOutputsAtom } from "@/core/executions";
9
8
  import { resolveLayoutData } from "@/core/layout/layout";
10
9
  import {
11
10
  resolveLayoutType,
@@ -70,10 +69,8 @@ interface PluginCellRendererProps extends PropsWithChildren<Props> {
70
69
  export const PluginCellRenderer = (props: PluginCellRendererProps) => {
71
70
  const { appConfig, mode, plugin } = props;
72
71
  const layoutState = useLayoutState();
73
- const notebook = useNotebook();
74
- const outputs = useAtomValue(cellOutputsAtom);
75
72
  const { setCurrentLayoutData } = useLayoutActions();
76
- const cells = flattenTopLevelNotebookCells(notebook, outputs);
73
+ const cells = useAtomValue(renderedNotebookCellsAtom);
77
74
  const layout = resolveLayoutData({ state: layoutState, plugin, cells });
78
75
 
79
76
  const Renderer = plugin.Component;
@@ -40,7 +40,7 @@ function renderErroredCell(cells: GridLayout["cells"]) {
40
40
  cells={[
41
41
  {
42
42
  ...notebook.cellData[ERRORED],
43
- ...notebook.cellRuntime[ERRORED],
43
+ consoleOutputs: [],
44
44
  output: null,
45
45
  },
46
46
  ]}
@@ -27,7 +27,7 @@ import {
27
27
  } from "@/components/ui/dropdown-menu";
28
28
  import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
29
29
  import type { CellId } from "@/core/cells/ids";
30
- import type { CellRuntimeState, RuntimeCell } from "@/core/cells/types";
30
+ import type { CellRuntimeView, RuntimeCell } from "@/core/cells/types";
31
31
  import { getReadonlyCodeDisplay } from "@/core/cells/readonly-code-display";
32
32
  import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
33
33
  import { useResolvedMarimoConfig } from "@/core/config/config";
@@ -300,7 +300,7 @@ const ActionButtons: React.FC<{
300
300
  );
301
301
  };
302
302
 
303
- interface VerticalCellProps extends Pick<CellRuntimeState, "consoleOutputs"> {
303
+ interface VerticalCellProps extends Pick<CellRuntimeView, "consoleOutputs"> {
304
304
  cellOutputArea: "above" | "below";
305
305
  cellId: CellId;
306
306
  config: CellConfig;
@@ -329,7 +329,6 @@ const VerticalCell = memo(
329
329
  const output = useCellOutput(cellId);
330
330
  const { execution, freshness } = useCellPresentation(cellId);
331
331
  const errored = execution.outcome === "error";
332
- const interrupted = execution.outcome === "interrupted";
333
332
  const stopped = execution.outcome === "skipped";
334
333
 
335
334
  const outputStale = outputIsStale(execution, freshness, false);
@@ -391,11 +390,9 @@ const VerticalCell = memo(
391
390
  <ConsoleOutput
392
391
  consoleOutputs={consoleOutputs}
393
392
  stale={outputStale}
394
- interrupted={interrupted}
395
393
  cellName={name}
396
394
  onSubmitDebugger={() => null}
397
395
  cellId={cellId}
398
- debuggerActive={false}
399
396
  />
400
397
  </div>
401
398
  );
@@ -405,7 +402,7 @@ const VerticalCell = memo(
405
402
  // instead of hiding them
406
403
  const hidden = shouldHidePublishedCell({
407
404
  errored,
408
- interrupted,
405
+ interrupted: execution.outcome === "interrupted",
409
406
  stopped,
410
407
  output,
411
408
  showErrorTracebacks,
@@ -1,8 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { atom, useAtomValue } from "jotai";
4
- import { notebookAtom } from "@/core/cells/cells";
5
- import { cellExecutionInputsAtom, cellExecutionView } from "@/core/executions";
4
+ import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
6
5
  import { Banner } from "@/plugins/impl/common/error-banner";
7
6
  import { pendingPdbInputAtom } from "@/core/codemirror/cells/debugger-state";
8
7
  import { kioskModeAtom } from "@/core/mode";
@@ -11,28 +10,25 @@ import { Button } from "../ui/button";
11
10
  import { Kbd } from "../ui/kbd";
12
11
  import { DelayMount } from "../utils/delay-mount";
13
12
 
14
- // Atom to check if there is a cell with unresolved stdin
15
- const hasBlockingStdinAtom = atom((get) => {
16
- const notebook = get(notebookAtom);
17
- const executions = get(cellExecutionInputsAtom);
13
+ export const hasBlockingStdinAtom = atom((get) => {
18
14
  if (!get(kioskModeAtom) && get(pendingPdbInputAtom) !== null) {
19
15
  return true;
20
16
  }
21
-
22
- // Check each cell in order
23
- for (const cellId of notebook.cellIds) {
24
- // Check if the cell is idle and has unresolved stdin
25
- const runtime = notebook.cellRuntime[cellId];
26
- if (cellExecutionView(executions, cellId).status === "idle") {
27
- const hasUnresolvedStdin = runtime.consoleOutputs.some(
28
- (output) => output.channel === "stdin" && output.response === undefined,
29
- );
30
- if (hasUnresolvedStdin) {
31
- return true;
17
+ const replica = get(activeNotebookReplicaAtom);
18
+ if (replica === null) {
19
+ return false;
20
+ }
21
+ for (const { record, items } of get(
22
+ replica.executionsAtom,
23
+ ).executions.values()) {
24
+ if (record.status === "running") {
25
+ for (const item of items.values()) {
26
+ if (item.kind === "input" && item.status === "pending") {
27
+ return true;
28
+ }
32
29
  }
33
30
  }
34
31
  }
35
-
36
32
  return false;
37
33
  });
38
34
 
@@ -19,7 +19,7 @@ const state = vi.hoisted(() => ({
19
19
  }));
20
20
 
21
21
  vi.mock("@/core/cells/cells", () => ({
22
- useNotebook: () => ({ cellRuntime: {}, cellData: {} }),
22
+ useCellRuntime: () => ({ consoleOutputs: [] }),
23
23
  }));
24
24
  vi.mock("@/core/cells/actions", () => ({
25
25
  useCellActions: () => ({ createCell: vi.fn() }),
@@ -13,7 +13,7 @@ import type React from "react";
13
13
  import { Suspense, useMemo, useRef, useState } from "react";
14
14
  import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
15
15
  import useEvent from "react-use-event-hook";
16
- import { useNotebook } from "@/core/cells/cells";
16
+ import { useCellRuntime } from "@/core/cells/cells";
17
17
  import { useCellActions } from "@/core/cells/actions";
18
18
  import { useLastFocusedCellId } from "@/core/cells/focus";
19
19
  import { HTMLCellId, SCRATCH_CELL_ID } from "@/core/cells/ids";
@@ -33,6 +33,7 @@ import type { CellConfig } from "@/core/network/types";
33
33
  import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
34
34
  import { useTheme } from "@/theme/useTheme";
35
35
  import { cn } from "@/utils/cn";
36
+ import { useAnswerPrompt } from "@/core/cells/useAnswerPrompt";
36
37
  import { Functions } from "@/utils/functions";
37
38
  import { CellEditor } from "../editor/cell/code/cell-editor";
38
39
  import {
@@ -59,7 +60,6 @@ const scratchpadCellConfig: CellConfig = {
59
60
  };
60
61
 
61
62
  export const ScratchPad: React.FC = () => {
62
- const notebookState = useNotebook();
63
63
  const [userConfig] = useResolvedMarimoConfig();
64
64
  const { theme } = useTheme();
65
65
  const ref = useRef<EditorView | null>(null);
@@ -70,12 +70,13 @@ export const ScratchPad: React.FC = () => {
70
70
  const section = usePanelSection();
71
71
 
72
72
  const cellId = SCRATCH_CELL_ID;
73
- const cellRuntime = notebookState.cellRuntime[cellId];
73
+ const cellRuntime = useCellRuntime(cellId);
74
74
  const output = useScratchOutput();
75
75
  const status = scratchStatus(
76
76
  useAtomValue(cellExecutionInputsAtom).executions,
77
77
  );
78
78
  const consoleOutputs = cellRuntime?.consoleOutputs;
79
+ const answerPrompt = useAnswerPrompt(cellId);
79
80
  const [code, setCode] = useAtom(scratchpadCodeAtom);
80
81
  const codeListener = useMemo(
81
82
  () => [
@@ -307,11 +308,9 @@ export const ScratchPad: React.FC = () => {
307
308
  consoleOutputs={consoleOutputs}
308
309
  className="overflow-auto"
309
310
  stale={false}
310
- interrupted={false}
311
311
  cellName={DEFAULT_CELL_NAME}
312
- onSubmitDebugger={Functions.NOOP}
312
+ onSubmitDebugger={answerPrompt}
313
313
  cellId={cellId}
314
- debuggerActive={false}
315
314
  />
316
315
  </div>
317
316
  </div>
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
5
5
  import { cellId } from "@/__tests__/branded";
6
6
  import { TooltipProvider } from "@/components/ui/tooltip";
7
7
  import { CellOutputId } from "@/core/cells/ids";
8
- import { createCell, createCellRuntimeState } from "@/core/cells/types";
8
+ import { createCell } from "@/core/cells/types";
9
9
  import { CellOutputBlock } from "../reveal-component";
10
10
 
11
11
  describe("CellOutputBlock", () => {
@@ -13,7 +13,7 @@ describe("CellOutputBlock", () => {
13
13
  const id = cellId("test");
14
14
  const cell = {
15
15
  ...createCell({ id, name: "title" }),
16
- ...createCellRuntimeState(),
16
+ consoleOutputs: [],
17
17
  output: {
18
18
  channel: "output" as const,
19
19
  mimetype: "text/plain" as const,
@@ -5,7 +5,7 @@ import { beforeAll, describe, expect, it } from "vitest";
5
5
  import { SetupMocks } from "@/__mocks__/common";
6
6
  import { cellId } from "@/__tests__/branded";
7
7
  import { TooltipProvider } from "@/components/ui/tooltip";
8
- import { createCell, createCellRuntimeState } from "@/core/cells/types";
8
+ import { createCell } from "@/core/cells/types";
9
9
  import { SlideCellReadOnlyView } from "../slide-cell-view";
10
10
 
11
11
  beforeAll(() => {
@@ -17,7 +17,7 @@ describe("SlideCellReadOnlyView", () => {
17
17
  const id = cellId("test");
18
18
  const cell = {
19
19
  ...createCell({ id, name: "title", code: "x = 1" }),
20
- ...createCellRuntimeState(),
20
+ consoleOutputs: [],
21
21
  output: null,
22
22
  };
23
23
 
@@ -96,7 +96,17 @@ export function createGanttBaseSpec(
96
96
  },
97
97
  color: {
98
98
  field: statusField,
99
- scale: { domain: ["success", "error"], range: ["#37BE5F", "red"] },
99
+ scale: {
100
+ domain: [
101
+ "success",
102
+ "error",
103
+ "queued",
104
+ "running",
105
+ "skipped",
106
+ "interrupted",
107
+ ],
108
+ range: ["#37BE5F", "red", "grey", "steelblue", "grey", "darkorange"],
109
+ },
100
110
  legend: null,
101
111
  },
102
112
  },
@@ -7,7 +7,9 @@ import {
7
7
  ChevronRight,
8
8
  CircleCheck,
9
9
  CircleEllipsis,
10
+ CircleMinus,
10
11
  CirclePlayIcon,
12
+ CircleStop,
11
13
  CircleX,
12
14
  } from "lucide-react";
13
15
  import React, { type JSX, Suspense, useEffect, useRef, useState } from "react";
@@ -353,6 +355,8 @@ const StatusIcons: Record<CellRun["status"], JSX.Element> = {
353
355
  success: <CircleCheck color="green" size={14} />,
354
356
  running: <CirclePlayIcon color="var(--blue-10)" size={14} />,
355
357
  error: <CircleX color="red" size={14} />,
358
+ skipped: <CircleMinus color="grey" size={14} />,
359
+ interrupted: <CircleStop color="var(--amber-10)" size={14} />,
356
360
  queued: <CircleEllipsis color="grey" size={14} />,
357
361
  };
358
362
 
@@ -441,11 +441,11 @@ describe("Cell output utility functions", () => {
441
441
  mimetype: "text/plain",
442
442
  data: "42",
443
443
  } as OutputMessage,
444
- consoleOutputs: [],
444
+ embeddedConsole: [],
445
445
  },
446
446
  cell2: {
447
447
  output: null,
448
- consoleOutputs: [
448
+ embeddedConsole: [
449
449
  {
450
450
  mimetype: "text/plain",
451
451
  data: "console log message",
@@ -515,9 +515,7 @@ describe("Cell output utility functions", () => {
515
515
  cellId("cell2"),
516
516
  mockNotebook,
517
517
  outputOf(mockNotebook, "cell2"),
518
- {
519
- includeConsoleOutput: true,
520
- },
518
+ mockNotebook.cellRuntime[cellId("cell2")].embeddedConsole,
521
519
  );
522
520
 
523
521
  expect(result.consoleOutputs).toBeDefined();
@@ -530,7 +528,7 @@ describe("Cell output utility functions", () => {
530
528
  it("should filter out empty console outputs", () => {
531
529
  const cell2Runtime = mockNotebook.cellRuntime[cellId("cell2")];
532
530
  if (cell2Runtime) {
533
- (cell2Runtime as { consoleOutputs: OutputMessage[] }).consoleOutputs = [
531
+ cell2Runtime.embeddedConsole = [
534
532
  {
535
533
  mimetype: "text/plain",
536
534
  data: "valid output",
@@ -546,9 +544,7 @@ describe("Cell output utility functions", () => {
546
544
  cellId("cell2"),
547
545
  mockNotebook,
548
546
  outputOf(mockNotebook, "cell2"),
549
- {
550
- includeConsoleOutput: true,
551
- },
547
+ mockNotebook.cellRuntime[cellId("cell2")].embeddedConsole,
552
548
  );
553
549
 
554
550
  expect(result.consoleOutputs).toHaveLength(1);
@@ -558,7 +554,7 @@ describe("Cell output utility functions", () => {
558
554
  it("should handle cells with both cell output and console outputs", () => {
559
555
  const cell1Runtime = mockNotebook.cellRuntime[cellId("cell1")];
560
556
  if (cell1Runtime) {
561
- (cell1Runtime as { consoleOutputs: OutputMessage[] }).consoleOutputs = [
557
+ cell1Runtime.embeddedConsole = [
562
558
  {
563
559
  mimetype: "text/plain",
564
560
  data: "debug message",
@@ -570,9 +566,7 @@ describe("Cell output utility functions", () => {
570
566
  cellId("cell1"),
571
567
  mockNotebook,
572
568
  outputOf(mockNotebook, "cell1"),
573
- {
574
- includeConsoleOutput: true,
575
- },
569
+ mockNotebook.cellRuntime[cellId("cell1")].embeddedConsole,
576
570
  );
577
571
 
578
572
  expect(result.cellOutput).toBeDefined();
@@ -588,9 +582,7 @@ describe("Cell output utility functions", () => {
588
582
  cellId("cell1"),
589
583
  mockNotebook,
590
584
  outputOf(mockNotebook, "cell1"),
591
- {
592
- includeConsoleOutput: true,
593
- },
585
+ mockNotebook.cellRuntime[cellId("cell1")].embeddedConsole,
594
586
  );
595
587
 
596
588
  expect(result.consoleOutputs).toEqual([]);
@@ -619,7 +611,7 @@ describe("Cell output utility functions", () => {
619
611
  it("should handle media outputs in console outputs", () => {
620
612
  const cell2Runtime = mockNotebook.cellRuntime[cellId("cell2")];
621
613
  if (cell2Runtime) {
622
- (cell2Runtime as { consoleOutputs: OutputMessage[] }).consoleOutputs = [
614
+ cell2Runtime.embeddedConsole = [
623
615
  {
624
616
  mimetype: "image/png",
625
617
  data: "https://example.com/image.png",
@@ -631,9 +623,7 @@ describe("Cell output utility functions", () => {
631
623
  cellId("cell2"),
632
624
  mockNotebook,
633
625
  outputOf(mockNotebook, "cell2"),
634
- {
635
- includeConsoleOutput: true,
636
- },
626
+ mockNotebook.cellRuntime[cellId("cell2")].embeddedConsole,
637
627
  );
638
628
 
639
629
  expect(result.consoleOutputs).toHaveLength(1);
@@ -5,7 +5,6 @@ import type * as Protocol from "@marimo-team/client/protocol";
5
5
  import { createStore } from "jotai";
6
6
  import { beforeEach, describe, expect, it } from "vitest";
7
7
  import { MockNotebook } from "@/__mocks__/notebook";
8
- import { notebookAtom } from "@/core/cells/cells";
9
8
  import { type CellId, CellId as CellIdClass } from "@/core/cells/ids";
10
9
  import { ErrorContextProvider } from "../error";
11
10
 
@@ -279,26 +278,16 @@ describe("ErrorContextProvider", () => {
279
278
 
280
279
  it("includes console tracebacks for marimo error outputs", () => {
281
280
  const cellId = CellIdClass.create();
282
- const notebookState = createMockNotebookWithErrors([
281
+ createMockNotebookWithErrors([
283
282
  {
284
283
  cellId,
285
284
  cellName: "Cell 1",
285
+ consoleTraceback:
286
+ '<pre>ValueError: boom\n File "notebook.py", line 1</pre>',
286
287
  code: "raise ValueError('boom')",
287
288
  error: { kind: "exception", name: "ValueError", message: "boom" },
288
289
  },
289
290
  ]);
290
- notebookState.cellRuntime[cellId] = {
291
- ...notebookState.cellRuntime[cellId],
292
- consoleOutputs: [
293
- {
294
- channel: "stderr",
295
- data: '<pre>ValueError: boom\n File "notebook.py", line 1</pre>',
296
- mimetype: "application/vnd.marimo+traceback",
297
- timestamp: Date.now(),
298
- },
299
- ],
300
- };
301
- store.set(notebookAtom, notebookState);
302
291
 
303
292
  const items = provider.getItems();
304
293
  const context = provider.formatContext(items[1]);
@@ -310,10 +299,11 @@ describe("ErrorContextProvider", () => {
310
299
 
311
300
  it("does not duplicate console traceback when error already has one", () => {
312
301
  const cellId = CellIdClass.create();
313
- const notebookState = createMockNotebookWithErrors([
302
+ createMockNotebookWithErrors([
314
303
  {
315
304
  cellId,
316
305
  cellName: "Cell 1",
306
+ consoleTraceback: "<pre>console line 1</pre>",
317
307
  code: "raise ValueError('boom')",
318
308
  error: {
319
309
  kind: "exception",
@@ -326,18 +316,6 @@ describe("ErrorContextProvider", () => {
326
316
  },
327
317
  },
328
318
  ]);
329
- notebookState.cellRuntime[cellId] = {
330
- ...notebookState.cellRuntime[cellId],
331
- consoleOutputs: [
332
- {
333
- channel: "stderr",
334
- data: "<pre>console line 1</pre>",
335
- mimetype: "application/vnd.marimo+traceback",
336
- timestamp: Date.now(),
337
- },
338
- ],
339
- };
340
- store.set(notebookAtom, notebookState);
341
319
 
342
320
  const items = provider.getItems();
343
321
  if (items[1].data.type !== "cell-error") {
@@ -356,23 +356,15 @@ export function getCellContextData(
356
356
  cellId: CellId,
357
357
  notebook: NotebookState,
358
358
  output: CellOutput | null,
359
- opts?: {
360
- includeConsoleOutput: boolean;
361
- },
359
+ rows?: readonly OutputMessage[],
362
360
  ): CellOutputData {
363
- const { includeConsoleOutput = false } = opts || {};
364
- const cellRuntime = notebook.cellRuntime[cellId];
365
-
366
361
  const cellData = notebook.cellData[cellId];
367
362
  const cellIndex = notebook.cellIds.indexOf(cellId);
368
363
  const cellName = displayCellName(cellData.name, cellIndex);
369
364
 
370
- let consoleOutputs: BaseOutput[] | undefined;
371
- if (includeConsoleOutput) {
372
- consoleOutputs = cellRuntime.consoleOutputs
373
- .map((output) => getBaseOutput(output))
374
- .filter((output) => output !== null);
375
- }
365
+ const consoleOutputs = rows
366
+ ?.map(getBaseOutput)
367
+ .filter((output) => output !== null);
376
368
 
377
369
  let cellOutput: BaseOutput | undefined;
378
370
  if (output !== null && !isOutputEmpty(output)) {