@marimo-team/islands 0.25.3-dev388 → 0.25.3-dev394

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 (166) hide show
  1. package/dist/{ConnectedDataExplorerComponent-BpCrAeX0.js → ConnectedDataExplorerComponent-1DGGwl88.js} +9 -9
  2. package/dist/{ErrorBoundary-_mFP3LkM.js → ErrorBoundary-DDIASniH.js} +6 -6
  3. package/dist/{abnfDiagram-VCTEODGH-ZqNgGZlz.js → abnfDiagram-VCTEODGH-CeQEbVik.js} +2 -2
  4. package/dist/{any-language-editor-CFbAr7vc.js → any-language-editor-C_s_ZoaK.js} +2 -2
  5. package/dist/{architectureDiagram-5GKGNRK7-BEUaR96d.js → architectureDiagram-5GKGNRK7-C8xUpTAb.js} +1 -1
  6. package/dist/{assertNever-5uYEbJc8.js → assertNever-DXGfUmPW.js} +2 -2
  7. package/dist/assets/__vite-browser-external-C9HF3uHE.js +1 -0
  8. package/dist/assets/worker-B4Cpvr8b.js +171 -0
  9. package/dist/{chat-ui-BKSYhGMh.js → chat-ui-B6bY_0LF.js} +774 -774
  10. package/dist/{check-BbhVyViy.js → check-ywinAQy6.js} +1 -1
  11. package/dist/{chunk-IMKFNOWR-BdEPmWQI.js → chunk-IMKFNOWR-DY7AWyNi.js} +1 -1
  12. package/dist/{chunk-SHT3W25Y-IvvXM3xf.js → chunk-SHT3W25Y-D4epY9MY.js} +1 -1
  13. package/dist/{chunk-SVP7TREG-C_qpJUv1.js → chunk-SVP7TREG-CKsl2Q6r.js} +1 -1
  14. package/dist/{chunk-TICWLB2K-C4agYVWP.js → chunk-TICWLB2K-CMsD2y0F.js} +1 -1
  15. package/dist/{classDiagram-ZZMXUADV-CT2iq8uF.js → classDiagram-ZZMXUADV-C4FsLnvt.js} +2 -2
  16. package/dist/{classDiagram-v2-VYDZK3BY-Coe_dD0r.js → classDiagram-v2-VYDZK3BY-BJRuFZeI.js} +2 -2
  17. package/dist/{code-visibility-DkMNjdNe.js → code-visibility-CByYqwFv.js} +13 -13
  18. package/dist/{common-Ces9ooG_.js → common-KkgATX2Y.js} +4918 -4910
  19. package/dist/{config-DJ8M-gPL.js → config-DOwBtRkI.js} +3 -3
  20. package/dist/{copy-icon-xWvA8ybp.js → copy-icon-BKcX0ltw.js} +2 -2
  21. package/dist/{createReducer-fp0gX_9U.js → createReducer-Bjx6kuxh.js} +1 -1
  22. package/dist/{cynefinDiagram-5FMLGOSQ-D0LKziUu.js → cynefinDiagram-5FMLGOSQ-DyI_lSsn.js} +1 -1
  23. package/dist/{dagre-GXQ25YYZ-Cmgziaw8.js → dagre-GXQ25YYZ-Buoy6sX-.js} +1 -1
  24. package/dist/{data-grid-overlay-editor-uNMslVKY.js → data-grid-overlay-editor-BHrTJhN3.js} +1 -1
  25. package/dist/{diagram-S7CK7UJ4-D-lZsALU.js → diagram-S7CK7UJ4-CbSD1DUy.js} +1 -1
  26. package/dist/{diagram-UQ7AKVKN-TcbdsFoT.js → diagram-UQ7AKVKN-Dapj2rQm.js} +1 -1
  27. package/dist/{diagram-VX7I27RA-D5BqZi1q.js → diagram-VX7I27RA-CxA3txtC.js} +1 -1
  28. package/dist/{diagram-Z3DM3KII-MNc7jqvr.js → diagram-Z3DM3KII-BEZqz916.js} +1 -1
  29. package/dist/{dialog-Cm0VGdxc.js → dialog-mwa6XN15.js} +2 -2
  30. package/dist/{dropdown-menu-DfamXjVI.js → dropdown-menu-CmgUseHo.js} +5 -5
  31. package/dist/duckdb-keywords-CdzX4o33.js +3 -0
  32. package/dist/{ebnfDiagram-PWID7BFC-Cxt6ywyX.js → ebnfDiagram-PWID7BFC-Dmw-1JV3.js} +2 -2
  33. package/dist/{erDiagram-RLTQ6QDP-BLF-askI.js → erDiagram-RLTQ6QDP-DZpG4cbm.js} +1 -1
  34. package/dist/{error-banner-k06CAftu.js → error-banner-CHPLqogX.js} +1 -1
  35. package/dist/{error-entries-rtPWQkJk.js → error-entries-Bk96zt4w.js} +825 -690
  36. package/dist/{feedback-button-i960qUnq.js → feedback-button-2FaWjlaR.js} +12 -12
  37. package/dist/{flowDiagram-HODETNUW-CsLw2mWn.js → flowDiagram-HODETNUW-B02oHnBv.js} +2 -2
  38. package/dist/{formats-DQ-qq-dU.js → formats-BDqe9cfr.js} +1 -1
  39. package/dist/{glide-data-editor-_EEhlGzS.js → glide-data-editor-B9Yq6Wg1.js} +11 -11
  40. package/dist/{glide-utils-CHrghEu-.js → glide-utils-DYKWS2YV.js} +2 -2
  41. package/dist/{globals-DKkjIolp.js → globals-S4D5AVKN.js} +3 -3
  42. package/dist/{html-to-image-B5nTOeMI.js → html-to-image-BauFF9F_.js} +4842 -4821
  43. package/dist/{infoDiagram-27XIBGKW-CdSApBWg.js → infoDiagram-27XIBGKW-BPbQHO9m.js} +1 -1
  44. package/dist/{ishikawaDiagram-5VMMS53U-BnzQ8SI5.js → ishikawaDiagram-5VMMS53U-DmnKSNi7.js} +1 -1
  45. package/dist/{kanban-definition-UXKFOSKX-D2llTpeX.js → kanban-definition-UXKFOSKX-u5PZbsBe.js} +1 -1
  46. package/dist/main.js +6236 -6175
  47. package/dist/{mermaid-BcNMyKmf.js → mermaid-ffopDjig.js} +34 -34
  48. package/dist/{mindmap-definition-YA3MSWOX-uoEsfD5R.js → mindmap-definition-YA3MSWOX-CX187lhP.js} +1 -1
  49. package/dist/{number-overlay-editor-D5U7jbrh.js → number-overlay-editor-l7DB2HCO.js} +1 -1
  50. package/dist/{pegDiagram-XKGWAZYB-DTWrE0S4.js → pegDiagram-XKGWAZYB-Bj6HGPak.js} +2 -2
  51. package/dist/{pencil-weySvN0N.js → pencil-CijoRsa3.js} +1 -1
  52. package/dist/{pieDiagram-E7YTZNPT-COME2oGN.js → pieDiagram-E7YTZNPT-C_wIgDJM.js} +1 -1
  53. package/dist/{process-output-DNxpsd4n.js → process-output-Deae7dX1.js} +4 -4
  54. package/dist/{railroadDiagram-O6MQD6OU-CUeFcNTY.js → railroadDiagram-O6MQD6OU-CwoJvnvC.js} +2 -2
  55. package/dist/{requirementDiagram-BXWQKSXE-BUR4lDZG.js → requirementDiagram-BXWQKSXE-C8JuhLLL.js} +1 -1
  56. package/dist/{reveal-component-BM9TozVQ.js → reveal-component-VR4UzAUv.js} +37 -37
  57. package/dist/{select-Ca-POp4c.js → select-DW32QOzC.js} +4 -4
  58. package/dist/{sequenceDiagram-WJ2MYXX4-CSPmml3q.js → sequenceDiagram-WJ2MYXX4-RbrRdoiV.js} +1 -1
  59. package/dist/{spec-BgSMwzks.js → spec-Ww0JjShW.js} +4 -4
  60. package/dist/{stateDiagram-D77RDMKH-BDUC8Pi9.js → stateDiagram-D77RDMKH-DWdIvCnU.js} +2 -2
  61. package/dist/{stateDiagram-v2-MP3YSRHH-BH-qyk8a.js → stateDiagram-v2-MP3YSRHH-BG0j9crW.js} +2 -2
  62. package/dist/{static-state-Cqzv5X7B.js → static-state-CnQdTBTW.js} +1 -1
  63. package/dist/style.css +1 -1
  64. package/dist/{swimlanes-42K2YHIH-CLE9Kiir.js → swimlanes-42K2YHIH-B6zUw4gq.js} +1 -1
  65. package/dist/{swimlanesDiagram-VR7AAH4N-Cv8kWAeA.js → swimlanesDiagram-VR7AAH4N-DjVEnsIG.js} +2 -2
  66. package/dist/{timeline-definition-24CTP7MA-fbRGX21i.js → timeline-definition-24CTP7MA-DSAxwqnC.js} +1 -1
  67. package/dist/{toast-0xspcdmv.js → toast-Crofa36R.js} +3 -3
  68. package/dist/{tooltip-BwlFTaNy.js → tooltip-Bg-SDCwa.js} +1 -1
  69. package/dist/{use-restore-focus-fKgXR0nb.js → use-restore-focus-CE9Sflmg.js} +1298 -1283
  70. package/dist/{useDateFormatter-B7LvPmsw.js → useDateFormatter-D5fsC9ot.js} +2 -2
  71. package/dist/{useDeepCompareMemoize-OhBYt-q2.js → useDeepCompareMemoize-Bvrue1iy.js} +1 -1
  72. package/dist/{useLifecycle-D9xcFAIN.js → useLifecycle-Ctr5lECo.js} +1 -1
  73. package/dist/{vega-component-Chak9Aon.js → vega-component-DQZhTzVQ.js} +6 -6
  74. package/dist/{vennDiagram-4TSXK5OY-BzKtg8gL.js → vennDiagram-4TSXK5OY-FAGYRdBj.js} +1 -1
  75. package/dist/{wardleyDiagram-VM6X3IG4-R0SgDvz1.js → wardleyDiagram-VM6X3IG4-BlB973r1.js} +1 -1
  76. package/dist/{xychartDiagram-S5SC5T6Z-DRskTHEM.js → xychartDiagram-S5SC5T6Z-CywvmjIK.js} +1 -1
  77. package/package.json +2 -2
  78. package/src/__mocks__/executions.ts +48 -8
  79. package/src/__mocks__/notebook.ts +20 -42
  80. package/src/components/app-config/__tests__/add-model-discovery.test.tsx +255 -0
  81. package/src/components/app-config/__tests__/model-discovery.test.tsx +183 -0
  82. package/src/components/app-config/ai-config.tsx +20 -24
  83. package/src/components/app-config/model-discovery.tsx +118 -184
  84. package/src/components/app-config/model-provider-config.ts +25 -0
  85. package/src/components/editor/Output.tsx +5 -4
  86. package/src/components/editor/__tests__/data-attributes.test.tsx +1 -6
  87. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +11 -16
  88. package/src/components/editor/__tests__/output-persistence.test.tsx +6 -24
  89. package/src/components/editor/actions/__tests__/useSetOutputsExpanded.test.ts +6 -8
  90. package/src/components/editor/actions/useSetOutputsExpanded.ts +12 -4
  91. package/src/components/editor/cell/cell-context-menu.tsx +3 -2
  92. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +89 -72
  93. package/src/components/editor/notebook-cell.tsx +15 -10
  94. package/src/components/editor/output/console/process-output.ts +4 -2
  95. package/src/components/editor/renderers/cells-renderer.tsx +3 -1
  96. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +5 -11
  97. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +9 -8
  98. package/src/components/editor/renderers/types.ts +2 -2
  99. package/src/components/editor/renderers/vertical-layout/utils.ts +4 -4
  100. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +5 -8
  101. package/src/components/scratchpad/scratchpad.tsx +6 -2
  102. package/src/components/slides/__tests__/cell-output-block.test.tsx +7 -8
  103. package/src/components/slides/__tests__/minimap-actions.test.tsx +3 -3
  104. package/src/components/slides/__tests__/slide-cell-view.test.tsx +1 -0
  105. package/src/components/slides/slide-cell-view.tsx +1 -3
  106. package/src/components/slides/slide.tsx +3 -3
  107. package/src/core/ai/context/__tests__/registry.test.ts +7 -11
  108. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +113 -35
  109. package/src/core/ai/context/providers/__tests__/error.test.ts +74 -191
  110. package/src/core/ai/context/providers/cell-output.ts +11 -6
  111. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +8 -103
  112. package/src/core/cells/__tests__/cells.test.ts +40 -292
  113. package/src/core/cells/__tests__/clear-outputs.test.ts +151 -0
  114. package/src/core/cells/__tests__/harness.ts +14 -12
  115. package/src/core/cells/__tests__/layout.test.ts +20 -26
  116. package/src/core/cells/__tests__/notebook-outline.test.ts +49 -43
  117. package/src/core/cells/__tests__/session.test.ts +26 -146
  118. package/src/core/cells/actions.ts +49 -9
  119. package/src/core/cells/cell.ts +0 -13
  120. package/src/core/cells/cells.ts +53 -62
  121. package/src/core/cells/focus.ts +6 -1
  122. package/src/core/cells/layout.ts +2 -3
  123. package/src/core/cells/outputs.ts +2 -2
  124. package/src/core/cells/session.ts +3 -38
  125. package/src/core/cells/types.ts +6 -8
  126. package/src/core/cells/utils.ts +4 -3
  127. package/src/core/codemirror/ai/__tests__/resources.test.ts +7 -11
  128. package/src/core/config/config-schema.ts +15 -0
  129. package/src/core/errors/__tests__/error-entries.test.ts +52 -18
  130. package/src/core/errors/error-entries.ts +21 -11
  131. package/src/core/executions/__tests__/freshness.test.ts +7 -4
  132. package/src/core/executions/__tests__/hooks.test.tsx +5 -1
  133. package/src/core/executions/__tests__/interrupt.test.ts +2 -0
  134. package/src/core/executions/__tests__/output-lifecycle.test.ts +201 -0
  135. package/src/core/executions/__tests__/output.test.ts +87 -3
  136. package/src/core/executions/__tests__/select.test.ts +17 -10
  137. package/src/core/executions/atoms.ts +73 -15
  138. package/src/core/executions/freshness.ts +1 -1
  139. package/src/core/executions/hooks.ts +18 -8
  140. package/src/core/executions/index.ts +6 -0
  141. package/src/core/executions/output.ts +122 -38
  142. package/src/core/executions/select.ts +2 -2
  143. package/src/core/export/__tests__/hooks.test.ts +20 -29
  144. package/src/core/export/hooks.ts +7 -9
  145. package/src/core/islands/__tests__/iframe-resizer.test.ts +91 -0
  146. package/src/core/islands/__tests__/main.test.ts +17 -0
  147. package/src/core/islands/components/__tests__/web-components.test.tsx +13 -15
  148. package/src/core/islands/components/output-wrapper.tsx +15 -20
  149. package/src/core/islands/iframe-resizer.ts +38 -0
  150. package/src/core/islands/main.ts +3 -0
  151. package/src/core/lifecycle/render-policy.ts +7 -4
  152. package/src/core/network/__tests__/ai.test.ts +41 -0
  153. package/src/core/network/ai.ts +12 -0
  154. package/src/core/notebook/document/__tests__/codemirror.test.ts +2 -0
  155. package/src/core/notebook/replica/__tests__/replica.test.ts +19 -0
  156. package/src/core/notebook/replica/__tests__/results.test.ts +45 -16
  157. package/src/core/notebook/replica/index.ts +1 -1
  158. package/src/core/notebook/replica/replica.ts +19 -4
  159. package/src/core/notebook/replica/resources/executions.ts +100 -9
  160. package/src/core/notebook/replica/resources/results.ts +46 -31
  161. package/src/core/transports/__tests__/static.test.ts +5 -3
  162. package/src/stories/cell.stories.tsx +40 -30
  163. package/src/stories/layout/vertical/one-column.stories.tsx +15 -7
  164. package/dist/assets/__vite-browser-external-C5NhJPNJ.js +0 -1
  165. package/dist/assets/worker-D-n8vtGi.js +0 -171
  166. package/dist/duckdb-keywords-BGArYVVK.js +0 -3
@@ -23,16 +23,6 @@ function renderErroredCell(cells: GridLayout["cells"]) {
23
23
  MockExecutions.seed(store, [MockExecutions.errored(ERRORED)]);
24
24
  const notebook = MockNotebook.notebookState({
25
25
  cellData: { [ERRORED]: { code: "raise ValueError('boom')" } },
26
- cellRuntime: {
27
- [ERRORED]: {
28
- output: {
29
- channel: "marimo-error",
30
- mimetype: "application/vnd.marimo+error",
31
- data: [MockNotebook.errors.exception("boom")],
32
- timestamp: 1,
33
- },
34
- },
35
- },
36
26
  });
37
27
  render(
38
28
  <Provider store={store}>
@@ -48,7 +38,11 @@ function renderErroredCell(cells: GridLayout["cells"]) {
48
38
  }}
49
39
  setLayout={vi.fn()}
50
40
  cells={[
51
- { ...notebook.cellData[ERRORED], ...notebook.cellRuntime[ERRORED] },
41
+ {
42
+ ...notebook.cellData[ERRORED],
43
+ ...notebook.cellRuntime[ERRORED],
44
+ output: null,
45
+ },
52
46
  ]}
53
47
  />
54
48
  </Provider>,
@@ -8,7 +8,7 @@ import React, {
8
8
  } from "react";
9
9
  import { Responsive, WidthProvider } from "react-grid-layout";
10
10
  import { OutputArea } from "@/components/editor/Output";
11
- import type { CellRuntimeState } from "@/core/cells/types";
11
+ import type { RuntimeCell } from "@/core/cells/types";
12
12
  import type { ICellRendererProps } from "../types";
13
13
  import type { GridLayout, GridLayoutCellSide } from "./types";
14
14
 
@@ -37,7 +37,11 @@ import { NumberField } from "@/components/ui/number-field";
37
37
  import { Switch } from "@/components/ui/switch";
38
38
  import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
39
39
  import type { CellId } from "@/core/cells/ids";
40
- import { useCellExecution, useCellFreshness } from "@/core/executions";
40
+ import {
41
+ useCellExecution,
42
+ useCellFreshness,
43
+ useCellOutput,
44
+ } from "@/core/executions";
41
45
  import type { AppMode } from "@/core/mode";
42
46
  import { useIsDragging } from "@/hooks/useIsDragging";
43
47
  import { cn } from "@/utils/cn";
@@ -227,7 +231,6 @@ export const GridLayoutRenderer: React.FC<Props> = ({
227
231
  code={cell.code}
228
232
  mode={mode}
229
233
  cellId={cell.id}
230
- output={cell.output}
231
234
  hideWithoutValue={true}
232
235
  isScrollable={isScrollable}
233
236
  side={side}
@@ -292,7 +295,6 @@ export const GridLayoutRenderer: React.FC<Props> = ({
292
295
  code={cell.code}
293
296
  mode={mode}
294
297
  cellId={cell.id}
295
- output={cell.output}
296
298
  hideWithoutValue={false}
297
299
  isScrollable={false}
298
300
  />
@@ -360,7 +362,6 @@ export const GridLayoutRenderer: React.FC<Props> = ({
360
362
  className="select-none pointer-events-none"
361
363
  mode={mode}
362
364
  cellId={cell.id}
363
- output={cell.output}
364
365
  hideWithoutValue={false}
365
366
  isScrollable={false}
366
367
  />
@@ -372,7 +373,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
372
373
  );
373
374
  };
374
375
 
375
- interface GridCellProps extends Pick<CellRuntimeState, "output"> {
376
+ interface GridCellProps {
376
377
  className?: string;
377
378
  code: string;
378
379
  cellId: CellId;
@@ -385,7 +386,6 @@ interface GridCellProps extends Pick<CellRuntimeState, "output"> {
385
386
 
386
387
  const GridCell = memo(
387
388
  ({
388
- output,
389
389
  cellId,
390
390
  mode,
391
391
  code,
@@ -394,6 +394,7 @@ const GridCell = memo(
394
394
  side,
395
395
  className,
396
396
  }: GridCellProps) => {
397
+ const output = useCellOutput(cellId);
397
398
  const execution = useCellExecution(cellId);
398
399
  const freshness = useCellFreshness(cellId);
399
400
  const loading = outputIsLoading(execution.status);
@@ -683,7 +684,7 @@ const GridHoverActions: React.FC<GridHoverActionsProps> = ({
683
684
  );
684
685
  };
685
686
 
686
- function isSidebarCell(cell: CellRuntimeState) {
687
+ function isSidebarCell(cell: RuntimeCell) {
687
688
  // False-positives are ok here because we rendering these cells in a hidden div
688
689
  return (
689
690
  typeof cell.output?.data === "string" &&
@@ -1,7 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import type { ZodType } from "zod";
4
- import type { CellData, CellRuntimeState } from "@/core/cells/types";
4
+ import type { CellData, RuntimeCell } from "@/core/cells/types";
5
5
  import type { AppConfig } from "@/core/config/config-schema";
6
6
  import type { AppMode } from "@/core/mode";
7
7
 
@@ -17,7 +17,7 @@ export interface ICellRendererProps<L> {
17
17
  /**
18
18
  * The cells to render.
19
19
  */
20
- cells: (CellRuntimeState & CellData)[];
20
+ cells: RuntimeCell[];
21
21
 
22
22
  /**
23
23
  * The layout configuration.
@@ -1,7 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import { isOutputEmpty } from "@/core/cells/outputs";
4
- import type { CellData, CellRuntimeState } from "@/core/cells/types";
4
+ import type { RuntimeCell } from "@/core/cells/types";
5
5
  import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
6
6
  import { KnownQueryParams } from "@/core/constants";
7
7
  import type { OutputMessage } from "@/core/kernel/messages";
@@ -42,10 +42,10 @@ export function updateShowCodeQueryParam(showCode: boolean): void {
42
42
  }
43
43
 
44
44
  export function groupCellsByColumn(
45
- cells: (CellRuntimeState & CellData)[],
46
- ): [number, (CellRuntimeState & CellData)[]][] {
45
+ cells: RuntimeCell[],
46
+ ): [number, RuntimeCell[]][] {
47
47
  // Group cells by column
48
- const cellsByColumn = new Map<number, (CellRuntimeState & CellData)[]>();
48
+ const cellsByColumn = new Map<number, RuntimeCell[]>();
49
49
  let lastSeenColumn = 0;
50
50
  cells.forEach((cell) => {
51
51
  const column = cell.config.column ?? lastSeenColumn;
@@ -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 { CellData, CellRuntimeState } from "@/core/cells/types";
30
+ import type { CellRuntimeState, 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";
@@ -36,6 +36,7 @@ import {
36
36
  runtimeStatusAtom,
37
37
  useCellExecution,
38
38
  useCellFreshness,
39
+ useCellOutput,
39
40
  } from "@/core/executions";
40
41
  import { useNotebookCodeAvailable } from "@/core/meta/code-visibility";
41
42
  import { showCodeInRunModeAtom } from "@/core/meta/state";
@@ -95,12 +96,11 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
95
96
  });
96
97
  };
97
98
 
98
- const renderCell = (cell: CellRuntimeState & CellData) => {
99
+ const renderCell = (cell: RuntimeCell) => {
99
100
  return (
100
101
  <VerticalCell
101
102
  key={cell.id}
102
103
  cellId={cell.id}
103
- output={cell.output}
104
104
  consoleOutputs={cell.consoleOutputs}
105
105
  code={cell.code}
106
106
  config={cell.config}
@@ -301,10 +301,7 @@ const ActionButtons: React.FC<{
301
301
  );
302
302
  };
303
303
 
304
- interface VerticalCellProps extends Pick<
305
- CellRuntimeState,
306
- "output" | "consoleOutputs"
307
- > {
304
+ interface VerticalCellProps extends Pick<CellRuntimeState, "consoleOutputs"> {
308
305
  cellOutputArea: "above" | "below";
309
306
  cellId: CellId;
310
307
  config: CellConfig;
@@ -318,7 +315,6 @@ interface VerticalCellProps extends Pick<
318
315
 
319
316
  const VerticalCell = memo(
320
317
  ({
321
- output,
322
318
  consoleOutputs,
323
319
  cellOutputArea,
324
320
  cellId,
@@ -331,6 +327,7 @@ const VerticalCell = memo(
331
327
  showErrorTracebacks,
332
328
  }: VerticalCellProps) => {
333
329
  const cellRef = useRef<HTMLDivElement>(null);
330
+ const output = useCellOutput(cellId);
334
331
  const execution = useCellExecution(cellId);
335
332
  const freshness = useCellFreshness(cellId);
336
333
  const errored = execution.outcome === "error";
@@ -23,7 +23,11 @@ import { prepareCellCodeUpdate } from "@/core/codemirror/language/cell-code";
23
23
  import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
24
24
  import { useResolvedMarimoConfig } from "@/core/config/config";
25
25
  import { CSSClasses } from "@/core/constants";
26
- import { cellExecutionInputsAtom, scratchStatus } from "@/core/executions";
26
+ import {
27
+ cellExecutionInputsAtom,
28
+ scratchStatus,
29
+ useScratchOutput,
30
+ } from "@/core/executions";
27
31
  import { useRequestClient } from "@/core/network/requests";
28
32
  import type { CellConfig } from "@/core/network/types";
29
33
  import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
@@ -67,7 +71,7 @@ export const ScratchPad: React.FC = () => {
67
71
 
68
72
  const cellId = SCRATCH_CELL_ID;
69
73
  const cellRuntime = notebookState.cellRuntime[cellId];
70
- const output = cellRuntime?.output;
74
+ const output = useScratchOutput();
71
75
  const status = scratchStatus(
72
76
  useAtomValue(cellExecutionInputsAtom).executions,
73
77
  );
@@ -13,14 +13,13 @@ describe("CellOutputBlock", () => {
13
13
  const id = cellId("test");
14
14
  const cell = {
15
15
  ...createCell({ id, name: "title" }),
16
- ...createCellRuntimeState({
17
- output: {
18
- channel: "output",
19
- mimetype: "text/plain",
20
- data: "hello",
21
- timestamp: 0,
22
- },
23
- }),
16
+ ...createCellRuntimeState(),
17
+ output: {
18
+ channel: "output" as const,
19
+ mimetype: "text/plain" as const,
20
+ data: "hello",
21
+ timestamp: 0,
22
+ },
24
23
  };
25
24
 
26
25
  const { container } = render(
@@ -5,7 +5,7 @@ import { beforeAll, describe, expect, it, vi } from "vitest";
5
5
  import { cellId } from "@/__tests__/branded";
6
6
  import { TooltipProvider } from "@/components/ui/tooltip";
7
7
  import type { CellId } from "@/core/cells/ids";
8
- import type { CellData, CellRuntimeState } from "@/core/cells/types";
8
+ import type { RuntimeCell } from "@/core/cells/types";
9
9
  import type { CellColumnId } from "@/core/cells/layout";
10
10
  import { SlidesMinimap } from "../minimap";
11
11
 
@@ -77,13 +77,13 @@ beforeAll(() => {
77
77
 
78
78
  // The minimap only reads `id`/`code`/`status`/`output`, so a minimal stub is
79
79
  // enough; the cast is confined to this helper.
80
- function makeCell(id: CellId): CellRuntimeState & CellData {
80
+ function makeCell(id: CellId): RuntimeCell {
81
81
  return {
82
82
  id,
83
83
  code: `print("${id}")`,
84
84
  output: null,
85
85
  status: "idle",
86
- } as unknown as CellRuntimeState & CellData;
86
+ } as unknown as RuntimeCell;
87
87
  }
88
88
 
89
89
  function renderMinimap() {
@@ -18,6 +18,7 @@ describe("SlideCellReadOnlyView", () => {
18
18
  const cell = {
19
19
  ...createCell({ id, name: "title", code: "x = 1" }),
20
20
  ...createCellRuntimeState(),
21
+ output: null,
21
22
  };
22
23
 
23
24
  const { container } = render(
@@ -21,7 +21,7 @@ import {
21
21
  cellStatusClasses,
22
22
  isUninstantiated,
23
23
  } from "@/core/cells/utils";
24
- import type { CellData, CellRuntimeState } from "@/core/cells/types";
24
+ import type { RuntimeCell } from "@/core/cells/types";
25
25
  import type { LanguageAdapterType } from "@/core/codemirror/language/types";
26
26
  import { useCellExecution, useCellFreshness } from "@/core/executions";
27
27
  import { connectionAtom } from "@/core/network/connection";
@@ -30,8 +30,6 @@ import { cn } from "@/utils/cn";
30
30
  import { ReadonlyCode } from "../editor/code/readonly-python-code";
31
31
  import { getReadonlyCodeDisplay } from "@/core/cells/readonly-code-display";
32
32
 
33
- type RuntimeCell = CellRuntimeState & CellData;
34
-
35
33
  /**
36
34
  * Renders a single cell in the slides view as an editable CodeMirror editor
37
35
  * stacked with its output, mirroring the notebook layout. Editing and
@@ -4,10 +4,10 @@ import { outputIsLoading } from "@/core/cells/cell";
4
4
  import { OutputArea } from "../editor/Output";
5
5
  import { memo } from "react";
6
6
  import type { CellId } from "@/core/cells/ids";
7
- import type { CellRuntimeState } from "@/core/cells/types";
8
- import type { CellRunStatus } from "@/core/executions";
7
+ import type { CellOutput, CellRunStatus } from "@/core/executions";
9
8
 
10
- interface SlideContentProps extends Pick<CellRuntimeState, "output"> {
9
+ interface SlideContentProps {
10
+ output: CellOutput | null;
11
11
  cellId: CellId;
12
12
  status: CellRunStatus;
13
13
  stale: boolean;
@@ -5,7 +5,6 @@ import type { FileUIPart } from "ai";
5
5
  import { createStore } from "jotai";
6
6
  import { beforeEach, describe, expect, it, vi } from "vitest";
7
7
  import { MockNotebook } from "@/__mocks__/notebook";
8
- import { notebookAtom } from "@/core/cells/cells";
9
8
  import { CellId as CellIdClass } from "@/core/cells/ids";
10
9
  import {
11
10
  type ErrorContextItem,
@@ -725,23 +724,21 @@ describe("AIContextRegistry", () => {
725
724
  const cellId1 = CellIdClass.create();
726
725
  const cellId2 = CellIdClass.create();
727
726
 
728
- const notebookState = MockNotebook.notebookStateWithErrors([
727
+ MockNotebook.withErrors(store, [
729
728
  {
730
729
  cellId: cellId1,
731
730
  cellName: "Cell 1",
732
- errorData: [
733
- MockNotebook.errors.syntax("Invalid syntax"),
734
- MockNotebook.errors.exception("Runtime error"),
735
- ],
731
+ error: { kind: "invalid-syntax", message: "Invalid syntax" },
736
732
  },
737
733
  {
738
734
  cellId: cellId2,
739
735
  cellName: "Cell 2",
740
- errorData: [MockNotebook.errors.cycle()],
736
+ error: {
737
+ kind: "cycle-dependencies",
738
+ message: "This cell is in a cycle",
739
+ },
741
740
  },
742
741
  ]);
743
-
744
- store.set(notebookAtom, notebookState);
745
742
  errorProvider = new ErrorContextProvider(store);
746
743
  registry = new AIContextRegistry<ErrorContextItem>().register(
747
744
  errorProvider,
@@ -797,8 +794,7 @@ describe("AIContextRegistry", () => {
797
794
  it("should handle empty errors gracefully", () => {
798
795
  // Create store with no errors using MockNotebook
799
796
  const emptyStore = createStore();
800
- const emptyNotebookState = MockNotebook.notebookStateWithErrors([]);
801
- emptyStore.set(notebookAtom, emptyNotebookState);
797
+ MockNotebook.withErrors(emptyStore, []);
802
798
 
803
799
  const emptyErrorProvider = new ErrorContextProvider(emptyStore);
804
800
  const emptyRegistry = new AIContextRegistry().register(
@@ -13,23 +13,52 @@ vi.mock("@/utils/Logger", () => ({
13
13
  Logger: Mocks.quietLogger(),
14
14
  }));
15
15
 
16
- import type { NotebookState } from "@/core/cells/cells";
16
+ import { createStore } from "jotai";
17
+ import { MockExecutions } from "@/__mocks__/executions";
18
+ import { type NotebookState, notebookAtom } from "@/core/cells/cells";
19
+ import type { CellOutput } from "@/core/executions";
17
20
  import type { OutputMessage } from "@/core/kernel/messages";
18
21
  import type { JotaiStore } from "@/core/state/jotai";
19
22
  import { CellOutputContextProvider, getCellContextData } from "../cell-output";
20
23
 
21
- // Test helper to create mock store
22
- function createMockStore(notebook: NotebookState): JotaiStore {
23
- const store = {
24
- get: vi.fn().mockReturnValue(notebook),
25
- } as unknown as JotaiStore;
24
+ /** A notebook fixture whose runtime entries also state what the host shows. */
25
+ type NotebookFixture = NotebookState & {
26
+ cellRuntime: Record<string, { output?: CellOutput | null }>;
27
+ };
28
+
29
+ /** What the fixture shows for `cellId`. */
30
+ function outputOf(
31
+ notebook: NotebookFixture,
32
+ cellId: string,
33
+ ): CellOutput | null {
34
+ return notebook.cellRuntime[cellId]?.output ?? null;
35
+ }
36
+
37
+ /** A store holding the fixture, with each cell's output as a host result. */
38
+ function createMockStore(notebook: NotebookFixture): JotaiStore {
39
+ const store = createStore();
40
+ store.set(notebookAtom, notebook);
41
+ MockExecutions.seed(
42
+ store,
43
+ notebook.cellIds.flatMap((cellId) => {
44
+ const output = outputOf(notebook, cellId);
45
+ return output === null
46
+ ? []
47
+ : [
48
+ MockExecutions.shown(cellId, {
49
+ mimetype: output.mimetype,
50
+ data: String(output.data),
51
+ }),
52
+ ];
53
+ }),
54
+ );
26
55
  return store;
27
56
  }
28
57
 
29
58
  describe("CellOutputContextProvider", () => {
30
59
  let provider: CellOutputContextProvider;
31
60
  let mockStore: JotaiStore;
32
- let mockNotebook: NotebookState;
61
+ let mockNotebook: NotebookFixture;
33
62
 
34
63
  beforeEach(() => {
35
64
  // Create a basic mock notebook state
@@ -69,7 +98,7 @@ describe("CellOutputContextProvider", () => {
69
98
  output: null,
70
99
  },
71
100
  },
72
- } as unknown as NotebookState;
101
+ } as unknown as NotebookFixture;
73
102
 
74
103
  mockStore = createMockStore(mockNotebook);
75
104
  provider = new CellOutputContextProvider(mockStore);
@@ -208,7 +237,7 @@ describe("Cell output utility functions", () => {
208
237
  cellIds: [],
209
238
  cellData: {},
210
239
  cellRuntime: {},
211
- } as unknown as NotebookState;
240
+ } as unknown as NotebookFixture;
212
241
 
213
242
  mockStore = createMockStore(mockNotebook);
214
243
  provider = new CellOutputContextProvider(mockStore);
@@ -339,7 +368,7 @@ describe("Cell output utility functions", () => {
339
368
  cellIds: [],
340
369
  cellData: {},
341
370
  cellRuntime: {},
342
- } as unknown as NotebookState;
371
+ } as unknown as NotebookFixture;
343
372
 
344
373
  mockStore = createMockStore(mockNotebook);
345
374
  provider = new CellOutputContextProvider(mockStore);
@@ -389,7 +418,7 @@ describe("Cell output utility functions", () => {
389
418
  });
390
419
 
391
420
  describe("getCellContextData", () => {
392
- let mockNotebook: NotebookState;
421
+ let mockNotebook: NotebookFixture;
393
422
 
394
423
  beforeEach(() => {
395
424
  mockNotebook = {
@@ -424,11 +453,15 @@ describe("Cell output utility functions", () => {
424
453
  ],
425
454
  },
426
455
  },
427
- } as unknown as NotebookState;
456
+ } as unknown as NotebookFixture;
428
457
  });
429
458
 
430
459
  it("should extract basic cell data", () => {
431
- const result = getCellContextData(cellId("cell1"), mockNotebook);
460
+ const result = getCellContextData(
461
+ cellId("cell1"),
462
+ mockNotebook,
463
+ outputOf(mockNotebook, "cell1"),
464
+ );
432
465
 
433
466
  expect(result.cellId).toBe("cell1");
434
467
  expect(result.cellName).toBe("My Named Cell");
@@ -436,13 +469,21 @@ describe("Cell output utility functions", () => {
436
469
  });
437
470
 
438
471
  it("should generate cell name for unnamed cells", () => {
439
- const result = getCellContextData(cellId("cell2"), mockNotebook);
472
+ const result = getCellContextData(
473
+ cellId("cell2"),
474
+ mockNotebook,
475
+ outputOf(mockNotebook, "cell2"),
476
+ );
440
477
 
441
478
  expect(result.cellName).toBe("cell-1"); // 0-indexed, so cell2 is at index 1
442
479
  });
443
480
 
444
481
  it("should include cell output when present", () => {
445
- const result = getCellContextData(cellId("cell1"), mockNotebook);
482
+ const result = getCellContextData(
483
+ cellId("cell1"),
484
+ mockNotebook,
485
+ outputOf(mockNotebook, "cell1"),
486
+ );
446
487
 
447
488
  expect(result.cellOutput).toBeDefined();
448
489
  expect(result.cellOutput?.outputType).toBe("text");
@@ -450,21 +491,34 @@ describe("Cell output utility functions", () => {
450
491
  });
451
492
 
452
493
  it("should not include cell output when not present", () => {
453
- const result = getCellContextData(cellId("cell2"), mockNotebook);
494
+ const result = getCellContextData(
495
+ cellId("cell2"),
496
+ mockNotebook,
497
+ outputOf(mockNotebook, "cell2"),
498
+ );
454
499
 
455
500
  expect(result.cellOutput).toBeUndefined();
456
501
  });
457
502
 
458
503
  it("should not include console outputs by default", () => {
459
- const result = getCellContextData(cellId("cell2"), mockNotebook);
504
+ const result = getCellContextData(
505
+ cellId("cell2"),
506
+ mockNotebook,
507
+ outputOf(mockNotebook, "cell2"),
508
+ );
460
509
 
461
510
  expect(result.consoleOutputs).toBeUndefined();
462
511
  });
463
512
 
464
513
  it("should include console outputs when opted in", () => {
465
- const result = getCellContextData(cellId("cell2"), mockNotebook, {
466
- includeConsoleOutput: true,
467
- });
514
+ const result = getCellContextData(
515
+ cellId("cell2"),
516
+ mockNotebook,
517
+ outputOf(mockNotebook, "cell2"),
518
+ {
519
+ includeConsoleOutput: true,
520
+ },
521
+ );
468
522
 
469
523
  expect(result.consoleOutputs).toBeDefined();
470
524
  expect(result.consoleOutputs).toHaveLength(1);
@@ -488,9 +542,14 @@ describe("Cell output utility functions", () => {
488
542
  ];
489
543
  }
490
544
 
491
- const result = getCellContextData(cellId("cell2"), mockNotebook, {
492
- includeConsoleOutput: true,
493
- });
545
+ const result = getCellContextData(
546
+ cellId("cell2"),
547
+ mockNotebook,
548
+ outputOf(mockNotebook, "cell2"),
549
+ {
550
+ includeConsoleOutput: true,
551
+ },
552
+ );
494
553
 
495
554
  expect(result.consoleOutputs).toHaveLength(1);
496
555
  expect(result.consoleOutputs?.[0]?.processedContent).toBe("valid output");
@@ -507,9 +566,14 @@ describe("Cell output utility functions", () => {
507
566
  ];
508
567
  }
509
568
 
510
- const result = getCellContextData(cellId("cell1"), mockNotebook, {
511
- includeConsoleOutput: true,
512
- });
569
+ const result = getCellContextData(
570
+ cellId("cell1"),
571
+ mockNotebook,
572
+ outputOf(mockNotebook, "cell1"),
573
+ {
574
+ includeConsoleOutput: true,
575
+ },
576
+ );
513
577
 
514
578
  expect(result.cellOutput).toBeDefined();
515
579
  expect(result.cellOutput?.processedContent).toBe("42");
@@ -520,23 +584,32 @@ describe("Cell output utility functions", () => {
520
584
  });
521
585
 
522
586
  it("should handle empty console outputs array", () => {
523
- const result = getCellContextData(cellId("cell1"), mockNotebook, {
524
- includeConsoleOutput: true,
525
- });
587
+ const result = getCellContextData(
588
+ cellId("cell1"),
589
+ mockNotebook,
590
+ outputOf(mockNotebook, "cell1"),
591
+ {
592
+ includeConsoleOutput: true,
593
+ },
594
+ );
526
595
 
527
596
  expect(result.consoleOutputs).toEqual([]);
528
597
  });
529
598
 
530
599
  it("should handle media outputs in cell output", () => {
531
- const cell1Runtime = mockNotebook.cellRuntime[cellId("cell1")];
600
+ const cell1Runtime = mockNotebook.cellRuntime.cell1;
532
601
  if (cell1Runtime) {
533
- (cell1Runtime as { output: OutputMessage | null }).output = {
602
+ cell1Runtime.output = {
534
603
  mimetype: "image/png",
535
604
  data: "data:image/png;base64,test",
536
605
  } as OutputMessage;
537
606
  }
538
607
 
539
- const result = getCellContextData(cellId("cell1"), mockNotebook);
608
+ const result = getCellContextData(
609
+ cellId("cell1"),
610
+ mockNotebook,
611
+ outputOf(mockNotebook, "cell1"),
612
+ );
540
613
 
541
614
  expect(result.cellOutput).toBeDefined();
542
615
  expect(result.cellOutput?.outputType).toBe("media");
@@ -554,9 +627,14 @@ describe("Cell output utility functions", () => {
554
627
  ];
555
628
  }
556
629
 
557
- const result = getCellContextData(cellId("cell2"), mockNotebook, {
558
- includeConsoleOutput: true,
559
- });
630
+ const result = getCellContextData(
631
+ cellId("cell2"),
632
+ mockNotebook,
633
+ outputOf(mockNotebook, "cell2"),
634
+ {
635
+ includeConsoleOutput: true,
636
+ },
637
+ );
560
638
 
561
639
  expect(result.consoleOutputs).toHaveLength(1);
562
640
  expect(result.consoleOutputs?.[0]?.outputType).toBe("media");