@marimo-team/islands 0.26.1-dev8 → 0.26.1-dev84
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.
- package/dist/{ConnectedDataExplorerComponent-DtwVgVpX.js → ConnectedDataExplorerComponent-CO9uVewH.js} +15 -15
- package/dist/{ErrorBoundary-DgwX53fT.js → ErrorBoundary-T8CwNebX.js} +7 -7
- package/dist/{abnfDiagram-VCTEODGH-BbZOIueZ.js → abnfDiagram-VCTEODGH-Ba0MYVW8.js} +2 -2
- package/dist/{any-language-editor-yG-YmLaK.js → any-language-editor-BNe8do3C.js} +5 -5
- package/dist/{architectureDiagram-5GKGNRK7-qjLjxapm.js → architectureDiagram-5GKGNRK7-7MqAehef.js} +1 -1
- package/dist/{assertNever-DywGMo-S.js → assertNever-5vhHGKOK.js} +14 -14
- package/dist/{button-qQhINE7z.js → button-Z2R2272J.js} +34 -31
- package/dist/{capabilities-DKqMqBzm.js → capabilities-ba3Dyv8n.js} +1 -1
- package/dist/{chat-ui-D5YPIONI.js → chat-ui-CjZbdpzb.js} +117 -117
- package/dist/{check-jchHMCfs.js → check-DUIc04aK.js} +1 -1
- package/dist/{chunk-IMKFNOWR-BzDY1_I7.js → chunk-IMKFNOWR-CAWA0HGB.js} +1 -1
- package/dist/{chunk-SHT3W25Y-DbHsMKdo.js → chunk-SHT3W25Y-BIwVQjG5.js} +1 -1
- package/dist/{chunk-SVP7TREG-CtwnwAE6.js → chunk-SVP7TREG-Cux251TB.js} +1 -1
- package/dist/{chunk-TICWLB2K-C5Z5QMbO.js → chunk-TICWLB2K-DJVQ6khO.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-B8E5Hn78.js → classDiagram-ZZMXUADV-Cwve77ev.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-DeGsK9bT.js → classDiagram-v2-VYDZK3BY-BAeHKXmD.js} +2 -2
- package/dist/{code-visibility-BRw-I8KK.js → code-visibility-BBgRhs2A.js} +17 -17
- package/dist/{common-CsAoQn5h.js → common-BF30ifb8.js} +6102 -6047
- package/dist/{config-qTaTHnpE.js → config-CShkLThS.js} +43 -42
- package/dist/{copy-icon-BI7vZHEW.js → copy-icon-CmNLxT5_.js} +3 -3
- package/dist/{createReducer-DdSLRfBT.js → createReducer-BUQhgLOI.js} +6 -6
- package/dist/{cynefinDiagram-5FMLGOSQ-NDedRwsw.js → cynefinDiagram-5FMLGOSQ-t4eEkPJh.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-De0sSZO7.js → dagre-GXQ25YYZ-IuZuI28B.js} +1 -1
- package/dist/{data-grid-overlay-editor-DeWsTtac.js → data-grid-overlay-editor-ChntsIBb.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-wBtVl61y.js → diagram-S7CK7UJ4-D8R5Q_ok.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-CKWE3c1T.js → diagram-UQ7AKVKN-BGuMPsr-.js} +1 -1
- package/dist/{diagram-VX7I27RA-D2Ac5198.js → diagram-VX7I27RA-BkTtpO8P.js} +1 -1
- package/dist/{diagram-Z3DM3KII-CYaFOQcI.js → diagram-Z3DM3KII-C0__Mxfm.js} +1 -1
- package/dist/{dialog-Ic6dh09m.js → dialog-BvjfalZ9.js} +28 -28
- package/dist/{dist-BvZpdAuG.js → dist-6B1_Ttbh.js} +1 -1
- package/dist/{dist-D1D56-GS.js → dist-B28poF32.js} +2 -2
- package/dist/{dist-BozTF_gH.js → dist-BBZ7lnMw.js} +2 -2
- package/dist/{dist-BfrgytDR.js → dist-BD8ZKF5t.js} +3 -3
- package/dist/{dist-DNkrY12t.js → dist-BG-7Qpaj.js} +3 -3
- package/dist/{dist-D92tYjLc.js → dist-BIaGGUbU.js} +13 -11
- package/dist/{dist-BagHbFqG.js → dist-BR5PU2Ph.js} +3 -3
- package/dist/{dist-DpYpG8Yc.js → dist-BidYR5m4.js} +3 -3
- package/dist/{dist-D95Cd4xm.js → dist-BkGYCvFX.js} +3 -3
- package/dist/{dist-DneeBk3K.js → dist-BmEyXT7K.js} +2 -2
- package/dist/{dist-BdUitvVW.js → dist-Bt0Wt6m9.js} +2 -2
- package/dist/{dist-CEomphG1.js → dist-CG2Sl0D4.js} +2 -2
- package/dist/{dist-BMz__bo5.js → dist-CQfpgadU.js} +3 -3
- package/dist/{dist-BreKIQqQ.js → dist-CVOPvfzN.js} +3 -3
- package/dist/{dist-BEcpQbZa.js → dist-Cm0iCeQQ.js} +3 -3
- package/dist/{dist-CDVvitRS.js → dist-Cnc14jEq.js} +2 -2
- package/dist/{dist-ChcBm3jk.js → dist-D3KPC38e.js} +4 -4
- package/dist/{dist-B1qu3Bez.js → dist-D7BXk27E.js} +3 -3
- package/dist/{dist-BsE4gQHj.js → dist-D9Qhvxvg.js} +1 -1
- package/dist/{dist-OmeAz0fR.js → dist-DJKajXDB.js} +3 -3
- package/dist/{dist-ObeTgSmf.js → dist-DYbNRTYG.js} +4 -4
- package/dist/{dist-Cshl6jBw.js → dist-DhtDWnzK.js} +2 -2
- package/dist/{dist-BunZKA_9.js → dist-_x2Jks2R.js} +2 -2
- package/dist/{dist-MggMo7OR.js → dist-m0MWV-aw.js} +1 -1
- package/dist/{dist-TGSwzj8a.js → dist-pPbYNVjd.js} +4 -4
- package/dist/{dropdown-menu-Dhv4fcNl.js → dropdown-menu-D0DeN-aL.js} +2108 -2108
- package/dist/{ebnfDiagram-PWID7BFC-Ds7f42dj.js → ebnfDiagram-PWID7BFC-CSESPZoz.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-b58Sz2Mc.js → erDiagram-RLTQ6QDP-DsDTtabH.js} +1 -1
- package/dist/{error-banner-CJVLr5_a.js → error-banner-CXLjTW24.js} +75 -80
- package/dist/{error-entries-BKlEsuk4.js → error-entries-CsXAdy1j.js} +1032 -867
- package/dist/{esm-B9n0caHs.js → esm-DY8dGAjJ.js} +23 -23
- package/dist/{esm-Bwp_FHP0.js → esm-Dw2ZydG_.js} +3 -3
- package/dist/{feedback-button-DBJ87u8R.js → feedback-button-nmOvfn22.js} +123 -123
- package/dist/{flowDiagram-HODETNUW-BH9U7VZK.js → flowDiagram-HODETNUW-qxDPYbfV.js} +2 -2
- package/dist/{formats-BLNFWWhV.js → formats-BRDSQgKN.js} +3 -3
- package/dist/{glide-data-editor-CQQvTuRa.js → glide-data-editor-SkR9hqZZ.js} +43 -43
- package/dist/{glide-utils-Ze_7l_91.js → glide-utils-CD8BaFTm.js} +3 -3
- package/dist/{globals-KyhCA8uY.js → globals-BjiU5aEs.js} +3 -3
- package/dist/{html-to-image-CNM0ZSFD.js → html-to-image-CwpapHNl.js} +24212 -24090
- package/dist/{infoDiagram-27XIBGKW-xbjwrcNi.js → infoDiagram-27XIBGKW-B5hq8RM_.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-DKtukhGS.js → ishikawaDiagram-5VMMS53U-DkHc_9ET.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-BEhlkZBb.js → kanban-definition-UXKFOSKX-CqkTFXmU.js} +1 -1
- package/dist/{loader-Bin_dutt.js → loader-qPmiRXZd.js} +1 -1
- package/dist/main.js +8865 -8747
- package/dist/{mermaid-D1CZDNoB.js → mermaid-pmVHDUQA.js} +35 -35
- package/dist/{mindmap-definition-YA3MSWOX-DQcnJPcV.js → mindmap-definition-YA3MSWOX-D6cNa__z.js} +1 -1
- package/dist/{number-overlay-editor-Bul3xvgs.js → number-overlay-editor-GjrMTG9X.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-BFQuPYfI.js → pegDiagram-XKGWAZYB-CmWJX_s1.js} +2 -2
- package/dist/{pencil-DVYzq-iR.js → pencil-CxMgOe04.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-l7aqNrem.js → pieDiagram-E7YTZNPT-CAQAxHah.js} +1 -1
- package/dist/{process-output-DthYR2Te.js → process-output-ztSj9cDn.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-6R3C1lwQ.js → railroadDiagram-O6MQD6OU-jlSsiQg3.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-DdWYu8fn.js → requirementDiagram-BXWQKSXE-DkDjfPhn.js} +1 -1
- package/dist/{reveal-component-CYrENlgq.js → reveal-component-BrZbx6s7.js} +1017 -1017
- package/dist/{select-CDUxhHZg.js → select-CEnB18uc.js} +364 -364
- package/dist/{sequenceDiagram-WJ2MYXX4-Dzp0dgRc.js → sequenceDiagram-WJ2MYXX4-DLywsGCW.js} +1 -1
- package/dist/{spec-ZAt4P01J.js → spec-Dz-Avv1m.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-BGnTUhFJ.js → stateDiagram-D77RDMKH-DUmlKwYU.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-DsJbmDf1.js → stateDiagram-v2-MP3YSRHH-D646KiXs.js} +2 -2
- package/dist/{static-state-C4bAlKTU.js → static-state-DhVFm8Z6.js} +4 -4
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-Bd4Bzh9r.js → swimlanes-42K2YHIH-L7B1GphF.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-BlY12Jf6.js → swimlanesDiagram-VR7AAH4N-DEu2wxtC.js} +2 -2
- package/dist/{swiper-component-DTdNB9wg.js → swiper-component-B2O8hF7b.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-m0LanyCH.js → timeline-definition-24CTP7MA-DDPyx1yG.js} +1 -1
- package/dist/{toast-U3NpO2x3.js → toast-BTjH6fIf.js} +197 -197
- package/dist/{tooltip-UzJukb3F.js → tooltip-DyLdBIM4.js} +81 -81
- package/dist/{use-restore-focus-DaTVz6S6.js → use-restore-focus-DJ_-uSn_.js} +2006 -1997
- package/dist/{useDateFormatter-LQNtoXyh.js → useDateFormatter-HpKD0jEC.js} +2 -2
- package/dist/{useDeepCompareMemoize-CmNbQ9TT.js → useDeepCompareMemoize-CHx-NxMl.js} +1 -1
- package/dist/{useIframeCapabilities-HTZiVlGV.js → useIframeCapabilities-_0KX0nu_.js} +1 -1
- package/dist/{useLifecycle-DTMczKkf.js → useLifecycle-tPpAt-OE.js} +2 -2
- package/dist/{vega-component-ZTdbCcwI.js → vega-component-BxJFcD2G.js} +19 -19
- package/dist/{vennDiagram-4TSXK5OY-BJ7vqDmn.js → vennDiagram-4TSXK5OY-CRwWeb7g.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-D5kWacsn.js → wardleyDiagram-VM6X3IG4-DVlG9eoq.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-gr15Ws_z.js → xychartDiagram-S5SC5T6Z-CM32AISp.js} +1 -1
- package/package.json +3 -3
- package/src/__mocks__/animation-frames.ts +31 -0
- package/src/__mocks__/executions.ts +51 -23
- package/src/__mocks__/intersection-observer.ts +45 -0
- package/src/__mocks__/notebook.ts +1 -1
- package/src/__tests__/branded.ts +4 -0
- package/src/__tests__/notebook-analysis.ts +48 -0
- package/src/__tests__/render-tracker.ts +15 -0
- package/src/__tests__/setup.ts +3 -0
- package/src/components/app-config/__tests__/add-model-discovery.test.tsx +30 -0
- package/src/components/app-config/ai-config.tsx +5 -3
- package/src/components/app-config/user-config-form.tsx +1 -1
- package/src/components/data-table/__tests__/export-actions.test.tsx +79 -0
- package/src/components/data-table/export-actions.tsx +64 -19
- package/src/components/data-table/schemas.ts +1 -0
- package/src/components/databases/engine-variable.tsx +2 -2
- package/src/components/dependency-graph/panels.tsx +2 -2
- package/src/components/editor/__tests__/cell-renders.test.tsx +116 -0
- package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +1 -1
- package/src/components/editor/actions/useCellActionButton.tsx +2 -8
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +28 -61
- package/src/components/editor/cell/CreateCellButton.tsx +69 -40
- package/src/components/editor/cell/__tests__/CreateCellButton.test.tsx +49 -0
- package/src/components/editor/cell/__tests__/cell-context-menu.test.tsx +126 -0
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +5 -5
- package/src/components/editor/cell/cell-context-menu.tsx +202 -111
- package/src/components/editor/cell/code/__tests__/code-placeholder.test.tsx +40 -0
- package/src/components/editor/cell/code/cell-editor.tsx +49 -108
- package/src/components/editor/cell/code/code-placeholder.css +61 -11
- package/src/components/editor/cell/code/code-placeholder.tsx +52 -27
- package/src/components/editor/cell/collapse.tsx +6 -3
- package/src/components/editor/cell/useSplitCell.tsx +2 -2
- package/src/components/editor/chrome/panels/__tests__/secrets-panel.test.tsx +57 -0
- package/src/components/editor/chrome/panels/secrets-panel.tsx +36 -9
- package/src/components/editor/chrome/panels/secrets-utils.ts +20 -0
- package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +5 -2
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +6 -10
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +240 -93
- package/src/components/editor/errors/auto-fix.tsx +8 -7
- package/src/components/editor/errors/send-error-report-button.tsx +139 -41
- package/src/components/editor/header/status.tsx +5 -2
- package/src/components/editor/navigation/__tests__/navigation.test.ts +3 -16
- package/src/components/editor/navigation/focus-utils.ts +20 -8
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +3 -11
- package/src/components/editor/navigation/navigation.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +15 -24
- package/src/components/editor/output/MarimoTracebackOutput.tsx +2 -2
- package/src/components/editor/output/console/ConsoleOutput.tsx +77 -50
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +28 -0
- package/src/components/editor/renderers/cells-renderer.tsx +3 -2
- package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +6 -9
- package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +2 -5
- package/src/components/find-replace/find-replace.tsx +3 -7
- package/src/components/icons/__tests__/large-spinner.test.tsx +5 -4
- package/src/components/scratchpad/scratchpad.tsx +2 -2
- package/src/components/tracing/tracing-keyboard.test.tsx +4 -3
- package/src/components/ui/__tests__/button-shortcut.test.tsx +22 -0
- package/src/components/ui/__tests__/fullscreen.test.tsx +83 -1
- package/src/components/ui/button.tsx +5 -1
- package/src/components/ui/fullscreen.tsx +43 -89
- package/src/components/variables/__tests__/variables-table.test.tsx +1 -2
- package/src/core/MarimoApp.tsx +1 -1
- package/src/core/__tests__/MarimoApp.test.tsx +147 -0
- package/src/core/ai/__tests__/staged-cells.test.ts +6 -39
- package/src/core/ai/context/providers/__tests__/error.test.ts +6 -3
- package/src/core/ai/staged-cells.ts +8 -35
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +15 -13
- package/src/core/ai/tools/edit-notebook-tool.ts +13 -8
- package/src/core/cells/__tests__/actions.test.ts +2 -2
- package/src/core/cells/__tests__/add-missing-import.test.ts +14 -9
- package/src/core/cells/__tests__/arrange.test.ts +1 -1
- package/src/core/cells/__tests__/cell-editor-view.test.ts +44 -0
- package/src/core/cells/__tests__/cells.test.ts +0 -1
- package/src/core/cells/__tests__/focus.test.ts +1 -7
- package/src/core/cells/__tests__/harness.ts +9 -8
- package/src/core/cells/__tests__/layout.test.ts +1 -1
- package/src/core/cells/__tests__/pending-delete-service.test.tsx +121 -11
- package/src/core/cells/__tests__/runs.test.ts +14 -14
- package/src/core/cells/__tests__/utils.test.ts +3 -2
- package/src/core/cells/actions.ts +6 -6
- package/src/core/cells/add-missing-import.ts +2 -3
- package/src/core/cells/cells.ts +40 -27
- package/src/core/cells/document.ts +1 -2
- package/src/core/cells/execution-console.ts +10 -5
- package/src/core/cells/focus.ts +1 -1
- package/src/core/cells/ids.ts +2 -4
- package/src/core/cells/pending-delete-service.ts +97 -85
- package/src/core/cells/runs.ts +7 -5
- package/src/core/cells/scrollCellIntoView.ts +4 -14
- package/src/core/cells/session.ts +8 -5
- package/src/core/cells/utils.ts +0 -13
- package/src/core/codemirror/__tests__/cell-documents.test.ts +79 -0
- package/src/core/codemirror/__tests__/debounced-editor-update.test.ts +72 -0
- package/src/core/codemirror/__tests__/editor-mount-scheduler.test.ts +75 -105
- package/src/core/codemirror/__tests__/format.test.ts +85 -63
- package/src/core/codemirror/__tests__/setup.test.ts +61 -1
- package/src/core/codemirror/__tests__/use-lazy-editor-mount.test.tsx +198 -0
- package/src/core/codemirror/cell-documents.ts +132 -0
- package/src/core/codemirror/cells/debugger-decorations.ts +22 -18
- package/src/core/codemirror/cells/line-timing-decorations.ts +13 -11
- package/src/core/codemirror/cells/traceback-decorations.ts +10 -11
- package/src/core/codemirror/code-lens/__tests__/entities.test.ts +7 -11
- package/src/core/codemirror/code-lens/__tests__/extension.test.ts +38 -12
- package/src/core/codemirror/code-lens/__tests__/perf.test.ts +7 -9
- package/src/core/codemirror/code-lens/extension.ts +21 -13
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +9 -14
- package/src/core/codemirror/copilot/getCodes.ts +3 -14
- package/src/core/codemirror/debounced-editor-update.ts +41 -0
- package/src/core/codemirror/editor-mount-scheduler.ts +41 -48
- package/src/core/codemirror/extensions.ts +2 -2
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +42 -16
- package/src/core/codemirror/find-replace/__tests__/search-highlight.test.ts +30 -0
- package/src/core/codemirror/find-replace/__tests__/unmounted-cells.test.ts +145 -0
- package/src/core/codemirror/find-replace/navigate.ts +88 -129
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/find-replace/state.ts +7 -2
- package/src/core/codemirror/format.ts +25 -31
- package/src/core/codemirror/go-to-definition/__tests__/underline.test.ts +58 -0
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +24 -44
- package/src/core/codemirror/go-to-definition/extension.ts +9 -7
- package/src/core/codemirror/go-to-definition/underline.ts +39 -48
- package/src/core/codemirror/language/__tests__/sql.test.ts +36 -0
- package/src/core/codemirror/language/cell-code.ts +7 -0
- package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +2 -18
- package/src/core/codemirror/language/languages/sql/sql.ts +3 -0
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +25 -0
- package/src/core/codemirror/lsp/notebook-lsp.ts +6 -16
- package/src/core/codemirror/placeholder/extensions.ts +26 -24
- package/src/core/codemirror/reactive-references/__tests__/extension.test.ts +54 -0
- package/src/core/codemirror/reactive-references/extension.ts +30 -21
- package/src/core/codemirror/use-lazy-editor-mount.ts +70 -0
- package/src/core/codemirror/utils.ts +2 -6
- package/src/core/datasets/__tests__/data-source.test.ts +15 -17
- package/src/core/datasets/data-source-connections.ts +8 -11
- package/src/core/datasets/state.ts +7 -12
- package/src/core/dom/__tests__/uiregistry.test.ts +27 -0
- package/src/core/dom/uiregistry.ts +9 -7
- package/src/core/executions/__tests__/atoms.test.ts +211 -5
- package/src/core/executions/__tests__/freshness.test.ts +65 -56
- package/src/core/executions/__tests__/interrupt.test.ts +5 -3
- package/src/core/executions/__tests__/output-lifecycle.test.ts +95 -7
- package/src/core/executions/__tests__/output.test.ts +5 -3
- package/src/core/executions/__tests__/run.test.ts +4 -4
- package/src/core/executions/__tests__/select.test.ts +108 -69
- package/src/core/executions/atoms.ts +248 -83
- package/src/core/executions/freshness.ts +7 -7
- package/src/core/executions/hooks.ts +15 -59
- package/src/core/executions/index.ts +2 -0
- package/src/core/executions/output.ts +49 -35
- package/src/core/executions/select.ts +90 -37
- package/src/core/export/__tests__/hooks.test.ts +1 -1
- package/src/core/islands/__tests__/bridge.test.ts +1 -1
- package/src/core/islands/bootstrap.ts +7 -7
- package/src/core/islands/bridge.ts +1 -1
- package/src/core/meta/__tests__/code-visibility.test.tsx +3 -2
- package/src/core/notebook/document/__tests__/codemirror.test.ts +8 -6
- package/src/core/notebook/document/__tests__/draft.test.ts +56 -58
- package/src/core/notebook/document/__tests__/fixtures.ts +8 -7
- package/src/core/notebook/document/__tests__/hooks.test.tsx +39 -35
- package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +8 -5
- package/src/core/notebook/document/__tests__/model.test.ts +8 -5
- package/src/core/notebook/document/__tests__/protocol-fixtures.ts +2 -2
- package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +37 -32
- package/src/core/notebook/document/__tests__/scenarios.test.ts +49 -45
- package/src/core/notebook/document/__tests__/state.test.ts +59 -56
- package/src/core/notebook/document/__tests__/submission.test.ts +15 -12
- package/src/core/notebook/document/__tests__/test-host.ts +3 -2
- package/src/core/notebook/document/__tests__/user.ts +7 -3
- package/src/core/notebook/document/draft.ts +29 -11
- package/src/core/notebook/document/state.ts +7 -6
- package/src/core/notebook/replica/__tests__/document.test.ts +9 -5
- package/src/core/notebook/replica/__tests__/executions.test.ts +90 -25
- package/src/core/notebook/replica/__tests__/fixtures.ts +7 -2
- package/src/core/notebook/replica/__tests__/frame.test.ts +206 -0
- package/src/core/notebook/replica/__tests__/once-per-frame.test.ts +95 -0
- package/src/core/notebook/replica/__tests__/replica.test.ts +53 -9
- package/src/core/notebook/replica/__tests__/results.test.ts +27 -29
- package/src/core/notebook/replica/backend.ts +4 -1
- package/src/core/notebook/replica/execution-state.ts +2 -2
- package/src/core/notebook/replica/frame.ts +54 -0
- package/src/core/notebook/replica/index.ts +1 -0
- package/src/core/notebook/replica/once-per-frame.ts +60 -0
- package/src/core/notebook/replica/replica.ts +27 -6
- package/src/core/notebook/replica/resources/analysis.ts +1 -1
- package/src/core/notebook/replica/resources/document.ts +9 -8
- package/src/core/notebook/replica/resources/executions.ts +197 -78
- package/src/core/notebook/replica/resources/results.ts +8 -14
- package/src/core/saving/__tests__/document.test.tsx +1 -1
- package/src/core/saving/__tests__/state.test.ts +2 -2
- package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +55 -9
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +230 -12
- package/src/core/session/active-notebook.ts +10 -1
- package/src/core/session/useNotebookReplica.ts +15 -2
- package/src/core/session/useNotebookSession.tsx +38 -46
- package/src/core/state/__tests__/atom-with-selected-inputs.test.ts +48 -0
- package/src/core/state/__tests__/create-keyed-selector-hook.test.tsx +137 -0
- package/src/core/state/atom-with-selected-inputs.ts +24 -0
- package/src/core/state/create-keyed-atom-hook.ts +18 -0
- package/src/core/state/create-keyed-selector-hook.ts +22 -0
- package/src/core/storage/__tests__/state.test.ts +6 -9
- package/src/core/storage/state.ts +5 -8
- package/src/core/transports/__tests__/static.test.ts +24 -20
- package/src/core/transports/static.ts +3 -2
- package/src/core/variables/state.ts +73 -68
- package/src/core/variables/types.ts +2 -2
- package/src/core/vscode/__tests__/is-in-vscode.test.ts +36 -0
- package/src/core/vscode/is-in-vscode.ts +2 -2
- package/src/core/wasm/__tests__/bridge.test.ts +73 -1
- package/src/core/wasm/bridge.ts +5 -4
- package/src/plugins/impl/TextInputPlugin.tsx +2 -1
- package/src/plugins/impl/__test__/text-labels.test.tsx +46 -1
- package/src/utils/__tests__/lazy.test.tsx +33 -0
- package/src/utils/__tests__/shared-intersection-observer.test.ts +49 -0
- package/src/utils/__tests__/shared-resource.test.ts +107 -0
- package/src/utils/arrays.ts +4 -1
- package/src/utils/lazy.tsx +74 -0
- package/src/utils/shared-intersection-observer.ts +53 -0
- package/src/utils/shared-resource.ts +59 -0
- package/src/core/variables/__tests__/state.test.ts +0 -148
- package/src/utils/lazy.ts +0 -35
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@testing-library/react";
|
|
11
11
|
import { atom, createStore, Provider } from "jotai";
|
|
12
12
|
import type React from "react";
|
|
13
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
13
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
14
14
|
import { MockExecutions } from "@/__mocks__/executions";
|
|
15
15
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
16
16
|
import { cellId } from "@/__tests__/branded";
|
|
@@ -33,38 +33,21 @@ import {
|
|
|
33
33
|
withCells,
|
|
34
34
|
} from "@/core/notebook/document/__tests__/fixtures";
|
|
35
35
|
import type { MarimoError } from "@/core/kernel/messages";
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
stableSessionIdAtom,
|
|
39
|
-
} from "@/core/kernel/session";
|
|
40
|
-
import { API } from "@/core/network/api";
|
|
41
|
-
import { connectionAtom } from "@/core/network/connection";
|
|
42
|
-
import { ConnectionState } from "@/core/session/types";
|
|
36
|
+
import { activeNotebookReplicaAtom } from "@/core/session/active-notebook";
|
|
37
|
+
import { createEditorBackend } from "@/core/session/backend";
|
|
43
38
|
import { Deferred } from "@/utils/Deferred";
|
|
44
|
-
import { HTTPError } from "@/utils/errors";
|
|
45
39
|
import { MarimoErrorOutput } from "../../output/MarimoErrorOutput";
|
|
46
40
|
import { MarimoTracebackOutput } from "../../output/MarimoTracebackOutput";
|
|
47
41
|
import { OutputRenderer } from "../../Output";
|
|
48
42
|
import { SendErrorReportButton } from "../send-error-report-button";
|
|
49
43
|
|
|
50
44
|
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
|
|
51
|
-
vi.mock("@/core/network/api", () => ({ API: { post: vi.fn() } }));
|
|
52
45
|
vi.mock("@/components/editor/chrome/wrapper/useOpenAiAssistant", () => ({
|
|
53
46
|
useOpenAiAssistant: () => vi.fn(),
|
|
54
47
|
}));
|
|
55
48
|
|
|
56
49
|
const CELL_ID = cellId("test-cell");
|
|
57
|
-
const
|
|
58
|
-
// Hoisted with the module mock below, which reads it as modules load.
|
|
59
|
-
const { attachmentsAtom } = await vi.hoisted(async () => {
|
|
60
|
-
const { atom } = await import("jotai");
|
|
61
|
-
return { attachmentsAtom: atom<Attachment[]>([]) };
|
|
62
|
-
});
|
|
63
|
-
vi.mock("@/core/session/active-notebook", async (importOriginal) => ({
|
|
64
|
-
...(await importOriginal<typeof import("@/core/session/active-notebook")>()),
|
|
65
|
-
// Writable, so the execution mock can give the replica results.
|
|
66
|
-
activeNotebookReplicaAtom: atom({ attachmentsAtom }),
|
|
67
|
-
}));
|
|
50
|
+
const attachmentsAtom = atom<Attachment[]>([]);
|
|
68
51
|
|
|
69
52
|
const AGENT: Attachment = {
|
|
70
53
|
id: "a1",
|
|
@@ -74,7 +57,15 @@ const AGENT: Attachment = {
|
|
|
74
57
|
notebook_id: "nb-test",
|
|
75
58
|
identity: "pi-thread",
|
|
76
59
|
};
|
|
77
|
-
const
|
|
60
|
+
const OTHER_AGENT: Attachment = {
|
|
61
|
+
...AGENT,
|
|
62
|
+
id: "a2",
|
|
63
|
+
identity: "claude-thread",
|
|
64
|
+
name: "Claude Code",
|
|
65
|
+
};
|
|
66
|
+
const NOTEBOOK_URL = "http://localhost/prefix/api/marimo/v1/notebooks/nb-test";
|
|
67
|
+
const fetch =
|
|
68
|
+
vi.fn<(url: RequestInfo | URL, init?: RequestInit) => Promise<Response>>();
|
|
78
69
|
const MESSAGE = "df is not defined";
|
|
79
70
|
const CODE = "df.head()";
|
|
80
71
|
const REPORT: CellOutputMessage<ErrorMessageOutput> = {
|
|
@@ -100,35 +91,85 @@ const ERRORS: MarimoError[] = [
|
|
|
100
91
|
function renderButton({
|
|
101
92
|
preview = true,
|
|
102
93
|
attachments = [AGENT],
|
|
103
|
-
|
|
94
|
+
canEmit = true,
|
|
104
95
|
content = <SendErrorReportButton getContent={() => REPORT} />,
|
|
105
96
|
}: {
|
|
106
97
|
preview?: boolean;
|
|
107
98
|
attachments?: Attachment[];
|
|
108
|
-
|
|
99
|
+
canEmit?: boolean;
|
|
109
100
|
content?: React.ReactNode;
|
|
110
101
|
} = {}) {
|
|
111
102
|
const store = createStore();
|
|
112
|
-
store.set(connectionAtom, { state: ConnectionState.OPEN });
|
|
113
103
|
store.set(pairConfigAtom, { ...PAIR_CONFIG, hostEnabled: preview });
|
|
114
104
|
store.set(attachmentsAtom, attachments);
|
|
115
|
-
|
|
105
|
+
const backend = createEditorBackend({
|
|
106
|
+
static: false,
|
|
107
|
+
snapshot: null,
|
|
108
|
+
transportType: "websocket",
|
|
109
|
+
url: () => "ws://localhost/ws",
|
|
110
|
+
headers: () => ({ "Marimo-Server-Token": "test-token" }),
|
|
111
|
+
notebookUrl: (id) => new URL(id, new URL(".", NOTEBOOK_URL)),
|
|
112
|
+
waitUntilReady: async () => undefined,
|
|
113
|
+
checkHealth: async () => true,
|
|
114
|
+
});
|
|
115
|
+
const seed = (...args: Parameters<typeof MockExecutions.seed>) => {
|
|
116
|
+
const replica = MockExecutions.seed(...args);
|
|
117
|
+
store.set(replica.backendAtom, backend);
|
|
118
|
+
store.set(replica.notebookAtom, {
|
|
119
|
+
...MockExecutions.notebook("nb-test"),
|
|
120
|
+
operations: canEmit ? ["notebook.emit"] : [],
|
|
121
|
+
});
|
|
122
|
+
store.set(activeNotebookReplicaAtom, { ...replica, attachmentsAtom });
|
|
123
|
+
return replica;
|
|
124
|
+
};
|
|
125
|
+
seed(store, []);
|
|
116
126
|
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
117
127
|
<Provider store={store}>
|
|
118
128
|
<TooltipProvider>{children}</TooltipProvider>
|
|
119
129
|
</Provider>
|
|
120
130
|
);
|
|
121
|
-
return { store, ...render(content, { wrapper }) };
|
|
131
|
+
return { store, seed, ...render(content, { wrapper }) };
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
function send() {
|
|
125
135
|
fireEvent.click(screen.getByRole("button", { name: "Send error to agent" }));
|
|
126
136
|
}
|
|
127
137
|
|
|
138
|
+
function openRecipients() {
|
|
139
|
+
fireEvent.keyDown(
|
|
140
|
+
screen.getByRole("button", { name: "Send error to agent" }),
|
|
141
|
+
{
|
|
142
|
+
key: "Enter",
|
|
143
|
+
},
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function lastRequest() {
|
|
148
|
+
const [url, init] = await waitFor(() => {
|
|
149
|
+
expect(fetch).toHaveBeenCalled();
|
|
150
|
+
return fetch.mock.lastCall!;
|
|
151
|
+
});
|
|
152
|
+
return new Request(url, init);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function sentEvent() {
|
|
156
|
+
return (await lastRequest()).json();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function errorEvent(message: unknown, to: string | null = AGENT.identity) {
|
|
160
|
+
return {
|
|
161
|
+
type: "marimo.agents.message.v1",
|
|
162
|
+
data: { message, to, sender: "marimo error report" },
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
128
166
|
describe("SendErrorReportButton", () => {
|
|
129
167
|
beforeEach(() => {
|
|
130
168
|
vi.clearAllMocks();
|
|
131
|
-
vi.
|
|
169
|
+
vi.stubGlobal("fetch", fetch);
|
|
170
|
+
fetch
|
|
171
|
+
.mockReset()
|
|
172
|
+
.mockImplementation(async () => new Response(null, { status: 204 }));
|
|
132
173
|
vi.mocked(toast).mockReturnValue({
|
|
133
174
|
id: "notice",
|
|
134
175
|
dismiss: vi.fn(),
|
|
@@ -136,6 +177,7 @@ describe("SendErrorReportButton", () => {
|
|
|
136
177
|
upsert: vi.fn(),
|
|
137
178
|
});
|
|
138
179
|
});
|
|
180
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
139
181
|
|
|
140
182
|
it("hides when host is disabled without building content", () => {
|
|
141
183
|
const getContent = vi.fn(() => REPORT);
|
|
@@ -150,76 +192,180 @@ describe("SendErrorReportButton", () => {
|
|
|
150
192
|
|
|
151
193
|
it.each([
|
|
152
194
|
{ attachments: [] },
|
|
153
|
-
{ attachments: [{ ...AGENT, kind: "client"
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
195
|
+
{ attachments: [{ ...AGENT, kind: "client" }] },
|
|
196
|
+
{
|
|
197
|
+
attachments: [
|
|
198
|
+
{ ...AGENT, identity: null },
|
|
199
|
+
{ ...AGENT, id: "a2", identity: "" },
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
{ canEmit: false },
|
|
203
|
+
])("hides without a recipient or emit capability: %j", (options) => {
|
|
204
|
+
const getContent = vi.fn(() => REPORT);
|
|
205
|
+
renderButton({
|
|
206
|
+
...options,
|
|
207
|
+
content: <SendErrorReportButton getContent={getContent} />,
|
|
208
|
+
});
|
|
209
|
+
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
|
210
|
+
expect(getContent).not.toHaveBeenCalled();
|
|
211
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
160
212
|
});
|
|
161
213
|
|
|
162
|
-
it("
|
|
214
|
+
it("publishes to the selected identity after removing duplicate and anonymous attachments", async () => {
|
|
163
215
|
const getContent = vi.fn(() => REPORT);
|
|
164
216
|
renderButton({
|
|
165
|
-
attachments: [
|
|
217
|
+
attachments: [
|
|
218
|
+
AGENT,
|
|
219
|
+
{ ...AGENT, id: "anon", identity: null },
|
|
220
|
+
OTHER_AGENT,
|
|
221
|
+
{ ...AGENT, id: "duplicate", name: "Later Pi" },
|
|
222
|
+
],
|
|
166
223
|
content: <SendErrorReportButton getContent={getContent} />,
|
|
167
224
|
});
|
|
225
|
+
openRecipients();
|
|
226
|
+
expect(
|
|
227
|
+
screen.getAllByRole("menuitem").map((item) => item.textContent),
|
|
228
|
+
).toEqual(["Pi", "Claude Code", "Send to all agents"]);
|
|
168
229
|
expect(getContent).not.toHaveBeenCalled();
|
|
169
|
-
|
|
230
|
+
fireEvent.click(screen.getByRole("menuitem", { name: "Claude Code" }));
|
|
231
|
+
const request = await lastRequest();
|
|
232
|
+
expect(request.url).toBe(`${NOTEBOOK_URL}/emit`);
|
|
233
|
+
expect(request.method).toBe("POST");
|
|
234
|
+
expect(request.headers.get("Marimo-Server-Token")).toBe("test-token");
|
|
235
|
+
expect(request.headers.get("Idempotency-Key")).toMatch(/^[\da-f-]{36}$/);
|
|
236
|
+
expect(await request.json()).toEqual(
|
|
237
|
+
errorEvent(REPORT, OTHER_AGENT.identity),
|
|
238
|
+
);
|
|
170
239
|
await waitFor(() =>
|
|
171
240
|
expect(toast).toHaveBeenCalledWith({
|
|
172
|
-
title: "Sent
|
|
241
|
+
title: "Sent",
|
|
173
242
|
duration: 3000,
|
|
174
243
|
}),
|
|
175
244
|
);
|
|
176
|
-
expect(
|
|
245
|
+
expect(fetch).toHaveBeenCalledOnce();
|
|
177
246
|
expect(getContent).toHaveBeenCalledOnce();
|
|
178
247
|
});
|
|
179
248
|
|
|
249
|
+
it("distinguishes agents whose names and ID suffixes match", async () => {
|
|
250
|
+
renderButton({
|
|
251
|
+
attachments: [
|
|
252
|
+
{ ...AGENT, name: "Lens", identity: "lens-a-thread" },
|
|
253
|
+
{ ...OTHER_AGENT, name: "Lens", identity: "lens-b-thread" },
|
|
254
|
+
],
|
|
255
|
+
});
|
|
256
|
+
openRecipients();
|
|
257
|
+
expect(
|
|
258
|
+
screen.getByRole("menuitem", { name: "Lens (lens-a-thread)" }),
|
|
259
|
+
).toBeVisible();
|
|
260
|
+
fireEvent.click(
|
|
261
|
+
screen.getByRole("menuitem", { name: "Lens (lens-b-thread)" }),
|
|
262
|
+
);
|
|
263
|
+
expect(await sentEvent()).toEqual(errorEvent(REPORT, "lens-b-thread"));
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it("publishes a broadcast with a null recipient", async () => {
|
|
267
|
+
renderButton({ attachments: [AGENT, OTHER_AGENT] });
|
|
268
|
+
openRecipients();
|
|
269
|
+
fireEvent.click(
|
|
270
|
+
screen.getByRole("menuitem", { name: "Send to all agents" }),
|
|
271
|
+
);
|
|
272
|
+
expect(await sentEvent()).toEqual(errorEvent(REPORT, null));
|
|
273
|
+
});
|
|
274
|
+
|
|
180
275
|
it("prevents duplicate sends while a request is pending", async () => {
|
|
181
|
-
const deferred = new Deferred<
|
|
182
|
-
|
|
276
|
+
const deferred = new Deferred<Response>();
|
|
277
|
+
fetch.mockReturnValue(deferred.promise);
|
|
183
278
|
renderButton();
|
|
184
279
|
send();
|
|
185
280
|
expect(screen.getByRole("button")).toBeDisabled();
|
|
186
281
|
send();
|
|
187
|
-
expect(
|
|
188
|
-
|
|
282
|
+
expect(fetch).toHaveBeenCalledOnce();
|
|
283
|
+
expect(toast).not.toHaveBeenCalled();
|
|
284
|
+
await act(async () =>
|
|
285
|
+
deferred.resolve(new Response(null, { status: 204 })),
|
|
286
|
+
);
|
|
189
287
|
expect(screen.getByRole("button")).toBeEnabled();
|
|
288
|
+
expect(toast).toHaveBeenCalledWith({ title: "Sent", duration: 3000 });
|
|
190
289
|
});
|
|
191
290
|
|
|
192
|
-
it("
|
|
291
|
+
it("hides the button after the last agent disconnects", () => {
|
|
193
292
|
const { store } = renderButton();
|
|
194
293
|
act(() => store.set(attachmentsAtom, []));
|
|
195
|
-
expect(screen.
|
|
294
|
+
expect(screen.queryByRole("button")).not.toBeInTheDocument();
|
|
196
295
|
});
|
|
197
296
|
|
|
198
|
-
it.each([
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
297
|
+
it.each(["host", "network"])(
|
|
298
|
+
"shows a %s error and permits a new send",
|
|
299
|
+
async (failure) => {
|
|
300
|
+
const detail = "Publication failed";
|
|
301
|
+
if (failure === "host") {
|
|
302
|
+
fetch.mockResolvedValueOnce(
|
|
303
|
+
new Response(
|
|
304
|
+
JSON.stringify({
|
|
305
|
+
type: "urn:marimo:problem:internal",
|
|
306
|
+
title: "Internal error",
|
|
307
|
+
status: 500,
|
|
308
|
+
detail,
|
|
309
|
+
}),
|
|
310
|
+
{
|
|
311
|
+
status: 500,
|
|
312
|
+
headers: { "Content-Type": "application/problem+json" },
|
|
313
|
+
},
|
|
314
|
+
),
|
|
315
|
+
);
|
|
316
|
+
} else {
|
|
317
|
+
fetch.mockRejectedValueOnce(new Error(detail));
|
|
318
|
+
}
|
|
319
|
+
renderButton();
|
|
320
|
+
send();
|
|
321
|
+
const failedId = (await lastRequest()).headers.get("Idempotency-Key");
|
|
322
|
+
await waitFor(() =>
|
|
323
|
+
expect(toast).toHaveBeenCalledWith({
|
|
324
|
+
variant: "danger",
|
|
325
|
+
title: "Could not send error",
|
|
326
|
+
description: detail,
|
|
327
|
+
duration: 5000,
|
|
328
|
+
}),
|
|
329
|
+
);
|
|
330
|
+
expect(toast).toHaveBeenCalledOnce();
|
|
331
|
+
expect(screen.getByRole("button")).toBeEnabled();
|
|
332
|
+
send();
|
|
333
|
+
await waitFor(() =>
|
|
334
|
+
expect(toast).toHaveBeenCalledWith({
|
|
335
|
+
title: "Sent",
|
|
336
|
+
duration: 3000,
|
|
337
|
+
}),
|
|
338
|
+
);
|
|
339
|
+
expect(fetch).toHaveBeenCalledTimes(2);
|
|
340
|
+
const request = await lastRequest();
|
|
341
|
+
expect(request.headers.get("Idempotency-Key")).not.toBe(failedId);
|
|
342
|
+
expect(await request.json()).toEqual(errorEvent(REPORT));
|
|
343
|
+
},
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
it("accepts 65,536 encoded bytes, including UTF-8, quotes, and escapes", async () => {
|
|
347
|
+
const message = `${"é".repeat(32_766)}\n`;
|
|
348
|
+
renderButton({
|
|
349
|
+
content: <SendErrorReportButton getContent={() => message} />,
|
|
350
|
+
});
|
|
204
351
|
send();
|
|
205
|
-
await
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
expect(screen.getByRole("button")).toBeEnabled();
|
|
352
|
+
expect(await sentEvent()).toEqual(errorEvent(message));
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it("rejects 65,537 encoded bytes before publication", async () => {
|
|
356
|
+
const message = `${"é".repeat(32_766)}\na`;
|
|
357
|
+
renderButton({
|
|
358
|
+
content: <SendErrorReportButton getContent={() => message} />,
|
|
359
|
+
});
|
|
214
360
|
send();
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
);
|
|
221
|
-
expect(
|
|
222
|
-
expect(
|
|
361
|
+
expect(toast).toHaveBeenCalledWith({
|
|
362
|
+
variant: "danger",
|
|
363
|
+
title: "Could not send error",
|
|
364
|
+
description: "The report exceeds 65,536 bytes as JSON.",
|
|
365
|
+
duration: 5000,
|
|
366
|
+
});
|
|
367
|
+
expect(fetch).not.toHaveBeenCalled();
|
|
368
|
+
expect(screen.getByRole("button")).toBeEnabled();
|
|
223
369
|
});
|
|
224
370
|
|
|
225
371
|
it("sends captured code and full traceback from the error output", async () => {
|
|
@@ -238,8 +384,8 @@ describe("SendErrorReportButton", () => {
|
|
|
238
384
|
),
|
|
239
385
|
});
|
|
240
386
|
send();
|
|
241
|
-
await
|
|
242
|
-
|
|
387
|
+
expect(await sentEvent()).toEqual(
|
|
388
|
+
errorEvent({
|
|
243
389
|
...REPORT,
|
|
244
390
|
output: {
|
|
245
391
|
type: "error",
|
|
@@ -252,7 +398,7 @@ describe("SendErrorReportButton", () => {
|
|
|
252
398
|
});
|
|
253
399
|
|
|
254
400
|
it("sends a formatter error beside a normal main output", async () => {
|
|
255
|
-
const { store } = renderButton({
|
|
401
|
+
const { store, seed } = renderButton({
|
|
256
402
|
content: (
|
|
257
403
|
<OutputRenderer
|
|
258
404
|
cellId={CELL_ID}
|
|
@@ -271,15 +417,15 @@ describe("SendErrorReportButton", () => {
|
|
|
271
417
|
cellData: { [CELL_ID]: { code: "later edit" } },
|
|
272
418
|
}),
|
|
273
419
|
);
|
|
274
|
-
|
|
420
|
+
seed(store, [
|
|
275
421
|
MockExecutions.shown(CELL_ID, {
|
|
276
422
|
mimetype: "text/plain",
|
|
277
423
|
data: "<Broken formatter>",
|
|
278
424
|
}),
|
|
279
425
|
]);
|
|
280
426
|
send();
|
|
281
|
-
await
|
|
282
|
-
|
|
427
|
+
expect(await sentEvent()).toEqual(
|
|
428
|
+
errorEvent({
|
|
283
429
|
...REPORT,
|
|
284
430
|
output: {
|
|
285
431
|
type: "error",
|
|
@@ -312,8 +458,8 @@ describe("SendErrorReportButton", () => {
|
|
|
312
458
|
"<cell>",
|
|
313
459
|
);
|
|
314
460
|
send();
|
|
315
|
-
await
|
|
316
|
-
|
|
461
|
+
expect(await sentEvent()).toEqual(
|
|
462
|
+
errorEvent({
|
|
317
463
|
...REPORT,
|
|
318
464
|
output: {
|
|
319
465
|
type: "error",
|
|
@@ -378,8 +524,8 @@ describe("SendErrorReportButton", () => {
|
|
|
378
524
|
content: message && <OutputRenderer cellId={CELL_ID} message={message} />,
|
|
379
525
|
});
|
|
380
526
|
send();
|
|
381
|
-
await
|
|
382
|
-
|
|
527
|
+
expect(await sentEvent()).toEqual(
|
|
528
|
+
errorEvent({
|
|
383
529
|
...REPORT,
|
|
384
530
|
output: {
|
|
385
531
|
type: "error",
|
|
@@ -402,7 +548,7 @@ describe("SendErrorReportButton", () => {
|
|
|
402
548
|
};
|
|
403
549
|
rerender(<SendErrorReportButton getContent={() => updated} />);
|
|
404
550
|
send();
|
|
405
|
-
await
|
|
551
|
+
expect(await sentEvent()).toEqual(errorEvent(updated));
|
|
406
552
|
});
|
|
407
553
|
|
|
408
554
|
it.each([
|
|
@@ -415,7 +561,7 @@ describe("SendErrorReportButton", () => {
|
|
|
415
561
|
content: <SendErrorReportButton getContent={() => content} />,
|
|
416
562
|
});
|
|
417
563
|
send();
|
|
418
|
-
await
|
|
564
|
+
expect(await sentEvent()).toEqual(errorEvent(content));
|
|
419
565
|
});
|
|
420
566
|
|
|
421
567
|
it("sends the source that raised while the host still has it", async () => {
|
|
@@ -436,8 +582,8 @@ describe("SendErrorReportButton", () => {
|
|
|
436
582
|
<OutputRenderer cellId={CELL_ID} message={message} />
|
|
437
583
|
) : null;
|
|
438
584
|
};
|
|
439
|
-
const { store, rerender } = renderButton({ content: <div /> });
|
|
440
|
-
const replica =
|
|
585
|
+
const { store, seed, rerender } = renderButton({ content: <div /> });
|
|
586
|
+
const replica = seed(
|
|
441
587
|
store,
|
|
442
588
|
[
|
|
443
589
|
{
|
|
@@ -453,18 +599,19 @@ describe("SendErrorReportButton", () => {
|
|
|
453
599
|
);
|
|
454
600
|
rerender(<StoreOutput />);
|
|
455
601
|
send();
|
|
456
|
-
await
|
|
602
|
+
expect(await sentEvent()).toEqual(errorEvent(REPORT));
|
|
457
603
|
|
|
458
604
|
// Once an edit is confirmed, the source that raised is gone.
|
|
459
|
-
|
|
605
|
+
fetch.mockClear();
|
|
460
606
|
act(() => {
|
|
461
607
|
store.set(replica.documentAtom, confirmed("edited"));
|
|
462
608
|
});
|
|
463
609
|
send();
|
|
464
|
-
await
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
610
|
+
expect(await sentEvent()).toEqual(
|
|
611
|
+
errorEvent({
|
|
612
|
+
type: REPORT.type,
|
|
613
|
+
cell_id: CELL_ID,
|
|
614
|
+
output: REPORT.output,
|
|
468
615
|
}),
|
|
469
616
|
);
|
|
470
617
|
});
|
|
@@ -505,8 +652,8 @@ describe("SendErrorReportButton", () => {
|
|
|
505
652
|
}),
|
|
506
653
|
);
|
|
507
654
|
send();
|
|
508
|
-
await
|
|
509
|
-
|
|
655
|
+
expect(await sentEvent()).toEqual(
|
|
656
|
+
errorEvent({
|
|
510
657
|
type: "cell-output",
|
|
511
658
|
cell_id: CELL_ID,
|
|
512
659
|
code: "x + 1",
|
|
@@ -530,8 +677,8 @@ describe("SendErrorReportButton", () => {
|
|
|
530
677
|
),
|
|
531
678
|
});
|
|
532
679
|
send();
|
|
533
|
-
await
|
|
534
|
-
|
|
680
|
+
expect(await sentEvent()).toEqual(
|
|
681
|
+
errorEvent({
|
|
535
682
|
type: "cell-output",
|
|
536
683
|
cell_id: CELL_ID,
|
|
537
684
|
code: "slow()",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import { useAtomValue, useSetAtom
|
|
3
|
+
import { useAtomValue, useSetAtom } from "jotai";
|
|
4
4
|
import {
|
|
5
5
|
CheckIcon,
|
|
6
6
|
ChevronDownIcon,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "@/components/ui/dropdown-menu";
|
|
19
19
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
20
20
|
import { aiCompletionCellAtom } from "@/core/ai/state";
|
|
21
|
-
import {
|
|
21
|
+
import { ensureCellEditorView } from "@/core/cells/cells";
|
|
22
22
|
import { useCellActions } from "@/core/cells/actions";
|
|
23
23
|
import type { CellId } from "@/core/cells/ids";
|
|
24
24
|
import { aiFeaturesEnabledAtom } from "@/core/config/config";
|
|
@@ -26,6 +26,7 @@ import { getAutoFixes } from "@/core/errors/errors";
|
|
|
26
26
|
import type { MarimoError } from "@/core/kernel/messages";
|
|
27
27
|
import { cn } from "@/utils/cn";
|
|
28
28
|
import { useOpenAiAssistant } from "../chrome/wrapper/useOpenAiAssistant";
|
|
29
|
+
import { focusEditor } from "../navigation/focus-utils";
|
|
29
30
|
import { type FixMode, useFixMode } from "./fix-mode";
|
|
30
31
|
|
|
31
32
|
export function buildFixInChatPrompt(
|
|
@@ -51,7 +52,6 @@ export const AutoFixButton = ({
|
|
|
51
52
|
cellId: CellId;
|
|
52
53
|
className?: string;
|
|
53
54
|
}) => {
|
|
54
|
-
const store = useStore();
|
|
55
55
|
const { createCell } = useCellActions();
|
|
56
56
|
const aiFeaturesEnabled = useAtomValue(aiFeaturesEnabledAtom);
|
|
57
57
|
const autoFixes = errors.flatMap((error) =>
|
|
@@ -69,8 +69,8 @@ export const AutoFixButton = ({
|
|
|
69
69
|
const firstFix = autoFixes[0];
|
|
70
70
|
|
|
71
71
|
const handleFix = (triggerFix: boolean) => {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
// A hidden cell with output never scrolls its editor into view.
|
|
73
|
+
const editorView = ensureCellEditorView(cellId);
|
|
74
74
|
firstFix.onFix({
|
|
75
75
|
addCodeBelow: (code: string) => {
|
|
76
76
|
createCell({ after: cellId, code, focus: false });
|
|
@@ -82,8 +82,9 @@ export const AutoFixButton = ({
|
|
|
82
82
|
triggerFix,
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
if (editorView) {
|
|
86
|
+
focusEditor(editorView);
|
|
87
|
+
}
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
const openAISidebar = () => {
|