@marimo-team/islands 0.25.2-dev99 → 0.25.3-dev10

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 (205) hide show
  1. package/dist/{ConnectedDataExplorerComponent-BZmqc_F0.js → ConnectedDataExplorerComponent-CNMliVzw.js} +15 -15
  2. package/dist/{ErrorBoundary-CXkr_IcB.js → ErrorBoundary-BsqSMK9Y.js} +12 -12
  3. package/dist/{ImageComparisonComponent-Cpfz30OZ.js → ImageComparisonComponent-uU8FSKZE.js} +3 -3
  4. package/dist/{Plot-CTyjbQDT.js → Plot-DdYOe1UK.js} +2 -2
  5. package/dist/{abnfDiagram-VCTEODGH-C_Lmaa2j.js → abnfDiagram-VCTEODGH-D-Ez91gV.js} +3 -3
  6. package/dist/{any-language-editor-BFzqhOBR.js → any-language-editor-DZ_YTVus.js} +7 -7
  7. package/dist/{architectureDiagram-5GKGNRK7-BKMataHB.js → architectureDiagram-5GKGNRK7-CTpcNtO8.js} +5 -5
  8. package/dist/assets/__vite-browser-external-BXYkiFsk.js +1 -0
  9. package/dist/assets/worker-HPY9fbhz.js +114 -0
  10. package/dist/{blockDiagram-I7D4REHJ-BeHOjyDk.js → blockDiagram-I7D4REHJ-Cg25UrxT.js} +9 -9
  11. package/dist/{button-BtsM2UqM.js → button-CvjkwdSk.js} +5 -5
  12. package/dist/{c4Diagram-7LVT6UL2-Bao10t_O.js → c4Diagram-7LVT6UL2-BxFgrnNV.js} +7 -7
  13. package/dist/{capabilities-A5jrzjCJ.js → capabilities-CQ5IjhzL.js} +1 -1
  14. package/dist/{channel-BxCkvUgE.js → channel-CPObtJXj.js} +1 -1
  15. package/dist/{chat-ui-CwOWzoSO.js → chat-ui-0lKdOoQ3.js} +1588 -1396
  16. package/dist/{check-CNP79M3A.js → check-EDwSwP89.js} +1 -1
  17. package/dist/{chunk-4HAMMTFA-CH7Gpamd.js → chunk-4HAMMTFA-D4eFPyFh.js} +5 -5
  18. package/dist/{chunk-75Z2AOVW-AI7CvgKn.js → chunk-75Z2AOVW-D7gxIs2Q.js} +1 -1
  19. package/dist/{chunk-DU6HZSFF-BSvuTkX4.js → chunk-DU6HZSFF-BwiyaNpg.js} +1 -1
  20. package/dist/{chunk-F27PBJKO-CLshwT9T.js → chunk-F27PBJKO-ufseIn5y.js} +1 -1
  21. package/dist/{chunk-GMAD6QVW-wnHcn-lH.js → chunk-GMAD6QVW-BhaJx0X3.js} +3 -3
  22. package/dist/{chunk-GVQU2GXP-7O2p8hut.js → chunk-GVQU2GXP-Cwbt-lF0.js} +2 -2
  23. package/dist/{chunk-IMKFNOWR-Bu0Vh_Yi.js → chunk-IMKFNOWR-DGxi-zeo.js} +5 -5
  24. package/dist/{chunk-L3NEJ4N5-B9_Alrxb.js → chunk-L3NEJ4N5-n-zgIVSy.js} +5 -5
  25. package/dist/{chunk-OSK3NFVY-PeQPH2fD.js → chunk-OSK3NFVY-DXa-Cxbn.js} +6 -6
  26. package/dist/{chunk-P2QGCYS3-D9twiFuU.js → chunk-P2QGCYS3-B_Zd3-X0.js} +1 -1
  27. package/dist/{chunk-POPQ4Y6H-BUiNs18s.js → chunk-POPQ4Y6H-hYOXbYH_.js} +1 -1
  28. package/dist/{chunk-PWAF6VOD-D8S9NPCy.js → chunk-PWAF6VOD-CQw5qATZ.js} +1 -1
  29. package/dist/{chunk-SHT3W25Y-B2dyNZ31.js → chunk-SHT3W25Y-CV9J3rAB.js} +7 -7
  30. package/dist/{chunk-SVP7TREG-D7UPvB10.js → chunk-SVP7TREG-BL-9Fqgg.js} +2 -2
  31. package/dist/{chunk-TICWLB2K-BNaGoadd.js → chunk-TICWLB2K-Cu_XMjDM.js} +5 -5
  32. package/dist/{chunk-YOKDWASO-DrWbKnxA.js → chunk-YOKDWASO-DPZk8vhS.js} +6 -6
  33. package/dist/classDiagram-ZZMXUADV-BXXV13Hq.js +30 -0
  34. package/dist/classDiagram-v2-VYDZK3BY-B7FXJ1Cp.js +30 -0
  35. package/dist/{code-visibility-pPjYsRTH.js → code-visibility-CXQvUXHT.js} +18 -18
  36. package/dist/{common-CkvBp0B4.js → common-CuD-CAC-.js} +6128 -7136
  37. package/dist/{compiler-runtime-Cj8ZWiNS.js → compiler-runtime-CldRdSsv.js} +2 -2
  38. package/dist/{copy-icon-BY7jgcaV.js → copy-icon-Ft7t9bqz.js} +6 -6
  39. package/dist/{cynefinDiagram-5FMLGOSQ-CCDn4Z9e.js → cynefinDiagram-5FMLGOSQ-CH96rwba.js} +3 -3
  40. package/dist/{dagre-GXQ25YYZ-BJiUO_SV.js → dagre-GXQ25YYZ-BD3PmpFY.js} +10 -10
  41. package/dist/{data-grid-overlay-editor-L6ELxFAh.js → data-grid-overlay-editor-DgeyYmC1.js} +7 -7
  42. package/dist/{data-grid-types-BucVmDDp.js → data-grid-types-BH_r7g7l.js} +1 -1
  43. package/dist/{diagram-S7CK7UJ4-BZfxFNRR.js → diagram-S7CK7UJ4-BsSJJldB.js} +4 -4
  44. package/dist/{diagram-UQ7AKVKN-1xcsiIMg.js → diagram-UQ7AKVKN-muQtNZc4.js} +3 -3
  45. package/dist/{diagram-VSXAHHWV-DPAWJ9Nw.js → diagram-VSXAHHWV-BJWcVVJY.js} +2 -2
  46. package/dist/{diagram-VX7I27RA-DmRsnHYY.js → diagram-VX7I27RA-CdhuZAqR.js} +5 -5
  47. package/dist/{diagram-Z3DM3KII--b49ryKx.js → diagram-Z3DM3KII-BD8mXjOj.js} +3 -3
  48. package/dist/{dialog-CmExhUDI.js → dialog-CEBFZNyc.js} +6 -6
  49. package/dist/{dist-CcyKTBTF.js → dist-DpBpA_n1.js} +2 -2
  50. package/dist/{dropdown-menu-Cz4TdOJh.js → dropdown-menu-CP_qCYHC.js} +139 -139
  51. package/dist/{ebnfDiagram-PWID7BFC-rSwVyh4y.js → ebnfDiagram-PWID7BFC-BIN1sweE.js} +3 -3
  52. package/dist/{erDiagram-RLTQ6QDP-Bfd3iAoC.js → erDiagram-RLTQ6QDP-Ctp5cfoN.js} +12 -12
  53. package/dist/{error-banner-D30nA9nE.js → error-banner-D-WCIiMt.js} +16 -11
  54. package/dist/{cells-DZi0ioak.js → error-entries-DSvFWT_M.js} +6171 -5075
  55. package/dist/{esm-DAVrGVKP.js → esm-AMFssoNp.js} +4 -4
  56. package/dist/{feedback-button-D-pV0Qji.js → feedback-button-DZMj9PF3.js} +119 -120
  57. package/dist/flowDiagram-HODETNUW-3EfLrlFb.js +16 -0
  58. package/dist/{formats-DhhbdyAH.js → formats-CeOmU1MU.js} +6 -6
  59. package/dist/{ganttDiagram-EL5Y4UJY-B4m_YsKa.js → ganttDiagram-EL5Y4UJY-BQT16JSc.js} +2 -2
  60. package/dist/{gitGraphDiagram-WWUBYQGX-QRBbvWXh.js → gitGraphDiagram-WWUBYQGX-D5nSIzdE.js} +2 -2
  61. package/dist/{glide-data-editor-D6CfYwdr.js → glide-data-editor-g_L8FLAC.js} +60 -60
  62. package/dist/{glide-utils-BVJ4fkxX.js → glide-utils-DJyqh0EM.js} +4 -4
  63. package/dist/{globals-BwK9YGrX.js → globals-CYGlmBXb.js} +3 -3
  64. package/dist/{highlighted-body-KPVGNVTW-Ad3MKZ18.js → highlighted-body-KPVGNVTW-zwjq21tf.js} +4 -4
  65. package/dist/{html-to-image-Cn1_16-x.js → html-to-image-B8s5SgGm.js} +37 -37
  66. package/dist/{infoDiagram-27XIBGKW-DVQFYvhg.js → infoDiagram-27XIBGKW-DipQoHxl.js} +2 -2
  67. package/dist/{ishikawaDiagram-5VMMS53U-viPND-nm.js → ishikawaDiagram-5VMMS53U-DgFMjSGz.js} +3 -3
  68. package/dist/{journeyDiagram-3NMN7TZE-BeeJdJo3.js → journeyDiagram-3NMN7TZE-BaLqn-dZ.js} +2 -2
  69. package/dist/{jsx-runtime-DgDPJV9S.js → jsx-runtime-3BD1kT0s.js} +1 -1
  70. package/dist/{kanban-definition-UXKFOSKX-Dcl_ECO9.js → kanban-definition-UXKFOSKX-w1ACVjgl.js} +9 -9
  71. package/dist/{katex-BNCmKUol.js → katex-BIdZGsyO.js} +141 -116
  72. package/dist/{label-DQO1jFjf.js → label-BDKF3Afc.js} +10 -10
  73. package/dist/{loader-Cm-ATtou.js → loader-BQOfjTIJ.js} +1 -1
  74. package/dist/main.js +623 -590
  75. package/dist/{mermaid-BfhcnSj-.js → mermaid-CHo49Yv-.js} +56 -56
  76. package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +2 -0
  77. package/dist/{mhchem-BEc7A1or.js → mhchem-CdWPJK6g.js} +1 -1
  78. package/dist/{mindmap-definition-YA3MSWOX-BdxxhF-5.js → mindmap-definition-YA3MSWOX-CrT0KSfX.js} +11 -11
  79. package/dist/{number-overlay-editor-tMylyldi.js → number-overlay-editor-9VRv-pdj.js} +5 -5
  80. package/dist/{pegDiagram-XKGWAZYB-Du5p2s0w.js → pegDiagram-XKGWAZYB-BqvywNJA.js} +3 -3
  81. package/dist/{pieDiagram-E7YTZNPT-DJg-SOIq.js → pieDiagram-E7YTZNPT-BfxJ_XCc.js} +3 -3
  82. package/dist/{process-output-CUG57KRp.js → process-output-CKRXyszb.js} +5 -5
  83. package/dist/{quadrantDiagram-AXDQQJYC-keLfFx9f.js → quadrantDiagram-AXDQQJYC-Ccw0xMjN.js} +1 -1
  84. package/dist/{railroadDiagram-O6MQD6OU-C0ojm-6_.js → railroadDiagram-O6MQD6OU-8vFLVTPu.js} +3 -3
  85. package/dist/{react-dom-BUgJ-ab_.js → react-dom-DUmH0GXv.js} +29 -21
  86. package/dist/{react-ofJbxM4x.js → react-sHtZdjeP.js} +103 -94
  87. package/dist/{react-vega-ewj7q_U5.js → react-vega-BED0DjiB.js} +3 -3
  88. package/dist/{requirementDiagram-BXWQKSXE-CNwNBmI3.js → requirementDiagram-BXWQKSXE-a_MxGvxe.js} +11 -11
  89. package/dist/{reveal-component-LXUMcqWX.js → reveal-component-C87mv9Mn.js} +906 -878
  90. package/dist/{sankeyDiagram-P5KCCOFB-Bh4EsJox.js → sankeyDiagram-P5KCCOFB-ELvOcnZH.js} +1 -1
  91. package/dist/{select-Bs-nmvm6.js → select-BButFi-d.js} +11 -11
  92. package/dist/{sequenceDiagram-WJ2MYXX4-DQaW5qBG.js → sequenceDiagram-WJ2MYXX4-CXFMnxGh.js} +4 -4
  93. package/dist/{spec-DVsoMvYT.js → spec-BwarBpUJ.js} +4 -4
  94. package/dist/{stateDiagram-D77RDMKH-BDa515QC.js → stateDiagram-D77RDMKH-DQeA_CwI.js} +13 -13
  95. package/dist/stateDiagram-v2-MP3YSRHH-BxxQucm1.js +30 -0
  96. package/dist/style.css +1 -1
  97. package/dist/{swimlanes-42K2YHIH-M4IdGi8J.js → swimlanes-42K2YHIH-Do6L-cYg.js} +10 -10
  98. package/dist/swimlanesDiagram-VR7AAH4N-DUzPvSVU.js +30 -0
  99. package/dist/{swiper-component-CpN-hewZ.js → swiper-component-DKntyn8p.js} +5 -5
  100. package/dist/{timeline-definition-24CTP7MA-DH-kvakg.js → timeline-definition-24CTP7MA-D3c46WM5.js} +3 -3
  101. package/dist/{toDate-vEi5kTfY.js → toDate-vIXljnsr.js} +43 -42
  102. package/dist/{toast-DfEpJedt.js → toast-B9UMEi8u.js} +9 -9
  103. package/dist/{tooltip-CuNWg2ay.js → tooltip-BO1REbqs.js} +7 -7
  104. package/dist/{use-restore-focus-kmgwrL8q.js → use-restore-focus-BEM7sFWl.js} +2042 -1827
  105. package/dist/{use-vega-container-remeasure-4DwJbPWu.js → use-vega-container-remeasure-Bz4PZMtt.js} +2 -2
  106. package/dist/{useAsyncData-rkAlR_vh.js → useAsyncData-Deh5kszT.js} +3 -3
  107. package/dist/{useDateFormatter-C-tz65rD.js → useDateFormatter-D8XruNGG.js} +4 -4
  108. package/dist/{useDeepCompareMemoize-BlHFBj5_.js → useDeepCompareMemoize-DXwzRINI.js} +2 -2
  109. package/dist/{useIframeCapabilities-C1Bt04Iz.js → useIframeCapabilities-DBETvvPl.js} +2 -2
  110. package/dist/{useLifecycle-B68iY077.js → useLifecycle-j7D9uD1o.js} +6 -6
  111. package/dist/{useTheme-BwSgeAFb.js → useTheme-CRnjkku0.js} +7 -7
  112. package/dist/{vega-component-C-bPttRN.js → vega-component-DTG6zxaY.js} +14 -14
  113. package/dist/{vega-embed-container-sSR5hAsy.js → vega-embed-container-BNHE18G9.js} +5 -5
  114. package/dist/{vennDiagram-4TSXK5OY-d5g7XeiI.js → vennDiagram-4TSXK5OY-BSZD8JcZ.js} +3 -3
  115. package/dist/{wardleyDiagram-VM6X3IG4-BfX3bSzR.js → wardleyDiagram-VM6X3IG4-48cUWkfA.js} +3 -3
  116. package/dist/{xychartDiagram-S5SC5T6Z-C1QsLZg7.js → xychartDiagram-S5SC5T6Z-CswYgYeu.js} +5 -5
  117. package/package.json +25 -22
  118. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  119. package/src/__tests__/host-imports.test.ts +100 -0
  120. package/src/__tests__/mount.test.ts +8 -8
  121. package/src/components/data-table/__tests__/column_formatting.test.ts +30 -0
  122. package/src/components/data-table/__tests__/columns.test.tsx +70 -0
  123. package/src/components/data-table/__tests__/context-menu.test.ts +176 -0
  124. package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +24 -1
  125. package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
  126. package/src/components/data-table/column-formatting/feature.ts +20 -1
  127. package/src/components/data-table/columns.tsx +25 -18
  128. package/src/components/data-table/context-menu.tsx +125 -26
  129. package/src/components/data-table/date-filter-inputs.tsx +15 -42
  130. package/src/components/data-table/export-actions.tsx +192 -116
  131. package/src/components/data-table/schemas.ts +14 -36
  132. package/src/components/data-table/utils.ts +18 -0
  133. package/src/components/editor/Output.tsx +9 -2
  134. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  135. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  136. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  137. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  138. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  139. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +372 -0
  140. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  141. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  142. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  143. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +4 -3
  144. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +548 -0
  145. package/src/components/editor/errors/send-error-report-button.tsx +69 -0
  146. package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
  147. package/src/components/editor/output/MarimoTracebackOutput.tsx +35 -20
  148. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  149. package/src/components/editor/output/ansi-reduce.ts +6 -0
  150. package/src/components/editor/output/console/ConsoleOutput.tsx +5 -3
  151. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +18 -0
  152. package/src/components/storage/__tests__/storage-file-viewer.test.tsx +2 -1
  153. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  154. package/src/core/attachments/state.ts +21 -0
  155. package/src/core/attachments/toast.ts +15 -0
  156. package/src/core/cells/__tests__/cells.test.ts +52 -0
  157. package/src/core/cells/__tests__/document-roundtrip.test.ts +16 -0
  158. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  159. package/src/core/cells/__tests__/session.test.ts +50 -1
  160. package/src/core/cells/error-report.ts +63 -0
  161. package/src/core/cells/session.ts +28 -1
  162. package/src/core/codemirror/copilot/__tests__/completion-integration.test.ts +447 -0
  163. package/src/core/codemirror/copilot/__tests__/inline-completion.test.ts +395 -0
  164. package/src/core/codemirror/copilot/__tests__/language-server.test.ts +511 -2
  165. package/src/core/codemirror/copilot/__tests__/rpc-cancellation.test.ts +201 -0
  166. package/src/core/codemirror/copilot/extension.ts +22 -11
  167. package/src/core/codemirror/copilot/language-server.ts +109 -60
  168. package/src/core/codemirror/language/__tests__/sql.test.ts +4 -3
  169. package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +138 -26
  170. package/src/core/codemirror/language/embedded/embedded-python.ts +47 -13
  171. package/src/core/codemirror/language/embedded/latex.ts +20 -13
  172. package/src/core/config/pair.ts +5 -3
  173. package/src/core/datasets/__tests__/data-source-discovery.test.ts +18 -11
  174. package/src/core/host/AGENTS.md +6 -0
  175. package/src/core/host/__tests__/protocol.test.ts +214 -0
  176. package/src/core/host/protocol.ts +1943 -0
  177. package/src/core/islands/__tests__/bootstrap.test.ts +26 -0
  178. package/src/core/islands/bootstrap.ts +1 -0
  179. package/src/core/islands/bridge.ts +2 -2
  180. package/src/core/kernel/messages.ts +4 -7
  181. package/src/core/network/__tests__/api.test.ts +114 -1
  182. package/src/core/network/api.ts +3 -2
  183. package/src/core/wasm/bridge.ts +2 -2
  184. package/src/core/wasm/worker/types.ts +2 -2
  185. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +193 -0
  186. package/src/core/websocket/useMarimoKernelConnection.tsx +9 -0
  187. package/src/css/katex-css.test.ts +1 -1
  188. package/src/css/katex.min.css +6 -1
  189. package/src/hooks/__tests__/useEventListener.test.tsx +45 -1
  190. package/src/hooks/useEventListener.ts +6 -1
  191. package/src/mount.tsx +3 -3
  192. package/src/plugins/impl/NumberPlugin.tsx +20 -3
  193. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  194. package/src/plugins/impl/__tests__/NumberPlugin.test.tsx +159 -1
  195. package/src/utils/__tests__/dates.test.ts +116 -0
  196. package/src/utils/dates.ts +94 -0
  197. package/dist/assets/__vite-browser-external-BqAtzd2P.js +0 -1
  198. package/dist/assets/worker-Bf8dt6S-.js +0 -109
  199. package/dist/classDiagram-ZZMXUADV-Bbo2n384.js +0 -30
  200. package/dist/classDiagram-v2-VYDZK3BY-xR8cGP0r.js +0 -30
  201. package/dist/error-entries-BovkFYNy.js +0 -56
  202. package/dist/flowDiagram-HODETNUW-D7IBKS12.js +0 -16
  203. package/dist/mermaid-HWGCJPDP-DYCzSILp.js +0 -2
  204. package/dist/stateDiagram-v2-MP3YSRHH-ChNddepZ.js +0 -30
  205. package/dist/swimlanesDiagram-VR7AAH4N-FUSwmzEp.js +0 -30
@@ -22,6 +22,7 @@ import {
22
22
  import { Kbd } from "@/components/ui/kbd";
23
23
  import { Tooltip } from "@/components/ui/tooltip";
24
24
  import { getCellEditorView } from "@/core/cells/cells";
25
+ import { buildErrorReport } from "@/core/cells/error-report";
25
26
  import type { CellId } from "@/core/cells/ids";
26
27
  import { SCRATCH_CELL_ID } from "@/core/cells/ids";
27
28
  import { toggleBreakpoint } from "@/core/codemirror/cells/debugger-state";
@@ -34,6 +35,7 @@ import { isWasm } from "@/core/wasm/utils";
34
35
  import { renderHTML } from "@/plugins/core/RenderHTML";
35
36
  import { sanitizeHtml } from "@/plugins/core/sanitize-html";
36
37
  import { copyToClipboard } from "@/utils/copy";
38
+ import { parseHtmlContent } from "@/utils/dom";
37
39
  import {
38
40
  containsMangledLocal,
39
41
  splitMangledLocals,
@@ -46,33 +48,45 @@ import {
46
48
  import { useOpenAiAssistant } from "../chrome/wrapper/useOpenAiAssistant";
47
49
  import { AIFixButton, buildFixInChatPrompt } from "../errors/auto-fix";
48
50
  import { MangledSegments } from "../errors/mangled-local-chip";
51
+ import { SendErrorReportButton } from "../errors/send-error-report-button";
49
52
  import { CellLinkTraceback } from "../links/cell-link";
50
53
  import type { OnRefactorWithAI } from "../Output";
51
54
 
52
55
  interface Props {
53
56
  cellId: CellId | undefined;
54
57
  traceback: string;
58
+ tracebackFormat?: "html" | "text";
59
+ code?: string;
55
60
  onRefactorWithAI?: OnRefactorWithAI;
56
61
  }
57
62
 
58
- /**
59
- * List of errors due to violations of Marimo semantics.
60
- */
63
+ /** Render a traceback and actions for its captured execution. */
61
64
  export const MarimoTracebackOutput = ({
62
65
  onRefactorWithAI,
63
66
  traceback,
67
+ tracebackFormat = "html",
64
68
  cellId,
69
+ code,
65
70
  }: Props): JSX.Element => {
66
- const htmlTraceback = renderHTML({
67
- html: traceback,
68
- additionalReplacements: [
69
- replaceTracebackFilenames,
70
- replaceTracebackPrefix,
71
- replaceMangledLocal,
72
- ],
73
- });
71
+ const htmlTraceback =
72
+ tracebackFormat === "text" ? (
73
+ <pre>{traceback}</pre>
74
+ ) : (
75
+ renderHTML({
76
+ html: traceback,
77
+ additionalReplacements: [
78
+ replaceTracebackFilenames,
79
+ replaceTracebackPrefix,
80
+ replaceMangledLocal,
81
+ ],
82
+ })
83
+ );
74
84
 
75
- const lastTracebackLine = lastLine(traceback);
85
+ const textTraceback =
86
+ tracebackFormat === "html"
87
+ ? parseHtmlContent(sanitizeHtml(traceback))
88
+ : traceback;
89
+ const lastTracebackLine = lastLine(textTraceback);
76
90
  const aiFeaturesEnabled = useAtomValue(aiFeaturesEnabledAtom);
77
91
  const openAiAssistant = useOpenAiAssistant();
78
92
 
@@ -131,6 +145,13 @@ export const MarimoTracebackOutput = ({
131
145
  </div>
132
146
  )}
133
147
  <div className="flex gap-2">
148
+ {cellId && lastTracebackLine && (
149
+ <SendErrorReportButton
150
+ getContent={() =>
151
+ buildErrorReport(cellId, { code, traceback, tracebackFormat })
152
+ }
153
+ />
154
+ )}
134
155
  {showAIFix && (
135
156
  <AIFixButton
136
157
  tooltip="Fix with AI"
@@ -186,11 +207,7 @@ export const MarimoTracebackOutput = ({
186
207
  </DropdownMenuItem>
187
208
  <DropdownMenuItem
188
209
  onClick={() => {
189
- // Strip HTML from the traceback (sanitize first to prevent XSS)
190
- const div = document.createElement("div");
191
- div.innerHTML = sanitizeHtml(traceback);
192
- const textContent = div.textContent || "";
193
- copyToClipboard(textContent);
210
+ copyToClipboard(textTraceback);
194
211
  }}
195
212
  >
196
213
  <CopyIcon className="h-4 w-4 mr-2" />
@@ -205,9 +222,7 @@ export const MarimoTracebackOutput = ({
205
222
  };
206
223
 
207
224
  function lastLine(text: string): string {
208
- const el = document.createElement("div");
209
- el.innerHTML = sanitizeHtml(text);
210
- const lines = el.textContent?.split("\n").filter(Boolean);
225
+ const lines = text.split("\n").filter(Boolean);
211
226
  return lines?.at(-1) || "";
212
227
  }
213
228
 
@@ -7,6 +7,24 @@ import {
7
7
  TerminalBuffer,
8
8
  } from "../ansi-reduce";
9
9
 
10
+ test("preserves source evidence through stateful output and serialization", () => {
11
+ const output = StatefulOutputMessage.create({
12
+ channel: "stderr",
13
+ mimetype: "application/vnd.marimo+traceback",
14
+ timestamp: 1,
15
+ data: "<pre>ValueError:",
16
+ code: "raise ValueError('failed code')",
17
+ }).appendData(" failed code</pre>");
18
+ expect(output.code).toBe("raise ValueError('failed code')");
19
+ expect(output.toJSON()).toEqual({
20
+ channel: "stderr",
21
+ mimetype: "application/vnd.marimo+traceback",
22
+ timestamp: 1,
23
+ data: "<pre>ValueError: failed code</pre>",
24
+ code: "raise ValueError('failed code')",
25
+ });
26
+ });
27
+
10
28
  describe("TerminalBuffer", () => {
11
29
  test("writeChar writes single character", () => {
12
30
  const buffer = new TerminalBuffer();
@@ -368,6 +368,7 @@ export class StatefulOutputMessage implements OutputMessage {
368
368
  public readonly mimetype: OutputMessage["mimetype"];
369
369
  public readonly channel: OutputMessage["channel"];
370
370
  public readonly timestamp: OutputMessage["timestamp"];
371
+ public readonly code: OutputMessage["code"];
371
372
  private ansiReducer = new AnsiReducer();
372
373
  private _data: string;
373
374
 
@@ -383,6 +384,7 @@ export class StatefulOutputMessage implements OutputMessage {
383
384
  message.channel,
384
385
  message.timestamp,
385
386
  ansiReducer,
387
+ message.code,
386
388
  );
387
389
  }
388
390
 
@@ -391,10 +393,12 @@ export class StatefulOutputMessage implements OutputMessage {
391
393
  channel: OutputMessage["channel"],
392
394
  timestamp: OutputMessage["timestamp"],
393
395
  ansiReducer: AnsiReducer,
396
+ code: OutputMessage["code"],
394
397
  ) {
395
398
  this.mimetype = mimetype;
396
399
  this.channel = channel;
397
400
  this.timestamp = timestamp;
401
+ this.code = code;
398
402
  this.ansiReducer = ansiReducer;
399
403
  this._data = this.ansiReducer.render();
400
404
  }
@@ -406,6 +410,7 @@ export class StatefulOutputMessage implements OutputMessage {
406
410
  this.channel,
407
411
  this.timestamp,
408
412
  this.ansiReducer,
413
+ this.code,
409
414
  );
410
415
  }
411
416
 
@@ -415,6 +420,7 @@ export class StatefulOutputMessage implements OutputMessage {
415
420
  channel: this.channel,
416
421
  timestamp: this.timestamp,
417
422
  data: this.data,
423
+ ...(this.code === undefined ? {} : { code: this.code }),
418
424
  };
419
425
  }
420
426
  }
@@ -360,10 +360,12 @@ const StdInput = (props: {
360
360
  }
361
361
 
362
362
  if (e.key === "Enter" && !e.shiftKey) {
363
- if (value && !isPassword) {
364
- addToHistory(value);
363
+ // Submit the visible input even if its change has not committed yet.
364
+ const submittedValue = e.currentTarget.value;
365
+ if (submittedValue && !isPassword) {
366
+ addToHistory(submittedValue);
365
367
  }
366
- onSubmit(value);
368
+ onSubmit(submittedValue);
367
369
  setValue("");
368
370
  e.preventDefault();
369
371
  e.stopPropagation();
@@ -179,6 +179,24 @@ describe("ConsoleOutput pdb history", () => {
179
179
  expect(nextInput).toHaveValue("");
180
180
  });
181
181
 
182
+ it("submits the visible input when its change has not reached React state", () => {
183
+ const onSubmitDebugger = vi.fn();
184
+ renderWithProvider(
185
+ <ConsoleOutput
186
+ {...defaultProps}
187
+ consoleOutputs={[stdinPrompt("Name: ")]}
188
+ onSubmitDebugger={onSubmitDebugger}
189
+ />,
190
+ );
191
+
192
+ const input = screen.getByTestId<HTMLInputElement>("console-input");
193
+ // Browser autofill or input events can precede the controlled-state update.
194
+ input.value = "marimo";
195
+ fireEvent.keyDown(input, { key: "Enter" });
196
+
197
+ expect(onSubmitDebugger).toHaveBeenCalledWith("marimo", 0);
198
+ });
199
+
182
200
  it("should submit an empty string when Enter is pressed with no input", () => {
183
201
  // Many CLIs prompt "Press Enter to continue" and expect "" back.
184
202
  const onSubmitDebugger = vi.fn();
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { render, screen } from "@testing-library/react";
4
4
  import { afterEach, describe, expect, it, vi } from "vitest";
5
+ import { requestId } from "@/__tests__/branded";
5
6
  import { TooltipProvider } from "@/components/ui/tooltip";
6
7
  import { DownloadStorage } from "@/core/storage/request-registry";
7
8
  import { StorageFileViewer } from "../storage-file-viewer";
@@ -41,7 +42,7 @@ describe("StorageFileViewer", () => {
41
42
 
42
43
  it("renders TOML from generic storage metadata as read-only TOML", async () => {
43
44
  const request = vi.spyOn(DownloadStorage, "request").mockResolvedValue({
44
- request_id: "request-id",
45
+ request_id: requestId("request-id"),
45
46
  url: "https://example.com/pyproject.toml?signature=secret",
46
47
  });
47
48
  vi.stubGlobal(
@@ -0,0 +1,58 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ // @vitest-environment jsdom
3
+
4
+ import { act, render, renderHook } from "@testing-library/react";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
+ import { Toaster } from "@/components/ui/toaster";
7
+ import { clearToasts, toast, useToast } from "@/components/ui/use-toast";
8
+ import { agentToast } from "../toast";
9
+
10
+ describe("agent notifications", () => {
11
+ beforeEach(() => {
12
+ vi.useFakeTimers();
13
+ clearToasts();
14
+ });
15
+
16
+ afterEach(() => {
17
+ act(() => {
18
+ clearToasts();
19
+ vi.runOnlyPendingTimers();
20
+ });
21
+ vi.useRealTimers();
22
+ });
23
+
24
+ it.each([
25
+ { variant: undefined, duration: 3000 },
26
+ { variant: "danger" as const, duration: 5000 },
27
+ ])("expires while the window is blurred: %j", ({ variant, duration }) => {
28
+ const { result } = renderHook(useToast);
29
+ render(<Toaster />);
30
+ act(() => agentToast({ title: "Agent notice", variant }));
31
+ act(() => window.dispatchEvent(new Event("blur")));
32
+ act(() => vi.advanceTimersByTime(duration - 1));
33
+ expect(result.current.toasts[0].open).toBe(true);
34
+ act(() => vi.advanceTimersByTime(1));
35
+ expect(result.current.toasts[0].open).toBe(false);
36
+ });
37
+
38
+ it("preserves pause behavior for ordinary notifications", () => {
39
+ const { result } = renderHook(useToast);
40
+ render(<Toaster />);
41
+ act(() => toast({ title: "Ordinary notice", duration: 3000 }));
42
+ act(() => window.dispatchEvent(new Event("blur")));
43
+ act(() => vi.advanceTimersByTime(5000));
44
+ expect(result.current.toasts[0].open).toBe(true);
45
+ });
46
+
47
+ it("does not let an older timer dismiss a newer notification", () => {
48
+ const { result } = renderHook(useToast);
49
+ act(() => agentToast({ title: "First" }));
50
+ act(() => vi.advanceTimersByTime(1000));
51
+ act(() => agentToast({ title: "Second" }));
52
+ act(() => vi.advanceTimersByTime(2000));
53
+ expect(result.current.toasts[0].title).toBe("Second");
54
+ expect(result.current.toasts[0].open).toBe(true);
55
+ act(() => vi.advanceTimersByTime(1000));
56
+ expect(result.current.toasts[0].open).toBe(false);
57
+ });
58
+ });
@@ -0,0 +1,21 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import type { components } from "@marimo-team/marimo-api";
4
+ import { atom } from "jotai";
5
+ import { isConnectedAtom } from "@/core/network/connection";
6
+
7
+ export type Attachment = components["schemas"]["Attachment"];
8
+
9
+ export const attachmentsAtom = atom<Attachment[]>([]);
10
+ export const agentAttachmentsAtom = atom((get) => {
11
+ if (!get(isConnectedAtom)) {
12
+ return [];
13
+ }
14
+ return get(attachmentsAtom).filter(
15
+ (attachment) => attachment.kind === "agent",
16
+ );
17
+ });
18
+
19
+ export function attachmentLabel(attachment: Attachment): string {
20
+ return attachment.name || "Agent";
21
+ }
@@ -0,0 +1,15 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { toast } from "@/components/ui/use-toast";
4
+
5
+ export function agentToast(
6
+ options: Pick<
7
+ Parameters<typeof toast>[0],
8
+ "title" | "variant" | "description"
9
+ >,
10
+ ) {
11
+ const duration = options.variant === "danger" ? 5000 : 3000;
12
+ const { dismiss } = toast({ ...options, duration });
13
+ // Agent notices must also expire while the user focuses the agent terminal.
14
+ window.setTimeout(dismiss, duration);
15
+ }
@@ -789,6 +789,58 @@ describe("cell reducer", () => {
789
789
  `);
790
790
  });
791
791
 
792
+ it("keeps error evidence after an edit and a new queued run", () => {
793
+ const code = "raise ValueError('old failure')";
794
+ const output: OutputMessage = {
795
+ channel: "marimo-error",
796
+ mimetype: "application/vnd.marimo+error",
797
+ data: [
798
+ {
799
+ type: "exception",
800
+ msg: "old failure",
801
+ exception_type: "ValueError",
802
+ raising_cell: null,
803
+ traceback: "<pre>ValueError: old failure</pre>",
804
+ },
805
+ ],
806
+ code,
807
+ timestamp: 1,
808
+ };
809
+ actions.handleCellMessage({
810
+ cell_id: firstCellId,
811
+ output,
812
+ console: {
813
+ channel: "stderr",
814
+ mimetype: "application/vnd.marimo+traceback",
815
+ data: "<pre>ValueError: old failure</pre>",
816
+ code,
817
+ timestamp: 1,
818
+ },
819
+ status: "idle",
820
+ stale_inputs: null,
821
+ timestamp: 1,
822
+ });
823
+ actions.updateCellCode({
824
+ cellId: firstCellId,
825
+ code: "print('new code')",
826
+ formattingChange: false,
827
+ });
828
+ actions.prepareForRun({ cellId: firstCellId });
829
+ actions.handleCellMessage({
830
+ cell_id: firstCellId,
831
+ output: null,
832
+ console: null,
833
+ status: "queued",
834
+ stale_inputs: null,
835
+ timestamp: 2,
836
+ });
837
+ const runtime = state.cellRuntime[firstCellId];
838
+ expect(state.cellData[firstCellId].lastCodeRun).toBe("print('new code')");
839
+ expect(runtime.output).toEqual(output);
840
+ expect(runtime.consoleOutputs[0].code).toBe(code);
841
+ expect(runtime.consoleOutputs[0].data).toContain("old failure");
842
+ });
843
+
792
844
  it("can run cell and receive cell messages", () => {
793
845
  // HAPPY PATH
794
846
  /////////////////
@@ -178,6 +178,22 @@ function documentSnapshot(state: NotebookState) {
178
178
  }
179
179
 
180
180
  describe("document round-trip", () => {
181
+ it("applies a server transaction that deletes every cell", () => {
182
+ setup("a", "b");
183
+ applyTransactionChanges(
184
+ [
185
+ ...replica.cellIds.inOrderIds.map((cellId) => ({
186
+ type: "delete-cell" as const,
187
+ cellId,
188
+ })),
189
+ { type: "reorder-cells", cellIds: [] },
190
+ ],
191
+ replicaActions,
192
+ () => replica.cellIds.inOrderIds,
193
+ );
194
+ expect(documentSnapshot(replica)).toEqual([]);
195
+ });
196
+
181
197
  it("initial setup converges", () => {
182
198
  setup("a", "b", "c");
183
199
  expect(documentSnapshot(primary)).toEqual(documentSnapshot(replica));
@@ -0,0 +1,139 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ // @vitest-environment jsdom
3
+
4
+ import { describe, expect, it } from "vitest";
5
+ import { cellId } from "@/__tests__/branded";
6
+ import type { MarimoError } from "@/core/kernel/messages";
7
+ import { buildErrorReport, ERROR_MESSAGE_INSTRUCTIONS } from "../error-report";
8
+
9
+ const CELL_ID = cellId("failed-cell");
10
+
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
+
52
+ it("retains every message and complete traceback without display limits", () => {
53
+ const traceback = `Traceback\n${"long frame\n".repeat(10_000)}ValueError: bad <value>`;
54
+ const errors: MarimoError[] = [
55
+ {
56
+ type: "exception",
57
+ msg: "bad <value>",
58
+ exception_type: "ValueError",
59
+ raising_cell: null,
60
+ traceback: `<pre>${traceback.replaceAll("<", "&lt;").replaceAll(">", "&gt;")}</pre>`,
61
+ },
62
+ { type: "syntax", msg: "another error" },
63
+ ];
64
+ expect(buildErrorReport(CELL_ID, { code: "failed()", errors })).toEqual({
65
+ type: "cell-output",
66
+ cell_id: CELL_ID,
67
+ code: "failed()",
68
+ output: {
69
+ type: "error",
70
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
71
+ message: "bad <value>\nanother error",
72
+ traceback,
73
+ },
74
+ });
75
+ });
76
+
77
+ it("leaves source unknown for a restored legacy exception", () => {
78
+ expect(
79
+ buildErrorReport(CELL_ID, {
80
+ errors: [
81
+ {
82
+ type: "exception",
83
+ exception_type: "exception",
84
+ msg: "legacy error",
85
+ raising_cell: null,
86
+ traceback: null,
87
+ },
88
+ ],
89
+ }),
90
+ ).toEqual({
91
+ type: "cell-output",
92
+ cell_id: CELL_ID,
93
+ output: {
94
+ type: "error",
95
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
96
+ message: "legacy error",
97
+ },
98
+ });
99
+ });
100
+
101
+ it("preserves empty captured code", () => {
102
+ expect(
103
+ buildErrorReport(CELL_ID, {
104
+ code: "",
105
+ errors: [{ type: "syntax", msg: "invalid code" }],
106
+ }),
107
+ ).toEqual({
108
+ type: "cell-output",
109
+ cell_id: CELL_ID,
110
+ code: "",
111
+ output: {
112
+ type: "error",
113
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
114
+ message: "invalid code",
115
+ },
116
+ });
117
+ });
118
+
119
+ it("keeps separate structured tracebacks in order", () => {
120
+ const errors: MarimoError[] = ["first", "second"].map((message) => ({
121
+ type: "exception",
122
+ exception_type: "ValueError",
123
+ raising_cell: null,
124
+ msg: message,
125
+ traceback: `<pre>Traceback\nValueError: ${message}</pre>`,
126
+ }));
127
+ expect(buildErrorReport(CELL_ID, { errors })).toEqual({
128
+ type: "cell-output",
129
+ cell_id: CELL_ID,
130
+ output: {
131
+ type: "error",
132
+ instructions: ERROR_MESSAGE_INSTRUCTIONS,
133
+ message: "first\nsecond",
134
+ traceback:
135
+ "Traceback\nValueError: first\n\nTraceback\nValueError: second",
136
+ },
137
+ });
138
+ });
139
+ });
@@ -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",
@@ -183,6 +186,52 @@ describe("notebookStateFromSession", () => {
183
186
  });
184
187
  });
185
188
 
189
+ it("restores matching code from the session", () => {
190
+ const code = "raise ValueError('cached failure')";
191
+ const session = createSession([
192
+ createSessionCell(
193
+ "cell-1",
194
+ [
195
+ {
196
+ type: "error",
197
+ ename: "ValueError",
198
+ evalue: "cached failure",
199
+ traceback: ["Traceback\n", "ValueError: cached failure"],
200
+ code,
201
+ },
202
+ ],
203
+ [
204
+ {
205
+ type: "stream",
206
+ name: "stderr",
207
+ text: "ValueError: cached <failure>",
208
+ mimetype: "application/vnd.marimo+traceback",
209
+ traceback_format: "text",
210
+ code,
211
+ },
212
+ ],
213
+ ),
214
+ ]);
215
+ const state = notebookStateFromSession(session, null);
216
+ invariant(state, "state is null");
217
+ expect(state.cellRuntime[CELL_1].output).toMatchObject({
218
+ code,
219
+ data: [
220
+ {
221
+ type: "exception",
222
+ exception_type: "ValueError",
223
+ msg: "cached failure",
224
+ traceback: "Traceback\nValueError: cached failure",
225
+ },
226
+ ],
227
+ });
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
+ });
233
+ });
234
+
186
235
  it("handles data output in session cell", () => {
187
236
  const dataOutput = {
188
237
  type: "data" as const,