smart_ide/docs/features/orchestrator-api.md
4NK 14c974f54c Add smart-ide-tools-bridge API for submodule tools + central local env
- New service: tools bridge (port 37147) registry + Carbonyl/PageIndex/Chandra POST jobs
- config/services.local.env.example and gitignore for services.local.env
- .env.example for repos-devtools, regex-search, ia-dev-gateway, orchestrator, claw proxy, langextract
- Orchestrator intents: tools.registry, tools.carbonyl.plan, tools.pageindex.run, tools.chandra.ocr
- Docs: API + repo service fiche, architecture index; do not commit dist/
2026-04-03 22:35:57 +02:00

60 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Orchestrateur `smart_ide` — contrat HTTP
## Rôle
Service **sans LLM** qui route les **intentions** utilisateur (ou commandes normalisées) vers :
- **Ollama** (génération / chat) ;
- **AnythingLLM** (RAG, workspaces — via API documentaire existante) ;
- **Micro-services** sous `services/` ([API/README.md](../API/README.md)) ;
- **ia-dev-gateway** ([ia-dev-service.md](./ia-dev-service.md)) pour agents et déploiements.
Lorchestrateur applique une **table de routage** déclarative (fichier de config versionné ou chargé au démarrage) et refuse explicitement les intentions non couvertes.
## Authentification
`Authorization: Bearer <ORCHESTRATOR_TOKEN>` sur toutes les routes sauf `GET /health` (spécification). Les appels sortants réutilisent les tokens propres à chaque cible (repos-devtools, regex search, ia-dev-gateway, etc.), injectés par variables denvironnement **hors dépôt**.
## Endpoints (spécification)
| Méthode | Chemin | Description |
|---------|--------|-------------|
| `GET` | `/health` | Liveness |
| `POST` | `/v1/route` | Corps : `{ "intent", "context"?, "projectId"?, "env"? }` → réponse : `{ "target": "ollama" \| "anythingllm" \| "service" \| "ia_dev", "action", "request": { ... } }` ou exécution proxy selon politique |
| `POST` | `/v1/execute` | Exécute une chaîne déjà résolue (optionnel v1 — peut être fusionné avec `/v1/route` en mode `dryRun: false`) |
| `GET` | `/v1/timeline` | Agrège derniers événements (runs gateway, indexation — source à brancher sur store journal) |
La référence OpenAPI détaillée : [API/orchestrator.md](../API/orchestrator.md).
## Routage typique
| Intention (exemple) | Cible |
|---------------------|--------|
| `code.complete`, `chat.local` | Proxy HTTP vers Ollama (`OLLAMA_URL`) |
| `rag.query`, `workspace.list` | Client AnythingLLM (`ANYTHINGLLM_BASE_URL` + API key) |
| `git.clone`, `git.list` | repos-devtools-server |
| `search.regex` | agent-regex-search-api |
| `extract.entities` | langextract-api |
| `doc.office.upload` | local-office (`X-API-Key`) |
| `agent.run`, `deploy.trigger` | ia-dev-gateway |
| `tools.registry`, `tools.carbonyl.plan`, `tools.pageindex.run`, `tools.chandra.ocr` | smart-ide-tools-bridge (`TOOLS_BRIDGE_URL`, jeton `TOOLS_BRIDGE_TOKEN`) |
## Variables denvironnement (cible)
| Variable | Description |
|----------|-------------|
| `ORCHESTRATOR_TOKEN` | Secret Bearer clients |
| `ORCHESTRATOR_HOST` / `ORCHESTRATOR_PORT` | Bind (défaut `127.0.0.1:37145`) |
| `OLLAMA_URL` | Base URL Ollama sur la machine IA |
| `ANYTHINGLLM_BASE_URL` | URL API AnythingLLM |
| `ANYTHINGLLM_API_KEY` | Clé API |
| `REPOS_DEVTOOLS_URL`, `REPOS_DEVTOOLS_TOKEN` | … |
| `IA_DEV_GATEWAY_URL`, `IA_DEV_GATEWAY_TOKEN` | … |
| `TOOLS_BRIDGE_URL` | Base URL du pont IDE (défaut `http://127.0.0.1:37147`) |
Les valeurs diffèrent par **environnement** (test / pprod / prod) — voir [platform-target.md](../platform-target.md).
## Implémentation
Un serveur de **routage stub** existe sous [`services/smart-ide-orchestrator/`](../../services/smart-ide-orchestrator/) (`ORCHESTRATOR_TOKEN`, `npm run build && npm start`). Il résout les intentions documentées ci-dessus et enregistre la timeline ; le **forward HTTP** vers les cibles est à compléter (`fetch` + jetons par service).