@finos/legend-application-query 13.8.44 → 13.8.45
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/lib/__lib__/LegendQueryAgentChatTelemetryHelper.d.ts +33 -0
- package/lib/__lib__/LegendQueryAgentChatTelemetryHelper.d.ts.map +1 -0
- package/lib/__lib__/LegendQueryAgentChatTelemetryHelper.js +45 -0
- package/lib/__lib__/LegendQueryAgentChatTelemetryHelper.js.map +1 -0
- package/lib/__lib__/LegendQueryEvent.d.ts +2 -0
- package/lib/__lib__/LegendQueryEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryEvent.js +2 -0
- package/lib/__lib__/LegendQueryEvent.js.map +1 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts +1 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +3 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +6 -1
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +33 -9
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +1 -0
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js +2 -0
- package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +4 -0
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/package.json +3 -3
- package/src/__lib__/LegendQueryAgentChatTelemetryHelper.ts +67 -0
- package/src/__lib__/LegendQueryEvent.ts +2 -0
- package/src/__lib__/LegendQueryTelemetryHelper.ts +1 -1
- package/src/application/LegendQueryApplicationConfig.ts +11 -2
- package/src/components/QueryEditor.tsx +61 -6
- package/src/components/data-space/DataSpaceQuerySetup.tsx +1 -0
- package/src/components/data-space/LegendQueryDataSpaceQueryBuilder.tsx +2 -0
- package/src/index.ts +2 -0
- package/src/stores/QueryEditorStore.ts +5 -0
- package/tsconfig.json +1 -0
|
@@ -161,7 +161,8 @@ export interface LegendQueryApplicationConfigurationData
|
|
|
161
161
|
url: string;
|
|
162
162
|
};
|
|
163
163
|
legendAI?: {
|
|
164
|
-
url
|
|
164
|
+
url?: string;
|
|
165
|
+
agentURL?: string;
|
|
165
166
|
};
|
|
166
167
|
}
|
|
167
168
|
|
|
@@ -178,6 +179,7 @@ export class LegendQueryApplicationConfig extends LegendApplicationConfig {
|
|
|
178
179
|
readonly marketplaceProductionParallelUrl?: string;
|
|
179
180
|
readonly lakehouseContractUrl?: string;
|
|
180
181
|
readonly legendAIUrl?: string;
|
|
182
|
+
readonly legendAIAgentUrl?: string;
|
|
181
183
|
readonly studioInstances: LegendStudioApplicationInstanceConfigurationData[] =
|
|
182
184
|
[];
|
|
183
185
|
|
|
@@ -266,13 +268,20 @@ export class LegendQueryApplicationConfig extends LegendApplicationConfig {
|
|
|
266
268
|
);
|
|
267
269
|
}
|
|
268
270
|
|
|
269
|
-
// legend AI
|
|
271
|
+
// legend AI (AI-assisted features such as query title/description suggester)
|
|
270
272
|
if (input.configData.legendAI?.url) {
|
|
271
273
|
this.legendAIUrl = LegendApplicationConfig.resolveAbsoluteUrl(
|
|
272
274
|
input.configData.legendAI.url,
|
|
273
275
|
);
|
|
274
276
|
}
|
|
275
277
|
|
|
278
|
+
// legend AI agent chat
|
|
279
|
+
if (input.configData.legendAI?.agentURL) {
|
|
280
|
+
this.legendAIAgentUrl = LegendApplicationConfig.resolveAbsoluteUrl(
|
|
281
|
+
input.configData.legendAI.agentURL,
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
276
285
|
// options
|
|
277
286
|
this.options = LegendQueryApplicationCoreOptions.create(
|
|
278
287
|
input.configData.extensions?.core ?? {},
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
MoonIcon,
|
|
44
44
|
SunIcon,
|
|
45
45
|
SparkleIcon,
|
|
46
|
+
RobotIcon,
|
|
46
47
|
} from '@finos/legend-art';
|
|
47
48
|
import { observer } from 'mobx-react-lite';
|
|
48
49
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -57,7 +58,7 @@ import {
|
|
|
57
58
|
generateExistingQueryEditorRoute,
|
|
58
59
|
} from '../__lib__/LegendQueryNavigation.js';
|
|
59
60
|
import { ExistingQueryEditorStore } from '../stores/QueryEditorStore.js';
|
|
60
|
-
import {
|
|
61
|
+
import { LegendQueryAgentChatTelemetryHelper } from '../__lib__/LegendQueryAgentChatTelemetryHelper.js';
|
|
61
62
|
import {
|
|
62
63
|
LEGEND_APPLICATION_COLOR_THEME,
|
|
63
64
|
ReleaseLogManager,
|
|
@@ -186,7 +187,7 @@ const CreateQueryDialog = observer(() => {
|
|
|
186
187
|
if (!aiSuggester || !editorStore.queryBuilderState || !legendAIUrl) {
|
|
187
188
|
return;
|
|
188
189
|
}
|
|
189
|
-
|
|
190
|
+
LegendQueryAgentChatTelemetryHelper.logEvent_QueryAISuggestLaunched(
|
|
190
191
|
applicationStore.telemetryService,
|
|
191
192
|
);
|
|
192
193
|
setIsSuggestingWithAI(true);
|
|
@@ -199,7 +200,7 @@ const CreateQueryDialog = observer(() => {
|
|
|
199
200
|
setAISuggestion(suggestion);
|
|
200
201
|
} catch (error) {
|
|
201
202
|
assertErrorThrown(error);
|
|
202
|
-
|
|
203
|
+
LegendQueryAgentChatTelemetryHelper.logEvent_QueryAISuggestFailure(
|
|
203
204
|
applicationStore.telemetryService,
|
|
204
205
|
error.message,
|
|
205
206
|
);
|
|
@@ -224,7 +225,7 @@ const CreateQueryDialog = observer(() => {
|
|
|
224
225
|
if (!aiSuggestion) {
|
|
225
226
|
return;
|
|
226
227
|
}
|
|
227
|
-
|
|
228
|
+
LegendQueryAgentChatTelemetryHelper.logEvent_QueryAISuggestApplied(
|
|
228
229
|
applicationStore.telemetryService,
|
|
229
230
|
);
|
|
230
231
|
createQueryState.setQueryName(aiSuggestion.title);
|
|
@@ -232,7 +233,7 @@ const CreateQueryDialog = observer(() => {
|
|
|
232
233
|
setAISuggestion(undefined);
|
|
233
234
|
};
|
|
234
235
|
const discardAISuggestion = (): void => {
|
|
235
|
-
|
|
236
|
+
LegendQueryAgentChatTelemetryHelper.logEvent_QueryAISuggestDiscarded(
|
|
236
237
|
applicationStore.telemetryService,
|
|
237
238
|
);
|
|
238
239
|
setAISuggestion(undefined);
|
|
@@ -519,7 +520,7 @@ const RenameQueryDialog = observer(
|
|
|
519
520
|
setAISuggestion(suggestion);
|
|
520
521
|
} catch (error) {
|
|
521
522
|
assertErrorThrown(error);
|
|
522
|
-
|
|
523
|
+
LegendQueryAgentChatTelemetryHelper.logEvent_QueryAISuggestFailure(
|
|
523
524
|
applicationStore.telemetryService,
|
|
524
525
|
error.message,
|
|
525
526
|
);
|
|
@@ -1093,6 +1094,20 @@ export const QueryEditor = observer(() => {
|
|
|
1093
1094
|
);
|
|
1094
1095
|
};
|
|
1095
1096
|
|
|
1097
|
+
const toggleAgentChat = (): void => {
|
|
1098
|
+
const qbState = editorStore.queryBuilderState;
|
|
1099
|
+
if (!qbState) {
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
const nextOpened = !qbState.isAgentChatOpened;
|
|
1103
|
+
if (nextOpened) {
|
|
1104
|
+
LegendQueryAgentChatTelemetryHelper.logEvent_QueryAgentChatOpened(
|
|
1105
|
+
applicationStore.telemetryService,
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
qbState.setIsAgentChatOpened(nextOpened);
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1096
1111
|
// open the query version history (same viewer used by the query loader)
|
|
1097
1112
|
const showQueryHistory = (): void => {
|
|
1098
1113
|
if (editorStore instanceof ExistingQueryEditorStore) {
|
|
@@ -1165,6 +1180,46 @@ export const QueryEditor = observer(() => {
|
|
|
1165
1180
|
</div>
|
|
1166
1181
|
</div>
|
|
1167
1182
|
<div className="query-editor__header__action__content">
|
|
1183
|
+
{!isLoadingEditor &&
|
|
1184
|
+
!editorStore.queryBuilderState?.config
|
|
1185
|
+
?.TEMPORARY__disableQueryBuilderAgentChat &&
|
|
1186
|
+
editorStore.queryBuilderState?.canBuildQuery && (
|
|
1187
|
+
<button
|
|
1188
|
+
title={
|
|
1189
|
+
editorStore.queryBuilderState.isAgentChatOpened
|
|
1190
|
+
? 'Close Legend AI Agent Chat'
|
|
1191
|
+
: 'Open Legend AI Agent Chat'
|
|
1192
|
+
}
|
|
1193
|
+
onClick={toggleAgentChat}
|
|
1194
|
+
className={clsx(
|
|
1195
|
+
'query-editor__header__action query-editor__header__action__theme-toggler',
|
|
1196
|
+
{
|
|
1197
|
+
'query-editor__header__action--toggled':
|
|
1198
|
+
editorStore.queryBuilderState.isAgentChatOpened,
|
|
1199
|
+
},
|
|
1200
|
+
)}
|
|
1201
|
+
>
|
|
1202
|
+
<div
|
|
1203
|
+
className={
|
|
1204
|
+
applicationStore.layoutService
|
|
1205
|
+
.TEMPORARY__isLightColorThemeEnabled
|
|
1206
|
+
? 'query-editor__header__action__chat__label--light'
|
|
1207
|
+
: 'query-editor__header__action__chat__label--dark'
|
|
1208
|
+
}
|
|
1209
|
+
>
|
|
1210
|
+
Legend AI
|
|
1211
|
+
</div>
|
|
1212
|
+
<RobotIcon
|
|
1213
|
+
className={clsx(
|
|
1214
|
+
'query-editor__header__action__chat__icon',
|
|
1215
|
+
applicationStore.layoutService
|
|
1216
|
+
.TEMPORARY__isLightColorThemeEnabled
|
|
1217
|
+
? 'query-editor__header__action__chat__label--light'
|
|
1218
|
+
: 'query-editor__header__action__chat__label--dark',
|
|
1219
|
+
)}
|
|
1220
|
+
/>
|
|
1221
|
+
</button>
|
|
1222
|
+
)}
|
|
1168
1223
|
<button
|
|
1169
1224
|
title="Toggle light/dark mode"
|
|
1170
1225
|
onClick={TEMPORARY__toggleLightDarkMode}
|
|
@@ -87,6 +87,7 @@ const DataProductQuerySetupSetupPanelContent = observer(
|
|
|
87
87
|
const onDataSpaceOptionChange = (
|
|
88
88
|
option: DataSpaceOption | DataProductOption | null,
|
|
89
89
|
): void => {
|
|
90
|
+
queryBuilderState.queryAgentChatState?.abort();
|
|
90
91
|
const value = option?.value;
|
|
91
92
|
if (value instanceof ResolvedDataSpaceEntityWithOrigin) {
|
|
92
93
|
queryBuilderState.changeHandlers.onDataSpaceChange(value);
|
|
@@ -112,10 +112,12 @@ const LegendQueryDataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
112
112
|
}
|
|
113
113
|
const value = option.value;
|
|
114
114
|
if (value instanceof ResolvedDataSpaceEntityWithOrigin) {
|
|
115
|
+
queryBuilderState.queryAgentChatState?.abort();
|
|
115
116
|
queryBuilderState
|
|
116
117
|
.onDataSpaceChange(value)
|
|
117
118
|
.catch(queryBuilderState.applicationStore.alertUnhandledError);
|
|
118
119
|
} else if (value instanceof DepotEntityWithOrigin) {
|
|
120
|
+
queryBuilderState.queryAgentChatState?.abort();
|
|
119
121
|
queryBuilderState.onDataProductChange(value);
|
|
120
122
|
}
|
|
121
123
|
};
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export * from './application/LegendQueryPluginManager.js';
|
|
|
21
21
|
|
|
22
22
|
export * from './__lib__/LegendQueryEvent.js';
|
|
23
23
|
export * from './__lib__/LegendQueryEventHelper.js';
|
|
24
|
+
export { LegendQueryTelemetryHelper } from './__lib__/LegendQueryTelemetryHelper.js';
|
|
25
|
+
export { LegendQueryAgentChatTelemetryHelper } from './__lib__/LegendQueryAgentChatTelemetryHelper.js';
|
|
24
26
|
export {
|
|
25
27
|
generateExistingQueryEditorRoute,
|
|
26
28
|
generateServiceQueryCreatorRoute,
|
|
@@ -280,6 +280,7 @@ export class QueryCreatorState {
|
|
|
280
280
|
artifactId: query.artifactId,
|
|
281
281
|
versionId: query.versionId,
|
|
282
282
|
},
|
|
283
|
+
...queryBuilderState.getExtraTelemetryMetadata(),
|
|
283
284
|
},
|
|
284
285
|
);
|
|
285
286
|
queryBuilderState.changeDetectionState.initialize(rawLambda);
|
|
@@ -1764,6 +1765,7 @@ export class ExistingQueryUpdateState {
|
|
|
1764
1765
|
artifactId: query.artifactId,
|
|
1765
1766
|
versionId: query.versionId,
|
|
1766
1767
|
},
|
|
1768
|
+
...queryBuilderState.getExtraTelemetryMetadata(),
|
|
1767
1769
|
},
|
|
1768
1770
|
);
|
|
1769
1771
|
config.onQueryUpdate?.(updatedQuery);
|
|
@@ -1800,6 +1802,8 @@ export class ExistingQueryUpdateState {
|
|
|
1800
1802
|
`Successfully updated query!`,
|
|
1801
1803
|
);
|
|
1802
1804
|
|
|
1805
|
+
const extraTelemetryMetadata =
|
|
1806
|
+
this.editorStore.queryBuilderState?.getExtraTelemetryMetadata() ?? {};
|
|
1803
1807
|
LegendQueryTelemetryHelper.logEvent_UpdateQuerySucceeded(
|
|
1804
1808
|
this.editorStore.applicationStore.telemetryService,
|
|
1805
1809
|
{
|
|
@@ -1810,6 +1814,7 @@ export class ExistingQueryUpdateState {
|
|
|
1810
1814
|
artifactId: updatedQuery.artifactId,
|
|
1811
1815
|
versionId: updatedQuery.versionId,
|
|
1812
1816
|
},
|
|
1817
|
+
...extraTelemetryMetadata,
|
|
1813
1818
|
},
|
|
1814
1819
|
);
|
|
1815
1820
|
} catch (error) {
|
package/tsconfig.json
CHANGED
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"./src/index.ts",
|
|
55
55
|
"./src/__lib__/DSL_DataSpace_LegendQueryDocumentation.ts",
|
|
56
56
|
"./src/__lib__/DSL_DataSpace_LegendQueryNavigation.ts",
|
|
57
|
+
"./src/__lib__/LegendQueryAgentChatTelemetryHelper.ts",
|
|
57
58
|
"./src/__lib__/LegendQueryApplicationNavigationContext.ts",
|
|
58
59
|
"./src/__lib__/LegendQueryEvent.ts",
|
|
59
60
|
"./src/__lib__/LegendQueryEventHelper.ts",
|