prior-cli 1.1.0 → 1.1.1
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.
- package/lib/tools.js +8 -6
- package/package.json +1 -1
package/lib/tools.js
CHANGED
|
@@ -160,13 +160,15 @@ const TOOLS = {
|
|
|
160
160
|
};
|
|
161
161
|
},
|
|
162
162
|
|
|
163
|
-
async web_search({ query }) {
|
|
163
|
+
async web_search({ query }, { token }) {
|
|
164
164
|
if (!query) throw new Error('"query" is required');
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
const res = await fetch(`${CLI_BASE}/api/web-search`, {
|
|
166
|
+
method: 'POST',
|
|
167
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
|
|
168
|
+
body: JSON.stringify({ query }),
|
|
169
|
+
timeout: 15000,
|
|
170
|
+
});
|
|
171
|
+
if (!res.ok) throw new Error(`Web search error: HTTP ${res.status}`);
|
|
170
172
|
const data = await res.json();
|
|
171
173
|
if (!data.items || !data.items.length) return { output: 'No results found.', summary: '0 results' };
|
|
172
174
|
const results = data.items.map(item => {
|