@luzmo/analytics-components-kit 1.0.3-beta.5 → 1.0.3-beta.7
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/components/ai-chat/ai-chat-request.d.ts +11 -0
- package/components/ai-chat/ai-chat.d.ts +72 -51
- package/components/ai-chat/ai-prompt-types.d.ts +93 -0
- package/components/ai-chat/empty-state/ai-chat-empty-state.d.ts +46 -0
- package/components/ai-chat/empty-state/index.d.ts +8 -0
- package/components/ai-chat/empty-state/types.d.ts +14 -0
- package/components/ai-chat/index.cjs +1 -1
- package/components/ai-chat/index.d.ts +11 -4
- package/components/ai-chat/index.js +2 -2
- package/components/ai-chat/session/ai-chat-session-controller.d.ts +51 -0
- package/components/ai-chat/session/ai-chat-session-types.d.ts +86 -0
- package/components/ai-chat/session/ai-chat-session.d.ts +81 -0
- package/components/ai-chat/session/index.d.ts +2 -0
- package/components/ai-chat/{ai-chat-streaming.d.ts → stream/ai-chat-streaming.d.ts} +6 -0
- package/components/ai-chat/stream/analyst-handler.d.ts +3 -0
- package/components/ai-chat/stream/dashboard-handler.d.ts +4 -0
- package/components/ai-chat/stream/index.d.ts +8 -0
- package/components/ai-chat/stream/item-handler.d.ts +2 -0
- package/components/ai-chat/stream/registry.d.ts +5 -0
- package/components/ai-chat/stream/shared.d.ts +10 -0
- package/components/ai-chat/stream/types.d.ts +26 -0
- package/components/ai-chat-BITPlYbm.cjs +178 -0
- package/components/ai-chat-D6fgbjA2.js +1861 -0
- package/components/ai-interaction-textarea/index.cjs +1 -1
- package/components/ai-interaction-textarea/index.js +1 -1
- package/components/{ai-interaction-textarea-BXmgedJt.js → ai-interaction-textarea-C1DMkiX9.js} +3 -3
- package/components/{ai-interaction-textarea-CogE101T.cjs → ai-interaction-textarea-wt2weV1c.cjs} +1 -1
- package/components/{base-BAzY-whv.js → base-D82dU2vv.js} +1 -1
- package/components/{base-CbpjVnVy.cjs → base-iNk9N4Tk.cjs} +1 -1
- package/components/data-field/index.cjs +1 -1
- package/components/data-field/index.js +1 -1
- package/components/{data-field-tfAMLb-d.js → data-field-2gH1_AhT.js} +3 -3
- package/components/{data-field-97uH3l6o.cjs → data-field-DDO-2ESu.cjs} +1 -1
- package/components/data-field-level/index.cjs +1 -1
- package/components/data-field-level/index.js +1 -1
- package/components/{data-field-level-BsDTHrJ6.js → data-field-level-2h8s8KK1.js} +1 -1
- package/components/{data-field-level-6npuFtQo.cjs → data-field-level-COl8ZWdN.cjs} +1 -1
- package/components/data-field-panel/index.cjs +1 -1
- package/components/data-field-panel/index.js +1 -1
- package/components/{data-field-panel-Dv5nfM0z.cjs → data-field-panel-CgfuCAp8.cjs} +1 -1
- package/components/{data-field-panel-P2t8d6sG.js → data-field-panel-P9QrDHMI.js} +3 -3
- package/components/data-fields-select/index.cjs +1 -1
- package/components/data-fields-select/index.js +1 -1
- package/components/{data-fields-select-DHnnYhbr.js → data-fields-select-1I8-Brdz.js} +1 -1
- package/components/{data-fields-select-B7vJTdZO.cjs → data-fields-select-Cudq0iLk.cjs} +1 -1
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +1 -1
- package/components/{dataset-selector-list-DbCmavOc.cjs → dataset-selector-list-BxGYITHM.cjs} +1 -1
- package/components/{dataset-selector-list-CXnDkIe2.js → dataset-selector-list-DmbQl9uz.js} +1 -1
- package/components/dataset-selector-row/index.cjs +1 -1
- package/components/dataset-selector-row/index.js +1 -1
- package/components/{dataset-selector-row-Bm60zTbF.cjs → dataset-selector-row-BgGa4uFN.cjs} +1 -1
- package/components/{dataset-selector-row-BONcmdL2.js → dataset-selector-row-CaTsyi1d.js} +1 -1
- package/components/{de-DMnvmNFg.js → de-DFS1MvFY.js} +6 -1
- package/components/de-DWpyMlmz.cjs +20 -0
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +1 -1
- package/components/{display-settings-BLf7lBww.cjs → display-settings-Bfz2tg_G.cjs} +1 -1
- package/components/{display-settings-BLMrlvMS.js → display-settings-DWoUj0P7.js} +1 -1
- package/components/display-settings-binning/index.cjs +1 -1
- package/components/display-settings-binning/index.js +1 -1
- package/components/{display-settings-binning-hCJ0qkt5.js → display-settings-binning-BIBzOWZA.js} +2 -2
- package/components/{display-settings-binning-BAg6FoqJ.cjs → display-settings-binning-Cf1QlQy6.cjs} +1 -1
- package/components/display-settings-datetime/index.cjs +1 -1
- package/components/display-settings-datetime/index.js +1 -1
- package/components/{display-settings-datetime-BzeNlKLC.cjs → display-settings-datetime-C76Et2ED.cjs} +1 -1
- package/components/{display-settings-datetime-CCxok7d7.js → display-settings-datetime-DGlj31eD.js} +2 -2
- package/components/display-settings-grand-totals/index.cjs +1 -1
- package/components/display-settings-grand-totals/index.js +1 -1
- package/components/{display-settings-grand-totals-HDpr3IJ5.cjs → display-settings-grand-totals-By98iKXS.cjs} +1 -1
- package/components/{display-settings-grand-totals-C1N1cehl.js → display-settings-grand-totals-ZWO02WXj.js} +2 -2
- package/components/display-settings-numeric/index.cjs +1 -1
- package/components/display-settings-numeric/index.js +1 -1
- package/components/{display-settings-numeric-DSs20wUu.cjs → display-settings-numeric-BPKl9ljn.cjs} +1 -1
- package/components/{display-settings-numeric-oyCfBAGV.js → display-settings-numeric-DHvjUxmC.js} +2 -2
- package/components/display-settings-period-over-period/index.cjs +1 -1
- package/components/display-settings-period-over-period/index.js +1 -1
- package/components/{display-settings-period-over-period-h8bA3V5C.js → display-settings-period-over-period-CPsfL-OC.js} +2 -2
- package/components/{display-settings-period-over-period-CcX7vQnt.cjs → display-settings-period-over-period-CYwa8_dX.cjs} +1 -1
- package/components/es-Bm4nseZH.cjs +20 -0
- package/components/{es-Cc258uTs.js → es-C1prodbH.js} +6 -1
- package/components/filter-expression-picker/index.cjs +1 -1
- package/components/filter-expression-picker/index.js +1 -1
- package/components/{filter-expression-picker-BMJkgHu9.cjs → filter-expression-picker-CJB_jgcc.cjs} +1 -1
- package/components/{filter-expression-picker-DQP5lkn4.js → filter-expression-picker-DbIwoTsX.js} +1 -1
- package/components/filter-item/index.cjs +1 -1
- package/components/filter-item/index.js +1 -1
- package/components/{filter-item-BXcYNAAm.js → filter-item-BGtJwvjk.js} +4 -4
- package/components/{filter-item-D9m378Qo.cjs → filter-item-as8Ocmp3.cjs} +1 -1
- package/components/filter-value-picker/index.cjs +1 -1
- package/components/filter-value-picker/index.js +1 -1
- package/components/{filter-value-picker-YIkbsWDP.cjs → filter-value-picker-BL-1pN_G.cjs} +1 -1
- package/components/{filter-value-picker-B-dzcjEo.js → filter-value-picker-BrYCGFst.js} +4 -4
- package/components/filter-value-picker-datetime/index.cjs +1 -1
- package/components/filter-value-picker-datetime/index.js +1 -1
- package/components/{filter-value-picker-datetime-BJMcnoKH.js → filter-value-picker-datetime-BPtF1l_J.js} +1 -1
- package/components/{filter-value-picker-datetime-BrrmcjIE.cjs → filter-value-picker-datetime-wXHf2Ybs.cjs} +1 -1
- package/components/filter-value-picker-hierarchy/index.cjs +1 -1
- package/components/filter-value-picker-hierarchy/index.js +1 -1
- package/components/{filter-value-picker-hierarchy-UdDq0CZG.js → filter-value-picker-hierarchy-CDhpfB2Y.js} +2 -2
- package/components/{filter-value-picker-hierarchy-B9gDxYna.cjs → filter-value-picker-hierarchy-Cmw2p2K6.cjs} +1 -1
- package/components/filter-value-picker-numeric/index.cjs +1 -1
- package/components/filter-value-picker-numeric/index.js +1 -1
- package/components/{filter-value-picker-numeric-EK515Z-Y.js → filter-value-picker-numeric-BEvT5oKu.js} +1 -1
- package/components/{filter-value-picker-numeric-D_dgITCq.cjs → filter-value-picker-numeric-UwkCyHGV.cjs} +1 -1
- package/components/filters/index.cjs +1 -1
- package/components/filters/index.js +1 -1
- package/components/{filters-8ehwgopC.cjs → filters-DdB5-4Db.cjs} +1 -1
- package/components/{filters-H2scDNLi.js → filters-ltvxQR-K.js} +2 -2
- package/components/{fr-B32d4zcX.js → fr-BMYUCp2R.js} +6 -1
- package/components/fr-BPTbVsj0.cjs +20 -0
- package/components/{get-dataset-name-7FdLQo10.js → get-dataset-name-BfFHT__k.js} +1 -1
- package/components/{get-dataset-name-CrWWViwN.cjs → get-dataset-name-Cl6mPSex.cjs} +1 -1
- package/components/index.cjs +1 -1
- package/components/index.js +58 -58
- package/components/item-grid/helpers/grid-item-popover.d.ts +7 -1
- package/components/item-grid/helpers/grid-rendering.d.ts +7 -1
- package/components/item-grid/index.cjs +1 -1
- package/components/item-grid/index.js +1 -1
- package/components/item-grid/item-grid.d.ts +8 -0
- package/components/{item-grid-CxblVEy3.cjs → item-grid-DR36E_MC.cjs} +7 -7
- package/components/{item-grid-B-IFwriA.js → item-grid-Q0Ggl_US.js} +574 -564
- package/components/item-option/index.cjs +1 -1
- package/components/item-option/index.js +1 -1
- package/components/{item-option-ChsD18x9.cjs → item-option-CbvYq_WJ.cjs} +1 -1
- package/components/{item-option-Buxnv89s.js → item-option-DI3KO7QY.js} +1 -1
- package/components/item-option-action-button-group/index.cjs +1 -1
- package/components/item-option-action-button-group/index.js +1 -1
- package/components/{item-option-action-button-group-Cw9EDbG-.cjs → item-option-action-button-group-BnMVlPWX.cjs} +1 -1
- package/components/{item-option-action-button-group-QO_darH9.js → item-option-action-button-group-D6IwxNDf.js} +1 -1
- package/components/{item-option-base-DjQ5poaH.cjs → item-option-base-CKQPWveC.cjs} +1 -1
- package/components/{item-option-base-DMmga0dv.js → item-option-base-DH5wKqEF.js} +1 -1
- package/components/item-option-color-palette-picker/index.cjs +1 -1
- package/components/item-option-color-palette-picker/index.js +1 -1
- package/components/{item-option-color-palette-picker-gZvk4ODA.cjs → item-option-color-palette-picker-h-3xHsR4.cjs} +1 -1
- package/components/{item-option-color-palette-picker-CiE_aWRI.js → item-option-color-palette-picker-n_OxJNd9.js} +1 -1
- package/components/item-option-color-picker/index.cjs +1 -1
- package/components/item-option-color-picker/index.js +1 -1
- package/components/{item-option-color-picker-CUskqN3R.js → item-option-color-picker-C1x5vS5d.js} +1 -1
- package/components/{item-option-color-picker-DCnGqBgT.cjs → item-option-color-picker-C6LZkkBG.cjs} +1 -1
- package/components/item-option-color-range/index.cjs +1 -1
- package/components/item-option-color-range/index.js +1 -1
- package/components/{item-option-color-range-BgHXTDvx.js → item-option-color-range-B2jermJT.js} +1 -1
- package/components/{item-option-color-range-B24EAbUi.cjs → item-option-color-range-DBiG8jhK.cjs} +1 -1
- package/components/item-option-multi-language-field/index.cjs +1 -1
- package/components/item-option-multi-language-field/index.js +1 -1
- package/components/{item-option-multi-language-field-qngZBXHT.js → item-option-multi-language-field-BmJY3dG0.js} +1 -1
- package/components/{item-option-multi-language-field-DDIu7Hns.cjs → item-option-multi-language-field-DDeFZMwX.cjs} +1 -1
- package/components/item-option-number-field/index.cjs +1 -1
- package/components/item-option-number-field/index.js +1 -1
- package/components/{item-option-number-field-Cd-cfpaq.js → item-option-number-field-B5ed4vvs.js} +1 -1
- package/components/{item-option-number-field-CqrO1Xu0.cjs → item-option-number-field-BJo-SKQB.cjs} +1 -1
- package/components/item-option-panel/index.cjs +1 -1
- package/components/item-option-panel/index.js +1 -1
- package/components/{item-option-panel-DZiOx_sn.js → item-option-panel-B8BKxNPg.js} +2 -2
- package/components/{item-option-panel-B26_sDcj.cjs → item-option-panel-Dm34avUG.cjs} +1 -1
- package/components/item-option-picker/index.cjs +1 -1
- package/components/item-option-picker/index.js +1 -1
- package/components/{item-option-picker-LRahjZUz.js → item-option-picker-C8evzSOb.js} +1 -1
- package/components/{item-option-picker-B86AqAWp.cjs → item-option-picker-DlbKU1wY.cjs} +1 -1
- package/components/item-option-position-picker/index.cjs +1 -1
- package/components/item-option-position-picker/index.js +1 -1
- package/components/{item-option-position-picker-NUpUlyPV.js → item-option-position-picker-Bue5o0fT.js} +1 -1
- package/components/{item-option-position-picker-Cbi2OygH.cjs → item-option-position-picker-CB4Y0Z6D.cjs} +1 -1
- package/components/item-option-positions-number-field/index.cjs +1 -1
- package/components/item-option-positions-number-field/index.js +1 -1
- package/components/{item-option-positions-number-field-BbIkX6wM.cjs → item-option-positions-number-field-Bbru1yNj.cjs} +1 -1
- package/components/{item-option-positions-number-field-ClPil6MM.js → item-option-positions-number-field-CdK1WdMx.js} +1 -1
- package/components/item-option-radio-button-group/index.cjs +1 -1
- package/components/item-option-radio-button-group/index.js +1 -1
- package/components/{item-option-radio-button-group-BtYYhQyI.cjs → item-option-radio-button-group-BCiDl5wB.cjs} +1 -1
- package/components/{item-option-radio-button-group-Bdd9sU4p.js → item-option-radio-button-group-BlQxNUIM.js} +1 -1
- package/components/item-option-slider/index.cjs +1 -1
- package/components/item-option-slider/index.js +1 -1
- package/components/{item-option-slider-BJ7gVQXP.js → item-option-slider-CX8XWUEP.js} +1 -1
- package/components/{item-option-slider-32oGS1fd.cjs → item-option-slider-Db-HdZ9C.cjs} +1 -1
- package/components/item-option-switch/index.cjs +1 -1
- package/components/item-option-switch/index.js +1 -1
- package/components/{item-option-switch-BMVlfdx5.js → item-option-switch-1wVCBJpo.js} +1 -1
- package/components/{item-option-switch-BFk3biK9.cjs → item-option-switch-BI0b6qMP.cjs} +1 -1
- package/components/item-option-text-field/index.cjs +1 -1
- package/components/item-option-text-field/index.js +1 -1
- package/components/{item-option-text-field-CWvgQ3pJ.cjs → item-option-text-field-Cuo1cBWG.cjs} +1 -1
- package/components/{item-option-text-field-BoXwVo-B.js → item-option-text-field-c8PsVNYB.js} +1 -1
- package/components/item-slot-drop/index.cjs +1 -1
- package/components/item-slot-drop/index.js +1 -1
- package/components/{item-slot-drop-CYRVCWF0.cjs → item-slot-drop-2SpLWjPC.cjs} +1 -1
- package/components/{item-slot-drop-C0GmOMQY.js → item-slot-drop-Cpf4DnI4.js} +4 -4
- package/components/item-slot-drop-panel/index.cjs +1 -1
- package/components/item-slot-drop-panel/index.js +1 -1
- package/components/{item-slot-drop-panel-Ci3Soo16.js → item-slot-drop-panel-C77wRsvJ.js} +3 -3
- package/components/{item-slot-drop-panel-CoRFds3a.cjs → item-slot-drop-panel-ClEOXFHz.cjs} +1 -1
- package/components/item-slot-picker/index.cjs +1 -1
- package/components/item-slot-picker/index.js +1 -1
- package/components/{item-slot-picker-D1_NbL1A.js → item-slot-picker-BEPRIyMJ.js} +5 -5
- package/components/{item-slot-picker-CmnJSYIF.cjs → item-slot-picker-B_l4VnV_.cjs} +1 -1
- package/components/item-slot-picker-panel/index.cjs +1 -1
- package/components/item-slot-picker-panel/index.js +1 -1
- package/components/{item-slot-picker-panel-B8VvKhRF.js → item-slot-picker-panel-B4tCFh38.js} +3 -3
- package/components/{item-slot-picker-panel-DzKodYTM.cjs → item-slot-picker-panel-BCzV9MAV.cjs} +1 -1
- package/components/{localized-mixin-Dujo7nlJ.cjs → localized-mixin-AEA3w4H0.cjs} +1 -1
- package/components/{localized-mixin-DZuGq2Fm.js → localized-mixin-XqTi4F7d.js} +1 -1
- package/components/nl-BE6MZtti.cjs +20 -0
- package/components/{nl-hCQgb1fB.js → nl-DzdJmn0w.js} +6 -1
- package/components/{set-locale-CXnxhP_B.js → set-locale-B8CaHx6q.js} +4 -4
- package/components/{set-locale-MCuEsOOu.cjs → set-locale-CFD7fxS3.cjs} +1 -1
- package/components/slot-menu/index.cjs +1 -1
- package/components/slot-menu/index.js +1 -1
- package/components/{slot-menu-CDAAPyFj.cjs → slot-menu-C8446xNy.cjs} +1 -1
- package/components/{slot-menu-CYNYwJnU.js → slot-menu-DuJRaqmC.js} +3 -3
- package/components/slot-menu-list/index.cjs +1 -1
- package/components/slot-menu-list/index.js +1 -1
- package/components/{slot-menu-list-DbWiuJDF.cjs → slot-menu-list-B6A6w2d9.cjs} +1 -1
- package/components/{slot-menu-list-DL-x5Ggl.js → slot-menu-list-Zzwr6h1J.js} +1 -1
- package/components/utils/base.cjs +1 -1
- package/components/utils/base.js +2 -2
- package/components/{utils-DKSE_5u1.cjs → utils-1SB0pExj.cjs} +1 -1
- package/components/{utils-BACUV6sE.js → utils-sAvG9cHu.js} +1 -1
- package/components/utils.cjs +1 -1
- package/components/utils.js +2 -2
- package/components/viz-item-menu/index.cjs +1 -1
- package/components/viz-item-menu/index.js +1 -1
- package/components/{viz-item-menu-yr7TQY8-.cjs → viz-item-menu-B4mavjZ5.cjs} +1 -1
- package/components/{viz-item-menu-DXoKwAhV.js → viz-item-menu-CEcwbasZ.js} +1 -1
- package/custom-elements.json +1743 -156
- package/package.json +1 -1
- package/react/components/ai-chat/empty-state/index.ts +1 -0
- package/react/components/ai-chat/empty-state/types.ts +16 -0
- package/react/components/ai-chat/stream/index.ts +1 -0
- package/react/components/ai-chat/stream/types.ts +29 -0
- package/react/components/ai-chat.component.ts +12 -12
- package/react/esm/components/ai-chat/empty-state/index.d.ts +1 -0
- package/react/esm/components/ai-chat/empty-state/index.js +1 -0
- package/react/esm/components/ai-chat/empty-state/types.d.ts +14 -0
- package/react/esm/components/ai-chat/empty-state/types.js +1 -0
- package/react/esm/components/ai-chat/stream/index.d.ts +1 -0
- package/react/esm/components/ai-chat/stream/index.js +1 -0
- package/react/esm/components/ai-chat/stream/types.d.ts +26 -0
- package/react/esm/components/ai-chat/stream/types.js +1 -0
- package/react/esm/components/ai-chat.component.d.ts +8 -8
- package/react/esm/components/ai-chat.component.js +8 -8
- package/types/ai-chat.types.d.ts +1 -1
- package/components/ai-chat/request-contract.d.ts +0 -56
- package/components/ai-chat-D9yB7Sw_.cjs +0 -151
- package/components/ai-chat-DkfD3BDG.js +0 -1258
- package/components/de-B8ds_DbE.cjs +0 -20
- package/components/es-DGC51Dm9.cjs +0 -20
- package/components/fr-BoZFY3Qe.cjs +0 -20
- package/components/nl-C9Ad2LdA.cjs +0 -20
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LuzmoChart } from '../../types';
|
|
2
|
+
import type { AiPromptAgent, AiPromptCreateBody, AiPromptDeleteBody, AiPromptProperties, BuildAiPromptRequestContext } from './ai-prompt-types';
|
|
3
|
+
export type { AiPromptAgent, AiPromptCreateBody, AiPromptDeleteBody, AiPromptInput, AiPromptItemTask, AiPromptProperties, AiPromptScreenMode, BuildAiPromptRequestContext, DashboardStatePayload, LuzmoDashboardGeneratedEventDetail, LuzmoPromptSubmittedEventDetail, LuzmoRestoreRequestedEventDetail } from './ai-prompt-types';
|
|
4
|
+
export declare function getAiPromptUrl(apiUrl: string, apiVersion: string): string;
|
|
5
|
+
export declare function chartToItemAsset(chart: LuzmoChart): Record<string, unknown> | null;
|
|
6
|
+
export declare function buildItemAiPromptProperties(ctx: BuildAiPromptRequestContext): AiPromptProperties;
|
|
7
|
+
export declare function buildDashboardAiPromptProperties(ctx: BuildAiPromptRequestContext): AiPromptProperties;
|
|
8
|
+
export declare function buildAnalystAiPromptProperties(ctx: BuildAiPromptRequestContext): AiPromptProperties;
|
|
9
|
+
export declare function buildAiPromptProperties(agent: AiPromptAgent, ctx: BuildAiPromptRequestContext): AiPromptProperties;
|
|
10
|
+
export declare function buildAiPromptRequest(agent: AiPromptAgent, ctx: BuildAiPromptRequestContext): AiPromptCreateBody;
|
|
11
|
+
export declare function buildAiPromptDeleteRequest(restoreToMessageId: string, authKey: string, authToken: string, apiVersion?: string, conversationId?: string | null): AiPromptDeleteBody;
|
|
@@ -2,19 +2,26 @@ import '@luzmo/lucero/chat-message';
|
|
|
2
2
|
import '@luzmo/lucero/overlay';
|
|
3
3
|
import '@luzmo/lucero/popover';
|
|
4
4
|
import '@luzmo/lucero/progress-steps';
|
|
5
|
-
import type { ProgressTreeNode } from '@luzmo/lucero/progress-steps';
|
|
6
5
|
import { LuzmoElement } from '@utils/base';
|
|
7
6
|
import { TemplateResult } from 'lit';
|
|
8
7
|
import type { ChatMessage, Dataset, LuzmoChart } from '../../types';
|
|
9
8
|
import '../ai-interaction-textarea';
|
|
9
|
+
import './empty-state';
|
|
10
|
+
import type { AiChatEmptyStateSuggestion } from './empty-state';
|
|
11
|
+
import type { AiChatSession } from './session/ai-chat-session';
|
|
12
|
+
import type { AiPromptAgent, AiPromptItemTask, AiPromptScreenMode, DashboardStatePayload } from './ai-prompt-types';
|
|
10
13
|
/**
|
|
11
14
|
* @customElement luzmo-ai-chat
|
|
12
|
-
* @summary
|
|
15
|
+
* @summary AI chat UI backed by AiChatSession for transcript, datasets, and streaming.
|
|
16
|
+
* @description Chat state lives in an AiChatSession. By default the element creates an internal
|
|
17
|
+
* session from auth, agent, and chart or dashboard props; optional messages and selected-datasets
|
|
18
|
+
* seed it once on connect. Pass .chatSession for a host-owned session (e.g. dashboard editor).
|
|
19
|
+
* See {@link AiChatSession} / createAiChatSession for callbacks and external fetchStreaming.
|
|
13
20
|
* @fires luzmo-message-sent - Fired when a user sends a message
|
|
14
|
-
* @fires luzmo-prompt-submitted - Fired when request-mode is set to external so the host can execute the API request lifecycle.
|
|
15
21
|
* @fires luzmo-response-received - Fired when an AI text response is received. For chart responses, this event is only fired if the response includes a `message` field. For error responses, this event is always fired with the error explanation.
|
|
16
|
-
* @fires luzmo-chart-generated - Fired when
|
|
17
|
-
* @fires luzmo-
|
|
22
|
+
* @fires luzmo-chart-generated - Fired when agent is `item` and a chart asset is ready
|
|
23
|
+
* @fires luzmo-dashboard-generated - Fired when agent is `dashboard` and a dashboard asset is ready
|
|
24
|
+
* @fires luzmo-conversation-id-changed - Fired when the conversation ID is updated from the API
|
|
18
25
|
*
|
|
19
26
|
* @property {string} --luzmo-ai-chat-background - Background of the chat container
|
|
20
27
|
* @property {string} --luzmo-ai-chat-border-radius - Border radius of the chat container
|
|
@@ -46,11 +53,11 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
46
53
|
static styles: import("lit").CSSResult;
|
|
47
54
|
static tagName: string;
|
|
48
55
|
/**
|
|
49
|
-
*
|
|
56
|
+
* Live transcript is {@link AiChatSession.state.messages}. This prop optionally seeds the session on first connect.
|
|
50
57
|
*/
|
|
51
58
|
messages: ChatMessage[];
|
|
52
59
|
/**
|
|
53
|
-
*
|
|
60
|
+
* Live selection is in the session. This prop optionally seeds on first connect.
|
|
54
61
|
*/
|
|
55
62
|
selectedDatasets: Dataset[];
|
|
56
63
|
/**
|
|
@@ -112,30 +119,52 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
112
119
|
*/
|
|
113
120
|
requireDataset: boolean;
|
|
114
121
|
/**
|
|
115
|
-
*
|
|
116
|
-
* @default '
|
|
122
|
+
* Which aiprompt agent to use. Determines request payload and stream handling.
|
|
123
|
+
* @default 'item'
|
|
117
124
|
*/
|
|
118
|
-
|
|
125
|
+
agent: AiPromptAgent;
|
|
119
126
|
/**
|
|
120
|
-
*
|
|
121
|
-
* @default '
|
|
127
|
+
* Task for the item agent (`generate`, `suggest`, `describe`).
|
|
128
|
+
* @default 'generate'
|
|
122
129
|
*/
|
|
123
|
-
|
|
130
|
+
task: AiPromptItemTask;
|
|
124
131
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @default
|
|
132
|
+
* AI model preference for item agent chart generation
|
|
133
|
+
* @default 'performance'
|
|
127
134
|
*/
|
|
128
|
-
|
|
135
|
+
modelPreference: 'performance' | 'quality';
|
|
129
136
|
/**
|
|
130
|
-
*
|
|
137
|
+
* Host-owned {@link AiChatSession}. The component subscribes and renders; does not abort on disconnect.
|
|
138
|
+
*/
|
|
139
|
+
chatSession: AiChatSession | null;
|
|
140
|
+
/**
|
|
141
|
+
* Conversation ID (synced into the session; updated when the API returns a new id).
|
|
131
142
|
* @default null
|
|
132
143
|
*/
|
|
133
144
|
conversationId: string | null;
|
|
134
145
|
/**
|
|
135
|
-
*
|
|
146
|
+
* Chart context for `agent="item"`.
|
|
136
147
|
* @default null
|
|
137
148
|
*/
|
|
138
149
|
chart: LuzmoChart | null;
|
|
150
|
+
/**
|
|
151
|
+
* Dashboard context for `agent="dashboard"`.
|
|
152
|
+
* @default null
|
|
153
|
+
*/
|
|
154
|
+
dashboard: DashboardStatePayload | null;
|
|
155
|
+
/**
|
|
156
|
+
* Current screen mode when editing a dashboard.
|
|
157
|
+
*/
|
|
158
|
+
currentScreenMode?: AiPromptScreenMode;
|
|
159
|
+
/**
|
|
160
|
+
* Locale ID sent to the aiprompt API.
|
|
161
|
+
*/
|
|
162
|
+
localeId?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Timezone ID for dashboard agent requests.
|
|
165
|
+
* @default 'UTC'
|
|
166
|
+
*/
|
|
167
|
+
timezoneId: string;
|
|
139
168
|
/**
|
|
140
169
|
* API version
|
|
141
170
|
* @default '0.1.0'
|
|
@@ -149,59 +178,51 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
149
178
|
stream: boolean;
|
|
150
179
|
/**
|
|
151
180
|
* Loading message shown while generating and before progress steps are available.
|
|
152
|
-
* Only effective in external request mode; in internal mode, progress steps
|
|
153
|
-
* are initialized immediately.
|
|
154
181
|
* @default null
|
|
155
182
|
*/
|
|
156
183
|
loadingMessage: string | null;
|
|
157
184
|
/**
|
|
158
|
-
* When set,
|
|
159
|
-
*
|
|
160
|
-
* Useful when the prompt originates from an external source (e.g. a dropdown).
|
|
185
|
+
* When set, auto-submits via the session without adding a duplicate user message
|
|
186
|
+
* (assumes the prompt is already in the transcript).
|
|
161
187
|
* @default null
|
|
162
188
|
*/
|
|
163
189
|
initialPrompt: string | null;
|
|
164
190
|
/**
|
|
165
|
-
*
|
|
166
|
-
|
|
191
|
+
* Title for the empty state when there are no messages.
|
|
192
|
+
*/
|
|
193
|
+
emptyStateTitle: string;
|
|
194
|
+
/**
|
|
195
|
+
* Optional label above empty-state suggestion chips. Only shown when `emptyStateSuggestions` is non-empty.
|
|
167
196
|
*/
|
|
168
|
-
|
|
197
|
+
emptyStateSubtitle: string;
|
|
169
198
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* @default false
|
|
199
|
+
* Optional suggestion chips for the empty state. When empty, only the title is shown.
|
|
200
|
+
* Each entry may include `selectedDatasets` to pre-select datasets when the chip is activated.
|
|
173
201
|
*/
|
|
174
|
-
|
|
175
|
-
private _progress;
|
|
176
|
-
private _progressCollapsed;
|
|
177
|
-
private _isGeneratingInternal;
|
|
202
|
+
emptyStateSuggestions: AiChatEmptyStateSuggestion[];
|
|
178
203
|
private _textareaValue;
|
|
179
|
-
private _abortController;
|
|
180
|
-
private _inflightAiMessage;
|
|
181
204
|
private _lastProcessedInitialPrompt;
|
|
182
|
-
private
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
private
|
|
186
|
-
private
|
|
187
|
-
private
|
|
188
|
-
private
|
|
189
|
-
private
|
|
190
|
-
private _updateMessage;
|
|
191
|
-
private _truncateMessagesAfterRestore;
|
|
192
|
-
private _restoreInternal;
|
|
205
|
+
private readonly _session;
|
|
206
|
+
/** Active {@link AiChatSession} (host or auto-created). Null until first bind or action. */
|
|
207
|
+
get session(): AiChatSession | null;
|
|
208
|
+
private _getRenderState;
|
|
209
|
+
private _createDomBridgeCallbacks;
|
|
210
|
+
private _buildSessionConfig;
|
|
211
|
+
private _emitConversationIdChanged;
|
|
212
|
+
private _restoreViaSession;
|
|
193
213
|
private _handleRestoreState;
|
|
194
|
-
private _prepareForAIResponse;
|
|
195
|
-
private _handleAPIError;
|
|
196
214
|
private _handleDatasetSelected;
|
|
197
215
|
private _handleDatasetRemoved;
|
|
198
|
-
private
|
|
199
|
-
private _isDatasetRequirementMet;
|
|
216
|
+
private _submitViaSession;
|
|
200
217
|
private _handlePromptSubmitted;
|
|
218
|
+
private _handleEmptyStateSuggestionSelected;
|
|
201
219
|
private _processInitialPrompt;
|
|
220
|
+
connectedCallback(): void;
|
|
202
221
|
disconnectedCallback(): void;
|
|
203
222
|
private _scrollToBottom;
|
|
204
223
|
protected updated(changedProperties: Map<string, unknown>): void;
|
|
224
|
+
private _syncSession;
|
|
225
|
+
private _handleInitialPromptChange;
|
|
205
226
|
/**
|
|
206
227
|
* Sanitizes HTML content to prevent XSS attacks while preserving safe formatting
|
|
207
228
|
* @param htmlContent - The HTML string to sanitize
|
|
@@ -214,6 +235,6 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
214
235
|
private _renderMessages;
|
|
215
236
|
private _renderStreamingResponse;
|
|
216
237
|
private _renderLoadingMessage;
|
|
217
|
-
private
|
|
238
|
+
private _renderEmptyState;
|
|
218
239
|
protected render(): TemplateResult;
|
|
219
240
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Dataset, LuzmoChart } from '../../types';
|
|
2
|
+
export type AiPromptAgent = 'item' | 'dashboard' | 'analyst';
|
|
3
|
+
export type AiPromptItemTask = 'generate' | 'suggest' | 'describe';
|
|
4
|
+
export type AiPromptScreenMode = 'desktop' | 'tablet' | 'mobile';
|
|
5
|
+
/** Dashboard payload for `agent: 'dashboard'` input (views, syncScreenModes, optional theme). */
|
|
6
|
+
export interface DashboardStatePayload {
|
|
7
|
+
views: unknown[];
|
|
8
|
+
syncScreenModes?: boolean;
|
|
9
|
+
theme?: Record<string, unknown>;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface AiPromptTextInput {
|
|
13
|
+
type: 'text';
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AiPromptDatasetInput {
|
|
17
|
+
type: 'dataset';
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AiPromptItemInput {
|
|
21
|
+
type: 'item';
|
|
22
|
+
value: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface AiPromptDashboardInput {
|
|
25
|
+
type: 'dashboard';
|
|
26
|
+
value: DashboardStatePayload;
|
|
27
|
+
current_screen_mode?: AiPromptScreenMode;
|
|
28
|
+
}
|
|
29
|
+
export type AiPromptInput = AiPromptTextInput | AiPromptDatasetInput | AiPromptItemInput | AiPromptDashboardInput;
|
|
30
|
+
export interface AiPromptProperties {
|
|
31
|
+
agent: AiPromptAgent;
|
|
32
|
+
task: AiPromptItemTask | 'generate';
|
|
33
|
+
conversation_id?: string;
|
|
34
|
+
locale_id?: string;
|
|
35
|
+
timezone_id?: string;
|
|
36
|
+
stream: boolean;
|
|
37
|
+
response_mode: 'mixed';
|
|
38
|
+
input: AiPromptInput[];
|
|
39
|
+
}
|
|
40
|
+
export interface AiPromptCreateBody {
|
|
41
|
+
key: string;
|
|
42
|
+
token: string;
|
|
43
|
+
action: 'create';
|
|
44
|
+
version: string;
|
|
45
|
+
properties: AiPromptProperties;
|
|
46
|
+
}
|
|
47
|
+
export interface AiPromptDeleteBody {
|
|
48
|
+
key: string;
|
|
49
|
+
token: string;
|
|
50
|
+
action: 'delete';
|
|
51
|
+
version: string;
|
|
52
|
+
properties: {
|
|
53
|
+
agent: 'item';
|
|
54
|
+
restore_to_message_id: string;
|
|
55
|
+
conversation_id?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface BuildAiPromptRequestContext {
|
|
59
|
+
prompt: string;
|
|
60
|
+
datasetIds: string[];
|
|
61
|
+
authKey: string;
|
|
62
|
+
authToken: string;
|
|
63
|
+
conversationId: string | null;
|
|
64
|
+
apiVersion?: string;
|
|
65
|
+
stream?: boolean;
|
|
66
|
+
localeId?: string;
|
|
67
|
+
timezoneId?: string;
|
|
68
|
+
/** Session/UI preference only; not serialized on aiprompt create until the backend supports it. */
|
|
69
|
+
modelPreference?: 'performance' | 'quality';
|
|
70
|
+
chart?: LuzmoChart | null;
|
|
71
|
+
dashboard?: DashboardStatePayload | null;
|
|
72
|
+
currentScreenMode?: AiPromptScreenMode;
|
|
73
|
+
task?: AiPromptItemTask;
|
|
74
|
+
}
|
|
75
|
+
export interface LuzmoPromptSubmittedEventDetail {
|
|
76
|
+
prompt: string;
|
|
77
|
+
selectedDatasets: Dataset[];
|
|
78
|
+
datasetIds: string[];
|
|
79
|
+
agent: AiPromptAgent;
|
|
80
|
+
request: AiPromptCreateBody;
|
|
81
|
+
url: string;
|
|
82
|
+
}
|
|
83
|
+
export interface LuzmoRestoreRequestedEventDetail {
|
|
84
|
+
apiMessageId: string;
|
|
85
|
+
messageIndex: number;
|
|
86
|
+
request: AiPromptDeleteBody;
|
|
87
|
+
url: string;
|
|
88
|
+
}
|
|
89
|
+
export interface LuzmoDashboardGeneratedEventDetail {
|
|
90
|
+
dashboard: DashboardStatePayload;
|
|
91
|
+
conversationId: string | null;
|
|
92
|
+
name?: Record<string, string>;
|
|
93
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import '@luzmo/lucero/suggestion';
|
|
2
|
+
import { LuzmoElement } from '@utils/base';
|
|
3
|
+
import { type TemplateResult } from 'lit';
|
|
4
|
+
import type { AiChatEmptyStateSuggestion } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* @customElement luzmo-ai-chat-empty-state
|
|
7
|
+
* @summary Empty state for AI chat with title, subtitle, and prompt suggestions.
|
|
8
|
+
* @fires luzmo-suggestion-selected - Fired when the user selects a suggestion chip. `event.detail`: `{ label, prompt, selectedDatasets? }`.
|
|
9
|
+
*
|
|
10
|
+
* @property {string} --luzmo-ai-chat-empty-state-header-actions-gap - Gap between the title and the actions block
|
|
11
|
+
* @property {string} --luzmo-ai-chat-empty-state-actions-gap - Gap between the actions label and suggestion chips
|
|
12
|
+
* @property {string} --luzmo-ai-chat-empty-state-suggestions-gap - Gap between suggestion chips
|
|
13
|
+
* @property {string} --luzmo-ai-chat-empty-state-max-width - Maximum content width
|
|
14
|
+
* @property {string} --luzmo-ai-chat-empty-state-padding-block - Vertical padding
|
|
15
|
+
* @property {string} --luzmo-ai-chat-empty-state-padding-inline - Horizontal padding
|
|
16
|
+
* @property {string} --luzmo-ai-chat-empty-state-title-font-size - Title font size
|
|
17
|
+
* @property {string} --luzmo-ai-chat-empty-state-title-font-weight - Title font weight
|
|
18
|
+
* @property {string} --luzmo-ai-chat-empty-state-title-line-height - Title line height
|
|
19
|
+
* @property {string} --luzmo-ai-chat-empty-state-title-color - Title text color
|
|
20
|
+
* @property {string} --luzmo-ai-chat-empty-state-subtitle-font-size - Subtitle font size
|
|
21
|
+
* @property {string} --luzmo-ai-chat-empty-state-subtitle-font-weight - Subtitle font weight
|
|
22
|
+
* @property {string} --luzmo-ai-chat-empty-state-subtitle-line-height - Subtitle line height
|
|
23
|
+
* @property {string} --luzmo-ai-chat-empty-state-subtitle-color - Subtitle text color (`--luzmo-font-color-dimmed`)
|
|
24
|
+
*/
|
|
25
|
+
export declare class LuzmoAiChatEmptyState extends LuzmoElement {
|
|
26
|
+
static styles: import("lit").CSSResult;
|
|
27
|
+
static tagName: string;
|
|
28
|
+
/**
|
|
29
|
+
* Heading shown above the suggestions.
|
|
30
|
+
*/
|
|
31
|
+
title: string;
|
|
32
|
+
/**
|
|
33
|
+
* Supporting text shown above suggestion chips when `suggestions` is non-empty.
|
|
34
|
+
*/
|
|
35
|
+
subtitle: string;
|
|
36
|
+
/**
|
|
37
|
+
* Suggestion chips rendered with {@link https://lucero.luzmo.com/ | Lucero} `luzmo-suggestion` (`variant="prompt"`).
|
|
38
|
+
*/
|
|
39
|
+
suggestions: AiChatEmptyStateSuggestion[];
|
|
40
|
+
/**
|
|
41
|
+
* When true, suggestion chips cannot be activated.
|
|
42
|
+
*/
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
private _handleSuggestionActivate;
|
|
45
|
+
protected render(): TemplateResult;
|
|
46
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LuzmoAiChatEmptyState } from './ai-chat-empty-state';
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
'luzmo-ai-chat-empty-state': LuzmoAiChatEmptyState;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export { LuzmoAiChatEmptyState } from './ai-chat-empty-state';
|
|
8
|
+
export type { AiChatEmptyStateSuggestion, AiChatEmptyStateSuggestionSelectedDetail } from './types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Dataset } from '../../../types';
|
|
2
|
+
export type AiChatEmptyStateSuggestion = {
|
|
3
|
+
/** Visible label on the suggestion chip. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Prompt text inserted or submitted when selected; defaults to `label`. */
|
|
6
|
+
prompt?: string;
|
|
7
|
+
/** Datasets applied to the chat input when this suggestion is selected. */
|
|
8
|
+
selectedDatasets?: Dataset[];
|
|
9
|
+
};
|
|
10
|
+
export type AiChatEmptyStateSuggestionSelectedDetail = {
|
|
11
|
+
label: string;
|
|
12
|
+
prompt: string;
|
|
13
|
+
selectedDatasets?: Dataset[];
|
|
14
|
+
};
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../ai-chat-
|
|
20
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../ai-chat-BITPlYbm.cjs`);exports.AiChatSession=e.r,exports.AiChatSessionController=e.n,exports.LuzmoAiChat=e.t,exports.LuzmoAiChatEmptyState=e.x,exports.buildAiPromptDeleteRequest=e.p,exports.buildAiPromptProperties=e.m,exports.buildAiPromptRequest=e.h,exports.buildAnalystAiPromptProperties=e.g,exports.buildDashboardAiPromptProperties=e._,exports.buildItemAiPromptProperties=e.v,exports.chartToItemAsset=e.y,exports.createAiChatSession=e.i,exports.createInitialProgress=e.c,exports.createInitialStreamState=e.a,exports.createStreamHandler=e.o,exports.extractChartFromChunk=e.s,exports.fetchStreamingResponse=e.l,exports.getAiPromptUrl=e.b,exports.hasProgressChunk=e.u,exports.parseStreamLine=e.d,exports.readNdjsonStream=e.f;
|
|
@@ -4,8 +4,15 @@ declare global {
|
|
|
4
4
|
'luzmo-ai-chat': LuzmoAiChat;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
export { LuzmoAiChat } from './ai-chat';
|
|
8
7
|
export type { ProgressTreeNode } from '../../types/ai-chat.types';
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
11
|
-
export type {
|
|
8
|
+
export { AiChatSession, AiChatSessionController, createAiChatSession } from './session';
|
|
9
|
+
export type { AiChatSessionControllerOptions, AiChatSessionSeed } from './session/ai-chat-session-controller';
|
|
10
|
+
export type { AiChatSessionBuildContext, AiChatSessionCallbacks, AiChatSessionConfig, AiChatSessionRestoreParams, AiChatSessionRestoreResult, AiChatSessionState, AiChatSessionSubmitParams, AiPromptCreateBody, AiPromptDeleteBody, LuzmoPromptSubmittedEventDetail, LuzmoRestoreRequestedEventDetail } from './session/ai-chat-session-types';
|
|
11
|
+
export { LuzmoAiChat } from './ai-chat';
|
|
12
|
+
export { LuzmoAiChatEmptyState } from './empty-state';
|
|
13
|
+
export type { AiChatEmptyStateSuggestion, AiChatEmptyStateSuggestionSelectedDetail } from './empty-state';
|
|
14
|
+
export * from './ai-prompt-types';
|
|
15
|
+
export * from './ai-chat-request';
|
|
16
|
+
export { createInitialProgress, createInitialStreamState, createStreamHandler, extractChartFromChunk, fetchStreamingResponse, hasProgressChunk, parseStreamLine, readNdjsonStream } from './stream';
|
|
17
|
+
export type { StreamingRequestOptions, StreamingResponse } from './stream/ai-chat-streaming';
|
|
18
|
+
export type { StreamHandlerCallbacks, StreamHandlerContext } from './stream';
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
e.setAttribute("data-luzmo-vars", ""), e.textContent = "html{--luzmo-animation-duration: 0.15s;--luzmo-border-color: rgba(var(--luzmo-border-color-rgb), 0.1);--luzmo-border-color-hover: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-down: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-border-color-focus: rgba(var(--luzmo-border-color-rgb), 0.15);--luzmo-border-color-rgb: 0, 0, 0;--luzmo-border-color-full: rgb(180, 180, 180);--luzmo-border-color-full-hover: rgb(140, 140, 140);--luzmo-border-color-full-down: rgb(110, 110, 110);--luzmo-border-color-full-focus: rgb(140, 140, 140);--luzmo-border-color-disabled: #dddddd;--luzmo-border-radius: 6px;--luzmo-border-radius-s: 4px;--luzmo-border-radius-l: 8px;--luzmo-border-radius-xl: 12px;--luzmo-border-radius-full: 999rem;--luzmo-background-color: #ffffff;--luzmo-background-color-rgb: 255, 255, 255;--luzmo-background-color-disabled: #eeeeee;--luzmo-background-color-hover: #f0f0fc;--luzmo-background-color-down: #f1f1ff;--luzmo-background-color-focus: #f0f0fc;--luzmo-background-color-highlight: rgb(240, 240, 240);--luzmo-background-color-highlight-disabled: rgb(245, 245, 245);--luzmo-background-color-highlight-hover: rgb(225, 225, 225);--luzmo-background-color-highlight-down: rgb(215, 215, 215);--luzmo-background-color-highlight-focus: rgb(225, 225, 225);--luzmo-background-color-alt-1: rgb(250, 250, 250);--luzmo-background-color-alt-2: rgb(239, 239, 239);--luzmo-border-width: 1px;--luzmo-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', Helvetica, Arial, sans-serif;--luzmo-font-size-xs: 10px;--luzmo-font-size-s: 12px;--luzmo-font-size-m: 14px;--luzmo-font-size: 14px;--luzmo-font-size-l: 16px;--luzmo-font-size-xl: 18px;--luzmo-font-size-xxl: 20px;--luzmo-font-style: normal;--luzmo-line-height: normal;--luzmo-font-weight: 400;--luzmo-font-weight-semibold: 500;--luzmo-font-weight-bold: 600;--luzmo-font-color: #333;--luzmo-font-color-hard: #000;--luzmo-font-color-disabled: var(--luzmo-color-disabled);--luzmo-font-color-extra-dimmed: #888;--luzmo-font-color-hover: #333;--luzmo-font-color-down: #111;--luzmo-font-color-focus: #333;--luzmo-scrollbar-size: 6px;--luzmo-scrollbar-width: thin;--luzmo-scrollbar-track-background: transparent;--luzmo-scrollbar-track-border-radius: var(--luzmo-border-radius-s);--luzmo-scrollbar-thumb-background: rgba(var(--luzmo-border-color-rgb), 0.3);--luzmo-scrollbar-thumb-border-radius: var(--luzmo-border-radius-s);--luzmo-scrollbar-thumb-hover-background: rgba(var(--luzmo-border-color-rgb), 0.4);--luzmo-primary: #4434ff;--luzmo-primary-hover: #4234e4;--luzmo-primary-down: #392cc7;--luzmo-primary-focus: #4234e4;--luzmo-primary-inverse-color: #ffffff;--luzmo-primary-rgb: 68, 52, 255;--luzmo-secondary: #ff00ff;--luzmo-secondary-hover: #e309e3;--luzmo-secondary-down: #c711c7;--luzmo-secondary-focus: #e309e3;--luzmo-secondary-inverse-color: #ffffff;--luzmo-secondary-rgb: 255, 0, 255;--luzmo-secondary-outline: rgba(255, 0, 255, 0.2);--luzmo-negative-color: #ca221c;--luzmo-negative-color-hover: #b3241f;--luzmo-negative-color-down: #9f231f;--luzmo-negative-color-focus: #b3241f;--luzmo-negative-color-rgb: 202, 34, 28;--luzmo-positive-color: rgb(20, 150, 101);--luzmo-positive-color-hover: rgb(17, 128, 86);--luzmo-positive-color-down: rgb(16, 105, 71);--luzmo-positive-color-focus: rgb(17, 128, 86);--luzmo-positive-color-rgb: 20, 150, 101;--luzmo-selected-color: rgb(110, 110, 110);--luzmo-selected-color-hover: rgb(70, 70, 70);--luzmo-selected-color-down: rgb(40, 40, 40);--luzmo-selected-color-focus: rgb(70, 70, 70);--luzmo-selected-color-hard: #1e1e1e;--luzmo-selected-color-hard-hover: rgb(0, 0, 0);--luzmo-selected-color-hard-down: rgb(0, 0, 0);--luzmo-selected-color-hard-focus: rgb(0, 0, 0);--luzmo-color-informative: #1a77e9;--luzmo-color-informative-rgb: 26, 119, 233;--luzmo-color-disabled: #aaaaaa;--luzmo-spacing-1: 2px;--luzmo-spacing-2: 4px;--luzmo-spacing-3: 8px;--luzmo-spacing-4: 12px;--luzmo-spacing-5: 16px;--luzmo-indicator-gap: 2px;--luzmo-indicator-width: 1px;--luzmo-indicator-color: var(--luzmo-primary);--luzmo-component-height-xxs: 20px;--luzmo-component-height-xs: 24px;--luzmo-component-height-s: 28px;--luzmo-component-height: 32px;--luzmo-component-height-l: 40px;--luzmo-component-height-xl: 48px;--luzmo-component-height-xxl: 64px;--luzmo-icon-size-xxs: 12px;--luzmo-icon-size-xs: 14px;--luzmo-icon-size-s: 16px;--luzmo-icon-size-m: 18px;--luzmo-icon-size-l: 20px;--luzmo-icon-size-xl: 22px;--luzmo-icon-size-xxl: 32px}", document.head.appendChild(e);
|
|
25
25
|
}
|
|
26
26
|
})();
|
|
27
|
-
import {
|
|
28
|
-
export {
|
|
27
|
+
import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, x as y, y as b } from "../ai-chat-D6fgbjA2.js";
|
|
28
|
+
export { m as AiChatSession, d as AiChatSessionController, g as LuzmoAiChat, y as LuzmoAiChatEmptyState, p as buildAiPromptDeleteRequest, u as buildAiPromptProperties, s as buildAiPromptRequest, o as buildAnalystAiPromptProperties, e as buildDashboardAiPromptProperties, v as buildItemAiPromptProperties, b as chartToItemAsset, c as createAiChatSession, r as createInitialProgress, t as createInitialStreamState, f as createStreamHandler, h as extractChartFromChunk, l as fetchStreamingResponse, n as getAiPromptUrl, _ as hasProgressChunk, i as parseStreamLine, a as readNdjsonStream };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ChatMessage, Dataset } from '../../../types';
|
|
2
|
+
import { type AiChatSession } from './ai-chat-session';
|
|
3
|
+
import type { AiChatSessionCallbacks, AiChatSessionConfig, AiChatSessionState } from './ai-chat-session-types';
|
|
4
|
+
export type AiChatSessionSeed = {
|
|
5
|
+
messages: ChatMessage[];
|
|
6
|
+
selectedDatasets: Dataset[];
|
|
7
|
+
conversationId: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type AiChatSessionControllerOptions = {
|
|
10
|
+
getConfig: () => AiChatSessionConfig;
|
|
11
|
+
getSeed: () => AiChatSessionSeed;
|
|
12
|
+
createDomBridge: () => AiChatSessionCallbacks;
|
|
13
|
+
onRenderNeeded: () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Single {@link AiChatSession} slot for `luzmo-ai-chat`.
|
|
17
|
+
* The chat component uses {@link current}, {@link state}, and {@link requireSession} only.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AiChatSessionController {
|
|
20
|
+
private readonly options;
|
|
21
|
+
/** The active {@link AiChatSession}. Null until first bind or action. */
|
|
22
|
+
private _session;
|
|
23
|
+
/** When true, {@link teardown} aborts and clears the session. */
|
|
24
|
+
private _ownsSession;
|
|
25
|
+
/** Whether the session has been seeded from props. Used to avoid unnecessary updates. */
|
|
26
|
+
private _seededFromProps;
|
|
27
|
+
private _unsubscribe;
|
|
28
|
+
constructor(options: AiChatSessionControllerOptions);
|
|
29
|
+
get current(): AiChatSession | null;
|
|
30
|
+
get state(): Readonly<AiChatSessionState>;
|
|
31
|
+
get ownsCurrentSession(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Use an app-provided session (e.g. from `.chatSession`).
|
|
34
|
+
* Pass `null` to clear it; an owned session may be created later via {@link requireSession}.
|
|
35
|
+
*/
|
|
36
|
+
setSession(session: AiChatSession | null): void;
|
|
37
|
+
/**
|
|
38
|
+
* Sync config / seed props after Lit `updated`.
|
|
39
|
+
* Call after handling `chatSession` via {@link setSession}.
|
|
40
|
+
*/
|
|
41
|
+
syncProperties(changedProperties: Map<string, unknown>): void;
|
|
42
|
+
requireSession(): AiChatSession;
|
|
43
|
+
/** Re-attach UI bridge and state subscription after {@link teardown} on reconnect. */
|
|
44
|
+
connect(): void;
|
|
45
|
+
teardown(): void;
|
|
46
|
+
private _createSessionIfMissing;
|
|
47
|
+
private _clearSession;
|
|
48
|
+
private _seedFromPropsOnce;
|
|
49
|
+
private _wire;
|
|
50
|
+
private _unwire;
|
|
51
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ProgressTreeNode } from '@luzmo/lucero/progress-steps';
|
|
2
|
+
import type { AiSampleChart, ChatMessage, Dataset, LuzmoChart } from '../../../types';
|
|
3
|
+
import type { AiPromptAgent, AiPromptCreateBody, AiPromptDeleteBody, AiPromptItemTask, AiPromptScreenMode, BuildAiPromptRequestContext, DashboardStatePayload, LuzmoDashboardGeneratedEventDetail, LuzmoPromptSubmittedEventDetail, LuzmoRestoreRequestedEventDetail } from '../ai-prompt-types';
|
|
4
|
+
import type { StreamingRequestOptions, StreamingResponse } from '../stream/ai-chat-streaming';
|
|
5
|
+
export interface AiChatSessionConfig {
|
|
6
|
+
agent: AiPromptAgent;
|
|
7
|
+
authKey: string;
|
|
8
|
+
authToken: string;
|
|
9
|
+
apiUrl?: string;
|
|
10
|
+
apiVersion?: string;
|
|
11
|
+
stream?: boolean;
|
|
12
|
+
conversationId?: string | null;
|
|
13
|
+
chart?: LuzmoChart | null;
|
|
14
|
+
dashboard?: DashboardStatePayload | null;
|
|
15
|
+
currentScreenMode?: AiPromptScreenMode;
|
|
16
|
+
localeId?: string;
|
|
17
|
+
timezoneId?: string;
|
|
18
|
+
task?: AiPromptItemTask;
|
|
19
|
+
modelPreference?: 'performance' | 'quality';
|
|
20
|
+
/** Initial transcript when hydrating a saved conversation. */
|
|
21
|
+
messages?: ChatMessage[];
|
|
22
|
+
/** Datasets attached to the prompt input. */
|
|
23
|
+
selectedDatasets?: Dataset[];
|
|
24
|
+
/** When true, {@link AiChatSession.submit} requires at least one selected dataset. */
|
|
25
|
+
requireDataset?: boolean;
|
|
26
|
+
/** Initial loading flag (e.g. Storybook or restored UI state). */
|
|
27
|
+
isGenerating?: boolean;
|
|
28
|
+
/** Initial progress tree. */
|
|
29
|
+
progress?: ProgressTreeNode | null;
|
|
30
|
+
/** Initial progress collapsed flag. */
|
|
31
|
+
progressCollapsed?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom streaming HTTP client. Defaults to the kit's {@link fetchStreamingResponse}.
|
|
34
|
+
* Use for proxies, mocks, or alternate auth transport while keeping session state handling.
|
|
35
|
+
*/
|
|
36
|
+
fetchStreaming?: (options: StreamingRequestOptions) => Promise<StreamingResponse>;
|
|
37
|
+
}
|
|
38
|
+
export interface AiChatSessionState {
|
|
39
|
+
messages: ChatMessage[];
|
|
40
|
+
selectedDatasets: Dataset[];
|
|
41
|
+
isGenerating: boolean;
|
|
42
|
+
progress: ProgressTreeNode | null;
|
|
43
|
+
progressCollapsed: boolean;
|
|
44
|
+
conversationId: string | null;
|
|
45
|
+
/** In-flight assistant message (streaming). Also present in `messages` while streaming. */
|
|
46
|
+
inflightMessage: ChatMessage | null;
|
|
47
|
+
}
|
|
48
|
+
export interface AiChatSessionCallbacks {
|
|
49
|
+
onStateChange?: (state: AiChatSessionState) => void;
|
|
50
|
+
onConversationIdChange?: (conversationId: string) => void;
|
|
51
|
+
onChartGenerated?: (detail: AiSampleChart) => void;
|
|
52
|
+
onDashboardGenerated?: (detail: LuzmoDashboardGeneratedEventDetail) => void;
|
|
53
|
+
onResponseReceived?: (message: ChatMessage, done: boolean, error?: unknown) => void;
|
|
54
|
+
onMessageSent?: (message: ChatMessage, selectedDatasets: Dataset[]) => void;
|
|
55
|
+
onDatasetsChanged?: (selectedDatasets: Dataset[]) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Host-owned submit: session updates transcript and loading state, then invokes this
|
|
58
|
+
* with the same payload shape as the former `luzmo-prompt-submitted` event. No built-in fetch.
|
|
59
|
+
*/
|
|
60
|
+
onPromptSubmitted?: (detail: LuzmoPromptSubmittedEventDetail) => void | Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Host-owned restore (item agent): session invokes this with delete request + URL; no built-in fetch.
|
|
63
|
+
*/
|
|
64
|
+
onRestoreRequested?: (detail: LuzmoRestoreRequestedEventDetail) => void | Promise<void>;
|
|
65
|
+
/** @deprecated Use `onResponseReceived` with the optional `error` argument. */
|
|
66
|
+
onError?: (error: unknown, message: ChatMessage) => void;
|
|
67
|
+
}
|
|
68
|
+
export interface AiChatSessionSubmitParams {
|
|
69
|
+
prompt: string;
|
|
70
|
+
/** Defaults to ids from {@link AiChatSessionState.selectedDatasets}. */
|
|
71
|
+
datasetIds?: string[];
|
|
72
|
+
/** Optional stable id for the in-flight AI message. */
|
|
73
|
+
aiMessageId?: string;
|
|
74
|
+
/** When true, does not append a user message (e.g. `initial-prompt` already in the transcript). */
|
|
75
|
+
skipUserMessage?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface AiChatSessionRestoreParams {
|
|
78
|
+
restoreToMessageId: string;
|
|
79
|
+
messageIndex: number;
|
|
80
|
+
}
|
|
81
|
+
export type AiChatSessionBuildContext = Omit<BuildAiPromptRequestContext, 'prompt' | 'datasetIds'>;
|
|
82
|
+
export interface AiChatSessionRestoreResult {
|
|
83
|
+
chart?: AiSampleChart;
|
|
84
|
+
message?: string;
|
|
85
|
+
}
|
|
86
|
+
export type { AiPromptCreateBody, AiPromptDeleteBody, LuzmoPromptSubmittedEventDetail, LuzmoRestoreRequestedEventDetail };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Dataset } from '../../../types';
|
|
2
|
+
import type { AiPromptCreateBody, AiPromptDeleteBody, LuzmoPromptSubmittedEventDetail } from '../ai-prompt-types';
|
|
3
|
+
import type { AiChatSessionCallbacks, AiChatSessionConfig, AiChatSessionRestoreParams, AiChatSessionRestoreResult, AiChatSessionState, AiChatSessionSubmitParams } from './ai-chat-session-types';
|
|
4
|
+
/**
|
|
5
|
+
* Headless chat controller: transcript, datasets, streaming, and API calls without a DOM host.
|
|
6
|
+
* Use with `luzmo-ai-chat` via `.chatSession` for the same simplicity as internal mode,
|
|
7
|
+
* while keeping the session alive when the panel unmounts.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const session = createAiChatSession(
|
|
12
|
+
* { agent: 'dashboard', authKey, authToken, dashboard, currentScreenMode },
|
|
13
|
+
* {
|
|
14
|
+
* onDashboardGenerated: (d) => applyToEditor(d),
|
|
15
|
+
* onStateChange: (s) => persistConversation(s.messages),
|
|
16
|
+
* }
|
|
17
|
+
* );
|
|
18
|
+
*
|
|
19
|
+
* html`<luzmo-ai-chat .chatSession=${session}></luzmo-ai-chat>`;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class AiChatSession {
|
|
23
|
+
private _config;
|
|
24
|
+
/** Callbacks passed to {@link createAiChatSession} (host application). */
|
|
25
|
+
private _hostCallbacks;
|
|
26
|
+
/** Optional bridge from `luzmo-ai-chat` (DOM events). Replaced on each bind, not chained. */
|
|
27
|
+
private _uiBridgeCallbacks;
|
|
28
|
+
private readonly _subscribers;
|
|
29
|
+
private _state;
|
|
30
|
+
private _abortController;
|
|
31
|
+
private _inflightMessage;
|
|
32
|
+
private _receivedProgress;
|
|
33
|
+
constructor(config: AiChatSessionConfig, callbacks?: AiChatSessionCallbacks);
|
|
34
|
+
get state(): Readonly<AiChatSessionState>;
|
|
35
|
+
get isGenerating(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe to full session state (for `luzmo-ai-chat` rendering). Returns an unsubscribe function.
|
|
38
|
+
* The listener is invoked immediately with the current state.
|
|
39
|
+
*/
|
|
40
|
+
subscribe(listener: (state: AiChatSessionState) => void): () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Wire `luzmo-ai-chat` DOM event bridging. Safe to call again when hot-swapping the same
|
|
43
|
+
* session back onto the component — replaces the previous bridge instead of stacking it.
|
|
44
|
+
*/
|
|
45
|
+
setUiBridge(bridge: AiChatSessionCallbacks): void;
|
|
46
|
+
/** Merge config (chart, conversationId, agent, …) without aborting an in-flight request. */
|
|
47
|
+
updateConfig(partial: Partial<AiChatSessionConfig>): void;
|
|
48
|
+
/** Replace the full dataset selection (e.g. when the dashboard context changes). */
|
|
49
|
+
setSelectedDatasets(datasets: Dataset[]): void;
|
|
50
|
+
addDataset(dataset: Dataset): void;
|
|
51
|
+
removeDataset(datasetId: string): void;
|
|
52
|
+
isDatasetRequirementMet(): boolean;
|
|
53
|
+
getAiPromptUrl(): string;
|
|
54
|
+
buildRequestBody(prompt: string, datasetIds: string[]): AiPromptCreateBody;
|
|
55
|
+
/** Same payload passed to {@link AiChatSessionCallbacks.onPromptSubmitted}. */
|
|
56
|
+
buildPromptSubmittedDetail(prompt: string, selectedDatasets: Dataset[], datasetIds: string[]): LuzmoPromptSubmittedEventDetail;
|
|
57
|
+
/**
|
|
58
|
+
* Append the user prompt (unless `skipUserMessage`), start streaming, and update {@link state}.
|
|
59
|
+
*/
|
|
60
|
+
submit(params: AiChatSessionSubmitParams): Promise<void>;
|
|
61
|
+
/** Item agent only — restore conversation to a prior API message. */
|
|
62
|
+
restore(params: AiChatSessionRestoreParams): Promise<AiChatSessionRestoreResult>;
|
|
63
|
+
buildRestoreRequest(restoreToMessageId: string): AiPromptDeleteBody;
|
|
64
|
+
/** Cancel the in-flight fetch. Does not clear conversation state. */
|
|
65
|
+
abort(): void;
|
|
66
|
+
private abortInflight;
|
|
67
|
+
private _createStreamCallbacks;
|
|
68
|
+
private _setConversationId;
|
|
69
|
+
private _upsertMessage;
|
|
70
|
+
private _finalizeInflightMessage;
|
|
71
|
+
private _removeInflightFromMessages;
|
|
72
|
+
private _removeEmptyInflightFromMessages;
|
|
73
|
+
private _handleSubmitError;
|
|
74
|
+
private _hasCallback;
|
|
75
|
+
private _emit;
|
|
76
|
+
private _invokeCallback;
|
|
77
|
+
private _patchState;
|
|
78
|
+
private _areSelectedDatasetsEqual;
|
|
79
|
+
private _areChatMessagesEqual;
|
|
80
|
+
}
|
|
81
|
+
export declare function createAiChatSession(config: AiChatSessionConfig, callbacks?: AiChatSessionCallbacks): AiChatSession;
|