@marimo-team/islands 0.25.3-dev5 → 0.25.3-dev51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CNMliVzw.js → ConnectedDataExplorerComponent-Da5OoEUL.js} +14 -14
  2. package/dist/{ErrorBoundary-BiZWOrv4.js → ErrorBoundary-CbxCC2kk.js} +8 -8
  3. package/dist/{abnfDiagram-VCTEODGH-D-Ez91gV.js → abnfDiagram-VCTEODGH-Bz3mrprX.js} +2 -2
  4. package/dist/any-language-editor-k2B8YI3Y.js +75 -0
  5. package/dist/{architectureDiagram-5GKGNRK7-CTpcNtO8.js → architectureDiagram-5GKGNRK7-Cs5ujb9K.js} +1 -1
  6. package/dist/{arrays-CN1djC4k.js → arrays-R6JsImiT.js} +8 -0
  7. package/dist/{button-CvjkwdSk.js → button-BxB3RDjN.js} +1 -1
  8. package/dist/{capabilities-CQ5IjhzL.js → capabilities-BgR0osfN.js} +2 -2
  9. package/dist/{chat-ui-0lKdOoQ3.js → chat-ui-C1Gjgokv.js} +1103 -1103
  10. package/dist/{check-EDwSwP89.js → check-P35dc2dH.js} +1 -1
  11. package/dist/{chunk-IMKFNOWR-DGxi-zeo.js → chunk-IMKFNOWR-CcTSaxZt.js} +1 -1
  12. package/dist/{chunk-SHT3W25Y-CV9J3rAB.js → chunk-SHT3W25Y-DcJcjOaO.js} +1 -1
  13. package/dist/{chunk-SVP7TREG-BL-9Fqgg.js → chunk-SVP7TREG-BVtDTjaF.js} +1 -1
  14. package/dist/{chunk-TICWLB2K-Cu_XMjDM.js → chunk-TICWLB2K-BkDFkh8q.js} +1 -1
  15. package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-YOKDWASO-DKplTrBY.js} +20 -20
  16. package/dist/{classDiagram-ZZMXUADV-BXXV13Hq.js → classDiagram-ZZMXUADV-CfAt7HT5.js} +2 -2
  17. package/dist/{classDiagram-v2-VYDZK3BY-B7FXJ1Cp.js → classDiagram-v2-VYDZK3BY-CGEjNYa2.js} +2 -2
  18. package/dist/{code-visibility-CW5_8ZOI.js → code-visibility-DoZ9lxzx.js} +6 -6
  19. package/dist/{common-mzWw4FdI.js → common-D1PacyXO.js} +3112 -3015
  20. package/dist/{copy-icon-Ft7t9bqz.js → copy-icon-CPoxUG7G.js} +3 -3
  21. package/dist/{cynefinDiagram-5FMLGOSQ-CH96rwba.js → cynefinDiagram-5FMLGOSQ-BW6NmfJi.js} +1 -1
  22. package/dist/{dagre-GXQ25YYZ-BD3PmpFY.js → dagre-GXQ25YYZ-CWg3CTuF.js} +1 -1
  23. package/dist/{data-grid-overlay-editor-CJmehSdc.js → data-grid-overlay-editor-B50UpkXd.js} +5 -5
  24. package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-0PJ-9N5n.js} +1 -1
  25. package/dist/{diagram-S7CK7UJ4-BsSJJldB.js → diagram-S7CK7UJ4-BPxtoS-z.js} +1 -1
  26. package/dist/{diagram-UQ7AKVKN-muQtNZc4.js → diagram-UQ7AKVKN-DA-vJdFL.js} +1 -1
  27. package/dist/{diagram-VX7I27RA-CdhuZAqR.js → diagram-VX7I27RA-D6bkR84S.js} +1 -1
  28. package/dist/{diagram-Z3DM3KII-BD8mXjOj.js → diagram-Z3DM3KII-m60g4cAT.js} +1 -1
  29. package/dist/{dialog-CEBFZNyc.js → dialog-C1PcpCqX.js} +3 -3
  30. package/dist/{dist-DpBpA_n1.js → dist-Lm-D-Vr6.js} +3 -3
  31. package/dist/{dropdown-menu-CP_qCYHC.js → dropdown-menu-MG5hiCIa.js} +76 -76
  32. package/dist/{ebnfDiagram-PWID7BFC-BIN1sweE.js → ebnfDiagram-PWID7BFC-CK99sho2.js} +2 -2
  33. package/dist/{erDiagram-RLTQ6QDP-Ctp5cfoN.js → erDiagram-RLTQ6QDP-Bryq0tdE.js} +1 -1
  34. package/dist/{error-banner-D-WCIiMt.js → error-banner-Sl2FlSJ4.js} +2 -2
  35. package/dist/{error-entries-DSvFWT_M.js → error-entries-CMNtA8NK.js} +959 -959
  36. package/dist/{feedback-button-BcT1FBud.js → feedback-button-DqPqwryB.js} +29 -29
  37. package/dist/{flowDiagram-HODETNUW-3EfLrlFb.js → flowDiagram-HODETNUW-D-3aRpfS.js} +2 -2
  38. package/dist/{formats-CeOmU1MU.js → formats-6pLWWrY2.js} +3 -3
  39. package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js} +2 -2
  40. package/dist/{glide-data-editor-XckatD0j.js → glide-data-editor-BxMhUd3K.js} +370 -368
  41. package/dist/{glide-utils-DJyqh0EM.js → glide-utils-Bt8_pBa2.js} +16 -16
  42. package/dist/{globals-jRrLCkrP.js → globals-DTJa_doJ.js} +3 -3
  43. package/dist/{highlighted-body-KPVGNVTW-zwjq21tf.js → highlighted-body-KPVGNVTW-3Ziwfz-V.js} +2 -2
  44. package/dist/{html-to-image-B8s5SgGm.js → html-to-image-By72ALyI.js} +29 -29
  45. package/dist/{infoDiagram-27XIBGKW-DipQoHxl.js → infoDiagram-27XIBGKW-s1C1kgfU.js} +1 -1
  46. package/dist/{ishikawaDiagram-5VMMS53U-DgFMjSGz.js → ishikawaDiagram-5VMMS53U-CCsRgolY.js} +1 -1
  47. package/dist/{kanban-definition-UXKFOSKX-w1ACVjgl.js → kanban-definition-UXKFOSKX-BrmxDlcc.js} +1 -1
  48. package/dist/{label-BDKF3Afc.js → label-BRnUC0NX.js} +2 -2
  49. package/dist/{linear-Cnaq3Tfb.js → linear-DWERh7eI.js} +121 -73
  50. package/dist/{loader-BQOfjTIJ.js → loader-Bm8cy3e8.js} +12 -12
  51. package/dist/main.js +2358 -2221
  52. package/dist/{mermaid-CHo49Yv-.js → mermaid-DKI0869I.js} +38 -38
  53. package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +2 -0
  54. package/dist/{mindmap-definition-YA3MSWOX-CrT0KSfX.js → mindmap-definition-YA3MSWOX-641xJysF.js} +1 -1
  55. package/dist/{number-overlay-editor-pZx8dUDV.js → number-overlay-editor-Z_H6x5b-.js} +3 -3
  56. package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
  57. package/dist/{once-BtE-wKRL.js → once-eG8Vmvjd.js} +1 -1
  58. package/dist/{pegDiagram-XKGWAZYB-BqvywNJA.js → pegDiagram-XKGWAZYB-keVUAUeS.js} +2 -2
  59. package/dist/{pieDiagram-E7YTZNPT-BfxJ_XCc.js → pieDiagram-E7YTZNPT-DHktXPO_.js} +1 -1
  60. package/dist/precisionRound-DhAzeRcm.js +49 -0
  61. package/dist/{process-output-CKRXyszb.js → process-output-D-OMW5sV.js} +4 -4
  62. package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-Blrm7V7_.js} +1 -1
  63. package/dist/{railroadDiagram-O6MQD6OU-8vFLVTPu.js → railroadDiagram-O6MQD6OU-BVEF4OV_.js} +2 -2
  64. package/dist/{react-vega-BED0DjiB.js → react-vega-C4T9Rb_w.js} +12284 -12270
  65. package/dist/{requirementDiagram-BXWQKSXE-a_MxGvxe.js → requirementDiagram-BXWQKSXE-CWo-UAKV.js} +1 -1
  66. package/dist/{reveal-component-79ez8-D5.js → reveal-component-tAB5K3QE.js} +10 -10
  67. package/dist/{select-BButFi-d.js → select-B0LRDH0g.js} +4 -4
  68. package/dist/{sequenceDiagram-WJ2MYXX4-CXFMnxGh.js → sequenceDiagram-WJ2MYXX4-CHQvLnq4.js} +1 -1
  69. package/dist/{spec-BwarBpUJ.js → spec-C-LRKGtT.js} +4 -4
  70. package/dist/{stateDiagram-D77RDMKH-DQeA_CwI.js → stateDiagram-D77RDMKH-BOJZgbUJ.js} +2 -2
  71. package/dist/{stateDiagram-v2-MP3YSRHH-BxxQucm1.js → stateDiagram-v2-MP3YSRHH-C53XXdYH.js} +2 -2
  72. package/dist/style.css +1 -1
  73. package/dist/{swimlanes-42K2YHIH-Do6L-cYg.js → swimlanes-42K2YHIH-D2o1gOtw.js} +1 -1
  74. package/dist/{swimlanesDiagram-VR7AAH4N-DUzPvSVU.js → swimlanesDiagram-VR7AAH4N-BHFzN1Wk.js} +2 -2
  75. package/dist/{swiper-component-DKntyn8p.js → swiper-component-DfhRvAFi.js} +2 -2
  76. package/dist/{time-BieKwdYS.js → time-BaMbJs4z.js} +18 -18
  77. package/dist/{timeline-definition-24CTP7MA-D3c46WM5.js → timeline-definition-24CTP7MA-rv7QUa46.js} +1 -1
  78. package/dist/{toDate-vIXljnsr.js → toDate-CjPuEPou.js} +21 -20
  79. package/dist/{toast-B9UMEi8u.js → toast-CFWpihJU.js} +4 -4
  80. package/dist/{tooltip-BO1REbqs.js → tooltip-CKO1pHJo.js} +2 -2
  81. package/dist/{use-restore-focus-BEM7sFWl.js → use-restore-focus-DBCITLeF.js} +1 -1
  82. package/dist/{useAsyncData-Deh5kszT.js → useAsyncData-ChgNtdmE.js} +15 -14
  83. package/dist/{useDateFormatter-D8XruNGG.js → useDateFormatter-c_yJtkAe.js} +2 -2
  84. package/dist/{useDeepCompareMemoize-DXwzRINI.js → useDeepCompareMemoize-Bet7kSsI.js} +1 -1
  85. package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-BkdeVdXC.js} +1 -1
  86. package/dist/{useLifecycle-j7D9uD1o.js → useLifecycle-VVmz_24o.js} +3 -3
  87. package/dist/{useTheme-CRnjkku0.js → useTheme-DympCsQg.js} +5 -5
  88. package/dist/{vega-component-DTG6zxaY.js → vega-component-DnfQeoyt.js} +147 -147
  89. package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container--LYZqguO.js} +2 -2
  90. package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-B9Pz0EGP.js} +298 -507
  91. package/dist/{vennDiagram-4TSXK5OY-BSZD8JcZ.js → vennDiagram-4TSXK5OY-D36Zk7t-.js} +1 -1
  92. package/dist/{wardleyDiagram-VM6X3IG4-48cUWkfA.js → wardleyDiagram-VM6X3IG4-BLBolvyQ.js} +1 -1
  93. package/dist/{xychartDiagram-S5SC5T6Z-CswYgYeu.js → xychartDiagram-S5SC5T6Z-CfH57l0v.js} +2 -2
  94. package/package.json +4 -4
  95. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  96. package/src/__tests__/host-imports.test.ts +1 -0
  97. package/src/__tests__/mount.test.ts +8 -8
  98. package/src/components/app-config/ai-config.tsx +5 -1
  99. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  100. package/src/components/chat/chat-panel.tsx +3 -7
  101. package/src/components/chat/chat-utils.ts +4 -8
  102. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  103. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  104. package/src/components/data-table/__tests__/export-actions.test.tsx +417 -6
  105. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  106. package/src/components/data-table/columns.tsx +2 -1
  107. package/src/components/data-table/context-menu.tsx +36 -20
  108. package/src/components/data-table/date-popover.tsx +6 -4
  109. package/src/components/data-table/export-actions.tsx +263 -161
  110. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +2 -2
  111. package/src/components/data-table/schemas.ts +14 -36
  112. package/src/components/editor/Output.tsx +5 -1
  113. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  114. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  115. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  116. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  117. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  118. package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
  119. package/src/components/editor/cell/CreateCellButton.tsx +8 -10
  120. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
  121. package/src/components/editor/cell/code/cell-editor.tsx +1 -1
  122. package/src/components/editor/cell/code/language-toggle.tsx +8 -7
  123. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +277 -78
  124. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +196 -41
  125. package/src/components/editor/connections/components.tsx +1 -1
  126. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  127. package/src/components/editor/controls/command-palette.tsx +22 -10
  128. package/src/components/editor/dynamic-favicon.tsx +21 -40
  129. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +139 -36
  130. package/src/components/editor/errors/send-error-report-button.tsx +10 -7
  131. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  132. package/src/components/editor/output/MarimoTracebackOutput.tsx +28 -22
  133. package/src/components/editor/output/console/ConsoleOutput.tsx +8 -18
  134. package/src/components/pages/home-page.tsx +4 -4
  135. package/src/components/slides/slide-cell-view.tsx +1 -1
  136. package/src/components/tracing/tracing.tsx +2 -2
  137. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  138. package/src/core/attachments/state.ts +5 -8
  139. package/src/core/attachments/toast.ts +15 -0
  140. package/src/core/cells/__tests__/error-report.test.ts +53 -3
  141. package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
  142. package/src/core/cells/__tests__/session.test.ts +18 -3
  143. package/src/core/cells/cells.ts +2 -1
  144. package/src/core/cells/error-report.ts +14 -6
  145. package/src/core/cells/pending-delete-service.ts +2 -6
  146. package/src/core/cells/session.ts +19 -1
  147. package/src/core/config/pair.ts +5 -3
  148. package/src/core/datasets/__tests__/data-source-discovery.test.ts +4 -4
  149. package/src/core/datasets/data-source-discovery.ts +4 -6
  150. package/src/core/edit-app.tsx +2 -2
  151. package/src/core/host/AGENTS.md +11 -2
  152. package/src/core/host/__tests__/attachments.test.ts +56 -0
  153. package/src/core/host/__tests__/document.test.ts +126 -0
  154. package/src/core/host/__tests__/events.test.ts +49 -0
  155. package/src/core/host/__tests__/fixtures.ts +41 -0
  156. package/src/core/host/__tests__/notebook-client.test.ts +496 -0
  157. package/src/core/host/connection.ts +81 -0
  158. package/src/core/host/events.ts +68 -0
  159. package/src/core/host/notebook-client.ts +316 -0
  160. package/src/core/host/resources/attachments.ts +19 -0
  161. package/src/core/host/resources/document.ts +101 -0
  162. package/src/core/hotkeys/actions.ts +2 -4
  163. package/src/core/islands/__tests__/bootstrap.test.ts +0 -26
  164. package/src/core/islands/bootstrap.ts +0 -1
  165. package/src/core/network/connection.ts +4 -2
  166. package/src/core/run-app.tsx +2 -2
  167. package/src/core/runtime/__tests__/runtime.test.ts +5 -12
  168. package/src/core/runtime/runtime.ts +5 -5
  169. package/src/core/static/files.ts +2 -0
  170. package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
  171. package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
  172. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +149 -0
  173. package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +168 -253
  174. package/src/core/websocket/connection-state.ts +70 -0
  175. package/src/core/websocket/state.ts +7 -0
  176. package/src/core/websocket/transports/__tests__/sse.test.ts +18 -4
  177. package/src/core/websocket/transports/create.ts +31 -0
  178. package/src/core/websocket/transports/sse.ts +14 -2
  179. package/src/core/websocket/transports/transport.ts +12 -23
  180. package/src/core/websocket/types.ts +9 -39
  181. package/src/core/websocket/useNotebookClient.ts +78 -0
  182. package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +53 -233
  183. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  184. package/src/hooks/useAsyncData.ts +3 -3
  185. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  186. package/src/hooks/useElapsedTime.ts +3 -3
  187. package/src/hooks/useInputHistory.ts +4 -7
  188. package/src/hooks/useResizeObserver.ts +4 -7
  189. package/src/mount.tsx +3 -3
  190. package/src/plugins/core/registerReactComponent.tsx +1 -1
  191. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  192. package/src/plugins/impl/FormPlugin.tsx +1 -1
  193. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  194. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +2 -0
  195. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  196. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  197. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  198. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  199. package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
  200. package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
  201. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  202. package/src/plugins/impl/panel/PanelPlugin.tsx +15 -16
  203. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  204. package/src/plugins/impl/panel/utils.ts +17 -0
  205. package/src/plugins/impl/vega/make-selectable.ts +3 -6
  206. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  207. package/src/stories/editor.stories.tsx +24 -17
  208. package/src/utils/__tests__/arrays.test.ts +35 -0
  209. package/src/utils/__tests__/numbers.test.ts +48 -1
  210. package/src/utils/__tests__/objects.test.ts +21 -0
  211. package/src/utils/arrays.ts +10 -0
  212. package/src/utils/numbers.ts +28 -17
  213. package/src/utils/objects.ts +3 -7
  214. package/src/utils/once.ts +19 -19
  215. package/dist/any-language-editor-DZ_YTVus.js +0 -76
  216. package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
  217. package/dist/precisionRound-DMIVQrt2.js +0 -97
  218. package/src/core/host/__tests__/protocol.test.ts +0 -214
  219. package/src/core/host/protocol.ts +0 -1943
  220. package/src/core/websocket/useWebSocket.tsx +0 -88
@@ -4,11 +4,51 @@
4
4
  import { describe, expect, it } from "vitest";
5
5
  import { cellId } from "@/__tests__/branded";
6
6
  import type { MarimoError } from "@/core/kernel/messages";
7
- import { buildErrorReport } from "../error-report";
7
+ import { buildErrorReport, ERROR_MESSAGE_INSTRUCTIONS } from "../error-report";
8
8
 
9
9
  const CELL_ID = cellId("failed-cell");
10
10
 
11
11
  describe("buildErrorReport", () => {
12
+ it("preserves plain traceback text without treating angle brackets as HTML", () => {
13
+ const traceback =
14
+ ' File "<cell>", line 1\nValueError: expected <value> & got <other>';
15
+ expect(
16
+ buildErrorReport(CELL_ID, { traceback, tracebackFormat: "text" }).output,
17
+ ).toEqual({
18
+ type: "error",
19
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
20
+ message: "ValueError: expected <value> & got <other>",
21
+ traceback,
22
+ });
23
+ });
24
+ it("owns the instruction to repair the live notebook", () => {
25
+ const report = buildErrorReport(CELL_ID, {
26
+ errors: [{ type: "syntax", msg: "invalid code" }],
27
+ });
28
+ expect(report.output.instructions).toEqual("Fix this notebook error.");
29
+ });
30
+
31
+ it("keeps repair intent visible before oversized evidence", () => {
32
+ const report = buildErrorReport(CELL_ID, {
33
+ code: "# long code\n".repeat(10_000),
34
+ errors: [
35
+ {
36
+ type: "exception",
37
+ exception_type: "ValueError",
38
+ msg: "long error ".repeat(10_000),
39
+ raising_cell: null,
40
+ traceback: `<pre>Traceback\n${"long frame\n".repeat(10_000)}</pre>`,
41
+ },
42
+ ],
43
+ });
44
+ const serialized = JSON.stringify(report);
45
+
46
+ expect(serialized.length).toBeGreaterThan(8192);
47
+ expect(serialized.slice(0, 256)).toContain(
48
+ '"instructions":"Fix this notebook error."',
49
+ );
50
+ });
51
+
12
52
  it("retains every message and complete traceback without display limits", () => {
13
53
  const traceback = `Traceback\n${"long frame\n".repeat(10_000)}ValueError: bad <value>`;
14
54
  const errors: MarimoError[] = [
@@ -27,6 +67,7 @@ describe("buildErrorReport", () => {
27
67
  code: "failed()",
28
68
  output: {
29
69
  type: "error",
70
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
30
71
  message: "bad <value>\nanother error",
31
72
  traceback,
32
73
  },
@@ -49,7 +90,11 @@ describe("buildErrorReport", () => {
49
90
  ).toEqual({
50
91
  type: "cell-output",
51
92
  cell_id: CELL_ID,
52
- output: { type: "error", message: "legacy error" },
93
+ output: {
94
+ type: "error",
95
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
96
+ message: "legacy error",
97
+ },
53
98
  });
54
99
  });
55
100
 
@@ -63,7 +108,11 @@ describe("buildErrorReport", () => {
63
108
  type: "cell-output",
64
109
  cell_id: CELL_ID,
65
110
  code: "",
66
- output: { type: "error", message: "invalid code" },
111
+ output: {
112
+ type: "error",
113
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
114
+ message: "invalid code",
115
+ },
67
116
  });
68
117
  });
69
118
 
@@ -80,6 +129,7 @@ describe("buildErrorReport", () => {
80
129
  cell_id: CELL_ID,
81
130
  output: {
82
131
  type: "error",
132
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
83
133
  message: "first\nsecond",
84
134
  traceback:
85
135
  "Traceback\nValueError: first\n\nTraceback\nValueError: second",
@@ -0,0 +1,113 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { createStore } from "jotai";
4
+ import { afterEach, describe, expect, it, vi } from "vitest";
5
+ import { MockNotebook } from "@/__mocks__/notebook";
6
+ import { cellId } from "@/__tests__/branded";
7
+ import {
8
+ createNotebookActions,
9
+ notebookAtom,
10
+ notebookOutline,
11
+ notebookReducer,
12
+ } from "../cells";
13
+ import { exportedForTesting } from "../document-changes";
14
+ import type { Outline } from "../outline";
15
+
16
+ const first = cellId("first");
17
+ const second = cellId("second");
18
+ const firstOutline: Outline = {
19
+ items: [{ name: "First", level: 1, by: { id: "first" } }],
20
+ };
21
+ const secondOutline: Outline = {
22
+ items: [{ name: "Second", level: 2, by: { id: "second" } }],
23
+ };
24
+
25
+ function setup() {
26
+ const store = createStore();
27
+ store.set(
28
+ notebookAtom,
29
+ MockNotebook.notebookState({
30
+ cellData: { [first]: { code: "x = 1" }, [second]: {} },
31
+ cellRuntime: {
32
+ [first]: { outline: firstOutline },
33
+ [second]: { outline: secondOutline },
34
+ },
35
+ }),
36
+ );
37
+ const actions = createNotebookActions((action) =>
38
+ store.set(notebookAtom, (state) => notebookReducer(state, action)),
39
+ );
40
+ return { store, actions };
41
+ }
42
+
43
+ afterEach(() => {
44
+ exportedForTesting.cancelPendingChanges();
45
+ });
46
+
47
+ describe("notebookOutline", () => {
48
+ it("does not notify outline subscribers when cell code changes", () => {
49
+ const { store, actions } = setup();
50
+ const initial = store.get(notebookOutline);
51
+ const listener = vi.fn();
52
+ const unsubscribe = store.sub(notebookOutline, listener);
53
+
54
+ actions.updateCellCode({
55
+ cellId: first,
56
+ code: "x = 2",
57
+ formattingChange: false,
58
+ });
59
+
60
+ expect(store.get(notebookOutline)).toBe(initial);
61
+ expect(listener).not.toHaveBeenCalled();
62
+ unsubscribe();
63
+ });
64
+
65
+ it("updates headings when runtime outlines change or are removed", () => {
66
+ const { store } = setup();
67
+ const updated: Outline = {
68
+ items: [{ name: "Updated", level: 1, by: { id: "updated" } }],
69
+ };
70
+
71
+ for (const outline of [updated, null]) {
72
+ store.set(notebookAtom, (state) => ({
73
+ ...state,
74
+ cellRuntime: {
75
+ ...state.cellRuntime,
76
+ [first]: { ...state.cellRuntime[first], outline },
77
+ },
78
+ }));
79
+ expect(store.get(notebookOutline)).toEqual({
80
+ items: [...(outline?.items ?? []), ...secondOutline.items],
81
+ });
82
+ }
83
+ });
84
+
85
+ it("keeps headings in cell order after moving and deleting cells", () => {
86
+ const { store, actions } = setup();
87
+ actions.moveCell({ cellId: second, before: true });
88
+ expect(store.get(notebookOutline)).toEqual({
89
+ items: [...secondOutline.items, ...firstOutline.items],
90
+ });
91
+
92
+ actions.deleteCell({ cellId: second });
93
+ expect(store.get(notebookOutline)).toEqual(firstOutline);
94
+ });
95
+
96
+ it("notifies subscribers when output is replaced with the same headings", () => {
97
+ const { store } = setup();
98
+ const listener = vi.fn();
99
+ const unsubscribe = store.sub(notebookOutline, listener);
100
+
101
+ store.set(notebookAtom, (state) => ({
102
+ ...state,
103
+ cellRuntime: {
104
+ ...state.cellRuntime,
105
+ [first]: { ...state.cellRuntime[first], outline: { ...firstOutline } },
106
+ },
107
+ }));
108
+
109
+ // Consumers must reconnect to replacement heading elements in the DOM.
110
+ expect(listener).toHaveBeenCalledOnce();
111
+ unsubscribe();
112
+ });
113
+ });
@@ -174,8 +174,11 @@ describe("notebookStateFromSession", () => {
174
174
  channel: "marimo-error",
175
175
  data: [
176
176
  {
177
- type: "unknown",
177
+ type: "exception",
178
+ exception_type: "ValueError",
178
179
  msg: "Something went wrong",
180
+ raising_cell: null,
181
+ traceback: "Traceback line 1",
179
182
  },
180
183
  ],
181
184
  mimetype: "application/vnd.marimo+error",
@@ -201,8 +204,9 @@ describe("notebookStateFromSession", () => {
201
204
  {
202
205
  type: "stream",
203
206
  name: "stderr",
204
- text: "<pre>ValueError: cached failure</pre>",
207
+ text: "ValueError: cached <failure>",
205
208
  mimetype: "application/vnd.marimo+traceback",
209
+ traceback_format: "text",
206
210
  code,
207
211
  },
208
212
  ],
@@ -212,9 +216,20 @@ describe("notebookStateFromSession", () => {
212
216
  invariant(state, "state is null");
213
217
  expect(state.cellRuntime[CELL_1].output).toMatchObject({
214
218
  code,
215
- data: [{ type: "unknown", msg: "cached failure" }],
219
+ data: [
220
+ {
221
+ type: "exception",
222
+ exception_type: "ValueError",
223
+ msg: "cached failure",
224
+ traceback: "Traceback\nValueError: cached failure",
225
+ },
226
+ ],
216
227
  });
217
228
  expect(state.cellRuntime[CELL_1].consoleOutputs[0].code).toBe(code);
229
+ expect(state.cellRuntime[CELL_1].consoleOutputs[0]).toMatchObject({
230
+ traceback_format: "text",
231
+ data: "ValueError: cached <failure>",
232
+ });
218
233
  });
219
234
 
220
235
  it("handles data output in session cell", () => {
@@ -1761,7 +1761,8 @@ export const cellErrorsAtom = atom((get) => {
1761
1761
  });
1762
1762
 
1763
1763
  export const notebookOutline = atom((get) => {
1764
- const { cellIds, cellRuntime } = get(notebookAtom);
1764
+ const cellIds = get(cellIdsAtom);
1765
+ const cellRuntime = get(cellsRuntimeAtom);
1765
1766
  const outlines = cellIds.inOrderIds.map(
1766
1767
  (cellId) => cellRuntime[cellId].outline,
1767
1768
  );
@@ -6,26 +6,29 @@ import { sanitizeHtml } from "@/plugins/core/sanitize-html";
6
6
  import { parseHtmlContent } from "@/utils/dom";
7
7
  import type { CellId } from "./ids";
8
8
 
9
- export interface CellOutputHandoff<Output> {
9
+ export interface CellOutputMessage<Output> {
10
10
  type: "cell-output";
11
11
  cell_id: CellId;
12
12
  code?: string;
13
13
  output: Output;
14
14
  }
15
15
 
16
- export interface ErrorHandoffOutput {
16
+ export interface ErrorMessageOutput {
17
17
  type: "error";
18
+ instructions: string;
18
19
  message: string;
19
20
  traceback?: string;
20
21
  }
21
22
 
23
+ export const ERROR_MESSAGE_INSTRUCTIONS = "Fix this notebook error.";
24
+
22
25
  export function buildErrorReport(
23
26
  cellId: CellId,
24
27
  evidence: { code?: string } & (
25
28
  | { errors: MarimoError[] }
26
- | { traceback: string }
29
+ | { traceback: string; tracebackFormat: "html" | "text" }
27
30
  ),
28
- ): CellOutputHandoff<ErrorHandoffOutput> {
31
+ ): CellOutputMessage<ErrorMessageOutput> {
29
32
  let message: string;
30
33
  let traceback: string;
31
34
  if ("errors" in evidence) {
@@ -38,18 +41,23 @@ export function buildErrorReport(
38
41
  )
39
42
  .join("\n\n");
40
43
  } else {
41
- traceback = parseHtmlContent(sanitizeHtml(evidence.traceback));
44
+ traceback =
45
+ evidence.tracebackFormat === "html"
46
+ ? parseHtmlContent(sanitizeHtml(evidence.traceback))
47
+ : evidence.traceback;
42
48
  message = traceback.split("\n").findLast((line) => line.length > 0) ?? "";
43
49
  }
44
50
 
51
+ // Put repair intent before evidence so it survives prefix truncation.
45
52
  return {
46
53
  type: "cell-output",
47
54
  cell_id: cellId,
48
- ...(evidence.code === undefined ? {} : { code: evidence.code }),
49
55
  output: {
50
56
  type: "error",
57
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
51
58
  message,
52
59
  ...(traceback ? { traceback } : {}),
53
60
  },
61
+ ...(evidence.code === undefined ? {} : { code: evidence.code }),
54
62
  };
55
63
  }
@@ -134,12 +134,8 @@ export function usePendingDeleteService() {
134
134
  submit({ cellIds, deleteCell, deleteManyCells, store });
135
135
  },
136
136
  clear,
137
- get idle() {
138
- return entries.size === 0;
139
- },
140
- get shouldConfirmDelete() {
141
- return entries.size > 1;
142
- },
137
+ idle: entries.size === 0,
138
+ shouldConfirmDelete: entries.size > 1,
143
139
  };
144
140
  }
145
141
 
@@ -206,8 +206,20 @@ function createCellRuntimeFromSession(
206
206
  channel: "marimo-error",
207
207
  data: [
208
208
  {
209
- type: "unknown",
209
+ type: "exception",
210
+ exception_type: primaryOutput.ename,
210
211
  msg: primaryOutput.evalue,
212
+ raising_cell: null,
213
+ traceback:
214
+ primaryOutput.traceback.length === 0
215
+ ? null
216
+ : primaryOutput.traceback
217
+ .map((line, index, lines) =>
218
+ index < lines.length - 1 && !line.endsWith("\n")
219
+ ? `${line}\n`
220
+ : line,
221
+ )
222
+ .join(""),
211
223
  },
212
224
  ],
213
225
  mimetype: "application/vnd.marimo+error",
@@ -240,6 +252,9 @@ function createCellRuntimeFromSession(
240
252
  channel: "media",
241
253
  data: consoleOutput.data,
242
254
  mimetype: consoleOutput.mimetype,
255
+ ...(consoleOutput.traceback_format === undefined
256
+ ? {}
257
+ : { traceback_format: consoleOutput.traceback_format }),
243
258
  timestamp: DEFAULT_TIMESTAMP,
244
259
  ...(consoleOutput.code === undefined
245
260
  ? {}
@@ -251,6 +266,9 @@ function createCellRuntimeFromSession(
251
266
  channel: consoleOutput.name === "stderr" ? "stderr" : "stdout",
252
267
  data: consoleOutput.text,
253
268
  mimetype: consoleOutput.mimetype ?? "text/plain",
269
+ ...(consoleOutput.traceback_format === undefined
270
+ ? {}
271
+ : { traceback_format: consoleOutput.traceback_format }),
254
272
  timestamp: DEFAULT_TIMESTAMP,
255
273
  ...(consoleOutput.code === undefined
256
274
  ? {}
@@ -3,16 +3,18 @@
3
3
  import { atom } from "jotai";
4
4
  import { z } from "zod";
5
5
 
6
- export const pairPreviewSchema = z.object({
6
+ export const pairConfigSchema = z.object({
7
7
  command: z.string(),
8
+ hostEnabled: z.boolean().default(false),
8
9
  templates: z.object({
9
10
  prompt: z.string(),
11
+ notebook: z.string(),
10
12
  session: z.string(),
11
13
  token_file: z.string(),
12
14
  token: z.string(),
13
15
  }),
14
16
  });
15
17
 
16
- export type PairPreviewConfig = z.infer<typeof pairPreviewSchema>;
18
+ export type PairConfig = z.infer<typeof pairConfigSchema>;
17
19
 
18
- export const pairPreviewAtom = atom<PairPreviewConfig | undefined>(undefined);
20
+ export const pairConfigAtom = atom<PairConfig | undefined>(undefined);
@@ -185,8 +185,8 @@ describe("isDetectedSourceConnected", () => {
185
185
  });
186
186
  const emptySnapshot = {
187
187
  dialects: [] as string[],
188
- storageProtocols: [] as string[],
189
- storageBackendTypes: [] as string[],
188
+ storageProtocols: new Set<string>(),
189
+ storageBackendTypes: new Set<string>(),
190
190
  };
191
191
 
192
192
  it("does not hide a source when nothing is connected", () => {
@@ -242,7 +242,7 @@ describe("isDetectedSourceConnected", () => {
242
242
  expect(
243
243
  isDetectedSourceConnected(s3, {
244
244
  ...emptySnapshot,
245
- storageProtocols: ["s3"],
245
+ storageProtocols: new Set(["s3"]),
246
246
  }),
247
247
  ).toBe(true);
248
248
  });
@@ -262,7 +262,7 @@ describe("isDetectedSourceConnected", () => {
262
262
  expect(
263
263
  isDetectedSourceConnected(hf, {
264
264
  ...emptySnapshot,
265
- storageBackendTypes: ["huggingface"],
265
+ storageBackendTypes: new Set(["huggingface"]),
266
266
  }),
267
267
  ).toBe(true);
268
268
  });
@@ -27,8 +27,8 @@ export function matchesDiscoveryGroup(
27
27
  */
28
28
  export interface LiveConnectionSnapshot {
29
29
  dialects: readonly string[];
30
- storageProtocols: readonly string[];
31
- storageBackendTypes: readonly string[];
30
+ storageProtocols: ReadonlySet<string>;
31
+ storageBackendTypes: ReadonlySet<string>;
32
32
  }
33
33
 
34
34
  /**
@@ -47,15 +47,13 @@ export function isDetectedSourceConnected(
47
47
  }
48
48
 
49
49
  if (
50
- match.protocols.some((protocol) =>
51
- snapshot.storageProtocols.includes(protocol),
52
- )
50
+ match.protocols.some((protocol) => snapshot.storageProtocols.has(protocol))
53
51
  ) {
54
52
  return true;
55
53
  }
56
54
 
57
55
  return match.backendTypes.some((backendType) =>
58
- snapshot.storageBackendTypes.includes(backendType),
56
+ snapshot.storageBackendTypes.has(backendType),
59
57
  );
60
58
  }
61
59
 
@@ -41,7 +41,7 @@ import { viewStateAtom } from "./mode";
41
41
  import { useRequestClient } from "./network/requests";
42
42
  import { useFilename } from "./saving/filename";
43
43
  import { lastSavedNotebookAtom } from "./saving/state";
44
- import { useMarimoKernelConnection } from "./websocket/useMarimoKernelConnection";
44
+ import { useNotebookSession } from "./websocket/useNotebookSession";
45
45
 
46
46
  interface AppProps {
47
47
  /**
@@ -83,7 +83,7 @@ export const EditApp: React.FC<AppProps> = ({
83
83
  };
84
84
  }, []);
85
85
 
86
- const { connection, reconnect } = useMarimoKernelConnection({
86
+ const { connection, reconnect } = useNotebookSession({
87
87
  autoInstantiate: userConfig.runtime.auto_instantiate,
88
88
  setCells: (cells, layout) => {
89
89
  setCells(cells);
@@ -1,6 +1,15 @@
1
1
  # Host core
2
2
 
3
- Production code may import host modules, `jotai/vanilla`, `zod`, and
4
- `@/utils/Logger`. Enforced by `marimo/host-imports`. Tests are exempt.
3
+ Production code may import host modules, `@marimo-team/client`,
4
+ `jotai/vanilla`, `zod`, and `@/utils/Logger`. Enforced by
5
+ `marimo/host-imports`. Tests are exempt.
6
+
7
+ The protocol schemas and types live in `@marimo-team/client/protocol`.
8
+ The native `marimo` event is a marimo extension and is defined in `events.ts`.
5
9
 
6
10
  Define interfaces here and inject application behavior through adapters.
11
+
12
+ `stream.ts` reduces stream events into one state. Each kind of object is a
13
+ `Resource` in `resources/` with pure handlers keyed by event name. The stream
14
+ handles phase, notebook identity, and control events itself. The client holds
15
+ one state atom and exposes derived atoms.
@@ -0,0 +1,56 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { describe, expect, it } from "vitest";
4
+ import { attachments } from "../resources/attachments";
5
+ import { createReducer } from "@marimo-team/client/reducer";
6
+ import { fixtureEvents } from "./fixtures";
7
+
8
+ const reducer = createReducer({ 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(reducer.reduce, reducer.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 = reducer.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 = reducer.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 = reducer.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("rebuilds records after reset", () => {
44
+ const state = confirmed();
45
+ const reset = reducer.reduce(state, { event: "reset", data: {} });
46
+ expect(reset.resources.attachments).toEqual([]);
47
+ const replacement = snapshot
48
+ .filter(
49
+ (event) =>
50
+ event.event !== "attachment" ||
51
+ event.data.attachment.id === records[0].id,
52
+ )
53
+ .reduce(reducer.reduce, reset);
54
+ expect(replacement.resources.attachments).toEqual([records[0]]);
55
+ });
56
+ });
@@ -0,0 +1,126 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { describe, expect, it } from "vitest";
4
+ import type * as Protocol from "@marimo-team/client/protocol";
5
+ import { document } from "../resources/document";
6
+ import { createReducer } from "@marimo-team/client/reducer";
7
+ import { fixtureEvents } from "./fixtures";
8
+
9
+ const reducer = createReducer({ document });
10
+ const snapshot = fixtureEvents("notebook-events.sse");
11
+ const edits = fixtureEvents("edits.sse");
12
+
13
+ function replay(
14
+ events: readonly Protocol.EventOutput[],
15
+ from = reducer.initial,
16
+ ) {
17
+ return events.reduce((state, event) => reducer.reduce(state, event), from);
18
+ }
19
+
20
+ const confirmed = () => replay(snapshot);
21
+ const current = (state: ReturnType<typeof replay>) =>
22
+ state.resources.document.current;
23
+
24
+ describe("document resource", () => {
25
+ it("publishes the snapshot at ready, then each completed edit and save", () => {
26
+ const ready = snapshot.findIndex((event) => event.event === "ready");
27
+ const opening = replay(snapshot.slice(0, ready));
28
+ expect(current(opening)).toBeNull();
29
+ const first = current(replay(snapshot.slice(ready), opening));
30
+ expect(first?.revision.order).toEqual(["c1", "c3", "k7f2"]);
31
+ expect([...first!.cells.keys()]).toEqual(first?.revision.order);
32
+
33
+ const [edit, save] = edits.filter((event) => event.event === "document");
34
+ const pending = replay(
35
+ edits.filter((event) => event.event !== "document"),
36
+ confirmed(),
37
+ );
38
+ expect(current(pending)).toEqual(first);
39
+ const changed = reducer.reduce(pending, edit);
40
+ expect(current(changed)?.revision).toEqual(edit.data.document);
41
+ expect([...current(changed)!.cells.keys()].toSorted()).toEqual(
42
+ edit.data.document.order.toSorted(),
43
+ );
44
+ const saved = current(reducer.reduce(changed, save));
45
+ expect(saved?.revision).toEqual(save.data.document);
46
+ expect(saved?.cells.get("c3")?.code).toBe("x = 22");
47
+ expect(saved?.cells.has("k7f2")).toBe(false);
48
+ expect(saved?.revision.saved_etag).toBe(saved?.revision.etag);
49
+ expect(first?.cells.get("c3")?.code).toBe("x = 21");
50
+ expect(first?.cells.has("k7f2")).toBe(true);
51
+ });
52
+
53
+ it("applies order-only changes and distinguishes an empty notebook from no document", () => {
54
+ const state = confirmed();
55
+ const revision = current(state)!.revision;
56
+ const reordered = {
57
+ ...revision,
58
+ order: revision.order.toReversed(),
59
+ version: revision.version + 1,
60
+ };
61
+ const changed = reducer.reduce(state, {
62
+ event: "document",
63
+ data: { document: reordered },
64
+ id: "200",
65
+ });
66
+ expect(current(changed)).toEqual({
67
+ revision: reordered,
68
+ cells: current(state)?.cells,
69
+ });
70
+
71
+ const empty = { ...revision, order: [] };
72
+ const opening = reducer.reduce(reducer.initial, {
73
+ event: "document",
74
+ data: { document: empty },
75
+ });
76
+ expect(current(opening)).toBeNull();
77
+ expect(
78
+ current(reducer.reduce(opening, { event: "ready", data: {}, id: "0" })),
79
+ ).toEqual({ revision: empty, cells: new Map() });
80
+ expect(
81
+ current(
82
+ reducer.reduce(reducer.initial, { event: "ready", data: {}, id: "0" }),
83
+ ),
84
+ ).toBeNull();
85
+ });
86
+
87
+ it("keeps the document while a live update is pending and after a replay completes it", () => {
88
+ const state = confirmed();
89
+ const [cell, , removed, published] = edits;
90
+ if (published.event !== "document") {
91
+ throw new Error("Fixture does not publish a document");
92
+ }
93
+ const partial = replay([cell, removed], state);
94
+ expect(current(partial)).toBe(current(state));
95
+ const completed = replay(
96
+ [published, { event: "ready", data: {}, id: "113" }],
97
+ partial,
98
+ );
99
+ expect(current(completed)?.revision).toEqual(published.data.document);
100
+ });
101
+
102
+ it("removes a notebook without waiting for individual cell removals", () => {
103
+ const removed = reducer.reduce(confirmed(), {
104
+ event: "notebook.removed",
105
+ data: { id: "n1", time: "2026-10-01T09:30:00Z" },
106
+ id: "200",
107
+ });
108
+ expect(current(removed)).toBeNull();
109
+ });
110
+
111
+ it("rejects records that cannot form a complete revision", () => {
112
+ const state = confirmed();
113
+ const revision = current(state)!.revision;
114
+ expect(() =>
115
+ reducer.reduce(state, {
116
+ event: "document",
117
+ data: { document: { ...revision, order: ["missing"] } },
118
+ id: "200",
119
+ }),
120
+ ).toThrow("Document records do not match");
121
+ const partial = reducer.reduce(state, edits[0]);
122
+ expect(() =>
123
+ reducer.reduce(partial, { event: "ready", data: {}, id: "200" }),
124
+ ).toThrow("incomplete document update");
125
+ });
126
+ });