@gooddata/sdk-ui-gen-ai 11.48.0-alpha.2 → 11.48.0-alpha.4

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.
Files changed (54) hide show
  1. package/esm/components/GenAIChatContextIndicator.d.ts.map +1 -1
  2. package/esm/components/GenAIChatContextIndicator.js +11 -11
  3. package/esm/components/GenAIChatConversations.d.ts.map +1 -1
  4. package/esm/components/GenAIChatConversations.js +2 -3
  5. package/esm/components/GenAIChatDialogConnected.d.ts +3 -1
  6. package/esm/components/GenAIChatDialogConnected.d.ts.map +1 -1
  7. package/esm/components/GenAIChatDialogConnected.js +25 -11
  8. package/esm/components/GenAiChatContextChooser.d.ts +1 -1
  9. package/esm/components/GenAiChatContextChooser.d.ts.map +1 -1
  10. package/esm/components/GenAiChatContextChooser.js +8 -8
  11. package/esm/components/hooks/useContextItems.d.ts +2 -2
  12. package/esm/components/hooks/useContextItems.d.ts.map +1 -1
  13. package/esm/components/hooks/useContextItems.js +5 -5
  14. package/esm/components/messages/components/SemanticSearchTreeView.d.ts.map +1 -1
  15. package/esm/components/messages/components/SemanticSearchTreeView.js +2 -4
  16. package/esm/components/messages/contents/CustomHyperlink.d.ts.map +1 -1
  17. package/esm/components/messages/contents/CustomHyperlink.js +4 -12
  18. package/esm/components/utils/icons.d.ts +2 -2
  19. package/esm/components/utils/icons.d.ts.map +1 -1
  20. package/esm/components/utils/icons.js +1 -0
  21. package/esm/context/addContextReference.d.ts +3 -2
  22. package/esm/context/addContextReference.d.ts.map +1 -1
  23. package/esm/context/addContextReference.js +62 -7
  24. package/esm/context/build.d.ts +2 -2
  25. package/esm/context/build.d.ts.map +1 -1
  26. package/esm/context/build.js +35 -4
  27. package/esm/context/collectContextReferences.d.ts +4 -10
  28. package/esm/context/collectContextReferences.d.ts.map +1 -1
  29. package/esm/context/collectContextReferences.js +96 -8
  30. package/esm/context/dashboard.d.ts.map +1 -1
  31. package/esm/context/dashboard.js +10 -4
  32. package/esm/context/removeContextReference.d.ts +2 -1
  33. package/esm/context/removeContextReference.d.ts.map +1 -1
  34. package/esm/context/removeContextReference.js +31 -2
  35. package/esm/store/chatWindow/chatWindowSelectors.d.ts +1 -8
  36. package/esm/store/chatWindow/chatWindowSelectors.d.ts.map +1 -1
  37. package/esm/store/chatWindow/chatWindowSelectors.js +1 -13
  38. package/esm/store/chatWindow/chatWindowSlice.d.ts +5 -3
  39. package/esm/store/chatWindow/chatWindowSlice.d.ts.map +1 -1
  40. package/esm/store/chatWindow/chatWindowSlice.js +15 -17
  41. package/esm/store/sideEffects/onUserMessage.d.ts.map +1 -1
  42. package/esm/store/sideEffects/onUserMessage.js +3 -12
  43. package/esm/types.d.ts +15 -10
  44. package/esm/types.d.ts.map +1 -1
  45. package/esm/utils.d.ts +4 -1
  46. package/esm/utils.d.ts.map +1 -1
  47. package/esm/utils.js +28 -0
  48. package/package.json +20 -20
  49. package/styles/css/conversations.css +0 -6
  50. package/styles/css/conversations.css.map +1 -1
  51. package/styles/css/main.css +31 -15
  52. package/styles/css/main.css.map +1 -1
  53. package/styles/scss/conversations.scss +0 -7
  54. package/styles/scss/main.scss +1 -0
@@ -1,6 +1,7 @@
1
1
  // (C) 2026 GoodData Corporation
2
- import { isIdentifierRef, } from "@gooddata/sdk-model";
3
- export function collectContextReferences(context, type) {
2
+ import { isIdentifierRef, serializeObjRef, } from "@gooddata/sdk-model";
3
+ import { convertReferenceTypeToGenAiType } from "../utils.js";
4
+ export function collectContextReferences(context) {
4
5
  if (!context) {
5
6
  return [];
6
7
  }
@@ -19,11 +20,98 @@ export function collectContextReferences(context, type) {
19
20
  nesting: 0,
20
21
  });
21
22
  }
22
- //NOTE: For ambient we need to return only one object with
23
- // most deep nesting level.
24
- if (type === "ambient") {
25
- return references.sort((a, b) => b.nesting - a.nesting).slice(0, 1);
23
+ // references
24
+ context.referencedObjects?.forEach((obj) => {
25
+ obj.objects.forEach((item) => {
26
+ const ref = item.ref;
27
+ const id = isIdentifierRef(ref) ? ref.identifier : ref.uri;
28
+ references.push({
29
+ id,
30
+ ref,
31
+ nesting: 1,
32
+ where: "referencedObjects",
33
+ title: item.title ?? id,
34
+ type: convertReferenceTypeToGenAiType(item.type),
35
+ });
36
+ });
37
+ });
38
+ return references.sort((a, b) => a.nesting - b.nesting);
39
+ }
40
+ export function collectAvailableReferences(context) {
41
+ if (!context) {
42
+ return [];
43
+ }
44
+ const references = [];
45
+ const used = [];
46
+ // dashboard
47
+ const dashboard = context.view?.dashboard;
48
+ if (dashboard) {
49
+ const dashboardRef = dashboard.ref;
50
+ const dashboardId = isIdentifierRef(dashboardRef) ? dashboardRef.identifier : dashboardRef.uri;
51
+ references.push({
52
+ id: dashboardId,
53
+ ref: dashboardRef,
54
+ type: "dashboard",
55
+ where: "view.dashboard",
56
+ title: dashboard.title ?? dashboardId,
57
+ nesting: 0,
58
+ });
59
+ used.push(serializeObjRef(dashboardRef));
60
+ const context = {
61
+ ref: dashboardRef,
62
+ type: "DASHBOARD",
63
+ title: dashboard.title ?? dashboardId,
64
+ };
65
+ dashboard.widgets.forEach((widget) => {
66
+ switch (widget.widgetType) {
67
+ case "insight": {
68
+ const ref = widget.widgetRef;
69
+ if (!ref) {
70
+ return;
71
+ }
72
+ const id = isIdentifierRef(ref) ? ref.identifier : ref.uri;
73
+ const key = serializeObjRef(ref);
74
+ if (!used.includes(key)) {
75
+ used.push(key);
76
+ references.push({
77
+ id,
78
+ ref,
79
+ nesting: 1,
80
+ where: "referencedObjects",
81
+ title: widget.title ?? id,
82
+ type: "widget",
83
+ context,
84
+ });
85
+ }
86
+ break;
87
+ }
88
+ case "visualizationSwitcher": {
89
+ widget.visualizations?.forEach((visualization) => {
90
+ const ref = visualization.widgetRef;
91
+ if (!ref) {
92
+ return;
93
+ }
94
+ const id = isIdentifierRef(ref) ? ref.identifier : ref.uri;
95
+ const key = serializeObjRef(ref);
96
+ if (!used.includes(key)) {
97
+ used.push(key);
98
+ references.push({
99
+ id,
100
+ ref,
101
+ nesting: 1,
102
+ where: "referencedObjects",
103
+ title: visualization.title ?? id,
104
+ type: "widget",
105
+ context,
106
+ });
107
+ }
108
+ });
109
+ break;
110
+ }
111
+ default:
112
+ break;
113
+ }
114
+ });
26
115
  }
27
- //NOTE: For user we need to return all objects.
28
- return references;
116
+ return references.sort((a, b) => a.nesting - b.nesting);
29
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/context/dashboard.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mCAAmC,EACxC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAEtB,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EACZ,KAAK,MAAM,EASd,MAAM,qBAAqB,CAAC;AAM7B;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,GAAG,iBAAiB,CAM1F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,GAAG,uBAAuB,GAAG,UAAU,EAC5D,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC,GACpF,sBAAsB,CAOxB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,iBAAiB,EAAE,EAC5B,YAAY,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,mCAAmC,CAAC,EAAE,KAAK,CAAC,GAC7E,sBAAsB,EAAE,CA2E1B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,EACxD,YAAY,CAAC,EAAE,IA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AS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC,GACvE;IAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAAC,iBAAiB,EAAE,qBAAqB,EAAE,CAAA;CAAE,CA+DnF"}
@@ -109,21 +109,27 @@ export function buildWidgetsContext(widgetsMap, resultsIdMap) {
109
109
  insightRef: widget.insight,
110
110
  resultId: resultsIdMap?.get(serializeObjRef(widget.ref)),
111
111
  }));
112
- referencedObjects.push({ type: "WIDGET", ref: widget.ref });
112
+ referencedObjects.push({ type: "WIDGET", ref: widget.ref, title: widget.title });
113
113
  }
114
114
  }
115
115
  if (isVisualizationSwitcherWidget(widget)) {
116
116
  const activeVisualization = widget.visualizations[0];
117
- widgets.push(buildWidgetContext(widget.title, widget.ref, "visualizationSwitcher", {
117
+ widgets.push(buildWidgetContext(widget.title || activeVisualization?.title, widget.ref, "visualizationSwitcher", {
118
118
  insightRef: activeVisualization?.insight,
119
119
  resultId: activeVisualization
120
120
  ? resultsIdMap?.get(serializeObjRef(activeVisualization.ref))
121
121
  : undefined,
122
122
  // All child insights, so the BE can execute the non-active children
123
123
  // (which have no cached result).
124
- visualizationRefs: widget.visualizations.map((v) => v.insight),
124
+ visualizations: widget.visualizations.map((v) => buildWidgetContext(v.title, v.ref, "insight", {
125
+ insightRef: v.insight,
126
+ })),
125
127
  }));
126
- referencedObjects.push({ type: "WIDGET", ref: widget.ref });
128
+ referencedObjects.push({
129
+ type: "WIDGET",
130
+ ref: widget.ref,
131
+ title: widget.title || activeVisualization?.title,
132
+ });
127
133
  }
128
134
  if (isRichTextWidget(widget)) {
129
135
  widgets.push(buildWidgetContext(widget.title, widget.ref, "richText", {
@@ -1,4 +1,5 @@
1
1
  import { type IGenAIUserContext } from "@gooddata/sdk-model";
2
- import type { IGenAIContextObject } from "./collectContextReferences.js";
2
+ import { type IGenAIContextObject } from "../types.js";
3
3
  export declare function removeContextReference(context: IGenAIUserContext | undefined, reference?: IGenAIContextObject): IGenAIUserContext | undefined;
4
+ export declare function removeUserContextReferences(context: IGenAIUserContext | undefined): IGenAIUserContext | undefined;
4
5
  //# sourceMappingURL=removeContextReference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"removeContextReference.d.ts","sourceRoot":"","sources":["../../src/context/removeContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,SAAS,CAAC,EAAE,mBAAmB,GAChC,iBAAiB,GAAG,SAAS,CA6B/B"}
1
+ {"version":3,"file":"removeContextReference.d.ts","sourceRoot":"","sources":["../../src/context/removeContextReference.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,iBAAiB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,iBAAiB,GAAG,SAAS,EACtC,SAAS,CAAC,EAAE,mBAAmB,GAChC,iBAAiB,GAAG,SAAS,CAgD/B;AAED,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CAY/B"}
@@ -1,4 +1,5 @@
1
1
  // (C) 2026 GoodData Corporation
2
+ import { areObjRefsEqual, } from "@gooddata/sdk-model";
2
3
  export function removeContextReference(context, reference) {
3
4
  if (!context) {
4
5
  return undefined;
@@ -8,15 +9,31 @@ export function removeContextReference(context, reference) {
8
9
  }
9
10
  const newContext = { ...context };
10
11
  // remove dashboard reference
11
- if (reference.where === "view.dashboard" && newContext.view) {
12
+ if (reference.where === "view.dashboard" &&
13
+ areObjRefsEqual(newContext.view?.dashboard?.ref, reference.ref)) {
12
14
  newContext.view = { ...newContext.view };
13
15
  delete newContext.view.dashboard;
14
16
  }
17
+ // remove reference
18
+ if (reference.where === "referencedObjects") {
19
+ newContext.referencedObjects = newContext.referencedObjects
20
+ ?.map((obj) => {
21
+ const clone = {
22
+ ...obj,
23
+ objects: obj.objects.filter((item) => !areObjRefsEqual(item.ref, reference.ref)),
24
+ };
25
+ if (clone.objects.length === 0) {
26
+ return null;
27
+ }
28
+ return clone;
29
+ })
30
+ .filter(Boolean);
31
+ }
15
32
  // make clean context
16
33
  if (newContext.view && Object.keys(newContext.view).length === 0) {
17
34
  delete newContext.view;
18
35
  }
19
- if (newContext.referencedObjects?.length === 0) {
36
+ if (!newContext.referencedObjects || newContext.referencedObjects.length === 0) {
20
37
  delete newContext.referencedObjects;
21
38
  }
22
39
  if (Object.keys(newContext).length === 0) {
@@ -24,3 +41,15 @@ export function removeContextReference(context, reference) {
24
41
  }
25
42
  return newContext;
26
43
  }
44
+ export function removeUserContextReferences(context) {
45
+ if (!context) {
46
+ return undefined;
47
+ }
48
+ const newContext = { ...context };
49
+ delete newContext.referencedObjects;
50
+ delete newContext.activeObject;
51
+ if (Object.keys(newContext).length === 0) {
52
+ return undefined;
53
+ }
54
+ return newContext;
55
+ }
@@ -19,13 +19,6 @@ export declare const tagsSelector: (state: RootState) => {
19
19
  export declare const catalogItemsSelector: (state: RootState) => CatalogItem[];
20
20
  export declare const keyDriverAnalysisSelector: (state: RootState) => IKdaDefinition | undefined;
21
21
  export declare const keyDriverAnalysisMinimizedSelector: (state: RootState) => boolean | undefined;
22
+ export declare const userContextSelector: (state: RootState) => IGenAIUserContext | undefined;
22
23
  export declare const ambientContextSelector: (state: RootState) => IGenAIUserContext | undefined;
23
- /**
24
- * Context to attach to the next message: an explicit one-shot context (e.g. Summarize)
25
- * wins over the ambient context kept in sync by the host.
26
- */
27
- export declare const effectiveContextSelector: (state: RootState) => {
28
- user: IGenAIUserContext | undefined;
29
- ambient: IGenAIUserContext | undefined;
30
- };
31
24
  //# sourceMappingURL=chatWindowSelectors.d.ts.map
@@ -1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B,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,iBAAiB,GAAG,SAG9E,CAAC"}
@@ -26,17 +26,5 @@ export const catalogItemsSelector = createSelector(chatWindowSliceSelector, (sta
26
26
  });
27
27
  export const keyDriverAnalysisSelector = createSelector(chatWindowSliceSelector, (state) => state.keyDriverAnalysis);
28
28
  export const keyDriverAnalysisMinimizedSelector = createSelector(chatWindowSliceSelector, (state) => state.keyDriverAnalysisMinimized);
29
- const userContextSelector = createSelector(chatWindowSliceSelector, (state) => state.context.user);
29
+ export const userContextSelector = createSelector(chatWindowSliceSelector, (state) => state.context.active);
30
30
  export const ambientContextSelector = createSelector(chatWindowSliceSelector, (state) => state.context.ambient);
31
- const contextModeSelector = createSelector(chatWindowSliceSelector, (state) => state.context.ambientMode);
32
- /**
33
- * Context to attach to the next message: an explicit one-shot context (e.g. Summarize)
34
- * wins over the ambient context kept in sync by the host.
35
- */
36
- export const effectiveContextSelector = createSelector(userContextSelector, ambientContextSelector, contextModeSelector, (userContext, ambientUserContext, mode) => {
37
- const suppressed = mode === "suppressed";
38
- return {
39
- user: userContext,
40
- ambient: suppressed ? undefined : ambientUserContext,
41
- };
42
- });
@@ -2,8 +2,7 @@ import { type Reducer } from "@reduxjs/toolkit";
2
2
  import { type IUserWorkspaceSettings } from "@gooddata/sdk-backend-spi";
3
3
  import { type CatalogItem, type GenAIObjectType, type IAllowedRelationshipType, type IColorPalette, type IGenAIUserContext } from "@gooddata/sdk-model";
4
4
  import type { IKdaDefinition } from "@gooddata/sdk-ui-dashboard";
5
- import { type IGenAIContextObject } from "../../context/collectContextReferences.js";
6
- import { type StoreContext } from "../../types.js";
5
+ import { type IGenAIContextObject, type StoreContext } from "../../types.js";
7
6
  type ChatWindowSliceState = {
8
7
  /**
9
8
  * Defines if the chat window is open.
@@ -93,7 +92,9 @@ export declare const setOpenAction: import("@reduxjs/toolkit").ActionCreatorWith
93
92
  allowedRelationshipTypes?: IAllowedRelationshipType[] | undefined;
94
93
  }, "chatWindow/setAllowedRelationshipTypesAction">, addContextReferenceAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
95
94
  object: IGenAIContextObject;
96
- }, "chatWindow/addContextReferenceAction">, removeAmbientUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/removeAmbientUserContextAction">, clearUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chatWindow/clearUserContextAction">, setIsPreviewAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
95
+ }, "chatWindow/addContextReferenceAction">, removeContextReferenceAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
96
+ object: IGenAIContextObject;
97
+ }, "chatWindow/removeContextReferenceAction">, setIsPreviewAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
97
98
  isPreview?: boolean | undefined;
98
99
  }, "chatWindow/setIsPreviewAction">,
99
100
  /**
@@ -107,6 +108,7 @@ setAmbientUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithPayload
107
108
  */
108
109
  setUserContextAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
109
110
  userContext?: IGenAIUserContext | undefined;
111
+ replaceUserContext?: boolean | undefined;
110
112
  }, "chatWindow/setUserContextAction">;
111
113
  export {};
112
114
  //# sourceMappingURL=chatWindowSlice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chatWindowSlice.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSlice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE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A8B,uGAC9B,sBAAsB,+FACtB,kBAAkB;;;AAClB;;GAEG;AACH,2BAA2B;;;AAC3B;;GAEG;AACH,oBAAoB;;qCACG,CAAC"}
1
+ {"version":3,"file":"chatWindowSlice.d.ts","sourceRoot":"","sources":["../../../src/store/chatWindow/chatWindowSlice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,OAAO,EAAe,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAKjE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7E,KAAK,oBAAoB,GAAG;IACxB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC;;OAEG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;OAEG;IACH,wBAAwB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACtD;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAmBhD,eAAO,MAAM,yBAAyB;;0BAOpC,CAAC;AAkHH,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,oBAAoB,CAA2B,CAAC;AAC7F,eAAO,MACH,aAAa;;gCACb,mBAAmB;;sCACnB,gBAAgB;;mCAChB,qBAAqB;;wCACrB,iBAAiB;;oCACjB,qBAAqB;;wCACrB,0BAA0B;;6CAC1B,mCAAmC;;sDACnC,oBAAoB;;uCACpB,aAAa;;;gCACb,sBAAsB,+HACtB,iCAAiC;;oDACjC,yBAAyB;;4CACzB,4BAA4B;;+CAC5B,kBAAkB;;;AAClB;;GAEG;AACH,2BAA2B;;;AAC3B;;GAEG;AACH,oBAAoB;;;qCACG,CAAC"}
@@ -1,7 +1,8 @@
1
1
  // (C) 2024-2026 GoodData Corporation
2
2
  import { createSlice } from "@reduxjs/toolkit";
3
- import { addContextReference } from "../../context/addContextReference.js";
4
- import { isReferenceChanged } from "../../context/isReferenceChanged.js";
3
+ import { addAmbientContextReferences, addContextReference } from "../../context/addContextReference.js";
4
+ import { mergeContexts } from "../../context/build.js";
5
+ import { removeContextReference, removeUserContextReferences } from "../../context/removeContextReference.js";
5
6
  export const chatWindowSliceName = "chatWindow";
6
7
  const initialState = {
7
8
  isOpen: false,
@@ -14,9 +15,8 @@ const initialState = {
14
15
  excludeTags: undefined,
15
16
  allowedRelationshipTypes: undefined,
16
17
  context: {
17
- ambientMode: "enabled",
18
18
  ambient: undefined,
19
- user: undefined,
19
+ active: undefined,
20
20
  },
21
21
  isPreview: undefined,
22
22
  };
@@ -65,27 +65,25 @@ const chatWindowSlice = createSlice({
65
65
  setAllowedRelationshipTypesAction: (state, { payload: { allowedRelationshipTypes }, }) => {
66
66
  state.allowedRelationshipTypes = allowedRelationshipTypes;
67
67
  },
68
- setUserContextAction: (state, { payload: { userContext } }) => {
69
- state.context.user = userContext;
70
- },
71
- clearUserContextAction: (state) => {
72
- state.context.user = undefined;
68
+ setUserContextAction: (state, { payload: { userContext, replaceUserContext }, }) => {
69
+ if (replaceUserContext) {
70
+ state.context.active = mergeContexts(removeUserContextReferences(state.context.active), userContext);
71
+ }
72
+ else {
73
+ state.context.active = mergeContexts(state.context.active, userContext);
74
+ }
73
75
  },
74
76
  setAmbientUserContextAction: (state, { payload: { userContext } }) => {
75
77
  if (!state.settings?.enableAiContextSetup) {
76
78
  return;
77
79
  }
78
- if (state.context.ambientMode === "suppressed" &&
79
- isReferenceChanged(state.context.ambient, userContext)) {
80
- state.context.ambientMode = "enabled";
81
- }
82
- state.context.ambient = userContext;
80
+ state.context = addAmbientContextReferences(state.context, userContext);
83
81
  },
84
82
  addContextReferenceAction: (state, { payload: { object } }) => {
85
83
  state.context = addContextReference(state.context, object);
86
84
  },
87
- removeAmbientUserContextAction: (state) => {
88
- state.context.ambientMode = "suppressed";
85
+ removeContextReferenceAction: (state, { payload: { object } }) => {
86
+ state.context.active = removeContextReference(state.context.active, object);
89
87
  },
90
88
  setIsPreviewAction: (state, { payload: { isPreview } }) => {
91
89
  state.isPreview = isPreview;
@@ -94,7 +92,7 @@ const chatWindowSlice = createSlice({
94
92
  },
95
93
  });
96
94
  export const chatWindowSliceReducer = chatWindowSlice.reducer;
97
- export const { setOpenAction, setFullscreenAction, setHistoryAction, setColorPaletteAction, setSettingsAction, copyToClipboardAction, setKeyDriverAnalysisAction, setKeyDriverAnalysisMinimizedAction, setObjectTypesAction, setTagsAction, setCatalogItemsActions, setAllowedRelationshipTypesAction, addContextReferenceAction, removeAmbientUserContextAction, clearUserContextAction, setIsPreviewAction,
95
+ export const { setOpenAction, setFullscreenAction, setHistoryAction, setColorPaletteAction, setSettingsAction, copyToClipboardAction, setKeyDriverAnalysisAction, setKeyDriverAnalysisMinimizedAction, setObjectTypesAction, setTagsAction, setCatalogItemsActions, setAllowedRelationshipTypesAction, addContextReferenceAction, removeContextReferenceAction, setIsPreviewAction,
98
96
  /**
99
97
  * @public
100
98
  */
@@ -1 +1 @@
1
- {"version":3,"file":"onUserMessage.d.ts","sourceRoot":"","sources":["../../../src/store/sideEffects/onUserMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,iBAAiB,EASzB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAOlC,MAAM,gBAAgB,CAAC;AAkBxB,OAAO,EAOH,KAAK,gBAAgB,EAGxB,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAiB,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oJAmB9E"}
1
+ {"version":3,"file":"onUserMessage.d.ts","sourceRoot":"","sources":["../../../src/store/sideEffects/onUserMessage.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,iBAAiB,EASzB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAOlC,MAAM,gBAAgB,CAAC;AAiBxB,OAAO,EAOH,KAAK,gBAAgB,EAGxB,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAiB,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oJAmB9E"}
@@ -3,8 +3,7 @@ import { call, cancel, cancelled, getContext, put, select } from "redux-saga/eff
3
3
  import { isChatConversationError, isChatConversationItem, } from "@gooddata/sdk-backend-spi";
4
4
  import { isChatConversationLocalItem, isTextContents, isUserMessage, makeAssistantItem, makeAssistantMessage, } from "../../model.js";
5
5
  import { generateTitleFromQuestion } from "../../utils.js";
6
- import { agentSwitchingActiveSelector, allowedRelationshipTypesSelector, effectiveContextSelector, objectTypesSelector, settingsSelector, tagsSelector, } from "../chatWindow/chatWindowSelectors.js";
7
- import { clearUserContextAction } from "../chatWindow/chatWindowSlice.js";
6
+ import { agentSwitchingActiveSelector, allowedRelationshipTypesSelector, objectTypesSelector, settingsSelector, tagsSelector, userContextSelector, } from "../chatWindow/chatWindowSelectors.js";
8
7
  import { conversationMessagesByIdSelector, conversationSelector, messagesSelector, pendingAgentSwitchSelector, selectedAgentIdSelector, } from "../messages/messagesSelectors.js";
9
8
  import { applyPendingAgentSwitchAction, evaluateMessageAction, evaluateMessageCompleteAction, evaluateMessageErrorAction, evaluateMessageStreamingAction, evaluateMessageUpdateAction, revertAgentSwitchAction, setCurrentConversationAction, } from "../messages/messagesSlice.js";
10
9
  import { processContents } from "./converters/interactionsToMessages.js";
@@ -93,9 +92,7 @@ function* evaluateUserMessage(message, preparedChatThread) {
93
92
  const settings = yield select(settingsSelector);
94
93
  const objectTypes = yield select(objectTypesSelector);
95
94
  const allowedRelationshipTypes = yield select(allowedRelationshipTypesSelector);
96
- const { user, ambient } = yield select(effectiveContextSelector);
97
- // Clear user context immediately — it is a one-shot value
98
- yield put(clearUserContextAction());
95
+ const context = yield select(userContextSelector);
99
96
  const showReasoning = Boolean(settings?.enableGenAIReasoningVisibility);
100
97
  // Track interaction ID to assistant message mapping
101
98
  let currentAssistantMessage = message;
@@ -106,7 +103,6 @@ function* evaluateUserMessage(message, preparedChatThread) {
106
103
  if (allowedRelationshipTypes?.length) {
107
104
  queryBuilder = queryBuilder.withAllowedRelationshipTypes(allowedRelationshipTypes);
108
105
  }
109
- const context = user ?? ambient;
110
106
  if (context) {
111
107
  queryBuilder = queryBuilder.withUserContext(context);
112
108
  }
@@ -324,11 +320,7 @@ function* evaluateUserConversationMessage(conversation, userMessage, assistantMe
324
320
  const objectTypes = yield select(objectTypesSelector);
325
321
  const { includeTags, excludeTags } = yield select(tagsSelector);
326
322
  const allowedRelationshipTypes = yield select(allowedRelationshipTypesSelector);
327
- // One-shot context (e.g. Summarize) wins over the ambient dashboard context;
328
- // the ambient part persists and rides on every message.
329
- const { user, ambient } = yield select(effectiveContextSelector);
330
- // Clear the one-shot user context immediately — it is a one-shot value
331
- yield put(clearUserContextAction());
323
+ const context = yield select(userContextSelector);
332
324
  // Track interaction ID to assistant message mapping
333
325
  let currentUserMessage = userMessage;
334
326
  let currentAssistantMessage = assistantMessage;
@@ -345,7 +337,6 @@ function* evaluateUserConversationMessage(conversation, userMessage, assistantMe
345
337
  if (allowedRelationshipTypes?.length) {
346
338
  queryBuilder = queryBuilder.withAllowedRelationshipTypes(allowedRelationshipTypes);
347
339
  }
348
- const context = user ?? ambient;
349
340
  if (context) {
350
341
  queryBuilder = queryBuilder.withUserContext(context);
351
342
  }
package/esm/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type IChatConversationVisualisationContent } from "@gooddata/sdk-backend-spi";
2
- import { type IGenAIUserContext, type IGenAIVisualization } from "@gooddata/sdk-model";
2
+ import { type GenAIObjectType, type IGenAIObjectReference, type IGenAIUserContext, type IGenAIVisualization, type ObjRef } from "@gooddata/sdk-model";
3
3
  import { type IChatConversationLocalItem } from "./model.js";
4
4
  export type Config = IGenAIVisualization["config"] | NonNullable<IChatConversationVisualisationContent["visualization"]>["insight"]["properties"]["controls"];
5
5
  export type StoredConversation = {
@@ -36,11 +36,6 @@ export type StoredConversation = {
36
36
  };
37
37
  };
38
38
  export type StoreContext = {
39
- /**
40
- * One-shot user context for the next message (e.g. active visualization).
41
- * Cleared after being consumed by the saga.
42
- */
43
- user?: IGenAIUserContext;
44
39
  /**
45
40
  * Ambient user context kept in sync by the host (e.g. the open dashboard and its
46
41
  * live filter state). Unlike the one-shot userContext it persists across messages
@@ -48,10 +43,20 @@ export type StoreContext = {
48
43
  */
49
44
  ambient?: IGenAIUserContext;
50
45
  /**
51
- * Ambient mode for the chat.
52
- * "suppressed" - ambient context is not used, but automatically change to auto if id is changed
53
- * "enabled" - ambient context is used if available and updated in real-time
46
+ * Active context
54
47
  */
55
- ambientMode?: "suppressed" | "enabled";
48
+ active?: IGenAIUserContext;
56
49
  };
50
+ /**
51
+ * @internal
52
+ */
53
+ export interface IGenAIContextObject {
54
+ id: string;
55
+ ref: ObjRef;
56
+ title: string;
57
+ nesting: number;
58
+ type: GenAIObjectType | "widget";
59
+ where: "view.dashboard" | "referencedObjects";
60
+ context?: IGenAIObjectReference;
61
+ }
57
62
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEvF,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,MAAM,GACZ,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,WAAW,CACP,qCAAqC,CAAC,eAAe,CAAC,CACzD,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IAClD;;;OAGG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;IACnE;;;OAGG;IACH,kBAAkB,CAAC,EAAE;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;CACL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CAC9B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,eAAe,GAAG,QAAQ,CAAC;IACjC,KAAK,EAAE,gBAAgB,GAAG,mBAAmB,CAAC;IAC9C,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACnC"}
package/esm/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type IntlShape } from "react-intl";
2
- import { type IAttributeOrMeasure } from "@gooddata/sdk-model";
2
+ import { type GenAIObjectReferenceType, type IAttributeOrMeasure } from "@gooddata/sdk-model";
3
3
  import { type IChatConversationLocal } from "./model.js";
4
+ import { type IGenAIContextObject } from "./types.js";
4
5
  export declare function getVisualizationHref(wsId: string, visId: string, useHostedAnalyticalDesigner?: boolean): string;
5
6
  export declare function getAbsoluteVisualizationHref(wsId: string, visId: string, useHostedAnalyticalDesigner?: boolean): string;
6
7
  export declare function getSettingHref(section: string, action?: string): string;
@@ -18,4 +19,6 @@ export declare function getHeadlineComparison(metrics: IAttributeOrMeasure[]): {
18
19
  };
19
20
  export declare function generateTemporaryTitle(intl: IntlShape, data: IChatConversationLocal): string;
20
21
  export declare function generateTitleFromQuestion(text: string): string;
22
+ export declare function convertReferenceTypeToGenAiType(type: GenAIObjectReferenceType): IGenAIContextObject["type"];
23
+ export declare function convertGenAiTypeToReferenceType(type: IGenAIContextObject["type"]): GenAIObjectReferenceType;
21
24
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,KA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,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,UAGlB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,EAAE;;;;EAMnE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAS5F;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgC9D;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,wBAAwB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAa3G;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,wBAAwB,CAa3G"}
package/esm/utils.js CHANGED
@@ -90,3 +90,31 @@ export function generateTitleFromQuestion(text) {
90
90
  }
91
91
  return `${sanitizedText.slice(0, sliceEnd).trim()}...`;
92
92
  }
93
+ export function convertReferenceTypeToGenAiType(type) {
94
+ switch (type) {
95
+ case "METRIC":
96
+ return "metric";
97
+ case "WIDGET":
98
+ return "widget";
99
+ case "ATTRIBUTE":
100
+ return "attribute";
101
+ case "DASHBOARD":
102
+ return "dashboard";
103
+ default:
104
+ return "dashboard";
105
+ }
106
+ }
107
+ export function convertGenAiTypeToReferenceType(type) {
108
+ switch (type) {
109
+ case "metric":
110
+ return "METRIC";
111
+ case "widget":
112
+ return "WIDGET";
113
+ case "attribute":
114
+ return "ATTRIBUTE";
115
+ case "dashboard":
116
+ return "DASHBOARD";
117
+ default:
118
+ return "DASHBOARD";
119
+ }
120
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-gen-ai",
3
- "version": "11.48.0-alpha.2",
3
+ "version": "11.48.0-alpha.4",
4
4
  "description": "GoodData GenAI SDK",
5
5
  "license": "MIT",
6
6
  "author": "GoodData Corporation",
@@ -57,18 +57,18 @@
57
57
  "reselect": "5.1.1",
58
58
  "tslib": "2.8.1",
59
59
  "uuid": "11.1.1",
60
- "@gooddata/api-client-tiger": "11.48.0-alpha.2",
61
- "@gooddata/sdk-backend-spi": "11.48.0-alpha.2",
62
- "@gooddata/sdk-model": "11.48.0-alpha.2",
63
- "@gooddata/sdk-ui": "11.48.0-alpha.2",
64
- "@gooddata/sdk-ui-charts": "11.48.0-alpha.2",
65
- "@gooddata/sdk-ui-dashboard": "11.48.0-alpha.2",
66
- "@gooddata/sdk-ui-filters": "11.48.0-alpha.2",
67
- "@gooddata/sdk-ui-semantic-search": "11.48.0-alpha.2",
68
- "@gooddata/sdk-ui-kit": "11.48.0-alpha.2",
69
- "@gooddata/sdk-ui-pivot": "11.48.0-alpha.2",
70
- "@gooddata/util": "11.48.0-alpha.2",
71
- "@gooddata/sdk-ui-theme-provider": "11.48.0-alpha.2"
60
+ "@gooddata/api-client-tiger": "11.48.0-alpha.4",
61
+ "@gooddata/sdk-backend-spi": "11.48.0-alpha.4",
62
+ "@gooddata/sdk-model": "11.48.0-alpha.4",
63
+ "@gooddata/sdk-ui-charts": "11.48.0-alpha.4",
64
+ "@gooddata/sdk-ui": "11.48.0-alpha.4",
65
+ "@gooddata/sdk-ui-dashboard": "11.48.0-alpha.4",
66
+ "@gooddata/sdk-ui-filters": "11.48.0-alpha.4",
67
+ "@gooddata/sdk-ui-kit": "11.48.0-alpha.4",
68
+ "@gooddata/sdk-ui-pivot": "11.48.0-alpha.4",
69
+ "@gooddata/util": "11.48.0-alpha.4",
70
+ "@gooddata/sdk-ui-semantic-search": "11.48.0-alpha.4",
71
+ "@gooddata/sdk-ui-theme-provider": "11.48.0-alpha.4"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@microsoft/api-documenter": "^7.17.0",
@@ -111,13 +111,13 @@
111
111
  "typescript": "5.9.3",
112
112
  "vitest": "4.1.8",
113
113
  "vitest-dom": "0.1.1",
114
- "@gooddata/eslint-config": "11.48.0-alpha.2",
115
- "@gooddata/i18n-toolkit": "11.48.0-alpha.2",
116
- "@gooddata/oxlint-config": "11.48.0-alpha.2",
117
- "@gooddata/reference-workspace": "11.48.0-alpha.2",
118
- "@gooddata/sdk-backend-mockingbird": "11.48.0-alpha.2",
119
- "@gooddata/stylelint-config": "11.48.0-alpha.2",
120
- "@gooddata/sdk-ui-theme-provider": "11.48.0-alpha.2"
114
+ "@gooddata/eslint-config": "11.48.0-alpha.4",
115
+ "@gooddata/i18n-toolkit": "11.48.0-alpha.4",
116
+ "@gooddata/oxlint-config": "11.48.0-alpha.4",
117
+ "@gooddata/reference-workspace": "11.48.0-alpha.4",
118
+ "@gooddata/sdk-backend-mockingbird": "11.48.0-alpha.4",
119
+ "@gooddata/sdk-ui-theme-provider": "11.48.0-alpha.4",
120
+ "@gooddata/stylelint-config": "11.48.0-alpha.4"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "react": "^18.0.0 || ^19.0.0",
@@ -48,12 +48,6 @@
48
48
  height: 1px;
49
49
  background-color: var(--gd-palette-complementary-3, #dde4eb);
50
50
  }
51
- .gd-gen-ai-chat__window__conversations__divider_menu {
52
- width: calc(100% - 20px);
53
- height: 1px;
54
- margin: 0 10px;
55
- background-color: var(--gd-palette-complementary-3, #dde4eb);
56
- }
57
51
  .gd-gen-ai-chat__window__conversations__empty {
58
52
  display: flex;
59
53
  padding: 20px 0;