smart_ide/docs/features/orchestrator-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

58 lines
3.0 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 |
## 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` | … |
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).