chore(cleanup): remove web search skill

Remove search_web and uninstall the now-unused cheerio dependency it
was the only consumer of. The skill's shared test file also covered
document extraction (extractText), so it is removed here; extractText
itself is removed in the following document drag-and-drop cleanup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 20:32:48 +01:00
co-authored by Claude Sonnet 5
parent c99b01a902
commit cf92418bad
7 changed files with 2 additions and 748 deletions
+1 -2
View File
@@ -1,11 +1,10 @@
import type { SkillDefinition } from './types'
import { memorySkills } from './memory'
import { webSkills } from './web'
export type { SkillDefinition } from './types'
export function loadSkills(): SkillDefinition[] {
return [...memorySkills, ...webSkills]
return [...memorySkills]
}
export function findSkill(name: string): SkillDefinition | undefined {
-5
View File
@@ -1,5 +0,0 @@
import type { SkillDefinition } from '../types'
import { searchWeb } from './searchWeb'
// Recherche web, independante de l'OS, commune a toutes les plateformes.
export const webSkills: SkillDefinition[] = [searchWeb]
@@ -1,57 +0,0 @@
import * as cheerio from 'cheerio'
import type { SkillDefinition } from '../types'
import { asString } from '../argUtils'
function resolveRealUrl(ddgHref: string | undefined): string | null {
if (!ddgHref) return null
try {
const url = new URL(ddgHref.startsWith('//') ? `https:${ddgHref}` : ddgHref)
return url.searchParams.get('uddg') ?? ddgHref
} catch {
return ddgHref
}
}
export const searchWeb: SkillDefinition = {
name: 'search_web',
description:
"Fait une vraie recherche web et renvoie les premiers resultats reels (titre, extrait et URL exacte) que tu peux lire et resumer. A utiliser pour toute information recente/actuelle que tu ne connais pas avec certitude, et pour trouver l'URL exacte d'un site avant de l'ouvrir avec navigate_browser (ne jamais deviner un nom de domaine). Ne jamais decrire un faux processus de recherche ou inventer un resultat : appelle cette fonction et base ta reponse uniquement sur ce qu'elle renvoie.",
parameters: {
type: 'object',
properties: {
query: { type: 'string', description: 'Termes de recherche' }
},
required: ['query']
},
execute: async (args) => {
const query = asString(args.query).trim()
if (!query) throw new Error('query manquante')
const response = await fetch(
`https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`,
{
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36'
}
}
)
if (!response.ok) throw new Error(`Recherche web echouee (${response.status})`)
const $ = cheerio.load(await response.text())
const results: string[] = []
$('.result.web-result .result__body').each((_, el) => {
if (results.length >= 5) return
const title = $(el).find('.result__title').text().trim().replace(/\s+/g, ' ')
const snippet = $(el).find('.result__snippet').text().trim().replace(/\s+/g, ' ')
const url = resolveRealUrl($(el).find('.result__a').attr('href'))
if (!title) return
const parts = [title, url, snippet].filter(Boolean)
results.push(parts.join(' — '))
})
if (results.length === 0) return 'Aucun resultat trouve pour cette recherche.'
return results.join('\n')
}
}