Skip to content

Commit 49c468b

Browse files
committed
Fix duplicate types.ts by re-exporting from original
1 parent 27c2ba5 commit 49c468b

File tree

2 files changed

+4
-69
lines changed

2 files changed

+4
-69
lines changed

packages/agent/src/core/toolAgent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This directory contains the refactored Tool Agent implementation, split into sma
99
- **messageUtils.ts**: Utilities for handling and formatting messages
1010
- **toolExecutor.ts**: Logic for executing tool calls
1111
- **tokenTracking.ts**: Enhanced utilities for token tracking
12-
- **types.ts**: Consolidated type definitions
12+
- **types.ts**: Additional type definitions specific to toolAgent (re-exports from core/types.ts)
1313

1414
## Usage
1515

packages/agent/src/core/toolAgent/types.ts

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,9 @@
1-
import { z } from 'zod';
2-
import { JsonSchema7Type } from 'zod-to-json-schema';
31
import { CoreMessage } from 'ai';
42

5-
import { Logger } from '../../utils/logger.js';
6-
import { TokenTracker } from '../tokens.js';
3+
// Re-export all types from the original types.ts file
4+
export * from '../types.js';
75

8-
// Re-export existing types from the original types.ts
9-
export type TokenLevel = 'debug' | 'verbose' | 'info' | 'warn' | 'error';
10-
export type pageFilter = 'simple' | 'none' | 'readability';
11-
12-
export type ToolContext = {
13-
logger: Logger;
14-
workingDirectory: string;
15-
headless: boolean;
16-
userSession: boolean;
17-
pageFilter: pageFilter;
18-
tokenTracker: TokenTracker;
19-
};
20-
21-
export type Tool<TParams = Record<string, any>, TReturn = any> = {
22-
name: string;
23-
description: string;
24-
parameters: z.ZodType<TParams>;
25-
returns: z.ZodType<TReturn>;
26-
logPrefix?: string;
27-
28-
logParameters?: (params: TParams, context: ToolContext) => void;
29-
logReturns?: (returns: TReturn, context: ToolContext) => void;
30-
31-
execute: (params: TParams, context: ToolContext) => Promise<TReturn>;
32-
33-
// Keep JsonSchema7Type for backward compatibility and Vercel AI SDK integration
34-
parametersJsonSchema?: JsonSchema7Type;
35-
returnsJsonSchema?: JsonSchema7Type;
36-
};
37-
38-
export type ToolCall = {
39-
id: string;
40-
name: string;
41-
input: any;
42-
};
43-
44-
export type TextContent = {
45-
type: 'text';
46-
text: string;
47-
};
48-
49-
export type ToolUseContent = {
50-
type: 'tool_use';
51-
} & ToolCall;
52-
53-
export type AssistantMessage = {
54-
role: 'assistant';
55-
content: (TextContent | ToolUseContent)[];
56-
};
57-
58-
export type ToolResultContent = {
59-
type: 'tool_result';
60-
tool_use_id: string;
61-
content: string;
62-
};
63-
64-
export type UserMessage = {
65-
role: 'user';
66-
content: (TextContent | ToolResultContent)[];
67-
};
68-
69-
export type Message = AssistantMessage | UserMessage;
70-
71-
// New types specific to toolAgent
6+
// Only define new types specific to toolAgent here
727
export interface ToolAgentResult {
738
result: string;
749
interactions: number;

0 commit comments

Comments
 (0)