@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
@@ -1,7 +1,8 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import React, { memo, Suspense, useMemo, useRef } from "react";
3
3
  import { type CellId, CellOutputId } from "@/core/cells/ids";
4
- import type { CellOutput, OutputMessage } from "@/core/kernel/messages";
4
+ import type { CellOutput } from "@/core/executions";
5
+ import type { OutputMessage } from "@/core/kernel/messages";
5
6
  import { cn } from "@/utils/cn";
6
7
  import { logNever } from "../../utils/assertNever";
7
8
  import { ErrorBoundary } from "./boundary/ErrorBoundary";
@@ -67,7 +68,7 @@ export type OnRefactorWithAI = (opts: {
67
68
  */
68
69
  export const OutputRenderer: React.FC<{
69
70
  message: Pick<
70
- OutputMessage,
71
+ CellOutput,
71
72
  "channel" | "data" | "mimetype" | "code" | "traceback_format"
72
73
  >;
73
74
  cellId?: CellId;
@@ -280,7 +281,7 @@ const MimeBundleOutputRenderer: React.FC<{
280
281
  // Filter out metadata from the mime entries and type narrow
281
282
  const rawEntries = Objects.entries(mimebundle as Record<string, unknown>)
282
283
  .filter(([key]) => key !== METADATA_KEY)
283
- .map(([mime, data]) => [mime, data] as [MimeType, CellOutput["data"]]);
284
+ .map(([mime, data]) => [mime, data] as [MimeType, OutputMessage["data"]]);
284
285
 
285
286
  // Apply precedence ordering and hiding rules
286
287
  const { entries: mimeEntries } = processMimeBundle(rawEntries);
@@ -351,7 +352,7 @@ const MimeBundleOutputRenderer: React.FC<{
351
352
  MimeBundleOutputRenderer.displayName = "MimeBundleOutputRenderer";
352
353
 
353
354
  interface OutputAreaProps {
354
- output: OutputMessage | null;
355
+ output: CellOutput | null;
355
356
  cellId: CellId;
356
357
  stale: boolean;
357
358
  loading: boolean;
@@ -109,12 +109,7 @@ describe("Cell data attributes", () => {
109
109
  },
110
110
  });
111
111
 
112
- notebook.cellRuntime[cid] = createCellRuntimeState({
113
- output: null,
114
- consoleOutputs: [],
115
- debuggerActive: false,
116
- outline: null,
117
- });
112
+ notebook.cellRuntime[cid] = createCellRuntimeState();
118
113
 
119
114
  store.set(notebookAtom, notebook);
120
115
 
@@ -8,6 +8,7 @@ import {
8
8
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
9
9
  import { Provider, createStore } from "jotai";
10
10
  import type { ReactNode } from "react";
11
+ import { MockExecutions } from "@/__mocks__/executions";
11
12
  import { MockNotebook } from "@/__mocks__/notebook";
12
13
  import { cellId } from "@/__tests__/branded";
13
14
  import { notebookAtom } from "@/core/cells/cells";
@@ -25,16 +26,13 @@ describe("DynamicFavicon", () => {
25
26
  }
26
27
 
27
28
  function setErrors() {
28
- store.set(
29
- notebookAtom,
30
- MockNotebook.notebookStateWithErrors([
31
- {
32
- cellId: id,
33
- cellName: "cell",
34
- errorData: [MockNotebook.errors.syntax("Invalid syntax")],
35
- },
36
- ]),
37
- );
29
+ MockNotebook.withErrors(store, [
30
+ {
31
+ cellId: id,
32
+ cellName: "cell",
33
+ error: { kind: "invalid-syntax", message: "Invalid syntax" },
34
+ },
35
+ ]);
38
36
  }
39
37
 
40
38
  beforeEach(() => {
@@ -211,12 +209,9 @@ describe("DynamicFavicon", () => {
211
209
  act(() => setErrors());
212
210
  await waitFor(() => expect(favicon.href).toContain("circle-x.ico"));
213
211
 
214
- act(() =>
215
- store.set(
216
- notebookAtom,
217
- MockNotebook.notebookState({ cellData: { [id]: {} } }),
218
- ),
219
- );
212
+ act(() => {
213
+ MockExecutions.seed(store, []);
214
+ });
220
215
  await waitFor(() => expect(favicon.href).toContain("circle-check.ico"));
221
216
  });
222
217
 
@@ -16,14 +16,13 @@ import {
16
16
  document as documentOf,
17
17
  withCells,
18
18
  } from "@/core/notebook/document/__tests__/fixtures";
19
- import type { CellRuntimeState } from "@/core/cells/types";
20
- import { createCellRuntimeState } from "@/core/cells/types";
21
19
  import { defaultUserConfig } from "@/core/config/config-schema";
22
20
  import type { AppMode } from "@/core/mode";
23
21
  import { requestClientAtom } from "@/core/network/requests";
24
22
  import { Cell } from "../notebook-cell";
25
23
 
26
24
  const cid = cellId("test");
25
+ const PERSIST = { mimetype: "text/html", data: "<span>persist me</span>" };
27
26
 
28
27
  function createTestWrapper() {
29
28
  const store = createStore();
@@ -37,10 +36,7 @@ function createTestWrapper() {
37
36
  return { wrapper, store };
38
37
  }
39
38
 
40
- function seedNotebook(
41
- store: ReturnType<typeof createStore>,
42
- runtimeOverrides: Partial<CellRuntimeState> = {},
43
- ) {
39
+ function seedNotebook(store: ReturnType<typeof createStore>) {
44
40
  const notebook = MockNotebook.notebookState({
45
41
  cellData: {
46
42
  [cid]: {
@@ -54,15 +50,6 @@ function seedNotebook(
54
50
  },
55
51
  },
56
52
  });
57
- notebook.cellRuntime[cid] = createCellRuntimeState({
58
- output: {
59
- channel: "output",
60
- mimetype: "text/html",
61
- data: "<span>persist me</span>",
62
- timestamp: 0,
63
- },
64
- ...runtimeOverrides,
65
- });
66
53
  store.set(notebookAtom, notebook);
67
54
  }
68
55
 
@@ -94,6 +81,7 @@ beforeAll(() => {
94
81
  describe("output persistence across mode changes", () => {
95
82
  it("preserves the output DOM node when toggling edit <-> present", () => {
96
83
  const { store, wrapper } = createTestWrapper();
84
+ MockExecutions.seed(store, [MockExecutions.shown(cid, PERSIST)]);
97
85
  seedNotebook(store);
98
86
 
99
87
  const { container, rerender } = render(renderCell("edit"), { wrapper });
@@ -144,6 +132,7 @@ describe("output persistence across mode changes", () => {
144
132
 
145
133
  it("hides all edit chrome while presenting", () => {
146
134
  const { store, wrapper } = createTestWrapper();
135
+ MockExecutions.seed(store, [MockExecutions.shown(cid, PERSIST)]);
147
136
  seedNotebook(store);
148
137
 
149
138
  const { container, rerender } = render(renderCell("edit"), { wrapper });
@@ -195,7 +184,7 @@ describe("output persistence across mode changes", () => {
195
184
  // The host holds newer source than the cell last ran with
196
185
  MockExecutions.seed(
197
186
  store,
198
- [MockExecutions.completed(cid, { code_fingerprint: "ran" })],
187
+ [MockExecutions.shown(cid, PERSIST, { code_fingerprint: "ran" })],
199
188
  null,
200
189
  withCells(
201
190
  documentOf(),
@@ -223,14 +212,7 @@ describe("output persistence across mode changes", () => {
223
212
  it("hides errored cells while presenting without unmounting them", () => {
224
213
  const { store, wrapper } = createTestWrapper();
225
214
  MockExecutions.seed(store, [MockExecutions.errored(cid)]);
226
- seedNotebook(store, {
227
- output: {
228
- channel: "marimo-error",
229
- mimetype: "application/vnd.marimo+error",
230
- data: [{ type: "exception", exception_type: "ValueError", msg: "!" }],
231
- timestamp: 0,
232
- },
233
- });
215
+ seedNotebook(store);
234
216
 
235
217
  const { container, rerender } = render(renderCell("edit"), { wrapper });
236
218
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  import { describe, expect, it } from "vitest";
4
4
  import { MockNotebook } from "@/__mocks__/notebook";
5
- import type { OutputMessage } from "@/core/kernel/messages";
5
+ import type { CellOutput } from "@/core/executions";
6
6
  import { outputExpansionConfigs } from "../useSetOutputsExpanded";
7
7
 
8
- const output: OutputMessage = {
8
+ const output: CellOutput = {
9
9
  channel: "output",
10
10
  mimetype: "text/plain",
11
11
  data: "hello",
@@ -22,20 +22,18 @@ describe("outputExpansionConfigs", () => {
22
22
  [expanded]: { config: { expand_output: true } },
23
23
  [expandedWithoutOutput]: { config: { expand_output: true } },
24
24
  },
25
- cellRuntime: {
26
- [withOutput]: { output },
27
- [expanded]: { output },
28
- },
29
25
  });
26
+ const outputOf = (cellId: string) =>
27
+ cellId === withOutput || cellId === expanded ? output : null;
30
28
 
31
29
  it("expands clamped cells with output and skips cells without output", () => {
32
- expect(outputExpansionConfigs(notebook, true)).toEqual({
30
+ expect(outputExpansionConfigs(notebook, outputOf, true)).toEqual({
33
31
  [withOutput]: { expand_output: true },
34
32
  });
35
33
  });
36
34
 
37
35
  it("clamps all expanded cells, including those without current output", () => {
38
- expect(outputExpansionConfigs(notebook, false)).toEqual({
36
+ expect(outputExpansionConfigs(notebook, outputOf, false)).toEqual({
39
37
  [expanded]: { expand_output: false },
40
38
  [expandedWithoutOutput]: { expand_output: false },
41
39
  });
@@ -1,9 +1,11 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
+ import { useStore } from "jotai";
3
4
  import { useCallback } from "react";
4
5
  import { getNotebook, type NotebookState } from "@/core/cells/cells";
5
6
  import type { CellId } from "@/core/cells/ids";
6
7
  import { isOutputEmpty } from "@/core/cells/outputs";
8
+ import { type CellOutput, cellOutputAtom } from "@/core/executions";
7
9
  import { useNotebookDocumentEdit } from "@/core/notebook/document";
8
10
  import type { CellConfig } from "@/core/network/types";
9
11
  import { Objects } from "@/utils/objects";
@@ -12,7 +14,8 @@ import { Objects } from "@/utils/objects";
12
14
  * The `expand_output` config changes needed to expand or clamp every output.
13
15
  */
14
16
  export function outputExpansionConfigs(
15
- notebook: NotebookState,
17
+ notebook: Pick<NotebookState, "cellIds" | "cellData">,
18
+ outputOf: (cellId: CellId) => CellOutput | null,
16
19
  expanded: boolean,
17
20
  ): Record<CellId, Partial<CellConfig>> {
18
21
  const configs: Record<CellId, Partial<CellConfig>> = {};
@@ -24,7 +27,7 @@ export function outputExpansionConfigs(
24
27
  ) {
25
28
  continue;
26
29
  }
27
- if (expanded && isOutputEmpty(notebook.cellRuntime[cellId]?.output)) {
30
+ if (expanded && isOutputEmpty(outputOf(cellId))) {
28
31
  continue;
29
32
  }
30
33
  configs[cellId] = { expand_output: expanded };
@@ -38,11 +41,16 @@ export function outputExpansionConfigs(
38
41
  */
39
42
  export const useSetOutputsExpanded = () => {
40
43
  const edit = useNotebookDocumentEdit();
44
+ const store = useStore();
41
45
 
42
46
  return useCallback(
43
47
  (expanded: boolean) => {
44
48
  const entries = Objects.entries(
45
- outputExpansionConfigs(getNotebook(), expanded),
49
+ outputExpansionConfigs(
50
+ getNotebook(),
51
+ (cellId) => store.get(cellOutputAtom(cellId)),
52
+ expanded,
53
+ ),
46
54
  );
47
55
  if (entries.length === 0) {
48
56
  return;
@@ -54,6 +62,6 @@ export const useSetOutputsExpanded = () => {
54
62
  }
55
63
  });
56
64
  },
57
- [edit],
65
+ [edit, store],
58
66
  );
59
67
  };
@@ -24,7 +24,7 @@ import { useRestoreFocus } from "@/components/ui/use-restore-focus";
24
24
  import { useCellData, useCellRuntime } from "@/core/cells/cells";
25
25
  import { CellOutputId } from "@/core/cells/ids";
26
26
  import { isOutputEmpty } from "@/core/cells/outputs";
27
- import { useCellExecution } from "@/core/executions";
27
+ import { useCellExecution, useCellOutput } from "@/core/executions";
28
28
  import { goToDefinitionWithLspFallback } from "@/core/codemirror/go-to-definition/utils";
29
29
  import { sendToPanelManager } from "@/core/vscode/vscode-bindings";
30
30
  import { copyImageToClipboard, copyToClipboard } from "@/utils/copy";
@@ -57,6 +57,7 @@ export const CellActionsContextMenu = ({
57
57
  const cellData = useCellData(cellId);
58
58
  const cellRuntime = useCellRuntime(cellId);
59
59
  const execution = useCellExecution(cellId);
60
+ const output = useCellOutput(cellId);
60
61
  const actions = useCellActionButtons({
61
62
  cell: {
62
63
  cellId: cellId,
@@ -64,7 +65,7 @@ export const CellActionsContextMenu = ({
64
65
  config: cellData.config,
65
66
  status: execution.status,
66
67
  blocked: execution.blocked,
67
- hasOutput: !isOutputEmpty(cellRuntime.output),
68
+ hasOutput: !isOutputEmpty(output),
68
69
  hasConsoleOutput: cellRuntime.consoleOutputs.length > 0,
69
70
  getEditorView,
70
71
  },
@@ -8,16 +8,17 @@ import {
8
8
  screen,
9
9
  waitFor,
10
10
  } from "@testing-library/react";
11
- import { atom, createStore, Provider, useAtomValue } from "jotai";
11
+ import { atom, createStore, Provider } from "jotai";
12
12
  import type React from "react";
13
13
  import { beforeEach, describe, expect, it, vi } from "vitest";
14
+ import { MockExecutions } from "@/__mocks__/executions";
14
15
  import { MockNotebook } from "@/__mocks__/notebook";
15
16
  import { cellId } from "@/__tests__/branded";
16
17
  import { PAIR_CONFIG } from "@/__tests__/fixtures/pair-config";
17
18
  import { TooltipProvider } from "@/components/ui/tooltip";
18
19
  import { toast } from "@/components/ui/use-toast";
19
20
  import type { Attachment } from "@/core/notebook/attachments";
20
- import { exportedForTesting, notebookAtom } from "@/core/cells/cells";
21
+ import { notebookAtom } from "@/core/cells/cells";
21
22
  import {
22
23
  type CellOutputMessage,
23
24
  type ErrorMessageOutput,
@@ -25,7 +26,13 @@ import {
25
26
  } from "@/core/cells/error-report";
26
27
  import { pairConfigAtom } from "@/core/config/pair";
27
28
  import { readExport } from "@/core/cells/session";
28
- import type { MarimoError, OutputMessage } from "@/core/kernel/messages";
29
+ import { cellOutputView, useCellOutput } from "@/core/executions";
30
+ import {
31
+ cell,
32
+ document as documentOf,
33
+ withCells,
34
+ } from "@/core/notebook/document/__tests__/fixtures";
35
+ import type { MarimoError } from "@/core/kernel/messages";
29
36
  import {
30
37
  type StableSessionId,
31
38
  stableSessionIdAtom,
@@ -48,10 +55,15 @@ vi.mock("@/components/editor/chrome/wrapper/useOpenAiAssistant", () => ({
48
55
 
49
56
  const CELL_ID = cellId("test-cell");
50
57
  const STABLE_ID = "stable/test" as StableSessionId;
51
- const attachmentsAtom = atom<Attachment[]>([]);
58
+ // Hoisted with the module mock below, which reads it as modules load.
59
+ const { attachmentsAtom } = await vi.hoisted(async () => {
60
+ const { atom } = await import("jotai");
61
+ return { attachmentsAtom: atom<Attachment[]>([]) };
62
+ });
52
63
  vi.mock("@/core/session/active-notebook", async (importOriginal) => ({
53
64
  ...(await importOriginal<typeof import("@/core/session/active-notebook")>()),
54
- activeNotebookReplicaAtom: atom(() => ({ attachmentsAtom })),
65
+ // Writable, so the execution mock can give the replica results.
66
+ activeNotebookReplicaAtom: atom({ attachmentsAtom }),
55
67
  }));
56
68
 
57
69
  const AGENT: Attachment = {
@@ -257,17 +269,14 @@ describe("SendErrorReportButton", () => {
257
269
  notebookAtom,
258
270
  MockNotebook.notebookState({
259
271
  cellData: { [CELL_ID]: { code: "later edit" } },
260
- cellRuntime: {
261
- [CELL_ID]: {
262
- output: {
263
- channel: "output",
264
- mimetype: "text/plain",
265
- data: "<Broken formatter>",
266
- },
267
- },
268
- },
269
272
  }),
270
273
  );
274
+ MockExecutions.seed(store, [
275
+ MockExecutions.shown(CELL_ID, {
276
+ mimetype: "text/plain",
277
+ data: "<Broken formatter>",
278
+ }),
279
+ ]);
271
280
  send();
272
281
  await waitFor(() =>
273
282
  expect(API.post).toHaveBeenCalledWith(ROUTE, {
@@ -317,14 +326,14 @@ describe("SendErrorReportButton", () => {
317
326
  });
318
327
 
319
328
  it("sends the restored exception type and complete traceback", async () => {
320
- const { cellRuntime } = readExport({
329
+ const { snapshot } = readExport({
321
330
  session: {
322
331
  version: "1",
323
332
  metadata: { marimo_version: "1", script_metadata_hash: null },
324
333
  cells: [
325
334
  {
326
335
  id: CELL_ID,
327
- code_hash: null,
336
+ code_hash: "h",
328
337
  console: [],
329
338
  outputs: [
330
339
  {
@@ -342,12 +351,25 @@ describe("SendErrorReportButton", () => {
342
351
  },
343
352
  ],
344
353
  },
345
- notebook: null,
354
+ notebook: {
355
+ version: "1",
356
+ metadata: { marimo_version: "1" },
357
+ cells: [
358
+ { id: CELL_ID, code: CODE, code_hash: "h", name: null, config: {} },
359
+ ],
360
+ },
346
361
  filename: null,
347
362
  appConfig: {},
348
363
  });
349
- const message = cellRuntime[CELL_ID].output;
350
- expect(message).toBeDefined();
364
+ const message = cellOutputView(
365
+ {
366
+ ...MockExecutions.inputs(snapshot?.results ?? []),
367
+ cleared: new Map(),
368
+ cells: new Map(snapshot?.cells.map((cell) => [cell.id, cell])),
369
+ },
370
+ CELL_ID,
371
+ );
372
+ expect(message).not.toBeNull();
351
373
  renderButton({
352
374
  content: message && <OutputRenderer cellId={CELL_ID} message={message} />,
353
375
  });
@@ -392,59 +414,54 @@ describe("SendErrorReportButton", () => {
392
414
  await waitFor(() => expect(API.post).toHaveBeenCalledWith(ROUTE, content));
393
415
  });
394
416
 
395
- it.each([false, true])(
396
- "retains failed code after edits and a queued run (%s)",
397
- async (queue) => {
398
- const output: OutputMessage = {
399
- channel: "marimo-error",
400
- mimetype: "application/vnd.marimo+error",
401
- data: ERRORS,
402
- code: CODE,
403
- };
404
- // Render from the store so reducer changes reach the button.
405
- const StoreOutput = () => {
406
- const message = useAtomValue(notebookAtom).cellRuntime[CELL_ID]?.output;
407
- return message ? (
408
- <OutputRenderer cellId={CELL_ID} message={message} />
409
- ) : null;
410
- };
411
- const { store } = renderButton({ content: <StoreOutput /> });
412
- const actions = exportedForTesting.createActions((action) => {
413
- store.set(notebookAtom, (state) =>
414
- exportedForTesting.reducer(state, action),
415
- );
416
- });
417
- act(() => {
418
- store.set(
419
- notebookAtom,
420
- MockNotebook.notebookState({
421
- cellData: { [CELL_ID]: { code: CODE } },
422
- cellRuntime: { [CELL_ID]: { output } },
423
- }),
424
- );
425
- store.set(notebookAtom, (state) => ({
426
- ...state,
427
- cellData: {
428
- ...state.cellData,
429
- [CELL_ID]: {
430
- ...state.cellData[CELL_ID],
431
- code: "print('edited')",
432
- },
433
- },
434
- }));
435
- if (queue) {
436
- actions.prepareForRun({ cellId: CELL_ID });
437
- actions.handleCellMessage({
438
- cell_id: CELL_ID,
439
- status: "queued",
440
- timestamp: 2,
441
- });
442
- }
443
- });
444
- send();
445
- await waitFor(() => expect(API.post).toHaveBeenCalledWith(ROUTE, REPORT));
446
- },
447
- );
417
+ it("sends the source that raised while the host still has it", async () => {
418
+ const confirmed = (fingerprint: string) =>
419
+ withCells(
420
+ documentOf(),
421
+ {
422
+ c1: null,
423
+ c2: null,
424
+ [CELL_ID]: cell(CELL_ID, CODE, { code_fingerprint: fingerprint }),
425
+ },
426
+ [CELL_ID],
427
+ );
428
+ // Render from the store so the host's changes reach the button.
429
+ const StoreOutput = () => {
430
+ const message = useCellOutput(CELL_ID);
431
+ return message ? (
432
+ <OutputRenderer cellId={CELL_ID} message={message} />
433
+ ) : null;
434
+ };
435
+ const { store, rerender } = renderButton({ content: <div /> });
436
+ const replica = MockExecutions.seed(
437
+ store,
438
+ [
439
+ MockExecutions.failed(
440
+ CELL_ID,
441
+ { name: "NameError", message: MESSAGE },
442
+ { code_fingerprint: "ran" },
443
+ ),
444
+ ],
445
+ null,
446
+ confirmed("ran"),
447
+ );
448
+ rerender(<StoreOutput />);
449
+ send();
450
+ await waitFor(() => expect(API.post).toHaveBeenCalledWith(ROUTE, REPORT));
451
+
452
+ // Once an edit is confirmed, the source that raised is gone.
453
+ vi.mocked(API.post).mockClear();
454
+ act(() => {
455
+ store.set(replica.documentAtom, confirmed("edited"));
456
+ });
457
+ send();
458
+ await waitFor(() =>
459
+ expect(API.post).toHaveBeenCalledWith(ROUTE, {
460
+ ...REPORT,
461
+ code: undefined,
462
+ }),
463
+ );
464
+ });
448
465
 
449
466
  it("does not borrow an old console traceback for a cancelled descendant", async () => {
450
467
  const cancelled: MarimoError[] = [
@@ -47,6 +47,8 @@ import {
47
47
  replyInput,
48
48
  useCellExecution,
49
49
  useCellFreshness,
50
+ useCellOutline,
51
+ useCellOutput,
50
52
  } from "@/core/executions";
51
53
  import type { WithResponse } from "@/core/cells/types";
52
54
  import type { OutputMessage } from "@/core/kernel/messages";
@@ -350,7 +352,7 @@ const ReadonlyCellComponent = forwardRef(
350
352
  (props: { cellId: CellId }, ref: React.ForwardedRef<HTMLDivElement>) => {
351
353
  const { cellId } = props;
352
354
  const cellData = useCellData(cellId);
353
- const cellRuntime = useCellRuntime(cellId);
355
+ const output = useCellOutput(cellId);
354
356
  const execution = useCellExecution(cellId);
355
357
  const freshness = useCellFreshness(cellId);
356
358
  const errored = execution.outcome === "error";
@@ -366,7 +368,7 @@ const ReadonlyCellComponent = forwardRef(
366
368
  errored,
367
369
  interrupted,
368
370
  stopped,
369
- output: cellRuntime.output,
371
+ output,
370
372
  showErrorTracebacks: false,
371
373
  });
372
374
 
@@ -386,7 +388,7 @@ const ReadonlyCellComponent = forwardRef(
386
388
  forceExpand={true}
387
389
  className={CSSClasses.outputArea}
388
390
  cellId={cellId}
389
- output={cellRuntime.output}
391
+ output={output}
390
392
  stale={outputIsStale(execution, freshness, true)}
391
393
  loading={outputIsLoading(execution.status)}
392
394
  />
@@ -415,6 +417,8 @@ const EditableCellComponent = ({
415
417
  const cellRef = useRef<HTMLDivElement>(null);
416
418
  const cellData = useCellData(cellId);
417
419
  const cellRuntime = useCellRuntime(cellId);
420
+ const output = useCellOutput(cellId);
421
+ const outline = useCellOutline(cellId);
418
422
  const execution = useCellExecution(cellId);
419
423
  const freshness = useCellFreshness(cellId);
420
424
  const errored = execution.outcome === "error";
@@ -456,7 +460,7 @@ const EditableCellComponent = ({
456
460
  errored,
457
461
  interrupted,
458
462
  stopped,
459
- output: cellRuntime.output,
463
+ output,
460
464
  showErrorTracebacks: userConfig.runtime.show_tracebacks ?? false,
461
465
  });
462
466
 
@@ -502,8 +506,8 @@ const EditableCellComponent = ({
502
506
  editorView,
503
507
  cellActionDropdownRef,
504
508
  });
505
- const canCollapse = canCollapseOutline(cellRuntime.outline);
506
- const hasOutput = !isOutputEmpty(cellRuntime.output);
509
+ const canCollapse = canCollapseOutline(outline);
510
+ const hasOutput = !isOutputEmpty(output);
507
511
  // While presenting, pending edits do not dim the output as stale,
508
512
  // matching the read view.
509
513
  const isStaleCell = outputIsStale(execution, freshness, !isPresenting);
@@ -598,7 +602,7 @@ const EditableCellComponent = ({
598
602
  forceExpand={isMarkdownCodeHidden || isPresenting}
599
603
  className={CSSClasses.outputArea}
600
604
  cellId={cellId}
601
- output={cellRuntime.output}
605
+ output={output}
602
606
  stale={isStaleCell}
603
607
  loading={outputIsLoading(execution.status)}
604
608
  />
@@ -1068,6 +1072,7 @@ const SetupCellComponent = ({
1068
1072
  const cellRef = useRef<HTMLDivElement>(null);
1069
1073
  const cellData = useCellData(cellId);
1070
1074
  const cellRuntime = useCellRuntime(cellId);
1075
+ const output = useCellOutput(cellId);
1071
1076
  const execution = useCellExecution(cellId);
1072
1077
  const freshness = useCellFreshness(cellId);
1073
1078
  const errored = execution.outcome === "error";
@@ -1123,9 +1128,9 @@ const SetupCellComponent = ({
1123
1128
  editorView,
1124
1129
  cellActionDropdownRef,
1125
1130
  });
1126
- const hasOutput = !isOutputEmpty(cellRuntime.output);
1131
+ const hasOutput = !isOutputEmpty(output);
1127
1132
  const hasConsoleOutput = cellRuntime.consoleOutputs.length > 0;
1128
- const isErrorOutput = isErrorMime(cellRuntime.output?.mimetype);
1133
+ const isErrorOutput = isErrorMime(output?.mimetype);
1129
1134
 
1130
1135
  const className = clsx("marimo-cell", "hover-actions-parent z-10", {
1131
1136
  interactive: true,
@@ -1294,7 +1299,7 @@ const SetupCellComponent = ({
1294
1299
  forceExpand={true}
1295
1300
  className={CSSClasses.outputArea}
1296
1301
  cellId={cellId}
1297
- output={cellRuntime.output}
1302
+ output={output}
1298
1303
  stale={false}
1299
1304
  loading={loading}
1300
1305
  />
@@ -1,10 +1,12 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
- import type { OutputMessage } from "@/core/kernel/messages";
2
+ import type { CellOutput } from "@/core/executions";
3
3
  import { ansiToPlainText, parseHtmlContent } from "@/utils/dom";
4
4
  import { Strings } from "@/utils/strings";
5
5
 
6
6
  /** Convert cell or console output to a string, while handling html and ansi codes */
7
- export function processOutput(output: OutputMessage): string {
7
+ export function processOutput(
8
+ output: Pick<CellOutput, "mimetype" | "data">,
9
+ ): string {
8
10
  if (
9
11
  output.mimetype.startsWith("application/vnd.marimo") ||
10
12
  output.mimetype === "text/html"
@@ -5,6 +5,7 @@ import type React from "react";
5
5
  import { memo, type PropsWithChildren } from "react";
6
6
  import { flattenTopLevelNotebookCells, useNotebook } from "@/core/cells/cells";
7
7
  import type { AppConfig } from "@/core/config/config-schema";
8
+ import { cellOutputsAtom } from "@/core/executions";
8
9
  import { resolveLayoutData } from "@/core/layout/layout";
9
10
  import {
10
11
  resolveLayoutType,
@@ -70,8 +71,9 @@ export const PluginCellRenderer = (props: PluginCellRendererProps) => {
70
71
  const { appConfig, mode, plugin } = props;
71
72
  const layoutState = useLayoutState();
72
73
  const notebook = useNotebook();
74
+ const outputs = useAtomValue(cellOutputsAtom);
73
75
  const { setCurrentLayoutData } = useLayoutActions();
74
- const cells = flattenTopLevelNotebookCells(notebook);
76
+ const cells = flattenTopLevelNotebookCells(notebook, outputs);
75
77
  const layout = resolveLayoutData({ state: layoutState, plugin, cells });
76
78
 
77
79
  const Renderer = plugin.Component;