|
| 1 | +import { extractParameterKey } from "./display-utils" |
| 2 | + |
1 | 3 | export interface DuplicateDetectionResult { |
2 | 4 | duplicateIds: string[] // IDs to prune (older duplicates) |
3 | 5 | deduplicationDetails: Map<string, { |
@@ -85,76 +87,3 @@ function sortObjectKeys(obj: any): any { |
85 | 87 | } |
86 | 88 | return sorted |
87 | 89 | } |
88 | | - |
89 | | -export function extractParameterKey(metadata: { tool: string, parameters?: any }): string { |
90 | | - if (!metadata.parameters) return '' |
91 | | - |
92 | | - const { tool, parameters } = metadata |
93 | | - |
94 | | - if (tool === "read" && parameters.filePath) { |
95 | | - return parameters.filePath |
96 | | - } |
97 | | - if (tool === "write" && parameters.filePath) { |
98 | | - return parameters.filePath |
99 | | - } |
100 | | - if (tool === "edit" && parameters.filePath) { |
101 | | - return parameters.filePath |
102 | | - } |
103 | | - |
104 | | - if (tool === "list") { |
105 | | - return parameters.path || '(current directory)' |
106 | | - } |
107 | | - if (tool === "glob") { |
108 | | - if (parameters.pattern) { |
109 | | - const pathInfo = parameters.path ? ` in ${parameters.path}` : "" |
110 | | - return `"${parameters.pattern}"${pathInfo}` |
111 | | - } |
112 | | - return '(unknown pattern)' |
113 | | - } |
114 | | - if (tool === "grep") { |
115 | | - if (parameters.pattern) { |
116 | | - const pathInfo = parameters.path ? ` in ${parameters.path}` : "" |
117 | | - return `"${parameters.pattern}"${pathInfo}` |
118 | | - } |
119 | | - return '(unknown pattern)' |
120 | | - } |
121 | | - |
122 | | - if (tool === "bash") { |
123 | | - if (parameters.description) return parameters.description |
124 | | - if (parameters.command) { |
125 | | - return parameters.command.length > 50 |
126 | | - ? parameters.command.substring(0, 50) + "..." |
127 | | - : parameters.command |
128 | | - } |
129 | | - } |
130 | | - |
131 | | - if (tool === "webfetch" && parameters.url) { |
132 | | - return parameters.url |
133 | | - } |
134 | | - if (tool === "websearch" && parameters.query) { |
135 | | - return `"${parameters.query}"` |
136 | | - } |
137 | | - if (tool === "codesearch" && parameters.query) { |
138 | | - return `"${parameters.query}"` |
139 | | - } |
140 | | - |
141 | | - if (tool === "todowrite") { |
142 | | - return `${parameters.todos?.length || 0} todos` |
143 | | - } |
144 | | - if (tool === "todoread") { |
145 | | - return "read todo list" |
146 | | - } |
147 | | - |
148 | | - if (tool === "task" && parameters.description) { |
149 | | - return parameters.description |
150 | | - } |
151 | | - if (tool === "batch") { |
152 | | - return `${parameters.tool_calls?.length || 0} parallel tools` |
153 | | - } |
154 | | - |
155 | | - const paramStr = JSON.stringify(parameters) |
156 | | - if (paramStr === '{}' || paramStr === '[]' || paramStr === 'null') { |
157 | | - return '' |
158 | | - } |
159 | | - return paramStr.substring(0, 50) |
160 | | -} |
0 commit comments