@luzmo/analytics-components-kit 1.0.3-beta.5 → 1.0.3-beta.6
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 +59 -54
- package/components/ai-chat/ai-prompt-types.d.ts +93 -0
- package/components/ai-chat/index.cjs +1 -1
- package/components/ai-chat/index.d.ts +9 -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-CY73iYCg.cjs +154 -0
- package/components/ai-chat-DVU9XiA2.js +1788 -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-DI98QoMZ.js} +3 -3
- package/components/{ai-interaction-textarea-CogE101T.cjs → ai-interaction-textarea-DqWt823F.cjs} +1 -1
- package/components/{base-BAzY-whv.js → base-D3ehdFno.js} +1 -1
- package/components/{base-CbpjVnVy.cjs → base-HUGXYn6t.cjs} +1 -1
- package/components/data-field/index.cjs +1 -1
- package/components/data-field/index.js +1 -1
- package/components/{data-field-97uH3l6o.cjs → data-field-DSzU9Apl.cjs} +1 -1
- package/components/{data-field-tfAMLb-d.js → data-field-DwSYggPc.js} +3 -3
- 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-BquNqRm1.js} +1 -1
- package/components/{data-field-level-6npuFtQo.cjs → data-field-level-CYUtLiIi.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-B_83HNyI.cjs} +1 -1
- package/components/{data-field-panel-P2t8d6sG.js → data-field-panel-Bqslx0EB.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-B7vJTdZO.cjs → data-fields-select-BZj1cpL5.cjs} +1 -1
- package/components/{data-fields-select-DHnnYhbr.js → data-fields-select-t1ikPTLw.js} +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-Bta-CGoN.cjs} +1 -1
- package/components/{dataset-selector-list-CXnDkIe2.js → dataset-selector-list-Ho8JnQp7.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-BONcmdL2.js → dataset-selector-row-8hgsmMRg.js} +1 -1
- package/components/{dataset-selector-row-Bm60zTbF.cjs → dataset-selector-row-CKhHK1H5.cjs} +1 -1
- package/components/{de-B8ds_DbE.cjs → de-CVLDoWlp.cjs} +1 -1
- package/components/{de-DMnvmNFg.js → de-D2bZwq4D.js} +6 -1
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +1 -1
- package/components/{display-settings-BLf7lBww.cjs → display-settings-Bmb0HUlu.cjs} +1 -1
- package/components/{display-settings-BLMrlvMS.js → display-settings-Di9dXtUM.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-B8qUIt6T.js} +2 -2
- package/components/{display-settings-binning-BAg6FoqJ.cjs → display-settings-binning-CpwCqvwm.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-3M3DvzTN.cjs} +1 -1
- package/components/{display-settings-datetime-CCxok7d7.js → display-settings-datetime-C8JfjDJK.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-DMDa6C5k.cjs} +1 -1
- package/components/{display-settings-grand-totals-C1N1cehl.js → display-settings-grand-totals-kyfMh55D.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-B51KddXI.cjs} +1 -1
- package/components/{display-settings-numeric-oyCfBAGV.js → display-settings-numeric-Cw8Nx5s9.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-B2AN0rwz.js} +2 -2
- package/components/{display-settings-period-over-period-CcX7vQnt.cjs → display-settings-period-over-period-CjjA2NqZ.cjs} +1 -1
- package/components/{es-Cc258uTs.js → es-9-jszdOJ.js} +6 -1
- package/components/{es-DGC51Dm9.cjs → es-Byjf7YBI.cjs} +1 -1
- package/components/filter-expression-picker/index.cjs +1 -1
- package/components/filter-expression-picker/index.js +1 -1
- package/components/{filter-expression-picker-DQP5lkn4.js → filter-expression-picker-Brn-vNUd.js} +1 -1
- package/components/{filter-expression-picker-BMJkgHu9.cjs → filter-expression-picker-DCFZKpBE.cjs} +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-BlSQe2nu.js} +4 -4
- package/components/{filter-item-D9m378Qo.cjs → filter-item-Cjrhb1RR.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-BCckBdal.cjs} +1 -1
- package/components/{filter-value-picker-B-dzcjEo.js → filter-value-picker-CBetCjIs.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-CT63jJDI.js} +1 -1
- package/components/{filter-value-picker-datetime-BrrmcjIE.cjs → filter-value-picker-datetime-CxM6HXe3.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-B9gDxYna.cjs → filter-value-picker-hierarchy-C5QZXiQz.cjs} +1 -1
- package/components/{filter-value-picker-hierarchy-UdDq0CZG.js → filter-value-picker-hierarchy-CAORy2A-.js} +2 -2
- 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-D_dgITCq.cjs → filter-value-picker-numeric-CtOfHaJR.cjs} +1 -1
- package/components/{filter-value-picker-numeric-EK515Z-Y.js → filter-value-picker-numeric-Fao-PKN7.js} +1 -1
- package/components/filters/index.cjs +1 -1
- package/components/filters/index.js +1 -1
- package/components/{filters-H2scDNLi.js → filters-CtWut3ce.js} +2 -2
- package/components/{filters-8ehwgopC.cjs → filters-DI0GTL9k.cjs} +1 -1
- package/components/{fr-BoZFY3Qe.cjs → fr-BVxPTfyF.cjs} +1 -1
- package/components/{fr-B32d4zcX.js → fr-DLf99-F8.js} +6 -1
- package/components/{get-dataset-name-CrWWViwN.cjs → get-dataset-name-CvZduuOo.cjs} +1 -1
- package/components/{get-dataset-name-7FdLQo10.js → get-dataset-name-EKmxKZU9.js} +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-Bcez8lwg.cjs} +7 -7
- package/components/{item-grid-B-IFwriA.js → item-grid-DgxtJ0eX.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-BgYyAKSW.cjs} +1 -1
- package/components/{item-option-Buxnv89s.js → item-option-DjiTHr0r.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-DdqzgR08.cjs} +1 -1
- package/components/{item-option-action-button-group-QO_darH9.js → item-option-action-button-group-U5GCtFjg.js} +1 -1
- package/components/{item-option-base-DjQ5poaH.cjs → item-option-base-BeIdCZMp.cjs} +1 -1
- package/components/{item-option-base-DMmga0dv.js → item-option-base-DM3U9dbW.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-CiE_aWRI.js → item-option-color-palette-picker-BsMZ3IUR.js} +1 -1
- package/components/{item-option-color-palette-picker-gZvk4ODA.cjs → item-option-color-palette-picker-oj8nSb-q.cjs} +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-DCnGqBgT.cjs → item-option-color-picker-BJKGTrIi.cjs} +1 -1
- package/components/{item-option-color-picker-CUskqN3R.js → item-option-color-picker-B_pemZKJ.js} +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-B24EAbUi.cjs → item-option-color-range-BOegJZim.cjs} +1 -1
- package/components/{item-option-color-range-BgHXTDvx.js → item-option-color-range-DW3rdMt5.js} +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-DDIu7Hns.cjs → item-option-multi-language-field-BQZ4Lmiy.cjs} +1 -1
- package/components/{item-option-multi-language-field-qngZBXHT.js → item-option-multi-language-field-CeYgkRzs.js} +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-CFQyJG_w.js} +1 -1
- package/components/{item-option-number-field-CqrO1Xu0.cjs → item-option-number-field-T2L2jFCf.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-B26_sDcj.cjs → item-option-panel-BOJmKPgY.cjs} +1 -1
- package/components/{item-option-panel-DZiOx_sn.js → item-option-panel-ChOItFmc.js} +2 -2
- package/components/item-option-picker/index.cjs +1 -1
- package/components/item-option-picker/index.js +1 -1
- package/components/{item-option-picker-B86AqAWp.cjs → item-option-picker-3krQktmk.cjs} +1 -1
- package/components/{item-option-picker-LRahjZUz.js → item-option-picker-IBP7QFLA.js} +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-Cbi2OygH.cjs → item-option-position-picker-BiLRWUWK.cjs} +1 -1
- package/components/{item-option-position-picker-NUpUlyPV.js → item-option-position-picker-DF54K_Mw.js} +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-B6qxN1x7.cjs} +1 -1
- package/components/{item-option-positions-number-field-ClPil6MM.js → item-option-positions-number-field-Dchzu5NS.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-Bdd9sU4p.js → item-option-radio-button-group-BiOpqNXX.js} +1 -1
- package/components/{item-option-radio-button-group-BtYYhQyI.cjs → item-option-radio-button-group-DzI_2jB3.cjs} +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-32oGS1fd.cjs → item-option-slider-6E4VgJpv.cjs} +1 -1
- package/components/{item-option-slider-BJ7gVQXP.js → item-option-slider-Dba7mmcA.js} +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-BAYX5lTr.js} +1 -1
- package/components/{item-option-switch-BFk3biK9.cjs → item-option-switch-Dt4pzFNi.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-BLOz4LvH.cjs} +1 -1
- package/components/{item-option-text-field-BoXwVo-B.js → item-option-text-field-CHalqTt1.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-CNeF_Qmg.cjs} +1 -1
- package/components/{item-slot-drop-C0GmOMQY.js → item-slot-drop-n6UHgA-Q.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-CoRFds3a.cjs → item-slot-drop-panel-Bh6PlCJx.cjs} +1 -1
- package/components/{item-slot-drop-panel-Ci3Soo16.js → item-slot-drop-panel-Hhp9_pDd.js} +3 -3
- package/components/item-slot-picker/index.cjs +1 -1
- package/components/item-slot-picker/index.js +1 -1
- package/components/{item-slot-picker-CmnJSYIF.cjs → item-slot-picker-7oF3vLwb.cjs} +1 -1
- package/components/{item-slot-picker-D1_NbL1A.js → item-slot-picker-BAMVwHtd.js} +5 -5
- 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-BYCDx6Hk.js} +3 -3
- package/components/{item-slot-picker-panel-DzKodYTM.cjs → item-slot-picker-panel-C6mMlurQ.cjs} +1 -1
- package/components/{localized-mixin-DZuGq2Fm.js → localized-mixin-CpYxJczB.js} +1 -1
- package/components/{localized-mixin-Dujo7nlJ.cjs → localized-mixin-CxGNXOcg.cjs} +1 -1
- package/components/{nl-C9Ad2LdA.cjs → nl-D4uOyZ6h.cjs} +1 -1
- package/components/{nl-hCQgb1fB.js → nl-QLEhlKsI.js} +6 -1
- package/components/{set-locale-CXnxhP_B.js → set-locale-wsrhUZVV.js} +4 -4
- package/components/{set-locale-MCuEsOOu.cjs → set-locale-xSK2Wd4D.cjs} +1 -1
- package/components/slot-menu/index.cjs +1 -1
- package/components/slot-menu/index.js +1 -1
- package/components/{slot-menu-CYNYwJnU.js → slot-menu-B431N66z.js} +3 -3
- package/components/{slot-menu-CDAAPyFj.cjs → slot-menu-CIQRPLvx.cjs} +1 -1
- 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-BROocU0s.cjs} +1 -1
- package/components/{slot-menu-list-DL-x5Ggl.js → slot-menu-list-Cdh09ie0.js} +1 -1
- package/components/utils/base.cjs +1 -1
- package/components/utils/base.js +2 -2
- package/components/{utils-BACUV6sE.js → utils-CJ3Vy98n.js} +1 -1
- package/components/{utils-DKSE_5u1.cjs → utils-iY1cKQaF.cjs} +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-DXoKwAhV.js → viz-item-menu--FyB_XCf.js} +1 -1
- package/components/{viz-item-menu-yr7TQY8-.cjs → viz-item-menu-D20StIE_.cjs} +1 -1
- package/custom-elements.json +1460 -157
- package/package.json +1 -1
- 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/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
|
@@ -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,24 @@ 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 type { AiChatSession } from './session/ai-chat-session';
|
|
10
|
+
import type { AiPromptAgent, AiPromptItemTask, AiPromptScreenMode, DashboardStatePayload } from './ai-prompt-types';
|
|
10
11
|
/**
|
|
11
12
|
* @customElement luzmo-ai-chat
|
|
12
|
-
* @summary
|
|
13
|
+
* @summary AI chat UI backed by AiChatSession for transcript, datasets, and streaming.
|
|
14
|
+
* @description Chat state lives in an AiChatSession. By default the element creates an internal
|
|
15
|
+
* session from auth, agent, and chart or dashboard props; optional messages and selected-datasets
|
|
16
|
+
* seed it once on connect. Pass .chatSession for a host-owned session (e.g. dashboard editor).
|
|
17
|
+
* See {@link AiChatSession} / createAiChatSession for callbacks and external fetchStreaming.
|
|
13
18
|
* @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
19
|
* @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-
|
|
20
|
+
* @fires luzmo-chart-generated - Fired when agent is `item` and a chart asset is ready
|
|
21
|
+
* @fires luzmo-dashboard-generated - Fired when agent is `dashboard` and a dashboard asset is ready
|
|
22
|
+
* @fires luzmo-conversation-id-changed - Fired when the conversation ID is updated from the API
|
|
18
23
|
*
|
|
19
24
|
* @property {string} --luzmo-ai-chat-background - Background of the chat container
|
|
20
25
|
* @property {string} --luzmo-ai-chat-border-radius - Border radius of the chat container
|
|
@@ -46,11 +51,11 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
46
51
|
static styles: import("lit").CSSResult;
|
|
47
52
|
static tagName: string;
|
|
48
53
|
/**
|
|
49
|
-
*
|
|
54
|
+
* Live transcript is {@link AiChatSession.state.messages}. This prop optionally seeds the session on first connect.
|
|
50
55
|
*/
|
|
51
56
|
messages: ChatMessage[];
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
58
|
+
* Live selection is in the session. This prop optionally seeds on first connect.
|
|
54
59
|
*/
|
|
55
60
|
selectedDatasets: Dataset[];
|
|
56
61
|
/**
|
|
@@ -112,30 +117,52 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
112
117
|
*/
|
|
113
118
|
requireDataset: boolean;
|
|
114
119
|
/**
|
|
115
|
-
*
|
|
116
|
-
* @default '
|
|
120
|
+
* Which aiprompt agent to use. Determines request payload and stream handling.
|
|
121
|
+
* @default 'item'
|
|
117
122
|
*/
|
|
118
|
-
|
|
123
|
+
agent: AiPromptAgent;
|
|
119
124
|
/**
|
|
120
|
-
*
|
|
121
|
-
* @default '
|
|
125
|
+
* Task for the item agent (`generate`, `suggest`, `describe`).
|
|
126
|
+
* @default 'generate'
|
|
127
|
+
*/
|
|
128
|
+
task: AiPromptItemTask;
|
|
129
|
+
/**
|
|
130
|
+
* AI model preference for item agent chart generation
|
|
131
|
+
* @default 'performance'
|
|
122
132
|
*/
|
|
123
|
-
|
|
133
|
+
modelPreference: 'performance' | 'quality';
|
|
124
134
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @default false
|
|
135
|
+
* Host-owned {@link AiChatSession}. The component subscribes and renders; does not abort on disconnect.
|
|
127
136
|
*/
|
|
128
|
-
|
|
137
|
+
chatSession: AiChatSession | null;
|
|
129
138
|
/**
|
|
130
|
-
* Conversation ID
|
|
139
|
+
* Conversation ID (synced into the session; updated when the API returns a new id).
|
|
131
140
|
* @default null
|
|
132
141
|
*/
|
|
133
142
|
conversationId: string | null;
|
|
134
143
|
/**
|
|
135
|
-
*
|
|
144
|
+
* Chart context for `agent="item"`.
|
|
136
145
|
* @default null
|
|
137
146
|
*/
|
|
138
147
|
chart: LuzmoChart | null;
|
|
148
|
+
/**
|
|
149
|
+
* Dashboard context for `agent="dashboard"`.
|
|
150
|
+
* @default null
|
|
151
|
+
*/
|
|
152
|
+
dashboard: DashboardStatePayload | null;
|
|
153
|
+
/**
|
|
154
|
+
* Current screen mode when editing a dashboard.
|
|
155
|
+
*/
|
|
156
|
+
currentScreenMode?: AiPromptScreenMode;
|
|
157
|
+
/**
|
|
158
|
+
* Locale ID sent to the aiprompt API.
|
|
159
|
+
*/
|
|
160
|
+
localeId?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Timezone ID for dashboard agent requests.
|
|
163
|
+
* @default 'UTC'
|
|
164
|
+
*/
|
|
165
|
+
timezoneId: string;
|
|
139
166
|
/**
|
|
140
167
|
* API version
|
|
141
168
|
* @default '0.1.0'
|
|
@@ -149,59 +176,37 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
149
176
|
stream: boolean;
|
|
150
177
|
/**
|
|
151
178
|
* 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
179
|
* @default null
|
|
155
180
|
*/
|
|
156
181
|
loadingMessage: string | null;
|
|
157
182
|
/**
|
|
158
|
-
* When set,
|
|
159
|
-
*
|
|
160
|
-
* Useful when the prompt originates from an external source (e.g. a dropdown).
|
|
183
|
+
* When set, auto-submits via the session without adding a duplicate user message
|
|
184
|
+
* (assumes the prompt is already in the transcript).
|
|
161
185
|
* @default null
|
|
162
186
|
*/
|
|
163
187
|
initialPrompt: string | null;
|
|
164
|
-
/**
|
|
165
|
-
* Progress tree for external request mode. Ignored in internal mode.
|
|
166
|
-
* @default null
|
|
167
|
-
*/
|
|
168
|
-
progress: ProgressTreeNode | null;
|
|
169
|
-
/**
|
|
170
|
-
* Whether progress steps should be shown collapsed.
|
|
171
|
-
* Only used in external request mode. Ignored in internal mode.
|
|
172
|
-
* @default false
|
|
173
|
-
*/
|
|
174
|
-
progressCollapsed: boolean;
|
|
175
|
-
private _progress;
|
|
176
|
-
private _progressCollapsed;
|
|
177
|
-
private _isGeneratingInternal;
|
|
178
188
|
private _textareaValue;
|
|
179
|
-
private _abortController;
|
|
180
|
-
private _inflightAiMessage;
|
|
181
189
|
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;
|
|
190
|
+
private readonly _session;
|
|
191
|
+
/** Active {@link AiChatSession} (host or auto-created). Null until first bind or action. */
|
|
192
|
+
get session(): AiChatSession | null;
|
|
193
|
+
private _getRenderState;
|
|
194
|
+
private _createDomBridgeCallbacks;
|
|
195
|
+
private _buildSessionConfig;
|
|
196
|
+
private _emitConversationIdChanged;
|
|
197
|
+
private _restoreViaSession;
|
|
193
198
|
private _handleRestoreState;
|
|
194
|
-
private _prepareForAIResponse;
|
|
195
|
-
private _handleAPIError;
|
|
196
199
|
private _handleDatasetSelected;
|
|
197
200
|
private _handleDatasetRemoved;
|
|
198
|
-
private
|
|
199
|
-
private _isDatasetRequirementMet;
|
|
201
|
+
private _submitViaSession;
|
|
200
202
|
private _handlePromptSubmitted;
|
|
201
203
|
private _processInitialPrompt;
|
|
204
|
+
connectedCallback(): void;
|
|
202
205
|
disconnectedCallback(): void;
|
|
203
206
|
private _scrollToBottom;
|
|
204
207
|
protected updated(changedProperties: Map<string, unknown>): void;
|
|
208
|
+
private _syncSession;
|
|
209
|
+
private _handleInitialPromptChange;
|
|
205
210
|
/**
|
|
206
211
|
* Sanitizes HTML content to prevent XSS attacks while preserving safe formatting
|
|
207
212
|
* @param htmlContent - The HTML string to sanitize
|
|
@@ -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
|
+
}
|
|
@@ -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-CY73iYCg.cjs`);exports.AiChatSession=e.r,exports.AiChatSessionController=e.n,exports.LuzmoAiChat=e.t,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,13 @@ 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 * from './ai-prompt-types';
|
|
13
|
+
export * from './ai-chat-request';
|
|
14
|
+
export { createInitialProgress, createInitialStreamState, createStreamHandler, extractChartFromChunk, fetchStreamingResponse, hasProgressChunk, parseStreamLine, readNdjsonStream } from './stream';
|
|
15
|
+
export type { StreamingRequestOptions, StreamingResponse } from './stream/ai-chat-streaming';
|
|
16
|
+
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, y } from "../ai-chat-DVU9XiA2.js";
|
|
28
|
+
export { m as AiChatSession, d as AiChatSessionController, g as LuzmoAiChat, p as buildAiPromptDeleteRequest, u as buildAiPromptProperties, s as buildAiPromptRequest, o as buildAnalystAiPromptProperties, e as buildDashboardAiPromptProperties, v as buildItemAiPromptProperties, y 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;
|
|
@@ -11,4 +11,10 @@ export interface StreamingResponse {
|
|
|
11
11
|
conversationId: string | null;
|
|
12
12
|
}
|
|
13
13
|
export declare function fetchStreamingResponse(options: StreamingRequestOptions): Promise<StreamingResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Parse one line from an aiprompt response stream.
|
|
16
|
+
* Supports plain NDJSON (`{"type":"progress",...}`) and SSE (`data: {...}`).
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseStreamLine(line: string): Record<string, unknown> | null;
|
|
19
|
+
/** Read NDJSON or SSE (`data:`) chunks from a streaming aiprompt response body. */
|
|
14
20
|
export declare function readNdjsonStream(body: ReadableStream<Uint8Array>, onChunk: (chunk: Record<string, unknown>) => void): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DashboardStatePayload } from '../ai-prompt-types';
|
|
2
|
+
import type { StreamHandlerContext } from './types';
|
|
3
|
+
export declare function processDashboardStreamChunk(chunk: Record<string, unknown>, ctx: StreamHandlerContext): void;
|
|
4
|
+
export declare function getDashboardSnapshot(state: StreamHandlerContext['state']): DashboardStatePayload | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createInitialProgress, fetchStreamingResponse, hasProgressChunk, parseStreamLine, readNdjsonStream } from './ai-chat-streaming';
|
|
2
|
+
export type { StreamChunkProcessor } from './registry';
|
|
3
|
+
export { createInitialStreamState, createStreamHandler } from './registry';
|
|
4
|
+
export type { StreamHandlerCallbacks, StreamHandlerContext, StreamHandlerState } from './types';
|
|
5
|
+
export { appendStreamText, applyConversationId, extractChartFromChunk, extractStreamText, finalizeTextResponse, handleSharedError, handleSharedProgress, isStreamDone } from './shared';
|
|
6
|
+
export { processItemStreamChunk } from './item-handler';
|
|
7
|
+
export { getDashboardSnapshot, processDashboardStreamChunk } from './dashboard-handler';
|
|
8
|
+
export { processAnalystStreamChunk } from './analyst-handler';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AiPromptAgent } from '../ai-prompt-types';
|
|
2
|
+
import type { StreamHandlerContext } from './types';
|
|
3
|
+
export type StreamChunkProcessor = (chunk: Record<string, unknown>, ctx: StreamHandlerContext) => void;
|
|
4
|
+
export declare function createStreamHandler(agent: AiPromptAgent): StreamChunkProcessor;
|
|
5
|
+
export declare function createInitialStreamState(): StreamHandlerContext['state'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StreamHandlerContext } from './types';
|
|
2
|
+
export declare function extractInlineStreamText(chunk: Record<string, unknown>): string;
|
|
3
|
+
export declare function extractStreamText(chunk: Record<string, unknown>): string;
|
|
4
|
+
export declare function isStreamDone(chunk: Record<string, unknown>): boolean;
|
|
5
|
+
export declare function applyConversationId(chunk: Record<string, unknown>, ctx: StreamHandlerContext): void;
|
|
6
|
+
export declare function handleSharedProgress(chunk: Record<string, unknown>, ctx: StreamHandlerContext): boolean;
|
|
7
|
+
export declare function handleSharedError(chunk: Record<string, unknown>, ctx: StreamHandlerContext): boolean;
|
|
8
|
+
export declare function appendStreamText(ctx: StreamHandlerContext, textContent: string): void;
|
|
9
|
+
export declare function finalizeTextResponse(ctx: StreamHandlerContext, isDone: boolean, hadTextInChunk?: boolean): void;
|
|
10
|
+
export declare function extractChartFromChunk(chunk: Record<string, unknown>): Record<string, unknown> | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ProgressTreeNode } from '@luzmo/lucero/progress-steps';
|
|
2
|
+
import type { AiSampleChart, ChatMessage } from '../../../types';
|
|
3
|
+
import type { DashboardStatePayload, LuzmoDashboardGeneratedEventDetail } from '../ai-prompt-types';
|
|
4
|
+
export interface StreamHandlerCallbacks {
|
|
5
|
+
onConversationIdChange: (conversationId: string) => void;
|
|
6
|
+
onProgress: (progress: ProgressTreeNode) => void;
|
|
7
|
+
onProgressCollapsed: (collapsed: boolean) => void;
|
|
8
|
+
onMessageUpdate: (message: ChatMessage) => void;
|
|
9
|
+
dispatchChartGenerated: (detail: AiSampleChart) => void;
|
|
10
|
+
dispatchDashboardGenerated: (detail: LuzmoDashboardGeneratedEventDetail) => void;
|
|
11
|
+
dispatchResponseReceived: (message: ChatMessage, done: boolean) => void;
|
|
12
|
+
getConversationId: () => string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface StreamHandlerState {
|
|
15
|
+
progressCollapsed: boolean;
|
|
16
|
+
dashboardSnapshot: DashboardStatePayload | null;
|
|
17
|
+
dashboardName: Record<string, string> | undefined;
|
|
18
|
+
interruptQuestion: string | null;
|
|
19
|
+
/** Latest item chart payload from streaming `asset_delta` events (aiprompt item agent). */
|
|
20
|
+
itemSnapshot: Record<string, unknown> | null;
|
|
21
|
+
}
|
|
22
|
+
export interface StreamHandlerContext {
|
|
23
|
+
aiMessage: ChatMessage;
|
|
24
|
+
callbacks: StreamHandlerCallbacks;
|
|
25
|
+
state: StreamHandlerState;
|
|
26
|
+
}
|