@librechat/agents 3.7.21 → 3.8.0

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 (70) 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/langfuse.cjs +6 -2
  4. package/dist/cjs/langfuse.cjs.map +1 -1
  5. package/dist/cjs/llm/invoke.cjs +21 -6
  6. package/dist/cjs/llm/invoke.cjs.map +1 -1
  7. package/dist/cjs/main.cjs +2 -0
  8. package/dist/cjs/stream.cjs +38 -1
  9. package/dist/cjs/stream.cjs.map +1 -1
  10. package/dist/cjs/tools/ArtifactDelivery.cjs +27 -0
  11. package/dist/cjs/tools/ArtifactDelivery.cjs.map +1 -0
  12. package/dist/cjs/tools/BashExecutor.cjs +6 -1
  13. package/dist/cjs/tools/BashExecutor.cjs.map +1 -1
  14. package/dist/cjs/tools/CodeExecutor.cjs +6 -1
  15. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
  16. package/dist/cjs/tools/ProgrammaticToolCalling.cjs +5 -1
  17. package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
  18. package/dist/cjs/tools/ToolNode.cjs +95 -18
  19. package/dist/cjs/tools/ToolNode.cjs.map +1 -1
  20. package/dist/cjs/tools/ToolSearch.cjs +130 -24
  21. package/dist/cjs/tools/ToolSearch.cjs.map +1 -1
  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/esm/graphs/Graph.mjs +21 -4
  26. package/dist/esm/graphs/Graph.mjs.map +1 -1
  27. package/dist/esm/langfuse.mjs +6 -2
  28. package/dist/esm/langfuse.mjs.map +1 -1
  29. package/dist/esm/llm/invoke.mjs +21 -6
  30. package/dist/esm/llm/invoke.mjs.map +1 -1
  31. package/dist/esm/main.mjs +2 -2
  32. package/dist/esm/stream.mjs +39 -2
  33. package/dist/esm/stream.mjs.map +1 -1
  34. package/dist/esm/tools/ArtifactDelivery.mjs +26 -0
  35. package/dist/esm/tools/ArtifactDelivery.mjs.map +1 -0
  36. package/dist/esm/tools/BashExecutor.mjs +6 -1
  37. package/dist/esm/tools/BashExecutor.mjs.map +1 -1
  38. package/dist/esm/tools/CodeExecutor.mjs +6 -1
  39. package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
  40. package/dist/esm/tools/ProgrammaticToolCalling.mjs +5 -1
  41. package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
  42. package/dist/esm/tools/ToolNode.mjs +95 -18
  43. package/dist/esm/tools/ToolNode.mjs.map +1 -1
  44. package/dist/esm/tools/ToolSearch.mjs +129 -25
  45. package/dist/esm/tools/ToolSearch.mjs.map +1 -1
  46. package/dist/esm/tools/local/resolveLocalExecutionTools.mjs +1 -1
  47. package/dist/esm/tools/preparedSubagents.mjs +128 -0
  48. package/dist/esm/tools/preparedSubagents.mjs.map +1 -0
  49. package/dist/types/graphs/Graph.d.ts +6 -1
  50. package/dist/types/langfuse.d.ts +5 -0
  51. package/dist/types/tools/ArtifactDelivery.d.ts +4 -0
  52. package/dist/types/tools/ToolNode.d.ts +13 -1
  53. package/dist/types/tools/ToolSearch.d.ts +46 -2
  54. package/dist/types/tools/preparedSubagents.d.ts +26 -0
  55. package/dist/types/types/graph.d.ts +8 -0
  56. package/dist/types/types/tools.d.ts +28 -0
  57. package/package.json +1 -1
  58. package/src/graphs/Graph.ts +63 -5
  59. package/src/langfuse.ts +17 -2
  60. package/src/llm/invoke.ts +35 -8
  61. package/src/stream.ts +70 -1
  62. package/src/tools/ArtifactDelivery.ts +50 -0
  63. package/src/tools/BashExecutor.ts +18 -1
  64. package/src/tools/CodeExecutor.ts +18 -1
  65. package/src/tools/ProgrammaticToolCalling.ts +15 -1
  66. package/src/tools/ToolNode.ts +189 -43
  67. package/src/tools/ToolSearch.ts +278 -28
  68. package/src/tools/preparedSubagents.ts +228 -0
  69. package/src/types/graph.ts +8 -0
  70. package/src/types/tools.ts +29 -0
@@ -11,6 +11,7 @@ import type {
11
11
  ToolErrorData,
12
12
  } from './stream';
13
13
  import type { ToolOutputReferenceRegistry } from '@/tools/toolOutputReferences';
14
+ import type { PreparedSubagents } from '@/tools/preparedSubagents';
14
15
  import type { RunBreakerScope } from '@/llm/streamLimits';
15
16
  import type { HumanInTheLoopConfig } from './hitl';
16
17
  import type { LangfuseConfig } from './graph';
@@ -56,6 +57,13 @@ export type EagerEventToolExecutionConfig = {
56
57
  * execution with final args.
57
58
  */
58
59
  excludeToolNames?: string[];
60
+ /**
61
+ * Maximum retained early foreground subagent invocations per graph. Defaults
62
+ * to 4; 0 disables them. Checkpoints, parent tool hooks, background calls and
63
+ * control-flow graph tools retain normal batch execution. Once a child has
64
+ * started, a failed/revised model attempt fails instead of automatically retrying.
65
+ */
66
+ maxPendingSubagents?: number;
59
67
  };
60
68
 
61
69
  export type EagerEventToolExecutionOutcome =
@@ -290,6 +298,8 @@ export type ToolNodeOptions = {
290
298
  * controller.
291
299
  */
292
300
  getRunScope?: () => RunBreakerScope;
301
+ /** Internal graph-owned prepared invocation registry. */
302
+ preparedSubagents?: PreparedSubagents;
293
303
  /** SDK-owned checkpoint bridge for open run-step lifecycle state. */
294
304
  restoreRunStepResumeState?: (
295
305
  state?: RunStepResumeState,
@@ -471,6 +481,14 @@ export type FileRef = {
471
481
 
472
482
  export type FileRefs = FileRef[];
473
483
 
484
+ export type ArtifactDeliveryFailure = {
485
+ code: 'artifact_delivery_failed';
486
+ status: 'partial' | 'failed';
487
+ attempted: number;
488
+ delivered: number;
489
+ failed: number;
490
+ };
491
+
474
492
  export type ExecuteResult = {
475
493
  /**
476
494
  * Execution session id — the (transient) sandbox run that produced
@@ -481,6 +499,7 @@ export type ExecuteResult = {
481
499
  stdout: string;
482
500
  stderr: string;
483
501
  files?: FileRefs;
502
+ artifact_delivery?: ArtifactDeliveryFailure;
484
503
  /**
485
504
  * Durable runtime session id echoed by a stateful Code API backend
486
505
  * (hash of tenant+user+hint). Additive; absent on stateless servers.
@@ -1259,6 +1278,13 @@ export type ToolSearchArtifact = {
1259
1278
  total_searched: number;
1260
1279
  pattern: string;
1261
1280
  error?: string;
1281
+ /** Servers that had tools to search, emitted when a server filter matched
1282
+ * nothing so the caller can see what it could have asked for. */
1283
+ available_mcp_servers?: string[];
1284
+ /** Requested servers that matched no registered server. */
1285
+ unmatched_mcp_servers?: string[];
1286
+ /** Requested servers that exist but had no tools left to search. */
1287
+ idle_mcp_servers?: string[];
1262
1288
  };
1263
1289
  };
1264
1290
 
@@ -1310,6 +1336,7 @@ export type ProgrammaticExecutionResponse = {
1310
1336
  stdout?: string;
1311
1337
  stderr?: string;
1312
1338
  files?: FileRefs;
1339
+ artifact_delivery?: ArtifactDeliveryFailure;
1313
1340
 
1314
1341
  /** Durable runtime session echo from a stateful backend (additive). */
1315
1342
  runtime_session_id?: string;
@@ -1326,6 +1353,7 @@ export type ProgrammaticExecutionArtifact = {
1326
1353
  /** Execution session — see `CodeSessionContext.session_id`. */
1327
1354
  session_id?: string;
1328
1355
  files?: FileRefs;
1356
+ artifact_delivery?: ArtifactDeliveryFailure;
1329
1357
  /** Durable runtime session echo from a stateful backend (additive). */
1330
1358
  runtime_session_id?: string;
1331
1359
  runtime_status?: 'new' | 'reused';
@@ -1392,6 +1420,7 @@ export type CodeExecutionArtifact = {
1392
1420
  /** Execution session — see `CodeSessionContext.session_id`. */
1393
1421
  session_id?: string;
1394
1422
  files?: FileRefs;
1423
+ artifact_delivery?: ArtifactDeliveryFailure;
1395
1424
  /** Durable runtime session echo from a stateful backend (additive). */
1396
1425
  runtime_session_id?: string;
1397
1426
  runtime_status?: 'new' | 'reused';