|
1 | | -import { createLogger } from '@sim/logger' |
2 | 1 | import { BookOpen, Loader2, MinusCircle, XCircle } from 'lucide-react' |
3 | 2 | import { |
4 | 3 | BaseClientTool, |
5 | 4 | type BaseClientToolMetadata, |
6 | 5 | ClientToolCallState, |
7 | 6 | } from '@/lib/copilot/tools/client/base-tool' |
8 | | -import { ExecuteResponseSuccessSchema } from '@/lib/copilot/tools/shared/schemas' |
9 | | - |
10 | | -interface SearchLibraryDocsArgs { |
11 | | - library_name: string |
12 | | - query: string |
13 | | - version?: string |
14 | | -} |
15 | 7 |
|
16 | 8 | export class SearchLibraryDocsClientTool extends BaseClientTool { |
17 | 9 | static readonly id = 'search_library_docs' |
@@ -52,32 +44,7 @@ export class SearchLibraryDocsClientTool extends BaseClientTool { |
52 | 44 | }, |
53 | 45 | } |
54 | 46 |
|
55 | | - async execute(args?: SearchLibraryDocsArgs): Promise<void> { |
56 | | - const logger = createLogger('SearchLibraryDocsClientTool') |
57 | | - try { |
58 | | - this.setState(ClientToolCallState.executing) |
59 | | - const res = await fetch('/api/copilot/execute-copilot-server-tool', { |
60 | | - method: 'POST', |
61 | | - headers: { 'Content-Type': 'application/json' }, |
62 | | - body: JSON.stringify({ toolName: 'search_library_docs', payload: args || {} }), |
63 | | - }) |
64 | | - if (!res.ok) { |
65 | | - const txt = await res.text().catch(() => '') |
66 | | - throw new Error(txt || `Server error (${res.status})`) |
67 | | - } |
68 | | - const json = await res.json() |
69 | | - const parsed = ExecuteResponseSuccessSchema.parse(json) |
70 | | - this.setState(ClientToolCallState.success) |
71 | | - await this.markToolComplete( |
72 | | - 200, |
73 | | - `Library documentation search complete for ${args?.library_name || 'unknown'}`, |
74 | | - parsed.result |
75 | | - ) |
76 | | - this.setState(ClientToolCallState.success) |
77 | | - } catch (e: any) { |
78 | | - logger.error('execute failed', { message: e?.message }) |
79 | | - this.setState(ClientToolCallState.error) |
80 | | - await this.markToolComplete(500, e?.message || 'Library documentation search failed') |
81 | | - } |
| 47 | + async execute(): Promise<void> { |
| 48 | + return |
82 | 49 | } |
83 | 50 | } |
0 commit comments