@marimo-team/islands 0.25.1-dev4 → 0.25.1-dev40
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/{ConnectedDataExplorerComponent-KVhjDMSe.js → ConnectedDataExplorerComponent-CwMXfDQR.js} +3 -3
- package/dist/{ErrorBoundary-pV36lYEK.js → ErrorBoundary-CAJO-M56.js} +1 -1
- package/dist/{ImageComparisonComponent-Dlm5aWnH.js → ImageComparisonComponent-Cpfz30OZ.js} +51 -52
- package/dist/{abnfDiagram-VCTEODGH-CpN0FRda.js → abnfDiagram-VCTEODGH-AFhOQTt8.js} +3 -3
- package/dist/{architectureDiagram-5GKGNRK7-DDyj5SRB.js → architectureDiagram-5GKGNRK7-BngksAAQ.js} +5 -5
- package/dist/{blockDiagram-I7D4REHJ-BbXEXJRu.js → blockDiagram-I7D4REHJ-CvBmppdy.js} +9 -9
- package/dist/{c4Diagram-7LVT6UL2-DcLsbQmR.js → c4Diagram-7LVT6UL2-EceL4_jH.js} +7 -7
- package/dist/{cells-B5-y5EY3.js → cells-Cv93oav_.js} +3 -3
- package/dist/{channel-B5XnTarr.js → channel-z7HZXHwv.js} +1 -1
- package/dist/{chat-ui-HJZsTl7o.js → chat-ui-DLSF8a04.js} +4 -4
- package/dist/{chunk-4HAMMTFA-D2qv8E0X.js → chunk-4HAMMTFA-BPTTOOC5.js} +5 -5
- package/dist/{chunk-75Z2AOVW-5_HsvXwr.js → chunk-75Z2AOVW-C4AOleKf.js} +1 -1
- package/dist/{chunk-DU6HZSFF-BUgAHvnM.js → chunk-DU6HZSFF-1TwWR6gh.js} +1 -1
- package/dist/{chunk-F27PBJKO-DHmYWZXr.js → chunk-F27PBJKO-DMI1PBe4.js} +1 -1
- package/dist/{chunk-GMAD6QVW-Czynz8aA.js → chunk-GMAD6QVW-vStrMz2P.js} +3 -3
- package/dist/{chunk-GVQU2GXP-yQEdulRS.js → chunk-GVQU2GXP-2HwWgs4u.js} +2 -2
- package/dist/{chunk-IMKFNOWR-BfwTebD0.js → chunk-IMKFNOWR-UOVZuZVn.js} +5 -5
- package/dist/{chunk-L3NEJ4N5-DwRWnDDK.js → chunk-L3NEJ4N5-RhC7i0I2.js} +5 -5
- package/dist/{chunk-OSK3NFVY-BBKU_Ign.js → chunk-OSK3NFVY-CZV09N-U.js} +6 -6
- package/dist/{chunk-P2QGCYS3-C0iGU29N.js → chunk-P2QGCYS3-0TAWai9C.js} +1 -1
- package/dist/{chunk-POPQ4Y6H-BCbS3Ozc.js → chunk-POPQ4Y6H-Cc3_56GX.js} +1 -1
- package/dist/{chunk-PWAF6VOD-CTFCL0jI.js → chunk-PWAF6VOD-lNxB9k8z.js} +1 -1
- package/dist/{chunk-SHT3W25Y-BspJEJ5H.js → chunk-SHT3W25Y-CrEPyWy1.js} +7 -7
- package/dist/{chunk-SVP7TREG-DX3rFNTe.js → chunk-SVP7TREG-uIyyySp6.js} +2 -2
- package/dist/{chunk-TICWLB2K-fVF7Uujg.js → chunk-TICWLB2K-DdXM3eg6.js} +5 -5
- package/dist/classDiagram-ZZMXUADV-BiATbBE4.js +30 -0
- package/dist/classDiagram-v2-VYDZK3BY-JnH97GYw.js +30 -0
- package/dist/{code-visibility-CgZS2a3W.js → code-visibility-XU9RAJNV.js} +2 -2
- package/dist/{common-DnMDPPaW.js → common-C0fbrgB8.js} +13 -13
- package/dist/{cynefinDiagram-5FMLGOSQ-CFQrqzSX.js → cynefinDiagram-5FMLGOSQ-zknaAsGy.js} +3 -3
- package/dist/{dagre-GXQ25YYZ-xHNAUTyG.js → dagre-GXQ25YYZ-BhMOoMGJ.js} +10 -10
- package/dist/{data-grid-overlay-editor-hHYgD_Sm.js → data-grid-overlay-editor-BnhbJgoq.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-Bt1rPbAx.js → diagram-S7CK7UJ4-V5-Z-EDY.js} +4 -4
- package/dist/{diagram-UQ7AKVKN-D1sq5FoZ.js → diagram-UQ7AKVKN-qw8AjDal.js} +3 -3
- package/dist/{diagram-VSXAHHWV-BKpmG23x.js → diagram-VSXAHHWV-CR7BJygZ.js} +2 -2
- package/dist/{diagram-VX7I27RA-BMwGFVD6.js → diagram-VX7I27RA-DfuqFb1E.js} +5 -5
- package/dist/{diagram-Z3DM3KII--KLDR9Pl.js → diagram-Z3DM3KII-DpWwlYZB.js} +3 -3
- package/dist/{dist-BaHjhkpZ.js → dist-CcyKTBTF.js} +1 -1
- package/dist/{ebnfDiagram-PWID7BFC-WnG4cvSQ.js → ebnfDiagram-PWID7BFC-C20OnNMZ.js} +3 -3
- package/dist/{erDiagram-RLTQ6QDP-DhzKiYHc.js → erDiagram-RLTQ6QDP-DBXLWO9v.js} +12 -12
- package/dist/{error-entries-Bkbpx0T0.js → error-entries-DLl0XqoW.js} +1 -1
- package/dist/{feedback-button-CvKssdG_.js → feedback-button-B0QSkbSp.js} +4 -4
- package/dist/flowDiagram-HODETNUW-DL52nMkt.js +16 -0
- package/dist/{formats-C8rLgZT9.js → formats-Cl_67ghI.js} +1 -1
- package/dist/{ganttDiagram-EL5Y4UJY-DbzEBLbl.js → ganttDiagram-EL5Y4UJY-cRRaDt88.js} +2 -2
- package/dist/{gitGraphDiagram-WWUBYQGX-BMf0iKi1.js → gitGraphDiagram-WWUBYQGX-Pox5k9-Y.js} +2 -2
- package/dist/{glide-data-editor-Ohetlgag.js → glide-data-editor-ymIQdwrb.js} +3 -3
- package/dist/{globals-CPNNcOJI.js → globals-B0S3-e_D.js} +1 -1
- package/dist/{html-to-image-BAgJOlSW.js → html-to-image-CGVgroef.js} +2 -2
- package/dist/{infoDiagram-27XIBGKW-BagtCX_5.js → infoDiagram-27XIBGKW-ntpxMfrq.js} +2 -2
- package/dist/{ishikawaDiagram-5VMMS53U-DByDehYy.js → ishikawaDiagram-5VMMS53U-BllIlHE5.js} +3 -3
- package/dist/{journeyDiagram-3NMN7TZE-D2LcKDUO.js → journeyDiagram-3NMN7TZE-EPJDPlt0.js} +2 -2
- package/dist/{kanban-definition-UXKFOSKX-BxwkbBI_.js → kanban-definition-UXKFOSKX-GYtNMjtS.js} +9 -9
- package/dist/{katex-C6D4cX_N.js → katex-BNCmKUol.js} +983 -1120
- package/dist/{loader-D2W4oM-3.js → loader-DEZSzvma.js} +253 -248
- package/dist/main.js +72 -69
- package/dist/{mermaid-DPNuhemn.js → mermaid-Dnzoxjt1.js} +49 -49
- package/dist/{mhchem-DWCF06w9.js → mhchem-BEc7A1or.js} +1 -1
- package/dist/{mindmap-definition-YA3MSWOX-Cgvojw3y.js → mindmap-definition-YA3MSWOX-Cth76xgH.js} +11 -11
- package/dist/{number-overlay-editor-CHWg5gGO.js → number-overlay-editor-DB3HJDI1.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DahHhYyN.js → pegDiagram-XKGWAZYB-Cu4uOXii.js} +3 -3
- package/dist/{pieDiagram-E7YTZNPT-CCtX0oCK.js → pieDiagram-E7YTZNPT-Bh3eDa9s.js} +3 -3
- package/dist/{process-output-zDX4jbhd.js → process-output-CGfg-JmZ.js} +2 -2
- package/dist/{quadrantDiagram-AXDQQJYC-DftINo6g.js → quadrantDiagram-AXDQQJYC--kqzFC3w.js} +1 -1
- package/dist/{railroadDiagram-O6MQD6OU-Du5NsPUb.js → railroadDiagram-O6MQD6OU-DG-M6Rnc.js} +3 -3
- package/dist/{react-vega-5AcMW8gG.js → react-vega-ewj7q_U5.js} +1 -1
- package/dist/{requirementDiagram-BXWQKSXE-0pmmxL6_.js → requirementDiagram-BXWQKSXE-DCwsThh0.js} +11 -11
- package/dist/{reveal-component-BujcZI2B.js → reveal-component-CfTzIkA2.js} +3 -3
- package/dist/{sankeyDiagram-P5KCCOFB-CDKR5TJH.js → sankeyDiagram-P5KCCOFB-BdzhT0BM.js} +1 -1
- package/dist/{sequenceDiagram-WJ2MYXX4-DB-ChWwU.js → sequenceDiagram-WJ2MYXX4-CbXB1_PU.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-orN6AwMx.js → stateDiagram-D77RDMKH-A-Zf3Sb2.js} +13 -13
- package/dist/stateDiagram-v2-MP3YSRHH-D9YMnUGx.js +30 -0
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-BkSDcqDT.js → swimlanes-42K2YHIH-B_pMf0J4.js} +10 -10
- package/dist/swimlanesDiagram-VR7AAH4N-Ctgy-yGP.js +30 -0
- package/dist/{timeline-definition-24CTP7MA-BuqJUIRZ.js → timeline-definition-24CTP7MA-DTXFjTTM.js} +3 -3
- package/dist/{vega-component-CNf5gcrm.js → vega-component-tFOzgarw.js} +4 -4
- package/dist/{vega-embed-container-CbnTccZi.js → vega-embed-container-sSR5hAsy.js} +2 -2
- package/dist/{vega-loader.browser-D95WfUcj.js → vega-loader.browser-DNST6uVf.js} +2 -2
- package/dist/{vennDiagram-4TSXK5OY-CTUlJ2PK.js → vennDiagram-4TSXK5OY-BPHjZo0R.js} +3 -3
- package/dist/{wardleyDiagram-VM6X3IG4-3evLUb0M.js → wardleyDiagram-VM6X3IG4-6fTLYBuD.js} +3 -3
- package/dist/{xychartDiagram-S5SC5T6Z-DL2E3K8-.js → xychartDiagram-S5SC5T6Z-BYjwjrzE.js} +5 -5
- package/package.json +1 -2
- package/src/__mocks__/common.ts +3 -3
- package/src/__tests__/CellStatus.test.tsx +1 -1
- package/src/__tests__/setup.ts +7 -7
- package/src/components/app-config/ai-config.tsx +2 -0
- package/src/components/app-config/optional-features.tsx +1 -1
- package/src/components/chat/chat-panel.tsx +19 -8
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +286 -0
- package/src/components/data-table/charts/charts.tsx +26 -13
- package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
- package/src/components/dependency-graph/elements.ts +2 -2
- package/src/components/editor/__tests__/package-alert.test.tsx +140 -0
- package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
- package/src/components/editor/actions/pair-with-agent.tsx +119 -0
- package/src/components/editor/actions/useNotebookActions.tsx +2 -1
- package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
- package/src/components/editor/ai/staged-cell-submission.ts +2 -2
- package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
- package/src/components/editor/chrome/components/contribute-snippet-button.tsx +6 -1
- package/src/components/editor/connections/database/as-code.ts +44 -44
- package/src/components/editor/connections/storage/as-code.ts +3 -3
- package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
- package/src/components/editor/navigation/clipboard.ts +2 -2
- package/src/components/editor/notebook-cell.tsx +2 -2
- package/src/components/editor/output/MarimoTracebackOutput.tsx +1 -1
- package/src/components/editor/output/VideoOutput.tsx +1 -1
- package/src/components/editor/output/ansi-reduce.ts +21 -17
- package/src/components/editor/output/console/ConsoleOutput.tsx +3 -3
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +59 -0
- package/src/components/editor/output/console/text-rendering.tsx +3 -1
- package/src/components/editor/package-alert.tsx +20 -7
- package/src/components/home/components.tsx +1 -0
- package/src/components/pages/run-page.tsx +1 -0
- package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
- package/src/components/slides/__tests__/minimap.test.ts +12 -12
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
- package/src/components/static-html/share-modal.tsx +2 -1
- package/src/components/static-html/static-banner.tsx +2 -2
- package/src/components/ui/links.tsx +6 -1
- package/src/components/ui/typography.tsx +16 -8
- package/src/core/ai/context/__tests__/registry.test.ts +31 -28
- package/src/core/ai/context/providers/cell-output.ts +8 -8
- package/src/core/ai/context/providers/datasource.ts +10 -7
- package/src/core/ai/context/providers/error.ts +7 -7
- package/src/core/ai/context/providers/file.ts +8 -8
- package/src/core/ai/context/providers/tables.ts +7 -7
- package/src/core/ai/context/providers/variable.ts +7 -7
- package/src/core/ai/context/registry.ts +18 -18
- package/src/core/ai/ids/ids.ts +5 -5
- package/src/core/ai/model-registry.ts +12 -9
- package/src/core/ai/staged-cells.ts +6 -6
- package/src/core/ai/tools/base.ts +6 -6
- package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
- package/src/core/ai/tools/registry.ts +4 -4
- package/src/core/ai/tools/run-cells-tool.ts +7 -7
- package/src/core/ai/tools/sample-tool.ts +6 -6
- package/src/core/cells/__tests__/cells.test.ts +27 -0
- package/src/core/cells/cells.ts +2 -1
- package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
- package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
- package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
- package/src/core/codemirror/code-lens/extension.ts +13 -13
- package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
- package/src/core/codemirror/copilot/language-server.ts +13 -13
- package/src/core/codemirror/copilot/transport.ts +1 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
- package/src/core/codemirror/go-to-definition/underline.ts +3 -3
- package/src/core/codemirror/keymaps/vim.ts +3 -3
- package/src/core/codemirror/language/languages/markdown.ts +8 -8
- package/src/core/codemirror/language/languages/python.ts +7 -7
- package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
- package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
- package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
- package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
- package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
- package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
- package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
- package/src/core/codemirror/reactive-references/extension.ts +3 -3
- package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
- package/src/core/codemirror/rtc/loro/sync.ts +5 -5
- package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
- package/src/core/dom/ui-element.ts +5 -5
- package/src/core/dom/uiregistry.ts +10 -10
- package/src/core/hotkeys/hotkeys.ts +9 -9
- package/src/core/islands/__tests__/bridge.test.ts +4 -4
- package/src/core/islands/__tests__/test-utils.tsx +4 -4
- package/src/core/islands/bridge.ts +85 -82
- package/src/core/islands/components/web-components.tsx +7 -7
- package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
- package/src/core/islands/worker/controller.ts +6 -3
- package/src/core/islands/worker-factory.ts +2 -2
- package/src/core/kernel/RuntimeState.ts +4 -4
- package/src/core/lsp/__tests__/transport.test.ts +19 -19
- package/src/core/lsp/transport.ts +5 -5
- package/src/core/network/CachingRequestRegistry.ts +2 -2
- package/src/core/network/DeferredRequestRegistry.ts +4 -4
- package/src/core/runtime/runtime.ts +25 -20
- package/src/core/static/virtual-file-tracker.ts +5 -5
- package/src/core/wasm/__tests__/bridge.test.ts +2 -2
- package/src/core/wasm/bridge.ts +130 -126
- package/src/core/wasm/router.ts +5 -5
- package/src/core/wasm/store.ts +4 -4
- package/src/core/wasm/worker/bootstrap.ts +8 -5
- package/src/core/wasm/worker/message-buffer.ts +3 -3
- package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
- package/src/core/websocket/transports/basic.ts +15 -8
- package/src/core/websocket/transports/sse.ts +7 -7
- package/src/core/websocket/transports/transport.ts +3 -3
- package/src/core/websocket/transports/ws.ts +9 -7
- package/src/css/globals.css +18 -21
- package/src/css/katex.min.css +260 -241
- package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
- package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
- package/src/plugins/core/registerReactComponent.tsx +5 -5
- package/src/plugins/core/sidebar-element.tsx +2 -2
- package/src/plugins/impl/ButtonPlugin.tsx +3 -3
- package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
- package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
- package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DateRangePlugin.tsx +3 -3
- package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
- package/src/plugins/impl/DictPlugin.tsx +3 -3
- package/src/plugins/impl/DropdownPlugin.tsx +3 -3
- package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
- package/src/plugins/impl/MatrixPlugin.tsx +4 -4
- package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
- package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
- package/src/plugins/impl/NumberPlugin.tsx +3 -3
- package/src/plugins/impl/RadioPlugin.tsx +9 -5
- package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
- package/src/plugins/impl/RefreshPlugin.tsx +3 -3
- package/src/plugins/impl/SliderPlugin.tsx +3 -3
- package/src/plugins/impl/SwitchPlugin.tsx +3 -3
- package/src/plugins/impl/TabsPlugin.tsx +3 -3
- package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
- package/src/plugins/impl/TextInputPlugin.tsx +3 -3
- package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
- package/src/plugins/impl/anywidget/model.ts +10 -10
- package/src/plugins/impl/anywidget/registry.ts +12 -9
- package/src/plugins/impl/anywidget/runtime.ts +11 -9
- package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +7 -6
- package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
- package/src/plugins/impl/panel/utils.ts +5 -5
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
- package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
- package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
- package/src/plugins/impl/vega/__tests__/utils.test.ts +16 -1
- package/src/plugins/impl/vega/__tests__/vega.test.ts +37 -0
- package/src/plugins/impl/vega/loader.ts +23 -1
- package/src/plugins/impl/vega/utils.ts +5 -4
- package/src/plugins/layout/AccordionPlugin.tsx +3 -3
- package/src/plugins/layout/CalloutPlugin.tsx +3 -3
- package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
- package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
- package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
- package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
- package/src/plugins/layout/OutlinePlugin.tsx +3 -3
- package/src/plugins/layout/ProgressPlugin.tsx +3 -3
- package/src/plugins/layout/RoutesPlugin.tsx +6 -8
- package/src/plugins/layout/StatPlugin.tsx +3 -3
- package/src/plugins/layout/TexPlugin.tsx +3 -3
- package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
- package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
- package/src/utils/Deferred.ts +6 -6
- package/src/utils/async-capture-tracker.ts +10 -7
- package/src/utils/errors.ts +5 -5
- package/src/utils/id-tree.tsx +83 -80
- package/src/utils/lru.ts +1 -1
- package/src/utils/multi-map.ts +14 -12
- package/src/utils/paths.ts +6 -6
- package/src/utils/pluralize.ts +3 -3
- package/src/utils/progress.ts +6 -6
- package/src/utils/python-poet/poet.ts +14 -14
- package/src/utils/routes.ts +4 -2
- package/src/utils/semaphore.ts +6 -6
- package/src/utils/storage/storage.ts +6 -6
- package/src/utils/storage/typed.ts +16 -12
- package/src/utils/time.ts +9 -9
- package/src/utils/timed-cache.ts +4 -4
- package/src/utils/tracer.ts +9 -6
- package/dist/classDiagram-ZZMXUADV-Fe-V14Sc.js +0 -30
- package/dist/classDiagram-v2-VYDZK3BY-xTDg7lOs.js +0 -30
- package/dist/flowDiagram-HODETNUW-6dMdB8pR.js +0 -16
- package/dist/katex-DFBiSucW.js +0 -21840
- package/dist/stateDiagram-v2-MP3YSRHH-o05_rJN8.js +0 -30
- package/dist/swimlanesDiagram-VR7AAH4N-D_nFQfRc.js +0 -30
|
@@ -95,17 +95,17 @@ function errorContextName(entry: CellErrorEntry): string {
|
|
|
95
95
|
|
|
96
96
|
const errorsTxt = new PluralWord("error", "errors");
|
|
97
97
|
export class ErrorContextProvider extends AIContextProvider<ErrorContextItem> {
|
|
98
|
-
readonly title = "Errors";
|
|
99
|
-
readonly mentionPrefix = "@";
|
|
100
|
-
readonly contextType = "error";
|
|
98
|
+
public readonly title = "Errors";
|
|
99
|
+
public readonly mentionPrefix = "@";
|
|
100
|
+
public readonly contextType = "error";
|
|
101
101
|
private store: JotaiStore;
|
|
102
102
|
|
|
103
|
-
constructor(store: JotaiStore) {
|
|
103
|
+
public constructor(store: JotaiStore) {
|
|
104
104
|
super();
|
|
105
105
|
this.store = store;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
getItems(): ErrorContextItem[] {
|
|
108
|
+
public getItems(): ErrorContextItem[] {
|
|
109
109
|
const errors = getCellErrorEntries(this.store);
|
|
110
110
|
|
|
111
111
|
if (errors.length === 0) {
|
|
@@ -141,7 +141,7 @@ export class ErrorContextProvider extends AIContextProvider<ErrorContextItem> {
|
|
|
141
141
|
return items;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
formatCompletion(item: ErrorContextItem): Completion {
|
|
144
|
+
public formatCompletion(item: ErrorContextItem): Completion {
|
|
145
145
|
if (item.data.type === "all-errors") {
|
|
146
146
|
const errorCount = item.data.errors.length;
|
|
147
147
|
return {
|
|
@@ -201,7 +201,7 @@ export class ErrorContextProvider extends AIContextProvider<ErrorContextItem> {
|
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
formatContext(item: ErrorContextItem): string {
|
|
204
|
+
public formatContext(item: ErrorContextItem): string {
|
|
205
205
|
const entries =
|
|
206
206
|
item.data.type === "all-errors" ? item.data.errors : [item.data.error];
|
|
207
207
|
|
|
@@ -38,14 +38,14 @@ const DEFAULT_FILE_SEARCH_CONFIG: FileSearchConfig = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export class FileContextProvider extends AIContextProvider<FileContextItem> {
|
|
41
|
-
readonly title = "Files";
|
|
42
|
-
readonly mentionPrefix = "#";
|
|
43
|
-
readonly contextType = "file";
|
|
41
|
+
public readonly title = "Files";
|
|
42
|
+
public readonly mentionPrefix = "#";
|
|
43
|
+
public readonly contextType = "file";
|
|
44
44
|
|
|
45
45
|
private apiRequests: EditRequests & RunRequests;
|
|
46
46
|
private config: FileSearchConfig;
|
|
47
47
|
|
|
48
|
-
constructor(
|
|
48
|
+
public constructor(
|
|
49
49
|
apiRequests: EditRequests & RunRequests,
|
|
50
50
|
config: FileSearchConfig = DEFAULT_FILE_SEARCH_CONFIG,
|
|
51
51
|
) {
|
|
@@ -58,7 +58,7 @@ export class FileContextProvider extends AIContextProvider<FileContextItem> {
|
|
|
58
58
|
* Create a dynamic completion source for file mentions
|
|
59
59
|
* This bypasses the standard registry system to enable dynamic searching
|
|
60
60
|
*/
|
|
61
|
-
createCompletionSource(): CompletionSource {
|
|
61
|
+
public createCompletionSource(): CompletionSource {
|
|
62
62
|
return async (
|
|
63
63
|
context: CompletionContext,
|
|
64
64
|
): Promise<CompletionResult | null> => {
|
|
@@ -176,13 +176,13 @@ export class FileContextProvider extends AIContextProvider<FileContextItem> {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
getItems(): FileContextItem[] {
|
|
179
|
+
public getItems(): FileContextItem[] {
|
|
180
180
|
// Files are fetched dynamically, so return empty array
|
|
181
181
|
// This provider relies on dynamic fetching via createCompletionSource()
|
|
182
182
|
return [];
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
formatCompletion(item: FileContextItem): Completion {
|
|
185
|
+
public formatCompletion(item: FileContextItem): Completion {
|
|
186
186
|
const { data, name } = item;
|
|
187
187
|
const icon = data.isDirectory ? "📁" : "📄";
|
|
188
188
|
|
|
@@ -254,7 +254,7 @@ export class FileContextProvider extends AIContextProvider<FileContextItem> {
|
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
formatContext(item: FileContextItem): string {
|
|
257
|
+
public formatContext(item: FileContextItem): string {
|
|
258
258
|
const { data, name } = item;
|
|
259
259
|
return contextToXml({
|
|
260
260
|
type: this.contextType,
|
|
@@ -17,16 +17,16 @@ export interface TableContextItem extends AIContextItem {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export class TableContextProvider extends AIContextProvider<TableContextItem> {
|
|
20
|
-
readonly title = "Tables";
|
|
21
|
-
readonly mentionPrefix = "@";
|
|
22
|
-
readonly contextType = "data";
|
|
20
|
+
public readonly title = "Tables";
|
|
21
|
+
public readonly mentionPrefix = "@";
|
|
22
|
+
public readonly contextType = "data";
|
|
23
23
|
private tablesMap: DatasetTablesMap;
|
|
24
|
-
constructor(tablesMap: DatasetTablesMap) {
|
|
24
|
+
public constructor(tablesMap: DatasetTablesMap) {
|
|
25
25
|
super();
|
|
26
26
|
this.tablesMap = tablesMap;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
getItems(): TableContextItem[] {
|
|
29
|
+
public getItems(): TableContextItem[] {
|
|
30
30
|
return [...this.tablesMap.entries()].map(([tableName, table]) => ({
|
|
31
31
|
uri: this.asURI(tableName),
|
|
32
32
|
name: tableName,
|
|
@@ -36,7 +36,7 @@ export class TableContextProvider extends AIContextProvider<TableContextItem> {
|
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
formatContext(item: TableContextItem): string {
|
|
39
|
+
public formatContext(item: TableContextItem): string {
|
|
40
40
|
const { data } = item;
|
|
41
41
|
const { columns, source, num_rows, num_columns, name, variable_name } =
|
|
42
42
|
data;
|
|
@@ -90,7 +90,7 @@ export class TableContextProvider extends AIContextProvider<TableContextItem> {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
formatCompletion(item: TableContextItem): Completion {
|
|
93
|
+
public formatCompletion(item: TableContextItem): Completion {
|
|
94
94
|
const tableName = item.data.name;
|
|
95
95
|
const table = item.data;
|
|
96
96
|
return {
|
|
@@ -16,20 +16,20 @@ export interface VariableContextItem extends AIContextItem {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class VariableContextProvider extends AIContextProvider<VariableContextItem> {
|
|
19
|
-
readonly title = "Variables";
|
|
20
|
-
readonly mentionPrefix = "@";
|
|
21
|
-
readonly contextType = "variable";
|
|
19
|
+
public readonly title = "Variables";
|
|
20
|
+
public readonly mentionPrefix = "@";
|
|
21
|
+
public readonly contextType = "variable";
|
|
22
22
|
|
|
23
23
|
private variables: Variables;
|
|
24
24
|
private tablesMap: DatasetTablesMap;
|
|
25
25
|
|
|
26
|
-
constructor(variables: Variables, tablesMap: DatasetTablesMap) {
|
|
26
|
+
public constructor(variables: Variables, tablesMap: DatasetTablesMap) {
|
|
27
27
|
super();
|
|
28
28
|
this.variables = variables;
|
|
29
29
|
this.tablesMap = tablesMap;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
getItems(): VariableContextItem[] {
|
|
32
|
+
public getItems(): VariableContextItem[] {
|
|
33
33
|
const ignore = new Set(this.tablesMap.keys());
|
|
34
34
|
|
|
35
35
|
return Object.entries(this.variables).flatMap(([name, variable]) => {
|
|
@@ -51,7 +51,7 @@ export class VariableContextProvider extends AIContextProvider<VariableContextIt
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
formatCompletion(item: VariableContextItem): Completion {
|
|
54
|
+
public formatCompletion(item: VariableContextItem): Completion {
|
|
55
55
|
const { data } = item;
|
|
56
56
|
const { variable } = data;
|
|
57
57
|
return {
|
|
@@ -66,7 +66,7 @@ export class VariableContextProvider extends AIContextProvider<VariableContextIt
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
formatContext(item: VariableContextItem): string {
|
|
69
|
+
public formatContext(item: VariableContextItem): string {
|
|
70
70
|
const { data } = item;
|
|
71
71
|
const { variable } = data;
|
|
72
72
|
return contextToXml({
|
|
@@ -36,35 +36,35 @@ export abstract class AIContextProvider<
|
|
|
36
36
|
T extends AIContextItem = AIContextItem,
|
|
37
37
|
> {
|
|
38
38
|
/** Human-readable title for this context type */
|
|
39
|
-
abstract readonly title: string;
|
|
39
|
+
public abstract readonly title: string;
|
|
40
40
|
|
|
41
41
|
/** Prefix used for mentions (e.g., "@" for variables, "#" for files) */
|
|
42
|
-
abstract readonly mentionPrefix: "@" | "#";
|
|
42
|
+
public abstract readonly mentionPrefix: "@" | "#";
|
|
43
43
|
|
|
44
44
|
/** Context type identifier used in ContextLocatorId */
|
|
45
|
-
abstract readonly contextType: string;
|
|
45
|
+
public abstract readonly contextType: string;
|
|
46
46
|
|
|
47
47
|
/** Get all available items of this context type */
|
|
48
|
-
abstract getItems(): T[];
|
|
48
|
+
public abstract getItems(): T[];
|
|
49
49
|
|
|
50
50
|
/** Format the context for inclusion in AI prompt */
|
|
51
|
-
abstract formatContext(item: T): string;
|
|
51
|
+
public abstract formatContext(item: T): string;
|
|
52
52
|
|
|
53
53
|
/** Format completion */
|
|
54
|
-
abstract formatCompletion(item: T): Completion;
|
|
54
|
+
public abstract formatCompletion(item: T): Completion;
|
|
55
55
|
|
|
56
56
|
/** Get attachments for context items (optional, async) */
|
|
57
|
-
async getAttachments(_items: T[]): Promise<FileUIPart[]> {
|
|
57
|
+
public async getAttachments(_items: T[]): Promise<FileUIPart[]> {
|
|
58
58
|
// Default implementation returns no attachments
|
|
59
59
|
return [];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
asURI(id: string): ContextLocatorId {
|
|
62
|
+
public asURI(id: string): ContextLocatorId {
|
|
63
63
|
return `${this.contextType}://${id}` as ContextLocatorId;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/** Parse context IDs from input text using the provider's mention prefix */
|
|
67
|
-
parseContextIds(input: string): ContextLocatorId[] {
|
|
67
|
+
public parseContextIds(input: string): ContextLocatorId[] {
|
|
68
68
|
// Match @type://id, e.g., @data://users
|
|
69
69
|
const regex = new RegExp(
|
|
70
70
|
`${this.mentionPrefix}([\\w-]+):\\/\\/([\\w./-]+)`,
|
|
@@ -112,7 +112,7 @@ export class AIContextRegistry<T extends AIContextItem> {
|
|
|
112
112
|
/**
|
|
113
113
|
* Register a new context provider
|
|
114
114
|
*/
|
|
115
|
-
register<U extends AIContextItem>(
|
|
115
|
+
public register<U extends AIContextItem>(
|
|
116
116
|
provider: AIContextProvider<U>,
|
|
117
117
|
// oxlint-disable-next-line typescript/prefer-return-this-type
|
|
118
118
|
): AIContextRegistry<U | T> {
|
|
@@ -123,28 +123,28 @@ export class AIContextRegistry<T extends AIContextItem> {
|
|
|
123
123
|
/**
|
|
124
124
|
* Get all registered providers
|
|
125
125
|
*/
|
|
126
|
-
getProviders(): Set<AIContextProvider<T>> {
|
|
126
|
+
public getProviders(): Set<AIContextProvider<T>> {
|
|
127
127
|
return this.providers;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Get a specific provider by type
|
|
132
132
|
*/
|
|
133
|
-
getProvider(type: string): AIContextProvider | undefined {
|
|
133
|
+
public getProvider(type: string): AIContextProvider | undefined {
|
|
134
134
|
return [...this.providers].find(
|
|
135
135
|
(provider) => provider.contextType === type,
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
@Memoize()
|
|
140
|
-
getAllItems(): T[] {
|
|
140
|
+
public getAllItems(): T[] {
|
|
141
141
|
return [...this.providers].flatMap((provider) => provider.getItems());
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* Parse context IDs from input across all providers
|
|
146
146
|
*/
|
|
147
|
-
parseAllContextIds(input: string): ContextLocatorId[] {
|
|
147
|
+
public parseAllContextIds(input: string): ContextLocatorId[] {
|
|
148
148
|
return [...this.providers].flatMap((provider) =>
|
|
149
149
|
provider.parseContextIds(input),
|
|
150
150
|
);
|
|
@@ -167,7 +167,7 @@ export class AIContextRegistry<T extends AIContextItem> {
|
|
|
167
167
|
/**
|
|
168
168
|
* Resolve only the requested context items, querying each matching provider
|
|
169
169
|
*/
|
|
170
|
-
resolveItems(contextIds: ContextLocatorId[]): T[] {
|
|
170
|
+
public resolveItems(contextIds: ContextLocatorId[]): T[] {
|
|
171
171
|
if (contextIds.length === 0) {
|
|
172
172
|
return [];
|
|
173
173
|
}
|
|
@@ -215,14 +215,14 @@ export class AIContextRegistry<T extends AIContextItem> {
|
|
|
215
215
|
/**
|
|
216
216
|
* Get context information for mentioned items
|
|
217
217
|
*/
|
|
218
|
-
getContextInfo(contextIds: ContextLocatorId[]): T[] {
|
|
218
|
+
public getContextInfo(contextIds: ContextLocatorId[]): T[] {
|
|
219
219
|
return this.resolveItems(contextIds);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* Format context for AI prompt inclusion
|
|
224
224
|
*/
|
|
225
|
-
formatContextForAI(contextIds: ContextLocatorId[]): string {
|
|
225
|
+
public formatContextForAI(contextIds: ContextLocatorId[]): string {
|
|
226
226
|
const contextInfo = this.resolveItems(contextIds);
|
|
227
227
|
|
|
228
228
|
if (contextInfo.length === 0) {
|
|
@@ -240,7 +240,7 @@ export class AIContextRegistry<T extends AIContextItem> {
|
|
|
240
240
|
/**
|
|
241
241
|
* Get attachments for mentioned items
|
|
242
242
|
*/
|
|
243
|
-
async getAttachmentsForContext(
|
|
243
|
+
public async getAttachmentsForContext(
|
|
244
244
|
contextIds: ContextLocatorId[],
|
|
245
245
|
): Promise<FileUIPart[]> {
|
|
246
246
|
const contextInfo = this.resolveItems(contextIds);
|
package/src/core/ai/ids/ids.ts
CHANGED
|
@@ -33,19 +33,19 @@ export type ShortModelId = TypedString<"ShortModelId">;
|
|
|
33
33
|
export type QualifiedModelId = `${ProviderId}/${ShortModelId}`;
|
|
34
34
|
|
|
35
35
|
export class AiModelId {
|
|
36
|
-
readonly providerId: ProviderId;
|
|
37
|
-
readonly shortModelId: ShortModelId;
|
|
36
|
+
public readonly providerId: ProviderId;
|
|
37
|
+
public readonly shortModelId: ShortModelId;
|
|
38
38
|
|
|
39
|
-
constructor(providerId: ProviderId, shortModelId: ShortModelId) {
|
|
39
|
+
public constructor(providerId: ProviderId, shortModelId: ShortModelId) {
|
|
40
40
|
this.providerId = providerId;
|
|
41
41
|
this.shortModelId = shortModelId;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
get id(): QualifiedModelId {
|
|
44
|
+
public get id(): QualifiedModelId {
|
|
45
45
|
return `${this.providerId}/${this.shortModelId}`;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
static parse(id: string): AiModelId {
|
|
48
|
+
public static parse(id: string): AiModelId {
|
|
49
49
|
if (!id.includes("/")) {
|
|
50
50
|
const providerId = guessProviderId(id);
|
|
51
51
|
return new AiModelId(providerId, id as ShortModelId);
|
|
@@ -93,7 +93,7 @@ export class AiModelRegistry {
|
|
|
93
93
|
this.buildMaps();
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
static getProviderInfo(providerId: ProviderId) {
|
|
96
|
+
public static getProviderInfo(providerId: ProviderId) {
|
|
97
97
|
const { providerMap } = getProviderMap();
|
|
98
98
|
return providerMap.get(providerId);
|
|
99
99
|
}
|
|
@@ -104,7 +104,10 @@ export class AiModelRegistry {
|
|
|
104
104
|
*
|
|
105
105
|
* Models should be in the format of `provider_id/short_model_id`.
|
|
106
106
|
*/
|
|
107
|
-
static create(opts: {
|
|
107
|
+
public static create(opts: {
|
|
108
|
+
customModels?: string[];
|
|
109
|
+
displayedModels?: string[];
|
|
110
|
+
}) {
|
|
108
111
|
const { customModels = [], displayedModels = [] } = opts;
|
|
109
112
|
return new AiModelRegistry(
|
|
110
113
|
customModels.map((model) => AiModelId.parse(model).id),
|
|
@@ -196,23 +199,23 @@ export class AiModelRegistry {
|
|
|
196
199
|
return { modelsByProviderMap, modelsMap };
|
|
197
200
|
}
|
|
198
201
|
|
|
199
|
-
getDisplayedModels() {
|
|
202
|
+
public getDisplayedModels() {
|
|
200
203
|
return this.displayedModels;
|
|
201
204
|
}
|
|
202
205
|
|
|
203
|
-
getCustomModels() {
|
|
206
|
+
public getCustomModels() {
|
|
204
207
|
return this.customModels;
|
|
205
208
|
}
|
|
206
209
|
|
|
207
|
-
getModelsByProvider(provider: ProviderId) {
|
|
210
|
+
public getModelsByProvider(provider: ProviderId) {
|
|
208
211
|
return this.modelsByProviderMap.get(provider) || [];
|
|
209
212
|
}
|
|
210
213
|
|
|
211
|
-
getGroupedModelsByProvider() {
|
|
214
|
+
public getGroupedModelsByProvider() {
|
|
212
215
|
return this.modelsByProviderMap;
|
|
213
216
|
}
|
|
214
217
|
|
|
215
|
-
getListModelsByProvider(): [ProviderId, AiModel[]][] {
|
|
218
|
+
public getListModelsByProvider(): [ProviderId, AiModel[]][] {
|
|
216
219
|
const modelsByProvider = this.getGroupedModelsByProvider();
|
|
217
220
|
const arrayModels = [...modelsByProvider.entries()];
|
|
218
221
|
const providerToOrderIdx = getProviderMap().providerToOrderIdx;
|
|
@@ -227,11 +230,11 @@ export class AiModelRegistry {
|
|
|
227
230
|
return arrayModels;
|
|
228
231
|
}
|
|
229
232
|
|
|
230
|
-
getModelsMap() {
|
|
233
|
+
public getModelsMap() {
|
|
231
234
|
return this.modelsMap;
|
|
232
235
|
}
|
|
233
236
|
|
|
234
|
-
getModel(qualifiedModelId: QualifiedModelId) {
|
|
237
|
+
public getModel(qualifiedModelId: QualifiedModelId) {
|
|
235
238
|
return this.modelsMap.get(qualifiedModelId);
|
|
236
239
|
}
|
|
237
240
|
}
|
|
@@ -305,11 +305,11 @@ class StagedCellReconciler {
|
|
|
305
305
|
private readonly actions: StagedCellReconcilerActions;
|
|
306
306
|
private marimoImportCellId: CellId | null = null;
|
|
307
307
|
|
|
308
|
-
constructor(actions: StagedCellReconcilerActions) {
|
|
308
|
+
public constructor(actions: StagedCellReconcilerActions) {
|
|
309
309
|
this.actions = actions;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
reconcile(completionCells: GeneratedCell[]) {
|
|
312
|
+
public reconcile(completionCells: GeneratedCell[]) {
|
|
313
313
|
for (const [idx, cell] of completionCells.entries()) {
|
|
314
314
|
if (idx < this.createdCells.length) {
|
|
315
315
|
const existingCell = this.createdCells[idx];
|
|
@@ -336,7 +336,7 @@ class StagedCellReconciler {
|
|
|
336
336
|
this.syncMarimoImport(completionCells);
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
discard(stagedCells: StagedAICells) {
|
|
339
|
+
public discard(stagedCells: StagedAICells) {
|
|
340
340
|
for (const { cellId } of this.createdCells.toReversed()) {
|
|
341
341
|
if (stagedCells.has(cellId)) {
|
|
342
342
|
this.actions.deleteStagedCell(cellId);
|
|
@@ -350,17 +350,17 @@ class StagedCellReconciler {
|
|
|
350
350
|
this.marimoImportCellId = null;
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
accept() {
|
|
353
|
+
public accept() {
|
|
354
354
|
for (const cellId of this.stagedCellIds()) {
|
|
355
355
|
this.actions.removeStagedCell(cellId);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
hasStagedCells(stagedCells: StagedAICells) {
|
|
359
|
+
public hasStagedCells(stagedCells: StagedAICells) {
|
|
360
360
|
return this.stagedCellIds().some((cellId) => stagedCells.has(cellId));
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
stagedCellIds() {
|
|
363
|
+
public stagedCellIds() {
|
|
364
364
|
const cellIds = this.createdCells.map(({ cellId }) => cellId);
|
|
365
365
|
if (this.marimoImportCellId) {
|
|
366
366
|
cellIds.push(this.marimoImportCellId);
|
|
@@ -26,12 +26,12 @@ export type StatusValue = "success" | "error" | "warning";
|
|
|
26
26
|
* );
|
|
27
27
|
*/
|
|
28
28
|
export class ToolExecutionError extends Error {
|
|
29
|
-
readonly code: string;
|
|
30
|
-
readonly isRetryable: boolean;
|
|
31
|
-
readonly suggestedFix?: string;
|
|
32
|
-
readonly meta?: Record<string, unknown>;
|
|
29
|
+
public readonly code: string;
|
|
30
|
+
public readonly isRetryable: boolean;
|
|
31
|
+
public readonly suggestedFix?: string;
|
|
32
|
+
public readonly meta?: Record<string, unknown>;
|
|
33
33
|
|
|
34
|
-
constructor(
|
|
34
|
+
public constructor(
|
|
35
35
|
message: string,
|
|
36
36
|
code = "TOOL_ERROR",
|
|
37
37
|
isRetryable = false,
|
|
@@ -46,7 +46,7 @@ export class ToolExecutionError extends Error {
|
|
|
46
46
|
this.meta = meta;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
toStructuredString(): string {
|
|
49
|
+
public toStructuredString(): string {
|
|
50
50
|
const stringError = JSON.stringify({
|
|
51
51
|
message: this.message,
|
|
52
52
|
code: this.code,
|
|
@@ -76,13 +76,13 @@ export class EditNotebookTool implements AiTool<
|
|
|
76
76
|
EditNotebookInput,
|
|
77
77
|
ToolOutputBase
|
|
78
78
|
> {
|
|
79
|
-
readonly name = "edit_notebook_tool";
|
|
80
|
-
readonly description = description;
|
|
81
|
-
readonly schema = editNotebookSchema;
|
|
82
|
-
readonly outputSchema = toolOutputBaseSchema;
|
|
83
|
-
readonly mode: CopilotMode[] = ["agent"];
|
|
79
|
+
public readonly name = "edit_notebook_tool";
|
|
80
|
+
public readonly description = description;
|
|
81
|
+
public readonly schema = editNotebookSchema;
|
|
82
|
+
public readonly outputSchema = toolOutputBaseSchema;
|
|
83
|
+
public readonly mode: CopilotMode[] = ["agent"];
|
|
84
84
|
|
|
85
|
-
handler = async (
|
|
85
|
+
public handler = async (
|
|
86
86
|
{ edit }: EditNotebookInput,
|
|
87
87
|
toolContext: ToolNotebookContext,
|
|
88
88
|
): Promise<ToolOutputBase> => {
|
|
@@ -36,11 +36,11 @@ export class FrontendToolRegistry {
|
|
|
36
36
|
/** All registered tools */
|
|
37
37
|
private tools = new Map<string, StoredTool>();
|
|
38
38
|
|
|
39
|
-
constructor(tools: StoredTool[] = []) {
|
|
39
|
+
public constructor(tools: StoredTool[] = []) {
|
|
40
40
|
this.tools = new Map(tools.map((tool) => [tool.name, tool]));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
has(toolName: string) {
|
|
43
|
+
public has(toolName: string) {
|
|
44
44
|
return this.tools.has(toolName);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ export class FrontendToolRegistry {
|
|
|
52
52
|
return tool;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
async invoke<TName extends string>({
|
|
55
|
+
public async invoke<TName extends string>({
|
|
56
56
|
toolName,
|
|
57
57
|
rawArgs,
|
|
58
58
|
toolContext,
|
|
@@ -127,7 +127,7 @@ export class FrontendToolRegistry {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
@Memoize()
|
|
130
|
-
getToolSchemas(mode: CopilotMode): FrontendToolDefinition[] {
|
|
130
|
+
public getToolSchemas(mode: CopilotMode): FrontendToolDefinition[] {
|
|
131
131
|
const tools = [...this.tools.values()].filter((tool) =>
|
|
132
132
|
tool.mode.includes(mode),
|
|
133
133
|
);
|
|
@@ -54,10 +54,10 @@ export class RunStaleCellsTool implements AiTool<
|
|
|
54
54
|
EmptyToolInput,
|
|
55
55
|
RunStaleCellsOutput
|
|
56
56
|
> {
|
|
57
|
-
readonly name = "run_stale_cells_tool";
|
|
58
|
-
readonly description = description;
|
|
59
|
-
readonly schema = z.object({});
|
|
60
|
-
readonly outputSchema = toolOutputBaseSchema.extend({
|
|
57
|
+
public readonly name = "run_stale_cells_tool";
|
|
58
|
+
public readonly description = description;
|
|
59
|
+
public readonly schema = z.object({});
|
|
60
|
+
public readonly outputSchema = toolOutputBaseSchema.extend({
|
|
61
61
|
cellsToOutput: z
|
|
62
62
|
.record(
|
|
63
63
|
z.string(),
|
|
@@ -72,15 +72,15 @@ export class RunStaleCellsTool implements AiTool<
|
|
|
72
72
|
)
|
|
73
73
|
.optional(),
|
|
74
74
|
}) satisfies z.ZodType<RunStaleCellsOutput>;
|
|
75
|
-
readonly mode: CopilotMode[] = ["agent"];
|
|
75
|
+
public readonly mode: CopilotMode[] = ["agent"];
|
|
76
76
|
|
|
77
77
|
private readonly postExecutionDelay: number;
|
|
78
78
|
|
|
79
|
-
constructor(opts?: { postExecutionDelay?: number }) {
|
|
79
|
+
public constructor(opts?: { postExecutionDelay?: number }) {
|
|
80
80
|
this.postExecutionDelay = opts?.postExecutionDelay ?? POST_EXECUTION_DELAY;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
handler = async (
|
|
83
|
+
public handler = async (
|
|
84
84
|
_args: EmptyToolInput,
|
|
85
85
|
toolContext: ToolNotebookContext,
|
|
86
86
|
): Promise<RunStaleCellsOutput> => {
|
|
@@ -36,18 +36,18 @@ interface Output extends ToolOutputBase {
|
|
|
36
36
|
|
|
37
37
|
/** A sample frontend tool that demonstrates real tool output structure */
|
|
38
38
|
export class TestFrontendTool implements AiTool<Input, Output> {
|
|
39
|
-
readonly name = "test_frontend_tool";
|
|
40
|
-
readonly description = description;
|
|
41
|
-
readonly schema = z.object({ name: z.string() });
|
|
42
|
-
readonly outputSchema = toolOutputBaseSchema.extend({
|
|
39
|
+
public readonly name = "test_frontend_tool";
|
|
40
|
+
public readonly description = description;
|
|
41
|
+
public readonly schema = z.object({ name: z.string() });
|
|
42
|
+
public readonly outputSchema = toolOutputBaseSchema.extend({
|
|
43
43
|
data: z.object({
|
|
44
44
|
greeting: z.string(),
|
|
45
45
|
timestamp: z.string(),
|
|
46
46
|
}),
|
|
47
47
|
});
|
|
48
|
-
readonly mode: CopilotMode[] = ["ask"];
|
|
48
|
+
public readonly mode: CopilotMode[] = ["ask"];
|
|
49
49
|
|
|
50
|
-
async handler({ name }: Input): Promise<Output> {
|
|
50
|
+
public async handler({ name }: Input): Promise<Output> {
|
|
51
51
|
// Example: Validate input and throw ToolExecutionError on invalid data
|
|
52
52
|
if (!name.trim()) {
|
|
53
53
|
throw new ToolExecutionError(
|
|
@@ -1504,6 +1504,33 @@ describe("cell reducer", () => {
|
|
|
1504
1504
|
]);
|
|
1505
1505
|
});
|
|
1506
1506
|
|
|
1507
|
+
it("resolves password prompts without retaining the response", () => {
|
|
1508
|
+
const prompt: OutputMessage = {
|
|
1509
|
+
channel: "stdin",
|
|
1510
|
+
mimetype: "text/password",
|
|
1511
|
+
data: "Password: ",
|
|
1512
|
+
timestamp: 1,
|
|
1513
|
+
};
|
|
1514
|
+
actions.handleCellMessage({
|
|
1515
|
+
cell_id: firstCellId,
|
|
1516
|
+
output: undefined,
|
|
1517
|
+
console: prompt,
|
|
1518
|
+
status: "running",
|
|
1519
|
+
stale_inputs: null,
|
|
1520
|
+
timestamp: 1 as Seconds,
|
|
1521
|
+
});
|
|
1522
|
+
|
|
1523
|
+
const secret = "getpass-regression-secret";
|
|
1524
|
+
actions.setStdinResponse({
|
|
1525
|
+
cellId: firstCellId,
|
|
1526
|
+
outputIndex: 0,
|
|
1527
|
+
response: secret,
|
|
1528
|
+
});
|
|
1529
|
+
|
|
1530
|
+
expect(cells[0].consoleOutputs).toEqual([{ ...prompt, response: "" }]);
|
|
1531
|
+
expect(JSON.stringify(cells[0].consoleOutputs)).not.toContain(secret);
|
|
1532
|
+
});
|
|
1533
|
+
|
|
1507
1534
|
it("does not crash when setStdinResponse has out-of-bounds outputIndex", () => {
|
|
1508
1535
|
const STDOUT: OutputMessage = {
|
|
1509
1536
|
channel: "stdout",
|
package/src/core/cells/cells.ts
CHANGED
|
@@ -1114,7 +1114,8 @@ const {
|
|
|
1114
1114
|
mimetype: stdinOutput.mimetype,
|
|
1115
1115
|
data: stdinOutput.data,
|
|
1116
1116
|
timestamp: stdinOutput.timestamp,
|
|
1117
|
-
response
|
|
1117
|
+
// An empty response resolves the prompt without retaining the secret.
|
|
1118
|
+
response: stdinOutput.mimetype === "text/password" ? "" : response,
|
|
1118
1119
|
};
|
|
1119
1120
|
|
|
1120
1121
|
return {
|
|
@@ -48,9 +48,12 @@ function createLineDecoration(
|
|
|
48
48
|
|
|
49
49
|
class CurrentLineHighlighter implements PluginValue {
|
|
50
50
|
private unsubscribe: () => void;
|
|
51
|
-
decorations: DecorationSet;
|
|
51
|
+
public decorations: DecorationSet;
|
|
52
52
|
|
|
53
|
-
constructor(
|
|
53
|
+
public constructor(
|
|
54
|
+
view: EditorView,
|
|
55
|
+
lineObservable: Observable<number | null>,
|
|
56
|
+
) {
|
|
54
57
|
this.decorations = createLineDecoration(view.state, lineObservable.get());
|
|
55
58
|
this.unsubscribe = lineObservable.sub((line) => {
|
|
56
59
|
this.decorations = createLineDecoration(view.state, line);
|
|
@@ -59,11 +62,11 @@ class CurrentLineHighlighter implements PluginValue {
|
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
update(update: ViewUpdate) {
|
|
65
|
+
public update(update: ViewUpdate) {
|
|
63
66
|
this.decorations = this.decorations.map(update.changes);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
destroy() {
|
|
69
|
+
public destroy() {
|
|
67
70
|
this.unsubscribe();
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -88,7 +91,7 @@ export function debuggerLineHighlighter(
|
|
|
88
91
|
// --- Breakpoint gutter ------------------------------------------------------
|
|
89
92
|
|
|
90
93
|
class BreakpointMarker extends GutterMarker {
|
|
91
|
-
override toDOM() {
|
|
94
|
+
public override toDOM() {
|
|
92
95
|
const dot = document.createElement("div");
|
|
93
96
|
dot.className = "cm-breakpoint-marker";
|
|
94
97
|
return dot;
|
|
@@ -130,7 +133,10 @@ function buildBreakpointMarkers(state: EditorState): RangeSet<GutterMarker> {
|
|
|
130
133
|
class BreakpointSync implements PluginValue {
|
|
131
134
|
private unsubscribe: () => void;
|
|
132
135
|
|
|
133
|
-
constructor(
|
|
136
|
+
public constructor(
|
|
137
|
+
view: EditorView,
|
|
138
|
+
observable: Observable<ReadonlySet<number>>,
|
|
139
|
+
) {
|
|
134
140
|
const apply = (lines: ReadonlySet<number>) => {
|
|
135
141
|
view.dispatch({ effects: setBreakpointLines.of(lines) });
|
|
136
142
|
};
|
|
@@ -144,7 +150,7 @@ class BreakpointSync implements PluginValue {
|
|
|
144
150
|
this.unsubscribe = observable.sub(apply);
|
|
145
151
|
}
|
|
146
152
|
|
|
147
|
-
destroy() {
|
|
153
|
+
public destroy() {
|
|
148
154
|
this.unsubscribe();
|
|
149
155
|
}
|
|
150
156
|
}
|