@librechat/agents 3.7.20 → 3.7.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/cjs/graphs/Graph.cjs +21 -4
  2. package/dist/cjs/graphs/Graph.cjs.map +1 -1
  3. package/dist/cjs/llm/invoke.cjs +21 -6
  4. package/dist/cjs/llm/invoke.cjs.map +1 -1
  5. package/dist/cjs/main.cjs +2 -0
  6. package/dist/cjs/stream.cjs +38 -1
  7. package/dist/cjs/stream.cjs.map +1 -1
  8. package/dist/cjs/tools/BashExecutor.cjs +3 -2
  9. package/dist/cjs/tools/BashExecutor.cjs.map +1 -1
  10. package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +2 -1
  11. package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
  12. package/dist/cjs/tools/CodeExecutor.cjs +27 -10
  13. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  14. package/dist/cjs/tools/ProgrammaticToolCalling.cjs +6 -5
  15. package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
  16. package/dist/cjs/tools/ToolNode.cjs +95 -18
  17. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  18. package/dist/cjs/tools/ToolSearch.cjs +130 -24
  19. package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
  20. package/dist/cjs/tools/diagnostics.cjs +26 -0
  21. package/dist/cjs/tools/diagnostics.cjs.map +1 -0
  22. package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs +1 -1
  23. package/dist/cjs/tools/preparedSubagents.cjs +129 -0
  24. package/dist/cjs/tools/preparedSubagents.cjs.map +1 -0
  25. package/dist/cjs/tools/search/rerankers.cjs +6 -4
  26. package/dist/cjs/tools/search/rerankers.cjs.map +1 -1
  27. package/dist/cjs/tools/search/search.cjs +14 -2
  28. package/dist/cjs/tools/search/search.cjs.map +1 -1
  29. package/dist/cjs/tools/search/tool.cjs +1 -1
  30. package/dist/esm/graphs/Graph.mjs +21 -4
  31. package/dist/esm/graphs/Graph.mjs.map +1 -1
  32. package/dist/esm/llm/invoke.mjs +21 -6
  33. package/dist/esm/llm/invoke.mjs.map +1 -1
  34. package/dist/esm/main.mjs +2 -2
  35. package/dist/esm/stream.mjs +39 -2
  36. package/dist/esm/stream.mjs.map +1 -1
  37. package/dist/esm/tools/BashExecutor.mjs +3 -2
  38. package/dist/esm/tools/BashExecutor.mjs.map +1 -1
  39. package/dist/esm/tools/BashProgrammaticToolCalling.mjs +2 -1
  40. package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
  41. package/dist/esm/tools/CodeExecutor.mjs +27 -10
  42. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  43. package/dist/esm/tools/ProgrammaticToolCalling.mjs +6 -5
  44. package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
  45. package/dist/esm/tools/ToolNode.mjs +95 -18
  46. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  47. package/dist/esm/tools/ToolSearch.mjs +129 -25
  48. package/dist/esm/tools/ToolSearch.mjs.map +1 -1
  49. package/dist/esm/tools/diagnostics.mjs +25 -0
  50. package/dist/esm/tools/diagnostics.mjs.map +1 -0
  51. package/dist/esm/tools/local/resolveLocalExecutionTools.mjs +1 -1
  52. package/dist/esm/tools/preparedSubagents.mjs +128 -0
  53. package/dist/esm/tools/preparedSubagents.mjs.map +1 -0
  54. package/dist/esm/tools/search/rerankers.mjs +6 -5
  55. package/dist/esm/tools/search/rerankers.mjs.map +1 -1
  56. package/dist/esm/tools/search/search.mjs +14 -2
  57. package/dist/esm/tools/search/search.mjs.map +1 -1
  58. package/dist/esm/tools/search/tool.mjs +1 -1
  59. package/dist/types/graphs/Graph.d.ts +6 -1
  60. package/dist/types/tools/CodeExecutor.d.ts +13 -2
  61. package/dist/types/tools/ToolNode.d.ts +13 -1
  62. package/dist/types/tools/ToolSearch.d.ts +46 -2
  63. package/dist/types/tools/diagnostics.d.ts +52 -0
  64. package/dist/types/tools/preparedSubagents.d.ts +26 -0
  65. package/dist/types/tools/search/rerankers.d.ts +10 -0
  66. package/dist/types/types/tools.d.ts +17 -0
  67. package/package.json +3 -2
  68. package/src/graphs/Graph.ts +63 -5
  69. package/src/llm/invoke.ts +35 -8
  70. package/src/stream.ts +70 -1
  71. package/src/tools/BashExecutor.ts +9 -4
  72. package/src/tools/BashProgrammaticToolCalling.ts +6 -3
  73. package/src/tools/CodeExecutor.ts +88 -15
  74. package/src/tools/ProgrammaticToolCalling.ts +24 -12
  75. package/src/tools/ToolNode.ts +189 -43
  76. package/src/tools/ToolSearch.ts +278 -28
  77. package/src/tools/diagnostics.ts +107 -0
  78. package/src/tools/preparedSubagents.ts +228 -0
  79. package/src/tools/search/rerankers.ts +18 -3
  80. package/src/tools/search/search.ts +30 -5
  81. package/src/types/tools.ts +17 -0
@@ -1 +1 @@
1
- {"version":3,"file":"search.mjs","names":[],"sources":["../../../../src/tools/search/search.ts"],"mappings":";;;;;;;;AAeA,MAAM,0BAA0B;AAEhC,MAAM,UAAU;CACd,YAAY,SAAyB;EACnC,IAAI,CAAC,MAAM,OAAO;EAelB,OAZuB,KAAK,QAAQ,SAAS,IAAI,CAAC,CAAC,QAAQ,OAAO,IAI5B,CAAC,CAAC,QAAQ,UAAU,IAGnB,CAAC,CAAC,QAAQ,qBAAqB,IAGlC,CAAC,CAAC,QAAQ,WAAW,GAEtC,CAAC,CAAC,KAAK;CAC5B;CACA,WAAW,OACT,MACA,YAKsB;EACtB,MAAM,YAAY,SAAS,aAAa;EACxC,MAAM,eAAe,SAAS,gBAAgB;EAS9C,OAAO,MAAM,IANQ,+BAA+B;GAClD,YAHiB,SAAS,cAAc,CAAC,QAAQ,IAAI;GAIrD;GACA;EACF,CAEoB,CAAC,CAAC,UAAU,IAAI;CACtC;CAEA,YAAY,OACV,OACA,SAKA,WACwB;EAExB,MAAM,UAAU,UAAU,oBAAoB;EAC9C,MAAM,WAAW,MAAM,KAAK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IACZ;IACA;IACA;IACA;IACA,OAAO;IACP,QAAQ;GACV,CAAC,CACH;GAGF,MAAM,QAAQ,IAAI,QAAQ;GAE1B,IAAI,OAAO,KAAK,QAAQ,SAAS,GAC/B,yBAAyB,OAAO,KAAK,SAAS,SAAS;GAGzD,IAAI,QAAQ,WAAW,SAAS,GAC9B,yBAAyB,YAAY,SAAS;GAGhD,OAAO,OAAO;EAChB,SAAS,OAAO;GACd,QAAQ,MAAM,4BAA4B,KAAK;GAC/C,OAAO;IACL,SAAS,CAAC;IACV,YAAY,CAAC;IACb,QAAQ,CAAC;IACT,iBAAiB,CAAC;IAClB,GAAG,OAAO;IACV,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC9D;EACF,UAAU;GACR,IAAI,gBAAgB,MAClB,QAAQ,MAAM;EAElB;CACF;CAEA,OAAO;EACL;EACA;CACF;AACF;AAGA,SAAS,aACP,SACA,WACA,kBACU;CACV,MAAM,QAAkB,CAAC;CAEzB,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,MAAM;EAEf,IAAI,oBAAoB,iBAAiB,IAAI,OAAO,IAAI,GACtD;EAGF,MAAM,KAAK,OAAO,IAAI;EACtB,IAAI,kBACF,iBAAiB,IAAI,OAAO,IAAI;EAElC,UAAU,IAAI,OAAO,MAAM,MAAuB;CACpD;CAGF,OAAO;AACT;AAGA,SAAS,yBACP,SACA,WACM;CACN,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,SAAS,QAAQ;EACvB,MAAM,gBAAgB,UAAU,IAAI,OAAO,IAAI;EAC/C,IAAI,eACF,QAAQ,KAAK;GACX,GAAG;GACH,GAAG;EACL;CAEJ;AACF"}
@@ -5,6 +5,7 @@ import { formatResultsForLLM } from "./format.mjs";
5
5
  import { INTENT_PROPERTY } from "../intentArg.mjs";
6
6
  import { WebSearchToolDescription, WebSearchToolName, countrySchema, dateSchema, imagesSchema, newsSchema, querySchema, videosSchema } from "./schema.mjs";
7
7
  import { createSearchMetrics } from "./metrics.mjs";
8
+ import { createReranker } from "./rerankers.mjs";
8
9
  import { createSearchAPI, createSourceProcessor } from "./search.mjs";
9
10
  import { createKeenableScraper } from "./keenable-scraper.mjs";
10
11
  import { createSerperScraper } from "./serper-scraper.mjs";
@@ -12,7 +13,6 @@ import { createTavilyScraper } from "./tavily-scraper.mjs";
12
13
  import { createFirecrawlScraper } from "./firecrawl.mjs";
13
14
  import { createCrwScraper } from "./crw-scraper.mjs";
14
15
  import { expandHighlights } from "./highlights.mjs";
15
- import { createReranker } from "./rerankers.mjs";
16
16
  import { tool } from "@langchain/core/tools";
17
17
  //#region src/tools/search/tool.ts
18
18
  function resolveSearchOutcome(data, query) {
@@ -11,6 +11,7 @@ import type * as t from '@/types';
11
11
  import { StreamLimitExceededError } from '@/llm/streamLimits';
12
12
  import { SubagentExecutor } from '@/tools/subagent';
13
13
  import { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
14
+ import { PreparedSubagents, PreparedSubagentError } from '@/tools/preparedSubagents';
14
15
  import { ToolNode as CustomToolNode } from '@/tools/ToolNode';
15
16
  import { AgentContext } from '@/agents/AgentContext';
16
17
  import { HandlerRegistry } from '@/events';
@@ -235,6 +236,8 @@ export declare abstract class Graph<T extends t.BaseGraphState = t.BaseGraphStat
235
236
  */
236
237
  private _compiledToolNodes;
237
238
  private _subagentExecutors;
239
+ readonly preparedSubagents: PreparedSubagents;
240
+ protected readonly subagentToolNodes: Map<string, CustomToolNode<t.BaseGraphState>>;
238
241
  getOrCreateFileCheckpointer(): t.LocalFileCheckpointer | undefined;
239
242
  }
240
243
  export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
@@ -348,7 +351,7 @@ export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode>
348
351
  * the composed constructor signal (child graphs own separate controllers).
349
352
  * Providers can translate either abort into a generic error, and recovery
350
353
  * paths must not run in that state. */
351
- protected resolveTrippedBreakerReason(breakerSignal?: AbortSignal): StreamLimitExceededError | undefined;
354
+ protected resolveTrippedBreakerReason(breakerSignal?: AbortSignal): StreamLimitExceededError | PreparedSubagentError | undefined;
352
355
  /**
353
356
  * Seals charged against `preemption.maxSeals`. Per-turn: cleared by both
354
357
  * reset paths so a fresh turn gets a fresh budget, while a HITL resume —
@@ -647,6 +650,8 @@ export declare class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode>
647
650
  * Returns a map where key is the contentPart index and value is the agentId
648
651
  */
649
652
  getContentPartAgentMap(): Map<number, string>;
653
+ canPrestartSubagents(agentContext?: AgentContext): boolean;
654
+ prestartSubagent(call: ToolCall, attempt: string, agentContext?: AgentContext): void;
650
655
  initializeTools({ currentTools, currentToolMap, agentContext, }: {
651
656
  currentTools?: t.GraphTools;
652
657
  currentToolMap?: t.ToolMap;
@@ -1,4 +1,5 @@
1
1
  import { DynamicStructuredTool } from '@langchain/core/tools';
2
+ import type { CodeApiMethod } from '@/tools/diagnostics';
2
3
  import type * as t from '@/types';
3
4
  import { Constants } from '@/common';
4
5
  export { appendCodeSessionFileSummary, stripCodeSessionFileSummary, } from '@/tools/CodeSessionFileSummary';
@@ -57,11 +58,21 @@ export declare function buildCodeApiExecutionErrorMessage(response: {
57
58
  error?: unknown;
58
59
  stderr?: unknown;
59
60
  }): string;
60
- export declare function resolveCodeApiAuthHeaders(authHeaders?: t.CodeApiAuthHeaders): Promise<t.CodeApiAuthHeaderMap>;
61
+ export declare function resolveCodeApiAuthHeaders(authHeaders?: t.CodeApiAuthHeaders, options?: {
62
+ recoverable?: boolean;
63
+ }): Promise<t.CodeApiAuthHeaderMap>;
61
64
  export declare function addCodeApiExecutionProfileHeader(headers: t.CodeApiAuthHeaderMap, executionProfile?: t.CodeApiExecutionProfile): t.CodeApiAuthHeaderMap;
62
- export declare function buildCodeApiHttpErrorMessage(_method: string, _endpoint: string, response: {
65
+ type CodeApiErrorResponse = {
63
66
  status: number;
64
67
  text: () => Promise<string>;
68
+ /** node-fetch types this as `NodeJS.ReadableStream`, which does not declare
69
+ * `destroy`; every runtime instance is a `Readable`, and a test double may
70
+ * supply nothing at all. */
71
+ body?: NodeJS.ReadableStream | null;
72
+ };
73
+ export declare function buildCodeApiHttpErrorMessage(method: CodeApiMethod, _endpoint: string, response: CodeApiErrorResponse, options?: {
74
+ recoverable?: boolean;
75
+ profile?: t.CodeApiExecutionProfile;
65
76
  }): Promise<string>;
66
77
  export declare const CodeExecutionToolDescription: string;
67
78
  /**
@@ -212,6 +212,7 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
212
212
  private getBreakerSignal?;
213
213
  /** Owning graph's immutable run scope; captured once per batch. */
214
214
  private getRunScope?;
215
+ private preparedSubagents?;
215
216
  /**
216
217
  * Monotonic counter used to mint a unique scope id for anonymous
217
218
  * batches (ones invoked without a `run_id` in
@@ -220,8 +221,9 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
220
221
  * other's in-flight state.
221
222
  */
222
223
  private anonBatchCounter;
223
- constructor({ tools, toolMap, name, tags, trace, runLangfuse, agentLangfuse, errorHandler, toolCallStepIds, handleToolErrors, loadRuntimeTools, toolRegistry, toolDefinitions, getDiscoveredToolNames, sessions, codeSessionKey, eventDrivenMode, eagerEventToolExecution, eagerEventToolExecutions, eagerEventToolUsageCount, eagerEventToolSuppressions, agentId, executingAgentId, executingAgentName, rootAgentId, rootAgentName, directToolNames, interruptingToolNames, codeSessionToolNames, maxContextTokens, maxToolResultChars, hookRegistry, humanInTheLoop, toolOutputReferences, toolOutputRegistry, toolExecution, fileCheckpointer, getBreakerSignal, getRunScope, restoreRunStepResumeState, createRunStepResumeState, }: t.ToolNodeConstructorParams);
224
+ constructor({ tools, toolMap, name, tags, trace, runLangfuse, agentLangfuse, errorHandler, toolCallStepIds, handleToolErrors, loadRuntimeTools, toolRegistry, toolDefinitions, getDiscoveredToolNames, sessions, codeSessionKey, eventDrivenMode, eagerEventToolExecution, eagerEventToolExecutions, eagerEventToolUsageCount, eagerEventToolSuppressions, agentId, executingAgentId, executingAgentName, rootAgentId, rootAgentName, directToolNames, interruptingToolNames, codeSessionToolNames, maxContextTokens, maxToolResultChars, hookRegistry, humanInTheLoop, toolOutputReferences, toolOutputRegistry, toolExecution, fileCheckpointer, getBreakerSignal, getRunScope, preparedSubagents, restoreRunStepResumeState, createRunStepResumeState, }: t.ToolNodeConstructorParams);
224
225
  invoke(input: any, options?: Partial<RunnableConfig>): Promise<any>;
226
+ private withToolScope;
225
227
  /**
226
228
  * Returns the run-scoped tool output registry, or `undefined` when
227
229
  * the feature is disabled.
@@ -281,6 +283,16 @@ export declare class ToolNode<T = any> extends RunnableCallable<T, T> {
281
283
  restoreSubagentResumeState(state: SubagentToolNodeResumeState): void;
282
284
  private recordToolUsageTurn;
283
285
  private recordEventToolPlanningTurn;
286
+ /**
287
+ * Forward the graph state as langgraph 1.4's `runtime.state` so
288
+ * tools can read it off their second argument instead of the
289
+ * deprecated `getCurrentTaskInput()` (which relies on
290
+ * `node:async_hooks` and is browser-incompatible). Shape mirrors
291
+ * langgraph's prebuilt ToolNode runtime exactly.
292
+ */
293
+ private invokeWithRuntime;
294
+ /** Only Graph's built-in subagent binding is allowed to call this seam. */
295
+ prestartSubagent(call: ToolCall, attempt: string, config: RunnableConfig, capacity: number): void;
284
296
  /**
285
297
  * Runs a single tool call with error handling.
286
298
  *
@@ -117,6 +117,48 @@ declare function extractMcpServerName(toolName: string): string | undefined;
117
117
  * @returns True if the tool belongs to the specified server
118
118
  */
119
119
  declare function isFromMcpServer(toolName: string, serverName: string): boolean;
120
+ /**
121
+ * Canonical form used for lenient matching. It folds case and treats the
122
+ * separators a host may rewrite as equivalent — LibreChat turns
123
+ * `ClickHouse Cloud` into `ClickHouse_Cloud`, so a model asking for
124
+ * `clickhouse-cloud` is naming the same server.
125
+ *
126
+ * **No character is ever discarded.** Every incorrect match this resolver has
127
+ * produced came from deleting characters, because deleting merges two distinct
128
+ * names onto one key: dropping non-ASCII made `éfoo` equal `foo`, dropping
129
+ * combining marks made `İfoo` equal `ifoo`, and dropping symbols made `❤️`
130
+ * equal `☀️`. Collapsing separators is the only equivalence intended here, so
131
+ * it is the only one performed.
132
+ *
133
+ * Case is folded with `toLowerCase` alone. A round trip through uppercase
134
+ * would additionally equate a Greek final sigma with its medial form, but it
135
+ * also equates dotless `ı` with ASCII `i`, which Unicode case folding keeps
136
+ * apart — and a false match hands over another server's tools while a missed
137
+ * one only produces the message naming the servers that do exist. The safe
138
+ * direction is the one taken here.
139
+ */
140
+ declare function canonicalizeServerName(serverName: string): string;
141
+ /**
142
+ * Maps requested server names onto the servers that actually have tools
143
+ * registered, so a near-miss filters instead of silently returning nothing.
144
+ *
145
+ * Exact names win, then case/separator-insensitive matches, then the
146
+ * mcp-prefix-stripped form. Trying them in that order keeps a deployment that
147
+ * runs both `github` and `mcp-github` unambiguous: each resolves to itself.
148
+ *
149
+ * Several registered names can still share one canonical form (`foo-bar` and
150
+ * `foobar`). An inexact request cannot choose between them, so every candidate
151
+ * is returned rather than whichever was seen first: a superset is recoverable
152
+ * by reading the tool names, an arbitrary pick is not.
153
+ *
154
+ * @param requested - Server names as supplied by the caller
155
+ * @param available - Server names present in the tool registry
156
+ * @returns The registry names to filter by, and any request that matched none
157
+ */
158
+ declare function resolveServerFilters(requested: string[], available: string[]): {
159
+ resolved: string[];
160
+ unresolved: string[];
161
+ };
120
162
  /**
121
163
  * Checks if a tool belongs to any of the specified MCP servers.
122
164
  * @param toolName - The full tool name
@@ -206,9 +248,11 @@ declare function getDeferredToolsListing(toolRegistry: t.LCToolRegistry | undefi
206
248
  * @param tools - Array of tool metadata from the server(s)
207
249
  * @param serverNames - The MCP server name(s)
208
250
  * @param nameFormat - Whether to show 'full' names (tool_mcp_server) or 'base' names (tool only)
251
+ * @param notes - Diagnostics about requested servers that were not searched;
252
+ * carried inside the JSON so the output stays parseable
209
253
  * @returns JSON string showing all tools grouped by server
210
254
  */
211
- declare function formatServerListing(tools: t.ToolMetadata[], serverNames: string | string[], nameFormat?: t.McpNameFormat): string;
255
+ declare function formatServerListing(tools: t.ToolMetadata[], serverNames: string | string[], nameFormat?: t.McpNameFormat, notes?: string[]): string;
212
256
  /**
213
257
  * Creates a Tool Search tool for discovering tools from a large registry.
214
258
  *
@@ -238,4 +282,4 @@ declare function formatServerListing(tools: t.ToolMetadata[], serverNames: strin
238
282
  * await tool.invoke({ query: 'expense' });
239
283
  */
240
284
  declare function createToolSearch(initParams?: t.ToolSearchParams): DynamicStructuredTool;
241
- export { createToolSearch, performLocalSearch, extractMcpServerName, isFromMcpServer, isFromAnyMcpServer, normalizeServerFilter, getAvailableMcpServers, getDeferredToolsListing, getBaseToolName, formatServerListing, sanitizeRegex, escapeRegexSpecialChars, isDangerousPattern, countNestedGroups, hasNestedQuantifiers, };
285
+ export { createToolSearch, performLocalSearch, extractMcpServerName, isFromMcpServer, isFromAnyMcpServer, resolveServerFilters, canonicalizeServerName, normalizeServerFilter, getAvailableMcpServers, getDeferredToolsListing, getBaseToolName, formatServerListing, sanitizeRegex, escapeRegexSpecialChars, isDangerousPattern, countNestedGroups, hasNestedQuantifiers, };
@@ -0,0 +1,52 @@
1
+ import type * as t from '@/types';
2
+ /**
3
+ * Operator diagnostics for the Code API tools.
4
+ *
5
+ * Every failure these tools surface to the model is reduced to a fixed
6
+ * sentence, so this log is the only surviving account of what went wrong —
7
+ * which also makes it the one place a credential can escape by accident. It
8
+ * escaped repeatedly while any field was quoted from something the tools did
9
+ * not produce: a response body echoing the header that was sent, an error
10
+ * message quoting an excerpt of a malformed signing key, a `stack` whose first
11
+ * line is that message, a writable `name`, a configured base URL carrying a
12
+ * capability in its path or its authority.
13
+ *
14
+ * Filtering those carriers case by case never converged, because the shape of
15
+ * a credential inside free text is not decidable. The rule here is structural
16
+ * instead: a diagnostic NAMES what happened using values this module owns, and
17
+ * QUOTES nothing it received. `CodeApiDiagnosticDetail` is a closed union of
18
+ * such values, so host-authored text cannot reach a log without failing to
19
+ * compile — and adding a field means widening that union in this file, which
20
+ * is the point at which the question gets asked.
21
+ */
22
+ export type CodeApiMethod = 'GET' | 'POST';
23
+ type CodeApiProfileLabel = t.CodeApiExecutionProfile | 'unset';
24
+ /** Built-in error types, the `typeof` results for a non-Error rejection, and
25
+ * the two labels this module supplies when neither applies. */
26
+ type CodeApiErrorLabel = 'SyntaxError' | 'TypeError' | 'RangeError' | 'ReferenceError' | 'URIError' | 'EvalError' | 'Error' | 'UndescribableError' | 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
27
+ export type CodeApiDiagnosticDetail = {
28
+ type: CodeApiErrorLabel;
29
+ } | {
30
+ method: CodeApiMethod;
31
+ profile: CodeApiProfileLabel;
32
+ status: number;
33
+ } | {
34
+ files: 'none';
35
+ };
36
+ /**
37
+ * Classifies a rejection without reading anything off it. `instanceof` walks
38
+ * the prototype chain, so an accessor trap is never reached; the guard covers
39
+ * a `getPrototypeOf` trap, which would otherwise cost both the log and the
40
+ * rejection.
41
+ */
42
+ export declare function describeCodeApiError(error: unknown): {
43
+ type: CodeApiErrorLabel;
44
+ };
45
+ type CodeApiDiagnosticSource = 'CodeExecutor' | 'BashExecutor' | 'ProgrammaticToolCalling' | 'BashProgrammaticToolCalling';
46
+ /**
47
+ * Console is the SDK's diagnostic channel; a winston logger is the host's
48
+ * concern. Hosts correlate these lines with their own request-scoped logs,
49
+ * which is where received identifiers such as a session id belong.
50
+ */
51
+ export declare function logCodeApiDiagnostic(source: CodeApiDiagnosticSource, level: 'debug' | 'warn' | 'error', message: string, detail: CodeApiDiagnosticDetail): void;
52
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { RunnableConfig } from '@langchain/core/runnables';
2
+ import type { ToolCall } from '@langchain/core/messages/tool';
3
+ /** A model attempt cannot safely retry after delegated work has started. */
4
+ export declare class PreparedSubagentError extends Error {
5
+ constructor(message: string, options?: ErrorOptions);
6
+ }
7
+ /**
8
+ * Owns speculative invocation work, never tool results or graph state. Only
9
+ * explicitly open model attempts admit work; closing an attempt fences late
10
+ * callbacks without retaining tombstones. Normal ToolNode execution adopts the
11
+ * raw output and performs its existing lifecycle/output processing once.
12
+ */
13
+ export declare class PreparedSubagents {
14
+ private readonly attempts;
15
+ private readonly reservations;
16
+ private readonly running;
17
+ private epoch;
18
+ begin(attempt: string, config?: RunnableConfig): void;
19
+ getConfig(attempt: string): RunnableConfig | undefined;
20
+ isOpen(attempt: string): boolean;
21
+ start(attempt: string, owner: string, call: ToolCall, capacity: number, invoke: (signal: AbortSignal) => Promise<unknown>): boolean;
22
+ finish(attempt: string, calls?: ToolCall[], cause?: unknown): void;
23
+ owns(owner: string, call: ToolCall): boolean;
24
+ take(owner: string, call: ToolCall): Promise<unknown> | undefined;
25
+ clear(): void;
26
+ }
@@ -1,4 +1,14 @@
1
1
  import type * as t from './types';
2
+ /**
3
+ * Ranking used whenever no reranker scores the chunks: the candidates' own
4
+ * order, capped at `topK`, with a neutral score.
5
+ *
6
+ * Exported because it is not only a *fallback*. With `rerankerType: 'none'`
7
+ * there is no reranker to fall back from, and the search pipeline needs the
8
+ * same ranking to hand the scraped text downstream — see `getHighlights` in
9
+ * `./search`.
10
+ */
11
+ export declare const getDefaultRanking: (documents: string[], topK: number) => t.Highlight[];
2
12
  export declare abstract class BaseReranker {
3
13
  protected apiKey: string | undefined;
4
14
  protected logger: t.Logger;
@@ -3,6 +3,7 @@ import type { StructuredToolInterface } from '@langchain/core/tools';
3
3
  import type { ToolCall } from '@langchain/core/messages/tool';
4
4
  import type { MessageContentComplex, RunStepResumeState, ToolErrorData } from './stream';
5
5
  import type { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
6
+ import type { PreparedSubagents } from '@/tools/preparedSubagents';
6
7
  import type { RunBreakerScope } from '@/llm/streamLimits';
7
8
  import type { HumanInTheLoopConfig } from './hitl';
8
9
  import type { LangfuseConfig } from './graph';
@@ -42,6 +43,13 @@ export type EagerEventToolExecutionConfig = {
42
43
  * execution with final args.
43
44
  */
44
45
  excludeToolNames?: string[];
46
+ /**
47
+ * Maximum retained early foreground subagent invocations per graph. Defaults
48
+ * to 4; 0 disables them. Checkpoints, parent tool hooks, background calls and
49
+ * control-flow graph tools retain normal batch execution. Once a child has
50
+ * started, a failed/revised model attempt fails instead of automatically retrying.
51
+ */
52
+ maxPendingSubagents?: number;
45
53
  };
46
54
  export type EagerEventToolExecutionOutcome = {
47
55
  results: ToolExecuteResult[];
@@ -273,6 +281,8 @@ export type ToolNodeOptions = {
273
281
  * controller.
274
282
  */
275
283
  getRunScope?: () => RunBreakerScope;
284
+ /** Internal graph-owned prepared invocation registry. */
285
+ preparedSubagents?: PreparedSubagents;
276
286
  /** SDK-owned checkpoint bridge for open run-step lifecycle state. */
277
287
  restoreRunStepResumeState?: (state?: RunStepResumeState, config?: RunnableConfig) => void;
278
288
  /** SDK-owned checkpoint snapshot for open run-step lifecycle state. */
@@ -1160,6 +1170,13 @@ export type ToolSearchArtifact = {
1160
1170
  total_searched: number;
1161
1171
  pattern: string;
1162
1172
  error?: string;
1173
+ /** Servers that had tools to search, emitted when a server filter matched
1174
+ * nothing so the caller can see what it could have asked for. */
1175
+ available_mcp_servers?: string[];
1176
+ /** Requested servers that matched no registered server. */
1177
+ unmatched_mcp_servers?: string[];
1178
+ /** Requested servers that exist but had no tools left to search. */
1179
+ idle_mcp_servers?: string[];
1163
1180
  };
1164
1181
  };
1165
1182
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/agents",
3
- "version": "3.7.20",
3
+ "version": "3.7.22",
4
4
  "reova": {
5
5
  "enabled": true,
6
6
  "endpoint": "https://telemetry.reo.dev/data"
@@ -280,6 +280,7 @@
280
280
  },
281
281
  "overrides": {
282
282
  "@langchain/openai": "$@langchain/openai",
283
+ "@langchain/langgraph-checkpoint": "^1.1.5",
283
284
  "@browserbasehq/stagehand": {
284
285
  "openai": "$openai"
285
286
  },
@@ -339,7 +340,7 @@
339
340
  "@anthropic-ai/sandbox-runtime": "^0.0.67",
340
341
  "@anthropic-ai/vertex-sdk": "^0.12.0",
341
342
  "@eslint/js": "^10.0.1",
342
- "@langchain/langgraph-checkpoint-mongodb": "^1.4.0",
343
+ "@langchain/langgraph-checkpoint-mongodb": "^1.4.1",
343
344
  "@swc/core": "^1.6.13",
344
345
  "@types/jest": "^30.0.0",
345
346
  "@types/node": "^24.13.1",
@@ -146,6 +146,7 @@ import {
146
146
  findCallback,
147
147
  type CallbackEntry,
148
148
  } from '@/utils/callbacks';
149
+ import { PreparedSubagents, PreparedSubagentError } from '@/tools/preparedSubagents';
149
150
  import { ToolNode as CustomToolNode, toolsCondition } from '@/tools/ToolNode';
150
151
  import { shouldTraceToolNodeForLangfuse } from '@/langfuseToolOutputTracing';
151
152
  import { createLocalCodingToolBundle } from '@/tools/local/LocalCodingTools';
@@ -898,6 +899,7 @@ export abstract class Graph<
898
899
  * Call after a run completes and content has been extracted.
899
900
  */
900
901
  clearHeavyState(): void {
902
+ this.preparedSubagents.clear();
901
903
  this.config = undefined;
902
904
  this.signal = undefined;
903
905
  this.callerSignal = undefined;
@@ -1239,6 +1241,8 @@ export abstract class Graph<
1239
1241
  restoreSubagentResumeState(state: SubagentToolNodeResumeState): void;
1240
1242
  }> = new Set();
1241
1243
  private _subagentExecutors = new Set<SubagentExecutor>();
1244
+ readonly preparedSubagents = new PreparedSubagents();
1245
+ protected readonly subagentToolNodes = new Map<string, CustomToolNode<t.BaseGraphState>>();
1242
1246
  public getOrCreateFileCheckpointer(): t.LocalFileCheckpointer | undefined {
1243
1247
  // Return the cached instance unconditionally if one exists. The
1244
1248
  // toolExecution check below decides whether to *create* a new
@@ -1397,16 +1401,16 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
1397
1401
  * paths must not run in that state. */
1398
1402
  protected resolveTrippedBreakerReason(
1399
1403
  breakerSignal: AbortSignal = this.breakerAbort.signal
1400
- ): StreamLimitExceededError | undefined {
1404
+ ): StreamLimitExceededError | PreparedSubagentError | undefined {
1401
1405
  if (
1402
1406
  breakerSignal.aborted &&
1403
- breakerSignal.reason instanceof StreamLimitExceededError
1407
+ (breakerSignal.reason instanceof StreamLimitExceededError || breakerSignal.reason instanceof PreparedSubagentError)
1404
1408
  ) {
1405
1409
  return breakerSignal.reason;
1406
1410
  }
1407
1411
  if (
1408
1412
  this.signal?.aborted === true &&
1409
- this.signal.reason instanceof StreamLimitExceededError
1413
+ (this.signal.reason instanceof StreamLimitExceededError || this.signal.reason instanceof PreparedSubagentError)
1410
1414
  ) {
1411
1415
  return this.signal.reason;
1412
1416
  }
@@ -1581,6 +1585,7 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
1581
1585
  /* Init */
1582
1586
 
1583
1587
  resetValues(keepContent?: boolean, checkpointScope?: string): void {
1588
+ this.preparedSubagents.clear();
1584
1589
  this.resetSubagentCheckpointThreadIds();
1585
1590
  this.messages = [];
1586
1591
  this.hasRestoredCheckpointMessages = false;
@@ -2717,6 +2722,49 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
2717
2722
 
2718
2723
  /* Graph */
2719
2724
 
2725
+ canPrestartSubagents(agentContext?: AgentContext): boolean {
2726
+ if (
2727
+ this.eagerEventToolExecution?.enabled !== true ||
2728
+ (this.eagerEventToolExecution.maxPendingSubagents ?? 4) <= 0 ||
2729
+ this.compileOptions?.checkpointer != null ||
2730
+ this.humanInTheLoop?.enabled === true ||
2731
+ (this.interruptingToolNames?.length ?? 0) > 0 ||
2732
+ agentContext == null ||
2733
+ !this.subagentToolNodes.has(agentContext.agentId)
2734
+ ) {
2735
+ return false;
2736
+ }
2737
+ const graphTools = agentContext.graphTools as t.GenericTool[] | undefined;
2738
+ return (
2739
+ graphTools?.length === 1 &&
2740
+ graphTools[0].name === Constants.SUBAGENT &&
2741
+ SUBAGENT_REPLAY_CONTROLLER in graphTools[0]
2742
+ );
2743
+ }
2744
+
2745
+ prestartSubagent(
2746
+ call: ToolCall,
2747
+ attempt: string,
2748
+ agentContext?: AgentContext
2749
+ ): void {
2750
+ const config = this.preparedSubagents.getConfig(attempt);
2751
+ if (
2752
+ !this.canPrestartSubagents(agentContext) ||
2753
+ config == null ||
2754
+ agentContext == null
2755
+ ) {
2756
+ return;
2757
+ }
2758
+ this.subagentToolNodes
2759
+ .get(agentContext.agentId)
2760
+ ?.prestartSubagent(
2761
+ call,
2762
+ attempt,
2763
+ config,
2764
+ this.eagerEventToolExecution?.maxPendingSubagents ?? 4
2765
+ );
2766
+ }
2767
+
2720
2768
  initializeTools({
2721
2769
  currentTools,
2722
2770
  currentToolMap,
@@ -2791,6 +2839,7 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
2791
2839
  hookRegistry: this.hookRegistry,
2792
2840
  humanInTheLoop: this.humanInTheLoop,
2793
2841
  eagerEventToolExecution: this.eagerEventToolExecution,
2842
+ preparedSubagents: this.preparedSubagents,
2794
2843
  codeSessionToolNames: this.codeSessionToolNames,
2795
2844
  eagerEventToolExecutions: this.eagerEventToolExecutions,
2796
2845
  eagerEventToolUsageCount: this.getEagerEventToolUsageCount(
@@ -2816,6 +2865,9 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
2816
2865
  StandardGraph.handleToolCallErrorStatic(this, data, metadata),
2817
2866
  });
2818
2867
  this.registerCompiledToolNode(node);
2868
+ if (agentContext != null) {
2869
+ this.subagentToolNodes.set(agentContext.agentId, node);
2870
+ }
2819
2871
  return node;
2820
2872
  }
2821
2873
 
@@ -4092,7 +4144,10 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
4092
4144
  * succeeding fallback would resolve a run the public contract says
4093
4145
  * must reject. Rethrow before any recovery path.
4094
4146
  */
4095
- if (primaryError instanceof StreamLimitExceededError) {
4147
+ if (
4148
+ primaryError instanceof StreamLimitExceededError ||
4149
+ primaryError instanceof PreparedSubagentError
4150
+ ) {
4096
4151
  /** Tripped before rethrowing so parallel agent nodes' in-flight
4097
4152
  * model calls and subagents stop while the rejection propagates. */
4098
4153
  attemptBreaker.abort(primaryError);
@@ -4342,7 +4397,10 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
4342
4397
  })
4343
4398
  );
4344
4399
  } catch (fallbackError) {
4345
- if (fallbackError instanceof StreamLimitExceededError) {
4400
+ if (
4401
+ fallbackError instanceof StreamLimitExceededError ||
4402
+ fallbackError instanceof PreparedSubagentError
4403
+ ) {
4346
4404
  /** Same treatment as the primary path: a fallback stream that
4347
4405
  * trips the breaker must stop parallel agent nodes' model calls
4348
4406
  * and subagents before the rejection propagates. */