@marimo-team/islands 0.25.3-dev462 → 0.25.3-dev464

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 (50) hide show
  1. package/dist/{ErrorBoundary-BnH_3-iX.js → ErrorBoundary-BUp3s8bW.js} +1 -1
  2. package/dist/assets/__vite-browser-external-DoIBUY2I.js +1 -0
  3. package/dist/assets/{worker-D70Lo75A.js → worker-DFvnFhLF.js} +2 -2
  4. package/dist/{chat-ui-Ci-OmyBN.js → chat-ui-DFoH-uxc.js} +3 -3
  5. package/dist/{code-visibility-9cVyvQDR.js → code-visibility-JyOG3ytM.js} +2 -2
  6. package/dist/{common-BFNJT3tG.js → common-DsPeHITU.js} +4 -4
  7. package/dist/{data-grid-overlay-editor-CQpih6Vr.js → data-grid-overlay-editor-D6RpA9b2.js} +1 -1
  8. package/dist/{error-entries-DMWlemUn.js → error-entries-C9OKfJKe.js} +283 -279
  9. package/dist/{feedback-button-D_xvjRAC.js → feedback-button-w5jJOd6o.js} +3 -3
  10. package/dist/{glide-data-editor-ttA3lt4w.js → glide-data-editor-lWcwB0Si.js} +3 -3
  11. package/dist/{globals-DgHMWwtp.js → globals-BFICoaLo.js} +1 -1
  12. package/dist/{html-to-image-CDlYnllr.js → html-to-image-BiWLL4Tu.js} +1 -1
  13. package/dist/main.js +163 -176
  14. package/dist/{number-overlay-editor-VuSNPGWk.js → number-overlay-editor-BDYmg8YM.js} +1 -1
  15. package/dist/{process-output-89n_C_pU.js → process-output-ClyiXL-f.js} +2 -2
  16. package/dist/{reveal-component-D63GuWKz.js → reveal-component-B63xZtLQ.js} +2 -2
  17. package/package.json +1 -1
  18. package/src/__mocks__/executions.ts +2 -2
  19. package/src/__mocks__/notebook.ts +6 -3
  20. package/src/components/dependency-graph/minimap-content.tsx +1 -1
  21. package/src/components/editor/notebook-cell.tsx +6 -6
  22. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +2 -2
  23. package/src/components/slides/slide-cell-view.tsx +2 -2
  24. package/src/core/ai/context/providers/__tests__/error.test.ts +0 -4
  25. package/src/core/cells/__tests__/cell.test.ts +8 -8
  26. package/src/core/cells/__tests__/runs.test.ts +1 -1
  27. package/src/core/cells/__tests__/session.test.ts +2 -2
  28. package/src/core/cells/__tests__/utils.test.ts +2 -2
  29. package/src/core/cells/cell.ts +2 -2
  30. package/src/core/cells/execution-console.ts +18 -13
  31. package/src/core/cells/runs.ts +10 -2
  32. package/src/core/cells/session.ts +1 -1
  33. package/src/core/cells/utils.ts +2 -2
  34. package/src/core/executions/__tests__/atoms.test.ts +1 -1
  35. package/src/core/executions/__tests__/interrupt.test.ts +1 -1
  36. package/src/core/executions/__tests__/output.test.ts +26 -5
  37. package/src/core/executions/__tests__/select.test.ts +4 -4
  38. package/src/core/executions/output.ts +16 -4
  39. package/src/core/islands/__tests__/bridge.test.ts +8 -1
  40. package/src/core/islands/bridge.ts +7 -3
  41. package/src/core/notebook/replica/__tests__/executions.test.ts +65 -10
  42. package/src/core/notebook/replica/__tests__/replica.test.ts +3 -1
  43. package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
  44. package/src/core/notebook/replica/replica.ts +2 -8
  45. package/src/core/notebook/replica/resources/executions.ts +28 -6
  46. package/src/core/session/__tests__/backend.test.ts +1 -1
  47. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +8 -11
  48. package/src/core/session/useNotebookSession.tsx +1 -1
  49. package/src/stories/layout/vertical/one-column.stories.tsx +1 -2
  50. package/dist/assets/__vite-browser-external-DxDOnHRB.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { a as n } from "./glide-data-editor-ttA3lt4w.js";
3
+ import { a as n } from "./glide-data-editor-lWcwB0Si.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
5
5
  var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
6
6
  name: "NumberOverlayEditorStyle",
@@ -1,6 +1,6 @@
1
- import { T as e } from "./html-to-image-CDlYnllr.js";
1
+ import { T as e } from "./html-to-image-BiWLL4Tu.js";
2
2
  import { h as t } from "./tooltip-CiJ919pg.js";
3
- import { Tt as n, wt as r } from "./error-entries-DMWlemUn.js";
3
+ import { Tt as n, wt as r } from "./error-entries-C9OKfJKe.js";
4
4
  import { r as i } from "./assertNever-DOTNJ2Y4.js";
5
5
  var a = t("file", [["path", {
6
6
  d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
@@ -3,14 +3,14 @@ import { g as t, h as n, i as r, m as i, t as a } from "./button-qQhINE7z.js";
3
3
  import { t as o } from "./react-Bgs_wQh3.js";
4
4
  import { t as s } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { h as c, t as l } from "./tooltip-CiJ919pg.js";
6
- import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-BFNJT3tG.js";
6
+ import { Cn as u, En as d, Sn as f, dn as p, et as m, f as h, i as g, l as _, n as v, nt as y, r as b, t as x, tt as S, u as C } from "./common-DsPeHITU.js";
7
7
  import { M as w } from "./select-PQHWLm64.js";
8
8
  import { X as T } from "./dropdown-menu-B12Nf3Zf.js";
9
9
  import { t as E } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Rt as D, Vt as O, f as k, i as ee } from "./use-restore-focus-BLj45Ibw.js";
11
11
  import { t as A } from "./useEvent-BoN7U38T.js";
12
12
  import { o as te } from "./static-state-CWXd6dYX.js";
13
- import { n as ne, t as re } from "./code-visibility-9cVyvQDR.js";
13
+ import { n as ne, t as re } from "./code-visibility-JyOG3ytM.js";
14
14
  /* empty css */
15
15
  var j = c("sticky-note", [["path", {
16
16
  d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev462",
3
+ "version": "0.25.3-dev464",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -180,7 +180,7 @@ export const MockExecutions = {
180
180
  error: Partial<Protocol.Error> = {},
181
181
  ): Protocol.Execution {
182
182
  return completed(cellId, {
183
- kind: "error",
183
+ kind: "failed",
184
184
  error: {
185
185
  kind: "exception",
186
186
  message: "boom",
@@ -200,7 +200,7 @@ export const MockExecutions = {
200
200
  },
201
201
 
202
202
  interrupted(cellId: string | null): Protocol.Execution {
203
- return completed(cellId, { kind: "interrupted" });
203
+ return completed(cellId, { kind: "cancelled" });
204
204
  },
205
205
 
206
206
  skipped(cellId: string): Protocol.Execution {
@@ -167,13 +167,16 @@ export const MockNotebook = {
167
167
  return record;
168
168
  }
169
169
  const traceback: Item = {
170
- kind: "display",
170
+ kind: "console",
171
171
  id: `traceback-${record.id}`,
172
172
  execution_id: record.id,
173
173
  seq: 0,
174
174
  content: {
175
- mimetype: "application/vnd.marimo+traceback",
176
- data: consoleTraceback,
175
+ kind: "media",
176
+ media: {
177
+ mimetype: "application/vnd.marimo+traceback",
178
+ data: consoleTraceback,
179
+ },
177
180
  },
178
181
  };
179
182
  return { ...record, items: [traceback] };
@@ -33,7 +33,7 @@ const MinimapCell: React.FC<MinimapCellProps> = (props) => {
33
33
  id: props.cellId,
34
34
  graph: graphs[props.cellId],
35
35
  code: useCellData(props.cellId).code,
36
- hasError: useCellExecution(props.cellId).outcome === "error",
36
+ hasError: useCellExecution(props.cellId).outcome === "failed",
37
37
  };
38
38
 
39
39
  let selectedCell: undefined | { id: CellId; graph: CellGraph };
@@ -327,8 +327,8 @@ const ReadonlyCellComponent = forwardRef(
327
327
  const cellData = useCellData(cellId);
328
328
  const output = useCellOutput(cellId);
329
329
  const { execution, freshness } = useCellPresentation(cellId);
330
- const errored = execution.outcome === "error";
331
- const interrupted = execution.outcome === "interrupted";
330
+ const errored = execution.outcome === "failed";
331
+ const interrupted = execution.outcome === "cancelled";
332
332
  const stopped = execution.outcome === "skipped";
333
333
 
334
334
  const className = clsx("marimo-cell", "hover-actions-parent z-10", {
@@ -392,8 +392,8 @@ const EditableCellComponent = ({
392
392
  const output = useCellOutput(cellId);
393
393
  const outline = useCellOutline(cellId);
394
394
  const { execution, freshness } = useCellPresentation(cellId);
395
- const errored = execution.outcome === "error";
396
- const interrupted = execution.outcome === "interrupted";
395
+ const errored = execution.outcome === "failed";
396
+ const interrupted = execution.outcome === "cancelled";
397
397
  const stopped = execution.outcome === "skipped";
398
398
  const cellActionDropdownRef = useRef<CellActionsDropdownHandle>(null);
399
399
  // DOM node where the editorView will be mounted
@@ -859,7 +859,7 @@ const CellRightSideActions = memo(
859
859
  <CellStatusComponent
860
860
  status={execution.status}
861
861
  freshness={freshness}
862
- interrupted={execution.outcome === "interrupted"}
862
+ interrupted={execution.outcome === "cancelled"}
863
863
  editing={true}
864
864
  disabled={disabled}
865
865
  elapsedTime={execution.duration}
@@ -1038,7 +1038,7 @@ const SetupCellComponent = ({
1038
1038
  const cellRuntime = useCellRuntime(cellId);
1039
1039
  const output = useCellOutput(cellId);
1040
1040
  const { execution, freshness } = useCellPresentation(cellId);
1041
- const errored = execution.outcome === "error";
1041
+ const errored = execution.outcome === "failed";
1042
1042
  const stopped = execution.outcome === "skipped";
1043
1043
  const cellActionDropdownRef = useRef<CellActionsDropdownHandle>(null);
1044
1044
  // DOM node where the editorView will be mounted
@@ -328,7 +328,7 @@ const VerticalCell = memo(
328
328
  const cellRef = useRef<HTMLDivElement>(null);
329
329
  const output = useCellOutput(cellId);
330
330
  const { execution, freshness } = useCellPresentation(cellId);
331
- const errored = execution.outcome === "error";
331
+ const errored = execution.outcome === "failed";
332
332
  const stopped = execution.outcome === "skipped";
333
333
 
334
334
  const outputStale = outputIsStale(execution, freshness, false);
@@ -402,7 +402,7 @@ const VerticalCell = memo(
402
402
  // instead of hiding them
403
403
  const hidden = shouldHidePublishedCell({
404
404
  errored,
405
- interrupted: execution.outcome === "interrupted",
405
+ interrupted: execution.outcome === "cancelled",
406
406
  stopped,
407
407
  output,
408
408
  showErrorTracebacks,
@@ -62,8 +62,8 @@ export const SlideCellView = ({ cell }: { cell: RuntimeCell }) => {
62
62
  const cellOutputPosition = userConfig.display.cell_output;
63
63
  const hasOutput = cell.output != null;
64
64
  const { execution, freshness } = useCellPresentation(cell.id);
65
- const errored = execution.outcome === "error";
66
- const interrupted = execution.outcome === "interrupted";
65
+ const errored = execution.outcome === "failed";
66
+ const interrupted = execution.outcome === "cancelled";
67
67
  const stopped = execution.outcome === "skipped";
68
68
 
69
69
  const uninstantiated = isUninstantiated(execution);
@@ -341,10 +341,6 @@ describe("ErrorContextProvider", () => {
341
341
  error: { kind: "invalid-syntax", message: "Syntax error" },
342
342
  expected: "Syntax error",
343
343
  },
344
- {
345
- error: { kind: "interrupted", message: "" },
346
- expected: "This cell was interrupted and needs to be re-run",
347
- },
348
344
  {
349
345
  error: { kind: "internal", message: "Unknown error" },
350
346
  expected: "Unknown error",
@@ -46,9 +46,9 @@ describe("outputIsStale", () => {
46
46
  });
47
47
 
48
48
  it("should return false if the cell is interrupted", () => {
49
- expect(
50
- outputIsStale(view({ outcome: "interrupted" }), CURRENT, false),
51
- ).toBe(false);
49
+ expect(outputIsStale(view({ outcome: "cancelled" }), CURRENT, false)).toBe(
50
+ false,
51
+ );
52
52
  });
53
53
 
54
54
  it("should return false if the cell is idle and not edited", () => {
@@ -64,7 +64,7 @@ describe("outputIsStale", () => {
64
64
  });
65
65
 
66
66
  it("should return true if the cell is interrupted and edited since", () => {
67
- expect(outputIsStale(view({ outcome: "interrupted" }), EDITED, true)).toBe(
67
+ expect(outputIsStale(view({ outcome: "cancelled" }), EDITED, true)).toBe(
68
68
  true,
69
69
  );
70
70
  });
@@ -94,14 +94,14 @@ describe("consoleOutputIsStale", () => {
94
94
  });
95
95
 
96
96
  it("is not stale after an interruption", () => {
97
- expect(consoleOutputIsStale(view({ outcome: "interrupted" }), EDITED)).toBe(
97
+ expect(consoleOutputIsStale(view({ outcome: "cancelled" }), EDITED)).toBe(
98
98
  false,
99
99
  );
100
100
  });
101
101
 
102
102
  it("should return false if the cell is interrupted but has stale inputs", () => {
103
- expect(
104
- outputIsStale(view({ outcome: "interrupted" }), REPLACED, false),
105
- ).toBe(false);
103
+ expect(outputIsStale(view({ outcome: "cancelled" }), REPLACED, false)).toBe(
104
+ false,
105
+ );
106
106
  });
107
107
  });
@@ -42,7 +42,7 @@ describe("execution traces", () => {
42
42
  started_at,
43
43
  completed_at: "1970-01-01T00:01:42Z",
44
44
  status: "completed",
45
- outcome: { kind: "interrupted" },
45
+ outcome: { kind: "cancelled" },
46
46
  } satisfies Execution["state"];
47
47
  const runId = "r1" as RunId;
48
48
  const running = observe(observe(initialState()), {
@@ -171,7 +171,7 @@ describe("readExport", () => {
171
171
  expect(result.snapshot.results?.[0]?.execution.state).toHaveProperty(
172
172
  "outcome",
173
173
  {
174
- kind: "error",
174
+ kind: "failed",
175
175
  error: expect.objectContaining({
176
176
  kind: "exception",
177
177
  name: "ValueError",
@@ -325,7 +325,7 @@ describe("readExport", () => {
325
325
  expect(result.snapshot?.results[0]?.execution.state).toHaveProperty(
326
326
  "outcome",
327
327
  {
328
- kind: "error",
328
+ kind: "failed",
329
329
  error: expect.objectContaining({
330
330
  kind: "exception",
331
331
  name: "ValueError",
@@ -204,10 +204,10 @@ describe("isUninstantiated", () => {
204
204
 
205
205
  it("should return false if the cell ended without a value", () => {
206
206
  expect(
207
- isUninstantiated({ status: "idle", outcome: "error", live: true }),
207
+ isUninstantiated({ status: "idle", outcome: "failed", live: true }),
208
208
  ).toBe(false);
209
209
  expect(
210
- isUninstantiated({ status: "idle", outcome: "interrupted", live: true }),
210
+ isUninstantiated({ status: "idle", outcome: "cancelled", live: true }),
211
211
  ).toBe(false);
212
212
  expect(
213
213
  isUninstantiated({ status: "idle", outcome: "skipped", live: true }),
@@ -32,7 +32,7 @@ export function outputIsStale(
32
32
  return true;
33
33
  }
34
34
  // An interrupted run's partial output stands as the record of that run.
35
- if (outcome === "interrupted") {
35
+ if (outcome === "cancelled") {
36
36
  return false;
37
37
  }
38
38
  return freshness.inputsChanged;
@@ -46,7 +46,7 @@ export function consoleOutputIsStale(
46
46
  freshness: CellFreshness,
47
47
  ): boolean {
48
48
  const { status, outcome } = execution;
49
- if (outcome === "interrupted") {
49
+ if (outcome === "cancelled") {
50
50
  return false;
51
51
  }
52
52
  if (outputIsLoading(status)) {
@@ -36,24 +36,26 @@ function consoleEntry(
36
36
  const id = item.seq + 1;
37
37
  switch (item.kind) {
38
38
  case "console":
39
- return {
40
- id,
41
- channel: item.name,
42
- data: item.text,
43
- mimetype: "text/plain",
44
- timestamp,
45
- };
46
- case "display":
39
+ if (item.content.kind === "text") {
40
+ return {
41
+ id,
42
+ channel: item.content.stream,
43
+ data: item.content.text,
44
+ mimetype: "text/plain",
45
+ timestamp,
46
+ };
47
+ }
48
+ const { media } = item.content;
47
49
  return {
48
50
  id,
49
51
  channel:
50
- item.content.mimetype === "application/vnd.marimo+traceback"
52
+ media.mimetype === "application/vnd.marimo+traceback"
51
53
  ? "stderr"
52
54
  : "media",
53
- mimetype: item.content.mimetype as OutputMessage["mimetype"],
54
- data: item.content.data,
55
+ mimetype: media.mimetype as OutputMessage["mimetype"],
56
+ data: media.data,
55
57
  code:
56
- item.content.mimetype === "application/vnd.marimo+traceback"
58
+ media.mimetype === "application/vnd.marimo+traceback"
57
59
  ? code
58
60
  : undefined,
59
61
  timestamp,
@@ -100,7 +102,10 @@ export function consoleObservers(
100
102
  if (output.channel === "media") {
101
103
  VirtualFileTracker.INSTANCE.track({ cell_id: cellId, output });
102
104
  }
103
- if (live && (item.kind === "console" || output.channel === "stderr")) {
105
+ if (
106
+ live &&
107
+ (output.channel === "stdout" || output.channel === "stderr")
108
+ ) {
104
109
  actions.addLogs({
105
110
  logs: getCellLogsForMessage({ cell_id: cellId, console: output }),
106
111
  });
@@ -46,8 +46,16 @@ function traceStatus(record: Execution): CellRun["status"] {
46
46
  if (record.state.status !== "completed") {
47
47
  return record.state.status;
48
48
  }
49
- const outcome = record.state.outcome.kind;
50
- return outcome === "succeeded" ? "success" : outcome;
49
+ switch (record.state.outcome.kind) {
50
+ case "succeeded":
51
+ return "success";
52
+ case "failed":
53
+ return "error";
54
+ case "cancelled":
55
+ return "interrupted";
56
+ case "skipped":
57
+ return "skipped";
58
+ }
51
59
  }
52
60
 
53
61
  const {
@@ -226,7 +226,7 @@ function resultRecord(
226
226
  } else if (primary.type === "error") {
227
227
  const traceback = normalizeTraceback(primary.traceback);
228
228
  outcome = {
229
- kind: "error",
229
+ kind: "failed",
230
230
  error: {
231
231
  kind: "exception",
232
232
  name: primary.ename,
@@ -84,7 +84,7 @@ export function getDescendantsStatus(
84
84
  const stale = descendants.some(
85
85
  (id) => freshness(id).sourceChanged || freshness(id).inputsChanged,
86
86
  );
87
- const errored = views.some((view) => view.outcome === "error");
87
+ const errored = views.some((view) => view.outcome === "failed");
88
88
  const runningOrQueued = views.some(
89
89
  (view) => view.status === "running" || view.status === "queued",
90
90
  );
@@ -112,7 +112,7 @@ export function cellRunReason(
112
112
  if (freshness.sourceChanged) {
113
113
  return "source";
114
114
  }
115
- if (execution.outcome === "interrupted") {
115
+ if (execution.outcome === "cancelled") {
116
116
  return "interrupted";
117
117
  }
118
118
  return freshness.inputsChanged && !cell.config.disabled && !execution.blocked
@@ -42,7 +42,7 @@ function run(
42
42
  status,
43
43
  started_at: null,
44
44
  completed_at: "2026-10-01T09:20:02Z",
45
- outcome: "succeeded",
45
+ outcome: { kind: "succeeded" },
46
46
  }
47
47
  : status === "running"
48
48
  ? { status, started_at: "2026-10-01T09:20:01Z" }
@@ -35,7 +35,7 @@ function run(
35
35
  status,
36
36
  started_at: MockExecutions.T0,
37
37
  completed_at: MockExecutions.T1,
38
- outcome: "succeeded",
38
+ outcome: { kind: "succeeded" },
39
39
  }
40
40
  : status === "running"
41
41
  ? { status, started_at: MockExecutions.T0 }
@@ -63,7 +63,7 @@ describe("cellOutputView", () => {
63
63
  const view = cellOutputView(
64
64
  inputs([
65
65
  MockExecutions.completed(C1, {
66
- kind: "error",
66
+ kind: "failed",
67
67
  error: hostError({
68
68
  traceback: { mimetype: "text/plain", data: "Traceback..." },
69
69
  related: [{ cell_id: C2, range: null, message: "Raised it" }],
@@ -242,9 +242,6 @@ describe("cellError", () => {
242
242
  expect(
243
243
  cellError(hostError({ kind: "internal", name: "abc", message: "oops" })),
244
244
  ).toEqual({ type: "unknown", msg: "oops", error_type: "abc" });
245
- expect(
246
- cellError(hostError({ kind: "interrupted", name: null, message: "" })),
247
- ).toEqual({ type: "interruption" });
248
245
  });
249
246
 
250
247
  it("shows any other kind as a diagnostic with the cells involved", () => {
@@ -305,11 +302,35 @@ describe("scratchOutputView", () => {
305
302
  status: "completed",
306
303
  started_at: null,
307
304
  completed_at: LATER,
308
- outcome: { kind: "interrupted" },
305
+ outcome: { kind: "cancelled" },
309
306
  depends_on: {},
310
307
  });
311
308
  expect(
312
309
  scratchOutputView(inputs([done, interrupted]).executions)?.data,
313
310
  ).toEqual([{ type: "interruption" }]);
314
311
  });
312
+
313
+ it("shows why a run failed when it has no execution to show", () => {
314
+ const done = MockExecutions.shown(null, HTML);
315
+ const { executions } = inputs([done]);
316
+ const failure = { message: "Kernel channel closed", completedAt: LATER };
317
+
318
+ // The run never reached the kernel, so only the run says what happened.
319
+ expect(
320
+ scratchOutputView({
321
+ ...executions,
322
+ scratchFailure: { ...failure, runId: "run-2" },
323
+ })?.data,
324
+ ).toEqual([
325
+ { type: "unknown", msg: "Kernel channel closed", error_type: null },
326
+ ]);
327
+
328
+ // Its own execution already shows the error.
329
+ expect(
330
+ scratchOutputView({
331
+ ...executions,
332
+ scratchFailure: { ...failure, runId: done[0].run_id! },
333
+ })?.data,
334
+ ).toBe("<b>1</b>");
335
+ });
315
336
  });
@@ -69,7 +69,7 @@ function run(
69
69
  status,
70
70
  started_at: null,
71
71
  completed_at: "2026-10-01T09:20:02Z",
72
- outcome: "succeeded",
72
+ outcome: { kind: "succeeded" },
73
73
  }
74
74
  : status === "running"
75
75
  ? { status, started_at: "2026-10-01T09:20:01Z" }
@@ -210,7 +210,7 @@ describe("cellExecutionView", () => {
210
210
  live: true,
211
211
  });
212
212
  const error = (kind: string): Protocol.Outcome => ({
213
- kind: "error",
213
+ kind: "failed",
214
214
  error: {
215
215
  kind,
216
216
  message: "",
@@ -222,7 +222,7 @@ describe("cellExecutionView", () => {
222
222
  related: [],
223
223
  },
224
224
  });
225
- expect(ended(error("exception")).outcome).toBe("error");
225
+ expect(ended(error("exception")).outcome).toBe("failed");
226
226
  const skipped: Protocol.Outcome = {
227
227
  kind: "skipped",
228
228
  reason: "ancestor-stopped",
@@ -230,7 +230,7 @@ describe("cellExecutionView", () => {
230
230
  related: [],
231
231
  };
232
232
  expect(ended(skipped).outcome).toBe("skipped");
233
- expect(ended({ kind: "interrupted" }).outcome).toBe("interrupted");
233
+ expect(ended({ kind: "cancelled" }).outcome).toBe("cancelled");
234
234
  });
235
235
 
236
236
  it("reads as queued from a request the stream has not shown a run for", () => {
@@ -130,8 +130,6 @@ export function cellError(error: Protocol.Error): CellError {
130
130
  };
131
131
  case "internal":
132
132
  return { type: "unknown", msg: error.message, error_type: error.name };
133
- case "interrupted":
134
- return { type: "interruption" };
135
133
  default:
136
134
  return {
137
135
  type: "diagnostic",
@@ -221,9 +219,9 @@ function resultDisplay(result: Result): CellOutput | null {
221
219
  switch (showing.kind) {
222
220
  case "output":
223
221
  return showing.media === null ? null : valueOutput(record, showing.media);
224
- case "error":
222
+ case "failed":
225
223
  return errorOutput(record, [cellError(showing.error)]);
226
- case "interrupted":
224
+ case "cancelled":
227
225
  return errorOutput(record, [{ type: "interruption" }]);
228
226
  case "skipped":
229
227
  return skippedOutput(record, showing);
@@ -321,5 +319,19 @@ export function cellOutputsView(
321
319
  * The latest scratch display, retained until a newer execution shows one.
322
320
  */
323
321
  export function scratchOutputView(executions: Executions): CellOutput | null {
322
+ const failure = executions.scratchFailure;
323
+ // A run that failed before the kernel saw its code has no execution to
324
+ // show, so its own reason stands in for the result.
325
+ if (
326
+ failure !== undefined &&
327
+ executions.scratch?.record.run_id !== failure.runId
328
+ ) {
329
+ return {
330
+ channel: "marimo-error",
331
+ mimetype: ERROR_MIMETYPE,
332
+ data: [{ type: "unknown", msg: failure.message, error_type: null }],
333
+ timestamp: seconds(failure.completedAt),
334
+ };
335
+ }
324
336
  return executions.scratch === null ? null : resultOutput(executions.scratch);
325
337
  }
@@ -418,7 +418,14 @@ describe("IslandsPyodideBridge", () => {
418
418
  };
419
419
  const write = (name: "stdout" | "stderr", text: string, seq = 0) => ({
420
420
  event: "console",
421
- data: { console: { id: text, execution_id: "e1", seq, name, text } },
421
+ data: {
422
+ console: {
423
+ id: text,
424
+ execution_id: "e1",
425
+ seq,
426
+ content: { kind: "text", stream: name, text },
427
+ },
428
+ },
422
429
  });
423
430
  sendNotebookEvent(2, record);
424
431
  sendNotebookEvent(2, write("stdout", "snapshot"));
@@ -212,13 +212,17 @@ export class IslandsPyodideBridge implements RunRequests, EditRequests {
212
212
  const entry = frame.data.console;
213
213
  const cellId = cells.get(entry.execution_id);
214
214
  // Snapshot rows have no cursor. Only live writes belong in the logs.
215
- if (frame.id !== undefined && cellId !== undefined) {
215
+ if (
216
+ frame.id !== undefined &&
217
+ cellId !== undefined &&
218
+ entry.content.kind === "text"
219
+ ) {
216
220
  const logs = getCellLogsForMessage({
217
221
  cell_id: cellId,
218
222
  console: {
219
- channel: entry.name,
223
+ channel: entry.content.stream,
220
224
  mimetype: "text/plain",
221
- data: entry.text,
225
+ data: entry.content.text,
222
226
  timestamp: frame.data.time
223
227
  ? Date.parse(frame.data.time) / 1000
224
228
  : Date.now() / 1000,