Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
76edd79
Update langchain (main) (#240493)
elastic-renovate-prod[bot] Mar 24, 2026
46b2149
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine Mar 25, 2026
8e1c6a7
Fix type errors, test failures, and dependency drift
patrykkopycinski Mar 25, 2026
78e1804
Changes from node scripts/capture_oas_snapshot --include-path /api/st…
kibanamachine Mar 25, 2026
f0764b0
Revert @emotion/sheet version drift from 1.4.1 back to 1.2.2
patrykkopycinski Mar 25, 2026
f8a1eae
Add zod-to-json-schema to @kbn/router-to-openapispec dependencies
patrykkopycinski Mar 25, 2026
4667faf
Merge remote-tracking branch 'upstream/8.19' into backport/8.19/pr-24…
patrykkopycinski Mar 28, 2026
05f23e8
Remove broken @langchain/core/ansi-styles resolution and fix langgrap…
patrykkopycinski Mar 28, 2026
10e7f3b
Changes from node scripts/eslint_all_files --no-cache --fix
kibanamachine Mar 28, 2026
5bebb0f
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine Mar 28, 2026
38ac900
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Mar 28, 2026
550dd88
Merge upstream/8.19 and resolve conflicts
patrykkopycinski Apr 5, 2026
0f576fe
TO FIX: Run node 'scripts/yarn_deduplicate && yarn kbn bootstrap' loc…
kibanamachine Apr 5, 2026
c98d4ad
fix(inference-langchain): use bind() instead of withConfig() in bindT…
patrykkopycinski Apr 6, 2026
6daeba1
Revert "fix(inference-langchain): use bind() instead of withConfig() …
patrykkopycinski Apr 6, 2026
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
43 changes: 22 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
"**/@babel/parser": "7.24.7",
"**/@hapi/mimos/mime-db": "1.53.0",
"**/@hello-pangea/dnd": "16.6.0",
"**/@langchain/core": "0.3.80",
"**/@langchain/google-common": "0.1.8",
"**/@langchain/core": "1.1.31",
"**/@langchain/google-common": "2.1.24",
"**/@types/node": "22.19.1",
"**/@types/prop-types": "15.7.5",
"**/@typescript-eslint/utils": "8.46.3",
Expand All @@ -91,18 +91,18 @@
"**/fast-xml-parser": "5.5.7",
"**/hoist-non-react-statics": "3.3.2",
"**/isomorphic-fetch/node-fetch": "2.7.0",
"**/langchain": "0.3.15",
"**/langchain": "1.2.30",
"**/qs": "6.15.0",
"**/remark-parse/trim": "1.0.1",
"**/sharp": "0.34.4",
"**/typescript": "5.9.3",
"**/util": "0.12.5",
"**/yauzl": "3.2.1",
"**/zod": "3.25.76",
"@aws-sdk/client-bedrock-agent-runtime": "3.747.0",
"@aws-sdk/client-bedrock-runtime": "3.744.0",
"@aws-sdk/client-kendra": "3.744.0",
"@aws-sdk/credential-provider-node": "3.744.0",
"@aws-sdk/client-bedrock-agent-runtime": "3.994.0",
"@aws-sdk/client-bedrock-runtime": "3.994.0",
"@aws-sdk/client-kendra": "3.994.0",
"@aws-sdk/credential-provider-node": "3.972.10",
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
Expand All @@ -115,7 +115,7 @@
"@ai-sdk/langchain": "1.0.102",
"@appland/sql-parser": "1.5.1",
"@arizeai/openinference-semantic-conventions": "1.1.0",
"@aws-sdk/client-bedrock-runtime": "3.744.0",
"@aws-sdk/client-bedrock-runtime": "3.994.0",
"@babel/runtime": "7.27.6",
"@dagrejs/dagre": "1.1.8",
"@dnd-kit/core": "6.3.1",
Expand Down Expand Up @@ -1071,14 +1071,15 @@
"@kbn/xstate-utils": "link:src/platform/packages/shared/kbn-xstate-utils",
"@kbn/zod": "link:src/platform/packages/shared/kbn-zod",
"@kbn/zod-helpers": "link:src/platform/packages/shared/kbn-zod-helpers",
"@langchain/aws": "0.1.10",
"@langchain/community": "0.3.45",
"@langchain/core": "0.3.80",
"@langchain/google-common": "0.1.8",
"@langchain/google-genai": "0.1.8",
"@langchain/google-vertexai": "0.1.8",
"@langchain/langgraph": "0.2.74",
"@langchain/openai": "0.4.4",
"@langchain/aws": "1.3.1",
"@langchain/classic": "1.0.22",
"@langchain/core": "1.1.31",
"@langchain/google-common": "2.1.24",
"@langchain/google-genai": "2.1.24",
"@langchain/google-vertexai": "2.1.24",
"@langchain/langgraph": "1.2.0",
"@langchain/langgraph-checkpoint": "1.0.0",
"@langchain/openai": "1.2.12",
"@launchdarkly/node-server-sdk": "9.10.6",
"@launchdarkly/openfeature-node-server": "1.1.0",
"@loaders.gl/core": "3.4.7",
Expand Down Expand Up @@ -1108,9 +1109,9 @@
"@opentelemetry/semantic-conventions": "1.39.0",
"@reduxjs/toolkit": "1.9.7",
"@slack/webhook": "7.0.1",
"@smithy/eventstream-codec": "4.0.1",
"@smithy/eventstream-serde-node": "4.0.1",
"@smithy/middleware-stack": "4.2.0",
"@smithy/eventstream-codec": "4.2.8",
"@smithy/eventstream-serde-node": "4.1.1",
"@smithy/middleware-stack": "4.2.8",
"@smithy/node-http-handler": "4.3.0",
"@smithy/types": "4.12.0",
"@smithy/util-utf8": "4.2.0",
Expand Down Expand Up @@ -1224,8 +1225,8 @@
"jsonwebtoken": "9.0.2",
"jsts": "1.6.2",
"kea": "2.6.0",
"langchain": "0.3.37",
"langsmith": "0.3.87",
"langchain": "1.2.30",
"langsmith": "0.5.7",
"launchdarkly-js-client-sdk": "3.9.0",
"load-json-file": "6.2.0",
"lodash": "4.17.23",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function findUsedNodeModules(options: Options) {
let outputs = 0;
const promise = Rx.lastValueFrom(
path$.pipe(
Rx.filter((path) => Path.extname(path) === '.js'),
Rx.filter((path) => ['.js', '.cjs'].includes(Path.extname(path))),
Rx.distinct(),
Rx.tap(() => {
inputs += 1;
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3969,7 +3969,7 @@
"matchDepNames": [
"langchain",
"@langchain/aws",
"@langchain/community",
"@langchain/classic",
"@langchain/core",
"@langchain/google-common",
"@langchain/google-genai",
Expand Down
3 changes: 3 additions & 0 deletions src/dev/build/tasks/clean_tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export const CleanExtraFilesFromModules: Task = {
'**/bower.json',
'**/yarn.lock',

// nested package manager artifacts (e.g. pnpm virtual store leaked into published packages)
'**/.pnpm',

// misc
'**/.*ignore',
'**/*.log',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ export class ImportResolver {
return Path.resolve(REPO_ROOT, `node_modules/@modelcontextprotocol/sdk/dist/esm/${relPath}`);
}

// We need this "hack" because our current import-resolver doesn't support "exports" in package.json.
if (req.startsWith('@langchain/langgraph/')) {
const subPath = req.slice('@langchain/langgraph/'.length);
return Path.resolve(REPO_ROOT, `node_modules/@langchain/langgraph/dist/${subPath}/index.js`);
}

// We need this "hack" because our current import-resolver doesn't support "exports" in package.json.
// We should be able to remove this once we support cjs/esm interop.
if (req.startsWith('@elastic/opentelemetry-node/sdk')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ owners:
defaultOwner: '@elastic/kibana-core'
toolchains:
default: node
javascript:
rootPackageDependenciesOnly: false
language: typescript
project:
title: '@kbn/router-to-openapispec'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "@kbn/router-to-openapispec",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"dependencies": {
"zod-to-json-schema": "3.25.0"
}
}
2 changes: 1 addition & 1 deletion src/platform/packages/shared/kbn-test/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = {
transformIgnorePatterns: [
// ignore all node_modules except monaco-editor, monaco-yaml which requires babel transforms to handle dynamic import()
// since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842)
'[/\\\\]node_modules(?![\\/\\\\](byte-size|monaco-editor|monaco-yaml|monaco-languageserver-types|monaco-marker-data-provider|monaco-worker-manager|vscode-languageserver-types|d3-interpolate|d3-color|langchain|langsmith|@cfworker|gpt-tokenizer|flat|@langchain|eventsource-parser|fast-check|@fast-check/jest|@assemblyscript|quickselect|rbush|zod/v4|vega-interpreter|vega-util|vega-tooltip))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](byte-size|monaco-editor|monaco-yaml|monaco-languageserver-types|monaco-marker-data-provider|monaco-worker-manager|vscode-languageserver-types|d3-interpolate|d3-color|langchain|langsmith|@cfworker|gpt-tokenizer|flat|@langchain|eventsource-parser|fast-check|@fast-check/jest|@assemblyscript|quickselect|rbush|zod/v4|vega-interpreter|vega-util|vega-tooltip|@modelcontextprotocol|pkce-challenge|ansi-styles))[/\\\\].+\\.js$',
'packages/kbn-pm/dist/index.js',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|@langchain|zod/v4))/dist/[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|@langchain|zod/v4))/dist/util/[/\\\\].+\\.js$',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
// An array of regexp pattern strings that are matched against, matched files will skip transformation:
transformIgnorePatterns: [
// since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842)
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|gpt-tokenizer|flat|@langchain|eventsource-parser|zod/v4))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|gpt-tokenizer|flat|@langchain|eventsource-parser|zod/v4|ansi-styles))[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|@langchain|zod/v4))/dist/[/\\\\].+\\.js$',
'[/\\\\]node_modules(?![\\/\\\\](langchain|langsmith|@langchain|zod/v4))/dist/util/[/\\\\].+\\.js$',
],
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,12 @@
"zod": ["typings/zod/v3"],
"zod/v4": ["typings/zod/v4"],
"vega-lite": ["typings/vega/vega_lite"],
"vega-tooltip": ["typings/vega/vega_tooltip"]
"vega-tooltip": ["typings/vega/vega_tooltip"],
"@langchain/langgraph/prebuilt": ["node_modules/@langchain/langgraph/dist/prebuilt"],
"@langchain/classic/chains": ["node_modules/@langchain/classic/dist/chains"],
"@langchain/classic/evaluation": ["node_modules/@langchain/classic/dist/evaluation"],
"@langchain/classic/document_loaders/fs/directory": ["node_modules/@langchain/classic/dist/document_loaders/fs/directory"],
"@langchain/classic/document_loaders/fs/text": ["node_modules/@langchain/classic/dist/document_loaders/fs/text"]
},
// Support .tsx files and transform JSX into calls to React.createElement
"jsx": "react",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,9 @@ describe('InferenceChatModel', () => {
});

expect(concatChunk.usage_metadata).toEqual({
input_token_details: {},
input_tokens: 5,
output_token_details: {},
output_tokens: 20,
total_tokens: 25,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ export class InferenceChatModel extends BaseChatModel<InferenceChatModelCallOpti
override bindTools(tools: BindToolsInput[], kwargs?: Partial<InferenceChatModelCallOptions>) {
// conversion will be done at call time for simplicity's sake
// so we just need to implement this method with the default behavior to support tools
return this.bind({
return this.withConfig({
tools,
...kwargs,
} as Partial<InferenceChatModelCallOptions>);
});
}

invocationParams(options: this['ParsedCallOptions']): InvocationParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* 2.0.
*/

import { BedrockChat as _BedrockChat } from '@langchain/community/chat_models/bedrock/web';
import type { ActionsClient } from '@kbn/actions-plugin/server';
import { BaseChatModelParams } from '@langchain/core/language_models/chat_models';
import { Logger } from '@kbn/logging';
import { PublicMethodsOf } from '@kbn/utility-types';
import type { BaseChatModelParams } from '@langchain/core/language_models/chat_models';
import type { Logger } from '@kbn/logging';
import type { PublicMethodsOf } from '@kbn/utility-types';
import type { TelemetryMetadata } from '@kbn/actions-plugin/server/lib';
import { prepareMessages, DEFAULT_BEDROCK_MODEL, DEFAULT_BEDROCK_REGION } from '../utils/bedrock';
import { ActionsClientChatBedrockConverse } from './chat_bedrock_converse/chat_bedrock_converse';

export interface CustomChatModelInput extends BaseChatModelParams {
actionsClient: PublicMethodsOf<ActionsClient>;
Expand All @@ -29,58 +28,4 @@ export interface CustomChatModelInput extends BaseChatModelParams {
* ActionsClientBedrockChatModel chat model supports non-streaming only the Bedrock Invoke API.
* The LangChain team will support only the Bedrock Converse API in the future.
*/
export class ActionsClientBedrockChatModel extends _BedrockChat {
constructor({ actionsClient, connectorId, logger, ...params }: CustomChatModelInput) {
super({
...params,
credentials: { accessKeyId: '', secretAccessKey: '' },
// only needed to force BedrockChat to use messages api for Claude v2
model: params.model ?? DEFAULT_BEDROCK_MODEL,
region: DEFAULT_BEDROCK_REGION,
fetchFn: async (url, options) => {
const inputBody = JSON.parse(options?.body as string);

if (this.streaming) {
throw new Error(
`ActionsClientBedrockChat does not support streaming, use ActionsClientChatBedrockConverse instead`
);
}

const data = (await actionsClient.execute({
actionId: connectorId,
params: {
subAction: 'invokeAIRaw',
subActionParams: {
telemetryMetadata: {
pluginId: params?.telemetryMetadata?.pluginId,
aggregateBy: params?.telemetryMetadata?.aggregateBy,
},
messages: prepareMessages(inputBody.messages),
temperature: params.temperature ?? inputBody.temperature,
stopSequences: inputBody.stop_sequences,
system: inputBody.system,
maxTokens: params.maxTokens ?? inputBody.max_tokens,
tools: inputBody.tools,
anthropicVersion: inputBody.anthropic_version,
},
},
})) as {
status: string;
data: { message: string };
message?: string;
serviceMessage?: string;
};
if (data.status === 'error') {
throw new Error(
`ActionsClientBedrockChat: action result status is error: ${data?.message} - ${data?.serviceMessage}`
);
}

return {
ok: data.status === 'ok',
json: () => data.data,
} as unknown as Response;
},
});
}
}
export class ActionsClientBedrockChatModel extends ActionsClientChatBedrockConverse {}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ActionsClientChatOpenAI extends ChatOpenAI {

async betaParsedCompletionWithRetry(
request: OpenAI.ChatCompletionCreateParamsNonStreaming
): Promise<ReturnType<OpenAIClient['beta']['chat']['completions']['parse']>> {
): Promise<ReturnType<OpenAIClient['chat']['completions']['parse']>> {
return this.completionWithRetry(request).then((response) =>
parseChatCompletion(
response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class ActionsClientGeminiChatModel extends ChatGoogleGenerativeAI {
constructor({ actionsClient, connectorId, ...props }: CustomChatModelInput) {
super({
...props,
model: props.model ?? 'gemini-1.5-flash',
apiKey: 'asda',
maxOutputTokens: props.maxTokens ?? 2048,
});
Expand All @@ -65,9 +66,10 @@ export class ActionsClientGeminiChatModel extends ChatGoogleGenerativeAI {
}

async completionWithRetry(
request: GenerateContentRequest,
options?: this['ParsedCallOptions']
...args: Parameters<ChatGoogleGenerativeAI['completionWithRetry']>
): Promise<GenerateContentResult> {
const [request, options] = args;
const req = request as GenerateContentRequest;
return this.caller.callWithOptions({ signal: options?.signal }, async () => {
try {
const requestBody = {
Expand All @@ -77,8 +79,8 @@ export class ActionsClientGeminiChatModel extends ChatGoogleGenerativeAI {
subActionParams: {
telemetryMetadata: this.telemetryMetadata,
model: this.#model,
messages: request.contents,
tools: request.tools,
messages: req.contents,
tools: req.tools,
temperature: this.#temperature,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ export function convertMessageContentToParts(
if (!isMultimodalModel) {
throw new Error(`This model does not support images`);
}
let source;
let source: string;
if (typeof c.image_url === 'string') {
source = c.image_url;
} else if (typeof c.image_url === 'object' && 'url' in c.image_url) {
source = c.image_url.url;
} else if (c.image_url && typeof c.image_url === 'object' && 'url' in c.image_url) {
source = c.image_url.url as string;
} else {
throw new Error('Please provide image as base64 encoded data URL');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { IKibanaResponse, IRouter } from '@kbn/core/server';
import { getRequestAbortedSignal } from '@kbn/data-plugin/server';
import { APMTracer } from '@kbn/langchain/server/tracers/apm';
import { getLangSmithTracer } from '@kbn/langchain/server/tracers/langsmith';
import type { ESProcessorItem, SamplesFormat } from '../../common';
import { ANALYZE_LOGS_PATH, AnalyzeLogsRequestBody, AnalyzeLogsResponse } from '../../common';
import { FLEET_ALL_ROLE, INTEGRATIONS_ALL_ROLE, ROUTE_HANDLER_TIMEOUT } from '../constants';
import { getLogFormatDetectionGraph } from '../graphs/log_type_detection/graph';
Expand Down Expand Up @@ -103,7 +104,12 @@ export function registerAnalyzeLogsRoutes(
const graphResults = await graph
.withConfig({ runName: 'Log Format' })
.invoke(logFormatParameters, options);
const graphLogFormat = graphResults.results.samplesFormat.name;
const results = graphResults.results as {
samplesFormat: SamplesFormat;
parsedSamples: string[];
additionalProcessors: ESProcessorItem[];
};
const graphLogFormat = results.samplesFormat.name;

switch (graphLogFormat) {
case 'unsupported':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const getMessages = (chatHistory: ChatMessage[]) => {
}
return null;
})
.filter((message): message is BaseMessage => message !== null);
.filter((message): message is HumanMessage | AIMessage => message !== null);
};

const buildContext = (docs: Document[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import type { Logger } from '@kbn/logging';
import { ChatPromptTemplate } from '@langchain/core/prompts';
import { FakeLLM } from '@langchain/core/utils/testing';
import { createOpenAIFunctionsAgent } from 'langchain/agents';
import { createOpenAIFunctionsAgent } from '@langchain/classic/agents';
import { actionsClientMock } from '@kbn/actions-plugin/server/actions_client/actions_client.mock';
import { coreMock, savedObjectsClientMock } from '@kbn/core/server/mocks';
import { newContentReferencesStoreMock } from '@kbn/elastic-assistant-common/impl/content_references/content_references_store/__mocks__/content_references_store.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { Document } from 'langchain/document';
import type { Document } from '@langchain/core/documents';

/**
* Mock LangChain `Document`s loaded from a LangChain `DirectoryLoader`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
QueryDslQueryContainer,
} from '@elastic/elasticsearch/lib/api/types';
import type { MlPluginSetup } from '@kbn/ml-plugin/server';
import { Document } from 'langchain/document';
import { Document } from '@langchain/core/documents';
import {
DocumentEntryType,
DocumentEntry,
Expand Down
Loading
Loading