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

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 (27) hide show
  1. package/dist/{ErrorBoundary-BUp3s8bW.js → ErrorBoundary-Bitt9N44.js} +1 -1
  2. package/dist/{chat-ui-DFoH-uxc.js → chat-ui-BJSYaekC.js} +3 -3
  3. package/dist/{code-visibility-JyOG3ytM.js → code-visibility-CK8BfIsO.js} +3 -3
  4. package/dist/{common-DsPeHITU.js → common-C-TqeXix.js} +3 -3
  5. package/dist/{data-grid-overlay-editor-D6RpA9b2.js → data-grid-overlay-editor-CilodNKx.js} +1 -1
  6. package/dist/{error-entries-C9OKfJKe.js → error-entries-CNH4hNt-.js} +7 -4
  7. package/dist/{feedback-button-w5jJOd6o.js → feedback-button-B_nA4iPT.js} +3 -3
  8. package/dist/{glide-data-editor-lWcwB0Si.js → glide-data-editor-BQ0Ykfzt.js} +3 -3
  9. package/dist/{globals-BFICoaLo.js → globals-BkrP88Os.js} +1 -1
  10. package/dist/{html-to-image-BiWLL4Tu.js → html-to-image-BBX2UucV.js} +1 -1
  11. package/dist/main.js +4550 -4541
  12. package/dist/{number-overlay-editor-BDYmg8YM.js → number-overlay-editor-C9lu04cw.js} +1 -1
  13. package/dist/{process-output-ClyiXL-f.js → process-output-DatAq1xF.js} +2 -2
  14. package/dist/{reveal-component-B63xZtLQ.js → reveal-component-BvH2Wxyh.js} +2 -2
  15. package/package.json +1 -1
  16. package/src/__mocks__/executions.ts +4 -4
  17. package/src/components/editor/cell/__tests__/useRunCells.test.tsx +1 -1
  18. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
  19. package/src/core/executions/__tests__/input.test.ts +1 -1
  20. package/src/core/executions/__tests__/interrupt.test.ts +2 -6
  21. package/src/core/executions/__tests__/run.test.ts +35 -24
  22. package/src/core/executions/atoms.ts +15 -6
  23. package/src/core/notebook/replica/__tests__/runtime.test.ts +9 -10
  24. package/src/core/notebook/replica/resources/runtime.ts +1 -1
  25. package/src/core/runtime/__tests__/adapter.test.ts +1 -1
  26. package/src/core/runtime/adapter.ts +1 -1
  27. package/src/core/wasm/__tests__/bridge.test.ts +4 -6
@@ -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-lWcwB0Si.js";
3
+ import { a as n } from "./glide-data-editor-BQ0Ykfzt.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-BiWLL4Tu.js";
1
+ import { T as e } from "./html-to-image-BBX2UucV.js";
2
2
  import { h as t } from "./tooltip-CiJ919pg.js";
3
- import { Tt as n, wt as r } from "./error-entries-C9OKfJKe.js";
3
+ import { Tt as n, wt as r } from "./error-entries-CNH4hNt-.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-DsPeHITU.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-C-TqeXix.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-JyOG3ytM.js";
13
+ import { n as ne, t as re } from "./code-visibility-CK8BfIsO.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-dev464",
3
+ "version": "0.25.3-dev465",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -33,6 +33,7 @@ const T1 = "2026-10-01T09:20:12.500Z";
33
33
 
34
34
  let sequence = 0;
35
35
 
36
+ const READY: Protocol.RuntimeState = { status: "ready" };
36
37
  const SUCCEEDED: Protocol.Outcome = { kind: "succeeded" };
37
38
 
38
39
  /** An execution, or the output it set, as the stream delivers them. */
@@ -231,14 +232,13 @@ export const MockExecutions = {
231
232
  };
232
233
  },
233
234
 
234
- runtime(status: Protocol.RuntimeStatus): Protocol.Runtime {
235
+ runtime(state: Protocol.RuntimeState = READY): Protocol.Runtime {
235
236
  return {
236
237
  id: "r1",
237
238
  notebook_id: "n1",
238
- status,
239
- message: null,
240
239
  marimo_version: null,
241
- started_at: T0,
240
+ created_at: T0,
241
+ state,
242
242
  };
243
243
  },
244
244
 
@@ -66,7 +66,7 @@ describe("useRunStaleCells", () => {
66
66
  const replica = MockExecutions.seed(
67
67
  store,
68
68
  records,
69
- MockExecutions.runtime("running"),
69
+ MockExecutions.runtime(),
70
70
  document,
71
71
  );
72
72
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -133,7 +133,7 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
133
133
  if (cells.length === 0 && !invisible) {
134
134
  // Until the host reports the runtime running, show loading state.
135
135
  // A static notebook has no runtime to wait for.
136
- if (runtimeStatus !== "running" && !isStaticNotebook()) {
136
+ if (runtimeStatus !== "ready" && !isStaticNotebook()) {
137
137
  return (
138
138
  <div className="flex-1 flex flex-col items-center justify-center py-8">
139
139
  <Loader2Icon className="w-8 h-8 animate-spin text-muted-foreground" />
@@ -36,7 +36,7 @@ describe("replyInput", () => {
36
36
  const replica = MockExecutions.seed(
37
37
  store,
38
38
  [],
39
- MockExecutions.runtime("running"),
39
+ MockExecutions.runtime(),
40
40
  documentOf(),
41
41
  );
42
42
  store.set(replica.backendAtom, fakeBackend({ input }));
@@ -45,15 +45,11 @@ function run(
45
45
 
46
46
  function setup(runs: Protocol.Run[]) {
47
47
  const store = createStore();
48
- const replica = MockExecutions.seed(
49
- store,
50
- [],
51
- MockExecutions.runtime("running"),
52
- );
48
+ const replica = MockExecutions.seed(store, [], MockExecutions.runtime());
53
49
  const interrupt = vi.fn<FakeInterrupt>(async () => ({
54
50
  ok: true,
55
51
  status: 202,
56
- data: MockExecutions.runtime("running"),
52
+ data: MockExecutions.runtime(),
57
53
  }));
58
54
  store.set(replica.backendAtom, fakeBackend({ interrupt }));
59
55
  store.set(replica.executionsAtom, {
@@ -90,7 +90,7 @@ describe("runCells", () => {
90
90
  const replica = MockExecutions.seed(
91
91
  store,
92
92
  [],
93
- MockExecutions.runtime("running"),
93
+ MockExecutions.runtime(),
94
94
  documentOf(),
95
95
  );
96
96
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -125,7 +125,7 @@ describe("runCells", () => {
125
125
  const replica = MockExecutions.seed(
126
126
  store,
127
127
  [],
128
- MockExecutions.runtime("running"),
128
+ MockExecutions.runtime(),
129
129
  withCells(documentOf(), {
130
130
  c2: cell("c2", "y = 2", { config: { ...CONFIG, disabled: true } }),
131
131
  }),
@@ -146,7 +146,7 @@ describe("runCells", () => {
146
146
  const replica = MockExecutions.seed(
147
147
  store,
148
148
  [],
149
- MockExecutions.runtime("starting"),
149
+ MockExecutions.runtime({ status: "starting", message: null }),
150
150
  documentOf(),
151
151
  );
152
152
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -157,7 +157,7 @@ describe("runCells", () => {
157
157
  expect(status(C1)).toBe("queued");
158
158
  expect(run).not.toHaveBeenCalled();
159
159
 
160
- store.set(replica.runtimeAtom, MockExecutions.runtime("running"));
160
+ store.set(replica.runtimeAtom, MockExecutions.runtime());
161
161
  await pending;
162
162
  expect(run).toHaveBeenCalledOnce();
163
163
  });
@@ -173,7 +173,7 @@ describe("runCells", () => {
173
173
  expect(run).not.toHaveBeenCalled();
174
174
 
175
175
  // The real replica reports both at once, from one snapshot.
176
- store.set(replica.runtimeAtom, MockExecutions.runtime("running"));
176
+ store.set(replica.runtimeAtom, MockExecutions.runtime());
177
177
  store.set(replica.notebookAtom, MockExecutions.notebook());
178
178
  await pending;
179
179
 
@@ -196,24 +196,35 @@ describe("runCells", () => {
196
196
  );
197
197
  });
198
198
 
199
- it("withdraws the submission and reports when the runtime has failed", async () => {
200
- const replica = MockExecutions.seed(
201
- store,
202
- [],
203
- { ...MockExecutions.runtime("failed"), message: "The kernel exited" },
204
- documentOf(),
205
- );
206
- store.set(replica.backendAtom, fakeBackend({ run }));
207
- model();
199
+ it.each<[Protocol.RuntimeOutcome, string]>([
200
+ [{ kind: "failed", message: "The kernel exited" }, "The kernel exited"],
201
+ [{ kind: "failed", message: null }, "The runtime failed"],
202
+ [{ kind: "stopped" }, "The notebook has no runtime"],
203
+ ])(
204
+ "withdraws the submission and reports when the runtime ended %o",
205
+ async (outcome, description) => {
206
+ const replica = MockExecutions.seed(
207
+ store,
208
+ [],
209
+ MockExecutions.runtime({
210
+ status: "ended",
211
+ ended_at: "2026-10-01T09:30:00Z",
212
+ outcome,
213
+ }),
214
+ documentOf(),
215
+ );
216
+ store.set(replica.backendAtom, fakeBackend({ run }));
217
+ model();
208
218
 
209
- await runCells(store, [C1]);
219
+ await runCells(store, [C1]);
210
220
 
211
- expect(run).not.toHaveBeenCalled();
212
- expect(status(C1)).toBe("idle");
213
- expect(toast).toHaveBeenCalledWith(
214
- expect.objectContaining({ description: "The kernel exited" }),
215
- );
216
- });
221
+ expect(run).not.toHaveBeenCalled();
222
+ expect(status(C1)).toBe("idle");
223
+ expect(toast).toHaveBeenCalledWith(
224
+ expect.objectContaining({ description }),
225
+ );
226
+ },
227
+ );
217
228
 
218
229
  it("withdraws the submission and reports when the notebook has no runtime", async () => {
219
230
  const replica = MockExecutions.seed(store, [], null, documentOf());
@@ -233,7 +244,7 @@ describe("runCells", () => {
233
244
  const replica = MockExecutions.seed(
234
245
  store,
235
246
  [],
236
- MockExecutions.runtime("starting"),
247
+ MockExecutions.runtime({ status: "starting", message: null }),
237
248
  documentOf(),
238
249
  );
239
250
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -313,7 +324,7 @@ describe("runCells", () => {
313
324
  const replica = MockExecutions.seed(
314
325
  store,
315
326
  [],
316
- MockExecutions.runtime("running"),
327
+ MockExecutions.runtime(),
317
328
  documentOf(),
318
329
  );
319
330
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -335,7 +346,7 @@ describe("runCells", () => {
335
346
  const replica = MockExecutions.seed(
336
347
  store,
337
348
  [],
338
- MockExecutions.runtime("running"),
349
+ MockExecutions.runtime(),
339
350
  documentOf(),
340
351
  );
341
352
  store.set(replica.backendAtom, fakeBackend({ run }));
@@ -255,7 +255,9 @@ export function clearCellOutputs(
255
255
  /** The runtime's status, null while the notebook has none or the stream is not ready. */
256
256
  export const runtimeStatusAtom = atom((get) => {
257
257
  const replica = get(activeNotebookReplicaAtom);
258
- return replica === null ? null : (get(replica.runtimeAtom)?.status ?? null);
258
+ return replica === null
259
+ ? null
260
+ : (get(replica.runtimeAtom)?.state.status ?? null);
259
261
  });
260
262
 
261
263
  export const notebookIsRunningAtom = atom((get) =>
@@ -272,7 +274,7 @@ type RuntimeReadiness = "running" | "waiting" | { refused: string };
272
274
  * Whether a run can go to the host now, should wait, or has nothing to wait for.
273
275
  *
274
276
  * A runtime that is starting, or a stream that has not reported yet, will
275
- * settle one way or the other. A failed or absent runtime, or a connection
277
+ * settle one way or the other. An ended or absent runtime, or a connection
276
278
  * that has closed, will not, so a run waiting on it is refused instead.
277
279
  */
278
280
  const runtimeReadinessAtom = atom((get): RuntimeReadiness => {
@@ -292,11 +294,18 @@ const runtimeReadinessAtom = atom((get): RuntimeReadiness => {
292
294
  if (runtime === null) {
293
295
  return { refused: "The notebook has no runtime" };
294
296
  }
295
- switch (runtime.status) {
296
- case "running":
297
+ switch (runtime.state.status) {
298
+ case "ready":
297
299
  return "running";
298
- case "failed":
299
- return { refused: runtime.message ?? "The runtime failed" };
300
+ case "ended": {
301
+ const { outcome } = runtime.state;
302
+ return {
303
+ refused:
304
+ outcome.kind === "failed"
305
+ ? (outcome.message ?? "The runtime failed")
306
+ : "The notebook has no runtime",
307
+ };
308
+ }
300
309
  default:
301
310
  return "waiting";
302
311
  }
@@ -17,22 +17,22 @@ describe("runtime resource", () => {
17
17
  const state = confirmed();
18
18
  const running = current(state);
19
19
  expect(running?.id).toBe("r1");
20
- expect(running?.status).toBe("running");
20
+ expect(running?.state).toEqual({ status: "ready" });
21
21
 
22
- const terminating = reducer.reduce(state, {
22
+ const stopping = reducer.reduce(state, {
23
23
  event: "runtime",
24
24
  id: "98",
25
- data: { runtime: { ...running!, status: "terminating" } },
25
+ data: { runtime: { ...running!, state: { status: "stopping" } } },
26
26
  });
27
- expect(current(terminating)?.status).toBe("terminating");
28
- expect(current(state)?.status).toBe("running");
27
+ expect(current(stopping)?.state).toEqual({ status: "stopping" });
28
+ expect(current(state)?.state).toEqual({ status: "ready" });
29
29
 
30
- const other = reducer.reduce(terminating, {
30
+ const other = reducer.reduce(stopping, {
31
31
  event: "runtime.removed",
32
32
  id: "99",
33
33
  data: { id: "r0", time },
34
34
  });
35
- expect(current(other)).toBe(current(terminating));
35
+ expect(current(other)).toBe(current(stopping));
36
36
 
37
37
  const removed = reducer.reduce(other, {
38
38
  event: "runtime.removed",
@@ -58,10 +58,9 @@ describe("runtime resource", () => {
58
58
  const replacement = {
59
59
  ...current(state)!,
60
60
  id: "r2",
61
- status: "starting" as const,
62
- message: "Starting the kernel",
63
61
  marimo_version: null,
64
- started_at: "2026-10-01T09:31:00Z",
62
+ created_at: "2026-10-01T09:31:00Z",
63
+ state: { status: "starting" as const, message: "Starting the kernel" },
65
64
  };
66
65
  const starting = reducer.reduce(removed, {
67
66
  event: "runtime",
@@ -3,7 +3,7 @@
3
3
  import type { Runtime } from "@marimo-team/client/protocol";
4
4
  import type { NotebookResource } from "@marimo-team/client";
5
5
 
6
- /** The notebook's runtime record while it has one. */
6
+ /** The notebook's runtime record, kept after the runtime ends. */
7
7
  export const runtime: NotebookResource<Runtime | null, "runtime"> = {
8
8
  initial: null,
9
9
  on: {
@@ -128,7 +128,7 @@ describe("canRunCellsAtom", () => {
128
128
  store.set(connectionAtom, { state: ConnectionState.OPEN });
129
129
  expect(store.get(canRunCellsAtom)).toBe(false);
130
130
 
131
- MockExecutions.seed(store, [], MockExecutions.runtime("running"));
131
+ MockExecutions.seed(store, [], MockExecutions.runtime());
132
132
  expect(store.get(canRunCellsAtom)).toBe(true);
133
133
  });
134
134
 
@@ -169,7 +169,7 @@ export const canRunCellsAtom = atom<boolean>((get) => {
169
169
  return false;
170
170
  }
171
171
  if (adapter.kind === "remote") {
172
- return get(runtimeStatusAtom) === "running";
172
+ return get(runtimeStatusAtom) === "ready";
173
173
  }
174
174
  return true;
175
175
  });
@@ -341,10 +341,9 @@ it.each(["running", "completed", null])(
341
341
  body: {
342
342
  id: "r1",
343
343
  notebook_id: "n1",
344
- status: "running",
345
- message: null,
346
344
  marimo_version: null,
347
- started_at: "2026-10-01T09:20:11Z",
345
+ created_at: "2026-10-01T09:20:11Z",
346
+ state: { status: "ready" },
348
347
  },
349
348
  };
350
349
  mockNotebookCall.mockImplementation(async () => {
@@ -479,10 +478,9 @@ it("signals an interrupt once across pending, completed, and lost-reply retries"
479
478
  body: {
480
479
  id: "r1",
481
480
  notebook_id: "n1",
482
- status: "running",
483
- message: null,
484
481
  marimo_version: null,
485
- started_at: "2026-10-01T09:20:11Z",
482
+ created_at: "2026-10-01T09:20:11Z",
483
+ state: { status: "ready" },
486
484
  },
487
485
  };
488
486
  mockNotebookCall.mockImplementation(() => pending.promise);