Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4836235
Default LLM selector in ai settings page
KDKHD Sep 3, 2025
0bc7a92
update copy
KDKHD Sep 3, 2025
934564b
add tests
KDKHD Sep 3, 2025
6b20e2e
make read only
KDKHD Sep 3, 2025
91bf90a
Merge branch '9.1' into feature/default-llm-setting-ai-settings
KDKHD Sep 3, 2025
1db981b
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 3, 2025
11446e9
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine Sep 3, 2025
fb7f61e
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 3, 2025
3583524
CI fix
KDKHD Sep 4, 2025
20aa90d
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Sep 4, 2025
644eea7
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine Sep 4, 2025
753c139
AI 4 soc
KDKHD Sep 4, 2025
4441745
Merge branch 'feature/default-llm-setting-ai-settings' of github.com:…
KDKHD Sep 4, 2025
1e49867
AI 4 soc tests
KDKHD Sep 4, 2025
90dd50e
AI 4 soc tests
KDKHD Sep 4, 2025
839de6a
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine Sep 4, 2025
4ff7093
fix tests
KDKHD Sep 4, 2025
cef2ccf
Merge branch 'feature/default-llm-setting-ai-settings' of github.com:…
KDKHD Sep 4, 2025
3c37216
[CI] Auto-commit changed files from 'node scripts/telemetry_check'
kibanamachine Sep 4, 2025
03bd42d
add feature flag
KDKHD Sep 4, 2025
7a4f409
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine Sep 4, 2025
7e714f0
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine Sep 4, 2025
ed2d819
ff
KDKHD Sep 5, 2025
e7a1426
Merge branch 'feature/default-llm-setting-ai-settings' of github.com:…
KDKHD Sep 5, 2025
7e0ba5f
tests
KDKHD Sep 5, 2025
bd5485e
test
KDKHD Sep 5, 2025
499e966
Merge branch '9.1' into feature/default-llm-setting-ai-settings
elasticmachine Sep 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
"@kbn/ai-assistant": "link:x-pack/platform/packages/shared/kbn-ai-assistant",
"@kbn/ai-assistant-common": "link:x-pack/platform/packages/shared/ai-assistant/common",
"@kbn/ai-assistant-cta": "link:x-pack/platform/packages/shared/ai-assistant/ai-assistant-cta",
"@kbn/ai-assistant-default-llm-setting": "link:x-pack/platform/packages/shared/ai-assistant-default-llm-setting",
"@kbn/ai-assistant-icon": "link:x-pack/platform/packages/shared/ai-assistant/icon",
"@kbn/ai-assistant-management-plugin": "link:src/platform/plugins/shared/ai_assistant_management/selection",
"@kbn/ai-security-labs-content": "link:x-pack/solutions/security/packages/ai-security-labs-content",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ export const OBSERVABILITY_AI_ASSISTANT_SIMULATED_FUNCTION_CALLING =
'observability:aiAssistantSimulatedFunctionCalling';
export const OBSERVABILITY_AI_ASSISTANT_SEARCH_CONNECTOR_INDEX_PATTERN =
'observability:aiAssistantSearchConnectorIndexPattern';
export const GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR = 'genAiSettings:defaultAIConnector';
export const GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY =
'genAiSettings:defaultAIConnectorOnly';
export const AI_ANONYMIZATION_SETTINGS = 'ai:anonymizationSettings';
export const OBSERVABILITY_SEARCH_EXCLUDED_DATA_TIERS = 'observability:searchExcludedDataTiers';
export const OBSERVABILITY_ENABLE_STREAMS_UI = 'observability:enableStreamsUI';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,18 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'keyword',
_meta: { description: 'Non-default value of setting.' },
},
'genAiSettings:defaultAIConnector': {
type: 'keyword',
_meta: {
description: 'Default AI connector',
},
},
'genAiSettings:defaultAIConnectorOnly': {
type: 'boolean',
_meta: {
description: 'Restrict to default AI connector only',
},
},
'observability:searchExcludedDataTiers': {
type: 'array',
items: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ export interface UsageStats {
'observability:apmEnableTransactionProfiling': boolean;
'devTools:enablePersistentConsole': boolean;
'aiAssistant:preferredAIAssistantType': string;
'genAiSettings:defaultAIConnector': string;
'genAiSettings:defaultAIConnectorOnly': boolean;
'securitySolution:excludedDataTiersForRuleExecution': string[];
'securitySolution:maxUnassociatedNotes': number;
'observability:searchExcludedDataTiers': string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const NO_DEFAULT_CONNECTOR = 'NO_DEFAULT_CONNECTOR';
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import { classicSetting } from './src/settings/classic_setting';
import { observabilitySolutionSetting } from './src/settings/observability_setting';
import { securitySolutionSetting } from './src/settings/security_setting';
import { AIAssistantManagementSelectionPlugin } from './plugin';
import {
GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY,
} from '@kbn/management-settings-ids';
import { NO_DEFAULT_CONNECTOR } from '../common/constants';

describe('plugin', () => {
beforeEach(() => {
Expand Down Expand Up @@ -73,14 +78,33 @@ describe('plugin', () => {
},
} as unknown as AIAssistantManagementSelectionPluginServerDependenciesSetup);

expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(1);
expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(3);

expect(coreSetup.uiSettings.register).toHaveBeenCalledWith({
[PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY]: {
...observabilitySolutionSetting,
value: AIAssistantType.Observability,
},
});

expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: NO_DEFAULT_CONNECTOR,
}),
})
);
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: false,
}),
})
);
});

it('registers correct uiSettings for serverless security', () => {
Expand All @@ -99,14 +123,33 @@ describe('plugin', () => {
},
} as unknown as AIAssistantManagementSelectionPluginServerDependenciesSetup);

expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(1);
expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(3);

expect(coreSetup.uiSettings.register).toHaveBeenCalledWith({
[PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY]: {
...securitySolutionSetting,
value: AIAssistantType.Security,
},
});

expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: NO_DEFAULT_CONNECTOR,
}),
})
);
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: false,
}),
})
);
});

it('registers correct uiSettings for serverless search', () => {
Expand All @@ -125,13 +168,31 @@ describe('plugin', () => {
},
} as unknown as AIAssistantManagementSelectionPluginServerDependenciesSetup);

expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(1);
expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(3);
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith({
[PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY]: {
...classicSetting,
value: AIAssistantType.Default,
},
});
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: NO_DEFAULT_CONNECTOR,
}),
})
);
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: false,
}),
})
);
});
});

Expand Down Expand Up @@ -177,13 +238,32 @@ describe('plugin', () => {

aiAssistantManagementSelectionPlugin.setup(coreSetup, setupDeps);

expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(1);
expect(coreSetup.uiSettings.register).toHaveBeenCalledTimes(3);
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith({
[PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY]: {
...classicSetting,
value: AIAssistantType.Observability,
},
});

expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: NO_DEFAULT_CONNECTOR,
}),
})
);
expect(coreSetup.uiSettings.register).toHaveBeenCalledWith(
expect.objectContaining({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY]: expect.objectContaining({
readonlyMode: 'ui',
readonly: false,
value: false,
}),
})
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {
DEFAULT_APP_CATEGORIES,
} from '@kbn/core/server';
import { KibanaFeatureScope } from '@kbn/features-plugin/common';
import {
GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR,
GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY,
} from '@kbn/management-settings-ids';
import { schema } from '@kbn/config-schema';
import type { AIAssistantManagementSelectionConfig } from './config';
import type {
AIAssistantManagementSelectionPluginServerDependenciesSetup,
Expand All @@ -25,6 +30,7 @@ import type {
AIAssistantManagementSelectionPluginServerStart,
} from './types';
import { PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY } from '../common/ui_setting_keys';
import { NO_DEFAULT_CONNECTOR } from '../common/constants';
import { classicSetting } from './src/settings/classic_setting';
import { observabilitySolutionSetting } from './src/settings/observability_setting';
import { securitySolutionSetting } from './src/settings/security_setting';
Expand All @@ -49,18 +55,6 @@ export class AIAssistantManagementSelectionPlugin
core: CoreSetup,
plugins: AIAssistantManagementSelectionPluginServerDependenciesSetup
) {
core.capabilities.registerProvider(() => {
return {
management: {
kibana: {
aiAssistantManagementSelection: true,
observabilityAiAssistantManagement: true,
securityAiAssistantManagement: true,
},
},
};
});

plugins.features?.registerKibanaFeature({
id: 'aiAssistantManagementSelection',
name: i18n.translate('aiAssistantManagementSelection.featureRegistry.featureName', {
Expand Down Expand Up @@ -119,6 +113,36 @@ export class AIAssistantManagementSelectionPlugin
core: CoreSetup,
plugins: AIAssistantManagementSelectionPluginServerDependenciesSetup
) {
core.uiSettings.register({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR]: {
readonlyMode: 'ui',
readonly: false,
schema: schema.string(),
value: NO_DEFAULT_CONNECTOR,
},
});

core.uiSettings.register({
[GEN_AI_SETTINGS_DEFAULT_AI_CONNECTOR_DEFAULT_ONLY]: {
readonlyMode: 'ui',
readonly: false,
schema: schema.boolean(),
value: false,
},
});

core.capabilities.registerProvider(() => {
return {
management: {
kibana: {
aiAssistantManagementSelection: true,
observabilityAiAssistantManagement: true,
securityAiAssistantManagement: true,
},
},
};
});

const { cloud } = plugins;
const serverlessProjectType = cloud?.serverless.projectType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"@kbn/doc-links",
"@kbn/core-ui-settings-common",
"@kbn/cloud-plugin",
"@kbn/licensing-plugin"
"@kbn/licensing-plugin",
"@kbn/management-settings-ids"
],
"exclude": ["target/**/*"]
}
12 changes: 12 additions & 0 deletions src/platform/plugins/shared/telemetry/schema/oss_platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -11545,6 +11545,18 @@
"description": "Non-default value of setting."
}
},
"genAiSettings:defaultAIConnector": {
"type": "keyword",
"_meta": {
"description": "Default AI connector"
}
},
"genAiSettings:defaultAIConnectorOnly": {
"type": "boolean",
"_meta": {
"description": "Restrict to default AI connector only"
}
},
"observability:searchExcludedDataTiers": {
"type": "array",
"items": {
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"@kbn/ai-assistant-common/*": ["x-pack/platform/packages/shared/ai-assistant/common/*"],
"@kbn/ai-assistant-cta": ["x-pack/platform/packages/shared/ai-assistant/ai-assistant-cta"],
"@kbn/ai-assistant-cta/*": ["x-pack/platform/packages/shared/ai-assistant/ai-assistant-cta/*"],
"@kbn/ai-assistant-default-llm-setting": ["x-pack/platform/packages/shared/ai-assistant-default-llm-setting"],
"@kbn/ai-assistant-default-llm-setting/*": ["x-pack/platform/packages/shared/ai-assistant-default-llm-setting/*"],
"@kbn/ai-assistant-icon": ["x-pack/platform/packages/shared/ai-assistant/icon"],
"@kbn/ai-assistant-icon/*": ["x-pack/platform/packages/shared/ai-assistant/icon/*"],
"@kbn/ai-assistant-management-plugin": ["src/platform/plugins/shared/ai_assistant_management/selection"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @kbn/ai-assistant-default-llm-setting

UI components for setting to configure default LLM.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { DefaultAIConnector } from './src/components/default_ai_connector';
export {
DefaultAiConnectorSettingsContextProvider,
useDefaultAiConnectorSettingContext,
} from './src/context/default_ai_connector_context';
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

module.exports = {
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/packages/kbn_ai_assistant_src',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/x-pack/platform/packages/shared/kbn-ai-assistant/src/**/*.{ts,tsx}',
'!<rootDir>/x-pack/platform/packages/shared/kbn-ai-assistant/src/*.test.{ts,tsx}',
],
preset: '@kbn/test',
rootDir: '../../../../..',
roots: ['<rootDir>/x-pack/platform/packages/shared/ai-assistant-default-llm-setting'],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "shared-browser",
"id": "@kbn/ai-assistant-default-llm-setting",
"owner": ["@elastic/security-generative-ai"],
"group": "platform",
"visibility": "shared"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/ai-assistant-default-llm-setting",
"description": "Default LLM settings for AI Assistant",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
Loading