Commit Graph

14 Commits

Author SHA1 Message Date
¨NW¨
0f23dffc26 feat(agents): restore agent-worker container architecture + fix chat scroll and parallel chats
- Restore agent-worker from commit 153399f: autonomous HTTP server per agent
  (main.go 597 lines, main_test.go 438 lines, Dockerfile.agent-worker)
- Add container fields to agents table (serviceName, servicePort, containerImage, containerStatus)
- Update executor.go: real delegateToAgent() with HTTP POST to agent containers
- Update db.go: GetAgentByID, UpdateContainerStatus, GetAgentHistory, SaveHistory
- Update orchestrator.go: inject DB into executor for container address resolution
- Add tRPC endpoints: agents.deployContainer, agents.stopContainer, agents.containerStatus
- Add Docker Swarm deploy/stop logic in server/agents.ts
- Add Start/Stop container buttons to Agents.tsx with status badges
- Fix chat auto-scroll: replace ScrollArea with overflow-y-auto for direct scrollTop control
- Fix parallel chats: make isThinking per-conversation (thinkingConvId) instead of global
  so switching between chats works while one is processing
2026-04-10 15:43:33 +01:00
Manus
4411db8cd6 Checkpoint: Phase 19 Complete: Task Management System + Web Research Workflow
PHASE 19 COMPLETION SUMMARY:

 COMPLETED FEATURES:

1. Task Management System (Phase 19.1-19.7)
   - Database schema with tasks table (14 columns)
   - Query helpers for CRUD operations
   - 7 tRPC endpoints for task management
   - TasksPanel React component with real-time updates
   - Auto-task creation functions
   - Chat UI integration with conversationId tracking

2. Auto-Task Creation Integration (Phase 19.8)
   - Integrated into orchestratorChat loop
   - Detects missing components from tool errors
   - Auto-creates tasks for: tools, skills, agents, components, dependencies
   - Tracks task completion status

3. Web Research Workflow (Phase 19.9-19.12)
   - server/web-research.ts module with 3 main functions:
     * performWebResearch() - Execute web searches with Browser Agent
     * compileResearchReport() - Generate markdown reports
     * createResearchTasks() - Create research tasks for orchestrator

   - 3 tRPC endpoints:
     * research.search - Perform web research
     * research.compileReport - Compile results into report
     * research.createTasks - Create research tasks

   - WebResearchPanel React component:
     * Search input with real-time results
     * Options: max results, screenshots, text extraction
     * Result cards with expandable details
     * Report download functionality
     * Error handling and empty states

4. Unit Tests
   - 120 tests pass (out of 121 total)
   - Web Research tests: 18 tests covering all functions
   - Task tests: 5 tests (1 fails due to missing DB table)
   - All other tests pass

ARCHITECTURE:
- Browser Agent integration via Puppeteer
- Task tracking with metadata
- Auto-report compilation in markdown
- Screenshot and text extraction support
- Real-time UI updates via tRPC

NEXT STEPS:
1. Run pnpm db:push on production to create tasks table
2. Commit all changes to Gitea
3. Deploy to production
4. Verify tests pass on production DB
5. Test Web Research workflow end-to-end

TEST RESULTS:
- Test Files: 1 failed | 10 passed (11 total)
- Tests: 1 failed | 120 passed (121 total)
- Only failure: tasks.test.ts (requires production DB table)
2026-03-30 05:39:39 -04:00
Manus
b579e1a4d1 Checkpoint: Phase 19: Complete Task Management System Implementation
COMPLETED FEATURES:

1. Database Schema (drizzle/schema.ts)
   - Added tasks table with 14 columns
   - Status enum: pending, in_progress, completed, failed, blocked
   - Priority enum: low, medium, high, critical
   - Supports task dependencies, metadata, error tracking
   - Indexed by agentId, status, conversationId

2. Query Helpers (server/db.ts)
   - createTask() - create new task
   - getAgentTasks() - get all agent tasks
   - getConversationTasks() - get conversation tasks
   - getTaskById() - get single task
   - updateTask() - update task status/results
   - deleteTask() - delete task
   - getPendingAgentTasks() - get active tasks with priority sorting

3. tRPC Endpoints (server/routers.ts)
   - tasks.create - create task with validation
   - tasks.listByAgent - list agent tasks
   - tasks.listByConversation - list conversation tasks
   - tasks.get - get single task
   - tasks.update - update task with partial updates
   - tasks.delete - delete task
   - tasks.getPending - get pending tasks

4. React Component (client/src/components/TasksPanel.tsx)
   - Right sidebar panel for task display
   - Checkbox for task completion
   - Status badges (pending, in_progress, completed, failed, blocked)
   - Priority indicators (low, medium, high, critical)
   - Expandable task details (description, result, errors, timestamps)
   - Real-time updates via tRPC mutations
   - Delete button with confirmation

5. Chat Integration (client/src/pages/Chat.tsx)
   - TasksPanel integrated as right sidebar
   - Unique conversationId per chat session
   - Tasks panel width: 320px (w-80)
   - Responsive layout with flex container

6. Auto-Task Creation (server/orchestrator.ts)
   - autoCreateTasks() - create tasks for missing components
   - detectMissingComponents() - parse error messages for missing items
   - trackTaskCompletion() - update task status after execution
   - Supports: tools, skills, agents, components, dependencies

7. Unit Tests (server/tasks.test.ts)
   - 5 test suites covering all operations
   - 107 tests pass, 1 fails (due to missing DB table)
   - Tests cover: create, read, update, delete operations

NEXT STEPS:
1. Run pnpm db:push on production to create tasks table
2. Commit to Gitea with all changes
3. Deploy to production
4. Verify all tests pass on production DB
2026-03-29 07:08:18 -04:00
Manus
8096ce4dfd true message 2026-03-26 05:41:44 -04:00
Manus
d396004294 Checkpoint: Phase 16 complete: entrypoint.sh with drizzle-kit auto-migrate, nodeMetrics table, metrics-collector background job (CPU/MEM every 30s, alerts CPU>80% or unhealthy with 15min cooldown), Sparkline SVG component in Nodes.tsx, nodes.metricsHistory + nodes.allMetricsLatest tRPC endpoints. 104 vitest tests pass. 2026-03-24 12:46:21 -04:00
Manus
0959c90d36 Checkpoint: Fix: agents.list tRPC procedure now uses getAllAgents() instead of getUserAgents(SYSTEM_USER_ID=1). Root cause: seed creates agents with userId=0 but router queried userId=1. Added getAllAgents() and getSystemAgents() helpers. 86 tests pass. 2026-03-20 21:15:55 -04:00
Manus
16b101537c Checkpoint: Phase 14: Fixed hardcoded header metrics (UPTIME/NODES/AGENTS/CPU/MEM) — connected to real tRPC dashboard.stats endpoint with 30s polling. Fixed seed idempotency — now checks by isSystem=true instead of total count. Added dashboard.test.ts with 13 new tests. All 82 tests pass. 2026-03-20 21:00:51 -04:00
Manus
0dcae37a78 Checkpoint: Phase 12: Real-time Docker Swarm monitoring for /nodes page
Реализовано:
- gateway/internal/docker/client.go: Docker API клиент через unix socket (/var/run/docker.sock)
  - IsSwarmActive(), GetSwarmInfo(), ListNodes(), ListContainers(), GetContainerStats()
  - CalcCPUPercent() для расчёта CPU%
- gateway/internal/api/handlers.go: новые endpoints
  - GET /api/nodes: список Swarm нод или standalone Docker хост
  - GET /api/nodes/stats: live CPU/RAM статистика контейнеров
  - POST /api/tools/execute: выполнение инструментов
- gateway/cmd/gateway/main.go: зарегистрированы новые маршруты
- server/gateway-proxy.ts: добавлены getGatewayNodes() и getGatewayNodeStats()
- server/routers.ts: добавлен nodes router (nodes.list, nodes.stats)
- client/src/pages/Nodes.tsx: полностью переписан на реальные данные
  - Auto-refresh: 10s для нод, 15s для статистики контейнеров
  - Swarm mode: показывает все ноды кластера
  - Standalone mode: показывает локальный Docker хост + контейнеры
  - CPU/RAM gauges из реальных docker stats
  - Error state при недоступном Gateway
  - Loading skeleton
- server/nodes.test.ts: 14 новых vitest тестов
- Все 51 тест пройдены
2026-03-20 20:12:57 -04:00
Manus
2f87e18e85 Checkpoint: Phase 11 complete: Frontend connected to Go Gateway. All orchestrator/ollama tRPC calls go through gateway-proxy.ts with Node.js fallback. 37 vitest tests pass. End-to-end verified: chat, tool calling, health via Go Gateway. 2026-03-20 19:38:27 -04:00
Manus
7aa8eee2ca Checkpoint: Phase 7 complete: Orchestrator Agent добавлен в /agents с меткой CROWN/SYSTEM, кнопками Configure и Open Chat. /chat читает конфиг оркестратора из БД (модель, промпт, инструменты). AgentDetailModal поддерживает isOrchestrator. 24 теста пройдены. 2026-03-20 17:48:21 -04:00
Manus
c2fdfdbf72 true message 2026-03-20 17:34:20 -04:00
Manus
86a1ee9062 Checkpoint: Full Development Complete: All 4 Phases
## Phase 1 (Fixed): Agent Management UI
- Исправлена авторизация: agents переведены на publicProcedure
- AgentDetailModal: 5 вкладок (General, LLM Params, Tools, History, Stats)
- Полное редактирование: model, provider, temperature, topP, maxTokens, frequencyPenalty, presencePenalty, systemPrompt
- Управление allowedTools и allowedDomains через теги
- AgentCreateModal: создание агентов с выбором модели из Ollama API
- Кнопка Metrics на каждой карточке агента

## Phase 2+3: Tool Binding System
- server/tools.ts: реестр из 10 инструментов (http_get, http_post, shell_exec, file_read, file_write, docker_list, docker_exec, docker_logs, browser_navigate, browser_screenshot)
- Безопасное выполнение: проверка allowedTools агента, accessControl из БД
- tools.execute tRPC endpoint
- Tools.tsx: страница управления инструментами с тест-выполнением
- Добавлен пункт "Инструменты" в sidebar навигацию

## Phase 4: Metrics & History
- AgentMetrics.tsx: детальная страница метрик по агенту
- Request Timeline: bar chart по часам (success/error)
- Conversation Log: история диалогов с пагинацией
- Raw Metrics Table: все метрики с токенами и временем
- Time range selector: 6h/24h/48h/7d
- Маршрут /agents/:id/metrics

## Tests: 24/24 passed
- server/auth.logout.test.ts (1)
- server/agents.test.ts (7)
- server/tools.test.ts (13)
- server/ollama.test.ts (3)
2026-03-20 16:52:27 -04:00
Manus
159a89a156 true message 2026-03-20 16:39:29 -04:00
Manus
b18e6e244f Checkpoint: Интеграция реального Ollama Cloud API: серверный прокси (tRPC), Dashboard с live-статусом подключения и количеством моделей, Chat с реальными ответами LLM и выбором модели, Settings с живым списком 34 моделей. Все 4 vitest теста пройдены. 2026-03-20 16:03:01 -04:00