@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.
- package/dist/assets/ConnectedDataExplorerComponent-CNLoZkWr.js +19 -0
- package/dist/assets/{ImageComparisonComponent-CEXMKKA4.js → ImageComparisonComponent-SX7fDaTK.js} +1 -1
- package/dist/assets/{VegaLite-Bt14Ds9k.js → VegaLite-MJUW3b7C.js} +6 -6
- package/dist/assets/_baseEach-9_logFrf.js +1 -0
- package/dist/assets/_baseMap-NzEbKt5c.js +1 -0
- package/dist/assets/_baseUniq-C5LFcyNC.js +1 -0
- package/dist/assets/_createAggregator-ZRm2b6Zm.js +1 -0
- package/dist/assets/agent-panel-BBd11wNX.js +287 -0
- package/dist/assets/agent-panel-D92Mfy1i.css +1 -0
- package/dist/assets/{any-language-editor-DiwNT6zp.js → any-language-editor-DwAaEQfS.js} +1 -1
- package/dist/assets/architectureDiagram-W76B3OCA-BJmVXUoW.js +36 -0
- package/dist/assets/{between-horizontal-start-FyewyCGn.js → between-horizontal-start-KiwU-a3C.js} +1 -1
- package/dist/assets/{blockDiagram-QIGZ2CNN-BrOkAf_c.js → blockDiagram-QIGZ2CNN-DzxZjE7B.js} +1 -1
- package/dist/assets/{c4Diagram-FPNF74CW-BHPzDxE2.js → c4Diagram-FPNF74CW-DjmldG_J.js} +5 -5
- package/dist/assets/channel-DHcKBVM4.js +1 -0
- package/dist/assets/chat-panel-DgJZr0eS.js +3 -0
- package/dist/assets/{chunk-4BX2VUAB-DLxaCNYh.js → chunk-4BX2VUAB-EUTQThiZ.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-DdzvO3HR.js → chunk-55IACEB6-DZAiDJxy.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-R5o-nSiG.js → chunk-FMBD7UC4-Bd0Czs-J.js} +1 -1
- package/dist/assets/{chunk-K7UQS3LO-DxaMrGgG.js → chunk-K7UQS3LO-DEKMIknX.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL-DqS9-FYm.js → chunk-QN33PNHL-E0jwHU_n.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-BZ-TzajS.js → chunk-QZHKN3VN-BzaIHJbq.js} +1 -1
- package/dist/assets/{chunk-TVAH2DTR-BsgP2dyv.js → chunk-TVAH2DTR-CZFYvqnm.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-D-h3ahXI.js → chunk-TZMSLE5B-BNqnFjtv.js} +1 -1
- package/dist/assets/{circle-play-CQtRZ-rT.js → circle-play-D3J_mYrF.js} +1 -1
- package/dist/assets/classDiagram-KNZD7YFC-D-xwLnlX.js +1 -0
- package/dist/assets/classDiagram-v2-RKCZMP56-D-xwLnlX.js +1 -0
- package/dist/assets/{clear-button-BY6Z_ViL.js → clear-button-ifzRuAR3.js} +1 -1
- package/dist/assets/clone-CSxIll62.js +1 -0
- package/dist/assets/command-palette-D2fdVSET.js +1 -0
- package/dist/assets/common-Ku-cF_2J.js +1 -0
- package/dist/assets/{compile-Ct_jzdKr.js → compile-BgZlHW1c.js} +1 -1
- package/dist/assets/cose-bilkent-S5V4N54A-CVM83SqK.js +1 -0
- package/dist/assets/dagre-5GWH7T2D-ouQPkxT3.js +4 -0
- package/dist/assets/{data-grid-overlay-editor-BN_wulc3.js → data-grid-overlay-editor-B47j5GJJ.js} +1 -1
- package/dist/assets/datasources-panel-Bt41Zir-.js +1 -0
- package/dist/assets/{dependency-graph-panel-BOmSCZf7.js → dependency-graph-panel-CZC_B7pK.js} +4 -4
- package/dist/assets/diagram-N5W7TBWH-CQ817ZdR.js +24 -0
- package/dist/assets/diagram-QEK2KX5R-DOK_psUO.js +43 -0
- package/dist/assets/diagram-S2PKOQOG-CVljmOW8.js +24 -0
- package/dist/assets/{documentation-panel-BxjJO_Gw.js → documentation-panel-C7yIvGg1.js} +1 -1
- package/dist/assets/edit-page-CyTMQV2u.js +129 -0
- package/dist/assets/{ellipsis-vertical-UHbmjI2n.js → ellipsis-vertical-C7FjlUsY.js} +1 -1
- package/dist/assets/{empty-state-BIBXzY_0.js → empty-state-DIOGM_CU.js} +1 -1
- package/dist/assets/{erDiagram-AWTI2OKA-E84mAle_.js → erDiagram-AWTI2OKA-DYu8cEdc.js} +1 -1
- package/dist/assets/{error-panel-MEvQ6K7h.js → error-panel-Ddb8RkFG.js} +1 -1
- package/dist/assets/file-explorer-panel-Oy9DbyFP.js +1 -0
- package/dist/assets/{flowDiagram-PVAE7QVJ-DfbIRSAW.js → flowDiagram-PVAE7QVJ-CmvW5iTb.js} +1 -1
- package/dist/assets/{ganttDiagram-OWAHRB6G-DR4HZ1z_.js → ganttDiagram-OWAHRB6G-BaKQlCaT.js} +4 -4
- package/dist/assets/gitGraphDiagram-NY62KEGX-CWO24eP6.js +65 -0
- package/dist/assets/{glide-data-editor-nNmo1lPq.js → glide-data-editor-CNDLEJ9a.js} +11 -11
- package/dist/assets/graph-BZKTtxsc.js +1 -0
- package/dist/assets/home-page-Bvwppn9N.js +9 -0
- package/dist/assets/{index-VPWqq2Pg.js → index-0XOUPdwT.js} +1 -1
- package/dist/assets/{index-uacyUula.js → index-BH7f3aiU.js} +1 -1
- package/dist/assets/{index-Dt9UWeWn.js → index-BJVyzkx5.js} +1 -1
- package/dist/assets/{index-BAH034Ue.js → index-B_d_JZGI.js} +1 -1
- package/dist/assets/{index-CB2pnVQG.js → index-BgXbBA39.js} +1 -1
- package/dist/assets/{index-B8llrTSo.js → index-Brf2DwUM.js} +1 -1
- package/dist/assets/{index-BLu5CX6z.js → index-CXrWwFX6.js} +1 -1
- package/dist/assets/{index-DyLSuOH1.js → index-CZaurnA9.js} +1 -1
- package/dist/assets/{index-BFSnz7iM.js → index-CerjupfZ.js} +1 -1
- package/dist/assets/{index-B7yXbrLa.js → index-D-tZfElD.js} +1 -1
- package/dist/assets/{index-c6If577Q.js → index-D3PqGupX.js} +1 -1
- package/dist/assets/{index-CSgxTUzD.js → index-DCkzth56.js} +1 -1
- package/dist/assets/{index-DWOaniGT.js → index-DFrGFNW1.js} +1 -1
- package/dist/assets/{index-CPN7TRA1.js → index-DZhOPkOB.js} +1 -1
- package/dist/assets/index-DadI618h.css +1 -0
- package/dist/assets/{index-DqzMPAC8.js → index-DkntzpX4.js} +2 -2
- package/dist/assets/{index-B1_GXGaP.js → index-DmgwT3sx.js} +1 -1
- package/dist/assets/index-PmY0x4Zd.js +578 -0
- package/dist/assets/{index-Bq516OmX.js → index-WXJFkQHg.js} +1 -1
- package/dist/assets/{index-DSU75csX.js → index-qE8lHQ-N.js} +1 -1
- package/dist/assets/{index-DMomwMcN.js → index-zrSUQXha.js} +1 -1
- package/dist/assets/infoDiagram-STP46IZ2-CAuVVehw.js +2 -0
- package/dist/assets/isEmpty-D1t7Gran.js +1 -0
- package/dist/assets/{journeyDiagram-BIP6EPQ6-BBiFyygf.js → journeyDiagram-BIP6EPQ6-D4Rp6H_h.js} +1 -1
- package/dist/assets/{kanban-definition-6OIFK2YF-DhgA6Nt6.js → kanban-definition-6OIFK2YF-DFt9DftA.js} +4 -4
- package/dist/assets/layout-D8WXi2_g.js +1 -0
- package/dist/assets/linear-BwY8e5hA.js +1 -0
- package/dist/assets/links-4B6ldZ5P.js +7 -0
- package/dist/assets/{logs-panel-B9SmTZAW.js → logs-panel-Dxiyt7dO.js} +1 -1
- package/dist/assets/{agent-panel-DpQ6muj-.css → markdown-renderer-ClyzDMmG.css} +1 -1
- package/dist/assets/markdown-renderer-VDu-NBKB.js +263 -0
- package/dist/assets/mermaid-B-O-Puyi.js +1 -0
- package/dist/assets/{mermaid.core-4nVOEVX3.js → mermaid.core-BFFCqfOn.js} +41 -41
- package/dist/assets/min-DtVSfYKl.js +1 -0
- package/dist/assets/{mindmap-definition-Q6HEUPPD-CVLQNn1q.js → mindmap-definition-Q6HEUPPD-kyvIY8Dg.js} +2 -2
- package/dist/assets/{number-overlay-editor-CzRzXLcd.js → number-overlay-editor-GjLB2UK4.js} +1 -1
- package/dist/assets/outline-panel-CMJjOoN7.js +1 -0
- package/dist/assets/packages-panel-nfXB-bKW.js +1 -0
- package/dist/assets/{pieDiagram-ADFJNKIX-C5IQ5DBZ.js → pieDiagram-ADFJNKIX-D8JFQcWR.js} +3 -3
- package/dist/assets/{quadrantDiagram-LMRXKWRM-CFXFnQxx.js → quadrantDiagram-LMRXKWRM-Nf8GzxXG.js} +1 -1
- package/dist/assets/{react-plotly-mzdv02_Y.js → react-plotly-CnW9p7ZA.js} +1 -1
- package/dist/assets/{requirementDiagram-4UW4RH46-D9bPC89T.js → requirementDiagram-4UW4RH46-CCUxF8BZ.js} +1 -1
- package/dist/assets/run-page-Bl4p3AbZ.js +1 -0
- package/dist/assets/sankeyDiagram-GR3RE2ED-Sr8kDwP1.js +10 -0
- package/dist/assets/scratchpad-panel-Ja1Mu-W3.js +1 -0
- package/dist/assets/secrets-panel-B-3fcSyP.js +1 -0
- package/dist/assets/{sequenceDiagram-C3RYC4MD-6N7_hY4k.js → sequenceDiagram-C3RYC4MD-CBJ152Q3.js} +4 -4
- package/dist/assets/{slides-component-DMjQomc3.css → slides-component-C-LoGC1U.css} +1 -1
- package/dist/assets/{slides-component-EcjC8sDK.js → slides-component-DGtsVP5o.js} +1 -1
- package/dist/assets/snippets-panel-ClNnwKBM.js +1 -0
- package/dist/assets/sortBy-D47H6Vyl.js +1 -0
- package/dist/assets/state-B_RCHTH5.js +1 -0
- package/dist/assets/stateDiagram-KXAO66HF-BlBFSAZr.js +1 -0
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-DbA-iToo.js +1 -0
- package/dist/assets/storage-BNcWOH3-.js +26 -0
- package/dist/assets/terminal-CATzv5Hd.js +10 -0
- package/dist/assets/time-CsYqILfB.js +1 -0
- package/dist/assets/{timeline-definition-XQNQX7LJ-BEaynAiY.js → timeline-definition-XQNQX7LJ-CGrhjuAs.js} +1 -1
- package/dist/assets/tracing-DUbJtOyq.js +2 -0
- package/dist/assets/{tracing-panel-BmuHLPrY.js → tracing-panel-DmzqPUtc.js} +2 -2
- package/dist/assets/{trash-UBqfK4mR.js → trash-rxdjLzkf.js} +1 -1
- package/dist/assets/{tree-XiEycetl.js → tree-C2Ul1h1C.js} +1 -1
- package/dist/assets/{treemap-75Q7IDZK-CnuVFbBG.js → treemap-75Q7IDZK-N9hyUpyj.js} +20 -20
- package/dist/assets/{ts-tags-CloPe9IY.js → ts-tags-DxCDHihD.js} +1 -1
- package/dist/assets/variable-panel-BbgupOdG.js +1 -0
- package/dist/assets/{vega-component-DsTH4tuX.js → vega-component-CR_MHOBT.js} +1 -1
- package/dist/assets/worker-fHbtoWvT.js +1 -0
- package/dist/assets/{xychartDiagram-6GGTOJPD-Dcz3O-A3.js → xychartDiagram-6GGTOJPD-jdLZsMb2.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +10 -5
- package/src/__tests__/mocks.ts +43 -0
- package/src/components/app-config/user-config-form.tsx +78 -1
- package/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap +116 -65
- package/src/components/chat/acp/__tests__/atoms.test.ts +1 -1
- package/src/components/chat/acp/__tests__/context-utils.test.ts +222 -0
- package/src/components/chat/acp/__tests__/prompt.test.ts +1 -1
- package/src/components/chat/acp/__tests__/state.test.ts +38 -42
- package/src/components/chat/acp/agent-docs.tsx +33 -6
- package/src/components/chat/acp/agent-panel.css +0 -18
- package/src/components/chat/acp/agent-panel.tsx +394 -72
- package/src/components/chat/acp/agent-selector.tsx +7 -1
- package/src/components/chat/acp/blocks.tsx +40 -10
- package/src/components/chat/acp/common.tsx +10 -2
- package/src/components/chat/acp/context-utils.ts +127 -0
- package/src/components/chat/acp/prompt.ts +96 -53
- package/src/components/chat/acp/state.ts +1 -1
- package/src/components/chat/acp/types.ts +8 -0
- package/src/components/chat/chat-panel.tsx +28 -89
- package/src/components/chat/chat-utils.ts +127 -1
- package/src/components/chat/markdown-renderer.css +39 -0
- package/src/components/chat/markdown-renderer.tsx +12 -47
- package/src/components/chat/tool-call-accordion.tsx +148 -26
- package/src/components/data-table/SearchBar.tsx +8 -7
- package/src/components/data-table/__tests__/column_formatting.test.ts +50 -35
- package/src/components/data-table/__tests__/data-table.test.tsx +39 -1
- package/src/components/data-table/cell-hover-template/feature.ts +14 -0
- package/src/components/data-table/cell-hover-template/types.ts +11 -0
- package/src/components/data-table/charts/components/form-fields.tsx +41 -37
- package/src/components/data-table/charts/forms/common-chart.tsx +2 -2
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +5 -2
- package/src/components/data-table/column-formatting/feature.ts +62 -29
- package/src/components/data-table/column-formatting/types.ts +1 -0
- package/src/components/data-table/column-header.tsx +3 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +24 -7
- package/src/components/data-table/column-summary/column-summary.tsx +18 -9
- package/src/components/data-table/columns.tsx +42 -18
- package/src/components/data-table/data-table.tsx +10 -2
- package/src/components/data-table/date-popover.tsx +85 -75
- package/src/components/data-table/filter-pills.tsx +14 -9
- package/src/components/data-table/header-items.tsx +5 -1
- package/src/components/data-table/pagination.tsx +20 -13
- package/src/components/data-table/renderers.tsx +28 -0
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +10 -8
- package/src/components/datasources/column-preview.tsx +6 -2
- package/src/components/datasources/datasources.tsx +8 -12
- package/src/components/editor/Cell.tsx +6 -0
- package/src/components/editor/actions/name-cell-input.tsx +6 -1
- package/src/components/editor/actions/useCellActionButton.tsx +3 -1
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +178 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +68 -66
- package/src/components/editor/ai/ai-completion-editor.tsx +29 -26
- package/src/components/editor/ai/completion-handlers.tsx +44 -6
- package/src/components/editor/ai/completion-utils.ts +92 -0
- package/src/components/editor/ai/transport/chat-transport.tsx +39 -0
- package/src/components/editor/cell/CellStatus.tsx +23 -20
- package/src/components/editor/cell/CreateCellButton.tsx +3 -4
- package/src/components/editor/cell/StagedAICell.tsx +51 -0
- package/src/components/editor/cell/cell-actions.tsx +2 -1
- package/src/components/editor/cell/code/language-toggle.tsx +3 -4
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +39 -28
- package/src/components/editor/controls/notebook-menu-dropdown.tsx +4 -2
- package/src/components/editor/file-tree/requesting-tree.tsx +14 -8
- package/src/components/editor/renderers/CellArray.tsx +3 -4
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +3 -3
- package/src/components/editor/renderers/slides-layout/types.ts +1 -0
- package/src/components/pages/home-page.tsx +4 -1
- package/src/components/slides/slides-component.tsx +1 -1
- package/src/components/slides/slides.css +6 -0
- package/src/components/terminal/__tests__/state.test.ts +207 -0
- package/src/components/terminal/hooks.ts +41 -0
- package/src/components/terminal/state.ts +75 -0
- package/src/components/terminal/terminal.tsx +334 -13
- package/src/components/terminal/theme.tsx +57 -0
- package/src/components/tracing/tracing-spec.ts +5 -4
- package/src/components/ui/range-slider.tsx +4 -2
- package/src/components/ui/slider.tsx +3 -1
- package/src/components/variables/variables-table.tsx +3 -0
- package/src/core/MarimoApp.tsx +9 -6
- package/src/core/ai/__tests__/staged-cells.test.ts +356 -0
- package/src/core/ai/context/__tests__/registry.test.ts +6 -4
- package/src/core/ai/context/providers/cell-output.ts +3 -2
- package/src/core/ai/context/providers/error.ts +3 -1
- package/src/core/ai/context/providers/file.ts +7 -2
- package/src/core/ai/context/providers/tables.ts +3 -2
- package/src/core/ai/context/providers/variable.ts +6 -4
- package/src/core/ai/staged-cells.ts +208 -0
- package/src/core/cells/cells.ts +1 -1
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +3 -1
- package/src/core/codemirror/language/LanguageAdapters.ts +9 -3
- package/src/core/codemirror/lsp/federated-lsp.ts +1 -1
- package/src/core/codemirror/lsp/notebook-lsp.ts +8 -2
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/rtc/loro/awareness.ts +52 -17
- package/src/core/codemirror/rtc/loro/sync.ts +12 -4
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/config.ts +4 -0
- package/src/core/hotkeys/hotkeys.ts +8 -4
- package/src/core/i18n/__tests__/locale-provider.test.tsx +176 -0
- package/src/core/i18n/locale-provider.tsx +35 -0
- package/src/core/i18n/with-locale.tsx +12 -0
- package/src/core/islands/components/web-components.tsx +13 -10
- package/src/core/islands/main.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -1
- package/src/core/kernel/messages.ts +8 -12
- package/src/core/network/DeferredRequestRegistry.ts +16 -4
- package/src/core/runtime/runtime.ts +5 -4
- package/src/core/saving/__tests__/filename.test.ts +37 -0
- package/src/core/static/__tests__/download-html.test.ts +43 -1
- package/src/core/wasm/bridge.ts +5 -1
- package/src/core/wasm/store.ts +4 -1
- package/src/core/wasm/worker/message-buffer.ts +3 -2
- package/src/core/websocket/types.ts +22 -16
- package/src/core/websocket/useMarimoWebSocket.tsx +2 -2
- package/src/css/app/Cell.css +11 -0
- package/src/hooks/useFormatting.ts +97 -0
- package/src/hooks/useTimer.ts +8 -5
- package/src/plugins/core/RenderHTML.tsx +36 -2
- package/src/plugins/core/__test__/RenderHTML.test.ts +72 -0
- package/src/plugins/core/registerReactComponent.tsx +44 -10
- package/src/plugins/impl/DataTablePlugin.tsx +4 -0
- package/src/plugins/impl/FileBrowserPlugin.tsx +8 -2
- package/src/plugins/impl/RangeSliderPlugin.tsx +5 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -1
- package/src/plugins/impl/anywidget/model.ts +16 -5
- package/src/plugins/impl/data-editor/types.ts +7 -5
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +20 -13
- package/src/plugins/impl/panel/utils.ts +6 -4
- package/src/plugins/layout/OutlinePlugin.tsx +69 -0
- package/src/plugins/layout/StatPlugin.tsx +4 -1
- package/src/plugins/plugins.ts +2 -0
- package/src/stories/cell.stories.tsx +1 -1
- package/src/stories/layout/vertical/one-column.stories.tsx +1 -1
- package/src/utils/__tests__/cell-urls.test.ts +29 -0
- package/src/utils/__tests__/dates.test.ts +45 -24
- package/src/utils/__tests__/filenames.test.ts +18 -0
- package/src/utils/__tests__/numbers.test.ts +42 -30
- package/src/utils/__tests__/once.test.ts +187 -0
- package/src/utils/__tests__/path.test.ts +38 -0
- package/src/utils/__tests__/urls.test.ts +56 -1
- package/src/utils/dates.ts +15 -10
- package/src/utils/edit-distance.ts +8 -6
- package/src/utils/errors.ts +9 -0
- package/src/utils/id-tree.tsx +21 -10
- package/src/utils/localStorage.ts +13 -4
- package/src/utils/numbers.ts +11 -11
- package/src/utils/once.ts +32 -0
- package/src/utils/paths.ts +4 -1
- package/src/utils/pluralize.ts +12 -5
- package/src/utils/python-poet/poet.ts +30 -15
- package/src/utils/time.ts +5 -1
- package/dist/assets/ConnectedDataExplorerComponent-Cn5-l2X1.js +0 -19
- package/dist/assets/_baseEach-C1FLm7WW.js +0 -1
- package/dist/assets/_baseMap-DBVArUYD.js +0 -1
- package/dist/assets/_baseUniq-Dk7ZPJ3N.js +0 -1
- package/dist/assets/_createAggregator-Bn38fDd3.js +0 -1
- package/dist/assets/agent-panel-COUYnuIK.js +0 -475
- package/dist/assets/architectureDiagram-W76B3OCA-DBzWQKKu.js +0 -36
- package/dist/assets/channel-CjhbjOv4.js +0 -1
- package/dist/assets/chat-panel-BPXKoTnZ.js +0 -7
- package/dist/assets/chat-panel-Brrs_eeH.css +0 -1
- package/dist/assets/classDiagram-KNZD7YFC-DHs5cFzy.js +0 -1
- package/dist/assets/classDiagram-v2-RKCZMP56-DHs5cFzy.js +0 -1
- package/dist/assets/clone-DM1YNjEn.js +0 -1
- package/dist/assets/command-palette-S0bzQp7v.js +0 -1
- package/dist/assets/common-B8U9k2Ly.js +0 -1
- package/dist/assets/cose-bilkent-S5V4N54A-wz1Sfx7j.js +0 -1
- package/dist/assets/dagre-5GWH7T2D-BfpcVBgq.js +0 -4
- package/dist/assets/datasources-panel-DfuURLJw.js +0 -1
- package/dist/assets/diagram-N5W7TBWH-Bf0oqqQh.js +0 -24
- package/dist/assets/diagram-QEK2KX5R-ZTc3qikh.js +0 -43
- package/dist/assets/diagram-S2PKOQOG-tLScBy7Z.js +0 -24
- package/dist/assets/edit-page-DJ8kJZ9w.js +0 -129
- package/dist/assets/file-explorer-panel-CzNUJ63G.js +0 -1
- package/dist/assets/gitGraphDiagram-NY62KEGX-C1t6QtVa.js +0 -65
- package/dist/assets/graph-CssCVWIq.js +0 -1
- package/dist/assets/home-page-9eW6qida.js +0 -9
- package/dist/assets/index-CknhX2Vy.css +0 -1
- package/dist/assets/index-DcCIe7np.js +0 -28
- package/dist/assets/index-OC46250R.js +0 -570
- package/dist/assets/infoDiagram-STP46IZ2-CwiAoz9f.js +0 -2
- package/dist/assets/layout-DpQrxGW-.js +0 -1
- package/dist/assets/linear-NsreOeBF.js +0 -1
- package/dist/assets/links-CbvGxbsJ.js +0 -7
- package/dist/assets/mermaid-DSt0r6IQ.js +0 -1
- package/dist/assets/min-D259kI3t.js +0 -1
- package/dist/assets/outline-panel-uvsS-YEQ.js +0 -1
- package/dist/assets/packages-panel-xMz9W2hW.js +0 -1
- package/dist/assets/run-page-Bb68qdhQ.js +0 -1
- package/dist/assets/sankeyDiagram-GR3RE2ED-BSJOau8E.js +0 -10
- package/dist/assets/scratchpad-panel-BF4BO-U4.js +0 -1
- package/dist/assets/secrets-panel-CdIX44dQ.js +0 -1
- package/dist/assets/snippets-panel-Dco9h0rb.js +0 -1
- package/dist/assets/sortBy-aLGA-PGK.js +0 -1
- package/dist/assets/stateDiagram-KXAO66HF-Bd68WT3b.js +0 -1
- package/dist/assets/stateDiagram-v2-UMBNRL4Z-BXz_GSwb.js +0 -1
- package/dist/assets/storage-CGlP4lCF.js +0 -26
- package/dist/assets/terminal-CxkHubcu.js +0 -9
- package/dist/assets/time-D2nr1UgQ.js +0 -1
- package/dist/assets/tracing-kTqHxa7q.js +0 -2
- package/dist/assets/variable-panel-noTnH-AQ.js +0 -1
- 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 <
|
|
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
|
-
<
|
|
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
|
|
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 =
|
|
642
|
-
const
|
|
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
|
-
|
|
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(
|
|
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
|
-
{
|
|
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:
|
|
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={() =>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
|
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
|
|
170
|
-
import
|
|
171
|
-
import seaborn as sns
|
|
193
|
+
import polars as pl
|
|
194
|
+
import altair as alt
|
|
172
195
|
`,
|
|
173
196
|
`
|
|
174
|
-
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["
|
|
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.
|
|
184
|
-
value="
|
|
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.
|
|
189
|
-
value="
|
|
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
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
205
|
-
|
|
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
|
|
253
|
+
import polars as pl
|
|
216
254
|
`,
|
|
217
255
|
`# Load dataset
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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\
|
|
252
|
-
`
|
|
253
|
-
`
|
|
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
|
|
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<
|