From c00c45ef188adbe6a7c3783c4038769243fa1cda Mon Sep 17 00:00:00 2001 From: Sean Story Date: Fri, 1 May 2026 13:13:46 -0500 Subject: [PATCH] feat(agent-builder): add connector_ids to AgentConfiguration type Co-Authored-By: Claude Opus 4.6 feat(agent-builder): add connector_ids to agent storage mapping Co-Authored-By: Claude Opus 4.6 feat(agent-builder): plumb connector_ids through agent converters Co-Authored-By: Claude Opus 4.6 feat(agent-builder): add connector_ids to agent CRUD API schemas Co-Authored-By: Claude Opus 4.6 feat(agent_context_layer): add connectorIds filter to SmlService.search() Adds optional `connectorIds` param to `SmlService.search()` and `AgentContextLayerPluginStart.search()`. When provided, builds an ES bool filter that restricts connector-type SML results to those with a matching `origin_id`, while non-connector results pass through unaffected. Exports `buildConnectorFilter` for unit-test coverage. Co-Authored-By: Claude Opus 4.6 feat(agent-builder): sml_search tool filters connectors by agent connector_ids Resolves the executing agent's connector_ids from the run context at search time and forwards them to agentContextLayer.search(), enabling per-agent connector scoping in SML search results. Co-Authored-By: Claude Opus 4.6 feat(agent-context-layer): accept connector_ids in SML HTTP search endpoint Co-Authored-By: Claude Opus 4.6 feat(agent-builder): frontend SML search passes connector_ids for agent-scoped filtering Threads the active agent's connector_ids through SmlService.search(), useSmlSearch hook, the SML command menu component, and the prefetch hook so that SML results are filtered to the agent's configured connectors. Co-Authored-By: Claude Opus 4.6 fix(agent-builder): make getAgentsService optional in SmlToolsOptions and apply lint fixes Co-Authored-By: Claude Opus 4.6 Refactor connector_ids under a top-level 'filters' Ensure that we can configure agents to not allow any connectors Types fixing Pass AgentConfiguration through ToolHandlerContext Ensure agentConfiguration considers configurationOverrides for tool context Changes from make api-docs --- oas_docs/output/kibana.serverless.yaml | 14 +++ oas_docs/output/kibana.yaml | 14 +++ .../agent-builder-common/agents/definition.ts | 7 ++ .../agent-builder-server/tools/handler.ts | 6 ++ .../command_menu/menus/sml/sml.test.tsx | 8 ++ .../command_menu/menus/sml/sml.tsx | 8 +- .../menus/sml/use_prefetch_sml.ts | 8 +- .../command_menu/use_command_menu_prefetch.ts | 33 +++++-- .../command_menu/utils/sml_filters.ts | 22 +++++ .../application/hooks/sml/use_sml_search.ts | 7 +- .../public/application/query_keys.ts | 6 +- .../public/services/sml/sml_service.ts | 7 +- .../agent_builder/server/routes/agents.ts | 12 +++ .../agents/persisted/client/converters.ts | 2 + .../agents/persisted/client/storage.ts | 2 + .../execution/run_agent/create_handler.ts | 8 +- .../services/execution/runner/run_agent.ts | 10 +- .../services/execution/runner/run_tool.ts | 1 + .../services/execution/runner/runner.ts | 4 +- .../tools/builtin/sml/sml_search.test.ts | 71 ++++++++++++++ .../services/tools/builtin/sml/sml_search.ts | 10 +- .../services/tools/builtin/sml/types.ts | 3 +- .../common/http_api/sml.ts | 14 +++ .../agent_context_layer/public/index.ts | 8 +- .../agent_context_layer/server/index.ts | 2 + .../server/routes/search.ts | 13 ++- .../services/sml/sml_connector_filter.test.ts | 59 ++++++++++++ .../server/services/sml/sml_service.ts | 92 +++++++++++++++++-- .../server/services/sml/types.ts | 9 ++ .../agent_context_layer/server/types.ts | 2 + 30 files changed, 421 insertions(+), 41 deletions(-) create mode 100644 x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/utils/sml_filters.ts create mode 100644 x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_connector_filter.test.ts diff --git a/oas_docs/output/kibana.serverless.yaml b/oas_docs/output/kibana.serverless.yaml index b2459872d80a7..fecdca4a19fd5 100644 --- a/oas_docs/output/kibana.serverless.yaml +++ b/oas_docs/output/kibana.serverless.yaml @@ -1418,6 +1418,13 @@ paths: description: Configuration settings for the agent. type: object properties: + connector_ids: + description: Array of connector IDs to associate with the agent. + items: + description: Connector ID to associate with the agent. + type: string + maxItems: 100 + type: array enable_elastic_capabilities: description: When true, enables built-in Elastic capabilities for the agent. type: boolean @@ -1906,6 +1913,13 @@ paths: description: Updated configuration settings for the agent. type: object properties: + connector_ids: + description: Array of connector IDs to associate with the agent. + items: + description: Connector ID to associate with the agent. + type: string + maxItems: 100 + type: array enable_elastic_capabilities: description: When true, enables built-in Elastic capabilities for the agent. type: boolean diff --git a/oas_docs/output/kibana.yaml b/oas_docs/output/kibana.yaml index 9d6b067cc1b95..cf1833e7b52d5 100644 --- a/oas_docs/output/kibana.yaml +++ b/oas_docs/output/kibana.yaml @@ -1488,6 +1488,13 @@ paths: description: Configuration settings for the agent. type: object properties: + connector_ids: + description: Array of connector IDs to associate with the agent. + items: + description: Connector ID to associate with the agent. + type: string + maxItems: 100 + type: array enable_elastic_capabilities: description: When true, enables built-in Elastic capabilities for the agent. type: boolean @@ -1976,6 +1983,13 @@ paths: description: Updated configuration settings for the agent. type: object properties: + connector_ids: + description: Array of connector IDs to associate with the agent. + items: + description: Connector ID to associate with the agent. + type: string + maxItems: 100 + type: array enable_elastic_capabilities: description: When true, enables built-in Elastic capabilities for the agent. type: boolean diff --git a/x-pack/platform/packages/shared/agent-builder/agent-builder-common/agents/definition.ts b/x-pack/platform/packages/shared/agent-builder/agent-builder-common/agents/definition.ts index 49ce9aac45171..88d7add653849 100644 --- a/x-pack/platform/packages/shared/agent-builder/agent-builder-common/agents/definition.ts +++ b/x-pack/platform/packages/shared/agent-builder/agent-builder-common/agents/definition.ts @@ -117,6 +117,13 @@ export interface AgentConfiguration { */ plugin_ids?: string[]; + /** + * Optional list of connector IDs associated with this agent. + * When set, SML search filters connector results to only those in this list. + * When undefined, all connectors remain visible (backward compatibility). + */ + connector_ids?: string[]; + /** * Custom configuration for the research step of the agent. */ diff --git a/x-pack/platform/packages/shared/agent-builder/agent-builder-server/tools/handler.ts b/x-pack/platform/packages/shared/agent-builder/agent-builder-server/tools/handler.ts index 5921db05d7dd1..8aeb2152652aa 100644 --- a/x-pack/platform/packages/shared/agent-builder/agent-builder-server/tools/handler.ts +++ b/x-pack/platform/packages/shared/agent-builder/agent-builder-server/tools/handler.ts @@ -13,6 +13,7 @@ import type { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-ser import type { ToolResult } from '@kbn/agent-builder-common/tools/tool_result'; import type { PromptRequest } from '@kbn/agent-builder-common/agents/prompts'; import type { AgentExecutionMode } from '@kbn/agent-builder-common'; +import type { AgentConfiguration } from '@kbn/agent-builder-common'; import type { ToolEventEmitter, ModelProvider, @@ -167,4 +168,9 @@ export interface ToolHandlerContext { * When 'standalone', the execution is non-interactive (HITL disabled). */ executionMode?: AgentExecutionMode; + /** + * The effective agent configuration for the current run, with any + * runtime configuration overrides already applied. + */ + agentConfiguration?: AgentConfiguration; } diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.test.tsx b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.test.tsx index 45a064cef37ac..9e03ed3dc1117 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.test.tsx +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.test.tsx @@ -48,6 +48,14 @@ jest.mock('../../../../../../../hooks/sml/use_sml_search', () => ({ useSmlSearch: () => mockUseSmlSearchReturn, })); +jest.mock('../../../../../../../hooks/use_conversation', () => ({ + useAgentId: () => 'test-agent-id', +})); + +jest.mock('../../../../../../../hooks/agents/use_agent_by_id', () => ({ + useAgentBuilderAgentById: () => ({ agent: null, isLoading: false, error: null }), +})); + beforeEach(() => { mockUseSmlSearchReturn = { results: defaultMockResults, diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.tsx b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.tsx index bf16dda696c9c..a896855f0ff1e 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.tsx +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/sml.tsx @@ -9,16 +9,22 @@ import React, { forwardRef, useCallback, useMemo } from 'react'; import { css } from '@emotion/react'; import { EuiHighlight, useEuiTheme } from '@elastic/eui'; import { useSmlSearch } from '../../../../../../../hooks/sml/use_sml_search'; +import { useAgentId } from '../../../../../../../hooks/use_conversation'; +import { useAgentBuilderAgentById } from '../../../../../../../hooks/agents/use_agent_by_id'; import type { CommandMenuComponentProps, CommandMenuHandle } from '../../types'; import { CommandId } from '../../types'; import { getSmlMenuHighlightSearchStrings } from '../../utils/sml_command_menu_highlight'; +import { buildSmlFiltersFromAgent } from '../../utils/sml_filters'; import { CommandMenuList } from '../components/command_menu_list'; import type { CommandMenuListOption } from '../components/command_menu_list'; export const Sml = forwardRef( ({ query, onSelect }, ref) => { + const agentId = useAgentId(); + const { agent } = useAgentBuilderAgentById(agentId); + const filters = useMemo(() => buildSmlFiltersFromAgent(agent), [agent]); const { euiTheme } = useEuiTheme(); - const { results, isLoading } = useSmlSearch(query, { skipContent: true }); + const { results, isLoading } = useSmlSearch(query, { skipContent: true, filters }); const { type, title } = useMemo(() => getSmlMenuHighlightSearchStrings(query), [query]); const smlMenuLabelStyles = useMemo( diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/use_prefetch_sml.ts b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/use_prefetch_sml.ts index 5c1718dea7d71..21c8510b23cdc 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/use_prefetch_sml.ts +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/menus/sml/use_prefetch_sml.ts @@ -7,12 +7,13 @@ import { useCallback } from 'react'; import { useQueryClient } from '@kbn/react-query'; +import type { SmlSearchFilters } from '@kbn/agent-context-layer-plugin/public'; import { SML_SEARCH_DEFAULT_SIZE } from '../../../../../../../../services/sml/constants'; import { queryKeys } from '../../../../../../../query_keys'; import { useAgentBuilderServices } from '../../../../../../../hooks/use_agent_builder_service'; import { useExperimentalFeatures } from '../../../../../../../hooks/use_experimental_features'; -export const usePrefetchSml = () => { +export const usePrefetchSml = (filters?: SmlSearchFilters) => { const queryClient = useQueryClient(); const { smlService } = useAgentBuilderServices(); const experimentalFeaturesEnabled = useExperimentalFeatures(); @@ -22,13 +23,14 @@ export const usePrefetchSml = () => { return; } queryClient.prefetchQuery({ - queryKey: queryKeys.sml.search('*', true), + queryKey: queryKeys.sml.search('*', true, filters), queryFn: () => smlService.search({ query: '*', size: SML_SEARCH_DEFAULT_SIZE, skipContent: true, + filters, }), }); - }, [experimentalFeaturesEnabled, queryClient, smlService]); + }, [experimentalFeaturesEnabled, queryClient, smlService, filters]); }; diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/use_command_menu_prefetch.ts b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/use_command_menu_prefetch.ts index 51c86e16a8c85..12a981227a192 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/use_command_menu_prefetch.ts +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/use_command_menu_prefetch.ts @@ -5,25 +5,40 @@ * 2.0. */ -import { useCallback, useRef } from 'react'; +import { useCallback, useMemo, useRef } from 'react'; import { usePrefetchSkills } from './menus/skills/use_prefetch_skills'; import { usePrefetchSml } from './menus/sml/use_prefetch_sml'; +import { useAgentId } from '../../../../../hooks/use_conversation'; +import { useAgentBuilderAgentById } from '../../../../../hooks/agents/use_agent_by_id'; +import { buildSmlFiltersFromAgent } from './utils/sml_filters'; /** * Prefetches data for all command menus on first invocation. + * Re-prefetches SML when the agent's filters change (e.g. after the async + * agent fetch resolves with connector_ids). * Returns a callback that should be called when the editor receives focus. */ +const NOT_YET_PREFETCHED = Symbol('not-yet-prefetched'); + export const useCommandMenuPrefetch = () => { - const hasPrefetched = useRef(false); + const hasPrefetchedSkills = useRef(false); + const lastSmlFiltersJson = useRef(NOT_YET_PREFETCHED); + const agentId = useAgentId(); + const { agent } = useAgentBuilderAgentById(agentId); + const filters = useMemo(() => buildSmlFiltersFromAgent(agent), [agent]); const prefetchSkills = usePrefetchSkills(); - const prefetchSml = usePrefetchSml(); + const prefetchSml = usePrefetchSml(filters); return useCallback(() => { - if (hasPrefetched.current) { - return; + if (!hasPrefetchedSkills.current) { + hasPrefetchedSkills.current = true; + prefetchSkills(); + } + + const filtersJson = filters ? JSON.stringify(filters) : ''; + if (filtersJson !== lastSmlFiltersJson.current) { + lastSmlFiltersJson.current = filtersJson; + prefetchSml(); } - hasPrefetched.current = true; - prefetchSkills(); - prefetchSml(); - }, [prefetchSkills, prefetchSml]); + }, [prefetchSkills, prefetchSml, filters]); }; diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/utils/sml_filters.ts b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/utils/sml_filters.ts new file mode 100644 index 0000000000000..79ed9106f9d6e --- /dev/null +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/components/conversations/conversation_input/message_editor/command_menu/utils/sml_filters.ts @@ -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 type { AgentDefinition } from '@kbn/agent-builder-common/agents/definition'; +import type { SmlSearchFilters } from '@kbn/agent-context-layer-plugin/public'; +import { SmlSearchFilterType } from '@kbn/agent-context-layer-plugin/public'; + +// Three states: undefined → no filtering (all connectors visible), +// [] → no connectors allowed, ['id1', ...] → only those connectors. +export const buildSmlFiltersFromAgent = ( + agent: AgentDefinition | null +): SmlSearchFilters | undefined => { + const connectorIds = agent?.configuration?.connector_ids; + if (connectorIds === undefined) { + return undefined; + } + return { [SmlSearchFilterType.connector]: { ids: connectorIds } }; +}; diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/hooks/sml/use_sml_search.ts b/x-pack/platform/plugins/shared/agent_builder/public/application/hooks/sml/use_sml_search.ts index 6c4edb9d6bc53..f0dec6e0b34c8 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/application/hooks/sml/use_sml_search.ts +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/hooks/sml/use_sml_search.ts @@ -10,6 +10,7 @@ import { useDebouncedValue } from '@kbn/react-hooks'; import { useQuery } from '@kbn/react-query'; import { formatAgentBuilderErrorMessage } from '@kbn/agent-builder-browser'; import { i18n } from '@kbn/i18n'; +import type { SmlSearchFilters } from '@kbn/agent-context-layer-plugin/public'; import { SML_SEARCH_DEFAULT_SIZE } from '../../../services/sml/constants'; import { queryKeys } from '../../query_keys'; import { useAgentBuilderServices } from '../use_agent_builder_service'; @@ -28,6 +29,8 @@ const smlSearchErrorToastTitle = i18n.translate( export interface UseSmlSearchOptions { /** When true, the server omits indexed `content` on each hit (smaller payload; e.g. command-menu autocomplete). */ readonly skipContent?: boolean; + /** Per-type filters for SML search. */ + readonly filters?: SmlSearchFilters; } export const useSmlSearch = (query: string, options?: UseSmlSearchOptions) => { @@ -35,16 +38,18 @@ export const useSmlSearch = (query: string, options?: UseSmlSearchOptions) => { const { smlService } = useAgentBuilderServices(); const debouncedQuery = useDebouncedValue(query, SML_SEARCH_DEBOUNCE_MS); const skipContent = options?.skipContent ?? false; + const filters = options?.filters; const searchQuery = useMemo(() => normalizeSmlSearchQuery(debouncedQuery), [debouncedQuery]); const { isError, isLoading, error, data } = useQuery({ - queryKey: queryKeys.sml.search(searchQuery, skipContent), + queryKey: queryKeys.sml.search(searchQuery, skipContent, filters), queryFn: () => smlService.search({ query: searchQuery, size: SML_SEARCH_DEFAULT_SIZE, skipContent, + filters, }), staleTime: SML_SEARCH_STALE_TIME_MS, cacheTime: SML_SEARCH_CACHE_TIME_MS, diff --git a/x-pack/platform/plugins/shared/agent_builder/public/application/query_keys.ts b/x-pack/platform/plugins/shared/agent_builder/public/application/query_keys.ts index f59d29d6e3409..b11e5fb4f7abe 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/application/query_keys.ts +++ b/x-pack/platform/plugins/shared/agent_builder/public/application/query_keys.ts @@ -5,6 +5,8 @@ * 2.0. */ +import type { SmlSearchFilters } from '@kbn/agent-context-layer-plugin/public'; + /** * Query keys for react-query */ @@ -51,8 +53,8 @@ export const queryKeys = { byAgent: (agentId?: string) => ['skills', 'byAgent', agentId], }, sml: { - search: (query: string, skipContent: boolean) => - ['sml', 'search', { query, skipContent }] as const, + search: (query: string, skipContent: boolean, filters?: SmlSearchFilters) => + ['sml', 'search', { query, skipContent, filters }] as const, }, plugins: { all: ['plugins', 'list'] as const, diff --git a/x-pack/platform/plugins/shared/agent_builder/public/services/sml/sml_service.ts b/x-pack/platform/plugins/shared/agent_builder/public/services/sml/sml_service.ts index a6e0febbaffcd..28010732eb2c8 100644 --- a/x-pack/platform/plugins/shared/agent_builder/public/services/sml/sml_service.ts +++ b/x-pack/platform/plugins/shared/agent_builder/public/services/sml/sml_service.ts @@ -6,7 +6,10 @@ */ import type { HttpSetup } from '@kbn/core-http-browser'; -import type { SmlSearchHttpResponse } from '@kbn/agent-context-layer-plugin/public'; +import type { + SmlSearchFilters, + SmlSearchHttpResponse, +} from '@kbn/agent-context-layer-plugin/public'; import { smlSearchPath } from '@kbn/agent-context-layer-plugin/public'; /** Browser client for SML search (`/internal/agent_context_layer/sml/_search`). */ @@ -21,12 +24,14 @@ export class SmlService { query: string; size: number; skipContent?: boolean; + filters?: SmlSearchFilters; }): Promise { return await this.http.post(smlSearchPath, { body: JSON.stringify({ query: params.query, size: params.size, ...(params.skipContent === true ? { skip_content: true } : {}), + ...(params.filters ? { filters: params.filters } : {}), }), }); } diff --git a/x-pack/platform/plugins/shared/agent_builder/server/routes/agents.ts b/x-pack/platform/plugins/shared/agent_builder/server/routes/agents.ts index c6543d378f852..abcc3b5a17eb9 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/routes/agents.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/routes/agents.ts @@ -59,6 +59,16 @@ const PLUGINS_SCHEMA = schema.arrayOf( } ); +const CONNECTORS_SCHEMA = schema.arrayOf( + schema.string({ + meta: { description: 'Connector ID to associate with the agent.' }, + }), + { + maxSize: 100, + meta: { description: 'Array of connector IDs to associate with the agent.' }, + } +); + export function registerAgentRoutes({ router, getInternalServices, @@ -239,6 +249,7 @@ export function registerAgentRoutes({ ) ), plugin_ids: schema.maybe(PLUGINS_SCHEMA), + connector_ids: schema.maybe(CONNECTORS_SCHEMA), }, { meta: { description: 'Configuration settings for the agent.' }, @@ -382,6 +393,7 @@ export function registerAgentRoutes({ ) ), plugin_ids: schema.maybe(PLUGINS_SCHEMA), + connector_ids: schema.maybe(CONNECTORS_SCHEMA), }, { meta: { description: 'Updated configuration settings for the agent.' }, diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/converters.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/converters.ts index f6c6aa6792c4b..153fa1d0ca825 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/converters.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/converters.ts @@ -52,6 +52,7 @@ export const fromEs = (document: Document): PersistedAgentDefinition => { (resolvedId === agentBuilderDefaultAgentId ? true : undefined), workflow_ids: configuration.workflow_ids, plugin_ids: configuration.plugin_ids, + connector_ids: configuration.connector_ids, }, }; }; @@ -86,6 +87,7 @@ export const createRequestToEs = ({ enable_elastic_capabilities: profile.configuration.enable_elastic_capabilities, workflow_ids: profile.configuration.workflow_ids, plugin_ids: profile.configuration.plugin_ids, + connector_ids: profile.configuration.connector_ids, }, created_at: creationDate.toISOString(), updated_at: creationDate.toISOString(), diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/storage.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/storage.ts index 839116d07a61b..0f65fb29de6dc 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/storage.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/agents/persisted/client/storage.ts @@ -33,6 +33,7 @@ const storageSettings = { workflow_ids: types.keyword({}), plugin_ids: types.keyword({}), skill_ids: types.keyword({}), + connector_ids: types.keyword({}), }, dynamic: false, }), @@ -68,6 +69,7 @@ export interface AgentConfigurationProperties { enable_elastic_capabilities?: boolean; workflow_ids?: string[]; plugin_ids?: string[]; + connector_ids?: string[]; } export type AgentProfileStorageSettings = typeof storageSettings; diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/run_agent/create_handler.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/run_agent/create_handler.ts index 8e202e965321e..d671c2fe34e29 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/run_agent/create_handler.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/run_agent/create_handler.ts @@ -5,6 +5,7 @@ * 2.0. */ +import type { AgentConfiguration } from '@kbn/agent-builder-common'; import type { AgentHandlerFn } from '@kbn/agent-builder-server'; import type { InternalAgentDefinition } from '../../agents/agent_registry'; import { runAgent } from './run_agent'; @@ -14,8 +15,10 @@ import { runAgent } from './run_agent'; */ export const createAgentHandler = ({ agent, + effectiveConfiguration, }: { agent: InternalAgentDefinition; + effectiveConfiguration: AgentConfiguration; }): AgentHandlerFn => { return async ( { @@ -35,11 +38,6 @@ export const createAgentHandler = ({ }, context ) => { - const effectiveConfiguration = { - ...agent.configuration, - ...(configurationOverrides || {}), - }; - const { round } = await runAgent( { nextInput, diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_agent.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_agent.ts index 0522094a5fbbc..fbeedc7509c13 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_agent.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_agent.ts @@ -135,8 +135,16 @@ export const runAgent = async ({ const agentRegistry = await agentsService.getRegistry({ request }); const agent = await agentRegistry.get(agentId); + // Single merge point for runtime overrides — consumed by both the agent handler + // (prompt construction, tool selection) and tool handlers (via ToolHandlerContext). + const effectiveConfiguration = { + ...agent.configuration, + ...(agentParams.configurationOverrides || {}), + }; + manager.deps.agentConfiguration = effectiveConfiguration; + const agentResult = await withAgentSpan({ agent }, async () => { - const agentHandler = createAgentHandler({ agent }); + const agentHandler = createAgentHandler({ agent, effectiveConfiguration }); const agentHandlerContext = await createAgentHandlerContext({ agentExecutionParams, manager }); return await agentHandler( { diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_tool.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_tool.ts index fa8d31ff4f220..1f76644dda701 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_tool.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/run_tool.ts @@ -324,6 +324,7 @@ export const createToolHandlerContext = async events: createToolEventEmitter({ eventHandler: onEvent, context: manager.context }), runContext: manager.context, executionMode: manager.deps.executionMode, + agentConfiguration: manager.deps.agentConfiguration, }; }; diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/runner.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/runner.ts index ed446df87aae1..416634c936eaf 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/runner.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/execution/runner/runner.ts @@ -13,7 +13,7 @@ import type { SavedObjectsServiceStart } from '@kbn/core-saved-objects-server'; import type { UiSettingsServiceStart } from '@kbn/core-ui-settings-server'; import type { SpacesPluginStart } from '@kbn/spaces-plugin/server'; import type { PluginStartContract as ActionsPluginStart } from '@kbn/actions-plugin/server'; -import type { Conversation, ConverseInput } from '@kbn/agent-builder-common'; +import type { AgentConfiguration, Conversation, ConverseInput } from '@kbn/agent-builder-common'; import { AgentExecutionMode, createInternalError, @@ -102,6 +102,8 @@ export interface CreateScopedRunnerDeps { executionMode: AgentExecutionMode; /** Sub-agent executor for spawning child executions. */ subAgentExecutor: SubAgentExecutor; + /** The effective agent configuration for the current run (with overrides applied). */ + agentConfiguration?: AgentConfiguration; } export type CreateRunnerDeps = Omit< diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.test.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.test.ts index 48b59a81022f0..3e4277f109c14 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.test.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.test.ts @@ -61,6 +61,7 @@ describe('createSmlSearchTool', () => { spaceId: 'default', esClient: mockContext.esClient, request: mockContext.request, + filters: undefined, }); }); @@ -139,4 +140,74 @@ describe('createSmlSearchTool', () => { }) ); }); + + it('passes connector_ids as filters from agentConfiguration', async () => { + mockSearch.mockResolvedValue({ results: [], total: 0 }); + const contextWithConnectors = { + ...mockContext, + agentConfiguration: { connector_ids: ['conn-1', 'conn-2'], tools: [] }, + }; + + const tool = createSmlSearchTool({ getAgentContextLayer }); + await tool.handler({ query: 'test' }, contextWithConnectors as unknown as ToolHandlerContext); + + expect(mockSearch).toHaveBeenCalledWith( + expect.objectContaining({ + filters: { connector: { ids: ['conn-1', 'conn-2'] } }, + }) + ); + }); + + it('does not pass filters when agentConfiguration has no connector_ids', async () => { + mockSearch.mockResolvedValue({ results: [], total: 0 }); + const contextWithoutConnectors = { + ...mockContext, + agentConfiguration: { tools: [] }, + }; + + const tool = createSmlSearchTool({ getAgentContextLayer }); + await tool.handler( + { query: 'test' }, + contextWithoutConnectors as unknown as ToolHandlerContext + ); + + expect(mockSearch).toHaveBeenCalledWith( + expect.objectContaining({ + filters: undefined, + }) + ); + }); + + it('passes empty connector ids filter when connector_ids is []', async () => { + mockSearch.mockResolvedValue({ results: [], total: 0 }); + const contextWithEmptyConnectors = { + ...mockContext, + agentConfiguration: { connector_ids: [], tools: [] }, + }; + + const tool = createSmlSearchTool({ getAgentContextLayer }); + await tool.handler( + { query: 'test' }, + contextWithEmptyConnectors as unknown as ToolHandlerContext + ); + + expect(mockSearch).toHaveBeenCalledWith( + expect.objectContaining({ + filters: { connector: { ids: [] } }, + }) + ); + }); + + it('does not pass filters when agentConfiguration is undefined', async () => { + mockSearch.mockResolvedValue({ results: [], total: 0 }); + + const tool = createSmlSearchTool({ getAgentContextLayer }); + await tool.handler({ query: 'test' }, mockContext as unknown as ToolHandlerContext); + + expect(mockSearch).toHaveBeenCalledWith( + expect.objectContaining({ + filters: undefined, + }) + ); + }); }); diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.ts index be50f31a5b438..3bfd031fbe9bc 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/sml_search.ts @@ -11,6 +11,7 @@ import { ToolResultType } from '@kbn/agent-builder-common/tools/tool_result'; import type { BuiltinToolDefinition } from '@kbn/agent-builder-server'; import { getToolResultId, createErrorResult } from '@kbn/agent-builder-server'; import { AGENT_CONTEXT_LAYER_EXPERIMENTAL_FEATURES_SETTING_ID } from '@kbn/management-settings-ids'; +import { SmlSearchFilterType } from '@kbn/agent-context-layer-plugin/server'; import type { SmlToolsOptions } from './types'; const smlSearchSchema = z.object({ @@ -63,7 +64,13 @@ export const createSmlSearchTool = ({ }, handler: async ({ query, size }, context) => { const agentContextLayer = getAgentContextLayer(); - const { spaceId, esClient, request } = context; + const { spaceId, esClient, request, agentConfiguration } = context; + + const connectorIds = agentConfiguration?.connector_ids; + const filters = + connectorIds !== undefined + ? { [SmlSearchFilterType.connector]: { ids: connectorIds } } + : undefined; let searchResult; try { @@ -73,6 +80,7 @@ export const createSmlSearchTool = ({ spaceId, esClient, request, + filters, }); } catch (error) { return { diff --git a/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/types.ts b/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/types.ts index c18cd06af4b2c..fa7f72aa8fe9d 100644 --- a/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/types.ts +++ b/x-pack/platform/plugins/shared/agent_builder/server/services/tools/builtin/sml/types.ts @@ -9,8 +9,7 @@ import type { AgentContextLayerPluginStart } from '@kbn/agent-context-layer-plug /** * Options for creating SML tools. - * Uses a getter for lazy resolution — the agent context layer start contract - * is not available until after plugin start. + * Uses a getter for lazy resolution — the start contract is not available until after plugin start. */ export interface SmlToolsOptions { getAgentContextLayer: () => AgentContextLayerPluginStart; diff --git a/x-pack/platform/plugins/shared/agent_context_layer/common/http_api/sml.ts b/x-pack/platform/plugins/shared/agent_context_layer/common/http_api/sml.ts index 0513efbefc389..ccf19f91b0b2e 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/common/http_api/sml.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/common/http_api/sml.ts @@ -5,6 +5,20 @@ * 2.0. */ +/** + * Allowed type keys for the `filters` parameter in SML search. + * Extend this enum when adding new filterable SML types. + */ +export enum SmlSearchFilterType { + connector = 'connector', +} + +/** + * Per-type filter criteria for SML search. + * Keys must be values of {@link SmlSearchFilterType}. + */ +export type SmlSearchFilters = Partial>; + /** * Max length of `query` for POST `/internal/agent_context_layer/sml/_search`. */ diff --git a/x-pack/platform/plugins/shared/agent_context_layer/public/index.ts b/x-pack/platform/plugins/shared/agent_context_layer/public/index.ts index 15ef901497f6d..d6e97bdcd0b90 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/public/index.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/public/index.ts @@ -8,8 +8,12 @@ import type { PluginInitializer } from '@kbn/core-plugins-browser'; export { smlSearchPath, internalApiPath } from '../common/constants'; -export { SML_HTTP_SEARCH_QUERY_MAX_LENGTH } from '../common/http_api/sml'; -export type { SmlSearchHttpResponse, SmlSearchHttpResultItem } from '../common/http_api/sml'; +export { SML_HTTP_SEARCH_QUERY_MAX_LENGTH, SmlSearchFilterType } from '../common/http_api/sml'; +export type { + SmlSearchFilters, + SmlSearchHttpResponse, + SmlSearchHttpResultItem, +} from '../common/http_api/sml'; export const plugin: PluginInitializer<{}, {}> = () => ({ setup: () => ({}), diff --git a/x-pack/platform/plugins/shared/agent_context_layer/server/index.ts b/x-pack/platform/plugins/shared/agent_context_layer/server/index.ts index 567b28f359723..b17ac5df29395 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/server/index.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/server/index.ts @@ -27,12 +27,14 @@ export type { SmlToAttachmentContext, SmlListItem, SmlSearchResult, + SmlSearchFilters, SmlDocument, SmlIndexAction, } from './services/sml/types'; export type { SmlResolvedItemResult } from './services/sml/execute_sml_attach_items'; export { smlElasticsearchIndexMappings, smlIndexName } from './services/sml/sml_storage'; +export { SmlSearchFilterType } from '../common/http_api/sml'; export const plugin: PluginInitializer< AgentContextLayerPluginSetup, diff --git a/x-pack/platform/plugins/shared/agent_context_layer/server/routes/search.ts b/x-pack/platform/plugins/shared/agent_context_layer/server/routes/search.ts index 08ba199452b86..25427cd777fb8 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/server/routes/search.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/server/routes/search.ts @@ -11,7 +11,7 @@ import type { RouteSecurity } from '@kbn/core-http-server'; import { AGENT_CONTEXT_LAYER_EXPERIMENTAL_FEATURES_SETTING_ID } from '@kbn/management-settings-ids'; import { apiPrivileges } from '../../common/features'; import type { SmlSearchHttpResponse } from '../../common/http_api/sml'; -import { SML_HTTP_SEARCH_QUERY_MAX_LENGTH } from '../../common/http_api/sml'; +import { SML_HTTP_SEARCH_QUERY_MAX_LENGTH, SmlSearchFilterType } from '../../common/http_api/sml'; import { smlSearchPath } from '../../common/constants'; import type { SmlService } from '../services/sml/types'; import type { AgentContextLayerStartDependencies, AgentContextLayerPluginStart } from '../types'; @@ -41,6 +41,14 @@ export const registerSearchRoute = ({ query: schema.string({ minLength: 1, maxLength: SML_HTTP_SEARCH_QUERY_MAX_LENGTH }), size: schema.maybe(schema.number({ min: 1, max: SML_SEARCH_SIZE_MAX })), skip_content: schema.maybe(schema.boolean()), + filters: schema.maybe( + schema.recordOf( + schema.literal(SmlSearchFilterType.connector), + schema.object({ + ids: schema.maybe(schema.arrayOf(schema.string(), { maxSize: 100 })), + }) + ) + ), }), }, options: { access: 'internal' }, @@ -59,7 +67,7 @@ export const registerSearchRoute = ({ } const sml = getSmlService(); - const { query, size, skip_content: skipContent } = request.body; + const { query, size, skip_content: skipContent, filters } = request.body; const esClient = coreContext.elasticsearch.client; const [, startDeps] = await coreSetup.getStartServices(); @@ -72,6 +80,7 @@ export const registerSearchRoute = ({ esClient, request, skipContent, + filters, }); const body: SmlSearchHttpResponse = { diff --git a/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_connector_filter.test.ts b/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_connector_filter.test.ts new file mode 100644 index 0000000000000..33f018b8de0e6 --- /dev/null +++ b/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_connector_filter.test.ts @@ -0,0 +1,59 @@ +/* + * 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 { SmlSearchFilterType } from '../../../common/http_api/sml'; +import { buildTypeFilters } from './sml_service'; + +// buildTypeFilters is designed to combine clauses from multiple SmlSearchFilterType +// values. When the enum grows beyond 'connector', add multi-type tests here. + +describe('buildTypeFilters', () => { + it('returns undefined when filters is undefined', () => { + expect(buildTypeFilters(undefined)).toBeUndefined(); + }); + + it('returns undefined when filters is empty', () => { + expect(buildTypeFilters({})).toBeUndefined(); + }); + + it('returns undefined when type criteria has no ids', () => { + expect(buildTypeFilters({ [SmlSearchFilterType.connector]: {} })).toBeUndefined(); + }); + + it('excludes the type entirely when ids is empty', () => { + const filter = buildTypeFilters({ [SmlSearchFilterType.connector]: { ids: [] } }); + expect(filter).toEqual({ + bool: { must_not: [{ term: { type: 'connector' } }] }, + }); + }); + + it('returns a filter for a single type with ids', () => { + const filter = buildTypeFilters({ + [SmlSearchFilterType.connector]: { ids: ['conn-1', 'conn-2'] }, + }); + expect(filter).toEqual({ + bool: { + should: [ + { + bool: { + must: [ + { term: { type: 'connector' } }, + { terms: { origin_id: ['conn-1', 'conn-2'] } }, + ], + }, + }, + { + bool: { + must_not: [{ term: { type: 'connector' } }], + }, + }, + ], + minimum_should_match: 1, + }, + }); + }); +}); diff --git a/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_service.ts b/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_service.ts index 7ec4b7ab31035..afa712c2a8727 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_service.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/sml_service.ts @@ -10,7 +10,13 @@ import type { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; import type { Logger } from '@kbn/logging'; import type { KibanaRequest } from '@kbn/core-http-server'; import type { AuthorizationServiceSetup } from '@kbn/security-plugin-types-server'; -import type { SmlService, SmlSearchResult, SmlDocument, SmlTypeDefinition } from './types'; +import type { + SmlService, + SmlSearchResult, + SmlDocument, + SmlTypeDefinition, + SmlSearchFilters, +} from './types'; import { createSmlTypeRegistry, type SmlTypeRegistry } from './sml_type_registry'; import { createSmlIndexer, type SmlIndexer } from './sml_indexer'; import { SmlCrawlerImpl } from './sml_crawler'; @@ -75,7 +81,7 @@ class SmlServiceImpl implements SmlServiceInstance { return { getCrawler: () => crawler, - search: async ({ query, size = 10, spaceId, esClient, request, skipContent }) => { + search: async ({ query, size = 10, spaceId, esClient, request, skipContent, filters }) => { const rawResults = await searchSml({ query, size, @@ -83,6 +89,7 @@ class SmlServiceImpl implements SmlServiceInstance { esClient, logger, skipContent, + filters, }); return filterResultsByPermissions({ searchResult: rawResults, @@ -345,6 +352,63 @@ const buildSmlSearchQuery = (query: string): Record => { }; }; +/** + * Build an ES filter clause from per-type SML search filters. + * + * For each type with an `ids` constraint, the filter returns documents that + * either (a) match the type AND have an origin_id in the list, or (b) are + * NOT of the constrained type. Types without filters are unaffected. + */ +export const buildTypeFilters = ( + filters: SmlSearchFilters | undefined +): Record | undefined => { + if (!filters) { + return undefined; + } + + const clauses: Array> = []; + + for (const [typeId, criteria] of Object.entries(filters)) { + if (!criteria?.ids) { + continue; + } + + if (criteria.ids.length === 0) { + // Explicitly empty → exclude all documents of this type + clauses.push({ bool: { must_not: [{ term: { type: typeId } }] } }); + } else { + // Non-empty → allow matching documents of this type, pass through other types + clauses.push({ + bool: { + should: [ + { + bool: { + must: [{ term: { type: typeId } }, { terms: { origin_id: criteria.ids } }], + }, + }, + { + bool: { + must_not: [{ term: { type: typeId } }], + }, + }, + ], + minimum_should_match: 1, + }, + }); + } + } + + if (clauses.length === 0) { + return undefined; + } + + if (clauses.length === 1) { + return clauses[0]; + } + + return { bool: { must: clauses } }; +}; + /** * Search the SML index. When the index hasn't been created yet, * the function returns empty results silently. @@ -356,6 +420,7 @@ const searchSml = async ({ esClient, logger, skipContent, + filters, }: { query: string; size: number; @@ -363,6 +428,7 @@ const searchSml = async ({ esClient: IScopedClusterClient; logger: Logger; skipContent?: boolean; + filters?: SmlSearchFilters; }): Promise<{ results: SmlSearchResult[]; total: number }> => { logger.debug( `SML search: query=${JSON.stringify( @@ -373,6 +439,19 @@ const searchSml = async ({ try { const smlQuery = buildSmlSearchQuery(query); + const typeFilter = buildTypeFilters(filters); + const filterClauses: Array> = [ + { + bool: { + should: [{ term: { spaces: spaceId } }, { term: { spaces: '*' } }], + minimum_should_match: 1, + }, + }, + ]; + if (typeFilter) { + filterClauses.push(typeFilter); + } + const response = await esClient.asInternalUser.search({ index: smlIndexName, size, @@ -381,14 +460,7 @@ const searchSml = async ({ query: { bool: { must: [smlQuery], - filter: [ - { - bool: { - should: [{ term: { spaces: spaceId } }, { term: { spaces: '*' } }], - minimum_should_match: 1, - }, - }, - ], + filter: filterClauses, }, }, _source: skipContent ? { excludes: ['content', 'description'] } : true, diff --git a/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/types.ts b/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/types.ts index 564fde6345d61..d5a95a60dadc7 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/types.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/server/services/sml/types.ts @@ -13,6 +13,7 @@ import type { import type { Logger } from '@kbn/logging'; import type { KibanaRequest } from '@kbn/core-http-server'; import type { AttachmentInput } from '@kbn/agent-builder-common/attachments'; +import type { SmlSearchFilters } from '../../../common/http_api/sml'; /** * A single SML chunk to be indexed. @@ -186,6 +187,12 @@ export interface SmlCrawler { }) => Promise; } +/** + * Per-type filter parameters for SML search. + * Re-exported from the shared HTTP API types so server and client use a single definition. + */ +export type { SmlSearchFilters } from '../../../common/http_api/sml'; + /** * SML service interface — exposed on the plugin start contract. */ @@ -201,6 +208,8 @@ export interface SmlService { request: KibanaRequest; /** When true, Elasticsearch omits `content` from `_source` (smaller payloads for autocomplete). */ skipContent?: boolean; + /** Per-type filters. See {@link SmlSearchFilters}. */ + filters?: SmlSearchFilters; }) => Promise<{ results: SmlSearchResult[]; total: number }>; /** diff --git a/x-pack/platform/plugins/shared/agent_context_layer/server/types.ts b/x-pack/platform/plugins/shared/agent_context_layer/server/types.ts index 2fa7c066e3c68..f14cac07ae6c1 100644 --- a/x-pack/platform/plugins/shared/agent_context_layer/server/types.ts +++ b/x-pack/platform/plugins/shared/agent_context_layer/server/types.ts @@ -19,6 +19,7 @@ import type { SecurityPluginStart } from '@kbn/security-plugin-types-server'; import type { SmlTypeDefinition, SmlSearchResult, + SmlSearchFilters, SmlDocument, SmlIndexAction, } from './services/sml/types'; @@ -47,6 +48,7 @@ export interface AgentContextLayerPluginStart { esClient: IScopedClusterClient; request: KibanaRequest; skipContent?: boolean; + filters?: SmlSearchFilters; }) => Promise<{ results: SmlSearchResult[]; total: number }>; checkItemsAccess: (params: {