@marimo-team/islands 0.25.3-dev444 → 0.25.3-dev447

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 (34) hide show
  1. package/dist/{ErrorBoundary-1xXl5h61.js → ErrorBoundary-DVbdKroW.js} +1 -1
  2. package/dist/{chat-ui-2c_3M6FX.js → chat-ui-9oyUBL6M.js} +3 -3
  3. package/dist/{code-visibility-2c4wpMuR.js → code-visibility-DmsDqWUx.js} +2 -2
  4. package/dist/{common-Czkx_WbM.js → common-BDo_Jwoz.js} +3413 -3410
  5. package/dist/{data-grid-overlay-editor-C67Mma9k.js → data-grid-overlay-editor-CpHB_knU.js} +1 -1
  6. package/dist/{error-entries-CNB7O2yS.js → error-entries-CWdDf7iZ.js} +465 -432
  7. package/dist/{feedback-button-D6tbegap.js → feedback-button-B_Wmi4to.js} +3 -3
  8. package/dist/{glide-data-editor-rXojB-VV.js → glide-data-editor-CMiIW5WP.js} +3 -3
  9. package/dist/{globals-BK_sLO9Z.js → globals-DaC3pk9F.js} +1 -1
  10. package/dist/{html-to-image-B0UiwmMu.js → html-to-image-CexRSGAZ.js} +1 -1
  11. package/dist/main.js +6385 -6363
  12. package/dist/{number-overlay-editor-DVGZgzhW.js → number-overlay-editor-Dd4cOJ5I.js} +1 -1
  13. package/dist/{process-output-3Epq3rw6.js → process-output-hcyVRJCC.js} +2 -2
  14. package/dist/{reveal-component-CCSXKkl3.js → reveal-component-CTmvBdvu.js} +39 -39
  15. package/package.json +1 -1
  16. package/src/__mocks__/requests.ts +1 -0
  17. package/src/components/editor/alerts/stdin-blocking-alert.tsx +5 -0
  18. package/src/components/editor/output/console/ConsoleOutput.tsx +27 -1
  19. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +33 -0
  20. package/src/components/editor/stdin-blocking-alert.tsx +5 -0
  21. package/src/core/cells/cell.ts +3 -0
  22. package/src/core/cells/cells.ts +42 -3
  23. package/src/core/cells/types.ts +7 -0
  24. package/src/core/codemirror/cells/debugger-state.ts +5 -0
  25. package/src/core/errors/error-entries.ts +2 -1
  26. package/src/core/islands/bootstrap.ts +2 -0
  27. package/src/core/islands/bridge.ts +1 -0
  28. package/src/core/network/requests-network.ts +5 -0
  29. package/src/core/network/requests-static.ts +1 -0
  30. package/src/core/network/requests-toasting.tsx +1 -0
  31. package/src/core/network/types.ts +1 -0
  32. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +69 -1
  33. package/src/core/session/useNotebookSession.tsx +29 -2
  34. package/src/core/wasm/bridge.ts +2 -0
@@ -41,7 +41,10 @@ import { cellId } from "@/__tests__/branded";
41
41
  import { alertAtom, getPackageAlert } from "@/core/alerts/state";
42
42
  import { stagedAICellsAtom } from "@/core/ai/staged-cells";
43
43
  import { notebookAtom } from "@/core/cells/cells";
44
- import { breakpointsAtom } from "@/core/codemirror/cells/debugger-state";
44
+ import {
45
+ breakpointsAtom,
46
+ pendingPdbInputAtom,
47
+ } from "@/core/codemirror/cells/debugger-state";
45
48
  import { AppConfigSchema } from "@/core/config/config-schema";
46
49
  import { ConnectionNotice } from "@/components/editor/alerts/connection-notice";
47
50
  import { kernelStartupErrorAtom } from "@/core/errors/state";
@@ -488,6 +491,71 @@ it("tracks exported files from host execution values", async () => {
488
491
  expect(VirtualFileTracker.INSTANCE.filenames()).not.toContain(file);
489
492
  });
490
493
 
494
+ it("opens and closes the debugger prompt on the failed cell", async () => {
495
+ const store = createStore();
496
+ const fake = withTransport();
497
+ vi.mocked(useRuntimeManager).mockReturnValue(makeRuntimeManager());
498
+ renderConnectionHook(store);
499
+ await started();
500
+ const conn = connection(fake);
501
+ await act(async () => conn.open());
502
+ const id = cellId("failed");
503
+ act(() => conn.send({ op: "pdb-input", cell_id: id, input_id: "p1" }));
504
+ expect(store.get(pendingPdbInputAtom)).toEqual({ cellId: id, inputId: "p1" });
505
+ act(() => conn.receive({ event: "reset", data: {} }));
506
+ expect(store.get(pendingPdbInputAtom)).toBeNull();
507
+ act(() => conn.send({ op: "pdb-input", cell_id: id, input_id: "p2" }));
508
+ expect(store.get(pendingPdbInputAtom)?.inputId).toBe("p2");
509
+ act(() => conn.send({ op: "pdb-input", cell_id: id, input_id: null }));
510
+ expect(store.get(pendingPdbInputAtom)).toBeNull();
511
+ });
512
+
513
+ it("clears the debugger prompt and private transcript when editing moves to another tab", async () => {
514
+ const store = createStore();
515
+ const fake = withTransport();
516
+ vi.mocked(useRuntimeManager).mockReturnValue(makeRuntimeManager());
517
+ renderConnectionHook(store);
518
+ await started();
519
+ const conn = connection(fake);
520
+ const id = cellId("c1");
521
+ const entry = {
522
+ channel: "stdout",
523
+ mimetype: "text/plain",
524
+ data: "ordinary console",
525
+ timestamp: 1,
526
+ };
527
+ await act(async () => conn.open());
528
+ act(() => {
529
+ conn.ready();
530
+ conn.send({ op: "cell-op", cell_id: id, console: entry });
531
+ conn.send({
532
+ op: "pdb-output",
533
+ cell_id: id,
534
+ entries: [{ ...entry, data: "private debugger" }],
535
+ });
536
+ conn.send({ op: "pdb-input", cell_id: id, input_id: "pending" });
537
+ });
538
+ const runtime = () => store.get(notebookAtom).cellRuntime[id];
539
+ expect(runtime().pdbOutput?.map((row) => row.data)).toEqual([
540
+ "private debugger",
541
+ ]);
542
+ expect(store.get(pendingPdbInputAtom)?.inputId).toBe("pending");
543
+ act(() =>
544
+ conn.send({
545
+ op: "consumer-capabilities",
546
+ consumer_capabilities: { edit: false, interact: true },
547
+ }),
548
+ );
549
+ expect(runtime().pdbOutput).toBeUndefined();
550
+ expect(runtime().consoleOutputs.map((row) => row.data)).toEqual([
551
+ "ordinary console",
552
+ ]);
553
+ expect(
554
+ store.get(notebookAtom).cellLogs.map((log) => log.message),
555
+ ).not.toContain("private debugger");
556
+ expect(store.get(pendingPdbInputAtom)).toBeNull();
557
+ });
558
+
491
559
  it("replaces gutter breakpoints with the session's replayed state", async () => {
492
560
  const store = createStore();
493
561
  const staleCell = cellId("stale");
@@ -33,6 +33,7 @@ import { useRunsActions } from "../cells/runs";
33
33
  import { focusAndScrollCellOutputIntoView } from "../cells/scrollCellIntoView";
34
34
  import {
35
35
  breakpointsAtom,
36
+ pendingPdbInputAtom,
36
37
  setActiveLine,
37
38
  } from "../codemirror/cells/debugger-state";
38
39
  import { notebookCells } from "../cells/utils";
@@ -89,8 +90,13 @@ export function useNotebookSession(opts: { sessionId: SessionId }) {
89
90
  const { sessionId } = opts;
90
91
  const store = useStore();
91
92
 
92
- const { handleCellMessage, reconcileDocument, resetCellRuntimes } =
93
- useReducerActions();
93
+ const {
94
+ showPdbOutput,
95
+ clearDebuggerOutput,
96
+ handleCellMessage,
97
+ reconcileDocument,
98
+ resetCellRuntimes,
99
+ } = useReducerActions();
94
100
  const { reconcileStagedCells } = useStagedAICellsActions();
95
101
  const { addCellNotification } = useRunsActions();
96
102
  const setInitialRunCompleted = useSetAtom(initialRunCompletedAtom);
@@ -159,6 +165,19 @@ export function useNotebookSession(opts: { sessionId: SessionId }) {
159
165
  null,
160
166
  );
161
167
  setActiveLine(null);
168
+ store.set(pendingPdbInputAtom, null);
169
+ return;
170
+ }
171
+
172
+ case "pdb-output":
173
+ showPdbOutput(msg.data);
174
+ return;
175
+ case "pdb-input": {
176
+ const { cell_id, input_id } = msg.data;
177
+ store.set(
178
+ pendingPdbInputAtom,
179
+ input_id === null ? null : { cellId: cell_id, inputId: input_id },
180
+ );
162
181
  return;
163
182
  }
164
183
 
@@ -371,6 +390,10 @@ export function useNotebookSession(opts: { sessionId: SessionId }) {
371
390
  return;
372
391
  case "consumer-capabilities":
373
392
  setKioskMode(!msg.data.consumer_capabilities.edit);
393
+ if (!msg.data.consumer_capabilities.edit) {
394
+ store.set(pendingPdbInputAtom, null);
395
+ clearDebuggerOutput();
396
+ }
374
397
  return;
375
398
  default:
376
399
  logNever(msg.data);
@@ -493,6 +516,10 @@ export function useNotebookSession(opts: { sessionId: SessionId }) {
493
516
  const unsubscribes = [
494
517
  store.sub(replica.connectionAtom, updateConnection),
495
518
  store.sub(readyAtom, updateConnection),
519
+ // Same-session reconnects replay only the prompt that is still pending.
520
+ store.sub(replica.generationAtom, () =>
521
+ store.set(pendingPdbInputAtom, null),
522
+ ),
496
523
  ];
497
524
  updateConnection();
498
525
  return () => unsubscribes.forEach((unsubscribe) => unsubscribe());
@@ -378,6 +378,8 @@ export class PyodideBridge implements RunRequests, EditRequests {
378
378
  throwNotImplemented();
379
379
  };
380
380
 
381
+ public sendPdbReply = throwNotImplemented;
382
+
381
383
  public sendPdb: EditRequests["sendPdb"] = async () => {
382
384
  throwNotImplemented();
383
385
  };