@marimo-team/islands 0.25.3-dev124 → 0.25.3-dev127

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 (35) hide show
  1. package/dist/{ErrorBoundary-DhQ27xs2.js → ErrorBoundary-CPEgy6hY.js} +1 -1
  2. package/dist/{chat-ui-DA8zEZ1I.js → chat-ui-k6_K3FK7.js} +4 -4
  3. package/dist/{code-visibility-C-yL48xr.js → code-visibility-DA9jRfM0.js} +3 -3
  4. package/dist/{common-DDRe3efY.js → common-uGnMtkcz.js} +5 -5
  5. package/dist/{data-grid-overlay-editor-BJHCQqQ1.js → data-grid-overlay-editor-C2qbg6YG.js} +1 -1
  6. package/dist/{error-entries-g9iQiVIT.js → error-entries-BvD_zQ4j.js} +1 -1
  7. package/dist/{feedback-button-Bvg8T58N.js → feedback-button-CIiADQ2k.js} +3 -3
  8. package/dist/{formats-V8ifA0Bk.js → formats-B3UNwK0S.js} +1 -1
  9. package/dist/{glide-data-editor-ZU7p01_F.js → glide-data-editor-yXRV-D0b.js} +3 -3
  10. package/dist/{globals-DtzxnBy4.js → globals-DbERpwvN.js} +1 -1
  11. package/dist/{html-to-image-Bg5ZoSO-.js → html-to-image-DJ2kGp48.js} +2 -2
  12. package/dist/main.js +13 -13
  13. package/dist/{number-overlay-editor-gFlLK8Ew.js → number-overlay-editor-z12o1WAt.js} +1 -1
  14. package/dist/{process-output-BtVPCGeI.js → process-output-BcFHHtnm.js} +2 -2
  15. package/dist/{reveal-component-C26V82jg.js → reveal-component-VBjBT6SL.js} +4 -4
  16. package/dist/{toDate-DKH0_kMo.js → toDate-DfkyXuPi.js} +4 -0
  17. package/dist/{vega-component-DgytCKrL.js → vega-component-0hWVSBRc.js} +2 -2
  18. package/package.json +1 -1
  19. package/src/core/host/__tests__/notebook-client.test.ts +18 -6
  20. package/src/core/host/__tests__/static.test.ts +4 -2
  21. package/src/core/host/__tests__/wasm.test.ts +12 -10
  22. package/src/core/host/backend.ts +8 -3
  23. package/src/core/host/notebook-client.ts +15 -15
  24. package/src/core/host/static.ts +2 -2
  25. package/src/core/host/wasm.ts +4 -3
  26. package/src/core/runtime/__tests__/runtime.test.ts +17 -0
  27. package/src/core/runtime/runtime.ts +13 -0
  28. package/src/core/websocket/__tests__/backend.test.ts +111 -0
  29. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +32 -27
  30. package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +7 -4
  31. package/src/core/websocket/backend.ts +68 -0
  32. package/src/core/websocket/transports/__tests__/notebook.test.ts +9 -56
  33. package/src/core/websocket/transports/notebook.ts +15 -38
  34. package/src/core/websocket/useNotebookClient.ts +6 -6
  35. package/src/core/websocket/useNotebookSession.tsx +3 -2
@@ -135,7 +135,7 @@ function F(e) {
135
135
  }
136
136
  //#endregion
137
137
  //#region src/components/editor/boundary/ErrorBoundary.tsx
138
- var I = (0, T.lazy)(() => import("./feedback-button-Bvg8T58N.js").then((e) => ({ default: e.FeedbackModal }))), L = (e) => {
138
+ var I = (0, T.lazy)(() => import("./feedback-button-CIiADQ2k.js").then((e) => ({ default: e.FeedbackModal }))), L = (e) => {
139
139
  let t = (0, w.c)(2), n;
140
140
  return t[0] === e.children ? n = t[1] : (n = /* @__PURE__ */ (0, j.jsx)(O, {
141
141
  FallbackComponent: R,
@@ -3,13 +3,13 @@ import { c as n, g as r, h as i, t as a } from "./button-BxB3RDjN.js";
3
3
  import { t as o } from "./react-sHtZdjeP.js";
4
4
  import { t as s } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { i as c, t as l } from "./copy-icon-CPoxUG7G.js";
6
- import { F as u, H as d, U as f, V as p, X as m, Y as h, Z as g, _, a as v, c as y, d as b, f as x, g as S, h as C, l as w, m as T, n as E, p as D, r as O, t as k, v as A, x as ee, y as te, z as ne } from "./html-to-image-Bg5ZoSO-.js";
6
+ import { F as u, H as d, U as f, V as p, X as m, Y as h, Z as g, _, a as v, c as y, d as b, f as x, g as S, h as C, l as w, m as T, n as E, p as D, r as O, t as k, v as A, x as ee, y as te, z as ne } from "./html-to-image-DJ2kGp48.js";
7
7
  import { h as j, t as re } from "./tooltip-CKO1pHJo.js";
8
- import { Ct as ie, Et as ae, Ht as oe, L as se, Lt as ce, Nt as le, St as ue, X as de, cn as fe, ct as pe, dn as me, en as he, et as ge, h as _e, i as ve, ln as ye, mn as be, mt as xe, r as Se, rt as Ce, st as we, t as Te, w as Ee, xt as De } from "./error-entries-g9iQiVIT.js";
8
+ import { Ct as ie, Et as ae, Ht as oe, L as se, Lt as ce, Nt as le, St as ue, X as de, cn as fe, ct as pe, dn as me, en as he, et as ge, h as _e, i as ve, ln as ye, mn as be, mt as xe, r as Se, rt as Ce, st as we, t as Te, w as Ee, xt as De } from "./error-entries-BvD_zQ4j.js";
9
9
  import { A as Oe, C as ke, M as Ae, b as je } from "./select-B0LRDH0g.js";
10
10
  import { _ as Me, f as Ne, h as Pe, i as Fe, n as Ie, t as Le } from "./dropdown-menu-B_7xD2X4.js";
11
- import { C as Re, d as ze } from "./toDate-DKH0_kMo.js";
12
- import { d as Be, f as Ve, i as He, n as Ue, t as We, u as Ge } from "./process-output-BtVPCGeI.js";
11
+ import { C as Re, d as ze } from "./toDate-DfkyXuPi.js";
12
+ import { d as Be, f as Ve, i as He, n as Ue, t as We, u as Ge } from "./process-output-BcFHHtnm.js";
13
13
  import { t as Ke } from "./jsx-runtime-3BD1kT0s.js";
14
14
  import { A as qe, C as Je, D as Ye, E as Xe, F as Ze, L as Qe, M as $e, O as et, P as tt, R as nt, S as rt, T as it, V as at, b as ot, j as st, v as ct, w as lt, x as ut, y as dt, z as ft } from "./use-restore-focus-DBCITLeF.js";
15
15
  import { n as pt } from "./error-banner-Sl2FlSJ4.js";
@@ -1,8 +1,8 @@
1
1
  import { g as e } from "./button-BxB3RDjN.js";
2
2
  import { t } from "./compiler-runtime-CldRdSsv.js";
3
- import { G as n, K as r } from "./error-entries-g9iQiVIT.js";
3
+ import { G as n, K as r } from "./error-entries-BvD_zQ4j.js";
4
4
  import { C as i } from "./select-B0LRDH0g.js";
5
- import { _ as a, c as o, x as s, y as c } from "./toDate-DKH0_kMo.js";
5
+ import { _ as a, c as o, x as s, y as c } from "./toDate-DfkyXuPi.js";
6
6
  import { C as l, E as u, a as d, b as f } from "./useTheme-CfeaVw5D.js";
7
7
  //#region src/core/islands/state.ts
8
8
  var p = t(), m = u(!1), h = u(/* @__PURE__ */ new Set()), g = u((e) => e(h)?.size === 0), _ = u(!1), v = u((e) => e(_) && e(m) === !1), y = u({
@@ -18,7 +18,7 @@ function x() {
18
18
  return e.warn("Failed to get version from mount config"), null;
19
19
  }
20
20
  }
21
- var S = x() || "0.25.3-dev124", C = u(S), w = u(!0);
21
+ var S = x() || "0.25.3-dev127", C = u(S), w = u(!0);
22
22
  u(null);
23
23
  //#endregion
24
24
  //#region src/core/wasm/state.ts
@@ -3,16 +3,16 @@ import { _ as t, c as n, f as r, g as i, h as a, m as o, n as s, p as c, r as l,
3
3
  import { t as d } from "./react-sHtZdjeP.js";
4
4
  import { t as f } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { i as p, n as m, r as h, t as g } from "./copy-icon-CPoxUG7G.js";
6
- import { $ as _, A as v, B as y, D as b, E as x, F as S, H as C, M as w, N as T, Q as E, S as D, T as O, V as k, W as A, X as j, Y as M, Z as N, _ as P, g as F, n as I, r as L, s as R, t as z, u as B, v as ee, w as V, y as te, z as ne } from "./html-to-image-Bg5ZoSO-.js";
6
+ import { $ as _, A as v, B as y, D as b, E as x, F as S, H as C, M as w, N as T, Q as E, S as D, T as O, V as k, W as A, X as j, Y as M, Z as N, _ as P, g as F, n as I, r as L, s as R, t as z, u as B, v as ee, w as V, y as te, z as ne } from "./html-to-image-DJ2kGp48.js";
7
7
  import { a as re, d as ie, h as H, n as ae, o as oe, r as se, t as U } from "./tooltip-CKO1pHJo.js";
8
- import { $ as ce, A as le, D as ue, Et as de, F as fe, G as pe, Ht as me, I as he, J as ge, K as _e, L as ve, Ot as ye, Rt as be, T as xe, Ut as Se, V as Ce, Xt as we, Yt as Te, Zt as Ee, _t as De, an as Oe, at as ke, b as Ae, c as je, cn as Me, dn as Ne, en as Pe, gn as Fe, gt as Ie, h as Le, hn as Re, l as ze, ln as Be, lt as Ve, mn as He, mt as Ue, on as We, ot as Ge, rn as Ke, st as qe, t as Je, un as Ye, vt as Xe, w as Ze, x as Qe, y as $e } from "./error-entries-g9iQiVIT.js";
8
+ import { $ as ce, A as le, D as ue, Et as de, F as fe, G as pe, Ht as me, I as he, J as ge, K as _e, L as ve, Ot as ye, Rt as be, T as xe, Ut as Se, V as Ce, Xt as we, Yt as Te, Zt as Ee, _t as De, an as Oe, at as ke, b as Ae, c as je, cn as Me, dn as Ne, en as Pe, gn as Fe, gt as Ie, h as Le, hn as Re, l as ze, ln as Be, lt as Ve, mn as He, mt as Ue, on as We, ot as Ge, rn as Ke, st as qe, t as Je, un as Ye, vt as Xe, w as Ze, x as Qe, y as $e } from "./error-entries-BvD_zQ4j.js";
9
9
  import { c as et, i as tt, r as nt } from "./useLifecycle-Dum8WSXq.js";
10
10
  import { a as rt, i as it, n as at, o as ot, r as st, t as ct } from "./useDateFormatter-c_yJtkAe.js";
11
11
  import { t as lt } from "./check-P35dc2dH.js";
12
12
  import { A as ut, C as dt, M as ft, O as pt, S as mt, _ as ht, b as gt, c as _t, d as vt, g as yt, h as bt, i as xt, l as St, m as Ct, n as wt, p as Tt, s as Et, t as Dt, u as Ot, v as kt, y as At } from "./select-B0LRDH0g.js";
13
13
  import { $ as jt, $t as Mt, A as Nt, At as Pt, B as Ft, Bt as It, Ct as Lt, D as Rt, Dt as zt, E as Bt, Et as Vt, F as Ht, Ft as Ut, G as Wt, Gt, H as Kt, Ht as qt, I as Jt, It as Yt, J as Xt, Jt as Zt, Kt as Qt, L as $t, Lt as en, M as tn, Mt as nn, N as rn, Nt as an, O as on, Ot as sn, P as cn, Pt as ln, Q as un, Qt as dn, R as fn, Rt as pn, S as mn, St as hn, T as gn, Tt as _n, U as vn, Ut as yn, V as bn, Vt as xn, W as Sn, Wt as Cn, X as wn, Xt as Tn, Y as En, Yt as Dn, Z as On, Zt as kn, _ as An, _n as jn, _t as Mn, a as Nn, an as Pn, at as Fn, b as In, bt as Ln, cn as Rn, ct as zn, d as Bn, dn as Vn, en as Hn, et as Un, f as Wn, fn as Gn, ft as Kn, gn as qn, gt as Jn, h as Yn, hn as Xn, ht as Zn, i as Qn, in as $n, it as er, j as tr, jt as nr, k as rr, kt as ir, l as ar, ln as or, lt as sr, mn as cr, mt as lr, n as ur, nn as dr, nt as fr, o as pr, ot as mr, pn as hr, pt as gr, qt as _r, rn as vr, rt as yr, s as br, sn as xr, st as Sr, t as Cr, tt as wr, u as Tr, ut as Er, vn as Dr, vt as Or, w as kr, wt as Ar, x as jr, xt as Mr, y as Nr, yn as Pr, yt as Fr, z as Ir, zt as Lr } from "./dropdown-menu-B_7xD2X4.js";
14
- import { a as Rr, c as zr, d as Br, i as Vr, l as Hr, n as Ur, o as Wr, r as Gr, t as Kr, v as qr, x as Jr, y as Yr } from "./toDate-DKH0_kMo.js";
15
- import { n as Xr, t as Zr } from "./ErrorBoundary-DhQ27xs2.js";
14
+ import { a as Rr, c as zr, d as Br, i as Vr, l as Hr, n as Ur, o as Wr, r as Gr, t as Kr, v as qr, x as Jr, y as Yr } from "./toDate-DfkyXuPi.js";
15
+ import { n as Xr, t as Zr } from "./ErrorBoundary-CPEgy6hY.js";
16
16
  import { t as Qr } from "./clsx-CoeGtWvn.js";
17
17
  import { t as $r } from "./react-dom-DUmH0GXv.js";
18
18
  import { t as ei } from "./jsx-runtime-3BD1kT0s.js";
@@ -30,7 +30,7 @@ import { n as ca, t as la } from "./once-eG8Vmvjd.js";
30
30
  import { o as ua } from "./dist-BorMD-uX.js";
31
31
  import { a as da, i as fa, n as pa, o as ma, r as ha, t as ga } from "./dialog-C1PcpCqX.js";
32
32
  import { t as _a } from "./useAsyncData-D0mLJstx.js";
33
- import { a as va, i as ya, n as ba, r as xa, t as Sa } from "./formats-V8ifA0Bk.js";
33
+ import { a as va, i as ya, n as ba, r as xa, t as Sa } from "./formats-B3UNwK0S.js";
34
34
  import { n as W, t as G } from "./objectWithoutPropertiesLoose-BRDcTsfB.js";
35
35
  import { D as Ca, n as wa } from "./vega-loader.browser-B9Pz0EGP.js";
36
36
  import { a as Ta, n as Ea, r as Da, t as Oa } from "./loader-Bm8cy3e8.js";
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
2
  import { t } from "./react-sHtZdjeP.js";
3
3
  import { t as n } from "./react-dom-DUmH0GXv.js";
4
4
  import { c as r, l as i, u as a } from "./data-grid-types-0PJ-9N5n.js";
5
- import { a as o, i as s, n as c, r as l } from "./glide-data-editor-ZU7p01_F.js";
5
+ import { a as o, i as s, n as c, r as l } from "./glide-data-editor-yXRV-D0b.js";
6
6
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/data-grid-overlay-editor-style.js
7
7
  var u = /* @__PURE__ */ e(t(), 1), d = /* @__PURE__ */ e(n(), 1), f = /*#__PURE__*/ o("div")({
8
8
  name: "DataGridOverlayEditorStyle",
@@ -7,7 +7,7 @@ import { d as p, h as m, i as h, t as g } from "./tooltip-CKO1pHJo.js";
7
7
  import { a as _, c as v, i as y, o as b, r as x, s as S, t as C } from "./useLifecycle-Dum8WSXq.js";
8
8
  import { t as w } from "./check-P35dc2dH.js";
9
9
  import { C as T, S as ee, a as te, b as ne, c as re, i as ie, n as ae, o as oe, r as se, s as ce, t as le } from "./select-B0LRDH0g.js";
10
- import { C as ue, S as de, _ as fe, b as pe, g as me, h as E, o as he, t as ge, x as _e } from "./toDate-DKH0_kMo.js";
10
+ import { C as ue, S as de, _ as fe, b as pe, g as me, h as E, o as he, t as ge, x as _e } from "./toDate-DfkyXuPi.js";
11
11
  import { t as ve } from "./react-dom-DUmH0GXv.js";
12
12
  import { t as ye } from "./jsx-runtime-3BD1kT0s.js";
13
13
  import { C as be, Ct as xe, D as Se, F as D, L as O, M as Ce, S as we, St as Te, bt as Ee, j as De, wt as k, yt as Oe } from "./use-restore-focus-DBCITLeF.js";
@@ -3,14 +3,14 @@ import { h as t, t as n } from "./button-BxB3RDjN.js";
3
3
  import { t as r } from "./react-sHtZdjeP.js";
4
4
  import { t as i } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { t as a } from "./copy-icon-CPoxUG7G.js";
6
- import { Dt as o, G as s, It as c, K as l, Rt as u, V as d, dn as f, h as p, i as m, n as h } from "./error-entries-g9iQiVIT.js";
6
+ import { Dt as o, G as s, It as c, K as l, Rt as u, V as d, dn as f, h as p, i as m, n as h } from "./error-entries-BvD_zQ4j.js";
7
7
  import { b as g } from "./select-B0LRDH0g.js";
8
- import { n as ee, t as te } from "./globals-DtzxnBy4.js";
8
+ import { n as ee, t as te } from "./globals-DbERpwvN.js";
9
9
  import { t as _ } from "./jsx-runtime-3BD1kT0s.js";
10
10
  import { C as v, _ as ne, i as y } from "./useTheme-CfeaVw5D.js";
11
11
  import { a as re, i as ie, n as ae, r as oe } from "./dialog-C1PcpCqX.js";
12
12
  import { t as se } from "./useAsyncData-D0mLJstx.js";
13
- import { t as ce } from "./code-visibility-C-yL48xr.js";
13
+ import { t as ce } from "./code-visibility-DA9jRfM0.js";
14
14
  //#region src/components/ui/skeleton.tsx
15
15
  var b = /* @__PURE__ */ e(r(), 1), x = i(), S = _(), le = (e) => {
16
16
  let n = (0, x.c)(8), r, i;
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
2
  import { h as t, r as n } from "./button-BxB3RDjN.js";
3
3
  import { t as r } from "./react-sHtZdjeP.js";
4
4
  import { t as i } from "./compiler-runtime-CldRdSsv.js";
5
- import { t as a } from "./toDate-DKH0_kMo.js";
5
+ import { t as a } from "./toDate-DfkyXuPi.js";
6
6
  import { t as o } from "./jsx-runtime-3BD1kT0s.js";
7
7
  import { i as s } from "./loader-Bm8cy3e8.js";
8
8
  //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/isDate.js
@@ -6,7 +6,7 @@ import { i as s, n as c, r as l } from "./copy-icon-CPoxUG7G.js";
6
6
  import { C as u, c as d, i as f, n as p, s as m, t as h, x as g } from "./select-B0LRDH0g.js";
7
7
  import { d as _, h as v, i as y, l as b, n as x, o as S, s as C, t as w, u as T } from "./dropdown-menu-B_7xD2X4.js";
8
8
  import { c as E, d as D, l as O, n as k, o as A, s as ee, t as j, u as te } from "./glide-utils-Bt8_pBa2.js";
9
- import { n as ne, t as re } from "./ErrorBoundary-DhQ27xs2.js";
9
+ import { n as ne, t as re } from "./ErrorBoundary-CPEgy6hY.js";
10
10
  import { t as ie } from "./react-dom-DUmH0GXv.js";
11
11
  import { t as M } from "./jsx-runtime-3BD1kT0s.js";
12
12
  import { t as N } from "./label-BRnUC0NX.js";
@@ -7062,7 +7062,7 @@ function rs(e, t, n, r, i) {
7062
7062
  }
7063
7063
  //#endregion
7064
7064
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/data-editor/data-editor.js
7065
- var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-BJHCQqQ1.js")), ss = 0;
7065
+ var is = /* @__PURE__ */ e(_r(), 1), as = /* @__PURE__ */ e(xr(), 1), os = K.lazy(async () => await import("./data-grid-overlay-editor-C2qbg6YG.js")), ss = 0;
7066
7066
  function cs(e) {
7067
7067
  return (0, is.default)((0, as.default)((0, as.default)(e).filter((e) => e.span !== void 0).map((e) => (0, Za.default)((e.span?.[0] ?? 0) + 1, (e.span?.[1] ?? 0) + 1))));
7068
7068
  }
@@ -9293,7 +9293,7 @@ function Vs(e, t, n, r, i) {
9293
9293
  }
9294
9294
  //#endregion
9295
9295
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.0_27cffe7f1bc30287d59ac27db3240c5b/node_modules/@glideapps/glide-data-grid/dist/esm/cells/number-cell.js
9296
- var Hs = K.lazy(async () => await import("./number-overlay-editor-gFlLK8Ew.js")), Us = {
9296
+ var Hs = K.lazy(async () => await import("./number-overlay-editor-z12o1WAt.js")), Us = {
9297
9297
  getAccessibilityString: (e) => e.data?.toString() ?? "",
9298
9298
  kind: W.Number,
9299
9299
  needsHover: (e) => e.hoverEffect === !0,
@@ -1,6 +1,6 @@
1
1
  import { h as e } from "./tooltip-CKO1pHJo.js";
2
2
  import { _ as t } from "./useTheme-CfeaVw5D.js";
3
- import { r as n } from "./code-visibility-C-yL48xr.js";
3
+ import { r as n } from "./code-visibility-DA9jRfM0.js";
4
4
  var r = e("triangle-alert", [
5
5
  ["path", {
6
6
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
@@ -5,10 +5,10 @@ import { t as l } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { n as u, t as d } from "./copy-icon-CPoxUG7G.js";
6
6
  import { a as f, c as p, l as m, s as h, t as g } from "./chunk-YOKDWASO-DKplTrBY.js";
7
7
  import { c as _, h as v, l as y, s as b, t as x, u as ee } from "./tooltip-CKO1pHJo.js";
8
- import { A as te, Ct as ne, Et as re, H as ie, M as ae, P as oe, Pt as se, Qt as ce, St as le, Tt as ue, U as de, Y as fe, a as pe, bt as me, d as he, it as ge, pt as _e, tn as ve, tt as ye, xt as be, y as xe, yt as Se } from "./error-entries-g9iQiVIT.js";
8
+ import { A as te, Ct as ne, Et as re, H as ie, M as ae, P as oe, Pt as se, Qt as ce, St as le, Tt as ue, U as de, Y as fe, a as pe, bt as me, d as he, it as ge, pt as _e, tn as ve, tt as ye, xt as be, y as xe, yt as Se } from "./error-entries-BvD_zQ4j.js";
9
9
  import { M as Ce, O as we, k as Te } from "./select-B0LRDH0g.js";
10
10
  import { ft as Ee, q as De } from "./dropdown-menu-B_7xD2X4.js";
11
- import { m as Oe, y as ke } from "./toDate-DKH0_kMo.js";
11
+ import { m as Oe, y as ke } from "./toDate-DfkyXuPi.js";
12
12
  import { t as Ae } from "./jsx-runtime-3BD1kT0s.js";
13
13
  import { Ct as je, K as Me, Q as Ne, St as S, X as Pe, Y as Fe, bt as C, ct as Ie, dt as Le, ft as Re, ht as ze, lt as Be, pt as Ve, vt as He, wt as w, xt as Ue, yt as We } from "./use-restore-focus-DBCITLeF.js";
14
14
  import { A as Ge, C as T, E as Ke, _ as E, c as qe, n as Je } from "./useTheme-CfeaVw5D.js";
package/dist/main.js CHANGED
@@ -3,20 +3,20 @@ import { _ as a, c as o, g as s, h as c, i as l, l as u, m as d, n as f, o as p,
3
3
  import { t as v } from "./react-sHtZdjeP.js";
4
4
  import { t as y } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { i as b, n as x, r as S, t as C } from "./copy-icon-CPoxUG7G.js";
6
- import { C as w, F as T, G as E, I as D, J as O, K as k, L as A, P as j, R as M, X as N, Z as P, _ as F, a as I, b as L, g as R, i as z, j as B, k as ee, n as te, o as ne, q as re, v as ie, y as ae } from "./html-to-image-Bg5ZoSO-.js";
6
+ import { C as w, F as T, G as E, I as D, J as O, K as k, L as A, P as j, R as M, X as N, Z as P, _ as F, a as I, b as L, g as R, i as z, j as B, k as ee, n as te, o as ne, q as re, v as ie, y as ae } from "./html-to-image-DJ2kGp48.js";
7
7
  import { a as oe, d as se, f as ce, h as V, i as le, n as ue, o as de, r as fe, t as pe } from "./tooltip-CKO1pHJo.js";
8
- import { $t as me, At as he, B as ge, Bt as _e, D as ve, Dt as ye, E as be, Et as xe, Ft as Se, Gt as Ce, J as we, Jt as Te, Kt as Ee, M as De, Mt as Oe, N as ke, O as Ae, Ot as je, Q as Me, R as Ne, S as Pe, Ut as Fe, V as Ie, Vt as Le, W as Re, Y as ze, Yt as Be, Z as Ve, _ as He, b as Ue, bt as We, cn as Ge, dt as Ke, en as qe, f as Je, fn as Ye, ft as Xe, g as Ze, gn as Qe, gt as $e, h as et, hn as tt, ht as nt, in as rt, j as it, jt as at, k as ot, kt as st, ln as ct, m as lt, nn as ut, nt as dt, o as ft, p as pt, pn as mt, q as ht, qt as gt, rt as _t, s as vt, sn as yt, st as bt, tn as xt, u as St, un as Ct, ut as wt, v as Tt, wt as Et, y as Dt, z as Ot, zt as kt } from "./error-entries-g9iQiVIT.js";
8
+ import { $t as me, At as he, B as ge, Bt as _e, D as ve, Dt as ye, E as be, Et as xe, Ft as Se, Gt as Ce, J as we, Jt as Te, Kt as Ee, M as De, Mt as Oe, N as ke, O as Ae, Ot as je, Q as Me, R as Ne, S as Pe, Ut as Fe, V as Ie, Vt as Le, W as Re, Y as ze, Yt as Be, Z as Ve, _ as He, b as Ue, bt as We, cn as Ge, dt as Ke, en as qe, f as Je, fn as Ye, ft as Xe, g as Ze, gn as Qe, gt as $e, h as et, hn as tt, ht as nt, in as rt, j as it, jt as at, k as ot, kt as st, ln as ct, m as lt, nn as ut, nt as dt, o as ft, p as pt, pn as mt, q as ht, qt as gt, rt as _t, s as vt, sn as yt, st as bt, tn as xt, u as St, un as Ct, ut as wt, v as Tt, wt as Et, y as Dt, z as Ot, zt as kt } from "./error-entries-BvD_zQ4j.js";
9
9
  import { D as At, E as jt, O as Mt, S as Nt, T as Pt, _ as Ft, a as It, c as Lt, d as Rt, f as zt, g as Bt, h as Vt, i as Ht, l as Ut, m as Wt, n as Gt, o as Kt, p as qt, r as Jt, s as Yt, t as Xt, u as Zt, v as Qt, w as $t, x as en, y as tn } from "./spec-DTiOPKyk.js";
10
- import { $ as nn, $t as rn, A as an, At as on, B as sn, Bt as cn, C as ln, Ct as un, D as dn, Dt as fn, E as pn, Et as mn, F as hn, Ft as gn, G as _n, Gt as vn, H as yn, Ht as bn, I as xn, It as Sn, J as Cn, Jt as wn, K as Tn, Kt as En, L as Dn, Lt as On, M as kn, Mt as An, N as jn, Nt as Mn, O as Nn, Ot as Pn, P as Fn, Pt as In, Qt as Ln, R as Rn, Rt as zn, S as Bn, St as Vn, T as Hn, Tt as Un, U as Wn, Ut as Gn, V as Kn, Vt as qn, W as Jn, Wt as Yn, Xt as Xn, Y as Zn, Yt as Qn, Zt as $n, _ as er, _t as tr, at as nr, b as rr, c as ir, cn as ar, ct as or, d as sr, dn as cr, dt as lr, en as ur, et as dr, f as fr, fn as pr, ft as mr, g as hr, gt as gr, h as _r, ht as vr, in as yr, it as br, j as xr, jt as Sr, k as Cr, kt as wr, ln as Tr, lt as Er, m as Dr, mn as Or, mt as kr, nn as Ar, nt as jr, on as Mr, ot as Nr, p as Pr, pn as Fr, pt as Ir, q as Lr, qt as Rr, r as zr, rn as Br, rt as Vr, sn as Hr, st as Ur, t as Wr, tn as Gr, tt as Kr, u as qr, un as Jr, ut as Yr, v as Xr, vt as Zr, w as Qr, wt as $r, x as ei, xt as ti, y as ni, z as ri, zt as ii } from "./common-DDRe3efY.js";
10
+ import { $ as nn, $t as rn, A as an, At as on, B as sn, Bt as cn, C as ln, Ct as un, D as dn, Dt as fn, E as pn, Et as mn, F as hn, Ft as gn, G as _n, Gt as vn, H as yn, Ht as bn, I as xn, It as Sn, J as Cn, Jt as wn, K as Tn, Kt as En, L as Dn, Lt as On, M as kn, Mt as An, N as jn, Nt as Mn, O as Nn, Ot as Pn, P as Fn, Pt as In, Qt as Ln, R as Rn, Rt as zn, S as Bn, St as Vn, T as Hn, Tt as Un, U as Wn, Ut as Gn, V as Kn, Vt as qn, W as Jn, Wt as Yn, Xt as Xn, Y as Zn, Yt as Qn, Zt as $n, _ as er, _t as tr, at as nr, b as rr, c as ir, cn as ar, ct as or, d as sr, dn as cr, dt as lr, en as ur, et as dr, f as fr, fn as pr, ft as mr, g as hr, gt as gr, h as _r, ht as vr, in as yr, it as br, j as xr, jt as Sr, k as Cr, kt as wr, ln as Tr, lt as Er, m as Dr, mn as Or, mt as kr, nn as Ar, nt as jr, on as Mr, ot as Nr, p as Pr, pn as Fr, pt as Ir, q as Lr, qt as Rr, r as zr, rn as Br, rt as Vr, sn as Hr, st as Ur, t as Wr, tn as Gr, tt as Kr, u as qr, un as Jr, ut as Yr, v as Xr, vt as Zr, w as Qr, wt as $r, x as ei, xt as ti, y as ni, z as ri, zt as ii } from "./common-uGnMtkcz.js";
11
11
  import { c as ai, i as oi, n as si, o as ci, t as li } from "./useLifecycle-Dum8WSXq.js";
12
12
  import { t as ui } from "./check-P35dc2dH.js";
13
13
  import { A as di, C as fi, D as pi, E as mi, M as hi, O as gi, S as _i, T as vi, a as yi, b as bi, c as xi, i as Si, k as Ci, l as wi, n as Ti, o as Ei, r as Di, s as Oi, t as ki, w as Ai, x as ji } from "./select-B0LRDH0g.js";
14
14
  import { At as Mi, C as Ni, Dt as Pi, J as Fi, K as Ii, R as Li, S as Ri, U as zi, X as Bi, Y as Vi, _ as Hi, a as Ui, c as Wi, dt as Gi, et as Ki, f as qi, g as Ji, h as Yi, ht as Xi, i as Zi, m as Qi, n as $i, p as ea, q as ta, r as na, s as ra, t as ia, v as aa, vn as oa, x as sa, yn as ca, z as la } from "./dropdown-menu-B_7xD2X4.js";
15
- import { C as ua, _ as da, a as fa, b as pa, c as ma, f as ha, h as ga, m as _a, p as va, s as ya, u as ba, x as xa, y as Sa } from "./toDate-DKH0_kMo.js";
16
- import { a as Ca, c as wa, d as Ta, f as Ea, i as Da, l as Oa, n as ka, o as Aa, r as ja, s as Ma, t as Na } from "./process-output-BtVPCGeI.js";
15
+ import { C as ua, _ as da, a as fa, b as pa, c as ma, f as ha, h as ga, m as _a, p as va, s as ya, u as ba, x as xa, y as Sa } from "./toDate-DfkyXuPi.js";
16
+ import { a as Ca, c as wa, d as Ta, f as Ea, i as Da, l as Oa, n as ka, o as Aa, r as ja, s as Ma, t as Na } from "./process-output-BcFHHtnm.js";
17
17
  import { a as Pa, c as Fa, d as Ia, i as La, l as Ra, r as za, u as Ba } from "./glide-utils-Bt8_pBa2.js";
18
- import { n as Va, t as Ha } from "./ErrorBoundary-DhQ27xs2.js";
19
- import { n as Ua, t as Wa } from "./globals-DtzxnBy4.js";
18
+ import { n as Va, t as Ha } from "./ErrorBoundary-CPEgy6hY.js";
19
+ import { n as Ua, t as Wa } from "./globals-DbERpwvN.js";
20
20
  import { t as Ga } from "./react-dom-DUmH0GXv.js";
21
21
  import { t as Ka } from "./jsx-runtime-3BD1kT0s.js";
22
22
  import { B as qa, C as H, Ct as Ja, D as Ya, E as Xa, F as U, G as Za, H as Qa, I as $a, L as eo, M as W, N as to, O as no, P as ro, Q as io, R as ao, S as G, St as oo, Tt as so, U as co, W as lo, Y as uo, Z as fo, _ as po, _t as mo, a as ho, b as go, bt as _o, c as vo, d as yo, f as bo, g as xo, h as So, ht as Co, i as wo, j as K, k as To, l as Eo, m as Do, n as Oo, o as ko, p as Ao, r as jo, s as Mo, u as No, ut as Po, v as Fo, vt as Io, w as Lo, wt as Ro, x as zo, xt as Bo, y as Vo, yt as Ho } from "./use-restore-focus-DBCITLeF.js";
@@ -36,10 +36,10 @@ import { n as Os } from "./dist-CrSP_H1M.js";
36
36
  import { i as ks } from "./dist-BorMD-uX.js";
37
37
  import { n as As, t as js } from "./esm-AMFssoNp.js";
38
38
  import { t as Ms } from "./useAsyncData-D0mLJstx.js";
39
- import { i as Ns, n as Ps, r as Fs } from "./formats-V8ifA0Bk.js";
39
+ import { i as Ns, n as Ps, r as Fs } from "./formats-B3UNwK0S.js";
40
40
  import { D as Is, O as Ls } from "./vega-loader.browser-B9Pz0EGP.js";
41
41
  import { a as Rs, n as zs } from "./loader-Bm8cy3e8.js";
42
- import { c as Bs, d as Vs, i as Hs, l as Us, o as Ws, s as Gs, t as Ks, u as qs } from "./code-visibility-C-yL48xr.js";
42
+ import { c as Bs, d as Vs, i as Hs, l as Us, o as Ws, s as Gs, t as Ks, u as qs } from "./code-visibility-DA9jRfM0.js";
43
43
  import { t as Js } from "./useDeepCompareMemoize-BpPWi3G3.js";
44
44
  import { t as Ys } from "./esm-D2gTsXEV.js";
45
45
  //#region ../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
@@ -10112,7 +10112,7 @@ var LS = (e) => {
10112
10112
  output: t
10113
10113
  };
10114
10114
  } };
10115
- } }, US = J.lazy(() => import("./chat-ui-DA8zEZ1I.js").then((e) => ({ default: e.Chatbot }))), WS = G(W({
10115
+ } }, US = J.lazy(() => import("./chat-ui-k6_K3FK7.js").then((e) => ({ default: e.Chatbot }))), WS = G(W({
10116
10116
  id: U(),
10117
10117
  role: Fo([
10118
10118
  "system",
@@ -10578,7 +10578,7 @@ function VC(e, t) {
10578
10578
  }
10579
10579
  //#endregion
10580
10580
  //#region src/plugins/impl/DataEditorPlugin.tsx
10581
- var HC = J.lazy(() => import("./glide-data-editor-ZU7p01_F.js").then((e) => e.t)), UC = wS("marimo-data-editor", { cssStyles: [qS] }).withData(W({
10581
+ var HC = J.lazy(() => import("./glide-data-editor-yXRV-D0b.js").then((e) => e.t)), UC = wS("marimo-data-editor", { cssStyles: [qS] }).withData(W({
10582
10582
  initialValue: W({ edits: G(W({
10583
10583
  rowIdx: K(),
10584
10584
  columnId: U(),
@@ -22055,7 +22055,7 @@ function fM(e, t) {
22055
22055
  }
22056
22056
  //#endregion
22057
22057
  //#region src/plugins/impl/vega/VegaPlugin.tsx
22058
- var pM = J.lazy(() => import("./vega-component-DgytCKrL.js")), mM = class {
22058
+ var pM = J.lazy(() => import("./vega-component-0hWVSBRc.js")), mM = class {
22059
22059
  tagName = "marimo-vega";
22060
22060
  validator = W({
22061
22061
  spec: no({}).transform((e) => e),
@@ -30330,7 +30330,7 @@ function VR(e) {
30330
30330
  }
30331
30331
  //#endregion
30332
30332
  //#region src/components/editor/renderers/slides-layout/slides-layout.tsx
30333
- var HR = J.lazy(() => import("./reveal-component-C26V82jg.js")), UR = (e) => {
30333
+ var HR = J.lazy(() => import("./reveal-component-VBjBT6SL.js")), UR = (e) => {
30334
30334
  let t = (0, X.c)(33), { layout: n, setLayout: r, cells: i, mode: a } = e, o = ns(da), s = a === "read" || o, c = ns(He) > 1, [l, u] = (0, J.useState)(null), d;
30335
30335
  t[0] !== i || t[1] !== n ? (d = zP(i, n), t[0] = i, t[1] = n, t[2] = d) : d = t[2];
30336
30336
  let { slideCells: f, skippedIds: p, noOutputIds: m, slideTypes: h, startCellIndex: g } = d, _;
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
2
2
  import { t } from "./react-sHtZdjeP.js";
3
- import { a as n } from "./glide-data-editor-ZU7p01_F.js";
3
+ import { a as n } from "./glide-data-editor-yXRV-D0b.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.0_27cffe7f1bc30287d59ac27db3240c5b/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 { O as e } from "./html-to-image-Bg5ZoSO-.js";
1
+ import { O as e } from "./html-to-image-DJ2kGp48.js";
2
2
  import { h as t } from "./tooltip-CKO1pHJo.js";
3
- import { C as n, w as r } from "./error-entries-g9iQiVIT.js";
3
+ import { C as n, w as r } from "./error-entries-BvD_zQ4j.js";
4
4
  import { b as i } from "./select-B0LRDH0g.js";
5
5
  import { n as a } from "./semaphore-89jsoHtS.js";
6
6
  var o = t("file", [["path", {
@@ -3,15 +3,15 @@ import { c as t, g as n, h as r, m as i, t as a } from "./button-BxB3RDjN.js";
3
3
  import { t as o } from "./react-sHtZdjeP.js";
4
4
  import { t as s } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { h as c, t as l } from "./tooltip-CKO1pHJo.js";
6
- import { O as u } from "./error-entries-g9iQiVIT.js";
7
- import { Q as d, X as f, Z as p, an as m, cn as h, i as g, in as _, l as v, n as y, r as b, t as x, u as S } from "./common-DDRe3efY.js";
6
+ import { O as u } from "./error-entries-BvD_zQ4j.js";
7
+ import { Q as d, X as f, Z as p, an as m, cn as h, i as g, in as _, l as v, n as y, r as b, t as x, u as S } from "./common-uGnMtkcz.js";
8
8
  import { M as C } from "./select-B0LRDH0g.js";
9
9
  import { q as ee } from "./dropdown-menu-B_7xD2X4.js";
10
- import { _ as w } from "./toDate-DKH0_kMo.js";
10
+ import { _ as w } from "./toDate-DfkyXuPi.js";
11
11
  import { t as T } from "./jsx-runtime-3BD1kT0s.js";
12
12
  import { q as E } from "./use-restore-focus-DBCITLeF.js";
13
13
  import { A as D, C as O, b as k } from "./useTheme-CfeaVw5D.js";
14
- import { a as A, n as te, t as ne } from "./code-visibility-C-yL48xr.js";
14
+ import { a as A, n as te, t as ne } from "./code-visibility-DA9jRfM0.js";
15
15
  /* empty css */
16
16
  var j = c("sticky-note", [["path", {
17
17
  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",
@@ -576,6 +576,10 @@ var G = new Set(Object.values(s)), K = class {
576
576
  let t = this.getSessionURL("/sse", e);
577
577
  return t.searchParams.delete(s.accessToken), t;
578
578
  }
579
+ getNotebookURL(e) {
580
+ let t = this.formatHttpURL({ path: `/api/marimo/v1/notebooks/${encodeURIComponent(e)}` });
581
+ return t.searchParams.delete(s.accessToken), t;
582
+ }
579
583
  getWsSyncURL(e) {
580
584
  let t = this.getSessionURL("/ws_sync", e);
581
585
  return q(this.appendCrossOriginAuth(t).toString());
@@ -3,7 +3,7 @@ import { g as t, h as n, m as r, o as i } from "./button-BxB3RDjN.js";
3
3
  import { t as a } from "./react-sHtZdjeP.js";
4
4
  import { t as o } from "./compiler-runtime-CldRdSsv.js";
5
5
  import { t as s } from "./tooltip-CKO1pHJo.js";
6
- import { C as c, a as l } from "./toDate-DKH0_kMo.js";
6
+ import { C as c, a as l } from "./toDate-DfkyXuPi.js";
7
7
  import { t as u } from "./jsx-runtime-3BD1kT0s.js";
8
8
  import { n as d } from "./error-banner-Sl2FlSJ4.js";
9
9
  import { t as f } from "./debounce-C3jyATpc.js";
@@ -11,7 +11,7 @@ import { A as p, n as ee } from "./useTheme-CfeaVw5D.js";
11
11
  import { c as m, t as h } from "./arrays-R6JsImiT.js";
12
12
  import { t as te } from "./objects-DCmMvZtn.js";
13
13
  import { t as ne } from "./useAsyncData-D0mLJstx.js";
14
- import { a as g, i as re, n as ie, t as ae } from "./formats-V8ifA0Bk.js";
14
+ import { a as g, i as re, n as ie, t as ae } from "./formats-B3UNwK0S.js";
15
15
  import { D as oe, n as _ } from "./vega-loader.browser-B9Pz0EGP.js";
16
16
  import { t as se } from "./react-vega-C4T9Rb_w.js";
17
17
  import { a as ce, n as le } from "./loader-Bm8cy3e8.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev124",
3
+ "version": "0.25.3-dev127",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -6,8 +6,9 @@ import { createStore } from "jotai";
6
6
  import { afterEach, describe, expect, it, vi } from "vitest";
7
7
  import { Deferred } from "@/utils/Deferred";
8
8
  import { ConnectionState } from "../../websocket/types";
9
+ import type { NotebookBackend } from "../backend";
9
10
  import type { ConnectionStatus } from "../connection";
10
- import { createNotebookClient, type NotebookClient } from "../notebook-client";
11
+ import { createNotebookClient } from "../notebook-client";
11
12
  import { fixtureEvents, fixtureMessages } from "./fixtures";
12
13
 
13
14
  /** One connection the fake transport opened. */
@@ -22,7 +23,14 @@ interface Attempt {
22
23
  stop(status?: ConnectionStatus): void;
23
24
  }
24
25
 
25
- function setup(edit?: NotebookClient["edit"]) {
26
+ type Commands = ReturnType<NotebookBackend["notebook"]>;
27
+ /** A backend edit with the notebook it was sent to. */
28
+ type Edit = (
29
+ id: string,
30
+ ...args: Parameters<Commands["edit"]>
31
+ ) => ReturnType<Commands["edit"]>;
32
+
33
+ function setup(edit = vi.fn<Edit>()) {
26
34
  const attempts: Attempt[] = [];
27
35
  const transport: NotebookTransport = ({ cursor, signal }, handlers) =>
28
36
  new Promise((resolve, reject) => {
@@ -40,11 +48,15 @@ function setup(edit?: NotebookClient["edit"]) {
40
48
  const onNotification = vi.fn();
41
49
  const checkHealth = vi.fn(async () => true);
42
50
  const store = createStore();
43
- const controller = createNotebookClient(store, { edit });
51
+ const backend: NotebookBackend = {
52
+ transport,
53
+ notebook: (id) => ({ edit: (...args) => edit(id, ...args) }),
54
+ };
55
+ const controller = createNotebookClient(store);
44
56
  const client = controller.client;
45
57
  const connect = (signal: AbortSignal) =>
46
58
  controller.connect({
47
- transport,
59
+ backend,
48
60
  signal,
49
61
  checkHealth,
50
62
  onNotification: (notification) => onNotification({ data: notification }),
@@ -99,7 +111,7 @@ const notebook = {
99
111
 
100
112
  describe("NotebookClient lifetime", () => {
101
113
  it("keeps an edit's target and request identity across a stream reset", async () => {
102
- const edit = vi.fn<NotebookClient["edit"]>().mockResolvedValue({
114
+ const edit = vi.fn<Edit>().mockResolvedValue({
103
115
  ok: false,
104
116
  status: 409,
105
117
  problem: { type: "conflict", title: "conflict", status: 409 },
@@ -127,7 +139,7 @@ describe("NotebookClient lifetime", () => {
127
139
  expect(edit).toHaveBeenCalledTimes(2);
128
140
  });
129
141
 
130
- it("rejects aborted edits and reports a missing edit adapter", async () => {
142
+ it("rejects aborted edits and reports edits before connecting", async () => {
131
143
  const { client } = setup();
132
144
  const controller = lifetime();
133
145
  await expect(
@@ -129,7 +129,7 @@ describe("static notebook backend", () => {
129
129
 
130
130
  it("advertises no mutations and returns a protocol failure for direct edits", async () => {
131
131
  const backend = createStaticNotebookBackend(snapshot());
132
- expect(await backend.client.edit([])).toEqual({
132
+ expect(await backend.notebook(snapshot().notebook.id).edit([])).toEqual({
133
133
  ok: false,
134
134
  status: 501,
135
135
  problem: {
@@ -154,7 +154,9 @@ describe("static notebook backend", () => {
154
154
  expect(open).not.toHaveBeenCalled();
155
155
  expect(message).not.toHaveBeenCalled();
156
156
  await expect(
157
- backend.client.edit([], { signal: before.signal }),
157
+ backend
158
+ .notebook(snapshot().notebook.id)
159
+ .edit([], { signal: before.signal }),
158
160
  ).rejects.toBe(before.signal.reason);
159
161
  const during = new AbortController();
160
162
  message.mockImplementation(() => during.abort());
@@ -102,9 +102,9 @@ describe("WASM notebook backend", () => {
102
102
  it("sends edits as calls with the retry key and validates replies", async () => {
103
103
  const { bridge, reply } = worker();
104
104
  const backend = createWasmNotebookBackend(bridge);
105
- expect(await backend.client.edit([], { idempotencyKey: "edit-7" })).toEqual(
106
- reply,
107
- );
105
+ expect(
106
+ await backend.notebook("n1").edit([], { idempotencyKey: "edit-7" }),
107
+ ).toEqual(reply);
108
108
  expect(bridge.call).toHaveBeenCalledWith({
109
109
  operation: "notebook.edit",
110
110
  params: { notebook_id: "n1" },
@@ -117,13 +117,15 @@ describe("WASM notebook backend", () => {
117
117
  status: 403,
118
118
  };
119
119
  bridge.call.mockResolvedValue({ status: 403, body: problem });
120
- expect(await backend.client.edit([])).toEqual({
120
+ expect(await backend.notebook("n1").edit([])).toEqual({
121
121
  ok: false,
122
122
  status: 403,
123
123
  problem,
124
124
  });
125
125
  bridge.call.mockResolvedValue({ status: 200, body: {} });
126
- await expect(backend.client.edit([])).rejects.toThrow(/Invalid input/);
126
+ await expect(backend.notebook("n1").edit([])).rejects.toThrow(
127
+ /Invalid input/,
128
+ );
127
129
  });
128
130
 
129
131
  it("cancels waiting for an accepted edit and permits retry with the same key", async () => {
@@ -132,7 +134,7 @@ describe("WASM notebook backend", () => {
132
134
  bridge.call.mockReturnValue(pending.promise);
133
135
  const backend = createWasmNotebookBackend(bridge);
134
136
  const controller = new AbortController();
135
- const editing = backend.client.edit([], {
137
+ const editing = backend.notebook("n1").edit([], {
136
138
  signal: controller.signal,
137
139
  idempotencyKey: "edit-8",
138
140
  });
@@ -140,12 +142,12 @@ describe("WASM notebook backend", () => {
140
142
  controller.abort();
141
143
  await expect(editing).rejects.toBe(controller.signal.reason);
142
144
  pending.resolve(wire);
143
- expect(await backend.client.edit([], { idempotencyKey: "edit-8" })).toEqual(
144
- reply,
145
- );
145
+ expect(
146
+ await backend.notebook("n1").edit([], { idempotencyKey: "edit-8" }),
147
+ ).toEqual(reply);
146
148
  expect(bridge.call.mock.calls[0]).toEqual(bridge.call.mock.calls[1]);
147
149
  await expect(
148
- backend.client.edit([], { signal: controller.signal }),
150
+ backend.notebook("n1").edit([], { signal: controller.signal }),
149
151
  ).rejects.toBe(controller.signal.reason);
150
152
  expect(bridge.call).toHaveBeenCalledTimes(2);
151
153
  });
@@ -1,10 +1,15 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
3
  import type { NotebookClient, NotebookTransport } from "@marimo-team/client";
4
+ import type { NotebookId } from "@marimo-team/client/protocol";
4
5
 
5
- /** Events and commands for the same notebook, independent of React or a replica. */
6
+ /** Events and commands for a notebook, independent of React or a replica. */
6
7
  export interface NotebookBackend {
7
8
  readonly transport: NotebookTransport;
8
- /** Method presence is not permission; the notebook advertises its operations. */
9
- readonly client: Pick<NotebookClient, "edit">;
9
+ /**
10
+ * Commands for a notebook the transport reported.
11
+ *
12
+ * Method presence is not permission. The notebook advertises its operations.
13
+ */
14
+ notebook(id: NotebookId): Pick<NotebookClient, "edit">;
10
15
  }
@@ -5,7 +5,6 @@ import {
5
5
  createNotebookReducer,
6
6
  type NotebookEvent,
7
7
  NotebookEvents,
8
- type NotebookTransport,
9
8
  type Result,
10
9
  StreamStopped,
11
10
  } from "@marimo-team/client";
@@ -18,6 +17,7 @@ import type {
18
17
  } from "@marimo-team/client/protocol";
19
18
  import { type Atom, atom, type createStore } from "jotai/vanilla";
20
19
  import { z } from "zod";
20
+ import type { NotebookBackend } from "./backend";
21
21
  import {
22
22
  ConnectionClosedReason,
23
23
  ConnectionState,
@@ -60,10 +60,10 @@ export interface NotebookClient {
60
60
  reconnect(): Promise<void>;
61
61
  }
62
62
 
63
- /** The transport and application callbacks needed to follow a notebook. */
63
+ /** The backend and application callbacks needed to follow a notebook. */
64
64
  export interface NotebookConnection {
65
- /** Opens one connection to the notebook's stream. */
66
- transport: NotebookTransport;
65
+ /** Follows the notebook's stream and sends its commands. */
66
+ backend: NotebookBackend;
67
67
  /** Abort to close the stream and clear the client's state. */
68
68
  signal: AbortSignal;
69
69
  /** Check whether the host is reachable before an explicit reconnect. */
@@ -103,14 +103,8 @@ function statusAfter(error: unknown): ConnectionStatus {
103
103
  return disconnected;
104
104
  }
105
105
 
106
- /**
107
- * Create a client without opening a connection.
108
- * The session supplies edits authenticated for the same host as its stream.
109
- */
110
- export function createNotebookClient(
111
- store: ReturnType<typeof createStore>,
112
- { edit }: { edit?: NotebookClient["edit"] } = {},
113
- ) {
106
+ /** Create a client without opening a connection. */
107
+ export function createNotebookClient(store: ReturnType<typeof createStore>) {
114
108
  // `useNotebookSession` copies this into the editor's shared `connectionAtom`,
115
109
  // which gates features until MO-8051 derives availability separately.
116
110
  const connectionAtom = atom<ConnectionStatus>({
@@ -137,6 +131,7 @@ export function createNotebookClient(
137
131
  : attachments.initial,
138
132
  );
139
133
  let reconnect: (() => Promise<void>) | undefined;
134
+ let backend: NotebookBackend | undefined;
140
135
  const client: NotebookClient = {
141
136
  connectionAtom,
142
137
  notebookAtom,
@@ -147,7 +142,7 @@ export function createNotebookClient(
147
142
  if (currentId !== null && currentId !== notebookId) {
148
143
  throw new Error("The notebook changed before the edit was sent");
149
144
  }
150
- if (edit === undefined) {
145
+ if (backend === undefined) {
151
146
  return {
152
147
  ok: false,
153
148
  status: 501,
@@ -158,7 +153,7 @@ export function createNotebookClient(
158
153
  },
159
154
  };
160
155
  }
161
- return edit(notebookId, changes, options);
156
+ return backend.notebook(notebookId).edit(changes, options);
162
157
  },
163
158
  attachmentsAtom,
164
159
  reconnect: async () => reconnect?.(),
@@ -170,7 +165,7 @@ export function createNotebookClient(
170
165
  }
171
166
 
172
167
  function connect({
173
- transport,
168
+ backend: connected,
174
169
  signal,
175
170
  checkHealth,
176
171
  onNotification,
@@ -178,6 +173,8 @@ export function createNotebookClient(
178
173
  if (signal.aborted) {
179
174
  return;
180
175
  }
176
+ backend = connected;
177
+ const { transport } = connected;
181
178
  let events: NotebookEvents<(typeof TYPES)[number]> | undefined;
182
179
  let checkingHealth = false;
183
180
  // Whether the replica still holds the state the last cursor describes.
@@ -283,6 +280,9 @@ export function createNotebookClient(
283
280
  "abort",
284
281
  () => {
285
282
  reconnect = undefined;
283
+ if (backend === connected) {
284
+ backend = undefined;
285
+ }
286
286
  store.set(streamAtom, reducer.initial);
287
287
  setStatus({ state: ConnectionState.NOT_STARTED });
288
288
  },