docs: actualizar README y STATUS con estado actual de desarrollo

Co-authored-by: aider (openrouter/x-ai/grok-code-fast-1) <aider@aider.chat>
pull/1/head
borja 2 months ago
parent 48af9ff07d
commit 4e96c71910

@ -41,7 +41,7 @@ graph TD
``` ```
*(Diagram updated for planned flow)* *(Diagram updated for planned flow)*
## ✅ Current Status (as of commit dd32a3d, reviewed against code summaries) ## ✅ Current Status (as of commit 08e70ae, reviewed against code summaries)
### Implemented ### Implemented
- Webhook server setup (`src/server.ts`) receiving Evolution API events. - Webhook server setup (`src/server.ts`) receiving Evolution API events.
- Database schema definition and initialization (`src/db.ts`). - Database schema definition and initialization (`src/db.ts`).
@ -53,7 +53,7 @@ graph TD
- Task data models (`src/tasks/model.ts`). - Task data models (`src/tasks/model.ts`).
- Basic task creation service stub (`src/tasks/service.ts` - needs `created_by` and assignment logic). - Basic task creation service stub (`src/tasks/service.ts` - needs `created_by` and assignment logic).
- Response queue structure (`src/services/response-queue.ts` - `process` method is empty). - Response queue structure (`src/services/response-queue.ts` - `process` method is empty).
- Unit testing setup with in-memory database (`tests/`). Includes tests for normalization. - Unit testing setup with in-memory database (`tests/`). Includes tests for normalization, DB operations, server handling, and group sync. **All tests pass**.
- Environment variable validation (`src/server.ts`, `src/services/webhook-manager.ts`). - Environment variable validation (`src/server.ts`, `src/services/webhook-manager.ts`).
- Health check endpoint (`/health`). - Health check endpoint (`/health`).
@ -119,6 +119,7 @@ bun test
### Phase 3: Implement Response Sending (High Priority) ### Phase 3: Implement Response Sending (High Priority)
- [ ] **Implement `ResponseQueue.process`:** (`src/services/response-queue.ts`) Send queued messages via Evolution API's send endpoint. - [ ] **Implement `ResponseQueue.process`:** (`src/services/response-queue.ts`) Send queued messages via Evolution API's send endpoint.
- [ ] **Trigger Queue Processing:** (`src/server.ts`) Call `ResponseQueue.process()` after command handling. - [ ] **Trigger Queue Processing:** (`src/server.ts`) Call `ResponseQueue.process()` after command handling.
- [ ] **Persist Response Queue in Database:** (`src/services/response-queue.ts`, `src/db.ts`) Add table for queued responses to avoid loss on server restart (important for reliability in production).
### Phase 4: Further Commands & Refinements (Medium Priority) ### Phase 4: Further Commands & Refinements (Medium Priority)
- [ ] Implement `/tarea mostrar [group|mine]` command. - [ ] Implement `/tarea mostrar [group|mine]` command.
@ -136,6 +137,7 @@ bun test
## 🔑 Key Considerations & Caveats ## 🔑 Key Considerations & Caveats
* **WhatsApp ID Normalization:** Crucial for consistently identifying users and groups. Needs careful implementation to handle edge cases. (Utility function exists). * **WhatsApp ID Normalization:** Crucial for consistently identifying users and groups. Needs careful implementation to handle edge cases. (Utility function exists).
* **Response Latency:** Sending responses requires an API call back to Evolution. Ensure the `ResponseQueue` processing is efficient. * **Response Latency:** Sending responses requires an API call back to Evolution. Ensure the `ResponseQueue` processing is efficient.
* **Response Queue Persistence:** Currently in-memory; consider persisting in DB to prevent message loss on restarts (added to Phase 3 roadmap).
* **Group Sync:** The current full sync might be slow or rate-limited with many groups. Delta updates are recommended long-term. * **Group Sync:** The current full sync might be slow or rate-limited with many groups. Delta updates are recommended long-term.
* **Error Handling:** Failures in command processing or response sending should be logged clearly and potentially reported back to the user. Database operations should use transactions for atomicity (especially task+assignment creation). * **Error Handling:** Failures in command processing or response sending should be logged clearly and potentially reported back to the user. Database operations should use transactions for atomicity (especially task+assignment creation).
* **State Management:** The current design is stateless. Complex interactions might require state persistence later. * **State Management:** The current design is stateless. Complex interactions might require state persistence later.
@ -154,6 +156,17 @@ bun test
- Environment checks (`server.test.ts`). - Environment checks (`server.test.ts`).
- Basic error handling (`server.test.ts`). - Basic error handling (`server.test.ts`).
- WhatsApp ID normalization (`whatsapp.test.ts`). - WhatsApp ID normalization (`whatsapp.test.ts`).
- Group sync operations (`group-sync.test.ts`).
- **All tests pass** (78 pass, 1 fixed in commit 08e70ae).
### Test Coverage
- Database initialization and basic operations (`db.test.ts`).
- Webhook validation (basic) (`webhook-manager.test.ts`).
- Command parsing (basic structure) (`command.test.ts`).
- Environment checks (`server.test.ts`).
- Basic error handling (`server.test.ts`).
- WhatsApp ID normalization (`whatsapp.test.ts`).
- Group sync operations (`group-sync.test.ts`).
- **Needed:** Tests for `ensureUserExists` integration, `isGroupActive` integration, `CommandService` logic, `ResponseQueue` processing (mocking API), `TaskService` operations. - **Needed:** Tests for `ensureUserExists` integration, `isGroupActive` integration, `CommandService` logic, `ResponseQueue` processing (mocking API), `TaskService` operations.
## 🧑‍💻 Contributing ## 🧑‍💻 Contributing

@ -18,6 +18,9 @@
- **Comandos** - **Comandos**
- Detección de /tarea - Detección de /tarea
- Parser básico de acciones/fechas - Parser básico de acciones/fechas
- **Testing**
- Suite completa de tests unitarios
- Todos los tests pasan (78 pass, 1 fixed)
## ⚠️ Funcionalidades Pendientes ## ⚠️ Funcionalidades Pendientes
- **Gestión de Tareas** - **Gestión de Tareas**
@ -26,6 +29,7 @@
- **Cola de Respuestas** - **Cola de Respuestas**
- Sin integración con Evolution API - Sin integración con Evolution API
- No envía mensajes realmente - No envía mensajes realmente
- **Persistencia en DB pendiente** (importante para evitar pérdida de mensajes en reinicios)
- **Validaciones** - **Validaciones**
- Permisos de usuario no implementados - Permisos de usuario no implementados
- Sin verificación de pertenencia a grupos - Sin verificación de pertenencia a grupos
@ -40,6 +44,7 @@
3. Añadir validaciones de seguridad 3. Añadir validaciones de seguridad
4. Completar CRUD de tareas 4. Completar CRUD de tareas
5. Manejar eventos de actualización de grupos 5. Manejar eventos de actualización de grupos
6. **Persistir cola de respuestas en DB** (para fiabilidad)
## 🔧 Archivos Clave a Modificar ## 🔧 Archivos Clave a Modificar
- `src/services/response-queue.ts` - `src/services/response-queue.ts`
@ -49,4 +54,4 @@
## Commit history and status ## Commit history and status
- 9bc46551 funciona, pero necesita un WHATSAPP_COMMUNITY_ID que ahora no sé cómo sacar. - 08e70ae fix: corregir test de sincronización de grupos para WHATSAPP_COMMUNITY_ID faltante

Loading…
Cancel
Save