@marimo-team/islands 0.26.1-dev19 → 0.26.1-dev20

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 (78) hide show
  1. package/dist/{ErrorBoundary-CYipPzuL.js → ErrorBoundary-Cx-CwafE.js} +1 -1
  2. package/dist/{chat-ui-b1ERxzeA.js → chat-ui-qZdDDrzU.js} +3 -3
  3. package/dist/{code-visibility-D2uVdtAQ.js → code-visibility-CVfXV6fG.js} +2 -2
  4. package/dist/{common-d-UA4Z2n.js → common-BXRJCkJO.js} +3 -3
  5. package/dist/{data-grid-overlay-editor-BfZIG_OX.js → data-grid-overlay-editor-Mbtx3F9C.js} +1 -1
  6. package/dist/{error-entries-Bl8fzLQc.js → error-entries-DhI0hGvj.js} +448 -450
  7. package/dist/{feedback-button-Ct0bgfAh.js → feedback-button-zx4NcNDn.js} +3 -3
  8. package/dist/{glide-data-editor-D9EGRA-V.js → glide-data-editor-CvezoJKg.js} +3 -3
  9. package/dist/{globals-UnK9bjY3.js → globals-CQuPaxzy.js} +1 -1
  10. package/dist/{html-to-image-D6A1lg0A.js → html-to-image-B803aaWE.js} +1 -1
  11. package/dist/main.js +3211 -3201
  12. package/dist/{number-overlay-editor-DMasuqqm.js → number-overlay-editor-DxM7vsCk.js} +1 -1
  13. package/dist/{process-output-w5omHedc.js → process-output-CnCLfvnL.js} +2 -2
  14. package/dist/{reveal-component-v6w_cxzA.js → reveal-component-BefmhjJF.js} +2 -2
  15. package/package.json +1 -1
  16. package/src/__mocks__/executions.ts +19 -18
  17. package/src/__mocks__/notebook.ts +1 -1
  18. package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +1 -1
  19. package/src/components/editor/cell/__tests__/useRunCells.test.tsx +3 -3
  20. package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +5 -2
  21. package/src/core/ai/context/providers/__tests__/error.test.ts +6 -3
  22. package/src/core/cells/__tests__/actions.test.ts +2 -2
  23. package/src/core/cells/__tests__/arrange.test.ts +1 -1
  24. package/src/core/cells/__tests__/harness.ts +9 -7
  25. package/src/core/cells/__tests__/layout.test.ts +1 -1
  26. package/src/core/cells/__tests__/runs.test.ts +3 -3
  27. package/src/core/cells/__tests__/utils.test.ts +3 -2
  28. package/src/core/cells/actions.ts +6 -6
  29. package/src/core/cells/cells.ts +1 -1
  30. package/src/core/cells/document.ts +1 -2
  31. package/src/core/cells/execution-console.ts +3 -3
  32. package/src/core/cells/ids.ts +2 -4
  33. package/src/core/cells/runs.ts +2 -2
  34. package/src/core/cells/session.ts +4 -4
  35. package/src/core/executions/__tests__/atoms.test.ts +5 -2
  36. package/src/core/executions/__tests__/freshness.test.ts +56 -52
  37. package/src/core/executions/__tests__/interrupt.test.ts +2 -2
  38. package/src/core/executions/__tests__/output.test.ts +3 -1
  39. package/src/core/executions/__tests__/run.test.ts +2 -2
  40. package/src/core/executions/__tests__/select.test.ts +70 -62
  41. package/src/core/executions/atoms.ts +1 -1
  42. package/src/core/executions/freshness.ts +5 -5
  43. package/src/core/executions/output.ts +15 -21
  44. package/src/core/executions/select.ts +17 -9
  45. package/src/core/export/__tests__/hooks.test.ts +1 -1
  46. package/src/core/meta/__tests__/code-visibility.test.tsx +3 -2
  47. package/src/core/notebook/document/__tests__/codemirror.test.ts +8 -6
  48. package/src/core/notebook/document/__tests__/draft.test.ts +56 -58
  49. package/src/core/notebook/document/__tests__/fixtures.ts +8 -7
  50. package/src/core/notebook/document/__tests__/hooks.test.tsx +39 -35
  51. package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +8 -5
  52. package/src/core/notebook/document/__tests__/model.test.ts +8 -5
  53. package/src/core/notebook/document/__tests__/protocol-fixtures.ts +2 -2
  54. package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +37 -32
  55. package/src/core/notebook/document/__tests__/scenarios.test.ts +49 -45
  56. package/src/core/notebook/document/__tests__/state.test.ts +59 -56
  57. package/src/core/notebook/document/__tests__/submission.test.ts +15 -12
  58. package/src/core/notebook/document/__tests__/test-host.ts +3 -2
  59. package/src/core/notebook/document/__tests__/user.ts +7 -3
  60. package/src/core/notebook/document/draft.ts +29 -11
  61. package/src/core/notebook/document/state.ts +7 -6
  62. package/src/core/notebook/replica/__tests__/document.test.ts +9 -5
  63. package/src/core/notebook/replica/__tests__/executions.test.ts +8 -5
  64. package/src/core/notebook/replica/__tests__/fixtures.ts +6 -2
  65. package/src/core/notebook/replica/__tests__/results.test.ts +23 -19
  66. package/src/core/notebook/replica/execution-state.ts +2 -2
  67. package/src/core/notebook/replica/replica.ts +2 -2
  68. package/src/core/notebook/replica/resources/analysis.ts +1 -1
  69. package/src/core/notebook/replica/resources/document.ts +9 -8
  70. package/src/core/notebook/replica/resources/executions.ts +2 -2
  71. package/src/core/notebook/replica/resources/results.ts +2 -2
  72. package/src/core/saving/__tests__/document.test.tsx +1 -1
  73. package/src/core/saving/__tests__/state.test.ts +2 -2
  74. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +9 -4
  75. package/src/core/session/useNotebookReplica.ts +1 -1
  76. package/src/core/session/useNotebookSession.tsx +1 -1
  77. package/src/core/transports/__tests__/static.test.ts +1 -1
  78. package/src/core/transports/static.ts +2 -2
@@ -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-D9EGRA-V.js";
3
+ import { a as n } from "./glide-data-editor-CvezoJKg.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.18.1_marked@15.0.12_react-dom@19.3.1__a94b4518d090e84da26f3a68e82f2953/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-D6A1lg0A.js";
1
+ import { T as e } from "./html-to-image-B803aaWE.js";
2
2
  import { h as t } from "./tooltip-D0h-ZJ6j.js";
3
- import { Tt as n, wt as r } from "./error-entries-Bl8fzLQc.js";
3
+ import { Tt as n, wt as r } from "./error-entries-DhI0hGvj.js";
4
4
  import { r as i } from "./assertNever-CqwxSD_2.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, m as r, r as i, t as a } from "./button-Z2R2272J.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-D0h-ZJ6j.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-d-UA4Z2n.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-BXRJCkJO.js";
7
7
  import { M as w } from "./select-CvorIE3l.js";
8
8
  import { X as T } from "./dropdown-menu-ChH3oiqI.js";
9
9
  import { t as E } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Ht as D, f as O, i as k, zt as A } from "./use-restore-focus-BFvwj2Hj.js";
11
11
  import { t as j } from "./useEvent-BoN7U38T.js";
12
12
  import { o as ee } from "./static-state-CqwW3B_X.js";
13
- import { n as te, t as ne } from "./code-visibility-D2uVdtAQ.js";
13
+ import { n as te, t as ne } from "./code-visibility-CVfXV6fG.js";
14
14
  /* empty css */
15
15
  var M = 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.26.1-dev19",
3
+ "version": "0.26.1-dev20",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -2,6 +2,7 @@
2
2
 
3
3
  /** Executions as the host would report them, for tests that read cell status. */
4
4
 
5
+ import { cellId } from "@/__tests__/branded";
5
6
  import type * as Protocol from "@marimo-team/client/protocol";
6
7
  import { atom, type createStore } from "jotai";
7
8
  import type { CellExecutionInputs } from "@/core/executions";
@@ -34,10 +35,10 @@ const T1 = "2026-10-01T09:20:12.500Z";
34
35
  let sequence = 0;
35
36
 
36
37
  const READY: Protocol.RuntimeState = { status: "ready" };
37
- const SUCCEEDED: Protocol.ExecutionOutcome = { kind: "succeeded" };
38
+ const SUCCEEDED: Protocol.ExecutionOutcomeOutput = { kind: "succeeded" };
38
39
 
39
40
  /** An execution, or the output it set, as the stream delivers them. */
40
- type ExecutionFixture = Protocol.Execution & { items?: readonly Item[] };
41
+ type ExecutionFixture = Protocol.ExecutionOutput & { items?: readonly Item[] };
41
42
  type Entry = ExecutionFixture | Protocol.Output;
42
43
  export type ExecutionEntries = ReadonlyArray<Entry | readonly Entry[]>;
43
44
 
@@ -55,16 +56,16 @@ function split(entries: ExecutionEntries) {
55
56
  }
56
57
 
57
58
  function execution(
58
- cellId: string | null,
59
- state: Protocol.ExecutionState,
60
- ): Protocol.Execution {
59
+ cid: string | null,
60
+ state: Protocol.ExecutionStateOutput,
61
+ ): Protocol.ExecutionOutput {
61
62
  sequence += 1;
62
63
  return {
63
64
  id: `e${sequence}`,
64
65
  run_id: "run-1",
65
66
  runtime_id: "r1",
66
67
  caused_by_id: null,
67
- cell_id: cellId,
68
+ cell_id: cid === null ? null : cellId(cid),
68
69
  code_fingerprint: "0f71456db2ea83f4",
69
70
  created_at: T0,
70
71
  state,
@@ -73,8 +74,8 @@ function execution(
73
74
 
74
75
  function completed(
75
76
  cellId: string | null,
76
- outcome: Protocol.ExecutionOutcome = SUCCEEDED,
77
- ): Protocol.Execution {
77
+ outcome: Protocol.ExecutionOutcomeOutput = SUCCEEDED,
78
+ ): Protocol.ExecutionOutput {
78
79
  return execution(cellId, {
79
80
  status: "completed",
80
81
  started_at: T0,
@@ -156,7 +157,7 @@ export const MockExecutions = {
156
157
  completed,
157
158
 
158
159
  /** A completed execution that took `elapsedMs`. */
159
- took(cellId: string, elapsedMs: number): Protocol.Execution {
160
+ took(cellId: string, elapsedMs: number): Protocol.ExecutionOutput {
160
161
  return execution(cellId, {
161
162
  status: "completed",
162
163
  started_at: T0,
@@ -170,8 +171,8 @@ export const MockExecutions = {
170
171
  shown(
171
172
  cellId: string | null,
172
173
  display: Protocol.Media,
173
- fields: Partial<Omit<Protocol.Execution, "id" | "state">> = {},
174
- ): readonly [Protocol.Execution, Protocol.Output] {
174
+ fields: Partial<Omit<Protocol.ExecutionOutput, "id" | "state">> = {},
175
+ ): readonly [Protocol.ExecutionOutput, Protocol.Output] {
175
176
  const execution = { ...completed(cellId), ...fields };
176
177
  return [execution, output(execution, display)];
177
178
  },
@@ -179,8 +180,8 @@ export const MockExecutions = {
179
180
  /** A completed execution that ended in `error`, a ValueError by default. */
180
181
  failed(
181
182
  cellId: string,
182
- error: Partial<Protocol.Error> = {},
183
- ): Protocol.Execution {
183
+ error: Partial<Protocol.ErrorOutput> = {},
184
+ ): Protocol.ExecutionOutput {
184
185
  return completed(cellId, {
185
186
  kind: "failed",
186
187
  error: {
@@ -197,15 +198,15 @@ export const MockExecutions = {
197
198
  });
198
199
  },
199
200
 
200
- errored(cellId: string): Protocol.Execution {
201
+ errored(cellId: string): Protocol.ExecutionOutput {
201
202
  return MockExecutions.failed(cellId);
202
203
  },
203
204
 
204
- interrupted(cellId: string | null): Protocol.Execution {
205
+ interrupted(cellId: string | null): Protocol.ExecutionOutput {
205
206
  return completed(cellId, { kind: "cancelled" });
206
207
  },
207
208
 
208
- skipped(cellId: string): Protocol.Execution {
209
+ skipped(cellId: string): Protocol.ExecutionOutput {
209
210
  return completed(cellId, {
210
211
  kind: "skipped",
211
212
  reason: "ancestor-stopped",
@@ -214,11 +215,11 @@ export const MockExecutions = {
214
215
  });
215
216
  },
216
217
 
217
- running(cellId: string | null): Protocol.Execution {
218
+ running(cellId: string | null): Protocol.ExecutionOutput {
218
219
  return execution(cellId, { status: "running", started_at: T0 });
219
220
  },
220
221
 
221
- queued(cellId: string | null): Protocol.Execution {
222
+ queued(cellId: string | null): Protocol.ExecutionOutput {
222
223
  return execution(cellId, { status: "queued" });
223
224
  },
224
225
 
@@ -148,7 +148,7 @@ export const MockNotebook = {
148
148
  cellId: CellId;
149
149
  cellName: string;
150
150
  code?: string;
151
- error: Partial<Protocol.Error>;
151
+ error: Partial<Protocol.ErrorOutput>;
152
152
  consoleTraceback?: string;
153
153
  }[],
154
154
  ): NotebookState => {
@@ -63,7 +63,7 @@ describe("NameCellContentEditable", () => {
63
63
  Object.defineProperty(field, "innerText", { value: " renamed " });
64
64
  fireEvent.blur(field);
65
65
 
66
- expect(store.get(model.documentAtom)?.cells.get("c1")?.name).toBe(
66
+ expect(store.get(model.documentAtom)?.cells.get(cellId("c1"))?.name).toBe(
67
67
  "renamed",
68
68
  );
69
69
  });
@@ -35,12 +35,12 @@ const wrapper = ({ children }: { children: ReactNode }) => (
35
35
  <Provider store={store}>{children}</Provider>
36
36
  );
37
37
 
38
- function accepted(cells: Protocol.CellId[]): Protocol.Run {
38
+ function accepted(cells: string[]): Protocol.RunOutput {
39
39
  return {
40
40
  id: "run-1",
41
41
  notebook_id: "n1",
42
42
  runtime_id: "r1",
43
- origin: { kind: "cells", cell_ids: cells },
43
+ origin: { kind: "cells", cell_ids: cells.map(cellId) },
44
44
  created_at: "2026-10-01T09:20:00Z",
45
45
  state: { status: "queued" },
46
46
  };
@@ -62,7 +62,7 @@ describe("useRunStaleCells", () => {
62
62
  store.set(activeDocumentModelAtom, null);
63
63
  });
64
64
 
65
- function seed(records: Protocol.Execution[]) {
65
+ function seed(records: Protocol.ExecutionOutput[]) {
66
66
  const document = documentOf();
67
67
  const replica = MockExecutions.seed(
68
68
  store,
@@ -12,6 +12,9 @@ import {
12
12
  } from "@/core/notebook/replica/__tests__/fixtures";
13
13
  import { activeDocumentModelAtom } from "@/core/session/active-notebook";
14
14
  import { DocumentSyncStatus } from "../footer-items/document-sync-status";
15
+ import { cellId } from "@/__tests__/branded";
16
+
17
+ const C1 = cellId("c1");
15
18
 
16
19
  const lifetimes: AbortController[] = [];
17
20
 
@@ -28,7 +31,7 @@ const conflict = {
28
31
  status: 412,
29
32
  detail: "cell c1 has changed since it was read.",
30
33
  index: 0,
31
- cell: document().cells.get("c1")!,
34
+ cell: document().cells.get(C1)!,
32
35
  document: document().revision,
33
36
  },
34
37
  } satisfies Awaited<ReturnType<FakeEdit>>;
@@ -78,7 +81,7 @@ describe("DocumentSyncStatus", () => {
78
81
  const { store, model } = setup(edit);
79
82
 
80
83
  await act(async () => {
81
- store.set(model.editAtom, (tx) => tx.setCode("c1", "x = 2"));
84
+ store.set(model.editAtom, (tx) => tx.setCode(C1, "x = 2"));
82
85
  await model.flush().catch(() => undefined);
83
86
  });
84
87
  const item = screen.getByTestId("footer-document-sync");
@@ -8,11 +8,11 @@ import { MockNotebook } from "@/__mocks__/notebook";
8
8
  import { type CellId, CellId as CellIdClass } from "@/core/cells/ids";
9
9
  import { ErrorContextProvider } from "../error";
10
10
 
11
- const SYNTAX: Partial<Protocol.Error> = {
11
+ const SYNTAX: Partial<Protocol.ErrorOutput> = {
12
12
  kind: "invalid-syntax",
13
13
  message: "Invalid syntax",
14
14
  };
15
- const RUNTIME: Partial<Protocol.Error> = {
15
+ const RUNTIME: Partial<Protocol.ErrorOutput> = {
16
16
  kind: "exception",
17
17
  name: "RuntimeError",
18
18
  message: "Runtime error",
@@ -332,7 +332,10 @@ describe("ErrorContextProvider", () => {
332
332
 
333
333
  describe("error description handling", () => {
334
334
  it("describes each kind of host error", () => {
335
- const errors: { error: Partial<Protocol.Error>; expected: string }[] = [
335
+ const errors: {
336
+ error: Partial<Protocol.ErrorOutput>;
337
+ expected: string;
338
+ }[] = [
336
339
  {
337
340
  error: { kind: "exception", message: "Runtime exception" },
338
341
  expected: "Runtime exception",
@@ -53,7 +53,7 @@ afterEach(() => {
53
53
  vi.clearAllMocks();
54
54
  });
55
55
 
56
- const setup = (cells?: Record<string, Protocol.Cell | null>) =>
56
+ const setup = (cells?: Record<string, Protocol.CellOutput | null>) =>
57
57
  setupNotebook(stops, cells);
58
58
 
59
59
  describe("createCellAtom", () => {
@@ -456,7 +456,7 @@ describe("undoDeleteCellAtom", () => {
456
456
  type: "delete",
457
457
  cells: [
458
458
  {
459
- cell: { id: "c9", code: "q = 9" },
459
+ cell: { id: cellId("c9"), code: "q = 9", name: "_" },
460
460
  placement: { after: cellId("gone") },
461
461
  serializedEditorState: null,
462
462
  },
@@ -44,7 +44,7 @@ afterEach(() => {
44
44
  }
45
45
  });
46
46
 
47
- const setup = (cells?: Record<string, Protocol.Cell | null>) =>
47
+ const setup = (cells?: Record<string, Protocol.CellOutput | null>) =>
48
48
  setupNotebook(stops, cells);
49
49
 
50
50
  /** Four cells, the last two in a second column. */
@@ -1,5 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
+ import { cellId } from "@/__tests__/branded";
3
4
  import { defaultUserConfig } from "@/core/config/config-schema";
4
5
 
5
6
  /** A store whose notebook follows a document model, as the session wires it. */
@@ -12,7 +13,6 @@ import type * as Protocol from "@marimo-team/client/protocol";
12
13
  import { createStore } from "jotai";
13
14
  import { mockDocumentModel } from "@/__mocks__/document";
14
15
  import { MockExecutions } from "@/__mocks__/executions";
15
- import type { CellId } from "@/core/cells/ids";
16
16
  import { adaptiveLanguageConfiguration } from "@/core/codemirror/language/extension";
17
17
  import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
18
18
  import {
@@ -26,7 +26,7 @@ import { layoutAtom } from "../layout";
26
26
 
27
27
  export function setupNotebook(
28
28
  stops: Array<() => void>,
29
- cells?: Record<string, Protocol.Cell | null>,
29
+ cells?: Record<string, Protocol.CellOutput | null>,
30
30
  ) {
31
31
  const store = createStore();
32
32
  store.set(notebookAtom, exportedForTesting.initialNotebookState());
@@ -39,7 +39,7 @@ export function setupNotebook(
39
39
  /** What the host shows for each cell, by cell id. */
40
40
  const results = new Map<
41
41
  string,
42
- readonly [Protocol.Execution, Protocol.Output]
42
+ readonly [Protocol.ExecutionOutput, Protocol.Output]
43
43
  >();
44
44
  followDocument({
45
45
  store,
@@ -64,9 +64,11 @@ export function setupNotebook(
64
64
  /** The columns' ids, as the page keys them. */
65
65
  columnIds: () => store.get(layoutAtom).columns.map((column) => column.id),
66
66
  notebook: () => store.get(notebookAtom),
67
- cellIn: (id: string) => store.get(model.documentAtom)?.cells.get(id),
67
+ cellIn: (id: string) =>
68
+ store.get(model.documentAtom)?.cells.get(cellId(id)),
68
69
  /** Give a cell an editor, as mounting it would, with a cell's language setup. */
69
- mountEditor: (id: string) => {
70
+ mountEditor: (rawId: string) => {
71
+ const id = cellId(rawId);
70
72
  const view = new EditorView({
71
73
  state: EditorState.create({
72
74
  doc: store.get(model.documentAtom)?.cells.get(id)?.code ?? "",
@@ -74,7 +76,7 @@ export function setupNotebook(
74
76
  history(),
75
77
  python(),
76
78
  adaptiveLanguageConfiguration({
77
- cellId: id as CellId,
79
+ cellId: id,
78
80
  completionConfig: {
79
81
  ...defaultUserConfig().completion,
80
82
  activate_on_typing: true,
@@ -88,7 +90,7 @@ export function setupNotebook(
88
90
  ],
89
91
  }),
90
92
  });
91
- store.get(notebookAtom).cellHandles[id as never].current = {
93
+ store.get(notebookAtom).cellHandles[id].current = {
92
94
  editorView: view,
93
95
  editorViewOrNull: view,
94
96
  };
@@ -137,7 +137,7 @@ describe("layoutAtom", () => {
137
137
  function reporter(store: ReturnType<typeof setupNotebook>["store"]) {
138
138
  const results = new Map<
139
139
  CellId,
140
- readonly [Protocol.Execution, Protocol.Output]
140
+ readonly [Protocol.ExecutionOutput, Protocol.Output]
141
141
  >();
142
142
  return (id: CellId, html: string) => {
143
143
  results.set(
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { describe, expect, it } from "vitest";
4
4
  import { cellId } from "@/__tests__/branded";
5
- import type { Execution } from "@marimo-team/client/protocol";
5
+ import type { ExecutionOutput as Execution } from "@marimo-team/client/protocol";
6
6
  import {
7
7
  exportedForTesting,
8
8
  MAX_CODE_LENGTH,
@@ -18,7 +18,7 @@ const queued = {
18
18
  run_id: "r1",
19
19
  runtime_id: "runtime",
20
20
  caused_by_id: null,
21
- cell_id: "cell",
21
+ cell_id: cellId("cell"),
22
22
  code_fingerprint: "fp",
23
23
  created_at: "2026-10-01T09:20:00Z",
24
24
  state: { status: "queued" },
@@ -147,7 +147,7 @@ describe("execution traces", () => {
147
147
  expect(isPureMarkdown(markdown)).toBe(true);
148
148
  expect(observe(initial, {}, markdown)).toBe(initial);
149
149
  expect(
150
- observe(observe(initial), { cell_id: "md" }, markdown).runMap.get(
150
+ observe(observe(initial), { cell_id: cellId("md") }, markdown).runMap.get(
151
151
  "r1" as RunId,
152
152
  )?.cellRuns.size,
153
153
  ).toBe(2);
@@ -1,5 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  /* oxlint-disable typescript/no-explicit-any */
3
+ import { cellId } from "@/__tests__/branded";
3
4
  import { describe, expect, it } from "vitest";
4
5
  import { MockExecutions } from "@/__mocks__/executions";
5
6
  import { initialNotebookState, type NotebookState } from "@/core/cells/cells";
@@ -105,7 +106,7 @@ describe("staleCellIds", () => {
105
106
  const state = notebook(cells);
106
107
  const executions = MockExecutions.inputs(
107
108
  [MockExecutions.completed("cell1"), MockExecutions.completed("cell2")],
108
- { blocked: new Set(["cell2"]) },
109
+ { blocked: new Set([cellId("cell2")]) },
109
110
  );
110
111
 
111
112
  expect(staleCellIds(state, executions, freshness(cells))).toEqual([]);
@@ -131,7 +132,7 @@ describe("staleCellIds with a run in progress", () => {
131
132
  const state = notebook(cells);
132
133
  const ran = MockExecutions.completed("cell1");
133
134
  const executions = MockExecutions.inputs([ran], {
134
- requested: new Set(["cell1"]),
135
+ requested: new Set([cellId("cell1")]),
135
136
  });
136
137
 
137
138
  expect(staleCellIds(state, executions, freshness(cells))).toEqual([]);
@@ -506,7 +506,7 @@ export const deleteCellsAtom = atom(
506
506
  Logger.warn("Skipping delete for missing cellId", { cellId: id });
507
507
  }
508
508
  }
509
- const order = document.order as CellId[];
509
+ const order = document.order;
510
510
  const deleting = order.flatMap((id) => {
511
511
  const cell = document.cells.get(id);
512
512
  return cell !== undefined && requested.has(id) ? [cell] : [];
@@ -517,11 +517,11 @@ export const deleteCellsAtom = atom(
517
517
  if (deleting.length === 0) {
518
518
  return false;
519
519
  }
520
- const gone = new Set(deleting.map((cell) => cell.id as CellId));
520
+ const gone = new Set(deleting.map((cell) => cell.id));
521
521
  const firstSurvivor = order.find((id) => !gone.has(id));
522
522
 
523
523
  const cells: DeletedCell[] = deleting.map((cell) => {
524
- const id = cell.id as CellId;
524
+ const id = cell.id;
525
525
  const index = order.indexOf(id);
526
526
  const code = cell.code ?? notebook.cellData[id]?.code ?? "";
527
527
  const editorView = notebook.cellHandles[id]?.current?.editorView;
@@ -541,7 +541,7 @@ export const deleteCellsAtom = atom(
541
541
  });
542
542
 
543
543
  // Focus the nearest visible survivor in the column, looking up before down.
544
- const first = deleting[0].id as CellId;
544
+ const first = deleting[0].id;
545
545
  const column = columnOf(get(layoutAtom), first);
546
546
  const ids = column.visible.includes(first) ? column.visible : column.ids;
547
547
  const at = ids.indexOf(first);
@@ -634,7 +634,7 @@ export const undoDeleteCellAtom = atom(null, (get, set): void => {
634
634
  const next = new Map(states);
635
635
  for (const { cell, serializedEditorState } of last.cells) {
636
636
  if (serializedEditorState !== null) {
637
- next.set(cell.id as CellId, serializedEditorState);
637
+ next.set(cell.id, serializedEditorState);
638
638
  }
639
639
  }
640
640
  return next;
@@ -642,7 +642,7 @@ export const undoDeleteCellAtom = atom(null, (get, set): void => {
642
642
  set(notebookAtom, (state) => ({
643
643
  ...state,
644
644
  history: state.history.slice(0, -1),
645
- scrollKey: last.cells[0].cell.id as CellId,
645
+ scrollKey: last.cells[0].cell.id,
646
646
  }));
647
647
  });
648
648
 
@@ -57,7 +57,7 @@ import {
57
57
 
58
58
  /** A deleted cell as it was, with where it went in the document. */
59
59
  export interface DeletedCell {
60
- cell: Protocol.CellInput;
60
+ cell: Protocol.CellInputOutput;
61
61
  placement: Placement;
62
62
  /** The editor's state at deletion, so undo brings its history back. */
63
63
  serializedEditorState: SerializedEditorState | null;
@@ -64,10 +64,9 @@ export function applyDocument(
64
64
  state: NotebookState,
65
65
  document: EditableDocument,
66
66
  ): NotebookState {
67
- // The protocol's ids are plain strings; the notebook brands them.
68
67
  const cellIds = isEqual(document.order, state.cellIds)
69
68
  ? state.cellIds
70
- : ([...document.order] as CellId[]);
69
+ : [...document.order];
71
70
  let { cellData, cellRuntime, cellHandles } = state;
72
71
  for (const id of cellIds) {
73
72
  const cell = document.cells.get(id);
@@ -1,6 +1,6 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import type { Execution } from "@marimo-team/client/protocol";
3
+ import type { ExecutionOutput as Execution } from "@marimo-team/client/protocol";
4
4
  import type { Getter } from "jotai";
5
5
  import type { ReducerCellActions } from "./cells";
6
6
  import {
@@ -89,14 +89,14 @@ export function consoleObservers(
89
89
  if (changed) {
90
90
  if (record.state.status === "running") {
91
91
  actions.startCellConsole({
92
- cellId: (record.cell_id ?? SCRATCH_CELL_ID) as CellId,
92
+ cellId: record.cell_id ?? SCRATCH_CELL_ID,
93
93
  });
94
94
  }
95
95
  onExecution?.(record);
96
96
  }
97
97
  },
98
98
  onItem(record, item, live) {
99
- const cellId = (record.cell_id ?? SCRATCH_CELL_ID) as CellId;
99
+ const cellId = record.cell_id ?? SCRATCH_CELL_ID;
100
100
  const start = startedAt(record);
101
101
  const output = consoleEntry(item, start ? Date.parse(start) / 1000 : 0);
102
102
  if (output.channel === "media") {
@@ -1,6 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  /* oxlint-disable typescript/no-redeclare */
3
3
 
4
+ import type * as Protocol from "@marimo-team/client/protocol";
4
5
  import type { components } from "@marimo-team/marimo-api";
5
6
  import { OBJECT_ID_ATTR } from "@/core/dom/ui-element-constants";
6
7
  import { invariant } from "@/utils/invariant";
@@ -13,10 +14,7 @@ const seen = new Set<CellId>();
13
14
  export const SCRATCH_CELL_ID = "__scratch__" as CellId;
14
15
  export const SETUP_CELL_ID = "setup" as CellId;
15
16
 
16
- /**
17
- * A typed CellId — derived from the generated OpenAPI schema.
18
- */
19
- export type CellId = components["schemas"]["CellId"];
17
+ export type CellId = Protocol.CellId;
20
18
  export const CellId = {
21
19
  /**
22
20
  * Create a new CellId, a random 4 letter string.
@@ -1,7 +1,7 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { createReducerAndAtoms } from "@/utils/createReducer";
3
3
  import type { TypedString } from "@/utils/typed";
4
- import type { Execution } from "@marimo-team/client/protocol";
4
+ import type { ExecutionOutput as Execution } from "@marimo-team/client/protocol";
5
5
  import { completedAt, startedAt } from "@/core/notebook/replica";
6
6
  import type { CellId } from "./ids";
7
7
  export type RunId = TypedString<"RunId">;
@@ -76,7 +76,7 @@ const {
76
76
  return state;
77
77
  }
78
78
  const runId = record.run_id as RunId;
79
- const cellId = record.cell_id as CellId;
79
+ const cellId = record.cell_id;
80
80
  const previous = state.runMap.get(runId);
81
81
  if (previous === undefined && code !== undefined && isPureMarkdown(code)) {
82
82
  return state;
@@ -168,7 +168,7 @@ function createEmptySessionCell(): SessionCell {
168
168
  }
169
169
 
170
170
  /** The cell as a host would describe it. A snapshot never changes, so its etags only need to be distinct. */
171
- function cellRecord(cellId: CellId, cell: NotebookCell): Protocol.Cell {
171
+ function cellRecord(cellId: CellId, cell: NotebookCell): Protocol.CellOutput {
172
172
  return {
173
173
  id: cellId,
174
174
  notebook_id: EMBEDDED,
@@ -214,12 +214,12 @@ function normalizeTraceback(lines: readonly string[]): string | null {
214
214
  * current, with no runtime behind it.
215
215
  */
216
216
  function resultRecord(
217
- cell: Protocol.Cell,
217
+ cell: Protocol.CellOutput,
218
218
  sessionCell: SessionCell | null | undefined,
219
219
  ): StaticResult | null {
220
220
  const primary = primaryOutputOf(sessionCell);
221
221
  const id = `${EMBEDDED}:${cell.id}:result`;
222
- let outcome: Protocol.ExecutionOutcome;
222
+ let outcome: Protocol.ExecutionOutcomeOutput;
223
223
  let output: Protocol.Output | null = null;
224
224
  if (primary === undefined) {
225
225
  return null;
@@ -352,7 +352,7 @@ export function readExport({
352
352
  return { snapshot: null, cellRuntime: {} };
353
353
  }
354
354
 
355
- const cells: Protocol.Cell[] = [];
355
+ const cells: Protocol.CellOutput[] = [];
356
356
  const results: StaticResult[] = [];
357
357
  const cellRuntime: Record<CellId, CellRuntimeState> = {};
358
358
  for (const cellId of cellIds) {
@@ -29,7 +29,7 @@ function run(
29
29
  cells: Protocol.CellId[],
30
30
  status: Protocol.RunState["status"] = "queued",
31
31
  id = "run-1",
32
- ): Protocol.Run {
32
+ ): Protocol.RunOutput {
33
33
  return {
34
34
  id,
35
35
  notebook_id: "n1",
@@ -50,7 +50,10 @@ function run(
50
50
  };
51
51
  }
52
52
 
53
- function withRuns(executions: Executions, runs: Protocol.Run[]): Executions {
53
+ function withRuns(
54
+ executions: Executions,
55
+ runs: Protocol.RunOutput[],
56
+ ): Executions {
54
57
  return { ...executions, runs: new Map(runs.map((r) => [r.id, r])) };
55
58
  }
56
59