Initial project blueprint

This commit is contained in:
2026-07-03 20:51:36 +03:00
commit 7d6cc1c83e
25 changed files with 1486 additions and 0 deletions
+106
View File
@@ -0,0 +1,106 @@
# API Contracts
## POST /chat
Вход:
```json
{
"project_id": "default",
"conversation_id": "optional",
"message": "Найди файл и исправь запрос",
"attachments": [],
"mode": "auto",
"preferences": {
"local_only": true,
"show_plan": true
}
}
```
Выход:
```json
{
"conversation_id": "conv_1",
"task_id": "task_1",
"response_type": "answer | task_started | confirmation_required | error",
"message": "string",
"cards": []
}
```
## POST /tasks
Создать задачу без chat-интерфейса.
```json
{
"project_id": "default",
"goal": "Исправить модуль",
"inputs": {},
"execution_mode": "agent_graph"
}
```
## GET /tasks/{task_id}
```json
{
"task_id": "task_1",
"status": "running",
"current_node": "node_3",
"progress": {
"completed": 2,
"total": 5
}
}
```
## GET /tasks/{task_id}/events
SSE/WebSocket stream событий:
```json
{
"event": "node_started",
"task_id": "task_1",
"node_id": "node_3",
"timestamp": "..."
}
```
## POST /confirmations/{id}/approve
```json
{
"scope": "once | task | project",
"comment": "approved"
}
```
## POST /confirmations/{id}/reject
```json
{
"reason": "not now"
}
```
## POST /workers/register
Local worker регистрируется на сервере.
```json
{
"worker_id": "worker_home_pc",
"name": "Home PC",
"capabilities": [
"file.read",
"file.write",
"file.search",
"command.run"
],
"version": "0.1.0"
}
```
+148
View File
@@ -0,0 +1,148 @@
# Local Worker Protocol
## Назначение
Local Worker — тонкий исполнитель команд на локальном компьютере.
Он не планирует задачу и не принимает интеллектуальных решений.
Он:
```text
- подключается к серверу;
- сообщает capabilities;
- получает команды;
- выполняет;
- возвращает статус, результат, ошибки, артефакты.
```
## Соединение
Предпочтительно:
```text
Local Worker → outbound WebSocket → Server
```
## Capabilities
Пример:
```json
{
"worker_id": "home_pc",
"machine": "DESKTOP-1",
"os": "windows",
"version": "0.1.0",
"capabilities": [
"file.read",
"file.write",
"file.search",
"file.apply_patch",
"command.run",
"process.status",
"task.cancel"
]
}
```
## Command envelope
```json
{
"command_id": "cmd_123",
"task_id": "task_456",
"tool": "file.read",
"args": {
"path": "D:/Projects/test.bsl"
},
"timeout_ms": 30000,
"policy_context": {
"approved": true,
"approval_id": "conf_1"
}
}
```
## Result envelope
```json
{
"command_id": "cmd_123",
"task_id": "task_456",
"tool": "file.read",
"status": "success",
"started_at": "2026-07-03T10:00:00Z",
"finished_at": "2026-07-03T10:00:01Z",
"duration_ms": 1000,
"stdout": "",
"stderr": "",
"result": {
"content": "...",
"encoding": "utf-8",
"size": 1024,
"sha256": "..."
},
"artifacts": [],
"error": null
}
```
## Error result
```json
{
"command_id": "cmd_123",
"status": "error",
"error": {
"code": "FILE_NOT_FOUND",
"message": "File not found",
"details": {
"path": "D:/Projects/test.bsl"
}
}
}
```
## Progress events
```json
{
"event": "progress",
"command_id": "cmd_123",
"progress": {
"percent": 45,
"message": "Searching files"
}
}
```
## Минимальный набор tools
```text
worker.ping
worker.capabilities
file.read
file.write
file.search
file.apply_patch
command.run
process.status
task.cancel
```
## Важное правило
Local Worker не должен сам вызывать модель и не должен сам решать следующий шаг.
Он может выполнять локальные проверки:
```text
- проверить существование файла;
- сделать backup;
- посчитать hash;
- применить patch;
- вернуть diff;
- выполнить command timeout;
- вернуть stdout/stderr.
```
+60
View File
@@ -0,0 +1,60 @@
# MCP Client
## Назначение
AI Orchestrator должен работать с любыми MCP-серверами.
MCP client — универсальный слой, не содержащий 1С-логики.
## Поддержать методы
```text
initialize
tools/list
tools/call
resources/list
resources/read
prompts/list
prompts/get
```
## Tool metadata
Каждый tool должен иметь metadata:
```json
{
"name": "1c.run_sql",
"description": "Execute SQL through 1C adapter",
"input_schema": {},
"risk": {
"resource": "sql",
"level": "safe | write | destructive | cost | system",
"preview_supported": true
}
}
```
## Tool call
```json
{
"server_id": "one_c",
"tool": "1c.run_sql",
"args": {
"query": "select * from ..."
}
}
```
## Tool result
```json
{
"status": "success",
"content": {},
"artifacts": [],
"logs": [],
"error": null
}
```
+78
View File
@@ -0,0 +1,78 @@
# Model Router
## Цель
Единый интерфейс к разным моделям:
- локальным;
- внешним;
- отключенным;
- vision;
- embedding.
## Слоты
```text
weak
strong
vision
embedding
reranker
```
## Provider types
```text
local
external
disabled
```
## Вызов
```json
{
"slot": "weak",
"messages": [],
"tools": [],
"response_format": "json_schema | text",
"task_context": {
"task_id": "task_1",
"node_id": "node_2"
}
}
```
## Ответ
```json
{
"slot": "weak",
"provider": "local",
"model": "qwen-coder-7b",
"status": "success",
"message": {},
"tool_calls": [],
"usage": {
"input_tokens": 100,
"output_tokens": 200,
"cost": 0
},
"error": null
}
```
## Fallback
Алгоритм:
```text
1. вызвать weak;
2. если результат валиден — продолжить;
3. если результат невалиден — retry weak;
4. если strong доступна — вызвать strong;
5. если strong disabled — вернуть partial result и ошибку качества;
6. если external выключен настройкой — не вызывать external.
```
Важно: external не запрещен в коде. Он включается/выключается настройкой.