smart_ide/docs/API/agent-regex-search-api.md
Nicolas Cantu 088eab84b7 Platform docs, services, ia_dev submodule, smart_ide project config
- Add ia_dev submodule (projects/smart_ide on forge 4nk)
- Document APIs, orchestrator, gateway, local-office, rollout
- Add systemd/scripts layout; relocate setup scripts
- Remove obsolete nginx/enso-only docs from this repo scope
2026-04-03 16:07:58 +02:00

2.1 KiB
Raw Permalink Blame History

API — agent-regex-search-api

Service Node : recherche regex sur fichiers via ripgrep (rg), résultats en JSON. Périmètre confiné à REGEX_SEARCH_ROOT.

  • Code : services/agent-regex-search-api/
  • Bind : REGEX_SEARCH_HOST (défaut 127.0.0.1)
  • Port : REGEX_SEARCH_PORT (défaut 37143)
  • Prérequis : rg dans le PATH (sinon réponse 503 sur /search)

Authentification

Authorization: Bearer <REGEX_SEARCH_TOKEN>

REGEX_SEARCH_TOKEN obligatoire au démarrage. Exception : GET /health ne exige pas le Bearer.

Endpoints

GET /health ou GET /health/

Réponse 200

{
  "status": "ok",
  "root": "<REGEX_SEARCH_ROOT résolu>"
}

POST /search

Corps JSON

Champ Obligatoire Description
pattern oui Regex style Rust, passée à ripgrep
subpath non Chemin relatif sous la racine (pas de .., pas absolu)
maxMatches non Plafond de résultats (défaut 500, max 50000)
timeoutMs non Timeout exécution rg en ms (défaut 60000, max 300000)

Réponse 200 (succès ripgrep, y compris « aucune correspondance », code sortie 1)

{
  "root": "string",
  "target": "string",
  "matches": [{ "path": "string", "lineNumber": number, "line": "string" }],
  "truncated": boolean,
  "exitCode": number
}

Autres réponses

  • 400 : corps invalide, pattern manquant, ou erreur ripgrep code 2 (regex / IO) — peut inclure error, matches, truncated, exitCode
  • 401 / absence de réponse utile : Bearer manquant ou incorrect sur /search
  • 404 : chemin non géré
  • 503 : rg introuvable (exitCode 127 côté implémentation) — { "error", "matches": [], "truncated": false }

Variables denvironnement

Variable Obligatoire Description
REGEX_SEARCH_TOKEN oui Secret Bearer
REGEX_SEARCH_ROOT non Répertoire de base des recherches (défaut /home/ncantu/code)
REGEX_SEARCH_HOST non Bind
REGEX_SEARCH_PORT non Port