michael-s-molina opened a new pull request, #41205: URL: https://github.com/apache/superset/pull/41205
### SUMMARY Implements the Chat contribution type described in [SIP-214](https://github.com/apache/superset/issues/41059), co-authored with Enzo Martellucci (@EnxDev). This introduces the `chat` and `navigation` namespaces in `@apache-superset/core`, giving extensions a first-class API to contribute a persistent chat interface and react to page navigation events. The host manages layout, open/close state, display mode, and persistence — extensions implement the trigger and panel components and use the API to drive behavior. These are the first two namespaces in a planned series. Surface-specific namespaces (dashboard, explore, SQL Lab, dataset) will follow in subsequent SIPs, allowing extensions to progressively access deeper contextual information. Agentic UI actions — modifying charts, editing queries, triggering workflows — are intentionally out of scope here and deferred to the Client Actions SIP. **Singleton model** Only one chat is active at a time. This is a deliberate design choice: rendering multiple chat providers simultaneously would create competing conversational experiences and introduce ambiguity for the user. Chat is treated as a deployment-level selection rather than a multi-provider composition. **Registering a chat** ```typescript import { chat } from '@apache-superset/core'; import ChatTrigger from './ChatTrigger'; import ChatPanel from './ChatPanel'; chat.registerChat( { id: 'my-org.my-chat', name: 'My Chat' }, ChatTrigger, ChatPanel, ); ``` The trigger is always visible in the bottom-right corner. The panel can be shown as a floating overlay or as a resizable sidebar docked beside the page content. The user's preference is persisted across reloads. **Display modes** - `'floating'` (default) — panel opens as an overlay anchored to the trigger. - `'panel'` — the page layout splits into content + chat sidebar with a draggable divider. Extensions can switch modes programmatically or react to user-initiated changes: ```typescript chat.setDisplayMode('panel'); chat.onDidChangeDisplayMode(mode => { console.log('display mode changed to', mode); }); ``` **Navigation awareness** The `navigation` namespace is new in `@apache-superset/core`. Extensions can query the current page or subscribe to page changes, enabling context-aware chat behavior: ```typescript import { navigation } from '@apache-superset/core'; console.log(navigation.getPage()); // e.g. 'dashboard', 'explore', 'sqllab' navigation.onDidChangePage(page => { console.log('navigated to', page); }); ``` **Documentation** The Contribution Types page and a new Chat reference page (under `docs/developer_docs/extensions/`) cover registration, display modes, the full open/close and event API, and the navigation namespace. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF https://github.com/user-attachments/assets/9c76b583-0407-471f-8c07-e34736dcfeb7 ### TESTING INSTRUCTIONS **Manual verification** Enable the `ENABLE_EXTENSIONS` feature flag, then create a minimal extension with the following `index.tsx`: ```tsx import React from 'react'; import { chat } from '@apache-superset/core'; const Trigger = () => { const handleClick = () => chat.isOpen() ? chat.close() : chat.open(); return <button onClick={handleClick}>💬</button>; }; const Panel = () => ( <div style={{ background: '#fff', height: '100%', padding: 16 }}> Hello from chat </div> ); chat.registerChat({ id: 'test.chat', name: 'Test Chat' }, Trigger, Panel); ``` ### ADDITIONAL INFORMATION - [ ] Has associated issue - [ ] Required feature flags: Chat host rendering is guarded by the existing `ENABLE_EXTENSIONS` flag - [x] Changes UI - [ ] Includes DB Migration - [x] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
