@marimo-team/frontend 0.15.5 → 0.16.0-dev96986

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 (325) hide show
  1. package/dist/assets/ConnectedDataExplorerComponent-CNLoZkWr.js +19 -0
  2. package/dist/assets/{ImageComparisonComponent-CEXMKKA4.js → ImageComparisonComponent-SX7fDaTK.js} +1 -1
  3. package/dist/assets/{VegaLite-Bt14Ds9k.js → VegaLite-MJUW3b7C.js} +6 -6
  4. package/dist/assets/_baseEach-9_logFrf.js +1 -0
  5. package/dist/assets/_baseMap-NzEbKt5c.js +1 -0
  6. package/dist/assets/_baseUniq-C5LFcyNC.js +1 -0
  7. package/dist/assets/_createAggregator-ZRm2b6Zm.js +1 -0
  8. package/dist/assets/agent-panel-BBd11wNX.js +287 -0
  9. package/dist/assets/agent-panel-D92Mfy1i.css +1 -0
  10. package/dist/assets/{any-language-editor-DiwNT6zp.js → any-language-editor-DwAaEQfS.js} +1 -1
  11. package/dist/assets/architectureDiagram-W76B3OCA-BJmVXUoW.js +36 -0
  12. package/dist/assets/{between-horizontal-start-FyewyCGn.js → between-horizontal-start-KiwU-a3C.js} +1 -1
  13. package/dist/assets/{blockDiagram-QIGZ2CNN-BrOkAf_c.js → blockDiagram-QIGZ2CNN-DzxZjE7B.js} +1 -1
  14. package/dist/assets/{c4Diagram-FPNF74CW-BHPzDxE2.js → c4Diagram-FPNF74CW-DjmldG_J.js} +5 -5
  15. package/dist/assets/channel-DHcKBVM4.js +1 -0
  16. package/dist/assets/chat-panel-DgJZr0eS.js +3 -0
  17. package/dist/assets/{chunk-4BX2VUAB-DLxaCNYh.js → chunk-4BX2VUAB-EUTQThiZ.js} +1 -1
  18. package/dist/assets/{chunk-55IACEB6-DdzvO3HR.js → chunk-55IACEB6-DZAiDJxy.js} +1 -1
  19. package/dist/assets/{chunk-FMBD7UC4-R5o-nSiG.js → chunk-FMBD7UC4-Bd0Czs-J.js} +1 -1
  20. package/dist/assets/{chunk-K7UQS3LO-DxaMrGgG.js → chunk-K7UQS3LO-DEKMIknX.js} +1 -1
  21. package/dist/assets/{chunk-QN33PNHL-DqS9-FYm.js → chunk-QN33PNHL-E0jwHU_n.js} +1 -1
  22. package/dist/assets/{chunk-QZHKN3VN-BZ-TzajS.js → chunk-QZHKN3VN-BzaIHJbq.js} +1 -1
  23. package/dist/assets/{chunk-TVAH2DTR-BsgP2dyv.js → chunk-TVAH2DTR-CZFYvqnm.js} +1 -1
  24. package/dist/assets/{chunk-TZMSLE5B-D-h3ahXI.js → chunk-TZMSLE5B-BNqnFjtv.js} +1 -1
  25. package/dist/assets/{circle-play-CQtRZ-rT.js → circle-play-D3J_mYrF.js} +1 -1
  26. package/dist/assets/classDiagram-KNZD7YFC-D-xwLnlX.js +1 -0
  27. package/dist/assets/classDiagram-v2-RKCZMP56-D-xwLnlX.js +1 -0
  28. package/dist/assets/{clear-button-BY6Z_ViL.js → clear-button-ifzRuAR3.js} +1 -1
  29. package/dist/assets/clone-CSxIll62.js +1 -0
  30. package/dist/assets/command-palette-D2fdVSET.js +1 -0
  31. package/dist/assets/common-Ku-cF_2J.js +1 -0
  32. package/dist/assets/{compile-Ct_jzdKr.js → compile-BgZlHW1c.js} +1 -1
  33. package/dist/assets/cose-bilkent-S5V4N54A-CVM83SqK.js +1 -0
  34. package/dist/assets/dagre-5GWH7T2D-ouQPkxT3.js +4 -0
  35. package/dist/assets/{data-grid-overlay-editor-BN_wulc3.js → data-grid-overlay-editor-B47j5GJJ.js} +1 -1
  36. package/dist/assets/datasources-panel-Bt41Zir-.js +1 -0
  37. package/dist/assets/{dependency-graph-panel-BOmSCZf7.js → dependency-graph-panel-CZC_B7pK.js} +4 -4
  38. package/dist/assets/diagram-N5W7TBWH-CQ817ZdR.js +24 -0
  39. package/dist/assets/diagram-QEK2KX5R-DOK_psUO.js +43 -0
  40. package/dist/assets/diagram-S2PKOQOG-CVljmOW8.js +24 -0
  41. package/dist/assets/{documentation-panel-BxjJO_Gw.js → documentation-panel-C7yIvGg1.js} +1 -1
  42. package/dist/assets/edit-page-CyTMQV2u.js +129 -0
  43. package/dist/assets/{ellipsis-vertical-UHbmjI2n.js → ellipsis-vertical-C7FjlUsY.js} +1 -1
  44. package/dist/assets/{empty-state-BIBXzY_0.js → empty-state-DIOGM_CU.js} +1 -1
  45. package/dist/assets/{erDiagram-AWTI2OKA-E84mAle_.js → erDiagram-AWTI2OKA-DYu8cEdc.js} +1 -1
  46. package/dist/assets/{error-panel-MEvQ6K7h.js → error-panel-Ddb8RkFG.js} +1 -1
  47. package/dist/assets/file-explorer-panel-Oy9DbyFP.js +1 -0
  48. package/dist/assets/{flowDiagram-PVAE7QVJ-DfbIRSAW.js → flowDiagram-PVAE7QVJ-CmvW5iTb.js} +1 -1
  49. package/dist/assets/{ganttDiagram-OWAHRB6G-DR4HZ1z_.js → ganttDiagram-OWAHRB6G-BaKQlCaT.js} +4 -4
  50. package/dist/assets/gitGraphDiagram-NY62KEGX-CWO24eP6.js +65 -0
  51. package/dist/assets/{glide-data-editor-nNmo1lPq.js → glide-data-editor-CNDLEJ9a.js} +11 -11
  52. package/dist/assets/graph-BZKTtxsc.js +1 -0
  53. package/dist/assets/home-page-Bvwppn9N.js +9 -0
  54. package/dist/assets/{index-VPWqq2Pg.js → index-0XOUPdwT.js} +1 -1
  55. package/dist/assets/{index-uacyUula.js → index-BH7f3aiU.js} +1 -1
  56. package/dist/assets/{index-Dt9UWeWn.js → index-BJVyzkx5.js} +1 -1
  57. package/dist/assets/{index-BAH034Ue.js → index-B_d_JZGI.js} +1 -1
  58. package/dist/assets/{index-CB2pnVQG.js → index-BgXbBA39.js} +1 -1
  59. package/dist/assets/{index-B8llrTSo.js → index-Brf2DwUM.js} +1 -1
  60. package/dist/assets/{index-BLu5CX6z.js → index-CXrWwFX6.js} +1 -1
  61. package/dist/assets/{index-DyLSuOH1.js → index-CZaurnA9.js} +1 -1
  62. package/dist/assets/{index-BFSnz7iM.js → index-CerjupfZ.js} +1 -1
  63. package/dist/assets/{index-B7yXbrLa.js → index-D-tZfElD.js} +1 -1
  64. package/dist/assets/{index-c6If577Q.js → index-D3PqGupX.js} +1 -1
  65. package/dist/assets/{index-CSgxTUzD.js → index-DCkzth56.js} +1 -1
  66. package/dist/assets/{index-DWOaniGT.js → index-DFrGFNW1.js} +1 -1
  67. package/dist/assets/{index-CPN7TRA1.js → index-DZhOPkOB.js} +1 -1
  68. package/dist/assets/index-DadI618h.css +1 -0
  69. package/dist/assets/{index-DqzMPAC8.js → index-DkntzpX4.js} +2 -2
  70. package/dist/assets/{index-B1_GXGaP.js → index-DmgwT3sx.js} +1 -1
  71. package/dist/assets/index-PmY0x4Zd.js +578 -0
  72. package/dist/assets/{index-Bq516OmX.js → index-WXJFkQHg.js} +1 -1
  73. package/dist/assets/{index-DSU75csX.js → index-qE8lHQ-N.js} +1 -1
  74. package/dist/assets/{index-DMomwMcN.js → index-zrSUQXha.js} +1 -1
  75. package/dist/assets/infoDiagram-STP46IZ2-CAuVVehw.js +2 -0
  76. package/dist/assets/isEmpty-D1t7Gran.js +1 -0
  77. package/dist/assets/{journeyDiagram-BIP6EPQ6-BBiFyygf.js → journeyDiagram-BIP6EPQ6-D4Rp6H_h.js} +1 -1
  78. package/dist/assets/{kanban-definition-6OIFK2YF-DhgA6Nt6.js → kanban-definition-6OIFK2YF-DFt9DftA.js} +4 -4
  79. package/dist/assets/layout-D8WXi2_g.js +1 -0
  80. package/dist/assets/linear-BwY8e5hA.js +1 -0
  81. package/dist/assets/links-4B6ldZ5P.js +7 -0
  82. package/dist/assets/{logs-panel-B9SmTZAW.js → logs-panel-Dxiyt7dO.js} +1 -1
  83. package/dist/assets/{agent-panel-DpQ6muj-.css → markdown-renderer-ClyzDMmG.css} +1 -1
  84. package/dist/assets/markdown-renderer-VDu-NBKB.js +263 -0
  85. package/dist/assets/mermaid-B-O-Puyi.js +1 -0
  86. package/dist/assets/{mermaid.core-4nVOEVX3.js → mermaid.core-BFFCqfOn.js} +41 -41
  87. package/dist/assets/min-DtVSfYKl.js +1 -0
  88. package/dist/assets/{mindmap-definition-Q6HEUPPD-CVLQNn1q.js → mindmap-definition-Q6HEUPPD-kyvIY8Dg.js} +2 -2
  89. package/dist/assets/{number-overlay-editor-CzRzXLcd.js → number-overlay-editor-GjLB2UK4.js} +1 -1
  90. package/dist/assets/outline-panel-CMJjOoN7.js +1 -0
  91. package/dist/assets/packages-panel-nfXB-bKW.js +1 -0
  92. package/dist/assets/{pieDiagram-ADFJNKIX-C5IQ5DBZ.js → pieDiagram-ADFJNKIX-D8JFQcWR.js} +3 -3
  93. package/dist/assets/{quadrantDiagram-LMRXKWRM-CFXFnQxx.js → quadrantDiagram-LMRXKWRM-Nf8GzxXG.js} +1 -1
  94. package/dist/assets/{react-plotly-mzdv02_Y.js → react-plotly-CnW9p7ZA.js} +1 -1
  95. package/dist/assets/{requirementDiagram-4UW4RH46-D9bPC89T.js → requirementDiagram-4UW4RH46-CCUxF8BZ.js} +1 -1
  96. package/dist/assets/run-page-Bl4p3AbZ.js +1 -0
  97. package/dist/assets/sankeyDiagram-GR3RE2ED-Sr8kDwP1.js +10 -0
  98. package/dist/assets/scratchpad-panel-Ja1Mu-W3.js +1 -0
  99. package/dist/assets/secrets-panel-B-3fcSyP.js +1 -0
  100. package/dist/assets/{sequenceDiagram-C3RYC4MD-6N7_hY4k.js → sequenceDiagram-C3RYC4MD-CBJ152Q3.js} +4 -4
  101. package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
  102. package/dist/assets/{slides-component-EcjC8sDK.js → slides-component-DGtsVP5o.js} +1 -1
  103. package/dist/assets/snippets-panel-ClNnwKBM.js +1 -0
  104. package/dist/assets/sortBy-D47H6Vyl.js +1 -0
  105. package/dist/assets/state-B_RCHTH5.js +1 -0
  106. package/dist/assets/stateDiagram-KXAO66HF-BlBFSAZr.js +1 -0
  107. package/dist/assets/stateDiagram-v2-UMBNRL4Z-DbA-iToo.js +1 -0
  108. package/dist/assets/storage-BNcWOH3-.js +26 -0
  109. package/dist/assets/terminal-CATzv5Hd.js +10 -0
  110. package/dist/assets/time-CsYqILfB.js +1 -0
  111. package/dist/assets/{timeline-definition-XQNQX7LJ-BEaynAiY.js → timeline-definition-XQNQX7LJ-CGrhjuAs.js} +1 -1
  112. package/dist/assets/tracing-DUbJtOyq.js +2 -0
  113. package/dist/assets/{tracing-panel-BmuHLPrY.js → tracing-panel-DmzqPUtc.js} +2 -2
  114. package/dist/assets/{trash-UBqfK4mR.js → trash-rxdjLzkf.js} +1 -1
  115. package/dist/assets/{tree-XiEycetl.js → tree-C2Ul1h1C.js} +1 -1
  116. package/dist/assets/{treemap-75Q7IDZK-CnuVFbBG.js → treemap-75Q7IDZK-N9hyUpyj.js} +20 -20
  117. package/dist/assets/{ts-tags-CloPe9IY.js → ts-tags-DxCDHihD.js} +1 -1
  118. package/dist/assets/variable-panel-BbgupOdG.js +1 -0
  119. package/dist/assets/{vega-component-DsTH4tuX.js → vega-component-CR_MHOBT.js} +1 -1
  120. package/dist/assets/worker-fHbtoWvT.js +1 -0
  121. package/dist/assets/{xychartDiagram-6GGTOJPD-Dcz3O-A3.js → xychartDiagram-6GGTOJPD-jdLZsMb2.js} +1 -1
  122. package/dist/index.html +2 -2
  123. package/package.json +10 -5
  124. package/src/__tests__/mocks.ts +43 -0
  125. package/src/components/app-config/user-config-form.tsx +78 -1
  126. package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +116 -65
  127. package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
  128. package/src/components/chat/acp/__tests__/context-utils.test.ts +222 -0
  129. package/src/components/chat/acp/__tests__/prompt.test.ts +1 -1
  130. package/src/components/chat/acp/__tests__/state.test.ts +38 -42
  131. package/src/components/chat/acp/agent-docs.tsx +33 -6
  132. package/src/components/chat/acp/agent-panel.css +0 -18
  133. package/src/components/chat/acp/agent-panel.tsx +394 -72
  134. package/src/components/chat/acp/agent-selector.tsx +7 -1
  135. package/src/components/chat/acp/blocks.tsx +40 -10
  136. package/src/components/chat/acp/common.tsx +10 -2
  137. package/src/components/chat/acp/context-utils.ts +127 -0
  138. package/src/components/chat/acp/prompt.ts +96 -53
  139. package/src/components/chat/acp/state.ts +1 -1
  140. package/src/components/chat/acp/types.ts +8 -0
  141. package/src/components/chat/chat-panel.tsx +28 -89
  142. package/src/components/chat/chat-utils.ts +127 -1
  143. package/src/components/chat/markdown-renderer.css +39 -0
  144. package/src/components/chat/markdown-renderer.tsx +12 -47
  145. package/src/components/chat/tool-call-accordion.tsx +148 -26
  146. package/src/components/data-table/SearchBar.tsx +8 -7
  147. package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
  148. package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
  149. package/src/components/data-table/cell-hover-template/feature.ts +14 -0
  150. package/src/components/data-table/cell-hover-template/types.ts +11 -0
  151. package/src/components/data-table/charts/components/form-fields.tsx +41 -37
  152. package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
  153. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
  154. package/src/components/data-table/column-formatting/feature.ts +62 -29
  155. package/src/components/data-table/column-formatting/types.ts +1 -0
  156. package/src/components/data-table/column-header.tsx +3 -1
  157. package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
  158. package/src/components/data-table/column-summary/column-summary.tsx +18 -9
  159. package/src/components/data-table/columns.tsx +42 -18
  160. package/src/components/data-table/data-table.tsx +10 -2
  161. package/src/components/data-table/date-popover.tsx +85 -75
  162. package/src/components/data-table/filter-pills.tsx +14 -9
  163. package/src/components/data-table/header-items.tsx +5 -1
  164. package/src/components/data-table/pagination.tsx +20 -13
  165. package/src/components/data-table/renderers.tsx +28 -0
  166. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
  167. package/src/components/datasources/column-preview.tsx +6 -2
  168. package/src/components/datasources/datasources.tsx +8 -12
  169. package/src/components/editor/Cell.tsx +6 -0
  170. package/src/components/editor/actions/name-cell-input.tsx +6 -1
  171. package/src/components/editor/actions/useCellActionButton.tsx +3 -1
  172. package/src/components/editor/ai/__tests__/completion-utils.test.ts +178 -1
  173. package/src/components/editor/ai/add-cell-with-ai.tsx +68 -66
  174. package/src/components/editor/ai/ai-completion-editor.tsx +29 -26
  175. package/src/components/editor/ai/completion-handlers.tsx +44 -6
  176. package/src/components/editor/ai/completion-utils.ts +92 -0
  177. package/src/components/editor/ai/transport/chat-transport.tsx +39 -0
  178. package/src/components/editor/cell/CellStatus.tsx +23 -20
  179. package/src/components/editor/cell/CreateCellButton.tsx +3 -4
  180. package/src/components/editor/cell/StagedAICell.tsx +51 -0
  181. package/src/components/editor/cell/cell-actions.tsx +2 -1
  182. package/src/components/editor/cell/code/language-toggle.tsx +3 -4
  183. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
  184. package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
  185. package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
  186. package/src/components/editor/renderers/CellArray.tsx +3 -4
  187. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
  188. package/src/components/editor/renderers/slides-layout/types.ts +1 -0
  189. package/src/components/pages/home-page.tsx +4 -1
  190. package/src/components/slides/slides-component.tsx +1 -1
  191. package/src/components/slides/slides.css +6 -0
  192. package/src/components/terminal/__tests__/state.test.ts +207 -0
  193. package/src/components/terminal/hooks.ts +41 -0
  194. package/src/components/terminal/state.ts +75 -0
  195. package/src/components/terminal/terminal.tsx +334 -13
  196. package/src/components/terminal/theme.tsx +57 -0
  197. package/src/components/tracing/tracing-spec.ts +5 -4
  198. package/src/components/ui/range-slider.tsx +4 -2
  199. package/src/components/ui/slider.tsx +3 -1
  200. package/src/components/variables/variables-table.tsx +3 -0
  201. package/src/core/MarimoApp.tsx +9 -6
  202. package/src/core/ai/__tests__/staged-cells.test.ts +356 -0
  203. package/src/core/ai/context/__tests__/registry.test.ts +6 -4
  204. package/src/core/ai/context/providers/cell-output.ts +3 -2
  205. package/src/core/ai/context/providers/error.ts +3 -1
  206. package/src/core/ai/context/providers/file.ts +7 -2
  207. package/src/core/ai/context/providers/tables.ts +3 -2
  208. package/src/core/ai/context/providers/variable.ts +6 -4
  209. package/src/core/ai/staged-cells.ts +208 -0
  210. package/src/core/cells/cells.ts +1 -1
  211. package/src/core/cells/logs.ts +1 -1
  212. package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
  213. package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
  214. package/src/core/codemirror/lsp/federated-lsp.ts +1 -1
  215. package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
  216. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  217. package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
  218. package/src/core/codemirror/rtc/loro/sync.ts +12 -4
  219. package/src/core/config/config-schema.ts +1 -0
  220. package/src/core/config/config.ts +4 -0
  221. package/src/core/hotkeys/hotkeys.ts +8 -4
  222. package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
  223. package/src/core/i18n/locale-provider.tsx +35 -0
  224. package/src/core/i18n/with-locale.tsx +12 -0
  225. package/src/core/islands/components/web-components.tsx +13 -10
  226. package/src/core/islands/main.ts +2 -2
  227. package/src/core/kernel/RuntimeState.ts +4 -1
  228. package/src/core/kernel/messages.ts +8 -12
  229. package/src/core/network/DeferredRequestRegistry.ts +16 -4
  230. package/src/core/runtime/runtime.ts +5 -4
  231. package/src/core/saving/__tests__/filename.test.ts +37 -0
  232. package/src/core/static/__tests__/download-html.test.ts +43 -1
  233. package/src/core/wasm/bridge.ts +5 -1
  234. package/src/core/wasm/store.ts +4 -1
  235. package/src/core/wasm/worker/message-buffer.ts +3 -2
  236. package/src/core/websocket/types.ts +22 -16
  237. package/src/core/websocket/useMarimoWebSocket.tsx +2 -2
  238. package/src/css/app/Cell.css +11 -0
  239. package/src/hooks/useFormatting.ts +97 -0
  240. package/src/hooks/useTimer.ts +8 -5
  241. package/src/plugins/core/RenderHTML.tsx +36 -2
  242. package/src/plugins/core/__test__/RenderHTML.test.ts +72 -0
  243. package/src/plugins/core/registerReactComponent.tsx +44 -10
  244. package/src/plugins/impl/DataTablePlugin.tsx +4 -0
  245. package/src/plugins/impl/FileBrowserPlugin.tsx +8 -2
  246. package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
  247. package/src/plugins/impl/SliderPlugin.tsx +3 -1
  248. package/src/plugins/impl/anywidget/model.ts +16 -5
  249. package/src/plugins/impl/data-editor/types.ts +7 -5
  250. package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
  251. package/src/plugins/impl/panel/utils.ts +6 -4
  252. package/src/plugins/layout/OutlinePlugin.tsx +69 -0
  253. package/src/plugins/layout/StatPlugin.tsx +4 -1
  254. package/src/plugins/plugins.ts +2 -0
  255. package/src/stories/cell.stories.tsx +1 -1
  256. package/src/stories/layout/vertical/one-column.stories.tsx +1 -1
  257. package/src/utils/__tests__/cell-urls.test.ts +29 -0
  258. package/src/utils/__tests__/dates.test.ts +45 -24
  259. package/src/utils/__tests__/filenames.test.ts +18 -0
  260. package/src/utils/__tests__/numbers.test.ts +42 -30
  261. package/src/utils/__tests__/once.test.ts +187 -0
  262. package/src/utils/__tests__/path.test.ts +38 -0
  263. package/src/utils/__tests__/urls.test.ts +56 -1
  264. package/src/utils/dates.ts +15 -10
  265. package/src/utils/edit-distance.ts +8 -6
  266. package/src/utils/errors.ts +9 -0
  267. package/src/utils/id-tree.tsx +21 -10
  268. package/src/utils/localStorage.ts +13 -4
  269. package/src/utils/numbers.ts +11 -11
  270. package/src/utils/once.ts +32 -0
  271. package/src/utils/paths.ts +4 -1
  272. package/src/utils/pluralize.ts +12 -5
  273. package/src/utils/python-poet/poet.ts +30 -15
  274. package/src/utils/time.ts +5 -1
  275. package/dist/assets/ConnectedDataExplorerComponent-Cn5-l2X1.js +0 -19
  276. package/dist/assets/_baseEach-C1FLm7WW.js +0 -1
  277. package/dist/assets/_baseMap-DBVArUYD.js +0 -1
  278. package/dist/assets/_baseUniq-Dk7ZPJ3N.js +0 -1
  279. package/dist/assets/_createAggregator-Bn38fDd3.js +0 -1
  280. package/dist/assets/agent-panel-COUYnuIK.js +0 -475
  281. package/dist/assets/architectureDiagram-W76B3OCA-DBzWQKKu.js +0 -36
  282. package/dist/assets/channel-CjhbjOv4.js +0 -1
  283. package/dist/assets/chat-panel-BPXKoTnZ.js +0 -7
  284. package/dist/assets/chat-panel-Brrs_eeH.css +0 -1
  285. package/dist/assets/classDiagram-KNZD7YFC-DHs5cFzy.js +0 -1
  286. package/dist/assets/classDiagram-v2-RKCZMP56-DHs5cFzy.js +0 -1
  287. package/dist/assets/clone-DM1YNjEn.js +0 -1
  288. package/dist/assets/command-palette-S0bzQp7v.js +0 -1
  289. package/dist/assets/common-B8U9k2Ly.js +0 -1
  290. package/dist/assets/cose-bilkent-S5V4N54A-wz1Sfx7j.js +0 -1
  291. package/dist/assets/dagre-5GWH7T2D-BfpcVBgq.js +0 -4
  292. package/dist/assets/datasources-panel-DfuURLJw.js +0 -1
  293. package/dist/assets/diagram-N5W7TBWH-Bf0oqqQh.js +0 -24
  294. package/dist/assets/diagram-QEK2KX5R-ZTc3qikh.js +0 -43
  295. package/dist/assets/diagram-S2PKOQOG-tLScBy7Z.js +0 -24
  296. package/dist/assets/edit-page-DJ8kJZ9w.js +0 -129
  297. package/dist/assets/file-explorer-panel-CzNUJ63G.js +0 -1
  298. package/dist/assets/gitGraphDiagram-NY62KEGX-C1t6QtVa.js +0 -65
  299. package/dist/assets/graph-CssCVWIq.js +0 -1
  300. package/dist/assets/home-page-9eW6qida.js +0 -9
  301. package/dist/assets/index-CknhX2Vy.css +0 -1
  302. package/dist/assets/index-DcCIe7np.js +0 -28
  303. package/dist/assets/index-OC46250R.js +0 -570
  304. package/dist/assets/infoDiagram-STP46IZ2-CwiAoz9f.js +0 -2
  305. package/dist/assets/layout-DpQrxGW-.js +0 -1
  306. package/dist/assets/linear-NsreOeBF.js +0 -1
  307. package/dist/assets/links-CbvGxbsJ.js +0 -7
  308. package/dist/assets/mermaid-DSt0r6IQ.js +0 -1
  309. package/dist/assets/min-D259kI3t.js +0 -1
  310. package/dist/assets/outline-panel-uvsS-YEQ.js +0 -1
  311. package/dist/assets/packages-panel-xMz9W2hW.js +0 -1
  312. package/dist/assets/run-page-Bb68qdhQ.js +0 -1
  313. package/dist/assets/sankeyDiagram-GR3RE2ED-BSJOau8E.js +0 -10
  314. package/dist/assets/scratchpad-panel-BF4BO-U4.js +0 -1
  315. package/dist/assets/secrets-panel-CdIX44dQ.js +0 -1
  316. package/dist/assets/snippets-panel-Dco9h0rb.js +0 -1
  317. package/dist/assets/sortBy-aLGA-PGK.js +0 -1
  318. package/dist/assets/stateDiagram-KXAO66HF-Bd68WT3b.js +0 -1
  319. package/dist/assets/stateDiagram-v2-UMBNRL4Z-BXz_GSwb.js +0 -1
  320. package/dist/assets/storage-CGlP4lCF.js +0 -26
  321. package/dist/assets/terminal-CxkHubcu.js +0 -9
  322. package/dist/assets/time-D2nr1UgQ.js +0 -1
  323. package/dist/assets/tracing-kTqHxa7q.js +0 -2
  324. package/dist/assets/variable-panel-noTnH-AQ.js +0 -1
  325. package/dist/assets/worker-X5rxzQGQ.js +0 -1
@@ -20,7 +20,6 @@ import {
20
20
  XIcon,
21
21
  } from "lucide-react";
22
22
  import React from "react";
23
- import { Streamdown } from "streamdown";
24
23
  import { mergeToolCalls } from "use-acp";
25
24
  import { JsonOutput } from "@/components/editor/output/JsonOutput";
26
25
  import { Button } from "@/components/ui/button";
@@ -33,12 +32,14 @@ import { logNever } from "@/utils/assertNever";
33
32
  import { cn } from "@/utils/cn";
34
33
  import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
35
34
  import { Strings } from "@/utils/strings";
35
+ import { MarkdownRenderer } from "../markdown-renderer";
36
36
  import { SimpleAccordion } from "./common";
37
37
  import type {
38
38
  AgentNotificationEvent,
39
39
  AgentThoughtNotificationEvent,
40
40
  ConnectionChangeNotificationEvent,
41
41
  ContentBlockOf,
42
+ CurrentModeUpdateNotificationEvent,
42
43
  ErrorNotificationEvent,
43
44
  PlanNotificationEvent,
44
45
  SessionNotificationEventData,
@@ -307,7 +308,7 @@ export const AgentMessagesBlock = (props: {
307
308
  export const ContentBlocks = (props: { data: ContentBlock[] }) => {
308
309
  const renderBlock = (block: ContentBlock) => {
309
310
  if (block.type === "text") {
310
- return <Streamdown>{block.text}</Streamdown>;
311
+ return <MarkdownRenderer content={block.text} />;
311
312
  }
312
313
  if (block.type === "image") {
313
314
  return <ImageBlock data={block} />;
@@ -371,7 +372,7 @@ export const ResourceBlock = (props: { data: ContentBlockOf<"resource"> }) => {
371
372
  </span>
372
373
  </PopoverTrigger>
373
374
  <PopoverContent className="max-h-96 overflow-y-auto scrollbar-thin">
374
- <Streamdown>{props.data.resource.text}</Streamdown>
375
+ <MarkdownRenderer content={props.data.resource.text} />
375
376
  </PopoverContent>
376
377
  </Popover>
377
378
  );
@@ -495,6 +496,16 @@ export const SessionNotificationsBlock = <
495
496
  return <PlansBlock data={items} />;
496
497
  }
497
498
 
499
+ if (kind === "available_commands_update") {
500
+ return null; // nothing to show
501
+ }
502
+ if (kind === "current_mode_update") {
503
+ const lastItem = items.at(-1);
504
+ return lastItem?.sessionUpdate === "current_mode_update" ? (
505
+ <CurrentModeBlock data={lastItem} />
506
+ ) : null;
507
+ }
508
+
498
509
  return (
499
510
  <SimpleAccordion title={items[0].sessionUpdate}>
500
511
  <JsonOutput data={items} format="tree" className="max-h-64" />
@@ -509,6 +520,13 @@ export const SessionNotificationsBlock = <
509
520
  );
510
521
  };
511
522
 
523
+ export const CurrentModeBlock = (props: {
524
+ data: CurrentModeUpdateNotificationEvent;
525
+ }) => {
526
+ const { currentModeId } = props.data;
527
+ return <div>Mode: {currentModeId}</div>;
528
+ };
529
+
512
530
  export const ToolNotificationsBlock = (props: {
513
531
  data: Array<ToolCallNotificationEvent | ToolCallUpdateNotificationEvent>;
514
532
  }) => {
@@ -635,19 +653,31 @@ export const ToolBodyBlock = (props: {
635
653
  | Omit<ToolCallNotificationEvent, "sessionUpdate">
636
654
  | Omit<ToolCallUpdateNotificationEvent, "sessionUpdate">;
637
655
  }) => {
638
- const content = props.data.content
656
+ const { content, locations, status, kind, rawInput } = props.data;
657
+ const textContent = content
639
658
  ?.filter((item) => item.type === "content")
640
659
  .map((item) => item.content);
641
- const diffs = props.data.content?.filter((item) => item.type === "diff");
642
- const locations = props.data.locations;
643
- const isFailed = props.data.status === "failed";
660
+ const diffs = content?.filter((item) => item.type === "diff");
661
+ const isFailed = status === "failed";
644
662
  const hasLocations = locations && locations.length > 0;
645
663
 
646
- if (content?.length === 0 && diffs?.length === 0 && hasLocations) {
664
+ // Completely empty
665
+ if (!content && !hasLocations && rawInput) {
666
+ // Show rawInput
667
+ return (
668
+ <pre className="bg-[var(--slate-2)] p-1 text-muted-foreground border border-[var(--slate-4)] rounded text-xs overflow-auto scrollbar-thin max-h-64">
669
+ <JsonOutput data={rawInput} format="tree" />
670
+ </pre>
671
+ );
672
+ }
673
+
674
+ const noContent = !textContent || textContent.length === 0;
675
+ const noDiffs = !diffs || diffs.length === 0;
676
+ if (noContent && noDiffs && hasLocations) {
647
677
  return (
648
678
  <div className="flex flex-col gap-2 pr-2">
649
679
  <span className="text-xs text-muted-foreground">
650
- {capitalize(props.data.kind || "")}{" "}
680
+ {capitalize(kind || "")}{" "}
651
681
  {locations?.map((item) => item.path).join(", ")}
652
682
  </span>
653
683
  </div>
@@ -657,7 +687,7 @@ export const ToolBodyBlock = (props: {
657
687
  return (
658
688
  <div className="flex flex-col gap-2 pr-2">
659
689
  {locations && <LocationsBlock data={locations} />}
660
- {content && <ContentBlocks data={content} />}
690
+ {textContent && <ContentBlocks data={textContent} />}
661
691
  {diffs && !isFailed && <DiffBlocks data={diffs} />}
662
692
  </div>
663
693
  );
@@ -1,5 +1,6 @@
1
1
  /* Copyright 2024 Marimo. All rights reserved. */
2
2
 
3
+ import type { RequestPermissionResponse } from "@zed-industries/agent-client-protocol";
3
4
  import {
4
5
  CheckCircleIcon,
5
6
  Loader2,
@@ -151,7 +152,7 @@ ConnectionStatus.displayName = "ConnectionStatus";
151
152
 
152
153
  interface PermissionRequestProps {
153
154
  permission: NonNullable<AgentPendingPermission>;
154
- onResolve: (option: unknown) => void;
155
+ onResolve: (option: RequestPermissionResponse) => void;
155
156
  }
156
157
 
157
158
  export const PermissionRequest: React.FC<PermissionRequestProps> = memo(
@@ -179,7 +180,14 @@ export const PermissionRequest: React.FC<PermissionRequestProps> = memo(
179
180
  ? "text-[var(--blue-10)]"
180
181
  : "text-[var(--red-10)]"
181
182
  }
182
- onClick={() => onResolve(option)}
183
+ onClick={() =>
184
+ onResolve({
185
+ outcome: {
186
+ outcome: "selected",
187
+ optionId: option.optionId,
188
+ },
189
+ })
190
+ }
183
191
  >
184
192
  {option.kind.startsWith("allow") && (
185
193
  <CheckCircleIcon className="h-3 w-3 mr-1" />
@@ -0,0 +1,127 @@
1
+ /* Copyright 2024 Marimo. All rights reserved. */
2
+
3
+ import type { ContentBlock } from "@zed-industries/agent-client-protocol";
4
+ import type { FileUIPart } from "ai";
5
+ import { getAIContextRegistry } from "@/core/ai/context/context";
6
+ import { store } from "@/core/state/jotai";
7
+ import { blobToString } from "@/utils/fileToBase64";
8
+ import { Logger } from "@/utils/Logger";
9
+
10
+ export interface ContextParseResult {
11
+ contextBlocks: ContentBlock[];
12
+ attachmentBlocks: ContentBlock[];
13
+ }
14
+
15
+ /**
16
+ * Converts File objects to agent protocol resource_link content blocks
17
+ */
18
+ export async function convertFilesToResourceLinks(
19
+ files: File[],
20
+ ): Promise<ContentBlock[]> {
21
+ const resourceLinks: ContentBlock[] = [];
22
+
23
+ for (const file of files) {
24
+ try {
25
+ const dataUrl = await blobToString(file, "dataUrl");
26
+ resourceLinks.push({
27
+ type: "resource_link",
28
+ uri: dataUrl,
29
+ mimeType: file.type,
30
+ name: file.name,
31
+ });
32
+ } catch (error) {
33
+ Logger.error("Error converting file to resource link", {
34
+ fileName: file.name,
35
+ error,
36
+ });
37
+ }
38
+ }
39
+
40
+ return resourceLinks;
41
+ }
42
+
43
+ /**
44
+ * Converts AI context registry attachments to agent protocol resource_link content blocks
45
+ */
46
+ async function convertAiAttachmentsToResourceLinks(
47
+ attachments: FileUIPart[],
48
+ ): Promise<ContentBlock[]> {
49
+ const resourceLinks: ContentBlock[] = [];
50
+
51
+ for (const attachment of attachments) {
52
+ resourceLinks.push({
53
+ type: "resource_link",
54
+ uri: attachment.url,
55
+ mimeType: attachment.mediaType,
56
+ name: attachment.filename ?? attachment.url,
57
+ });
58
+ }
59
+
60
+ return resourceLinks;
61
+ }
62
+
63
+ /**
64
+ * Parses context from the prompt value and returns content blocks for agent prompts.
65
+ * Extracts context references using @ notation and converts them to resource blocks.
66
+ * Also handles attachments from the AI context registry.
67
+ */
68
+ export async function parseContextFromPrompt(
69
+ promptValue: string,
70
+ ): Promise<ContextParseResult> {
71
+ const contextBlocks: ContentBlock[] = [];
72
+ const attachmentBlocks: ContentBlock[] = [];
73
+
74
+ // Skip if no '@' in the input
75
+ if (!promptValue.includes("@")) {
76
+ return { contextBlocks, attachmentBlocks };
77
+ }
78
+
79
+ try {
80
+ const registry = getAIContextRegistry(store);
81
+ const contextIds = registry.parseAllContextIds(promptValue);
82
+
83
+ if (contextIds.length === 0) {
84
+ return { contextBlocks, attachmentBlocks };
85
+ }
86
+
87
+ // Get context string for the registry
88
+ const contextString = registry.formatContextForAI(contextIds);
89
+
90
+ if (contextString.trim()) {
91
+ // Create a resource block with the context information
92
+ contextBlocks.push({
93
+ type: "resource",
94
+ resource: {
95
+ uri: "context.md",
96
+ mimeType: "text/markdown",
97
+ text: contextString,
98
+ },
99
+ });
100
+ }
101
+
102
+ // Get attachments from the AI context registry
103
+ try {
104
+ const aiAttachments = await registry.getAttachmentsForContext(contextIds);
105
+ if (aiAttachments.length > 0) {
106
+ const resourceLinks =
107
+ await convertAiAttachmentsToResourceLinks(aiAttachments);
108
+ attachmentBlocks.push(...resourceLinks);
109
+ Logger.debug("Added AI context attachments", {
110
+ count: aiAttachments.length,
111
+ });
112
+ }
113
+ } catch (error) {
114
+ Logger.error("Error getting AI context attachments", { error });
115
+ }
116
+
117
+ Logger.debug("Parsed context for agent", {
118
+ contextIds,
119
+ contextLength: contextString.length,
120
+ attachmentCount: attachmentBlocks.length,
121
+ });
122
+ } catch (error) {
123
+ Logger.error("Error parsing context for agent", { error });
124
+ }
125
+
126
+ return { contextBlocks, attachmentBlocks };
127
+ }
@@ -3,7 +3,7 @@
3
3
  export function getAgentPrompt(filename: string) {
4
4
  return `
5
5
  I am currently editing a marimo notebook.
6
- You can read or write to the notebook at @${filename}
6
+ You can read or write to the notebook at ${filename}
7
7
 
8
8
  If you make edits to the notebook, only edit the contents inside the function decorator with @app.cell.
9
9
  marimo will automatically handle adding the parameters and return statement of the function. For example,
@@ -11,7 +11,7 @@ export function getAgentPrompt(filename: string) {
11
11
 
12
12
  \`\`\`
13
13
  @app.cell
14
- def __():
14
+ def _():
15
15
  <your code here>
16
16
  return
17
17
  \`\`\`
@@ -37,6 +37,7 @@ export function getAgentPrompt(filename: string) {
37
37
  7. The last expression in a cell is automatically displayed, just like in Jupyter notebooks.
38
38
  8. Don't include comments in markdown cells
39
39
  9. Don't include comments in SQL cells
40
+ 10. Never define anything using \`global\`.
40
41
 
41
42
  ## Reactivity
42
43
 
@@ -46,11 +47,12 @@ export function getAgentPrompt(filename: string) {
46
47
  - UI elements trigger updates when their values change without explicit callbacks
47
48
  - UI element values are accessed through \`.value\` attribute
48
49
  - You cannot access a UI element's value in the same cell where it's defined
50
+ - Cells prefixed with an underscore (e.g. _my_var) are local to the cell and cannot be accessed by other cells
49
51
 
50
52
  ## Best Practices
51
53
 
52
54
  <data_handling>
53
- - Use pandas for data manipulation
55
+ - Use polars for data manipulation
54
56
  - Implement proper data validation
55
57
  - Handle missing values appropriately
56
58
  - Use efficient data structures
@@ -60,7 +62,7 @@ export function getAgentPrompt(filename: string) {
60
62
  <visualization>
61
63
  - For matplotlib: use plt.gca() as the last expression instead of plt.show()
62
64
  - For plotly: return the figure object directly
63
- - For altair: return the chart object directly
65
+ - For altair: return the chart object directly. Add tooltips where appropriate. You can pass polars dataframes directly to altair.
64
66
  - Include proper labels, titles, and color schemes
65
67
  - Make visualizations interactive where appropriate
66
68
  </visualization>
@@ -74,7 +76,7 @@ export function getAgentPrompt(filename: string) {
74
76
  </ui_elements>
75
77
 
76
78
  <sql>
77
- - When writing duckdb, prefer using marimo's SQL cells, which start with _df = mo.sql(query)
79
+ - When writing duckdb, prefer using marimo's SQL cells, which start with df = mo.sql(f"""<your query>""") for DuckDB, or df = mo.sql(f"""<your query>""", engine=engine) for other SQL engines.
78
80
  - See the SQL with duckdb example for an example on how to do this
79
81
  - Don't add comments in cells that use mo.sql()
80
82
  - Consider using \`vega_datasets\` for common example datasets
@@ -115,19 +117,35 @@ export function getAgentPrompt(filename: string) {
115
117
 
116
118
  - \`mo.md(text)\` - display markdown
117
119
  - \`mo.stop(predicate, output=None)\` - stop execution conditionally
120
+ - \`mo.output.append(value)\` - append to the output when it is not the last expression
121
+ - \`mo.output.replace(value)\` - replace the output when it is not the last expression
118
122
  - \`mo.Html(html)\` - display HTML
119
123
  - \`mo.image(image)\` - display an image
120
124
  - \`mo.hstack(elements)\` - stack elements horizontally
121
125
  - \`mo.vstack(elements)\` - stack elements vertically
122
126
  - \`mo.tabs(elements)\` - create a tabbed interface
123
127
 
128
+
129
+
124
130
  ## Examples
125
131
 
132
+ <example title="Markdown ccell">
133
+ ${formatCells([
134
+ `
135
+ mo.md("""
136
+ # Hello world
137
+ This is a _markdown_ **cell**.
138
+ """)
139
+ `,
140
+ ])}
141
+ </example>
142
+
126
143
  <example title="Basic UI with reactivity">
127
144
  ${formatCells([
128
145
  `
129
146
  import marimo as mo
130
- import matplotlib.pyplot as plt
147
+ import altair as alt
148
+ import polars as pl
131
149
  import numpy as np
132
150
  `,
133
151
  `
@@ -138,12 +156,18 @@ export function getAgentPrompt(filename: string) {
138
156
  x = np.random.rand(n_points.value)
139
157
  y = np.random.rand(n_points.value)
140
158
 
141
- plt.figure(figsize=(8, 6))
142
- plt.scatter(x, y, alpha=0.7)
143
- plt.title(f"Scatter plot with {n_points.value} points")
144
- plt.xlabel("X axis")
145
- plt.ylabel("Y axis")
146
- plt.gca()
159
+ df = pl.DataFrame({"x": x, "y": y})
160
+
161
+ chart = alt.Chart(df).mark_circle(opacity=0.7).encode(
162
+ x=alt.X('x', title='X axis'),
163
+ y=alt.Y('y', title='Y axis')
164
+ ).properties(
165
+ title=f"Scatter plot with {n_points.value} points",
166
+ width=400,
167
+ height=300
168
+ )
169
+
170
+ chart
147
171
  `,
148
172
  ])}
149
173
  </example>
@@ -152,11 +176,11 @@ export function getAgentPrompt(filename: string) {
152
176
  ${formatCells([
153
177
  `
154
178
  import marimo as mo
155
- import pandas as pd
179
+ import polars as pl
156
180
  from vega_datasets import data
157
181
  `,
158
182
  `
159
- cars_df = data.cars()
183
+ cars_df = pl.DataFrame(data.cars())
160
184
  mo.ui.data_explorer(cars_df)
161
185
  `,
162
186
  ])}
@@ -166,43 +190,57 @@ export function getAgentPrompt(filename: string) {
166
190
  ${formatCells([
167
191
  `
168
192
  import marimo as mo
169
- import pandas as pd
170
- import matplotlib.pyplot as plt
171
- import seaborn as sns
193
+ import polars as pl
194
+ import altair as alt
172
195
  `,
173
196
  `
174
- iris = sns.load_dataset('iris')
197
+ iris = pl.read_csv("hf://datasets/scikit-learn/iris/Iris.csv")
175
198
  `,
176
199
  `
177
200
  species_selector = mo.ui.dropdown(
178
- options=["All"] + iris["species"].unique().tolist(),
201
+ options=["All"] + iris["Species"].unique().to_list(),
179
202
  value="All",
180
- label="Species"
203
+ label="Species",
181
204
  )
182
205
  x_feature = mo.ui.dropdown(
183
- options=iris.select_dtypes('number').columns.tolist(),
184
- value="sepal_length",
185
- label="X Feature"
206
+ options=iris.select(pl.col(pl.Float64, pl.Int64)).columns,
207
+ value="SepalLengthCm",
208
+ label="X Feature",
186
209
  )
187
210
  y_feature = mo.ui.dropdown(
188
- options=iris.select_dtypes('number').columns.tolist(),
189
- value="sepal_width",
190
- label="Y Feature"
211
+ options=iris.select(pl.col(pl.Float64, pl.Int64)).columns,
212
+ value="SepalWidthCm",
213
+ label="Y Feature",
191
214
  )
192
215
  mo.hstack([species_selector, x_feature, y_feature])
193
216
  `,
194
217
  `
195
- filtered_data = iris if species_selector.value == "All" else iris[iris["species"] == species_selector.value]
196
-
197
- plt.figure(figsize=(10, 6))
198
- sns.scatterplot(
199
- data=filtered_data,
200
- x=x_feature.value,
201
- y=y_feature.value,
202
- hue="species"
218
+ filtered_data = iris if species_selector.value == "All" else iris.filter(pl.col("Species") == species_selector.value)
219
+
220
+ chart = alt.Chart(filtered_data).mark_circle().encode(
221
+ x=alt.X(x_feature.value, title=x_feature.value),
222
+ y=alt.Y(y_feature.value, title=y_feature.value),
223
+ color='Species'
224
+ ).properties(
225
+ title=f"{y_feature.value} vs {x_feature.value}",
226
+ width=500,
227
+ height=400
203
228
  )
204
- plt.title(f"{y_feature.value} vs {x_feature.value}")
205
- plt.gca()
229
+
230
+ chart
231
+ `,
232
+ ])}
233
+ </example>
234
+
235
+ <example title="Conditional Outputs">
236
+ ${formatCells([
237
+ `
238
+ mo.stop(not data.value, mo.md("No data to display"))
239
+
240
+ if mode.value == "scatter":
241
+ mo.output.replace(render_scatter(data.value))
242
+ else:
243
+ mo.output.replace(render_bar_chart(data.value))
206
244
  `,
207
245
  ])}
208
246
  </example>
@@ -212,14 +250,21 @@ export function getAgentPrompt(filename: string) {
212
250
  `
213
251
  import marimo as mo
214
252
  import altair as alt
215
- import pandas as pd
253
+ import polars as pl
216
254
  `,
217
255
  `# Load dataset
218
- cars_df = pd.read_csv('<https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json>')
219
- _chart = alt.Chart(cars_df).mark_point().encode(
220
- x='Horsepower',
221
- y='Miles_per_Gallon',
222
- color='Origin',
256
+ weather = pl.read_csv("https://raw.githubusercontent.com/vega/vega-datasets/refs/heads/main/data/weather.csv")
257
+ weather_dates = weather.with_columns(
258
+ pl.col("date").str.strptime(pl.Date, format="%Y-%m-%d")
259
+ )
260
+ _chart = (
261
+ alt.Chart(weather_dates)
262
+ .mark_point()
263
+ .encode(
264
+ x="date:T",
265
+ y="temp_max",
266
+ color="location",
267
+ )
223
268
  )
224
269
  `,
225
270
  "chart = mo.ui.altair_chart(_chart)\nchart",
@@ -248,33 +293,31 @@ export function getAgentPrompt(filename: string) {
248
293
 
249
294
  <example title="SQL with duckdb">
250
295
  ${formatCells([
251
- "import marimo as mo\nimport pandas as pd",
252
- `cars_df = pd.read_csv('<https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json>')`,
253
- `_df = mo.sql("SELECT * from cars_df WHERE Miles_per_Gallon > 20")`,
296
+ "import marimo as mo\n import polars as pl",
297
+ `weather = pl.read_csv('https://raw.githubusercontent.com/vega/vega-datasets/refs/heads/main/data/weather.csv')`,
298
+ `seattle_weather_df = mo.sql(
299
+ f"""
300
+ SELECT * FROM weather WHERE location = 'Seattle';
301
+ """
302
+ )`,
254
303
  ])}
255
304
  </example>`;
256
305
  }
257
306
 
258
307
  function formatCells(cells: string[]) {
259
- // Option 1:
260
- // return cells.map((cell) => {
261
- // return `# Cell ${cell}`;
262
- // });
263
-
264
308
  const indent = " ";
265
309
  const indentCode = (code: string) => {
266
310
  return code
267
311
  .trim()
268
312
  .split("\n")
269
- .map((line) => indent + line)
313
+ .map((line) => (indent + line).trimEnd())
270
314
  .join("\n");
271
315
  };
272
316
 
273
- // Option 2:
274
317
  const formatCell = (cell: string) => {
275
318
  return `
276
319
  @app.cell
277
- def __():
320
+ def _():
278
321
  ${indentCode(cell)}
279
322
  return
280
323
  `;
@@ -259,5 +259,5 @@ export function getAgentSessionSupport(
259
259
  export function getAgentConnectionCommand(agentId: ExternalAgentId): string {
260
260
  const port = AGENT_CONFIG[agentId].port;
261
261
  const command = AGENT_CONFIG[agentId].command;
262
- return `npx supergateway --stdio\\\n "${command}" \\\n --outputTransport ws --port ${port} `;
262
+ return `npx stdio-to-ws "${command}" --port ${port}`;
263
263
  }
@@ -2,10 +2,16 @@
2
2
  import type { ContentBlock } from "@zed-industries/agent-client-protocol";
3
3
  import type { groupNotifications, useAcpClient } from "use-acp";
4
4
 
5
+ export type SessionMode = ReturnType<typeof useAcpClient>["sessionMode"];
6
+
5
7
  export type NotificationEvent = Awaited<
6
8
  ReturnType<typeof groupNotifications>
7
9
  >[number][number];
8
10
 
11
+ export type AvailableCommands = ReturnType<
12
+ typeof useAcpClient
13
+ >["availableCommands"];
14
+
9
15
  export type AgentConnectionState = ReturnType<
10
16
  typeof useAcpClient
11
17
  >["connectionState"];
@@ -49,6 +55,8 @@ export type ToolCallNotificationEvent = NotificationDataOf<"tool_call">;
49
55
  export type ToolCallUpdateNotificationEvent =
50
56
  NotificationDataOf<"tool_call_update">;
51
57
  export type PlanNotificationEvent = NotificationDataOf<"plan">;
58
+ export type CurrentModeUpdateNotificationEvent =
59
+ NotificationDataOf<"current_mode_update">;
52
60
 
53
61
  export type ContentBlockType = ContentBlock["type"];
54
62
  export type ContentBlockOf<T extends ContentBlockType> = Extract<