Skip to content

Commit ba5abbf

Browse files
[Agent Builder] add the agent-builder-platform plugin (elastic#244164)
## Summary Fix elastic/search-team#11943 - Create a plugin for platform tools and attachment types to dissociate the "framework" from the "platform stuff", to avoid cyclic dependencies issues. - Move tools and attachment types from `onechat` to `agent-builder-platform` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent 2884a57 commit ba5abbf

39 files changed

Lines changed: 374 additions & 88 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ x-pack/platform/plugins/private/translations @elastic/kibana-localization
10201020
x-pack/platform/plugins/private/upgrade_assistant @elastic/kibana-management
10211021
x-pack/platform/plugins/private/watcher @elastic/kibana-management
10221022
x-pack/platform/plugins/shared/actions @elastic/response-ops
1023+
x-pack/platform/plugins/shared/agent_builder_platform @elastic/workchat-eng
10231024
x-pack/platform/plugins/shared/ai_infra/llm_tasks @elastic/appex-ai-infra
10241025
x-pack/platform/plugins/shared/ai_infra/product_doc_base @elastic/appex-ai-infra
10251026
x-pack/platform/plugins/shared/aiops @elastic/ml-ui

docs/extend/plugin-list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ mapped_pages:
111111
| Name | Description |
112112
| --- | --- |
113113
| [actions](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/actions/README.md) | The Kibana actions plugin provides a framework to create executable actions. You can: |
114+
| [agentBuilderPlatform](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/agent_builder_platform/README.md) | Contains the platform-owned agent builder entities |
114115
| [aiops](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/aiops/README.md) | The plugin provides APIs and components for AIOps features, including the “Log rate analysis” UI, maintained by the ML team. |
115116
| [alerting](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/alerting/README.md) | The Kibana Alerting plugin provides a common place to set up rules. You can: |
116117
| [apm](https://github.com/elastic/kibana/blob/main/x-pack/solutions/observability/plugins/apm/readme.md) | This plugin provides access to App Monitoring features provided by Elastic. It allows you to monitor your software services and applications in real-time; visualize detailed performance information on your services, identify and analyze errors, and monitor host-level and APM agent-specific metrics like JVM and Go runtime metrics. |

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
"@kbn/actions-simulators-plugin": "link:x-pack/platform/test/alerting_api_integration/common/plugins/actions_simulators",
172172
"@kbn/actions-types": "link:src/platform/packages/shared/kbn-actions-types",
173173
"@kbn/advanced-settings-plugin": "link:src/platform/plugins/private/advanced_settings",
174+
"@kbn/agent-builder-platform-plugin": "link:x-pack/platform/plugins/shared/agent_builder_platform",
174175
"@kbn/ai-assistant": "link:x-pack/platform/packages/shared/kbn-ai-assistant",
175176
"@kbn/ai-assistant-common": "link:x-pack/platform/packages/shared/ai-assistant/common",
176177
"@kbn/ai-assistant-connector-selector-action": "link:x-pack/platform/packages/shared/ai-assistant/ai-assistant-connector-selector-action",

tsconfig.base.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"@kbn/actions-types/*": ["src/platform/packages/shared/kbn-actions-types/*"],
1515
"@kbn/advanced-settings-plugin": ["src/platform/plugins/private/advanced_settings"],
1616
"@kbn/advanced-settings-plugin/*": ["src/platform/plugins/private/advanced_settings/*"],
17+
"@kbn/agent-builder-platform-plugin": ["x-pack/platform/plugins/shared/agent_builder_platform"],
18+
"@kbn/agent-builder-platform-plugin/*": ["x-pack/platform/plugins/shared/agent_builder_platform/*"],
1719
"@kbn/ai-assistant": ["x-pack/platform/packages/shared/kbn-ai-assistant"],
1820
"@kbn/ai-assistant/*": ["x-pack/platform/packages/shared/kbn-ai-assistant/*"],
1921
"@kbn/ai-assistant-common": ["x-pack/platform/packages/shared/ai-assistant/common"],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# agentBuilderPlatform plugin
2+
3+
Contains the platform-owned agent builder entities
4+
- tools
5+
- attachment types
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
module.exports = {
9+
preset: '@kbn/test',
10+
rootDir: '../../../../..',
11+
roots: ['<rootDir>/x-pack/platform/plugins/shared/agent_builder_platform/server'],
12+
setupFiles: [],
13+
collectCoverage: true,
14+
collectCoverageFrom: [
15+
'<rootDir>/x-pack/platform/plugins/shared/agent_builder_platform/{public,server,common}/**/*.{js,ts,tsx}',
16+
],
17+
coverageReporters: ['html'],
18+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "plugin",
3+
"id": "@kbn/agent-builder-platform-plugin",
4+
"owner": "@elastic/workchat-eng",
5+
"group": "platform",
6+
"visibility": "shared",
7+
"plugin": {
8+
"id": "agentBuilderPlatform",
9+
"server": true,
10+
"browser": false,
11+
"configPath": ["xpack", "agentBuilderPlatform"],
12+
"requiredPlugins": ["onechat"],
13+
"requiredBundles": [],
14+
"optionalPlugins": ["workflowsManagement"],
15+
"extraPublicDirs": []
16+
}
17+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This file is generated by the @kbn/moon package. Any manual edits will be erased!
2+
# To extend this, write your extensions/overrides to 'moon.extend.yml'
3+
# then regenerate this file with: 'node scripts/regenerate_moon_projects.js --update --filter @kbn/agent-builder-platform-plugin'
4+
5+
$schema: https://moonrepo.dev/schemas/project.json
6+
id: '@kbn/agent-builder-platform-plugin'
7+
type: unknown
8+
owners:
9+
defaultOwner: '@elastic/workchat-eng'
10+
toolchain:
11+
default: node
12+
language: typescript
13+
project:
14+
name: '@kbn/agent-builder-platform-plugin'
15+
description: Moon project for @kbn/agent-builder-platform-plugin
16+
channel: ''
17+
owner: '@elastic/workchat-eng'
18+
metadata:
19+
sourceRoot: x-pack/platform/plugins/shared/agent_builder_platform
20+
dependsOn:
21+
- '@kbn/core'
22+
- '@kbn/logging'
23+
- '@kbn/config-schema'
24+
- '@kbn/workflows-management-plugin'
25+
- '@kbn/onechat-server'
26+
- '@kbn/lens-embeddable-utils'
27+
- '@kbn/onechat-genai-utils'
28+
- '@kbn/core-elasticsearch-server'
29+
- '@kbn/onechat-common'
30+
- '@kbn/zod'
31+
- '@kbn/management-settings-ids'
32+
- '@kbn/onechat-plugin'
33+
- '@kbn/core-lifecycle-server'
34+
- '@kbn/esql-validation-autocomplete'
35+
tags:
36+
- plugin
37+
- prod
38+
- group-platform
39+
- shared
40+
- jest-unit-tests
41+
fileGroups:
42+
src:
43+
- common/**/*
44+
- public/**/*
45+
- server/**/*
46+
- '!target/**/*'
47+
- '!.storybook/**/*.js'
48+
tasks:
49+
jest:
50+
args:
51+
- '--config'
52+
- $projectRoot/jest.config.js
53+
inputs:
54+
- '@group(src)'
55+
jestCI:
56+
args:
57+
- '--config'
58+
- $projectRoot/jest.config.js
59+
inputs:
60+
- '@group(src)'

x-pack/platform/plugins/shared/onechat/server/services/attachments/definitions/esql.ts renamed to x-pack/platform/plugins/shared/agent_builder_platform/server/attachment_types/esql.ts

File renamed without changes.

x-pack/platform/plugins/shared/onechat/server/services/attachments/definitions/index.ts renamed to x-pack/platform/plugins/shared/agent_builder_platform/server/attachment_types/index.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,32 @@
66
*/
77

88
import type { AttachmentTypeDefinition } from '@kbn/onechat-server/attachments';
9+
import type { CoreSetup } from '@kbn/core-lifecycle-server';
910
import { createTextAttachmentType } from './text';
1011
import { createEsqlAttachmentType } from './esql';
1112
import { createScreenContextAttachmentType } from './screen_context';
12-
import type { AttachmentServiceSetup } from '../types';
13+
import type {
14+
AgentBuilderPlatformPluginStart,
15+
PluginSetupDependencies,
16+
PluginStartDependencies,
17+
} from '../types';
18+
19+
export const registerAttachmentTypes = ({
20+
coreSetup,
21+
setupDeps,
22+
}: {
23+
coreSetup: CoreSetup<PluginStartDependencies, AgentBuilderPlatformPluginStart>;
24+
setupDeps: PluginSetupDependencies;
25+
}) => {
26+
const { onechat } = setupDeps;
1327

14-
export const registerAttachmentTypes = ({ registry }: { registry: AttachmentServiceSetup }) => {
1528
const attachmentTypes: AttachmentTypeDefinition<any, any>[] = [
1629
createTextAttachmentType(),
1730
createScreenContextAttachmentType(),
1831
createEsqlAttachmentType(),
1932
];
2033

2134
attachmentTypes.forEach((attachmentType) => {
22-
registry.registerType(attachmentType);
35+
onechat.attachments.registerType(attachmentType);
2336
});
2437
};

0 commit comments

Comments
 (0)