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

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 (54) hide show
  1. package/dist/{ErrorBoundary-D2YXxE_x.js → ErrorBoundary-BnH_3-iX.js} +1 -1
  2. package/dist/assets/__vite-browser-external-DxDOnHRB.js +1 -0
  3. package/dist/assets/{worker-DLJ9P24O.js → worker-D70Lo75A.js} +2 -2
  4. package/dist/{chat-ui-wWHUzOrx.js → chat-ui-Ci-OmyBN.js} +3 -3
  5. package/dist/{code-visibility-BPWgfZVa.js → code-visibility-9cVyvQDR.js} +2 -2
  6. package/dist/{common-_2RH91nQ.js → common-BFNJT3tG.js} +3 -3
  7. package/dist/{data-grid-overlay-editor-yh1wqygW.js → data-grid-overlay-editor-CQpih6Vr.js} +1 -1
  8. package/dist/{error-entries-3nytC8-z.js → error-entries-DMWlemUn.js} +471 -447
  9. package/dist/{feedback-button-Ctc_u2JY.js → feedback-button-D_xvjRAC.js} +3 -3
  10. package/dist/{glide-data-editor-DJikF-sp.js → glide-data-editor-ttA3lt4w.js} +3 -3
  11. package/dist/{globals-D8_0qvIC.js → globals-DgHMWwtp.js} +1 -1
  12. package/dist/{html-to-image-C3Nb90uM.js → html-to-image-CDlYnllr.js} +1 -1
  13. package/dist/main.js +8527 -8499
  14. package/dist/{number-overlay-editor-BUXorcPD.js → number-overlay-editor-VuSNPGWk.js} +1 -1
  15. package/dist/{process-output-BiLaCBoX.js → process-output-89n_C_pU.js} +2 -2
  16. package/dist/{reveal-component-B54ZJYk8.js → reveal-component-D63GuWKz.js} +2 -2
  17. package/package.json +1 -1
  18. package/src/__mocks__/executions.ts +61 -30
  19. package/src/components/editor/__tests__/output-persistence.test.tsx +1 -1
  20. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +5 -1
  21. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +1 -1
  22. package/src/core/cells/__tests__/clear-outputs.test.ts +18 -19
  23. package/src/core/cells/__tests__/harness.ts +4 -1
  24. package/src/core/cells/__tests__/layout.test.ts +4 -1
  25. package/src/core/cells/__tests__/runs.test.ts +2 -2
  26. package/src/core/cells/__tests__/session.test.ts +52 -45
  27. package/src/core/cells/__tests__/utils.test.ts +3 -3
  28. package/src/core/cells/execution-console.ts +7 -2
  29. package/src/core/cells/runs.ts +1 -1
  30. package/src/core/cells/session.ts +28 -18
  31. package/src/core/executions/__tests__/freshness.test.ts +11 -9
  32. package/src/core/executions/__tests__/hooks.test.tsx +8 -9
  33. package/src/core/executions/__tests__/output-lifecycle.test.ts +34 -35
  34. package/src/core/executions/__tests__/output.test.ts +28 -53
  35. package/src/core/executions/__tests__/select.test.ts +7 -7
  36. package/src/core/executions/atoms.ts +5 -5
  37. package/src/core/executions/output.ts +25 -28
  38. package/src/core/executions/select.ts +3 -11
  39. package/src/core/export/__tests__/hooks.test.ts +7 -9
  40. package/src/core/notebook/replica/__tests__/replica.test.ts +3 -3
  41. package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
  42. package/src/core/notebook/replica/execution-state.ts +20 -12
  43. package/src/core/notebook/replica/index.ts +2 -1
  44. package/src/core/notebook/replica/replica.ts +25 -5
  45. package/src/core/notebook/replica/resources/executions.ts +41 -17
  46. package/src/core/notebook/replica/resources/results.ts +11 -9
  47. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +5 -9
  48. package/src/core/static/virtual-file-tracker.ts +5 -8
  49. package/src/core/transports/__tests__/server.test.ts +1 -1
  50. package/src/core/transports/__tests__/static.test.ts +17 -10
  51. package/src/core/transports/static.ts +14 -6
  52. package/src/stories/cell.stories.tsx +14 -14
  53. package/src/stories/layout/vertical/one-column.stories.tsx +2 -1
  54. package/dist/assets/__vite-browser-external-D2z_TiUO.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-DJikF-sp.js";
3
+ import { a as n } from "./glide-data-editor-ttA3lt4w.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-C3Nb90uM.js";
1
+ import { T as e } from "./html-to-image-CDlYnllr.js";
2
2
  import { h as t } from "./tooltip-CiJ919pg.js";
3
- import { Tt as n, wt as r } from "./error-entries-3nytC8-z.js";
3
+ import { Tt as n, wt as r } from "./error-entries-DMWlemUn.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-_2RH91nQ.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";
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-BPWgfZVa.js";
13
+ import { n as ne, t as re } from "./code-visibility-9cVyvQDR.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-dev460",
3
+ "version": "0.25.3-dev462",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -17,7 +17,7 @@ import {
17
17
  type Results,
18
18
  type Result,
19
19
  } from "@/core/notebook/replica";
20
- import { shownOutcome } from "@/core/notebook/replica";
20
+ import { shown } from "@/core/notebook/replica";
21
21
  import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
22
22
 
23
23
  type Store = ReturnType<typeof createStore>;
@@ -33,7 +33,25 @@ const T1 = "2026-10-01T09:20:12.500Z";
33
33
 
34
34
  let sequence = 0;
35
35
 
36
- const NO_VALUE: Protocol.ValueOutcome = { kind: "value", display: null };
36
+ const SUCCEEDED: Protocol.Outcome = { kind: "succeeded" };
37
+
38
+ /** An execution, or the output it set, as the stream delivers them. */
39
+ type ExecutionFixture = Protocol.Execution & { items?: readonly Item[] };
40
+ type Entry = ExecutionFixture | Protocol.Output;
41
+ export type ExecutionEntries = ReadonlyArray<Entry | readonly Entry[]>;
42
+
43
+ function split(entries: ExecutionEntries) {
44
+ const records: ExecutionFixture[] = [];
45
+ const outputs = new Map<Protocol.ExecutionId, Protocol.Output>();
46
+ for (const entry of entries.flat()) {
47
+ if ("execution_id" in entry) {
48
+ outputs.set(entry.execution_id, entry);
49
+ } else {
50
+ records.push(entry);
51
+ }
52
+ }
53
+ return { records, outputs };
54
+ }
37
55
 
38
56
  function execution(
39
57
  cellId: string | null,
@@ -53,7 +71,7 @@ function execution(
53
71
 
54
72
  function completed(
55
73
  cellId: string | null,
56
- outcome: Protocol.Outcome = NO_VALUE,
74
+ outcome: Protocol.Outcome = SUCCEEDED,
57
75
  ): Protocol.Execution {
58
76
  return execution(cellId, {
59
77
  status: "completed",
@@ -64,9 +82,15 @@ function completed(
64
82
  });
65
83
  }
66
84
 
67
- type ExecutionFixture = Protocol.Execution & { items?: readonly Item[] };
85
+ function output(
86
+ execution: Protocol.Execution,
87
+ media: Protocol.DisplayData | null,
88
+ ): Protocol.Output {
89
+ return { id: `${execution.id}:output`, execution_id: execution.id, media };
90
+ }
68
91
 
69
- function mirror(records: readonly ExecutionFixture[]): Executions {
92
+ function mirror(entries: ExecutionEntries): Executions {
93
+ const { records, outputs } = split(entries);
70
94
  const executions = new Map<Protocol.ExecutionId, Execution>();
71
95
  const latest = new Map<Protocol.CellId, Protocol.ExecutionId>();
72
96
  for (const { items = [], ...record } of records) {
@@ -80,25 +104,30 @@ function mirror(records: readonly ExecutionFixture[]): Executions {
80
104
  }
81
105
  executions.set(record.id, {
82
106
  record,
107
+ output: outputs.get(record.id) ?? null,
83
108
  outputVersion: 0,
84
109
  items: new Map(items.map((item) => [item.id, item])),
85
110
  variables: new Map(),
86
111
  });
87
112
  }
88
- const scratch = records.findLast(
89
- (record) => record.cell_id === null && shownOutcome(record) !== null,
113
+ const scratch = [...executions.values()].findLast(
114
+ (execution) =>
115
+ execution.record.cell_id === null && shown(execution) !== null,
90
116
  );
91
117
  return {
92
118
  runs: new Map(),
93
119
  executions,
94
120
  latest,
95
- results: results(records),
121
+ results: results(entries),
96
122
  scratch:
97
- scratch === undefined ? null : { record: scratch, outputVersion: 0 },
123
+ scratch === undefined
124
+ ? null
125
+ : { record: scratch.record, output: scratch.output, outputVersion: 0 },
98
126
  };
99
127
  }
100
128
 
101
- function results(records: readonly Protocol.Execution[]): Results {
129
+ function results(entries: ExecutionEntries): Results {
130
+ const { records, outputs } = split(entries);
102
131
  const results = new Map<Protocol.CellId, Result | null>();
103
132
  for (const record of records) {
104
133
  if (record.cell_id !== null) {
@@ -106,7 +135,11 @@ function results(records: readonly Protocol.Execution[]): Results {
106
135
  results.set(record.cell_id, null);
107
136
  }
108
137
  if (record.state.status === "completed") {
109
- results.set(record.cell_id, { record, outputVersion: 0 });
138
+ results.set(record.cell_id, {
139
+ record,
140
+ output: outputs.get(record.id) ?? null,
141
+ outputVersion: 0,
142
+ });
110
143
  }
111
144
  }
112
145
  }
@@ -117,6 +150,7 @@ export const MockExecutions = {
117
150
  T0,
118
151
  T1,
119
152
  execution,
153
+ output,
120
154
  completed,
121
155
 
122
156
  /** A completed execution that took `elapsedMs`. */
@@ -125,18 +159,19 @@ export const MockExecutions = {
125
159
  status: "completed",
126
160
  started_at: T0,
127
161
  completed_at: new Date(Date.parse(T0) + elapsedMs).toISOString(),
128
- outcome: NO_VALUE,
162
+ outcome: SUCCEEDED,
129
163
  depends_on: {},
130
164
  });
131
165
  },
132
166
 
133
- /** A completed execution that showed `display`. */
167
+ /** A completed execution and the output it showed. */
134
168
  shown(
135
169
  cellId: string | null,
136
170
  display: Protocol.DisplayData,
137
171
  fields: Partial<Omit<Protocol.Execution, "id" | "state">> = {},
138
- ): Protocol.Execution {
139
- return { ...completed(cellId, { kind: "value", display }), ...fields };
172
+ ): readonly [Protocol.Execution, Protocol.Output] {
173
+ const execution = { ...completed(cellId), ...fields };
174
+ return [execution, output(execution, display)];
140
175
  },
141
176
 
142
177
  /** A completed execution that ended in `error`, a ValueError by default. */
@@ -177,12 +212,8 @@ export const MockExecutions = {
177
212
  });
178
213
  },
179
214
 
180
- /** A running execution that has shown `value` so far. */
181
- running(
182
- cellId: string | null,
183
- value: Protocol.ValueOutcome | null = null,
184
- ): Protocol.Execution {
185
- return execution(cellId, { status: "running", started_at: T0, value });
215
+ running(cellId: string | null): Protocol.Execution {
216
+ return execution(cellId, { status: "running", started_at: T0 });
186
217
  },
187
218
 
188
219
  queued(cellId: string | null): Protocol.Execution {
@@ -213,18 +244,18 @@ export const MockExecutions = {
213
244
 
214
245
  /**
215
246
  * What the selectors read. `latest` and the results are derived from
216
- * `records`, and the document is taken to have every cell they name,
247
+ * `entries`, and the document is taken to have every cell they name,
217
248
  * with nothing keeping it from running.
218
249
  */
219
250
  inputs(
220
- records: readonly Protocol.Execution[],
251
+ entries: ExecutionEntries,
221
252
  extra: Partial<Pick<CellExecutionInputs, "requested" | "blocked">> = {},
222
253
  ): CellExecutionInputs {
223
254
  return {
224
- executions: mirror(records),
225
- results: results(records),
255
+ executions: mirror(entries),
256
+ results: results(entries),
226
257
  cells: new Map(
227
- records.flatMap((record) =>
258
+ split(entries).records.flatMap((record) =>
228
259
  record.cell_id === null ? [] : [[record.cell_id, { config: CONFIG }]],
229
260
  ),
230
261
  ),
@@ -235,10 +266,10 @@ export const MockExecutions = {
235
266
  };
236
267
  },
237
268
 
238
- /** Make the store's active replica report `records`, `runtime`, and `document`. */
269
+ /** Make the store's active replica report `entries`, `runtime`, and `document`. */
239
270
  seed(
240
271
  store: Store,
241
- records: ExecutionFixture[],
272
+ entries: ExecutionEntries,
242
273
  runtime: Protocol.Runtime | null = null,
243
274
  document: Document | null = null,
244
275
  ) {
@@ -258,8 +289,8 @@ export const MockExecutions = {
258
289
  documentAtom,
259
290
  shownDocumentAtom: documentAtom,
260
291
  runtimeAtom: atom(runtime),
261
- executionsAtom: atom(mirror(records)),
262
- resultsAtom: atom(results(records)),
292
+ executionsAtom: atom(mirror(entries)),
293
+ resultsAtom: atom(results(entries)),
263
294
  } satisfies NotebookReplica;
264
295
  store.set(activeNotebookReplicaAtom, replica);
265
296
  return replica;
@@ -184,7 +184,7 @@ describe("output persistence across mode changes", () => {
184
184
  // The host holds newer source than the cell last ran with
185
185
  MockExecutions.seed(
186
186
  store,
187
- [{ ...MockExecutions.shown(cid, PERSIST), code_fingerprint: "ran" }],
187
+ [MockExecutions.shown(cid, PERSIST, { code_fingerprint: "ran" })],
188
188
  null,
189
189
  withCells(
190
190
  documentOf(),
@@ -363,7 +363,11 @@ describe("SendErrorReportButton", () => {
363
363
  });
364
364
  const message = cellOutputView(
365
365
  {
366
- ...MockExecutions.inputs(snapshot?.results ?? []),
366
+ ...MockExecutions.inputs(
367
+ (snapshot?.results ?? []).flatMap(({ execution, output }) =>
368
+ output === null ? [execution] : [execution, output],
369
+ ),
370
+ ),
367
371
  cleared: new Map(),
368
372
  cells: new Map(snapshot?.cells.map((cell) => [cell.id, cell])),
369
373
  },
@@ -397,7 +397,7 @@ const GridCell = memo(
397
397
  const hidden =
398
398
  hideWithoutValue &&
399
399
  execution.outcome !== null &&
400
- execution.outcome !== "value";
400
+ execution.outcome !== "succeeded";
401
401
 
402
402
  const isOutputEmpty = output == null || output.data === "";
403
403
  // If not reading, show code when there is no output
@@ -94,28 +94,31 @@ describe("clearing a running cell", () => {
94
94
  notebookAtom,
95
95
  MockNotebook.notebookState({ cellData: { [A]: {} } }),
96
96
  );
97
- const running = MockExecutions.running(A, {
98
- kind: "value",
99
- display: { mimetype: "text/plain", data: "so far" },
97
+ const running = MockExecutions.running(A);
98
+ const soFar = MockExecutions.output(running, {
99
+ mimetype: "text/plain",
100
+ data: "so far",
100
101
  });
101
- const replica = MockExecutions.seed(store, [running], null, DOCUMENT);
102
+ const replica = MockExecutions.seed(
103
+ store,
104
+ [running, soFar],
105
+ null,
106
+ DOCUMENT,
107
+ );
102
108
  store.set(clearCellOutputAtom, { cellId: A });
103
109
  expect(store.get(cellOutputAtom(A))).toBeNull();
104
110
 
105
111
  store.set(replica.executionsAtom, (state) =>
106
- executions.on.execution!(
112
+ executions.on.output!(
107
113
  state,
108
114
  {
109
- event: "execution",
115
+ event: "output",
110
116
  id: "more",
111
117
  data: {
112
- execution: {
113
- ...MockExecutions.running(A, {
114
- kind: "value",
115
- display: { mimetype: "text/plain", data: "more" },
116
- }),
117
- id: running.id,
118
- },
118
+ output: MockExecutions.output(running, {
119
+ mimetype: "text/plain",
120
+ data: "more",
121
+ }),
119
122
  },
120
123
  },
121
124
  { phase: "live" },
@@ -124,13 +127,9 @@ describe("clearing a running cell", () => {
124
127
  expect(store.get(cellOutputAtom(A))?.data).toBe("more");
125
128
 
126
129
  store.set(replica.executionsAtom, (state) =>
127
- executions.on.execution!(
130
+ executions.on.output!(
128
131
  state,
129
- {
130
- event: "execution",
131
- id: "again",
132
- data: { execution: { ...running } },
133
- },
132
+ { event: "output", id: "again", data: { output: soFar } },
134
133
  { phase: "live" },
135
134
  ),
136
135
  );
@@ -37,7 +37,10 @@ export function setupNotebook(
37
37
  const controller = new AbortController();
38
38
  stops.push(stop, () => controller.abort());
39
39
  /** What the host shows for each cell, by cell id. */
40
- const results = new Map<string, Protocol.Execution>();
40
+ const results = new Map<
41
+ string,
42
+ readonly [Protocol.Execution, Protocol.Output]
43
+ >();
41
44
  followDocument({
42
45
  store,
43
46
  model,
@@ -135,7 +135,10 @@ describe("layoutAtom", () => {
135
135
  /** Deliver `html` as a cell's output, as the kernel's message does. */
136
136
  /** Report what the host shows for a cell, keeping the other cells' outputs. */
137
137
  function reporter(store: ReturnType<typeof setupNotebook>["store"]) {
138
- const results = new Map<CellId, Protocol.Execution>();
138
+ const results = new Map<
139
+ CellId,
140
+ readonly [Protocol.Execution, Protocol.Output]
141
+ >();
139
142
  return (id: CellId, html: string) => {
140
143
  results.set(
141
144
  id,
@@ -46,7 +46,7 @@ describe("execution traces", () => {
46
46
  } satisfies Execution["state"];
47
47
  const runId = "r1" as RunId;
48
48
  const running = observe(observe(initialState()), {
49
- state: { started_at, status: "running", value: null },
49
+ state: { started_at, status: "running" },
50
50
  });
51
51
  for (const state of [
52
52
  observe(running, { state: completed }),
@@ -63,7 +63,7 @@ describe("execution traces", () => {
63
63
  }
64
64
  expect(
65
65
  observe(running, {
66
- state: { ...completed, outcome: { kind: "value", display: null } },
66
+ state: { ...completed, outcome: { kind: "succeeded" } },
67
67
  })
68
68
  .runMap.get(runId)
69
69
  ?.cellRuns.get(cellId("cell"))?.status,
@@ -105,17 +105,19 @@ describe("readExport", () => {
105
105
  });
106
106
  invariant(result.snapshot, "no snapshot");
107
107
  expect(result.snapshot.results).toEqual([
108
- expect.objectContaining({
109
- cell_id: "c1",
110
- code_fingerprint: "hash-1",
111
- state: expect.objectContaining({
112
- status: "completed",
113
- outcome: {
114
- kind: "value",
115
- display: { mimetype: "text/html", data: "<b>1</b>" },
116
- },
108
+ {
109
+ execution: expect.objectContaining({
110
+ cell_id: "c1",
111
+ code_fingerprint: "hash-1",
112
+ state: expect.objectContaining({
113
+ status: "completed",
114
+ outcome: { kind: "succeeded" },
115
+ }),
117
116
  }),
118
- }),
117
+ output: expect.objectContaining({
118
+ media: { mimetype: "text/html", data: "<b>1</b>" },
119
+ }),
120
+ },
119
121
  ]);
120
122
  });
121
123
 
@@ -163,19 +165,24 @@ describe("readExport", () => {
163
165
  appConfig: {},
164
166
  });
165
167
  invariant(result.snapshot, "no snapshot");
166
- expect(result.snapshot.results?.map((r) => r.cell_id)).toEqual(["c1"]);
167
- expect(result.snapshot.results?.[0]?.state).toHaveProperty("outcome", {
168
- kind: "error",
169
- error: expect.objectContaining({
170
- kind: "exception",
171
- name: "ValueError",
172
- message: "bad",
173
- traceback:
174
- expectedTraceback === null
175
- ? null
176
- : { mimetype: "text/plain", data: expectedTraceback },
177
- }),
178
- });
168
+ expect(
169
+ result.snapshot.results?.map((r) => r.execution.cell_id),
170
+ ).toEqual(["c1"]);
171
+ expect(result.snapshot.results?.[0]?.execution.state).toHaveProperty(
172
+ "outcome",
173
+ {
174
+ kind: "error",
175
+ error: expect.objectContaining({
176
+ kind: "exception",
177
+ name: "ValueError",
178
+ message: "bad",
179
+ traceback:
180
+ expectedTraceback === null
181
+ ? null
182
+ : { mimetype: "text/plain", data: expectedTraceback },
183
+ }),
184
+ },
185
+ );
179
186
  },
180
187
  );
181
188
  });
@@ -315,15 +322,18 @@ describe("readExport", () => {
315
322
  appConfig: {},
316
323
  });
317
324
 
318
- expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
319
- kind: "error",
320
- error: expect.objectContaining({
321
- kind: "exception",
322
- name: "ValueError",
323
- message: "Something went wrong",
324
- traceback: { mimetype: "text/plain", data: "Traceback line 1" },
325
- }),
326
- });
325
+ expect(result.snapshot?.results[0]?.execution.state).toHaveProperty(
326
+ "outcome",
327
+ {
328
+ kind: "error",
329
+ error: expect.objectContaining({
330
+ kind: "exception",
331
+ name: "ValueError",
332
+ message: "Something went wrong",
333
+ traceback: { mimetype: "text/plain", data: "Traceback line 1" },
334
+ }),
335
+ },
336
+ );
327
337
 
328
338
  invariant(result.snapshot, "no snapshot");
329
339
  });
@@ -385,9 +395,9 @@ describe("readExport", () => {
385
395
  appConfig: {},
386
396
  });
387
397
 
388
- expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
389
- kind: "value",
390
- display: { mimetype: "text/plain", data: "Hello World" },
398
+ expect(result.snapshot?.results[0]?.output).toHaveProperty("media", {
399
+ mimetype: "text/plain",
400
+ data: "Hello World",
391
401
  });
392
402
 
393
403
  invariant(result.snapshot, "no snapshot");
@@ -749,9 +759,9 @@ describe("readExport", () => {
749
759
  appConfig: {},
750
760
  });
751
761
 
752
- expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
753
- kind: "value",
754
- display: { mimetype: "text/plain", data: "First" },
762
+ expect(result.snapshot?.results[0]?.output).toHaveProperty("media", {
763
+ mimetype: "text/plain",
764
+ data: "First",
755
765
  });
756
766
  });
757
767
 
@@ -773,9 +783,9 @@ describe("readExport", () => {
773
783
  appConfig: {},
774
784
  });
775
785
 
776
- expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
777
- kind: "value",
778
- display: { mimetype: "text/plain", data: "Plain text" },
786
+ expect(result.snapshot?.results[0]?.output).toHaveProperty("media", {
787
+ mimetype: "text/plain",
788
+ data: "Plain text",
779
789
  });
780
790
 
781
791
  invariant(result.snapshot, "no snapshot");
@@ -796,10 +806,7 @@ describe("readExport", () => {
796
806
  appConfig: {},
797
807
  });
798
808
 
799
- expect(result.snapshot?.results[0]?.state).toHaveProperty("outcome", {
800
- kind: "value",
801
- display: null,
802
- });
809
+ expect(result.snapshot?.results[0]?.output).toHaveProperty("media", null);
803
810
  });
804
811
 
805
812
  it("returns correct structure with all expected properties", () => {
@@ -141,7 +141,7 @@ describe("staleCellIds with a run in progress", () => {
141
141
  describe("cellRunReason", () => {
142
142
  const view = {
143
143
  status: "idle",
144
- outcome: "value",
144
+ outcome: "succeeded",
145
145
  live: true,
146
146
  blocked: false,
147
147
  } as const;
@@ -178,7 +178,7 @@ describe("isUninstantiated", () => {
178
178
 
179
179
  it("should return false if the cell has run", () => {
180
180
  expect(
181
- isUninstantiated({ status: "idle", outcome: "value", live: true }),
181
+ isUninstantiated({ status: "idle", outcome: "succeeded", live: true }),
182
182
  ).toBe(false);
183
183
  });
184
184
 
@@ -186,7 +186,7 @@ describe("isUninstantiated", () => {
186
186
  // Restored from storage, or kept across a kernel restart: the output
187
187
  // shows, and nothing the cell bound exists in this runtime.
188
188
  expect(
189
- isUninstantiated({ status: "idle", outcome: "value", live: false }),
189
+ isUninstantiated({ status: "idle", outcome: "succeeded", live: false }),
190
190
  ).toBe(true);
191
191
  expect(
192
192
  isUninstantiated({ status: "running", outcome: null, live: false }),
@@ -75,10 +75,15 @@ function consoleEntry(
75
75
  export function consoleObservers(
76
76
  actions: Pick<ReducerCellActions, "addLogs" | "startCellConsole">,
77
77
  onExecution?: (record: Execution) => void,
78
- ): Pick<Parameters<NotebookReplica["connect"]>[1], "onExecution" | "onItem"> {
78
+ ): Pick<
79
+ Parameters<NotebookReplica["connect"]>[1],
80
+ "onExecution" | "onOutput" | "onItem"
81
+ > {
79
82
  return {
83
+ onOutput(output, execution) {
84
+ VirtualFileTracker.INSTANCE.trackOutput(output, execution);
85
+ },
80
86
  onExecution(record, changed) {
81
- VirtualFileTracker.INSTANCE.trackExecution(record);
82
87
  if (changed) {
83
88
  if (record.state.status === "running") {
84
89
  actions.startCellConsole({
@@ -47,7 +47,7 @@ function traceStatus(record: Execution): CellRun["status"] {
47
47
  return record.state.status;
48
48
  }
49
49
  const outcome = record.state.outcome.kind;
50
- return outcome === "value" ? "success" : outcome;
50
+ return outcome === "succeeded" ? "success" : outcome;
51
51
  }
52
52
 
53
53
  const {