[Search] Search assistant plugin setup (#190633)

## Summary

Introducing new plugin for search assistant. in the future this will be
extension of Observability AI solution solution
[plugin](https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability_solution/observability_ai_assistant)

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Sander Philipse <sander.philipse@elastic.co>
This commit is contained in:
Saarika Bhasi 2024-08-22 07:27:33 -04:00 committed by GitHub
parent cdcdfddd3f
commit a524e27bed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 308 additions and 0 deletions

1
.github/CODEOWNERS vendored
View file

@ -733,6 +733,7 @@ src/plugins/screenshot_mode @elastic/appex-sharedux
x-pack/examples/screenshotting_example @elastic/appex-sharedux
x-pack/plugins/screenshotting @elastic/kibana-reporting-services
packages/kbn-search-api-panels @elastic/search-kibana
x-pack/plugins/search_assistant @elastic/search-kibana
packages/kbn-search-connectors @elastic/search-kibana
x-pack/plugins/search_connectors @elastic/search-kibana
packages/kbn-search-errors @elastic/kibana-data-discovery

View file

@ -795,6 +795,10 @@ Elastic.
It uses Chromium and Puppeteer underneath to run the browser in headless mode.
|{kib-repo}blob/{branch}/x-pack/plugins/search_assistant/README.md[searchAssistant]
|This holds the Search AI Assistant which targets Search users and Serverless Elasticsearch.
|{kib-repo}blob/{branch}/x-pack/plugins/search_connectors/README.mdx[searchConnectors]
|This plugin contains common assets and endpoints for the use of connectors in Kibana. Primarily used by the enterprise_search and serverless_search plugins.

View file

@ -751,6 +751,7 @@
"@kbn/screenshotting-example-plugin": "link:x-pack/examples/screenshotting_example",
"@kbn/screenshotting-plugin": "link:x-pack/plugins/screenshotting",
"@kbn/search-api-panels": "link:packages/kbn-search-api-panels",
"@kbn/search-assistant": "link:x-pack/plugins/search_assistant",
"@kbn/search-connectors": "link:packages/kbn-search-connectors",
"@kbn/search-connectors-plugin": "link:x-pack/plugins/search_connectors",
"@kbn/search-errors": "link:packages/kbn-search-errors",

View file

@ -136,6 +136,7 @@ pageLoadAssetSize:
savedSearch: 16225
screenshotMode: 17856
screenshotting: 22870
searchAssistant: 19831
searchConnectors: 30000
searchHomepage: 19831
searchInferenceEndpoints: 20470

View file

@ -1460,6 +1460,8 @@
"@kbn/screenshotting-plugin/*": ["x-pack/plugins/screenshotting/*"],
"@kbn/search-api-panels": ["packages/kbn-search-api-panels"],
"@kbn/search-api-panels/*": ["packages/kbn-search-api-panels/*"],
"@kbn/search-assistant": ["x-pack/plugins/search_assistant"],
"@kbn/search-assistant/*": ["x-pack/plugins/search_assistant/*"],
"@kbn/search-connectors": ["packages/kbn-search-connectors"],
"@kbn/search-connectors/*": ["packages/kbn-search-connectors/*"],
"@kbn/search-connectors-plugin": ["x-pack/plugins/search_connectors"],

View file

@ -105,6 +105,7 @@
"xpack.searchNotebooks": "plugins/search_notebooks",
"xpack.searchPlayground": "plugins/search_playground",
"xpack.searchInferenceEndpoints": "plugins/search_inference_endpoints",
"xpack.searchAssistant": "plugins/search_assistant",
"xpack.searchProfiler": "plugins/searchprofiler",
"xpack.security": ["plugins/security", "packages/security"],
"xpack.server": "legacy/server",

View file

@ -0,0 +1,3 @@
# SearchAssistant
This holds the Search AI Assistant which targets Search users and Serverless Elasticsearch.

View file

@ -0,0 +1,8 @@
/*
* 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 const PLUGIN_ID = 'searchAssistant';
export const PLUGIN_NAME = 'searchAssistant';

View file

@ -0,0 +1,24 @@
{
"type": "plugin",
"id": "@kbn/search-assistant",
"owner": "@elastic/search-kibana",
"description": "AI Assistant for Search",
"plugin": {
"id": "searchAssistant",
"server": true,
"browser": true,
"configPath": [
"xpack",
"searchAssistant"
],
"requiredPlugins": [
"observabilityAIAssistant",
"observabilityAIAssistantApp"
],
"optionalPlugins": [
"cloud",
"usageCollection",
],
"requiredBundles": []
}
}

View file

@ -0,0 +1,37 @@
/*
* 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.
*/
import React from 'react';
import ReactDOM from 'react-dom';
import type { CoreStart } from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { I18nProvider } from '@kbn/i18n-react';
import { Router } from '@kbn/shared-ux-router';
import type { SearchAssistantPluginStartDependencies } from './types';
import { SearchAssistantRouter } from './router';
export const renderApp = (
core: CoreStart,
services: SearchAssistantPluginStartDependencies,
element: HTMLElement
) => {
ReactDOM.render(
<KibanaRenderContextProvider {...core}>
<KibanaContextProvider services={{ ...core, ...services }}>
<I18nProvider>
<Router history={services.history}>
<SearchAssistantRouter />
</Router>
</I18nProvider>
</KibanaContextProvider>
</KibanaRenderContextProvider>,
element
);
return () => ReactDOM.unmountComponentAtNode(element);
};

View file

@ -0,0 +1,15 @@
/*
* 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.
*/
import React from 'react';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
export const App: React.FC = () => {
return (
<KibanaPageTemplate.Section alignment="top" restrictWidth={false} grow paddingSize="none">
<div />
</KibanaPageTemplate.Section>
);
};

View file

@ -0,0 +1,24 @@
/*
* 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.
*/
import { EuiPageTemplate } from '@elastic/eui';
import React from 'react';
import { App } from './app';
export const SearchAssistantPage: React.FC = () => {
return (
<EuiPageTemplate
offset={0}
restrictWidth={false}
data-test-subj="svlSearchAssistantPage"
grow={false}
panelled={false}
>
<App />
</EuiPageTemplate>
);
};

View file

@ -0,0 +1,13 @@
/*
* 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.
*/
import { SearchAssistantPlugin } from './plugin';
export function plugin() {
return new SearchAssistantPlugin();
}
export type { SearchAssistantPluginSetup, SearchAssistantPluginStart } from './types';

View file

@ -0,0 +1,29 @@
/*
* 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.
*/
import type { CoreSetup, Plugin } from '@kbn/core/public';
import type {
SearchAssistantPluginSetup,
SearchAssistantPluginStart,
SearchAssistantPluginStartDependencies,
} from './types';
export class SearchAssistantPlugin
implements Plugin<SearchAssistantPluginSetup, SearchAssistantPluginStart>
{
public setup(
core: CoreSetup<SearchAssistantPluginStartDependencies, SearchAssistantPluginStart>
): SearchAssistantPluginSetup {
return {};
}
public start(): SearchAssistantPluginStart {
return {};
}
public stop() {}
}

View file

@ -0,0 +1,20 @@
/*
* 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.
*/
import { Route, Routes } from '@kbn/shared-ux-router';
import React from 'react';
import { SearchAssistantPage } from './components/search_assistant';
export const SearchAssistantRouter: React.FC = () => {
return (
<Routes>
<Route>
<SearchAssistantPage />
</Route>
</Routes>
);
};

View file

@ -0,0 +1,22 @@
/*
* 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.
*/
import { AppMountParameters } from '@kbn/core/public';
import { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
import { ObservabilityAIAssistantPublicStart } from '@kbn/observability-ai-assistant-plugin/public';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SearchAssistantPluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SearchAssistantPluginStart {}
export interface SearchAssistantPluginStartDependencies {
history: AppMountParameters['history'];
observabilityAIAssistant: ObservabilityAIAssistantPublicStart;
usageCollection?: UsageCollectionStart;
}

View file

@ -0,0 +1,19 @@
/*
* 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.
*/
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor } from '@kbn/core/server';
const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: false }),
});
export type SearchAssistantConfig = TypeOf<typeof configSchema>;
export const config: PluginConfigDescriptor<SearchAssistantConfig> = {
schema: configSchema,
};

View file

@ -0,0 +1,15 @@
/*
* 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.
*/
import { SearchAssistantPlugin } from './plugin';
export { config } from './config';
export function plugin() {
return new SearchAssistantPlugin();
}
export type { SearchAssistantPluginSetup, SearchAssistantPluginStart } from './types';

View file

@ -0,0 +1,26 @@
/*
* 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.
*/
import type { Plugin } from '@kbn/core/server';
import type { SearchAssistantPluginSetup, SearchAssistantPluginStart } from './types';
export class SearchAssistantPlugin
implements Plugin<SearchAssistantPluginSetup, SearchAssistantPluginStart>
{
constructor() {}
public setup() {
return {};
}
public start() {
return {};
}
public stop() {}
}

View file

@ -0,0 +1,11 @@
/*
* 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 @typescript-eslint/no-empty-interface
export interface SearchAssistantPluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SearchAssistantPluginStart {}

View file

@ -0,0 +1,28 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types"
},
"include": [
"index.ts",
"common/**/*.ts",
"public/**/*.ts",
"public/**/*.tsx",
"server/**/*.ts",
"../../typings/**/*"
],
"kbn_references": [
"@kbn/core",
"@kbn/react-kibana-context-render",
"@kbn/kibana-react-plugin",
"@kbn/i18n-react",
"@kbn/shared-ux-router",
"@kbn/shared-ux-page-kibana-template",
"@kbn/usage-collection-plugin",
"@kbn/observability-ai-assistant-plugin",
"@kbn/config-schema"
],
"exclude": [
"target/**/*",
]
}

View file

@ -6216,6 +6216,10 @@
version "0.0.0"
uid ""
"@kbn/search-assistant@link:x-pack/plugins/search_assistant":
version "0.0.0"
uid ""
"@kbn/search-connectors-plugin@link:x-pack/plugins/search_connectors":
version "0.0.0"
uid ""