@marimo-team/frontend 0.25.3-dev4 → 0.25.3-dev42
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/assets/CellStatus-BpOBz-8m.js +1 -0
- package/dist/assets/{ConnectedDataExplorerComponent-t8fH_TNc.js → ConnectedDataExplorerComponent-D9UK8o9A.js} +1 -1
- package/dist/assets/{ErrorBoundary-Gl5nCA8C.js → ErrorBoundary-DmXl4Nre.js} +2 -2
- package/dist/assets/JsonOutput-BJraU9kp.js +11 -0
- package/dist/assets/{LazyAnyLanguageCodeMirror-CKcCbG2G.js → LazyAnyLanguageCodeMirror-BPYE76jR.js} +2 -2
- package/dist/assets/MarimoErrorOutput-DVjK8RgY.js +10 -0
- package/dist/assets/{RenderHTML-BbOqmHy3.js → RenderHTML-BFaztTR0.js} +1 -1
- package/dist/assets/{RunButton-CK3LhnP5.js → RunButton-B44xE_d5.js} +1 -1
- package/dist/assets/{add-cell-with-ai-8UBC0xwR.js → add-cell-with-ai-CkjslziO.js} +13 -13
- package/dist/assets/{add-connection-dialog-DXQnd6eB.js → add-connection-dialog-CWLLVKju.js} +2 -2
- package/dist/assets/{agent-panel-DdkVL-Kx.js → agent-panel-DYdQ_2pp.js} +5 -5
- package/dist/assets/ai-model-dropdown-F3mm17Wa.js +13 -0
- package/dist/assets/{alert-dialog-BaPGzeOK.js → alert-dialog-C-sWmKva.js} +1 -1
- package/dist/assets/any-language-editor-DUMe1UCk.js +1 -0
- package/dist/assets/{app-config-button-BKEG4x9u.js → app-config-button-D0uDs5nC.js} +1 -1
- package/dist/assets/arrays-0R2reF2y.js +1 -0
- package/dist/assets/{blob-D5nfNHOo.js → blob-BSfsdCNF.js} +1 -1
- package/dist/assets/{button-COI-NGrx.js → button-D8gVKwe-.js} +1 -1
- package/dist/assets/{cache-panel-DTY1dqvi.js → cache-panel-Byolv2ht.js} +1 -1
- package/dist/assets/{capabilities-BJvf-MD4.js → capabilities-Pq1YNPlK.js} +1 -1
- package/dist/assets/{cell-editor-32lVhib7.js → cell-editor-DzvvHs9g.js} +9 -9
- package/dist/assets/{cell-link-LSth_8hT.js → cell-link-DFPHORAO.js} +1 -1
- package/dist/assets/{cells-BRkCaSsh.js → cells-BdgzY0of.js} +31 -31
- package/dist/assets/{chat-display-Dnagy4Nv.js → chat-display-BrcwdhKJ.js} +1 -1
- package/dist/assets/{chat-panel-DN9vsbgS.js → chat-panel-C__3iSyI.js} +2 -2
- package/dist/assets/{chat-ui-Df8Vcj6n.js → chat-ui-NlBK3kK6.js} +1 -1
- package/dist/assets/{circle-DXf-VWZG.js → circle-B6D_6D8w.js} +1 -1
- package/dist/assets/code-visibility-Cs-Vv3jV.js +1 -0
- package/dist/assets/coerce-DWjFeXOY.js +1 -0
- package/dist/assets/{column-preview-CHK_DNrs.js → column-preview-ivm1b-GY.js} +1 -1
- package/dist/assets/command-palette-TgwswwvD.js +1 -0
- package/dist/assets/{common-Cu6CDbuw.js → common-BcEY1yDS.js} +1 -1
- package/dist/assets/{components-CP_UoFtT.js → components-DrU8dOzy.js} +1 -1
- package/dist/assets/{components-CXfO-F47.js → components-lDm0qi2t.js} +1 -1
- package/dist/assets/{components-CGw16R_N.js → components-lkCfd2vy.js} +1 -1
- package/dist/assets/config-BwHT0yGp.js +104 -0
- package/dist/assets/config-DGX7JYor.js +1 -0
- package/dist/assets/config-DXjnAwtL.js +1 -0
- package/dist/assets/{copy-D8O_CYCG.js → copy-KlhazlhB.js} +1 -1
- package/dist/assets/{copy-icon-BIiRXh_3.js → copy-icon-8-a5vovc.js} +1 -1
- package/dist/assets/{createReducer-DgRODTW6.js → createReducer-HKXUbqyz.js} +1 -1
- package/dist/assets/{datasource-Cq6x_5ML.js → datasource-dKk3JHSQ.js} +1 -1
- package/dist/assets/{dates-CfmdTL6B.js → dates-CQMwFko2.js} +1 -1
- package/dist/assets/{dependency-graph-panel--Kgtktcw.js → dependency-graph-panel-BaisS9Zt.js} +1 -1
- package/dist/assets/{dist-iaThVDkA.js → dist-jlhMTKo_.js} +1 -1
- package/dist/assets/{documentation-panel-BHmbeznw.js → documentation-panel-CpSUoM8r.js} +1 -1
- package/dist/assets/{download-DCJXy66H.js → download-RV4i1fWI.js} +1 -1
- package/dist/assets/{dropdown-menu-C1rnl-0o.js → dropdown-menu-DS6umAnH.js} +1 -1
- package/dist/assets/edit-page-C8RUVAaO.js +9 -0
- package/dist/assets/{error-banner-Cd69vvyX.js → error-banner-B5kzVf_0.js} +1 -1
- package/dist/assets/{error-entries-Dk3VZ-OK.js → error-entries-CJS0gOId.js} +1 -1
- package/dist/assets/{error-panel-BPRYmC5J.js → error-panel-BxCKpZtN.js} +1 -1
- package/dist/assets/{errors-DCrsa1nH.js → errors-CNsgAw6m.js} +1 -1
- package/dist/assets/{es-Cqst59WX.js → es-N9SHpmG7.js} +1 -1
- package/dist/assets/feedback-button-BLvwvndE.js +1 -0
- package/dist/assets/{feedback-button-Bik2-e33.js → feedback-button-DYjae3_b.js} +2 -2
- package/dist/assets/{file-explorer-panel-BmekFu7T.js → file-explorer-panel-BmjAJusg.js} +1 -1
- package/dist/assets/{file-name-input-Cdc-TVqO.js → file-name-input-BpfSzvEB.js} +1 -1
- package/dist/assets/{floating-outline-XD9FAV-f.js → floating-outline-CrWdiNQ2.js} +1 -1
- package/dist/assets/{formats-yZ06h1Pl.js → formats-zylfwejq.js} +1 -1
- package/dist/assets/{formatting-BqrP-n49.js → formatting-uom1es4b.js} +1 -1
- package/dist/assets/{fullscreen-B9tHcfpV.js → fullscreen-BWTs8pYZ.js} +1 -1
- package/dist/assets/{gallery-page-Dm6mGwBi.js → gallery-page-W_b-XWq6.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-2n7Ig5Jm.js → ganttDiagram-EL5Y4UJY-CYqkCfFG.js} +1 -1
- package/dist/assets/{glide-data-editor-J9CAb70d.js → glide-data-editor-C_bIL30J.js} +2 -2
- package/dist/assets/{glide-utils-CIrAxdjv.js → glide-utils-HFqhvWHI.js} +2 -2
- package/dist/assets/{home-page-s3LUizSn.js → home-page-D1teQDdF.js} +3 -3
- package/dist/assets/hooks-CZF85I2f.js +1 -0
- package/dist/assets/{html-to-image-DK9Zl1lU.js → html-to-image-D_0rd3_B.js} +1 -1
- package/dist/assets/index-4Nwpioic.js +30 -0
- package/dist/assets/index-ChfDZJzP.css +2 -0
- package/dist/assets/{input-BoBxR50a.js → input-ByHt6aoV.js} +1 -1
- package/dist/assets/{kiosk-mode-BZECfg9k.js → kiosk-mode-BGmMSc7A.js} +1 -1
- package/dist/assets/{layout-B_GMOySr.js → layout-ByZveRPN.js} +5 -5
- package/dist/assets/linear-Bma8J3iM.js +1 -0
- package/dist/assets/links-CXcpNIM0.js +1 -0
- package/dist/assets/{logs-panel-ABM16htT.js → logs-panel-DVSgfMgv.js} +1 -1
- package/dist/assets/{markdown-renderer-BG3sp2rs.js → markdown-renderer-DX2O5YiE.js} +1 -1
- package/dist/assets/{menu-items-BrwnTgyK.js → menu-items-BgUyNUpu.js} +1 -1
- package/dist/assets/{mermaid-a3xYymTy.js → mermaid-B6mqMm5_.js} +2 -2
- package/dist/assets/{name-cell-input-BgEBmqyL.js → name-cell-input-DL1i8Mj0.js} +1 -1
- package/dist/assets/numbers-CsZVw3Dc.js +1 -0
- package/dist/assets/{objects-snlMn4yk.js → objects-rLPlQ3X_.js} +1 -1
- package/dist/assets/{once-Haz_uxEL.js → once-6KNTRW0u.js} +1 -1
- package/dist/assets/{outline-panel-DCXQ3_F6.js → outline-panel-DPKPT2eg.js} +1 -1
- package/dist/assets/{packages-panel-BMGOmZkR.js → packages-panel-CZZwD9YV.js} +1 -1
- package/dist/assets/{panel-accordion-state-C1sdPp0m.js → panel-accordion-state-C7vvsYz1.js} +1 -1
- package/dist/assets/panels-BT2oosq8.js +4 -0
- package/dist/assets/precisionRound-BxlUs8G4.js +1 -0
- package/dist/assets/process-output-BKhybJBb.js +1 -0
- package/dist/assets/{quadrantDiagram-AXDQQJYC-yBhCDI7E.js → quadrantDiagram-AXDQQJYC-D9KH5Zge.js} +1 -1
- package/dist/assets/react-vega-BTNeboR2.js +189 -0
- package/dist/assets/{readonly-code-display-Do50PHI8.js → readonly-code-display-9QrSm_7D.js} +1 -1
- package/dist/assets/{readonly-python-code-DCSMIsTX.js → readonly-python-code-BLotL3XP.js} +1 -1
- package/dist/assets/{renderShortcut-BkVJQ_Zh.js → renderShortcut-H60uiHBp.js} +1 -1
- package/dist/assets/{reveal-component-CLE6vB1Z.js → reveal-component-2QaMbLNx.js} +3 -3
- package/dist/assets/{run-page-Depd6lEE.js → run-page-DyZ8JFKU.js} +1 -1
- package/dist/assets/{runs-BLp5jezv.js → runs-6lJxKV1w.js} +1 -1
- package/dist/assets/{runtime-details-state-CSPobEdR.js → runtime-details-state-B25uM-Ps.js} +1 -1
- package/dist/assets/{schemas-Dv42wLFq.js → schemas-ChRqMOTL.js} +1 -1
- package/dist/assets/{scratchpad-panel-lc6jmpjv.js → scratchpad-panel-Dt83MaaA.js} +1 -1
- package/dist/assets/{scroll-to-bottom-button-1FyowpWV.js → scroll-to-bottom-button-CIkON2WJ.js} +1 -1
- package/dist/assets/{secrets-panel-Bctbtkrp.js → secrets-panel-CmLZsNfp.js} +1 -1
- package/dist/assets/{select-DTBn5eTb.js → select-3CVGlYrC.js} +1 -1
- package/dist/assets/{session-DqoWmb7X.js → session-B8Y-GJnS.js} +1 -1
- package/dist/assets/session-panel-xVWVwa1U.js +1 -0
- package/dist/assets/{snippets-panel-Bh1oTw4m.js → snippets-panel-IxIxfxNc.js} +1 -1
- package/dist/assets/{spec-BfSBcO5B.js → spec-uCpVvaAR.js} +1 -1
- package/dist/assets/state-BHuYDaxs.js +3 -0
- package/dist/assets/{state-uwRvJLb8.js → state-BY4_P6ko.js} +1 -1
- package/dist/assets/{state-BAJYRhmO.js → state-C0irhlOZ.js} +1 -1
- package/dist/assets/{state-XsPO8hNi.js → state-CVgqwwCU.js} +1 -1
- package/dist/assets/{state-DxQnC_1I.js → state-Ck7FMD5A.js} +1 -1
- package/dist/assets/{state-C3oDoyFe.js → state-DaWgt-rn.js} +1 -1
- package/dist/assets/{strings-B2vv-ENv.js → strings-C25fhMR_.js} +1 -1
- package/dist/assets/{swiper-component-a07domrZ.js → swiper-component-CRGRy5_O.js} +1 -1
- package/dist/assets/{switch-CTaiAjrz.js → switch-1h011wlH.js} +1 -1
- package/dist/assets/{tabs-BuQlZFbt.js → tabs-CY8E4r9U.js} +1 -1
- package/dist/assets/{terminal-Ck_vK-34.js → terminal-CjvCrRrA.js} +3 -3
- package/dist/assets/{time-MgToa8VM.js → time-DswSXBDk.js} +1 -1
- package/dist/assets/{toast-BGzLGnvw.js → toast-Gzxi-le_.js} +1 -1
- package/dist/assets/tooltip-Brya4Ghn.js +61 -0
- package/dist/assets/{tooltip-C9TuY18o.js → tooltip-CkGm8X7m.js} +1 -1
- package/dist/assets/tracing-V5zejPsw.js +1 -0
- package/dist/assets/{tracing-panel-PeRXHD8_.js → tracing-panel-DLS3iwK6.js} +2 -2
- package/dist/assets/{tree-actions-GM5E_bUs.js → tree-actions-Be_mzC1C.js} +1 -1
- package/dist/assets/{use-restore-focus-BxEGwIbk.js → use-restore-focus-DdS7Tl0F.js} +1 -1
- package/dist/assets/{useAddCell-GR7eEQrT.js → useAddCell-DK79W1vA.js} +1 -1
- package/dist/assets/useAsyncData-DhhdOGGd.js +1 -0
- package/dist/assets/{useBoolean-BDD6_xQQ.js → useBoolean-j0qHaJxu.js} +1 -1
- package/dist/assets/{useCellActionButton-B-9eG5z_.js → useCellActionButton-Cw9Ob12j.js} +1 -1
- package/dist/assets/{useDeleteCell-2_bMClHd.js → useDeleteCell-BNqX6PPu.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-k3C3M18S.js → useDependencyPanelTab-GnTnqKJo.js} +1 -1
- package/dist/assets/{useEventListener-D9cftcHj.js → useEventListener-CjDeLqFC.js} +1 -1
- package/dist/assets/{useIframeCapabilities-CwTkczVN.js → useIframeCapabilities-Czr9e4uG.js} +1 -1
- package/dist/assets/{useInstallPackage-iX1eufdl.js → useInstallPackage-CVItDn1e.js} +1 -1
- package/dist/assets/{useInterval--x3s1VpI.js → useInterval-DJdQmXnq.js} +1 -1
- package/dist/assets/useNotebookActions-_qJ1Sjtj.js +1 -0
- package/dist/assets/{useRunCells-B2vUhREg.js → useRunCells-DP09DHT6.js} +1 -1
- package/dist/assets/{useSplitCell-DEb03htp.js → useSplitCell-IfumZ4sm.js} +1 -1
- package/dist/assets/{useTheme-COhSHkCj.js → useTheme-DLtPc-39.js} +1 -1
- package/dist/assets/{utils-CaQYvazl.js → utils-DfElfBpz.js} +1 -1
- package/dist/assets/vega-component-CMn031HF.js +1 -0
- package/dist/assets/{vega-embed-container-DJPNkHPb.js → vega-embed-container-DtArSJz1.js} +1 -1
- package/dist/assets/vega-loader.browser-Bu25TKax.js +6 -0
- package/dist/assets/{write-secret-modal-DzKAInL2.js → write-secret-modal-usRSi1bb.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-KbGzG6-u.js → xychartDiagram-S5SC5T6Z-CeRnBS5e.js} +1 -1
- package/dist/index.html +76 -77
- package/package.json +4 -4
- package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
- package/src/__tests__/host-imports.test.ts +1 -0
- package/src/__tests__/mount.test.ts +28 -8
- package/src/components/app-config/ai-config.tsx +5 -1
- package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
- package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
- package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
- package/src/components/data-table/columns.tsx +2 -1
- package/src/components/data-table/date-popover.tsx +6 -4
- package/src/components/data-table/export-actions.tsx +192 -116
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +2 -2
- package/src/components/data-table/schemas.ts +14 -36
- package/src/components/editor/Output.tsx +9 -2
- package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
- package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
- package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
- package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
- package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +366 -0
- package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
- package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
- package/src/components/editor/connections/components.tsx +1 -1
- package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
- package/src/components/editor/controls/command-palette.tsx +22 -10
- package/src/components/editor/dynamic-favicon.tsx +21 -40
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +537 -0
- package/src/components/editor/errors/send-error-report-button.tsx +69 -0
- package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
- package/src/components/editor/output/MarimoTracebackOutput.tsx +36 -21
- package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
- package/src/components/editor/output/ansi-reduce.ts +6 -0
- package/src/components/pages/home-page.tsx +4 -4
- package/src/components/tracing/tracing.tsx +2 -2
- package/src/core/attachments/__tests__/toast.test.tsx +58 -0
- package/src/core/attachments/state.ts +18 -0
- package/src/core/attachments/toast.ts +15 -0
- package/src/core/cells/__tests__/cells.test.ts +52 -0
- package/src/core/cells/__tests__/error-report.test.ts +139 -0
- package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
- package/src/core/cells/__tests__/session.test.ts +50 -1
- package/src/core/cells/cells.ts +2 -1
- package/src/core/cells/error-report.ts +63 -0
- package/src/core/cells/pending-delete-service.ts +2 -6
- package/src/core/cells/session.ts +28 -1
- package/src/core/config/pair.ts +5 -3
- package/src/core/datasets/__tests__/data-source-discovery.test.ts +4 -4
- package/src/core/datasets/data-source-discovery.ts +4 -6
- package/src/core/edit-app.tsx +2 -2
- package/src/core/host/AGENTS.md +11 -2
- package/src/core/host/__tests__/attachments.test.ts +56 -0
- package/src/core/host/__tests__/document.test.ts +126 -0
- package/src/core/host/__tests__/events.test.ts +49 -0
- package/src/core/host/__tests__/fixtures.ts +41 -0
- package/src/core/host/__tests__/notebook-client.test.ts +433 -0
- package/src/core/host/connection.ts +81 -0
- package/src/core/host/events.ts +77 -0
- package/src/core/host/notebook-client.ts +323 -0
- package/src/core/host/resources/attachments.ts +19 -0
- package/src/core/host/resources/document.ts +101 -0
- package/src/core/hotkeys/actions.ts +2 -4
- package/src/core/network/connection.ts +4 -2
- package/src/core/run-app.tsx +2 -2
- package/src/core/runtime/__tests__/runtime.test.ts +55 -11
- package/src/core/runtime/runtime.ts +18 -5
- package/src/core/runtime/types.ts +2 -0
- package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
- package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +170 -0
- package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +181 -65
- package/src/core/websocket/connection-state.ts +70 -0
- package/src/core/websocket/state.ts +7 -0
- package/src/core/websocket/transports/__tests__/sse.test.ts +1 -4
- package/src/core/websocket/transports/create.ts +31 -0
- package/src/core/websocket/transports/transport.ts +12 -23
- package/src/core/websocket/types.ts +9 -39
- package/src/core/websocket/useNotebookClient.ts +88 -0
- package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +59 -225
- package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
- package/src/hooks/useAsyncData.ts +3 -3
- package/src/hooks/useDataSourceDiscovery.ts +6 -4
- package/src/hooks/useElapsedTime.ts +3 -3
- package/src/mount.tsx +7 -3
- package/src/plugins/core/registerReactComponent.tsx +1 -1
- package/src/plugins/impl/DropdownPlugin.tsx +2 -6
- package/src/plugins/impl/FormPlugin.tsx +1 -1
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
- package/src/plugins/impl/code/any-language-editor.tsx +2 -2
- package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
- package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
- package/src/plugins/impl/vega/make-selectable.ts +3 -6
- package/src/utils/__tests__/arrays.test.ts +35 -0
- package/src/utils/__tests__/numbers.test.ts +48 -1
- package/src/utils/__tests__/objects.test.ts +21 -0
- package/src/utils/arrays.ts +10 -0
- package/src/utils/numbers.ts +28 -17
- package/src/utils/objects.ts +3 -7
- package/src/utils/once.ts +19 -19
- package/dist/assets/CellStatus-BP2mavAq.js +0 -1
- package/dist/assets/JsonOutput-DxHKOpPG.js +0 -11
- package/dist/assets/MarimoErrorOutput-D60XkCny.js +0 -6
- package/dist/assets/ai-model-dropdown-B0z6-zhp.js +0 -5
- package/dist/assets/any-language-editor-BLCAD3yx.js +0 -1
- package/dist/assets/api-BeC_VSGv.js +0 -1
- package/dist/assets/arrays-BqUx5USx.js +0 -1
- package/dist/assets/code-visibility-B-_GvwR5.js +0 -1
- package/dist/assets/coerce-CpE6kUdX.js +0 -1
- package/dist/assets/command-palette-Cf7WX-nr.js +0 -1
- package/dist/assets/config-BOKzA3tF.js +0 -1
- package/dist/assets/config-DX8Y2WbJ.js +0 -1
- package/dist/assets/config-VPSq73n8.js +0 -1
- package/dist/assets/edit-page-BT74CF4G.js +0 -9
- package/dist/assets/feedback-button-B2gKC5cn.js +0 -1
- package/dist/assets/hooks-RnjuFmEx.js +0 -1
- package/dist/assets/index-Bcdzex-3.css +0 -2
- package/dist/assets/index-D-kY3FU1.js +0 -29
- package/dist/assets/linear-0eij_aAG.js +0 -1
- package/dist/assets/links-DkkL9DVa.js +0 -1
- package/dist/assets/numbers-Mk3-CcoU.js +0 -1
- package/dist/assets/pair-CaQyK6En.js +0 -1
- package/dist/assets/panels-Dn59o8ay.js +0 -4
- package/dist/assets/precisionRound-Bq_nmf5u.js +0 -1
- package/dist/assets/process-output-D0KGq04R.js +0 -1
- package/dist/assets/react-vega-C3rYGtP6.js +0 -189
- package/dist/assets/session-panel-BxS5hiG2.js +0 -1
- package/dist/assets/state-_Qai_QyX.js +0 -3
- package/dist/assets/tooltip-mT3CGest.js +0 -61
- package/dist/assets/tracing-Di6pUmX8.js +0 -1
- package/dist/assets/useAsyncData-C7aJJz0Y.js +0 -1
- package/dist/assets/useNotebookActions-DIc4xTzY.js +0 -1
- package/dist/assets/vega-component-CnadTgoE.js +0 -1
- package/dist/assets/vega-loader.browser-CLRkNgm7.js +0 -6
- package/src/core/host/__tests__/protocol.test.ts +0 -214
- package/src/core/host/protocol.ts +0 -1943
- package/src/core/websocket/useWebSocket.tsx +0 -88
|
@@ -17,18 +17,16 @@ import { Events } from "@/utils/events";
|
|
|
17
17
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
18
18
|
import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
|
|
19
19
|
import { API } from "@/core/network/api";
|
|
20
|
-
import {
|
|
20
|
+
import { pairConfigAtom } from "@/core/config/pair";
|
|
21
21
|
import { stableSessionIdAtom } from "@/core/kernel/session";
|
|
22
22
|
import {
|
|
23
23
|
AGENT_LABELS,
|
|
24
24
|
AGENT_TABS,
|
|
25
25
|
type AgentTab,
|
|
26
26
|
type ConnectionInfo,
|
|
27
|
-
getFileFromURL,
|
|
28
27
|
getRawPrompt,
|
|
29
28
|
getTerminalCommand,
|
|
30
29
|
maskToken,
|
|
31
|
-
SKILL_INSTALL,
|
|
32
30
|
TERMINAL_TABS,
|
|
33
31
|
} from "./pair-with-agent-commands";
|
|
34
32
|
|
|
@@ -52,15 +50,64 @@ export const PairWithAgentModal: React.FC<{
|
|
|
52
50
|
}> = ({ onClose }) => {
|
|
53
51
|
const [activeTab, setActiveTab] = useState<AgentTab>("claude");
|
|
54
52
|
const runtimeManager = useRuntimeManager();
|
|
55
|
-
const
|
|
53
|
+
const config = useAtomValue(pairConfigAtom);
|
|
54
|
+
const hostEnabled = config?.hostEnabled ?? false;
|
|
56
55
|
const stableSessionId = useAtomValue(stableSessionIdAtom);
|
|
57
|
-
const
|
|
56
|
+
const [lookup, setLookup] = useState<
|
|
57
|
+
{
|
|
58
|
+
sessionId: string;
|
|
59
|
+
} & (
|
|
60
|
+
| { status: "ready"; notebookId: string | null }
|
|
61
|
+
| { status: "loading" | "error" }
|
|
62
|
+
)
|
|
63
|
+
>();
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!hostEnabled || !stableSessionId) {
|
|
66
|
+
setLookup(undefined);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const sessionId = stableSessionId;
|
|
70
|
+
setLookup({ sessionId, status: "loading" });
|
|
71
|
+
let cancelled = false;
|
|
72
|
+
API.get<Record<string, { session_id: string; notebook_id: string | null }>>(
|
|
73
|
+
"/sessions",
|
|
74
|
+
)
|
|
75
|
+
.then((sessions) => {
|
|
76
|
+
if (!cancelled) {
|
|
77
|
+
const session = Object.values(sessions).find(
|
|
78
|
+
(session) => session.session_id === sessionId,
|
|
79
|
+
);
|
|
80
|
+
setLookup(
|
|
81
|
+
session
|
|
82
|
+
? { sessionId, status: "ready", notebookId: session.notebook_id }
|
|
83
|
+
: { sessionId, status: "error" },
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.catch(() => {
|
|
88
|
+
if (!cancelled) {
|
|
89
|
+
setLookup({ sessionId, status: "error" });
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return () => {
|
|
93
|
+
cancelled = true;
|
|
94
|
+
};
|
|
95
|
+
}, [hostEnabled, stableSessionId]);
|
|
96
|
+
const currentLookup =
|
|
97
|
+
lookup?.sessionId === stableSessionId ? lookup : undefined;
|
|
98
|
+
const verified = !hostEnabled || currentLookup?.status === "ready";
|
|
99
|
+
const notebookId =
|
|
100
|
+
hostEnabled && currentLookup?.status === "ready"
|
|
101
|
+
? currentLookup.notebookId
|
|
102
|
+
: undefined;
|
|
103
|
+
const targetReady = Boolean(stableSessionId) && verified;
|
|
58
104
|
const authToken = useAuthToken();
|
|
59
105
|
const hasToken = Boolean(authToken);
|
|
60
106
|
const connection: ConnectionInfo = {
|
|
61
107
|
url: runtimeManager.httpURL.toString(),
|
|
62
|
-
|
|
63
|
-
session:
|
|
108
|
+
notebook: notebookId ?? undefined,
|
|
109
|
+
session:
|
|
110
|
+
targetReady && !notebookId ? (stableSessionId ?? undefined) : undefined,
|
|
64
111
|
};
|
|
65
112
|
|
|
66
113
|
return (
|
|
@@ -83,6 +130,13 @@ export const PairWithAgentModal: React.FC<{
|
|
|
83
130
|
</DialogHeader>
|
|
84
131
|
|
|
85
132
|
<div className="flex flex-col gap-4 py-2">
|
|
133
|
+
{!targetReady && (
|
|
134
|
+
<output className="text-sm text-muted-foreground">
|
|
135
|
+
{currentLookup?.status === "error"
|
|
136
|
+
? "Could not verify this notebook. Close this dialog and try again."
|
|
137
|
+
: "Waiting for the notebook connection…"}
|
|
138
|
+
</output>
|
|
139
|
+
)}
|
|
86
140
|
<Tabs
|
|
87
141
|
value={activeTab}
|
|
88
142
|
onValueChange={(v) => setActiveTab(v as AgentTab)}
|
|
@@ -101,30 +155,27 @@ export const PairWithAgentModal: React.FC<{
|
|
|
101
155
|
value={tab}
|
|
102
156
|
className="mt-4 flex flex-col gap-4"
|
|
103
157
|
>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<Step index={commandStep} title="Run in your terminal">
|
|
158
|
+
<Step
|
|
159
|
+
index={1}
|
|
160
|
+
title="Run in your terminal"
|
|
161
|
+
hint={
|
|
162
|
+
hostEnabled && tab === "opencode"
|
|
163
|
+
? "Agent connections require OpenCode 2.x."
|
|
164
|
+
: undefined
|
|
165
|
+
}
|
|
166
|
+
>
|
|
114
167
|
<CommandBlock
|
|
115
168
|
command={getTerminalCommand(
|
|
116
169
|
tab,
|
|
117
170
|
connection,
|
|
118
171
|
hasToken,
|
|
119
|
-
|
|
172
|
+
config,
|
|
120
173
|
)}
|
|
174
|
+
disabled={!targetReady}
|
|
121
175
|
/>
|
|
122
176
|
</Step>
|
|
123
177
|
{hasToken && authToken && (
|
|
124
|
-
<Step
|
|
125
|
-
index={commandStep + 1}
|
|
126
|
-
title="Paste when prompted for a token"
|
|
127
|
-
>
|
|
178
|
+
<Step index={2} title="Paste when prompted for a token">
|
|
128
179
|
<CommandBlock
|
|
129
180
|
command={authToken}
|
|
130
181
|
display={maskToken(authToken)}
|
|
@@ -136,17 +187,8 @@ export const PairWithAgentModal: React.FC<{
|
|
|
136
187
|
))}
|
|
137
188
|
|
|
138
189
|
<TabsContent value="prompt" className="mt-4 flex flex-col gap-4">
|
|
139
|
-
{!preview && (
|
|
140
|
-
<Step
|
|
141
|
-
index={1}
|
|
142
|
-
title="Make sure the marimo-pair skill is available to your agent"
|
|
143
|
-
hint="Skip if your agent already has it."
|
|
144
|
-
>
|
|
145
|
-
<CommandBlock command={SKILL_INSTALL} />
|
|
146
|
-
</Step>
|
|
147
|
-
)}
|
|
148
190
|
<Step
|
|
149
|
-
index={
|
|
191
|
+
index={1}
|
|
150
192
|
title="Copy this prompt into your agent"
|
|
151
193
|
hint={
|
|
152
194
|
hasToken
|
|
@@ -155,13 +197,14 @@ export const PairWithAgentModal: React.FC<{
|
|
|
155
197
|
}
|
|
156
198
|
>
|
|
157
199
|
<CommandBlock
|
|
158
|
-
command={getRawPrompt(connection, authToken,
|
|
200
|
+
command={getRawPrompt(connection, authToken, config)}
|
|
159
201
|
display={getRawPrompt(
|
|
160
202
|
connection,
|
|
161
203
|
authToken ? maskToken(authToken) : null,
|
|
162
|
-
|
|
204
|
+
config,
|
|
163
205
|
)}
|
|
164
206
|
multiline={true}
|
|
207
|
+
disabled={!targetReady}
|
|
165
208
|
/>
|
|
166
209
|
</Step>
|
|
167
210
|
</TabsContent>
|
|
@@ -199,11 +242,21 @@ const CommandBlock: React.FC<{
|
|
|
199
242
|
display?: string;
|
|
200
243
|
multiline?: boolean;
|
|
201
244
|
copyLabel?: string;
|
|
202
|
-
|
|
245
|
+
disabled?: boolean;
|
|
246
|
+
}> = ({
|
|
247
|
+
command,
|
|
248
|
+
display,
|
|
249
|
+
multiline = false,
|
|
250
|
+
copyLabel = "Copy command",
|
|
251
|
+
disabled = false,
|
|
252
|
+
}) => {
|
|
203
253
|
const [copied, setCopied] = useState(false);
|
|
204
254
|
|
|
205
255
|
const copy = Events.stopPropagation(async (e) => {
|
|
206
256
|
e.preventDefault();
|
|
257
|
+
if (disabled) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
207
260
|
await copyToClipboard(command);
|
|
208
261
|
setCopied(true);
|
|
209
262
|
setTimeout(() => setCopied(false), 2000);
|
|
@@ -218,6 +271,7 @@ const CommandBlock: React.FC<{
|
|
|
218
271
|
<Tooltip content="Copied!" open={copied}>
|
|
219
272
|
<Button
|
|
220
273
|
aria-label="Copy prompt"
|
|
274
|
+
disabled={disabled}
|
|
221
275
|
onClick={copy}
|
|
222
276
|
size="xs"
|
|
223
277
|
variant="ghost"
|
|
@@ -240,7 +294,13 @@ const CommandBlock: React.FC<{
|
|
|
240
294
|
{display ?? command}
|
|
241
295
|
</code>
|
|
242
296
|
<Tooltip content="Copied!" open={copied}>
|
|
243
|
-
<Button
|
|
297
|
+
<Button
|
|
298
|
+
aria-label={copyLabel}
|
|
299
|
+
onClick={copy}
|
|
300
|
+
size="xs"
|
|
301
|
+
variant="ghost"
|
|
302
|
+
disabled={disabled}
|
|
303
|
+
>
|
|
244
304
|
{copied ? (
|
|
245
305
|
<CheckIcon size={14} strokeWidth={1.5} />
|
|
246
306
|
) : (
|
|
@@ -106,9 +106,9 @@ export const AddCellWithAI: React.FC<{
|
|
|
106
106
|
const runtimeManager = useRuntimeManager();
|
|
107
107
|
|
|
108
108
|
const inputRef = useRef<ReactCodeMirrorRef>(null);
|
|
109
|
-
const submissionController =
|
|
110
|
-
new StagedCellSubmissionController(),
|
|
111
|
-
)
|
|
109
|
+
const [submissionController] = useState(
|
|
110
|
+
() => new StagedCellSubmissionController(),
|
|
111
|
+
);
|
|
112
112
|
|
|
113
113
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
114
114
|
const { files, addFiles, removeFile } = useFileState();
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
// @vitest-environment jsdom
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
act,
|
|
6
|
+
fireEvent,
|
|
7
|
+
render,
|
|
8
|
+
screen,
|
|
9
|
+
waitFor,
|
|
10
|
+
} from "@testing-library/react";
|
|
11
|
+
import { atom, createStore, Provider } from "jotai";
|
|
12
|
+
import { userEvent } from "storybook/test";
|
|
13
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
14
|
+
import { PAIR_CONFIG } from "@/__tests__/fixtures/pair-config";
|
|
15
|
+
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
16
|
+
import { toast } from "@/components/ui/use-toast";
|
|
17
|
+
import type { Attachment } from "@/core/attachments/state";
|
|
18
|
+
import { pairConfigAtom } from "@/core/config/pair";
|
|
19
|
+
import {
|
|
20
|
+
type StableSessionId,
|
|
21
|
+
stableSessionIdAtom,
|
|
22
|
+
} from "@/core/kernel/session";
|
|
23
|
+
import { API } from "@/core/network/api";
|
|
24
|
+
import { connectionAtom } from "@/core/network/connection";
|
|
25
|
+
import { notebookClientAtom } from "@/core/websocket/state";
|
|
26
|
+
import { ConnectionState } from "@/core/websocket/types";
|
|
27
|
+
import { Deferred } from "@/utils/Deferred";
|
|
28
|
+
import { AttachmentStatus } from "../footer-items/attachment-status";
|
|
29
|
+
|
|
30
|
+
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
|
|
31
|
+
vi.mock("@/core/network/api", () => ({ API: { post: vi.fn() } }));
|
|
32
|
+
|
|
33
|
+
const attachmentsAtom = atom<Attachment[]>([]);
|
|
34
|
+
|
|
35
|
+
const AGENT: Attachment = {
|
|
36
|
+
id: "a1",
|
|
37
|
+
kind: "agent",
|
|
38
|
+
name: "Pi",
|
|
39
|
+
since: new Date().toISOString(),
|
|
40
|
+
notebook_id: "nb-one",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function renderStatus(attachments: Attachment[] = [AGENT], preview = true) {
|
|
44
|
+
const store = createStore();
|
|
45
|
+
store.set(connectionAtom, { state: ConnectionState.OPEN });
|
|
46
|
+
store.set(pairConfigAtom, { ...PAIR_CONFIG, hostEnabled: preview });
|
|
47
|
+
store.set(notebookClientAtom, {
|
|
48
|
+
connectionAtom: atom({ state: ConnectionState.OPEN }),
|
|
49
|
+
documentAtom: atom(null),
|
|
50
|
+
attachmentsAtom,
|
|
51
|
+
reconnect: async () => undefined,
|
|
52
|
+
});
|
|
53
|
+
store.set(attachmentsAtom, attachments);
|
|
54
|
+
store.set(stableSessionIdAtom, "stable/test" as StableSessionId);
|
|
55
|
+
return {
|
|
56
|
+
store,
|
|
57
|
+
...render(
|
|
58
|
+
<Provider store={store}>
|
|
59
|
+
<TooltipProvider>
|
|
60
|
+
<AttachmentStatus />
|
|
61
|
+
</TooltipProvider>
|
|
62
|
+
</Provider>,
|
|
63
|
+
),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
describe("AttachmentStatus", () => {
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
vi.clearAllMocks();
|
|
70
|
+
vi.mocked(API.post).mockResolvedValue("");
|
|
71
|
+
vi.mocked(toast).mockReturnValue({
|
|
72
|
+
id: "notice",
|
|
73
|
+
dismiss: vi.fn(),
|
|
74
|
+
update: vi.fn(),
|
|
75
|
+
upsert: vi.fn(),
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
afterEach(() => {
|
|
80
|
+
vi.useRealTimers();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("renders nothing when host is disabled", () => {
|
|
84
|
+
expect(renderStatus([AGENT], false).container).toBeEmptyDOMElement();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("renders nothing without agents", () => {
|
|
88
|
+
expect(
|
|
89
|
+
renderStatus([{ ...AGENT, kind: "client" }]).container,
|
|
90
|
+
).toBeEmptyDOMElement();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("lists each agent by its self-described name", () => {
|
|
94
|
+
renderStatus([
|
|
95
|
+
AGENT,
|
|
96
|
+
{ ...AGENT, id: "a2", name: "Claude Code" },
|
|
97
|
+
{ ...AGENT, id: "c1", kind: "client", name: "Browser" },
|
|
98
|
+
]);
|
|
99
|
+
expect(screen.getAllByTestId("footer-attachment-status")).toHaveLength(1);
|
|
100
|
+
expect(screen.getByLabelText("2 agents connected")).toBeInTheDocument();
|
|
101
|
+
expect(screen.getByRole("heading", { name: "Pi" })).toBeInTheDocument();
|
|
102
|
+
expect(
|
|
103
|
+
screen.getByRole("heading", { name: "Claude Code" }),
|
|
104
|
+
).toBeInTheDocument();
|
|
105
|
+
expect(screen.getByText("a1")).toBeInTheDocument();
|
|
106
|
+
expect(screen.getByText("a2")).toBeInTheDocument();
|
|
107
|
+
expect(screen.queryByText("Browser")).not.toBeInTheDocument();
|
|
108
|
+
expect(screen.getAllByText(/^Connected /)).toHaveLength(2);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("uses Agent when no name was supplied", () => {
|
|
112
|
+
renderStatus([{ ...AGENT, name: null }]);
|
|
113
|
+
expect(screen.getByLabelText("Agent connected")).toBeInTheDocument();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it.each(["{Enter}", " "])("opens from the keyboard with %j", async (key) => {
|
|
117
|
+
vi.useFakeTimers();
|
|
118
|
+
renderStatus();
|
|
119
|
+
act(() => vi.advanceTimersByTime(3000));
|
|
120
|
+
vi.useRealTimers();
|
|
121
|
+
const user = userEvent.setup();
|
|
122
|
+
const button = screen.getByRole("button", { name: "Pi connected" });
|
|
123
|
+
expect(button.tagName).toBe("BUTTON");
|
|
124
|
+
expect(button).toHaveAttribute("type", "button");
|
|
125
|
+
await user.tab();
|
|
126
|
+
expect(button).toHaveFocus();
|
|
127
|
+
await user.keyboard(key);
|
|
128
|
+
expect(button).toHaveAttribute("aria-expanded", "true");
|
|
129
|
+
expect(screen.getByText(/^Connected /)).toBeInTheDocument();
|
|
130
|
+
await user.keyboard("{Escape}");
|
|
131
|
+
expect(button).toHaveAttribute("aria-expanded", "false");
|
|
132
|
+
expect(button).toHaveFocus();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("opens for three seconds on connection without moving editor focus", () => {
|
|
136
|
+
vi.useFakeTimers();
|
|
137
|
+
const { store } = renderStatus([]);
|
|
138
|
+
const editor = document.createElement("textarea");
|
|
139
|
+
document.body.append(editor);
|
|
140
|
+
editor.focus();
|
|
141
|
+
act(() => store.set(attachmentsAtom, [AGENT]));
|
|
142
|
+
const trigger = screen.getByRole("button", { name: "Pi connected" });
|
|
143
|
+
expect(trigger).toHaveAttribute("aria-expanded", "true");
|
|
144
|
+
expect(editor).toHaveFocus();
|
|
145
|
+
act(() => vi.advanceTimersByTime(3000));
|
|
146
|
+
expect(trigger).toHaveAttribute("aria-expanded", "false");
|
|
147
|
+
expect(editor).toHaveFocus();
|
|
148
|
+
editor.remove();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("reopens on a new agent but not a metadata update or disconnection", () => {
|
|
152
|
+
vi.useFakeTimers();
|
|
153
|
+
const { store } = renderStatus();
|
|
154
|
+
act(() => vi.advanceTimersByTime(3000));
|
|
155
|
+
act(() => store.set(attachmentsAtom, [{ ...AGENT, name: "New name" }]));
|
|
156
|
+
expect(screen.getByLabelText("New name connected")).toHaveAttribute(
|
|
157
|
+
"aria-expanded",
|
|
158
|
+
"false",
|
|
159
|
+
);
|
|
160
|
+
act(() => store.set(attachmentsAtom, [AGENT, { ...AGENT, id: "a2" }]));
|
|
161
|
+
expect(screen.getByLabelText("2 agents connected")).toHaveAttribute(
|
|
162
|
+
"aria-expanded",
|
|
163
|
+
"true",
|
|
164
|
+
);
|
|
165
|
+
act(() => vi.advanceTimersByTime(3000));
|
|
166
|
+
act(() => store.set(attachmentsAtom, [AGENT]));
|
|
167
|
+
expect(screen.getByLabelText("Pi connected")).toHaveAttribute(
|
|
168
|
+
"aria-expanded",
|
|
169
|
+
"false",
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("keeps manually opened details open past the automatic timeout", () => {
|
|
174
|
+
vi.useFakeTimers();
|
|
175
|
+
renderStatus();
|
|
176
|
+
const trigger = screen.getByLabelText("Pi connected");
|
|
177
|
+
fireEvent.click(trigger);
|
|
178
|
+
fireEvent.click(trigger);
|
|
179
|
+
act(() => vi.advanceTimersByTime(5000));
|
|
180
|
+
expect(trigger).toHaveAttribute("aria-expanded", "true");
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("keeps manual confirmation open when another agent connects", () => {
|
|
184
|
+
vi.useFakeTimers();
|
|
185
|
+
const { store } = renderStatus();
|
|
186
|
+
const trigger = screen.getByLabelText("Pi connected");
|
|
187
|
+
fireEvent.click(trigger);
|
|
188
|
+
fireEvent.click(trigger);
|
|
189
|
+
fireEvent.click(screen.getByRole("button", { name: "Disconnect Pi" }));
|
|
190
|
+
act(() =>
|
|
191
|
+
store.set(attachmentsAtom, [
|
|
192
|
+
AGENT,
|
|
193
|
+
{ ...AGENT, id: "a2", name: "Claude" },
|
|
194
|
+
]),
|
|
195
|
+
);
|
|
196
|
+
act(() => vi.advanceTimersByTime(5000));
|
|
197
|
+
expect(
|
|
198
|
+
screen.getByRole("button", { name: "Confirm disconnect Pi" }),
|
|
199
|
+
).toBeInTheDocument();
|
|
200
|
+
expect(API.post).not.toHaveBeenCalled();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("keeps focused details open when another agent connects", () => {
|
|
204
|
+
vi.useFakeTimers();
|
|
205
|
+
const { store } = renderStatus();
|
|
206
|
+
act(() => screen.getByRole("button", { name: "Disconnect Pi" }).focus());
|
|
207
|
+
act(() => store.set(attachmentsAtom, [AGENT, { ...AGENT, id: "a2" }]));
|
|
208
|
+
act(() => vi.advanceTimersByTime(5000));
|
|
209
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("keeps hovered details open when another agent connects", () => {
|
|
213
|
+
vi.useFakeTimers();
|
|
214
|
+
const { store } = renderStatus();
|
|
215
|
+
fireEvent.pointerEnter(screen.getByRole("dialog"));
|
|
216
|
+
act(() => store.set(attachmentsAtom, [AGENT, { ...AGENT, id: "a2" }]));
|
|
217
|
+
act(() => vi.advanceTimersByTime(5000));
|
|
218
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it("pauses the automatic close while the pointer is over the details", () => {
|
|
222
|
+
vi.useFakeTimers();
|
|
223
|
+
renderStatus();
|
|
224
|
+
const details = screen.getByRole("dialog");
|
|
225
|
+
fireEvent.pointerEnter(details);
|
|
226
|
+
act(() => vi.advanceTimersByTime(5000));
|
|
227
|
+
expect(screen.getByLabelText("Pi connected")).toHaveAttribute(
|
|
228
|
+
"aria-expanded",
|
|
229
|
+
"true",
|
|
230
|
+
);
|
|
231
|
+
fireEvent.pointerLeave(details);
|
|
232
|
+
act(() => vi.advanceTimersByTime(3000));
|
|
233
|
+
expect(screen.getByLabelText("Pi connected")).toHaveAttribute(
|
|
234
|
+
"aria-expanded",
|
|
235
|
+
"false",
|
|
236
|
+
);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it("groups identities while keeping separate attachment rows", () => {
|
|
240
|
+
renderStatus([
|
|
241
|
+
{ ...AGENT, identity: "same" },
|
|
242
|
+
{ ...AGENT, id: "a2", identity: "same" },
|
|
243
|
+
]);
|
|
244
|
+
expect(screen.getByLabelText("Pi connected")).toBeInTheDocument();
|
|
245
|
+
expect(
|
|
246
|
+
screen.getAllByRole("button", { name: "Disconnect Pi" }),
|
|
247
|
+
).toHaveLength(2);
|
|
248
|
+
for (const text of screen.getAllByText(/^Connected /)) {
|
|
249
|
+
expect(text).not.toHaveTextContent("Invalid Date");
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("keeps the popover closed across a same-identity reconnect gap", () => {
|
|
254
|
+
vi.useFakeTimers();
|
|
255
|
+
const { store } = renderStatus([{ ...AGENT, identity: "same" }]);
|
|
256
|
+
act(() => vi.advanceTimersByTime(3000));
|
|
257
|
+
act(() => store.set(attachmentsAtom, []));
|
|
258
|
+
act(() =>
|
|
259
|
+
store.set(attachmentsAtom, [{ ...AGENT, id: "a2", identity: "same" }]),
|
|
260
|
+
);
|
|
261
|
+
expect(screen.getByLabelText("Pi connected")).toHaveAttribute(
|
|
262
|
+
"aria-expanded",
|
|
263
|
+
"false",
|
|
264
|
+
);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it("disconnects only the selected attachment and waits for the server update", async () => {
|
|
268
|
+
const { store } = renderStatus([
|
|
269
|
+
AGENT,
|
|
270
|
+
{ ...AGENT, id: "a2", name: "Codex" },
|
|
271
|
+
]);
|
|
272
|
+
fireEvent.click(screen.getByRole("button", { name: "Disconnect Pi" }));
|
|
273
|
+
expect(API.post).not.toHaveBeenCalled();
|
|
274
|
+
fireEvent.click(
|
|
275
|
+
screen.getByRole("button", { name: "Confirm disconnect Pi" }),
|
|
276
|
+
);
|
|
277
|
+
await waitFor(() =>
|
|
278
|
+
expect(API.post).toHaveBeenCalledWith(
|
|
279
|
+
"/pair/notebooks/stable%2Ftest/attachments/detach",
|
|
280
|
+
{ attachment_id: "a1" },
|
|
281
|
+
),
|
|
282
|
+
);
|
|
283
|
+
expect(screen.getByLabelText("2 agents connected")).toBeInTheDocument();
|
|
284
|
+
act(() =>
|
|
285
|
+
store.set(attachmentsAtom, [{ ...AGENT, id: "a2", name: "Codex" }]),
|
|
286
|
+
);
|
|
287
|
+
expect(screen.getByLabelText("Codex connected")).toBeInTheDocument();
|
|
288
|
+
expect(
|
|
289
|
+
screen.queryByRole("button", { name: "Disconnect Pi" }),
|
|
290
|
+
).not.toBeInTheDocument();
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it("disables duplicate disconnects while pending", async () => {
|
|
294
|
+
const deferred = new Deferred<string>();
|
|
295
|
+
vi.mocked(API.post).mockReturnValue(deferred.promise);
|
|
296
|
+
renderStatus();
|
|
297
|
+
const button = screen.getByRole("button", { name: "Disconnect Pi" });
|
|
298
|
+
fireEvent.click(button);
|
|
299
|
+
fireEvent.click(
|
|
300
|
+
screen.getByRole("button", { name: "Confirm disconnect Pi" }),
|
|
301
|
+
);
|
|
302
|
+
expect(button).toBeDisabled();
|
|
303
|
+
expect(
|
|
304
|
+
screen.getByRole("button", { name: "Cancel disconnect Pi" }),
|
|
305
|
+
).toBeDisabled();
|
|
306
|
+
fireEvent.click(button);
|
|
307
|
+
expect(API.post).toHaveBeenCalledOnce();
|
|
308
|
+
await act(async () => deferred.resolve(""));
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
it("shows disconnect failures and retains the attachment", async () => {
|
|
312
|
+
vi.mocked(API.post).mockRejectedValue(new Error("offline"));
|
|
313
|
+
renderStatus();
|
|
314
|
+
fireEvent.click(screen.getByRole("button", { name: "Disconnect Pi" }));
|
|
315
|
+
fireEvent.click(
|
|
316
|
+
screen.getByRole("button", { name: "Confirm disconnect Pi" }),
|
|
317
|
+
);
|
|
318
|
+
await waitFor(() =>
|
|
319
|
+
expect(toast).toHaveBeenCalledWith({
|
|
320
|
+
variant: "danger",
|
|
321
|
+
title: "Could not disconnect Pi",
|
|
322
|
+
duration: 5000,
|
|
323
|
+
}),
|
|
324
|
+
);
|
|
325
|
+
expect(screen.getByLabelText("Pi connected")).toBeInTheDocument();
|
|
326
|
+
expect(screen.getByRole("button", { name: "Disconnect Pi" })).toBeEnabled();
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
it("cancels confirmation without disconnecting and restores focus", () => {
|
|
330
|
+
renderStatus();
|
|
331
|
+
fireEvent.click(screen.getByRole("button", { name: "Disconnect Pi" }));
|
|
332
|
+
expect(screen.getByText("Disconnect?")).toBeVisible();
|
|
333
|
+
expect(
|
|
334
|
+
screen.getByRole("button", { name: "Confirm disconnect Pi" }),
|
|
335
|
+
).toBeEnabled();
|
|
336
|
+
fireEvent.click(
|
|
337
|
+
screen.getByRole("button", { name: "Cancel disconnect Pi" }),
|
|
338
|
+
);
|
|
339
|
+
expect(API.post).not.toHaveBeenCalled();
|
|
340
|
+
expect(screen.getByRole("button", { name: "Disconnect Pi" })).toHaveFocus();
|
|
341
|
+
expect(
|
|
342
|
+
screen.queryByRole("button", { name: "Confirm disconnect Pi" }),
|
|
343
|
+
).not.toBeInTheDocument();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
it("disables disconnect without a stable session ID", () => {
|
|
347
|
+
const { store } = renderStatus();
|
|
348
|
+
act(() => store.set(stableSessionIdAtom, null));
|
|
349
|
+
expect(
|
|
350
|
+
screen.getByRole("button", { name: "Disconnect Pi" }),
|
|
351
|
+
).toBeDisabled();
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it("removes detached agents when the list is replaced", () => {
|
|
355
|
+
const { store, container } = renderStatus([
|
|
356
|
+
AGENT,
|
|
357
|
+
{ ...AGENT, id: "a2", name: "Claude Code" },
|
|
358
|
+
]);
|
|
359
|
+
act(() => store.set(attachmentsAtom, [AGENT]));
|
|
360
|
+
expect(
|
|
361
|
+
screen.queryByRole("heading", { name: "Claude Code" }),
|
|
362
|
+
).not.toBeInTheDocument();
|
|
363
|
+
act(() => store.set(attachmentsAtom, []));
|
|
364
|
+
expect(container).toBeEmptyDOMElement();
|
|
365
|
+
});
|
|
366
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import type React from "react";
|
|
4
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
4
5
|
import { forwardRef } from "react";
|
|
5
6
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
6
7
|
import { cn } from "@/utils/cn";
|
|
@@ -8,36 +9,43 @@ import { cn } from "@/utils/cn";
|
|
|
8
9
|
type FooterItemProps = {
|
|
9
10
|
selected: boolean;
|
|
10
11
|
tooltip: React.ReactNode;
|
|
12
|
+
asChild?: boolean;
|
|
11
13
|
} & React.HTMLAttributes<HTMLDivElement>;
|
|
12
14
|
|
|
13
15
|
export const FooterItem: React.FC<FooterItemProps> = forwardRef<
|
|
14
16
|
HTMLDivElement,
|
|
15
17
|
FooterItemProps
|
|
16
|
-
>(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{content}
|
|
36
|
-
</Tooltip>
|
|
18
|
+
>(
|
|
19
|
+
(
|
|
20
|
+
{ children, tooltip, selected, className, asChild = false, ...rest },
|
|
21
|
+
ref,
|
|
22
|
+
) => {
|
|
23
|
+
const Component = asChild ? SlotPrimitive.Slot : "div";
|
|
24
|
+
const content = (
|
|
25
|
+
<Component
|
|
26
|
+
ref={ref}
|
|
27
|
+
className={cn(
|
|
28
|
+
"h-full flex items-center p-2 text-sm shadow-inset font-mono cursor-pointer rounded",
|
|
29
|
+
!selected && "hover:bg-(--sage-3)",
|
|
30
|
+
selected && "bg-(--sage-4)",
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
{...rest}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</Component>
|
|
37
37
|
);
|
|
38
|
-
}
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (tooltip) {
|
|
40
|
+
return (
|
|
41
|
+
<Tooltip content={tooltip} side="top" delayDuration={200}>
|
|
42
|
+
{content}
|
|
43
|
+
</Tooltip>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return content;
|
|
48
|
+
},
|
|
49
|
+
);
|
|
42
50
|
|
|
43
51
|
FooterItem.displayName = "FooterItem";
|