@marimo-team/frontend 0.25.3-dev20 → 0.25.3-dev21
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-DVOHpdeJ.js → CellStatus-O0rU3_5j.js} +1 -1
- package/dist/assets/{ErrorBoundary-CM13wrd8.js → ErrorBoundary-BkSCfv3B.js} +2 -2
- package/dist/assets/{JsonOutput-Cx1iyibB.js → JsonOutput-Dq6MGIMV.js} +5 -5
- package/dist/assets/MarimoErrorOutput-BLtCVffa.js +10 -0
- package/dist/assets/{RenderHTML-DX6i99Op.js → RenderHTML-PtQ99V0D.js} +1 -1
- package/dist/assets/{RunButton-BKoh0zYG.js → RunButton-B8KRdPZ-.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BpD_790A.js → add-cell-with-ai-BOBZjUxI.js} +5 -5
- package/dist/assets/{add-connection-dialog-B1BXCjex.js → add-connection-dialog-DP62zXw2.js} +1 -1
- package/dist/assets/{agent-panel-CDFUc1uu.js → agent-panel-BFul7UiF.js} +1 -1
- package/dist/assets/{ai-model-dropdown-i1vfGeVi.js → ai-model-dropdown-sTKkdrbX.js} +3 -3
- package/dist/assets/{app-config-button-AdV-QDD7.js → app-config-button-Bp44UZdD.js} +1 -1
- package/dist/assets/{blob-BG8yoQmx.js → blob-ykpU69Lk.js} +1 -1
- package/dist/assets/{cell-editor-BKJ06H5F.js → cell-editor-B7YlotyH.js} +8 -8
- package/dist/assets/cell-link-CmO9D2a2.js +1 -0
- package/dist/assets/cells-BMs-CYDt.js +220 -0
- package/dist/assets/{chat-display-DhgI2MS9.js → chat-display-Dw8HQAAY.js} +1 -1
- package/dist/assets/{chat-panel-Cau71Ygr.js → chat-panel-DPDZrfoJ.js} +2 -2
- package/dist/assets/{chat-ui-C5ql1Up-.js → chat-ui-BxnFw9Za.js} +1 -1
- package/dist/assets/code-visibility-CGVmpSdE.js +1 -0
- package/dist/assets/{column-preview-BZ_iNhtJ.js → column-preview-BQ4k86Lv.js} +1 -1
- package/dist/assets/{command-palette-DDC3kBet.js → command-palette-BfxYnBUD.js} +1 -1
- package/dist/assets/{common-Sl3uthjg.js → common-CzWTWhcY.js} +1 -1
- package/dist/assets/{components-3cou6Mka.js → components-C-p2nJ78.js} +1 -1
- package/dist/assets/config-BtRLgrlt.js +104 -0
- package/dist/assets/{config-DRIpOKqh.js → config-CMUeR8Wr.js} +1 -1
- package/dist/assets/{datasource-DfbNb83e.js → datasource-CEDUN47W.js} +1 -1
- package/dist/assets/{dependency-graph-panel-L5cBE5sl.js → dependency-graph-panel-KWuUrABU.js} +1 -1
- package/dist/assets/{documentation-panel-D7S8JIc2.js → documentation-panel-T1wYs9YS.js} +1 -1
- package/dist/assets/{download-C03FOElq.js → download-Bt4rM2gS.js} +1 -1
- package/dist/assets/{edit-page-CLF_VUTW.js → edit-page-DIxL37jf.js} +6 -6
- package/dist/assets/{error-entries-CLnPDv7b.js → error-entries-CQTemuon.js} +1 -1
- package/dist/assets/{error-panel-D2xrYLue.js → error-panel-BmlN965r.js} +1 -1
- package/dist/assets/{feedback-button-DzPunIqU.js → feedback-button-CO89l9HJ.js} +2 -2
- package/dist/assets/feedback-button-QWfd9e1X.js +1 -0
- package/dist/assets/{file-explorer-panel-Uk4_QIJQ.js → file-explorer-panel-Bs25Xwng.js} +1 -1
- package/dist/assets/{file-name-input-B4fRaQkI.js → file-name-input-DgR3ynbz.js} +1 -1
- package/dist/assets/{floating-outline-B5MaM1JS.js → floating-outline-kOJ_XOxZ.js} +1 -1
- package/dist/assets/{gallery-page-BefvdsM7.js → gallery-page--AiS7R2S.js} +1 -1
- package/dist/assets/{glide-data-editor-C3eaYlXg.js → glide-data-editor-FopeFe04.js} +1 -1
- package/dist/assets/{home-page-hmvKlc1w.js → home-page-DEUEDKZQ.js} +1 -1
- package/dist/assets/hooks-CsCHI0xl.js +1 -0
- package/dist/assets/{index-CMx5iSyu.js → index-BXheV3uz.js} +9 -9
- package/dist/assets/{layout-Ck1RoL1B.js → layout-CcQIAduN.js} +5 -5
- package/dist/assets/{logs-panel-BRytaWaO.js → logs-panel-Cj-mRfbP.js} +1 -1
- package/dist/assets/{markdown-renderer-DX0Xrrfy.js → markdown-renderer-Dg2Tj8xg.js} +1 -1
- package/dist/assets/{name-cell-input-DlpTvPLa.js → name-cell-input-DhWcLBL9.js} +1 -1
- package/dist/assets/{outline-panel-B2WIpz-1.js → outline-panel-DCCN7CCz.js} +1 -1
- package/dist/assets/{packages-panel-CI5ff9b-.js → packages-panel-cI3VRnI0.js} +1 -1
- package/dist/assets/{panel-accordion-state-BqSH5ttk.js → panel-accordion-state-CrUAB8rV.js} +1 -1
- package/dist/assets/panels-DeK2CjCU.js +4 -0
- package/dist/assets/{process-output-f3C3PD0Z.js → process-output-C0AVlTcL.js} +1 -1
- package/dist/assets/{readonly-code-display-MnMEoYW5.js → readonly-code-display-CEGKPKlf.js} +1 -1
- package/dist/assets/{readonly-python-code-ggs4hAzC.js → readonly-python-code-kOLuuvuL.js} +1 -1
- package/dist/assets/{reveal-component-PiV1eQk9.js → reveal-component-m_Q_Dhsa.js} +3 -3
- package/dist/assets/run-page-ZPnT0tT8.js +1 -0
- package/dist/assets/{runtime-details-state-CoL-p0MC.js → runtime-details-state-DRpKx1d7.js} +1 -1
- package/dist/assets/{scratchpad-panel-D2rWg4k8.js → scratchpad-panel-4r5I7_4T.js} +1 -1
- package/dist/assets/session-panel-B-fUHivk.js +1 -0
- package/dist/assets/{snippets-panel-ClGHtEKQ.js → snippets-panel-QqliOy2l.js} +1 -1
- package/dist/assets/state-BAKG3nB6.js +3 -0
- package/dist/assets/{state-DtGB7xeJ.js → state-BiuybHTd.js} +1 -1
- package/dist/assets/{terminal-wnSHYT8N.js → terminal-CP30at9D.js} +3 -3
- package/dist/assets/{tracing-Dz2rYOFL.js → tracing-Cg6nJ9oa.js} +1 -1
- package/dist/assets/{tracing-panel-DqQY9V91.js → tracing-panel-_OkwL3ST.js} +2 -2
- package/dist/assets/{tree-actions-DnUokmva.js → tree-actions-D5U7Yym8.js} +1 -1
- package/dist/assets/{useAddCell-IN24thff.js → useAddCell-C3jdhSc9.js} +1 -1
- package/dist/assets/{useBoolean-d0Tty94N.js → useBoolean-BHCcNH_F.js} +1 -1
- package/dist/assets/{useCellActionButton-DmaFZ4oF.js → useCellActionButton-Db-2kvJ0.js} +1 -1
- package/dist/assets/{useDeleteCell-fQlM46Y2.js → useDeleteCell-D0dwhgwH.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-ImXYINm_.js → useDependencyPanelTab-BjQVPzm0.js} +1 -1
- package/dist/assets/{useInstallPackage-BW06eter.js → useInstallPackage-B-krIeGp.js} +1 -1
- package/dist/assets/useNotebookActions-CY_gTNzg.js +1 -0
- package/dist/assets/{useRunCells-DSJPXE-j.js → useRunCells-Dyf_vzJl.js} +1 -1
- package/dist/assets/{useSplitCell-DQyMF5gd.js → useSplitCell-DA8ujlOv.js} +1 -1
- package/dist/assets/{vega-component-IouMe13t.js → vega-component-CaZvZfgt.js} +1 -1
- package/dist/index.html +30 -30
- package/package.json +1 -1
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +12 -18
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +12 -23
- package/src/core/attachments/state.ts +5 -8
- package/src/core/host/__tests__/attachments.test.ts +57 -0
- package/src/core/host/__tests__/notebook-client.test.ts +131 -1
- package/src/core/host/events.ts +1 -0
- package/src/core/host/notebook-client.ts +20 -2
- package/src/core/host/resources/attachments.ts +19 -0
- package/src/core/islands/__tests__/bootstrap.test.ts +0 -26
- package/src/core/islands/bootstrap.ts +0 -1
- package/src/core/runtime/__tests__/runtime.test.ts +1 -1
- package/src/core/runtime/runtime.ts +4 -3
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +30 -0
- package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +0 -171
- package/src/core/websocket/state.ts +7 -0
- package/src/core/websocket/useNotebookClient.ts +9 -1
- package/src/core/websocket/useNotebookSession.tsx +0 -8
- package/dist/assets/MarimoErrorOutput-s_5GOX8k.js +0 -10
- package/dist/assets/cell-link-8Auigi8P.js +0 -1
- package/dist/assets/cells-C6YGYGdi.js +0 -220
- package/dist/assets/code-visibility-BJImdpDi.js +0 -1
- package/dist/assets/config-Dy28fDwn.js +0 -1
- package/dist/assets/feedback-button-Kla7i5RT.js +0 -1
- package/dist/assets/hooks-DzML9nez.js +0 -1
- package/dist/assets/panels-B_jlikjE.js +0 -107
- package/dist/assets/run-page-CkP22x9D.js +0 -1
- package/dist/assets/session-panel-CnANhcTo.js +0 -1
- package/dist/assets/state-CbjBtkdd.js +0 -3
- package/dist/assets/useNotebookActions-DHt3s-ia.js +0 -1
package/dist/index.html
CHANGED
|
@@ -66,27 +66,27 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-BXheV3uz.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-B0Z9INg1.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/react-DVplv7_D.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-BrajqUja.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="./assets/useEvent-Dfcbgjhg.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-_LrxgvjW.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="./assets/schemas-ChRqMOTL.js">
|
|
76
|
+
<link rel="modulepreload" crossorigin href="./assets/objects-snlMn4yk.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="./assets/useEventListener-D9cftcHj.js">
|
|
78
|
+
<link rel="modulepreload" crossorigin href="./assets/invariant-Ci2dTZ72.js">
|
|
79
|
+
<link rel="modulepreload" crossorigin href="./assets/utils-B4K466FK.js">
|
|
80
|
+
<link rel="modulepreload" crossorigin href="./assets/session-DqoWmb7X.js">
|
|
81
|
+
<link rel="modulepreload" crossorigin href="./assets/Deferred-CrTnjj37.js">
|
|
82
|
+
<link rel="modulepreload" crossorigin href="./assets/config-BtRLgrlt.js">
|
|
76
83
|
<link rel="modulepreload" crossorigin href="./assets/isObject-BCaOs5rp.js">
|
|
77
84
|
<link rel="modulepreload" crossorigin href="./assets/isSymbol-oX0TOjjx.js">
|
|
78
85
|
<link rel="modulepreload" crossorigin href="./assets/now-Cmx0b_zA.js">
|
|
79
86
|
<link rel="modulepreload" crossorigin href="./assets/debounce-aFmHgJZY.js">
|
|
80
87
|
<link rel="modulepreload" crossorigin href="./assets/isArrayLikeObject-DnwgSs_Z.js">
|
|
81
88
|
<link rel="modulepreload" crossorigin href="./assets/_baseMerge-CQpUq7ep.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="./assets/objects-snlMn4yk.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="./assets/useEventListener-D9cftcHj.js">
|
|
84
|
-
<link rel="modulepreload" crossorigin href="./assets/invariant-Ci2dTZ72.js">
|
|
85
89
|
<link rel="modulepreload" crossorigin href="./assets/config-CA1V-wjh.js">
|
|
86
|
-
<link rel="modulepreload" crossorigin href="./assets/utils-B4K466FK.js">
|
|
87
|
-
<link rel="modulepreload" crossorigin href="./assets/session-DqoWmb7X.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="./assets/Deferred-CrTnjj37.js">
|
|
89
|
-
<link rel="modulepreload" crossorigin href="./assets/config-Dy28fDwn.js">
|
|
90
90
|
<link rel="modulepreload" crossorigin href="./assets/clsx-DB0hHKMi.js">
|
|
91
91
|
<link rel="modulepreload" crossorigin href="./assets/cn-ldLVeaqm.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="./assets/jsx-runtime-B74pBk57.js">
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/useTheme-n8Dj1zH7.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-C7aJJz0Y.js">
|
|
141
141
|
<link rel="modulepreload" crossorigin href="./assets/purify.es--06brOip.js">
|
|
142
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
142
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-BMs-CYDt.js">
|
|
143
143
|
<link rel="modulepreload" crossorigin href="./assets/coerce-DWjFeXOY.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/get-DjNf4SIX.js">
|
|
145
145
|
<link rel="modulepreload" crossorigin href="./assets/_hasPath-BmRQipI0.js">
|
|
@@ -147,47 +147,47 @@
|
|
|
147
147
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-Bpdo9AvU.js">
|
|
148
148
|
<link rel="modulepreload" crossorigin href="./assets/pick-DKIID_Mo.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/errors-CNsgAw6m.js">
|
|
150
|
-
<link rel="modulepreload" crossorigin href="./assets/config-
|
|
150
|
+
<link rel="modulepreload" crossorigin href="./assets/config-CMUeR8Wr.js">
|
|
151
151
|
<link rel="modulepreload" crossorigin href="./assets/state-BAJYRhmO.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/state-C3oDoyFe.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-B4fCknq1.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/copy-D8O_CYCG.js">
|
|
155
155
|
<link rel="modulepreload" crossorigin href="./assets/micromark-factory-space-D9Dr-k4J.js">
|
|
156
156
|
<link rel="modulepreload" crossorigin href="./assets/chunk-YOKDWASO-BIpRENEC.js">
|
|
157
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
157
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-Dg2Tj8xg.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/copy-Djr5m5ac.js">
|
|
159
159
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-BIiRXh_3.js">
|
|
160
|
-
<link rel="modulepreload" crossorigin href="./assets/useRunCells-
|
|
161
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
162
|
-
<link rel="modulepreload" crossorigin href="./assets/blob-
|
|
160
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-Dyf_vzJl.js">
|
|
161
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-PtQ99V0D.js">
|
|
162
|
+
<link rel="modulepreload" crossorigin href="./assets/blob-ykpU69Lk.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/kbd-pdKBv96t.js">
|
|
164
|
-
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-
|
|
164
|
+
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-B-krIeGp.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/share-BZW3tzEX.js">
|
|
166
166
|
<link rel="modulepreload" crossorigin href="./assets/events-CbeVJ6OD.js">
|
|
167
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
168
|
-
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-
|
|
167
|
+
<link rel="modulepreload" crossorigin href="./assets/state-BAKG3nB6.js">
|
|
168
|
+
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-BkSCfv3B.js">
|
|
169
169
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-eAtVhbNZ.js">
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-C1rnl-0o.js">
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/html-to-image-DK9Zl1lU.js">
|
|
172
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
172
|
+
<link rel="modulepreload" crossorigin href="./assets/download-Bt4rM2gS.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/switch-CTaiAjrz.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/tabs-BuQlZFbt.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/table-DG7Ap4H4.js">
|
|
176
176
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-CxVozGAC.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-Qw1f8Jhy.js">
|
|
178
|
-
<link rel="modulepreload" crossorigin href="./assets/tree-actions-
|
|
178
|
+
<link rel="modulepreload" crossorigin href="./assets/tree-actions-D5U7Yym8.js">
|
|
179
179
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-63DyBLHQ.js">
|
|
180
180
|
<link rel="modulepreload" crossorigin href="./assets/external-link-UrX9KO36.js">
|
|
181
181
|
<link rel="modulepreload" crossorigin href="./assets/spinner-DyNE-o8o.js">
|
|
182
182
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-C3rKm8_a.js">
|
|
183
183
|
<link rel="modulepreload" crossorigin href="./assets/hat-glasses-C8RhSVii.js">
|
|
184
184
|
<link rel="modulepreload" crossorigin href="./assets/package-GSoSTiIK.js">
|
|
185
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
186
|
-
<link rel="modulepreload" crossorigin href="./assets/error-entries-
|
|
185
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-CEDUN47W.js">
|
|
186
|
+
<link rel="modulepreload" crossorigin href="./assets/error-entries-CQTemuon.js">
|
|
187
187
|
<link rel="modulepreload" crossorigin href="./assets/alert-DTaqCu_d.js">
|
|
188
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
189
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
190
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
188
|
+
<link rel="modulepreload" crossorigin href="./assets/state-BiuybHTd.js">
|
|
189
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-CmO9D2a2.js">
|
|
190
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-BLtCVffa.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/useDateFormatter-DA-62E-Y.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/en-US-Buu61juQ.js">
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/isValid-q_Ad80ug.js">
|
|
@@ -206,13 +206,13 @@
|
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/formats-yZ06h1Pl.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/table-vrvqpuKJ.js">
|
|
208
208
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-Dbe0MrFr.js">
|
|
209
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
209
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-Dq6MGIMV.js">
|
|
210
210
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-C4_v6fQW.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="./assets/square-function-_W_Lo0P4.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="./assets/spec-BfSBcO5B.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="./assets/semaphore-BjoL5P0h.js">
|
|
214
214
|
<link rel="modulepreload" crossorigin href="./assets/fileToBase64-BgBraYAr.js">
|
|
215
|
-
<link rel="modulepreload" crossorigin href="./assets/useBoolean-
|
|
215
|
+
<link rel="modulepreload" crossorigin href="./assets/useBoolean-BHCcNH_F.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/code-xml-SQaZqvcO.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/file-headphone-Dl35U6h3.js">
|
|
218
218
|
<link rel="modulepreload" crossorigin href="./assets/file-BPBVl9pl.js">
|
|
@@ -220,11 +220,11 @@
|
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/file-icons-CdJgUy-I.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/globe-UdPdIbF7.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/esm-CI_o7NhW.js">
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/useAddCell-
|
|
224
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/useAddCell-C3jdhSc9.js">
|
|
224
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-kOLuuvuL.js">
|
|
225
225
|
<link rel="modulepreload" crossorigin href="./assets/data-grid-types-DgHVN_Zz.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/glide-utils-CIrAxdjv.js">
|
|
227
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
227
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-BQ4k86Lv.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/square-BPmgQFnh.js">
|
|
229
229
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-DmIqR8sY.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/prop-types-Djf4O40e.js">
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
<link rel="modulepreload" crossorigin href="./assets/icons-CiZ_8zS-.js">
|
|
237
237
|
<link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-DFIVN9dn.js">
|
|
238
238
|
<link rel="modulepreload" crossorigin href="./assets/pathUtils-DPmlLd-r.js">
|
|
239
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
239
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-kOJ_XOxZ.js">
|
|
240
240
|
<link rel="stylesheet" crossorigin href="./assets/cells-0PFKL3SH.css">
|
|
241
241
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DjIHoF9Z.css">
|
|
242
242
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-B0GmlMnR.css">
|
package/package.json
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
screen,
|
|
9
9
|
waitFor,
|
|
10
10
|
} from "@testing-library/react";
|
|
11
|
-
import { createStore, Provider } from "jotai";
|
|
11
|
+
import { atom, createStore, Provider } from "jotai";
|
|
12
12
|
import { userEvent } from "storybook/test";
|
|
13
13
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
14
14
|
import { PAIR_CONFIG } from "@/__tests__/fixtures/pair-config";
|
|
15
15
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
16
16
|
import { toast } from "@/components/ui/use-toast";
|
|
17
|
-
import {
|
|
17
|
+
import type { Attachment } from "@/core/attachments/state";
|
|
18
18
|
import { pairConfigAtom } from "@/core/config/pair";
|
|
19
19
|
import {
|
|
20
20
|
type StableSessionId,
|
|
@@ -22,13 +22,16 @@ import {
|
|
|
22
22
|
} from "@/core/kernel/session";
|
|
23
23
|
import { API } from "@/core/network/api";
|
|
24
24
|
import { connectionAtom } from "@/core/network/connection";
|
|
25
|
-
import {
|
|
25
|
+
import { notebookClientAtom } from "@/core/websocket/state";
|
|
26
|
+
import { ConnectionState } from "@/core/websocket/types";
|
|
26
27
|
import { Deferred } from "@/utils/Deferred";
|
|
27
28
|
import { AttachmentStatus } from "../footer-items/attachment-status";
|
|
28
29
|
|
|
29
30
|
vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
|
|
30
31
|
vi.mock("@/core/network/api", () => ({ API: { post: vi.fn() } }));
|
|
31
32
|
|
|
33
|
+
const attachmentsAtom = atom<Attachment[]>([]);
|
|
34
|
+
|
|
32
35
|
const AGENT: Attachment = {
|
|
33
36
|
id: "a1",
|
|
34
37
|
kind: "agent",
|
|
@@ -41,6 +44,12 @@ function renderStatus(attachments: Attachment[] = [AGENT], preview = true) {
|
|
|
41
44
|
const store = createStore();
|
|
42
45
|
store.set(connectionAtom, { state: ConnectionState.OPEN });
|
|
43
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
|
+
});
|
|
44
53
|
store.set(attachmentsAtom, attachments);
|
|
45
54
|
store.set(stableSessionIdAtom, "stable/test" as StableSessionId);
|
|
46
55
|
return {
|
|
@@ -342,21 +351,6 @@ describe("AttachmentStatus", () => {
|
|
|
342
351
|
).toBeDisabled();
|
|
343
352
|
});
|
|
344
353
|
|
|
345
|
-
it.each([
|
|
346
|
-
{ state: ConnectionState.CONNECTING },
|
|
347
|
-
{ state: ConnectionState.CLOSING },
|
|
348
|
-
{ state: ConnectionState.NOT_STARTED },
|
|
349
|
-
{
|
|
350
|
-
state: ConnectionState.CLOSED,
|
|
351
|
-
code: WebSocketClosedReason.KERNEL_DISCONNECTED,
|
|
352
|
-
reason: "offline",
|
|
353
|
-
},
|
|
354
|
-
])("hides connected claims while the browser is %j", (connection) => {
|
|
355
|
-
const { store, container } = renderStatus();
|
|
356
|
-
act(() => store.set(connectionAtom, connection));
|
|
357
|
-
expect(container).toBeEmptyDOMElement();
|
|
358
|
-
});
|
|
359
|
-
|
|
360
354
|
it("removes detached agents when the list is replaced", () => {
|
|
361
355
|
const { store, container } = renderStatus([
|
|
362
356
|
AGENT,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
screen,
|
|
9
9
|
waitFor,
|
|
10
10
|
} from "@testing-library/react";
|
|
11
|
-
import { createStore, Provider, useAtomValue } from "jotai";
|
|
11
|
+
import { atom, createStore, Provider, useAtomValue } from "jotai";
|
|
12
12
|
import type React from "react";
|
|
13
13
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
14
14
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
@@ -16,7 +16,7 @@ import { cellId } from "@/__tests__/branded";
|
|
|
16
16
|
import { PAIR_CONFIG } from "@/__tests__/fixtures/pair-config";
|
|
17
17
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
18
18
|
import { toast } from "@/components/ui/use-toast";
|
|
19
|
-
import {
|
|
19
|
+
import type { Attachment } from "@/core/attachments/state";
|
|
20
20
|
import { exportedForTesting, notebookAtom } from "@/core/cells/cells";
|
|
21
21
|
import {
|
|
22
22
|
type CellOutputMessage,
|
|
@@ -32,7 +32,8 @@ import {
|
|
|
32
32
|
} from "@/core/kernel/session";
|
|
33
33
|
import { API } from "@/core/network/api";
|
|
34
34
|
import { connectionAtom } from "@/core/network/connection";
|
|
35
|
-
import {
|
|
35
|
+
import { notebookClientAtom } from "@/core/websocket/state";
|
|
36
|
+
import { ConnectionState } from "@/core/websocket/types";
|
|
36
37
|
import { Deferred } from "@/utils/Deferred";
|
|
37
38
|
import { HTTPError } from "@/utils/errors";
|
|
38
39
|
import { MarimoErrorOutput } from "../../output/MarimoErrorOutput";
|
|
@@ -48,6 +49,8 @@ vi.mock("@/components/editor/chrome/wrapper/useOpenAiAssistant", () => ({
|
|
|
48
49
|
|
|
49
50
|
const CELL_ID = cellId("test-cell");
|
|
50
51
|
const STABLE_ID = "stable/test" as StableSessionId;
|
|
52
|
+
const attachmentsAtom = atom<Attachment[]>([]);
|
|
53
|
+
|
|
51
54
|
const AGENT: Attachment = {
|
|
52
55
|
id: "a1",
|
|
53
56
|
kind: "agent",
|
|
@@ -93,6 +96,12 @@ function renderButton({
|
|
|
93
96
|
const store = createStore();
|
|
94
97
|
store.set(connectionAtom, { state: ConnectionState.OPEN });
|
|
95
98
|
store.set(pairConfigAtom, { ...PAIR_CONFIG, hostEnabled: preview });
|
|
99
|
+
store.set(notebookClientAtom, {
|
|
100
|
+
connectionAtom: atom({ state: ConnectionState.OPEN }),
|
|
101
|
+
documentAtom: atom(null),
|
|
102
|
+
attachmentsAtom,
|
|
103
|
+
reconnect: async () => undefined,
|
|
104
|
+
});
|
|
96
105
|
store.set(attachmentsAtom, attachments);
|
|
97
106
|
store.set(stableSessionIdAtom, stableId);
|
|
98
107
|
const wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
@@ -177,26 +186,6 @@ describe("SendErrorReportButton", () => {
|
|
|
177
186
|
expect(screen.getByRole("button")).toBeDisabled();
|
|
178
187
|
});
|
|
179
188
|
|
|
180
|
-
it.each([
|
|
181
|
-
{ state: ConnectionState.CONNECTING },
|
|
182
|
-
{ state: ConnectionState.CLOSING },
|
|
183
|
-
{ state: ConnectionState.NOT_STARTED },
|
|
184
|
-
{
|
|
185
|
-
state: ConnectionState.CLOSED,
|
|
186
|
-
code: WebSocketClosedReason.KERNEL_DISCONNECTED,
|
|
187
|
-
reason: "offline",
|
|
188
|
-
},
|
|
189
|
-
])(
|
|
190
|
-
"does not send from a stale snapshot while the browser is %j",
|
|
191
|
-
(connection) => {
|
|
192
|
-
const { store } = renderButton();
|
|
193
|
-
act(() => store.set(connectionAtom, connection));
|
|
194
|
-
expect(screen.getByRole("button")).toBeDisabled();
|
|
195
|
-
send();
|
|
196
|
-
expect(API.post).not.toHaveBeenCalled();
|
|
197
|
-
},
|
|
198
|
-
);
|
|
199
|
-
|
|
200
189
|
it.each([
|
|
201
190
|
[new HTTPError(409, "Conflict"), "No agent attached"],
|
|
202
191
|
[new HTTPError(500, "Server error"), "Could not send error"],
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import type { components } from "@marimo-team/marimo-api";
|
|
4
3
|
import { atom } from "jotai";
|
|
5
|
-
import {
|
|
4
|
+
import type { Attachment } from "@/core/host/protocol";
|
|
5
|
+
import { notebookClientAtom } from "@/core/websocket/state";
|
|
6
6
|
|
|
7
|
-
export type Attachment
|
|
7
|
+
export type { Attachment } from "@/core/host/protocol";
|
|
8
8
|
|
|
9
|
-
export const attachmentsAtom = atom<Attachment[]>([]);
|
|
10
9
|
export const agentAttachmentsAtom = atom((get) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return get(attachmentsAtom).filter(
|
|
10
|
+
const notebook = get(notebookClientAtom);
|
|
11
|
+
return (notebook ? get(notebook.attachmentsAtom) : []).filter(
|
|
15
12
|
(attachment) => attachment.kind === "agent",
|
|
16
13
|
);
|
|
17
14
|
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import { attachments } from "../resources/attachments";
|
|
5
|
+
import { createStream } from "../stream";
|
|
6
|
+
import { fixtureEvents } from "./fixtures";
|
|
7
|
+
|
|
8
|
+
const stream = createStream({ attachments });
|
|
9
|
+
const snapshot = fixtureEvents("notebook-events.sse");
|
|
10
|
+
const records = snapshot.flatMap((event) =>
|
|
11
|
+
event.event === "attachment" ? [event.data.attachment] : [],
|
|
12
|
+
);
|
|
13
|
+
const confirmed = () => snapshot.reduce(stream.reduce, stream.initial);
|
|
14
|
+
|
|
15
|
+
describe("attachment resource", () => {
|
|
16
|
+
it("collects snapshot records, replaces by id, and removes attachments", () => {
|
|
17
|
+
const state = confirmed();
|
|
18
|
+
expect(state.resources.attachments).toEqual(records);
|
|
19
|
+
const [browser, agent] = records;
|
|
20
|
+
const renamed = { ...agent, name: "Renamed agent" };
|
|
21
|
+
const updated = stream.reduce(state, {
|
|
22
|
+
event: "attachment",
|
|
23
|
+
id: "98",
|
|
24
|
+
data: { attachment: renamed },
|
|
25
|
+
});
|
|
26
|
+
expect(updated.resources.attachments).toEqual([browser, renamed]);
|
|
27
|
+
expect(state.resources.attachments).toEqual(records);
|
|
28
|
+
|
|
29
|
+
const removed = stream.reduce(updated, {
|
|
30
|
+
event: "attachment.removed",
|
|
31
|
+
id: "99",
|
|
32
|
+
data: { id: browser.id, time: "2026-10-01T09:30:00Z" },
|
|
33
|
+
});
|
|
34
|
+
expect(removed.resources.attachments).toEqual([renamed]);
|
|
35
|
+
const repeated = stream.reduce(removed, {
|
|
36
|
+
event: "attachment.removed",
|
|
37
|
+
id: "100",
|
|
38
|
+
data: { id: browser.id, time: "2026-10-01T09:30:00Z" },
|
|
39
|
+
});
|
|
40
|
+
expect(repeated.resources.attachments).toBe(removed.resources.attachments);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("retains records for replay and rebuilds them after reset", () => {
|
|
44
|
+
const state = confirmed();
|
|
45
|
+
expect(stream.resume(state)).toBe(state);
|
|
46
|
+
const reset = stream.reduce(state, { event: "reset", data: {} });
|
|
47
|
+
expect(reset.resources.attachments).toEqual([]);
|
|
48
|
+
const replacement = snapshot
|
|
49
|
+
.filter(
|
|
50
|
+
(event) =>
|
|
51
|
+
event.event !== "attachment" ||
|
|
52
|
+
event.data.attachment.id === records[0].id,
|
|
53
|
+
)
|
|
54
|
+
.reduce(stream.reduce, reset);
|
|
55
|
+
expect(replacement.resources.attachments).toEqual([records[0]]);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -8,7 +8,7 @@ import { Deferred } from "@/utils/Deferred";
|
|
|
8
8
|
import { jsonParseWithSpecialChar } from "@/utils/json/json-parser";
|
|
9
9
|
import { classifyCloseEvent } from "../../websocket/connection-state";
|
|
10
10
|
import { createNotebookClient } from "../notebook-client";
|
|
11
|
-
import { fixtureMessages } from "./fixtures";
|
|
11
|
+
import { fixtureEvents, fixtureMessages } from "./fixtures";
|
|
12
12
|
|
|
13
13
|
function notebookMessage(id: string) {
|
|
14
14
|
const notebook = {
|
|
@@ -301,3 +301,133 @@ describe("NotebookClient lifetime", () => {
|
|
|
301
301
|
second.abort();
|
|
302
302
|
});
|
|
303
303
|
});
|
|
304
|
+
|
|
305
|
+
async function open() {
|
|
306
|
+
const url = vi.fn(() => "ws://localhost/ws?session_id=first&cursor=999");
|
|
307
|
+
const setupResult = setup(url);
|
|
308
|
+
const lifetime = new AbortController();
|
|
309
|
+
setupResult.connect(lifetime.signal);
|
|
310
|
+
setupResult.healthy.resolve();
|
|
311
|
+
await setupResult.healthy.promise;
|
|
312
|
+
setupResult.events.dispatchEvent(new Event("open"));
|
|
313
|
+
return { ...setupResult, lifetime, url };
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
describe("NotebookClient attachments", () => {
|
|
317
|
+
const [browser, agent] = fixtureEvents("notebook-events.sse").flatMap(
|
|
318
|
+
(event) => (event.event === "attachment" ? [event.data.attachment] : []),
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
it("publishes a complete snapshot and applies live changes independently of kernel readiness", async () => {
|
|
322
|
+
const { client, store, receive, lifetime } = await open();
|
|
323
|
+
const snapshot = fixtureMessages("notebook-events.sse");
|
|
324
|
+
const readyIndex = snapshot.findIndex((event) => event.event === "ready");
|
|
325
|
+
snapshot.slice(0, readyIndex).forEach(receive);
|
|
326
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
327
|
+
snapshot.slice(readyIndex).forEach(receive);
|
|
328
|
+
expect(store.get(client.attachmentsAtom)).toEqual([browser, agent]);
|
|
329
|
+
const renamed = { ...agent, name: "Renamed agent" };
|
|
330
|
+
receive({ event: "attachment", id: "98", data: { attachment: renamed } });
|
|
331
|
+
receive({
|
|
332
|
+
event: "attachment.removed",
|
|
333
|
+
id: "99",
|
|
334
|
+
data: { id: browser.id },
|
|
335
|
+
});
|
|
336
|
+
expect(store.get(client.attachmentsAtom)).toEqual([renamed]);
|
|
337
|
+
receive({ data: { op: "kernel-ready", resumed: false } });
|
|
338
|
+
expect(store.get(client.attachmentsAtom)).toEqual([renamed]);
|
|
339
|
+
receive({ event: "attachment.removed", id: "100", data: { id: agent.id } });
|
|
340
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
341
|
+
lifetime.abort();
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it("resumes attachments alongside an incomplete document and waits for replay ready", async () => {
|
|
345
|
+
const { client, store, receive, events, urls, lifetime } = await open();
|
|
346
|
+
expect(urls[0].searchParams.has("cursor")).toBe(false);
|
|
347
|
+
fixtureMessages("notebook-events.sse").forEach(receive);
|
|
348
|
+
const confirmed = store.get(client.documentAtom);
|
|
349
|
+
const edits = fixtureMessages("edits.sse");
|
|
350
|
+
edits.slice(0, 3).forEach(receive);
|
|
351
|
+
const renamed = { ...agent, name: "Renamed agent" };
|
|
352
|
+
receive({ event: "attachment", id: "112a", data: { attachment: renamed } });
|
|
353
|
+
expect(store.get(client.attachmentsAtom)).toEqual([browser, renamed]);
|
|
354
|
+
events.dispatchEvent(new CloseEvent("close"));
|
|
355
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
356
|
+
expect(urls.at(-1)!.searchParams.get("cursor")).toBe("112a");
|
|
357
|
+
events.dispatchEvent(new Event("open"));
|
|
358
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
359
|
+
expect(store.get(client.documentAtom)).toBe(confirmed);
|
|
360
|
+
edits.slice(3).forEach(receive);
|
|
361
|
+
receive({
|
|
362
|
+
event: "attachment.removed",
|
|
363
|
+
id: "115",
|
|
364
|
+
data: { id: browser.id },
|
|
365
|
+
});
|
|
366
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
367
|
+
receive({ event: "ready", id: "116", data: {} });
|
|
368
|
+
expect(store.get(client.attachmentsAtom)).toEqual([renamed]);
|
|
369
|
+
const revisions = fixtureEvents("edits.sse").flatMap((event) =>
|
|
370
|
+
event.event === "document" ? [event.data.document] : [],
|
|
371
|
+
);
|
|
372
|
+
expect(store.get(client.documentAtom)?.revision).toEqual(revisions.at(-1));
|
|
373
|
+
lifetime.abort();
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it("replaces stale attachments with an empty snapshot after reset", async () => {
|
|
377
|
+
const { client, store, receive, lifetime } = await open();
|
|
378
|
+
fixtureMessages("notebook-events.sse").forEach(receive);
|
|
379
|
+
receive({ event: "reset", data: {} });
|
|
380
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
381
|
+
fixtureMessages("notebook-events.sse")
|
|
382
|
+
.filter((event) => event.event !== "attachment")
|
|
383
|
+
.forEach(receive);
|
|
384
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
385
|
+
lifetime.abort();
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it.each(["close", "error", "malformed", "removed", "abort", "identity"])(
|
|
389
|
+
"clears presence on %s and ignores messages after disposal",
|
|
390
|
+
async (reason) => {
|
|
391
|
+
const { client, store, receive, events, url, lifetime } = await open();
|
|
392
|
+
fixtureMessages("notebook-events.sse").forEach(receive);
|
|
393
|
+
expect(store.get(client.attachmentsAtom)).toEqual([browser, agent]);
|
|
394
|
+
switch (reason) {
|
|
395
|
+
case "close":
|
|
396
|
+
events.dispatchEvent(
|
|
397
|
+
new CloseEvent("close", { reason: "MARIMO_UNAUTHORIZED" }),
|
|
398
|
+
);
|
|
399
|
+
break;
|
|
400
|
+
case "error":
|
|
401
|
+
events.dispatchEvent(new Event("error"));
|
|
402
|
+
break;
|
|
403
|
+
case "malformed":
|
|
404
|
+
receive({ event: "attachment", id: "98", data: {} });
|
|
405
|
+
break;
|
|
406
|
+
case "removed":
|
|
407
|
+
receive({ event: "notebook.removed", id: "98", data: { id: "n1" } });
|
|
408
|
+
break;
|
|
409
|
+
case "identity":
|
|
410
|
+
url.mockReturnValue(
|
|
411
|
+
"ws://localhost/api/marimo/v1/notebooks/n2/events/ws",
|
|
412
|
+
);
|
|
413
|
+
events.dispatchEvent(new CloseEvent("close"));
|
|
414
|
+
receive({ event: "ready", id: "98", data: {} });
|
|
415
|
+
break;
|
|
416
|
+
default:
|
|
417
|
+
lifetime.abort();
|
|
418
|
+
}
|
|
419
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
420
|
+
lifetime.abort();
|
|
421
|
+
fixtureMessages("notebook-events.sse").forEach(receive);
|
|
422
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
423
|
+
},
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
it("keeps legacy sessions empty", async () => {
|
|
427
|
+
const { client, store, receive, lifetime } = await open();
|
|
428
|
+
receive({ data: { op: "kernel-ready" } });
|
|
429
|
+
receive({ data: { op: "reconnected" } });
|
|
430
|
+
expect(store.get(client.attachmentsAtom)).toEqual([]);
|
|
431
|
+
lifetime.abort();
|
|
432
|
+
});
|
|
433
|
+
});
|
package/src/core/host/events.ts
CHANGED
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
TransportReadyState,
|
|
12
12
|
} from "./connection";
|
|
13
13
|
import { parseNotebookEvent } from "./events";
|
|
14
|
+
import type { Attachment } from "./protocol";
|
|
15
|
+
import { attachments } from "./resources/attachments";
|
|
14
16
|
import { type Document, document } from "./resources/document";
|
|
15
17
|
import { createStream } from "./stream";
|
|
16
18
|
|
|
@@ -26,6 +28,8 @@ export interface NotebookClient {
|
|
|
26
28
|
* retains the last document. Partial updates are not exposed.
|
|
27
29
|
*/
|
|
28
30
|
readonly documentAtom: Atom<Document | null>;
|
|
31
|
+
/** Live attachments, empty until the stream is ready or while disconnected. */
|
|
32
|
+
readonly attachmentsAtom: Atom<readonly Attachment[]>;
|
|
29
33
|
/** Attempt to restore a closed connection after checking host health. */
|
|
30
34
|
reconnect(): Promise<void>;
|
|
31
35
|
}
|
|
@@ -60,15 +64,23 @@ export function createNotebookClient(store: ReturnType<typeof createStore>) {
|
|
|
60
64
|
state: ConnectionState.NOT_STARTED,
|
|
61
65
|
});
|
|
62
66
|
// One atom holds the whole stream, which resource atoms derive from.
|
|
63
|
-
const stream = createStream({ document });
|
|
67
|
+
const stream = createStream({ document, attachments });
|
|
64
68
|
const streamAtom = atom(stream.initial);
|
|
69
|
+
// A resumed stream is live, but presence waits for this connection's ready.
|
|
70
|
+
const readyAtom = atom(false);
|
|
65
71
|
const documentAtom = atom(
|
|
66
72
|
(get) => get(streamAtom).resources.document.current,
|
|
67
73
|
);
|
|
74
|
+
const attachmentsAtom = atom((get) =>
|
|
75
|
+
get(readyAtom) && get(connectionAtom).state === ConnectionState.OPEN
|
|
76
|
+
? get(streamAtom).resources.attachments
|
|
77
|
+
: attachments.initial,
|
|
78
|
+
);
|
|
68
79
|
let reconnect: (() => Promise<void>) | undefined;
|
|
69
80
|
const client: NotebookClient = {
|
|
70
81
|
connectionAtom,
|
|
71
82
|
documentAtom,
|
|
83
|
+
attachmentsAtom,
|
|
72
84
|
reconnect: async () => reconnect?.(),
|
|
73
85
|
};
|
|
74
86
|
|
|
@@ -111,14 +123,17 @@ export function createNotebookClient(store: ReturnType<typeof createStore>) {
|
|
|
111
123
|
? stream.resume(store.get(streamAtom))
|
|
112
124
|
: stream.initial;
|
|
113
125
|
streamKey = key;
|
|
126
|
+
store.set(readyAtom, false);
|
|
114
127
|
store.set(streamAtom, state);
|
|
115
128
|
if (state.cursor !== null) {
|
|
116
129
|
next.searchParams.set("cursor", state.cursor);
|
|
117
130
|
}
|
|
118
131
|
return next.toString();
|
|
119
132
|
});
|
|
120
|
-
const setStatus = (status: ConnectionStatus) =>
|
|
133
|
+
const setStatus = (status: ConnectionStatus) => {
|
|
134
|
+
store.set(readyAtom, false);
|
|
121
135
|
store.set(connectionAtom, status);
|
|
136
|
+
};
|
|
122
137
|
const disconnected = {
|
|
123
138
|
state: ConnectionState.CLOSED,
|
|
124
139
|
code: ConnectionClosedReason.KERNEL_DISCONNECTED,
|
|
@@ -174,6 +189,9 @@ export function createNotebookClient(store: ReturnType<typeof createStore>) {
|
|
|
174
189
|
try {
|
|
175
190
|
event = parseNotebookEvent(decodeJson(message.data));
|
|
176
191
|
store.set(streamAtom, stream.reduce(store.get(streamAtom), event));
|
|
192
|
+
if (event.event === "ready" || event.event === "reset") {
|
|
193
|
+
store.set(readyAtom, event.event === "ready");
|
|
194
|
+
}
|
|
177
195
|
} catch (error) {
|
|
178
196
|
Logger.error("Failed to decode notebook message", error);
|
|
179
197
|
if (messageFormat === "session") {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import type { Attachment } from "../protocol";
|
|
4
|
+
import type { Resource } from "./resource";
|
|
5
|
+
|
|
6
|
+
/** Attachment records retained with the stream's resume cursor. */
|
|
7
|
+
export const attachments: Resource<readonly Attachment[]> = {
|
|
8
|
+
initial: [],
|
|
9
|
+
on: {
|
|
10
|
+
attachment: (state, { data: { attachment } }) =>
|
|
11
|
+
state.some((item) => item.id === attachment.id)
|
|
12
|
+
? state.map((item) => (item.id === attachment.id ? attachment : item))
|
|
13
|
+
: [...state, attachment],
|
|
14
|
+
"attachment.removed": (state, { data }) =>
|
|
15
|
+
state.some((item) => item.id === data.id)
|
|
16
|
+
? state.filter((item) => item.id !== data.id)
|
|
17
|
+
: state,
|
|
18
|
+
},
|
|
19
|
+
};
|