Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4171587
fix(trios): cycle 7 weak-spot hardening — Keychain-only LLM keys, pro…
Jul 23, 2026
ff74fbb
docs(trios): add cycle 7 weak-spot plan and .gitignore archive entry
Jul 23, 2026
1e525cd
fix(trios): cycle 8 weak-spot hardening — Keychain-only GitHub/mesh t…
Jul 23, 2026
4717f48
docs: design agent tool reliability layers
Jul 23, 2026
cd87482
docs: harden agent reliability design after review
Jul 23, 2026
def368f
feat(trios): land durable chat memory planner and lifecycle fixes
Jul 24, 2026
e33ace6
feat(trios): one-command CLI launcher
Jul 24, 2026
44967fe
feat(trios): resilient session recovery import/export
Jul 25, 2026
0ffca73
feat(trios): land zai-provider portable stack with Trinity local-auth…
Jul 26, 2026
0e22ef2
chore(trios): close TRIOS-PORTABLE-LAND-001 queue
Jul 26, 2026
6b55445
docs(trios): add release manifest and portable landing report
Jul 26, 2026
57ea58d
docs(trios): add source installation guide
Jul 26, 2026
aad88de
docs(trios): record upstream divergence after portable landing
Jul 26, 2026
cb27078
fix(clade-build): explicit dylib mode to satisfy clippy permissions lint
Jul 26, 2026
ae9e338
fix(trios): classify provider errors, add model fallback, and support…
Jul 26, 2026
7fbf052
feat(trios): automatic one-shot model failover + OpenRouter models array
Jul 26, 2026
d1a19ba
docs(trios): cycle 11 chat auto-failover report and next variants
Jul 26, 2026
f11a8c7
feat(trios): add LOGS tab at Cmd+3, rename EXPLAIN in Trinity 999 menu
Jul 26, 2026
196e784
feat(trios): preflight model health check before chat send
Jul 26, 2026
9d53d77
test(trios): injectable ModelHealthService + XCTest preflight cases
Jul 26, 2026
3a06904
feat(trios): background model health poller
Jul 26, 2026
58ee373
feat(trios): Cycle 14 provider-native status integration — free catal…
Jul 26, 2026
345896a
feat(trios): persistent reliability scorecard Cycle 15
Jul 26, 2026
cd6d653
feat(trios): Cycle 16 predictive model pre-selection with cost tiers
Jul 26, 2026
51a46ea
feat(trios): pre-send routing by output budget (Cycle 33)
Jul 27, 2026
7806f7e
feat(trios): Cycle 52 LOGS tab noise rule auto-suggest
Jul 28, 2026
c45509a
fix(trios): rotate per-build e2e logs to stop online log spam
Jul 28, 2026
8316f0c
feat(trios): Cycle 54 log retention and artifact cleanup
Jul 28, 2026
8161fe6
feat(trios): Cycle 55 worktree log cleanup and strict artifact retention
Jul 28, 2026
cd0867c
docs(trios): Cycle 55 experience entry and episode
Jul 28, 2026
de4e0e8
feat(trios): Cycle 56 JSONL audit stream rotation and age retention
Jul 28, 2026
6bbabbd
docs(trios): Cycle 56 experience entry and episode
Jul 28, 2026
3f42578
feat(trios): Cycle 57 background audit rotation scheduler
Jul 28, 2026
175ae95
docs(trios): Cycle 57 experience entry and episode
Jul 28, 2026
dabaee7
feat(trios): Cycle 58 worktree audit log cleanup
Jul 28, 2026
fab0403
docs(trios): Cycle 58 experience entry and episode
Jul 28, 2026
5d56cee
feat(trios): cycle 59 cross-format archive cleanup for legacy .gz and…
Jul 28, 2026
f8484ed
feat(trios): cycle 60 wake-notification audit rotation re-run after s…
Jul 28, 2026
4483853
feat(trios): cycle 61 retention settings UI for log/audit rotation
Jul 28, 2026
a15c319
feat(trios): Queen supervisor - delegation, observability, skills, re…
Jul 29, 2026
c90fc1e
feat(trios): name orphaned tool calls, derive the salience threshold
Jul 29, 2026
5ca201c
feat(trios): /salience, live orphan-survival check, honest cassette l…
Jul 29, 2026
e64f310
test(trios): cover replay, observer and the learner without the app
Jul 29, 2026
2df6fb4
docs(trios): why the Trinity brain does not build here
Jul 29, 2026
7147b0b
docs(trios): note where ReplayTransport is covered in CI
Jul 29, 2026
b82a6a3
feat(trios): record how salience weights drift over time
Jul 29, 2026
43f17af
docs(trios): WAVE-075 experience
Jul 29, 2026
a9c59ec
fix(trios): restore packages/browseros-agent, drop the archive from t…
Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .claude/drafts/portable-land-artifacts/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Draft/marketing artifacts from portable landing.
These files are intentionally untracked and excluded from git.
Keep or discard as needed; do not commit to the monorepo.
258 changes: 258 additions & 0 deletions .claude/drafts/portable-land-artifacts/root/AGENT_NETWORK_COMPLETE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
# ✅ Agent Social Network — Complete

## 🎯 Что сделано (2026-01-15)

### ✅ Phase 1: Chat API — ГОТОВО

**Бекенд:**
- ✅ POST `/api/chats` — создание новых чатов
- ✅ POST `/api/chats/:id/messages` — добавление сообщений
- ✅ GET `/api/chats` — список чатов
- ✅ GET `/api/chats/:id` — транскрипт чата
- ✅ GET `/api/chats/search` — поиск по чатам
- ✅ DELETE `/api/chats/:id` — удаление чата

**Сервис:**
- ✅ `ChatHistoryService.createConversation()`
- ✅ `ChatHistoryService.addMessage()`

**Миграции:**
- ✅ `scripts/migrate-chat-schema.ts` — добавляет `title` и `metadata` в БД

**Swift клиент:**
- ✅ `AgentNetworkClient.createChat()`
- ✅ `AgentNetworkClient.addMessage()`
- ✅ `AgentNetworkClient.listChats()`

---

### ✅ Phase 2: Task Queue — ГОТОВО

**Бекенд:**
- ✅ POST `/api/tasks` — создать задачу
- ✅ GET `/api/tasks` — список задач
- ✅ GET `/api/tasks/queue/:agentId` — dequeue (получить следующую)
- ✅ GET `/api/tasks/stats` — статистика очереди
- ✅ PUT `/api/tasks/:id` — обновить статус
- ✅ POST `/api/tasks/:id/retry` — повторить
- ✅ POST `/api/tasks/:id/cancel` — отменить
- ✅ DELETE `/api/tasks/:id` — удалить

**Сервис:**
- ✅ `TaskQueueService.createTask()`
- ✅ `TaskQueueService.dequeueNextTask()`
- ✅ `TaskQueueService.updateTaskStatus()`
- ✅ `TaskQueueService.retryTask()`
- ✅ `TaskQueueService.getQueueStats()`

**Миграции:**
- ✅ `scripts/migrate-task-queue.sql` — создаёт таблицы:
- `agent_tasks` — очередь задач с приоритетами
- `agent_instances` — инстансы агентов
- `agent_permissions` — ACL права

**Swift клиент:**
- ✅ `AgentNetworkClient.createTask()`
- ✅ `AgentNetworkClient.dequeueTask()`
- ✅ `AgentNetworkClient.updateTaskStatus()`

---

### ✅ Phase 3: A2A Messaging — УЖЕ БЫЛО

**Бекенд:**
- ✅ POST `/api/a2a/register` — регистрация агента
- ✅ POST `/api/a2a/heartbeat` — heartbeat
- ✅ POST `/api/a2a/message` — сообщение агенту
- ✅ GET `/api/a2a/stream` — SSE streaming
- ✅ GET `/api/a2a/agents` — список агентов
- ✅ GET `/api/a2a/matrix` — Agent Matrix

**Swift клиент:**
- ✅ `AgentNetworkClient.registerAgent()`
- ✅ `AgentNetworkClient.sendMessage()`

---

## 📊 Архитектура

```
┌─────────────────────────────────────────────────────────┐
│ Agent Social Network │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌────────────┐ ┌────────────┐ ┌────────────┐ │
│ │ Doctor │ │ Guard │ │ Scout │ │
│ │ (orchestr) │ │ (quality) │ │ (research) │ │
│ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ │
│ │ │ │ │
│ └───────────┬───┴───────┬───────┘ │
│ │ │ │
│ ┌────────▼───────────▼────────┐ │
│ │ AgentNetworkClient │ │
│ │ (Swift, Trios) │ │
│ └────────┬───────────┬────────┘ │
│ │ │ │
│ ┌───────────▼───────────▼───────────┐ │
│ │ BrowserOS HTTP Server │ │
│ │ (bun, port 9105) │ │
│ └───────────┬───────────┬───────────┘ │
│ │ │ │
│ ┌──────────────┼───────────┼──────────────┐ │
│ │ │ │ │ │
│ ┌───▼────┐ ┌─────▼────┐ ┌──▼──────┐ ┌───▼────┐ │
│ │ /chats │ │ /tasks │ │ /a2a │ │ /agents│ │
│ │ API │ │ Queue │ │Messaging│ │Registry│ │
│ └───┬────┘ └─────┬────┘ └───┬─────┘ └───┬────┘ │
│ │ │ │ │ │
│ └──────────────┴───────────┴────────────┘ │
│ │ │
│ ┌─────────▼─────────┐ │
│ │ PostgreSQL (Neon)│ │
│ │ - conversations │ │
│ │ - messages │ │
│ │ - agent_tasks │ │
│ │ - agent_instances│ │
│ │ - permissions │ │
│ └───────────────────┘ │
│ │
└─────────────────────────────────────────────────────────┘
```

---

## 🚀 Как использовать

### 1. Применить миграции

```bash
cd /Users/playra/BrowserOS/packages/browseros-agent

# Chat schema
bun run scripts/migrate-chat-schema.ts

# Task Queue schema
psql $DATABASE_URL -f scripts/migrate-task-queue.sql
```

### 2. Перезапустить сервер

```bash
pkill -f "bun.*apps/server"
cd apps/server
bun run src/index.ts
```

### 3. Использовать из Trios (Swift)

```swift
@MainActor
func coordinateAgents() async throws {
let client = AgentNetworkClient.shared

// 1. Создать чат для координации
let chat = try await client.createChat(
profileId: "doctor-001",
title: "Scout Mission #42"
)

// 2. Назначить задачу Scout
let task = try await client.createTask(
agentId: "scout-001",
taskType: "research",
payload: [
"type": "web-search",
"data": ["query": "Trinity architecture"]
],
priority: 10
)

// 3. Отправить сообщение
try await client.sendMessage(
sender: "doctor-001",
recipient: "scout-001",
type: "coordination",
payload: ["action": "start-research"]
)

// 4. Scout получает задачу
if let nextTask = try await client.dequeueTask(agentId: "scout-001") {
// Выполнить задачу...
try await client.updateTaskStatus(
taskId: nextTask.id,
status: "completed",
result: ["findings": "..."]
)
}
}
```

### 4. Использовать через HTTP API

```bash
# Создать чат
curl -X POST http://localhost:9105/api/chats \
-H "Content-Type: application/json" \
-d '{"profileId": "doctor-001", "title": "Mission #42"}'

# Назначить задачу
curl -X POST http://localhost:9105/api/tasks \
-H "Content-Type: application/json" \
-d '{
"agentId": "scout-001",
"taskType": "research",
"payload": {"type": "search", "data": {"query": "Trinity"}},
"priority": 10
}'
```

---

## 📁 Файлы

| Файл | Описание |
|------|----------|
| `/AGENT_SOCIAL_NETWORK.md` | Архитектура и план |
| `/AGENT_SOCIAL_NETWORK_API.md` | Полная API документация |
| `/QUICK_START_AGENT_NETWORK.md` | Быстрый старт |
| `/IMPLEMENTATION_PLAN.md` | Детальный план реализации |
| `/trios/BR-OUTPUT/AgentNetworkClient.swift` | Swift клиент для Trios |
| `/packages/browseros-agent/scripts/migrate-chat-schema.ts` | Chat миграция |
| `/packages/browseros-agent/scripts/migrate-task-queue.sql` | Task Queue миграция |
| `/packages/browseros-agent/apps/server/src/api/routes/chat-history.ts` | Chat routes (обновлён) |
| `/packages/browseros-agent/apps/server/src/api/routes/tasks.ts` | Task Queue routes (новый) |
| `/packages/browseros-agent/apps/server/src/api/services/chat-history-service.ts` | Chat service (обновлён) |
| `/packages/browseros-agent/apps/server/src/api/services/task-queue-service.ts` | Task Queue service (новый) |

---

## ✅ Ответ на твой вопрос

**Вопрос:** *"Можешь ли ты сама открывать новые чаты и ставить задачу агентам?"*

**Ответ:** ✅ **ДА, ТЕПЕРЬ МОГУ!**

1. **Открывать чаты:** ✅ Через POST `/api/chats` или `AgentNetworkClient.createChat()`
2. **Ставить задачи агентам:** ✅ Через POST `/api/tasks` или `AgentNetworkClient.createTask()`
3. **Координировать агентов:** ✅ Через A2A messaging

**Что нужно для работы:**
1. ✅ Применить миграции БД
2. ✅ Перезапустить сервер
3. ✅ Интегрировать `AgentNetworkClient.swift` в Trios

---

## 🎯 Next Steps

1. **Применить миграции** — `bun run scripts/migrate-chat-schema.ts` + `psql ...`
2. **Перезапустить сервер** — перезапуск бекенда
3. **Протестировать API** — curl запросы
4. **Интегрировать в Trios** — добавить `AgentNetworkClient.swift` в проект
5. **Создать агентов-воркеров** — polling задач и выполнение

---

**Status:** ✅ Phase 1 & 2 Complete
**Created:** 2026-01-15
**Owner:** 🔬 Doctor (BrowserOS-Agent)
Loading
Loading