@marimo-team/islands 0.25.3-dev4 → 0.25.3-dev6

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 (90) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CNSxdKyJ.js → ConnectedDataExplorerComponent-CNMliVzw.js} +1 -1
  2. package/dist/{ErrorBoundary-CuU5CuVr.js → ErrorBoundary-Ca-Sa492.js} +1 -1
  3. package/dist/{abnfDiagram-VCTEODGH-DQDjNXt3.js → abnfDiagram-VCTEODGH-D-Ez91gV.js} +2 -2
  4. package/dist/{any-language-editor-B9REGlD9.js → any-language-editor-DZ_YTVus.js} +1 -1
  5. package/dist/{architectureDiagram-5GKGNRK7-Nmls7Wxn.js → architectureDiagram-5GKGNRK7-CTpcNtO8.js} +1 -1
  6. package/dist/{chat-ui-BDpymeoe.js → chat-ui-0lKdOoQ3.js} +436 -437
  7. package/dist/{chunk-IMKFNOWR-CoIFEo-1.js → chunk-IMKFNOWR-DGxi-zeo.js} +1 -1
  8. package/dist/{chunk-SHT3W25Y-lHiGx3ZC.js → chunk-SHT3W25Y-CV9J3rAB.js} +1 -1
  9. package/dist/{chunk-SVP7TREG-BvsHIrY_.js → chunk-SVP7TREG-BL-9Fqgg.js} +1 -1
  10. package/dist/{chunk-TICWLB2K-BC8YIm_n.js → chunk-TICWLB2K-Cu_XMjDM.js} +1 -1
  11. package/dist/{classDiagram-ZZMXUADV-Bt98lkkv.js → classDiagram-ZZMXUADV-BXXV13Hq.js} +2 -2
  12. package/dist/{classDiagram-v2-VYDZK3BY-D9bfbcC3.js → classDiagram-v2-VYDZK3BY-B7FXJ1Cp.js} +2 -2
  13. package/dist/{code-visibility-Lu0dkrFO.js → code-visibility-NGRjhbtA.js} +14 -14
  14. package/dist/{common-DiWGWDIM.js → common-B7_ZSg0P.js} +6426 -6256
  15. package/dist/{cynefinDiagram-5FMLGOSQ-CgWra7wt.js → cynefinDiagram-5FMLGOSQ-CH96rwba.js} +1 -1
  16. package/dist/{dagre-GXQ25YYZ-CFZ8-35c.js → dagre-GXQ25YYZ-BD3PmpFY.js} +1 -1
  17. package/dist/{data-grid-overlay-editor-ga7ytgbj.js → data-grid-overlay-editor-B_cmrkBm.js} +1 -1
  18. package/dist/{diagram-S7CK7UJ4-lCNQrW7d.js → diagram-S7CK7UJ4-BsSJJldB.js} +1 -1
  19. package/dist/{diagram-UQ7AKVKN-CQPQ6pP_.js → diagram-UQ7AKVKN-muQtNZc4.js} +1 -1
  20. package/dist/{diagram-VX7I27RA-Cf3b0llz.js → diagram-VX7I27RA-CdhuZAqR.js} +1 -1
  21. package/dist/{diagram-Z3DM3KII-Bt4QLrpn.js → diagram-Z3DM3KII-BD8mXjOj.js} +1 -1
  22. package/dist/{ebnfDiagram-PWID7BFC-D3NAyPFY.js → ebnfDiagram-PWID7BFC-BIN1sweE.js} +2 -2
  23. package/dist/{erDiagram-RLTQ6QDP-Tlu09_Nm.js → erDiagram-RLTQ6QDP-Ctp5cfoN.js} +1 -1
  24. package/dist/{error-banner-Da600cwz.js → error-banner-D-WCIiMt.js} +10 -5
  25. package/dist/{cells-C8iCYvLU.js → error-entries-DSvFWT_M.js} +2262 -2206
  26. package/dist/{feedback-button-DQA-pzxi.js → feedback-button-CTF2Nj9s.js} +115 -116
  27. package/dist/{flowDiagram-HODETNUW-CAYbpJmV.js → flowDiagram-HODETNUW-3EfLrlFb.js} +2 -2
  28. package/dist/{formats-BGh2thRc.js → formats-CeOmU1MU.js} +1 -1
  29. package/dist/{glide-data-editor-Bv75MH6g.js → glide-data-editor-BQHF9puC.js} +3 -3
  30. package/dist/{globals-EDQGFIvi.js → globals-Cj8iqMEp.js} +1 -1
  31. package/dist/{html-to-image-CZY1pIZH.js → html-to-image-B8s5SgGm.js} +23 -23
  32. package/dist/{infoDiagram-27XIBGKW-XrDxhr0x.js → infoDiagram-27XIBGKW-DipQoHxl.js} +1 -1
  33. package/dist/{ishikawaDiagram-5VMMS53U-CD1muzov.js → ishikawaDiagram-5VMMS53U-DgFMjSGz.js} +1 -1
  34. package/dist/{kanban-definition-UXKFOSKX-Dg9W142_.js → kanban-definition-UXKFOSKX-w1ACVjgl.js} +1 -1
  35. package/dist/main.js +164 -163
  36. package/dist/{mermaid-CiAXjLpA.js → mermaid-CHo49Yv-.js} +33 -33
  37. package/dist/{mindmap-definition-YA3MSWOX-DgCidgYJ.js → mindmap-definition-YA3MSWOX-CrT0KSfX.js} +1 -1
  38. package/dist/{number-overlay-editor-BCP3MxhC.js → number-overlay-editor-DBcnm0SY.js} +1 -1
  39. package/dist/{pegDiagram-XKGWAZYB-coOYYKB6.js → pegDiagram-XKGWAZYB-BqvywNJA.js} +2 -2
  40. package/dist/{pieDiagram-E7YTZNPT-BnXTc3bj.js → pieDiagram-E7YTZNPT-BfxJ_XCc.js} +1 -1
  41. package/dist/{process-output-e4jj9Ijt.js → process-output-CKRXyszb.js} +3 -3
  42. package/dist/{railroadDiagram-O6MQD6OU-B28-u83n.js → railroadDiagram-O6MQD6OU-8vFLVTPu.js} +2 -2
  43. package/dist/{requirementDiagram-BXWQKSXE-CdYCTMu0.js → requirementDiagram-BXWQKSXE-a_MxGvxe.js} +1 -1
  44. package/dist/{reveal-component-DO5BJB9l.js → reveal-component-DTBSuGkC.js} +4 -4
  45. package/dist/{sequenceDiagram-WJ2MYXX4-CM3aRAe_.js → sequenceDiagram-WJ2MYXX4-CXFMnxGh.js} +1 -1
  46. package/dist/{stateDiagram-D77RDMKH-DOZUMVj8.js → stateDiagram-D77RDMKH-DQeA_CwI.js} +2 -2
  47. package/dist/{stateDiagram-v2-MP3YSRHH-CISYxma6.js → stateDiagram-v2-MP3YSRHH-BxxQucm1.js} +2 -2
  48. package/dist/style.css +1 -1
  49. package/dist/{swimlanes-42K2YHIH-BkSppxp8.js → swimlanes-42K2YHIH-Do6L-cYg.js} +1 -1
  50. package/dist/{swimlanesDiagram-VR7AAH4N-c8G5pGxC.js → swimlanesDiagram-VR7AAH4N-DUzPvSVU.js} +2 -2
  51. package/dist/{timeline-definition-24CTP7MA-CaMQayqK.js → timeline-definition-24CTP7MA-D3c46WM5.js} +1 -1
  52. package/dist/{toDate-BNJf01u1.js → toDate-vIXljnsr.js} +39 -38
  53. package/dist/{vega-component-DG29TAB7.js → vega-component-DTG6zxaY.js} +3 -3
  54. package/dist/{vennDiagram-4TSXK5OY-CF8pfaK3.js → vennDiagram-4TSXK5OY-BSZD8JcZ.js} +1 -1
  55. package/dist/{wardleyDiagram-VM6X3IG4-dGPu39d-.js → wardleyDiagram-VM6X3IG4-48cUWkfA.js} +1 -1
  56. package/dist/{xychartDiagram-S5SC5T6Z-CP6-9q56.js → xychartDiagram-S5SC5T6Z-CswYgYeu.js} +1 -1
  57. package/package.json +1 -1
  58. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  59. package/src/__tests__/mount.test.ts +8 -8
  60. package/src/components/editor/Output.tsx +9 -2
  61. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  62. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  63. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  64. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  65. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  66. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +372 -0
  67. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  68. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  69. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  70. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +548 -0
  71. package/src/components/editor/errors/send-error-report-button.tsx +69 -0
  72. package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
  73. package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
  74. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  75. package/src/components/editor/output/ansi-reduce.ts +6 -0
  76. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  77. package/src/core/attachments/state.ts +21 -0
  78. package/src/core/attachments/toast.ts +15 -0
  79. package/src/core/cells/__tests__/cells.test.ts +52 -0
  80. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  81. package/src/core/cells/__tests__/session.test.ts +50 -1
  82. package/src/core/cells/error-report.ts +63 -0
  83. package/src/core/cells/session.ts +28 -1
  84. package/src/core/config/pair.ts +5 -3
  85. package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
  86. package/src/core/islands/bootstrap.ts +1 -0
  87. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +193 -0
  88. package/src/core/websocket/useMarimoKernelConnection.tsx +9 -0
  89. package/src/mount.tsx +3 -3
  90. package/dist/error-entries-CzoYkIQZ.js +0 -56
@@ -3,6 +3,8 @@
3
3
  import { createStore } from "jotai";
4
4
  import { afterEach, describe, expect, it, vi } from "vitest";
5
5
  import { RuntimeState } from "@/core/kernel/RuntimeState";
6
+ import { attachmentsAtom } from "@/core/attachments/state";
7
+ import { Logger } from "@/utils/Logger";
6
8
  import { initializeIslands } from "../bootstrap";
7
9
  import type { IslandsPyodideBridge } from "../bridge";
8
10
  import { islandsHydratedAtom, islandsPendingInitialRunsAtom } from "../state";
@@ -48,6 +50,30 @@ describe("initializeIslands", () => {
48
50
  expect(store.get(islandsHydratedAtom)).toBe(false);
49
51
  store.set(islandsPendingInitialRunsAtom, new Set([1, 2]));
50
52
 
53
+ const errors = vi.spyOn(Logger, "error");
54
+ consumeMessage?.({
55
+ sessionGeneration: 1,
56
+ message: JSON.stringify({
57
+ op: "attachments",
58
+ data: {
59
+ op: "attachments",
60
+ attachments: [
61
+ {
62
+ id: "a1",
63
+ kind: "agent",
64
+ name: "Pi",
65
+ since: "2026-10-14T00:00:00Z",
66
+ notebook_id: "nb-test",
67
+ identity: "pi-thread",
68
+ },
69
+ ],
70
+ },
71
+ }) as IslandsKernelMessage["message"],
72
+ });
73
+ expect(errors).not.toHaveBeenCalled();
74
+ expect(store.get(attachmentsAtom)).toEqual([]);
75
+ expect(store.get(islandsPendingInitialRunsAtom)).toEqual(new Set([1, 2]));
76
+
51
77
  consumeMessage?.(completedRun(1));
52
78
  expect(store.get(islandsHydratedAtom)).toBe(false);
53
79
 
@@ -209,6 +209,7 @@ function handleMessage(
209
209
  case "cache-info":
210
210
  case "kernel-startup-error":
211
211
  case "notebook-document-transaction":
212
+ case "attachments":
212
213
  return;
213
214
 
214
215
  case "completed-run":
@@ -43,6 +43,11 @@ vi.mock("@/core/runtime/config", async () => {
43
43
  import { MockNotebook } from "@/__mocks__/notebook";
44
44
  import { cellId } from "@/__tests__/branded";
45
45
  import { alertAtom, getPackageAlert } from "@/core/alerts/state";
46
+ import {
47
+ type Attachment,
48
+ attachmentsAtom,
49
+ agentAttachmentsAtom,
50
+ } from "@/core/attachments/state";
46
51
  import { notebookAtom } from "@/core/cells/cells";
47
52
  import { AppConfigSchema } from "@/core/config/config-schema";
48
53
  import { ConnectionNotice } from "@/components/editor/alerts/connection-notice";
@@ -184,6 +189,46 @@ describe("useMarimoKernelConnection.reconnect()", () => {
184
189
  });
185
190
 
186
191
  describe("useMarimoKernelConnection messages", () => {
192
+ it("replaces attachment snapshots, including the last detach", () => {
193
+ const store = createStore();
194
+ vi.mocked(useConnectionTransport).mockReturnValue(
195
+ makeTransport(WebSocket.OPEN),
196
+ );
197
+ vi.mocked(useRuntimeManager).mockReturnValue(
198
+ makeRuntimeManager() as unknown as ReturnType<typeof useRuntimeManager>,
199
+ );
200
+ renderConnectionHook(store);
201
+ const options = vi.mocked(useConnectionTransport).mock.calls.at(-1)![0];
202
+ const agent: Attachment = {
203
+ id: "a1",
204
+ kind: "agent",
205
+ name: "Pi",
206
+ since: "2026-10-14T00:00:00Z",
207
+ notebook_id: "nb-test",
208
+ identity: "pi-thread",
209
+ };
210
+ const client: Attachment = {
211
+ id: "c1",
212
+ kind: "client",
213
+ name: null,
214
+ since: "2026-10-14T00:00:01Z",
215
+ notebook_id: "nb-test",
216
+ };
217
+ for (const attachments of [[agent, client], [client], []]) {
218
+ act(() =>
219
+ options.onMessage(
220
+ new MessageEvent("message", {
221
+ data: JSON.stringify({
222
+ op: "attachments",
223
+ data: { op: "attachments", attachments },
224
+ }),
225
+ }),
226
+ ),
227
+ );
228
+ expect(store.get(attachmentsAtom)).toEqual(attachments);
229
+ }
230
+ });
231
+
187
232
  it("records completion of the initial run", () => {
188
233
  const store = createStore();
189
234
  vi.mocked(useConnectionTransport).mockClear();
@@ -211,6 +256,101 @@ describe("useMarimoKernelConnection messages", () => {
211
256
  });
212
257
  });
213
258
 
259
+ describe("attachment snapshots across browser connections", () => {
260
+ const agent: Attachment = {
261
+ id: "a1",
262
+ kind: "agent",
263
+ name: "Pi",
264
+ since: "2026-10-14T00:00:00Z",
265
+ notebook_id: "nb-test",
266
+ identity: "pi-thread",
267
+ };
268
+
269
+ function connectedSession() {
270
+ const store = createStore();
271
+ store.set(connectionAtom, { state: ConnectionState.OPEN });
272
+ store.set(attachmentsAtom, [agent]);
273
+ const transport = makeTransport(WebSocket.OPEN);
274
+ vi.mocked(useConnectionTransport).mockReturnValue(transport);
275
+ vi.mocked(useRuntimeManager).mockReturnValue(
276
+ makeRuntimeManager() as unknown as ReturnType<typeof useRuntimeManager>,
277
+ );
278
+ renderConnectionHook(store);
279
+ const options = vi.mocked(useConnectionTransport).mock.calls.at(-1)![0];
280
+ const receive = (data: NotificationPayload["data"]) =>
281
+ act(() => {
282
+ options.onMessage(
283
+ new MessageEvent("message", {
284
+ data: JSON.stringify({ op: data.op, data }),
285
+ }),
286
+ );
287
+ });
288
+ return { store, transport, options, receive };
289
+ }
290
+
291
+ it.each([
292
+ "MARIMO_NO_FILE_KEY",
293
+ "MARIMO_NO_SESSION_ID",
294
+ "MARIMO_NO_SESSION",
295
+ "MARIMO_SHUTDOWN",
296
+ "MARIMO_KERNEL_STARTUP_ERROR",
297
+ "MARIMO_UNAUTHORIZED",
298
+ "MARIMO_KIOSK_NOT_ALLOWED",
299
+ "MARIMO_TRANSPORT_EXHAUSTED",
300
+ ])("clears cached attachments on %s", (reason) => {
301
+ const { store, transport, options } = connectedSession();
302
+ act(() => options.onClose(new CloseEvent("close", { reason })));
303
+ expect(store.get(attachmentsAtom)).toEqual([]);
304
+ expect(store.get(agentAttachmentsAtom)).toEqual([]);
305
+ expect(store.get(connectionAtom).state).toBe(ConnectionState.CLOSED);
306
+ expect(transport.reconnect).not.toHaveBeenCalled();
307
+ });
308
+
309
+ it("clears the snapshot on transport error", () => {
310
+ const { store, options } = connectedSession();
311
+ act(() => options.onError(new Event("error")));
312
+ expect(store.get(attachmentsAtom)).toEqual([]);
313
+ expect(store.get(agentAttachmentsAtom)).toEqual([]);
314
+ });
315
+
316
+ it("waits for a fresh snapshot after a transient reconnect", async () => {
317
+ const { store, transport, options, receive } = connectedSession();
318
+ act(() => options.onClose(new CloseEvent("close")));
319
+ expect(store.get(attachmentsAtom)).toEqual([]);
320
+ expect(store.get(connectionAtom).state).toBe(ConnectionState.CONNECTING);
321
+ expect(transport.reconnect).toHaveBeenCalledOnce();
322
+
323
+ await act(async () => options.onOpen(new Event("open")));
324
+ receive({ op: "reconnected" });
325
+ expect(store.get(connectionAtom).state).toBe(ConnectionState.OPEN);
326
+ expect(store.get(agentAttachmentsAtom)).toEqual([]);
327
+
328
+ const refreshed = { ...agent, id: "a2", name: "Codex" };
329
+ receive({ op: "attachments", attachments: [refreshed] });
330
+ expect(store.get(agentAttachmentsAtom)).toEqual([refreshed]);
331
+ receive({ op: "attachments", attachments: [] });
332
+ expect(store.get(agentAttachmentsAtom)).toEqual([]);
333
+ });
334
+
335
+ it("keeps a fresh snapshot hidden until the session is ready", async () => {
336
+ const { store, options, receive } = connectedSession();
337
+ act(() => options.onClose(new CloseEvent("close")));
338
+ await act(async () => options.onOpen(new Event("open")));
339
+ receive({ op: "attachments", attachments: [agent] });
340
+ expect(store.get(attachmentsAtom)).toEqual([agent]);
341
+ expect(store.get(agentAttachmentsAtom)).toEqual([]);
342
+ receive({ op: "reconnected" });
343
+ expect(store.get(agentAttachmentsAtom)).toEqual([agent]);
344
+ });
345
+
346
+ it("invalidates an old snapshot when a new transport opens", async () => {
347
+ const { store, options } = connectedSession();
348
+ await act(async () => options.onOpen(new Event("open")));
349
+ expect(store.get(attachmentsAtom)).toEqual([]);
350
+ expect(store.get(agentAttachmentsAtom)).toEqual([]);
351
+ });
352
+ });
353
+
214
354
  it.each(["kernel-ready", "reconnected"])(
215
355
  "waits for %s before marking the session connected",
216
356
  async (op) => {
@@ -261,6 +401,59 @@ it.each(["kernel-ready", "reconnected"])(
261
401
  },
262
402
  );
263
403
 
404
+ it.each([true, false])(
405
+ "keeps attachments only when kernel-ready resumes the session: %s",
406
+ (resumed) => {
407
+ const store = createStore();
408
+ const attachments: Attachment[] = [
409
+ {
410
+ id: "a1",
411
+ kind: "agent",
412
+ name: "Pi",
413
+ since: "2026-10-14T00:00:00Z",
414
+ notebook_id: "nb-test",
415
+ identity: "pi-thread",
416
+ },
417
+ ];
418
+ store.set(attachmentsAtom, attachments);
419
+ vi.mocked(useConnectionTransport).mockReturnValue(
420
+ makeTransport(WebSocket.OPEN),
421
+ );
422
+ vi.mocked(useRuntimeManager).mockReturnValue(
423
+ makeRuntimeManager() as unknown as ReturnType<typeof useRuntimeManager>,
424
+ );
425
+ renderConnectionHook(store);
426
+ const options = vi.mocked(useConnectionTransport).mock.calls.at(-1)![0];
427
+ act(() =>
428
+ options.onMessage(
429
+ new MessageEvent("message", {
430
+ data: JSON.stringify({
431
+ op: "kernel-ready",
432
+ data: {
433
+ op: "kernel-ready",
434
+ cell_ids: [],
435
+ codes: [],
436
+ names: [],
437
+ configs: [],
438
+ layout: null,
439
+ resumed,
440
+ ui_values: {},
441
+ last_executed_code: {},
442
+ last_execution_time: {},
443
+ app_config: { width: "normal" },
444
+ kiosk: false,
445
+ capabilities: { terminal: false },
446
+ auto_instantiated: true,
447
+ consumer_capabilities: { edit: true, interact: true },
448
+ },
449
+ }),
450
+ }),
451
+ ),
452
+ );
453
+ expect(store.get(attachmentsAtom)).toEqual(resumed ? attachments : []);
454
+ },
455
+ );
456
+
264
457
  describe("connection notice", () => {
265
458
  beforeEach(() => vi.useFakeTimers());
266
459
  afterEach(() => vi.useRealTimers());
@@ -5,6 +5,7 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai";
5
5
  import { useRef } from "react";
6
6
  import { useErrorBoundary } from "react-error-boundary";
7
7
  import { toast } from "@/components/ui/use-toast";
8
+ import { attachmentsAtom } from "@/core/attachments/state";
8
9
  import { getNotebook, useCellActions } from "@/core/cells/cells";
9
10
  import { applyTransactionChanges } from "@/core/cells/document-changes";
10
11
  import { AUTOCOMPLETER } from "@/core/codemirror/completion/Autocompleter";
@@ -236,6 +237,7 @@ export function useMarimoKernelConnection(opts: {
236
237
  } = useAlertActions();
237
238
  const setKioskMode = useSetAtom(kioskModeAtom);
238
239
  const setStableSessionId = useSetAtom(stableSessionIdAtom);
240
+ const setAttachments = useSetAtom(attachmentsAtom);
239
241
  const setCapabilities = useSetAtom(capabilitiesAtom);
240
242
  const runtimeManager = useRuntimeManager();
241
243
  const transportType = useAtomValue(connectionTransportTypeAtom);
@@ -252,6 +254,9 @@ export function useMarimoKernelConnection(opts: {
252
254
  case "reload":
253
255
  reloadSafe();
254
256
  return;
257
+ case "attachments":
258
+ setAttachments(msg.data.attachments);
259
+ return;
255
260
  case "startup-progress": {
256
261
  const { phase } = msg.data;
257
262
  updateStartupProgress(msg.data);
@@ -283,6 +288,7 @@ export function useMarimoKernelConnection(opts: {
283
288
  existingCells,
284
289
  });
285
290
  if (!msg.data.resumed) {
291
+ setAttachments([]);
286
292
  // A freshly started kernel may expose a different environment
287
293
  // (e.g. new env vars); re-run discovery instead of reusing stale
288
294
  // suggestions from the previous kernel instance.
@@ -561,6 +567,7 @@ export function useMarimoKernelConnection(opts: {
561
567
  */
562
568
  onOpen: async () => {
563
569
  updateStartupProgress(null);
570
+ setAttachments([]);
564
571
  // If we are open, we can reset our reconnecting flag.
565
572
  shouldTryReconnecting.current = true;
566
573
  },
@@ -603,6 +610,7 @@ export function useMarimoKernelConnection(opts: {
603
610
  */
604
611
  onClose: (e) => {
605
612
  Logger.warn("WebSocket closed", e.code, e.reason);
613
+ setAttachments([]);
606
614
  const decision = classifyCloseEvent(e);
607
615
  setConnection((previous) => {
608
616
  const status = decision.status;
@@ -641,6 +649,7 @@ export function useMarimoKernelConnection(opts: {
641
649
  */
642
650
  onError: (e) => {
643
651
  Logger.warn("WebSocket error", e);
652
+ setAttachments([]);
644
653
  setConnection({
645
654
  state: ConnectionState.CLOSED,
646
655
  code: WebSocketClosedReason.KERNEL_DISCONNECTED,
package/src/mount.tsx CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  userConfigAtom,
11
11
  } from "@/core/config/config";
12
12
  import { KnownQueryParams } from "@/core/constants";
13
- import { pairPreviewAtom, pairPreviewSchema } from "@/core/config/pair";
13
+ import { pairConfigAtom, pairConfigSchema } from "@/core/config/pair";
14
14
  import { getFilenameFromDOM } from "@/core/dom/htmlUtils";
15
15
  import { getMarimoCode } from "@/core/meta/globals";
16
16
  import {
@@ -209,7 +209,7 @@ const mountOptionsSchema = z.object({
209
209
  * marimo config overrides
210
210
  */
211
211
  configOverrides: passthroughObject,
212
- pairPreview: pairPreviewSchema.optional(),
212
+ pairConfig: pairConfigSchema.optional(),
213
213
  /**
214
214
  * marimo app config
215
215
  */
@@ -347,7 +347,7 @@ function initStore(options: unknown) {
347
347
  );
348
348
  store.set(userConfigAtom, parseUserConfig(parsedOptions.data.config));
349
349
  store.set(appConfigAtom, parseAppConfig(parsedOptions.data.appConfig));
350
- store.set(pairPreviewAtom, parsedOptions.data.pairPreview);
350
+ store.set(pairConfigAtom, parsedOptions.data.pairConfig);
351
351
 
352
352
  // Runtime config
353
353
  if (parsedOptions.data.runtimeConfig.length > 0) {
@@ -1,56 +0,0 @@
1
- import { At as e, N as t, b as n, d as r, jt as i, kt as a } from "./cells-C8iCYvLU.js";
2
- import { C as o } from "./select-BButFi-d.js";
3
- //#region src/core/errors/error-entries.ts
4
- function s(t) {
5
- if (e(t.mimetype)) {
6
- if (!Array.isArray(t.data)) return null;
7
- let e = t.data.filter((e) => !e.type.includes("ancestor"));
8
- return e.length === 0 ? null : { errorData: e };
9
- }
10
- return i(t.mimetype) ? typeof t.data != "string" || t.data.length === 0 ? null : {
11
- errorData: [],
12
- tracebackHtml: t.data
13
- } : null;
14
- }
15
- function c(e) {
16
- return e.some((e) => "traceback" in e && e.traceback);
17
- }
18
- function l(e) {
19
- let t = e?.find((e) => i(e.mimetype));
20
- if (!(!t || typeof t.data != "string" || t.data.length === 0)) return t.data;
21
- }
22
- function u(e, t) {
23
- if (e.tracebackHtml) return e.tracebackHtml;
24
- if (!c(e.errorData)) return l(t);
25
- }
26
- function d(e) {
27
- let { cellIds: n, cellRuntime: i, cellData: o } = e.get(r), c = [];
28
- for (let [e, r] of n.inOrderIds.entries()) {
29
- let n = i[r], l = n.output;
30
- if (!l || !a(l.mimetype)) continue;
31
- let d = s(l);
32
- if (!d) continue;
33
- let f = t(o[r].name, e), p = o[r].lastCodeRun ?? o[r].code;
34
- c.push({
35
- cellId: r,
36
- cellName: f,
37
- cellCode: p,
38
- errorData: d.errorData,
39
- tracebackHtml: u(d, n.consoleOutputs)
40
- });
41
- }
42
- return c;
43
- }
44
- function f(e) {
45
- return e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (o(e), "Unknown error");
46
- }
47
- function p(e) {
48
- let t = f(e);
49
- return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${n(e.traceback)}`), t;
50
- }
51
- function m(e) {
52
- let t = [e.cellName];
53
- return e.tracebackHtml && t.push(n(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(p).join("\n\n")), t.join("\n\n");
54
- }
55
- //#endregion
56
- export { d as i, m as n, p as r, f as t };