@librechat/agents-types 2.2.6 → 2.2.8

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 (3) hide show
  1. package/package.json +1 -1
  2. package/stream.ts +5 -0
  3. package/tools.ts +3 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/agents-types",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "Type definitions for @librechat/agents",
5
5
  "types": "index.d.ts",
6
6
  "scripts": {
package/stream.ts CHANGED
@@ -93,6 +93,11 @@ export type MessageCreationDetails = {
93
93
  };
94
94
 
95
95
  export type ToolEndData = { input: string | Record<string, unknown>, output?: ToolMessage };
96
+ export type ToolErrorData = {
97
+ id: string,
98
+ name: string,
99
+ error?: Error,
100
+ } & Pick<ToolEndData, 'input'>;
96
101
  export type ToolEndCallback = (data: ToolEndData, metadata?: Record<string, unknown>) => void;
97
102
 
98
103
  export type ProcessedToolCall = {
package/tools.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  import type { RunnableToolLike } from '@langchain/core/runnables';
3
3
  import type { StructuredToolInterface } from '@langchain/core/tools';
4
4
  import type { ToolCall } from '@langchain/core/messages/tool';
5
- import { ContentTypes, EnvVar } from '@/common';
5
+ import type { ToolErrorData } from './stream';
6
+ import { EnvVar } from '@/common';
6
7
 
7
8
  /** Replacement type for `import type { ToolCall } from '@langchain/core/messages/tool'` in order to have stringified args typed */
8
9
  export type CustomToolCall = {
@@ -29,6 +30,7 @@ export type ToolNodeOptions = {
29
30
  handleToolErrors?: boolean;
30
31
  loadRuntimeTools?: ToolRefGenerator;
31
32
  toolCallStepIds?: Map<string, string>;
33
+ errorHandler?: (data: ToolErrorData, metadata?: Record<string, unknown>) => void
32
34
  };
33
35
 
34
36
  export type ToolNodeConstructorParams = ToolRefs & ToolNodeOptions;
@@ -42,11 +44,6 @@ export type ToolEndEvent = {
42
44
  index: number;
43
45
  };
44
46
 
45
- export type ToolCallContent = {
46
- type: ContentTypes.TOOL_CALL;
47
- tool_call: ToolCall;
48
- };
49
-
50
47
  export type CodeEnvFile = {
51
48
  id: string;
52
49
  name: string;