feat: Add presence heartbeat for Matrix online status
- matrix-gateway: POST /internal/matrix/presence/online endpoint - usePresenceHeartbeat hook with activity tracking - Auto away after 5 min inactivity - Offline on page close/visibility change - Integrated in MatrixChatRoom component
This commit is contained in:
195
PHASE4_STARTED.md
Normal file
195
PHASE4_STARTED.md
Normal file
@@ -0,0 +1,195 @@
|
||||
# 🚀 PHASE 4 IMPLEMENTATION STARTED
|
||||
|
||||
**Status:** 🔄 In Progress (20% Complete)
|
||||
**Started:** 2025-11-24
|
||||
**Target:** 4-6 weeks (or 3-4 hours automated)
|
||||
|
||||
---
|
||||
|
||||
## ✅ COMPLETED (20%):
|
||||
|
||||
### 1. **auth-service** (8 files) ✅
|
||||
- ✅ models.py (ActorIdentity, SessionToken, ApiKey)
|
||||
- ✅ actor_context.py (build_actor_context, require_actor)
|
||||
- ✅ routes_sessions.py (login, me, logout)
|
||||
- ✅ routes_api_keys.py (create, list, delete)
|
||||
- ✅ main.py (FastAPI app + DB tables)
|
||||
- ✅ requirements.txt
|
||||
- ✅ Dockerfile
|
||||
- ✅ README.md
|
||||
|
||||
**Port:** 7011
|
||||
**Features:**
|
||||
- Mock login (3 test users)
|
||||
- Session tokens (7-day expiry)
|
||||
- API keys (optional expiration)
|
||||
- ActorContext helper for other services
|
||||
|
||||
---
|
||||
|
||||
## 🔄 IN PROGRESS (Started):
|
||||
|
||||
### 2. **pdp-service** (1/8 files)
|
||||
- ✅ models.py (PolicyRequest, PolicyDecision, Action, Resource)
|
||||
- 🔜 engine.py
|
||||
- 🔜 policy_store.py
|
||||
- 🔜 main.py
|
||||
- 🔜 config.yaml
|
||||
- 🔜 requirements.txt
|
||||
- 🔜 Dockerfile
|
||||
- 🔜 README.md
|
||||
|
||||
---
|
||||
|
||||
## 🔜 REMAINING (80%):
|
||||
|
||||
### 3. **usage-engine** (0/8 files)
|
||||
### 4. **PEP hooks** (0/3 services)
|
||||
### 5. **Audit schema** (0/1 migration)
|
||||
### 6. **docker-compose.phase4.yml** (0/1 file)
|
||||
### 7. **Documentation** (0/4 docs)
|
||||
|
||||
---
|
||||
|
||||
## 📊 PROGRESS:
|
||||
|
||||
```
|
||||
Phase 4 Checklist:
|
||||
|
||||
[x] 1. auth-service/ (8 files)
|
||||
[ ] 2. pdp-service/ (8 files) — IN PROGRESS
|
||||
[ ] 3. usage-engine/ (8 files)
|
||||
[ ] 4. PEP Integration
|
||||
[ ] messaging-service
|
||||
[ ] agent-runtime
|
||||
[ ] toolcore
|
||||
[ ] 5. Audit & Security
|
||||
[ ] security_audit table
|
||||
[ ] PDP audit logging
|
||||
[ ] NATS security events
|
||||
[ ] 6. Infrastructure
|
||||
[ ] docker-compose.phase4.yml
|
||||
[ ] scripts/start-phase4.sh
|
||||
[ ] scripts/stop-phase4.sh
|
||||
[ ] 7. Documentation
|
||||
[ ] docs/AUTH_SERVICE_SPEC.md
|
||||
[ ] docs/PDP_SPEC.md
|
||||
[ ] docs/USAGE_ENGINE_SPEC.md
|
||||
[ ] PHASE4_READY.md
|
||||
```
|
||||
|
||||
**Progress:** 9/40+ files (22%)
|
||||
|
||||
---
|
||||
|
||||
## 🎯 NEXT STEPS:
|
||||
|
||||
### Option A: Continue in Next Session
|
||||
Продовжити автоматичну імплементацію в новій сесії:
|
||||
1. Complete pdp-service (7 remaining files)
|
||||
2. Create usage-engine (8 files)
|
||||
3. Add PEP hooks (3 services)
|
||||
4. Create audit schema
|
||||
5. Docker compose + docs
|
||||
|
||||
**Estimated Time:** 2-3 more hours
|
||||
|
||||
### Option B: Use Specs for Manual Implementation
|
||||
Використати готові специфікації:
|
||||
- Phase 4 Master Task (provided by user)
|
||||
- auth-service as reference
|
||||
- Implement step-by-step manually
|
||||
|
||||
---
|
||||
|
||||
## 📁 Created Files:
|
||||
|
||||
```
|
||||
services/auth-service/
|
||||
├── models.py ✅ ActorIdentity, SessionToken, ApiKey
|
||||
├── actor_context.py ✅ build_actor_context helper
|
||||
├── routes_sessions.py ✅ /auth/login, /auth/me, /auth/logout
|
||||
├── routes_api_keys.py ✅ API key CRUD
|
||||
├── main.py ✅ FastAPI app
|
||||
├── requirements.txt ✅
|
||||
├── Dockerfile ✅
|
||||
└── README.md ✅
|
||||
|
||||
services/pdp-service/
|
||||
└── models.py ✅ PolicyRequest, PolicyDecision (1/8)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start (auth-service):
|
||||
|
||||
```bash
|
||||
# Local development
|
||||
cd services/auth-service
|
||||
pip install -r requirements.txt
|
||||
python main.py
|
||||
|
||||
# Test login
|
||||
curl -X POST http://localhost:7011/auth/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email": "user@daarion.city", "password": "any"}'
|
||||
|
||||
# Test /me
|
||||
curl http://localhost:7011/auth/me \
|
||||
-H "Authorization: Bearer <token>"
|
||||
```
|
||||
|
||||
**Mock Users:**
|
||||
- `admin@daarion.city` → system_admin
|
||||
- `user@daarion.city` → regular user
|
||||
- `sofia@agents.daarion.city` → agent
|
||||
|
||||
---
|
||||
|
||||
## 📚 References:
|
||||
|
||||
**Phase 4 Spec:** (provided by user in chat)
|
||||
- auth-service ✅
|
||||
- pdp-service (in spec)
|
||||
- usage-engine (in spec)
|
||||
- PEP integration (in spec)
|
||||
- Audit log (in spec)
|
||||
|
||||
**Related:**
|
||||
- [PHASE3_IMPLEMENTATION_COMPLETE.md](PHASE3_IMPLEMENTATION_COMPLETE.md)
|
||||
- [ALL_PHASES_STATUS.md](ALL_PHASES_STATUS.md)
|
||||
|
||||
---
|
||||
|
||||
## 💬 STATUS SUMMARY:
|
||||
|
||||
**Completed:**
|
||||
- ✅ Phase 1: Messenger
|
||||
- ✅ Phase 2: Agent Integration
|
||||
- ✅ Phase 3: LLM + Memory + Tools
|
||||
- 🔄 **Phase 4: Security Layer** (20% complete)
|
||||
|
||||
**Ready to Continue:**
|
||||
- auth-service working
|
||||
- pdp-service started
|
||||
- Need 2-3 more hours for full Phase 4
|
||||
|
||||
---
|
||||
|
||||
**Next Command:**
|
||||
```bash
|
||||
# When ready to continue, say:
|
||||
"продовжуй Phase 4"
|
||||
|
||||
# Or manually implement using specs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Status:** 🔄 In Progress
|
||||
**Version:** 0.2.0
|
||||
**Last Updated:** 2025-11-24
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user