Initial project blueprint
This commit is contained in:
@@ -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.
|
||||
```
|
||||
Reference in New Issue
Block a user