# Задача для Codex ## Цель Создать отдельный проект `ai-orchestrator`. Это серверный orchestrator/runtime для управления AI-задачами, моделями, MCP-tools и local workers. Проект не должен быть частью текущего `Local LLM Platform`. ## Основные принципы 1. Orchestrator — главный сервис. 2. Agent — не отдельная сущность, а execution profile. 3. Сложные задачи выполняются через execution graph. 4. Workers не создают других workers. 5. Local Worker — тонкий исполнитель на компьютере пользователя. 6. В коде нет hardcoded bans. 7. Все ограничения — через настраиваемую policy. 8. Система должна работать без внешнего ИИ. 9. Strong model может быть локальной или внешней. 10. Vision model — отдельный слот. ## Реализовать структуру ```text src/ orchestrator/ agent_runtime/ model_router/ mcp_client/ local_worker_protocol/ policy/ api/ logging/ storage/ ``` ## MVP функции ### 1. API Реализовать: ```text POST /chat POST /tasks GET /tasks/{id} GET /tasks/{id}/events POST /confirmations/{id}/approve POST /confirmations/{id}/reject GET /workers ``` ### 2. Orchestrator Должен: ```text - принимать task; - создавать execution graph; - запускать nodes; - вызывать model router; - вызывать MCP client; - отправлять команды local worker; - обрабатывать confirmation_required; - писать event log. ``` ### 3. Execution Graph Node types: ```text planner model_call tool_call local_worker_call reviewer finalizer confirmation ``` ### 4. Model Router Слоты: ```text weak strong vision embedding ``` Provider: ```text local external disabled ``` ### 5. Policy Engine Без hardcoded bans. Policy читает конфиг и возвращает: ```text allow confirm manual disabled_by_config ``` ### 6. Local Worker Gateway Поддержать: ```text worker registration capabilities command dispatch command result progress events heartbeat disconnect ``` ### 7. MCP Client Поддержать базовый MCP flow: ```text initialize tools/list tools/call ``` ### 8. UI contracts Подготовить backend ответы для карточек: ```text plan_card confirmation_card progress_card artifact_card error_card ``` ## Smoke tests Добавить тесты: ```text 1. simple chat without tools 2. task creates execution graph 3. model fallback weak → strong 4. policy confirm returns confirmation request 5. policy full_auto executes immediately 6. local worker command result is stored 7. MCP tool call result is stored 8. task event stream emits node_started/node_completed ``` ## Конфиги Создать примеры: ```text configs/examples/local_only.yaml configs/examples/local_plus_external.yaml configs/examples/full_auto.yaml configs/examples/confirm_mode.yaml ``` ## Важно Не добавлять 1С-логику в ядро orchestrator. 1С должна подключаться как MCP server или tool provider.