Skip to content

Commit baeb4e6

Browse files
szwarckonradangorayckibanamachineflorent-leborgneviduni94
committed
[EDR Workflows]Automatic troubleshooting usage callout (elastic#224030)
Tracks elastic#221566 Closes elastic/security-team#12824 With this change, whenever a user selects the Elastic LLM connector within the Automatic Troubleshooting feature, they'll see a callout informing them about the potential costs of using it. Once the callout is acknowledged, it will be dismissed and the closed state will be stored in local storage, so it won’t appear again on future visits. To enable EIS locally: ``` export VAULT_ADDR=https://secrets.elastic.co:8200/ vault login --method=oidc node scripts/eis.js ``` and run ES server with provided env + start kibana with .dev.yaml entry from the output of the command above. https://github.com/user-attachments/assets/51a2ce77-ed25-4611-9d62-72e9d09bb789 --------- Co-authored-by: Angela Chuang <[email protected]> Co-authored-by: Angela Chuang <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: florent-leborgne <[email protected]> Co-authored-by: Viduni Wickramarachchi <[email protected]> (cherry picked from commit dfe6f54)
1 parent 46d7388 commit baeb4e6

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

x-pack/platform/packages/shared/kbn-elastic-assistant/impl/tour/common/hooks/use_tour_storage_key.test.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ const testFeatures = [
5252
NEW_FEATURES_TOUR_STORAGE_KEYS.CONVERSATION_CONNECTOR_ELASTIC_LLM
5353
],
5454
},
55+
{
56+
featureKey: NEW_FEATURES_TOUR_STORAGE_KEYS.ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING,
57+
expectedStorageKey:
58+
NEW_TOUR_FEATURES_TOUR_STORAGE_KEYS[
59+
NEW_FEATURES_TOUR_STORAGE_KEYS.ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING
60+
],
61+
},
5562
];
5663

5764
describe('useTourStorageKey', () => {

x-pack/platform/packages/shared/kbn-elastic-assistant/impl/tour/const.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export enum NEW_FEATURES_TOUR_STORAGE_KEYS {
1111
ELASTIC_LLM_USAGE_ATTACK_DISCOVERY = 'ELASTIC_LLM_USAGE_ATTACK_DISCOVERY',
1212
ELASTIC_LLM_USAGE_ATTACK_DISCOVERY_FLYOUT = 'ELASTIC_LLM_USAGE_ATTACK_DISCOVERY_FLYOUT',
1313
ELASTIC_LLM_USAGE_ASSISTANT_HEADER = 'ELASTIC_LLM_USAGE_ASSISTANT_HEADER',
14+
ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING = 'ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING',
1415
CONVERSATION_CONNECTOR_ELASTIC_LLM = 'CONVERSATION_CONNECTOR_ELASTIC_LLM',
1516
}
1617

@@ -26,4 +27,6 @@ export const NEW_TOUR_FEATURES_TOUR_STORAGE_KEYS: Record<NEW_FEATURES_TOUR_STORA
2627
'elasticAssistant.elasticLLM.costAwarenessTour.assistantHeader.v8.19',
2728
CONVERSATION_CONNECTOR_ELASTIC_LLM:
2829
'elasticAssistant.elasticLLM.conversation.costAwarenessTour.v8.19',
30+
ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING:
31+
'elasticAssistant.elasticLLM.costAwarenessTour.automaticTroubleshooting.v9.0',
2932
};

x-pack/solutions/security/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/components/insights/workflow_insights_scan.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ import {
1212
ConnectorSelectorInline,
1313
DEFAULT_ASSISTANT_NAMESPACE,
1414
useLoadConnectors,
15+
useAssistantContext,
16+
AssistantSpaceIdProvider,
1517
} from '@kbn/elastic-assistant';
1618
import { noop } from 'lodash/fp';
1719
import useLocalStorage from 'react-use/lib/useLocalStorage';
1820
import { some } from 'lodash';
1921
import { AssistantIcon } from '@kbn/ai-assistant-icon';
22+
import { ElasticLLMCostAwarenessTour } from '@kbn/elastic-assistant/impl/tour/elastic_llm';
23+
import { NEW_FEATURES_TOUR_STORAGE_KEYS } from '@kbn/elastic-assistant/impl/tour/const';
2024
import { useUserPrivileges } from '../../../../../../../common/components/user_privileges';
2125
import { useSpaceId } from '../../../../../../../common/hooks/use_space_id';
2226
import { WORKFLOW_INSIGHTS } from '../../../translations';
@@ -39,17 +43,20 @@ export const WorkflowInsightsScanSection = ({
3943
}: WorkflowInsightsScanSectionProps) => {
4044
const CONNECTOR_ID_LOCAL_STORAGE_KEY = 'connectorId';
4145

42-
const spaceId = useSpaceId() ?? 'default';
46+
const spaceId = useSpaceId();
4347
const { http } = useKibana().services;
4448
const { data: aiConnectors } = useLoadConnectors({
4549
http,
4650
});
4751
const { canWriteWorkflowInsights } = useUserPrivileges().endpointPrivileges;
52+
const { inferenceEnabled } = useAssistantContext();
4853

4954
// Store the selected connector id in local storage so that it persists across page reloads
5055
const [localStorageWorkflowInsightsConnectorId, setLocalStorageWorkflowInsightsConnectorId] =
5156
useLocalStorage<string>(
52-
`${DEFAULT_ASSISTANT_NAMESPACE}.${DEFEND_INSIGHTS_STORAGE_KEY}.${spaceId}.${CONNECTOR_ID_LOCAL_STORAGE_KEY}`
57+
`${DEFAULT_ASSISTANT_NAMESPACE}.${DEFEND_INSIGHTS_STORAGE_KEY}.${
58+
spaceId || 'default'
59+
}.${CONNECTOR_ID_LOCAL_STORAGE_KEY}`
5360
);
5461

5562
const [connectorId, setConnectorId] = React.useState<string | undefined>(
@@ -133,11 +140,24 @@ export const WorkflowInsightsScanSection = ({
133140
<EuiFlexItem grow={false}>
134141
<EuiFlexGroup alignItems="center" gutterSize="s">
135142
<EuiFlexItem grow={false}>
136-
<ConnectorSelectorInline
137-
onConnectorSelected={noop}
138-
onConnectorIdSelected={onConnectorIdSelected}
139-
selectedConnectorId={connectorId}
140-
/>
143+
{spaceId && (
144+
<AssistantSpaceIdProvider spaceId={spaceId}>
145+
<ElasticLLMCostAwarenessTour
146+
isDisabled={!inferenceEnabled}
147+
selectedConnectorId={connectorId}
148+
zIndex={1000}
149+
storageKey={
150+
NEW_FEATURES_TOUR_STORAGE_KEYS.ELASTIC_LLM_USAGE_AUTOMATIC_TROUBLESHOOTING
151+
}
152+
>
153+
<ConnectorSelectorInline
154+
onConnectorSelected={noop}
155+
onConnectorIdSelected={onConnectorIdSelected}
156+
selectedConnectorId={connectorId}
157+
/>
158+
</ElasticLLMCostAwarenessTour>
159+
</AssistantSpaceIdProvider>
160+
)}
141161
</EuiFlexItem>
142162
{scanButton}
143163
</EuiFlexGroup>

0 commit comments

Comments
 (0)