Commit Graph

431 Commits

Author SHA1 Message Date
Apple
36394cff55 docs: Presence Layer implementation report
Backend complete:
- Matrix Gateway: GET /internal/matrix/presence/{mxid}
- City Service: GET /api/v1/agents/{id}/presence
- Both endpoints tested and working

TODO: Frontend integration
2025-11-30 10:43:39 -08:00
Apple
3bfbd359fd feat: Presence Layer API implementation
Matrix Gateway:
- GET /internal/matrix/presence/{matrix_user_id} - get single user presence
- GET /internal/matrix/presence/bulk - get multiple users presence

City Service:
- GET /api/v1/agents/{agent_id}/presence - get agent presence via gateway
- get_matrix_presence_for_user() helper function

Task doc: TASK_PHASE_PRESENCE_LAYER_v1.md
2025-11-30 10:42:29 -08:00
Apple
e912019d16 docs: Matrix Finalize v2 report
Backend Matrix integration complete:
- Synapse rate limits increased (100 msg/s, 500 burst)
- All 27 rooms synced with Matrix
- Chat API endpoints working (send/receive)
- Message flow tested end-to-end

TODO:
- Frontend routing for room pages
- Chat widget integration with new API
- Presence API integration
2025-11-30 10:37:34 -08:00
Apple
ec57f7a596 feat: Add Chat API endpoints for Matrix integration
City Service:
- GET /api/v1/chat/rooms/{room_id}/messages - get message history
- POST /api/v1/chat/rooms/{room_id}/messages - send message
- Add get_room_by_id to repo_city

Synapse:
- Increase rate limits for room creation
- Add rc_joins, rc_invites configuration

All 27 rooms now have matrix_room_id
2025-11-30 10:34:27 -08:00
Apple
aa3b9970fd docs: add Matrix Gateway integration report
- 9 rooms synced with Matrix successfully
- 16 rooms pending due to rate limiting
- Matrix Gateway endpoints working
- Auto-create logic implemented for agent/node/microdao chat rooms
2025-11-30 10:16:43 -08:00
Apple
7108985b55 feat: Matrix Gateway integration for Rooms Layer
Matrix Gateway:
- Add POST /internal/matrix/room/join endpoint
- Add POST /internal/matrix/message/send endpoint
- Add GET /internal/matrix/rooms/{room_id}/messages endpoint

City Service:
- Add POST /rooms/sync/matrix endpoint for bulk sync
- Update get_agent_chat_room to auto-create Matrix rooms
- Update get_node_chat_room to auto-create Matrix rooms
- Update get_microdao_chat_room to auto-create Matrix rooms
- Add join_user_to_room, send_message_to_room, get_room_messages to matrix_client
- Add ensure_room_has_matrix helper function

This enables:
- Automatic Matrix room creation for all entity types
- chat_available = true when Matrix room exists
- Real-time messaging via Matrix
2025-11-30 10:12:27 -08:00
Apple
361d114a43 docs: add Rooms Layer restore report
Completed:
- City Rooms (8 rooms)
- MicroDAO Rooms (5 rooms for DAARION)
- Node Support Rooms (2 rooms)
- Citizens Layer (14 public agents)

TODO:
- Matrix room creation
- Gateway integration
- Chat widget full integration
2025-11-30 09:58:32 -08:00
Apple
e62f81253f fix: MicroDAO rooms query to include owner_id based rooms 2025-11-30 09:56:58 -08:00
Apple
1ea293281a fix: correct function name list_agent_summaries 2025-11-30 09:52:11 -08:00
Apple
b2ddaa90b3 fix: add updated_at column to city_rooms 2025-11-30 09:51:03 -08:00
Apple
f8d1287e38 fix: add missing columns to city_rooms table (room_type, owner_type, etc.) 2025-11-30 09:49:55 -08:00
Apple
a1baedfc94 feat: Rooms Layer restore - seed City/MicroDAO/Node rooms + fix Citizens
TASK_PHASE_ROOMS_LAYER_RESTORE_AND_MATRIX_INTEGRATION (partial):

Backend:
- Seed 8 City Rooms (general, welcome, leadership-hall, etc.)
- Seed 5 MicroDAO Rooms for DAARION (lobby, governance, news, builders, help)
- Seed 2 Node Support Rooms (node1, node2)
- Update agents is_public for Citizens Layer
- Fix get_public_citizens query (less strict filtering)
- Add get_city_rooms_for_list function

This fixes:
- City Rooms list = 0 -> now 8 rooms
- MicroDAO Rooms = 0 -> now 5 rooms
- Citizens = 0 -> now shows public agents
2025-11-30 09:48:37 -08:00
Apple
d264e7efc5 docs: add critical TASK_PHASE_ROOMS_LAYER_RESTORE_AND_MATRIX_INTEGRATION.md
Comprehensive task to fix Rooms Layer issues:
- City Rooms not loading in list view
- MicroDAO Rooms = 0
- Agent/Node Chat Rooms missing
- Citizens Layer = 0 citizens

Includes SQL seeds, API fixes, Matrix integration steps.
2025-11-30 09:43:10 -08:00
Apple
fcdac0f33c feat: implement Agent Presence Indicators (MVP)
Backend:
- Add /api/v1/agents/presence endpoint
- Integrate with matrix-presence-aggregator
- Add DAGI router health checks

Frontend:
- Create useAgentPresence hook
- Create AgentPresenceBadge component
- Integrate into /agents list page
- Integrate into /agents/:agentId cabinet

Shows real-time online/offline status for all agents.
2025-11-30 09:41:57 -08:00
Apple
111d62a62a docs: add TASK_PHASE_AGENT_PRESENCE_INDICATORS_MVP.md
Task for implementing real-time presence indicators for all agents.
Shows Matrix presence (online/unavailable/offline) and DAGI router health.
Integrates into agent lists, cabinets, node dashboards, microdao dashboards.
2025-11-30 09:22:29 -08:00
Apple
e246e6d413 docs: update verification checklist with deployment results 2025-11-30 09:17:30 -08:00
Apple
c4d7eb4493 fix: correct JSX structure in node page for chat widget 2025-11-30 09:15:17 -08:00
Apple
38e49adeba fix: syntax error in node page - missing closing div 2025-11-30 09:13:01 -08:00
Apple
6297adc0dc feat: implement Agent Chat Widget for entity pages
TASK_PHASE_AGENT_CHAT_WIDGET_MVP.md completed:

Backend:
- Add /api/v1/agents/{agent_id}/chat-room endpoint
- Add /api/v1/nodes/{node_id}/chat-room endpoint
- Add /api/v1/microdaos/{slug}/chat-room endpoint

Frontend:
- Create AgentChatWidget.tsx floating chat component
- Integrate into /agents/:agentId page
- Integrate into /nodes/:nodeId page
- Integrate into /microdao/:slug page

Ontology rule implemented:
'No page without agents' = ability to directly talk to agents on that page
2025-11-30 09:10:45 -08:00
Apple
fb4a33f016 docs: add TASK_PHASE_AGENT_CHAT_WIDGET_MVP.md
Task for implementing floating chat widget on agent/node/microdao pages.
Follows ontology rule: 'No page without agents means ability to talk to them directly.'

Scope:
- Backend: /chat-room API endpoints
- Frontend: AgentChatWidget.tsx component
- Integration: /agents/:agentId, /nodes/:nodeId, /microdao/:slug
2025-11-30 09:04:04 -08:00
Apple
644edd3f30 feat(mvp): DAGI Integration Fix - gov_level, DAIS, nodes table
TASK_PHASE_MVP_DAGI_INTEGRATION_FIX_20251201

A) Agents Layer:
- A1: Added gov_level to API and UI (list + profile)
- A2: Added dais_identity_id to API and UI
- A3: Added home_microdao_id/name/slug for ownership display

B) MicroDAO Layer:
- B1/B2: Already implemented (agents, rooms, citizens, district badge)

C) Nodes Layer:
- C1: Node Dashboard already implemented
- C2: Created nodes table migration with owner_microdao_id
- C3: INSERT NODE1/NODE2 with dao_daarion ownership

D) Backend Fixes:
- D1: Extended /api/agents/* with DAIS/governance fields
- D2/D3: Already implemented

Files changed:
- services/city-service/repo_city.py
- services/city-service/models_city.py
- services/city-service/routes_city.py
- services/city-service/migrations.py
- apps/web/src/lib/types/agents.ts
- apps/web/src/lib/agent-dashboard.ts
- apps/web/src/app/agents/page.tsx
- apps/web/src/components/agent-dashboard/AgentSummaryCard.tsx

Reports:
- docs/debug/mvp_dagi_integration_fix_report_20251201.md
- docs/tasks/TASK_PHASE_MVP_DAGI_INTEGRATION_FIX_20251201.md
2025-11-30 08:45:07 -08:00
Apple
a23deae3c4 feat(node-dashboard): add MVP dashboard API endpoint
- services/city-service: add /api/v1/nodes/{id}/dashboard endpoint
- services/city-service: add legacy /api/v1/node/dashboard?nodeId=...
- apps/web: update route.ts to use city-service first
- apps/web: fallback to node-registry if city-service fails

Response structure:
  node_id, name, kind, status, tags, agents_total,
  agents_online, uptime (null), metrics_available (false)

Closes TASK_PHASE_NODE_DASHBOARD_API_MVP
2025-11-30 06:59:51 -08:00
Apple
85a785bd86 fix(compose): use external postgres volume + city-service ENV
- docker-compose.yml: postgres uses microdao-daarion_postgres_data (external)
- docker-compose.yml: city-service connects to dagi-postgres:5432/daarion + NATS_URL
- docker-compose.city-space.yml: added dagi-postgres, dagi-nats as services
- docs/DEPLOY_ON_SERVER.md: added restart instructions without data loss

Closes TASK_PHASE_DOCKER_COMPOSE_CITY_SERVICE_POSTGRES
2025-11-30 06:58:02 -08:00
Apple
9d6428c6ee docs: add compose + node dashboard tasks 2025-11-30 06:51:46 -08:00
Apple
7ff426f975 fix: allow node cabinet fallback when dashboard unavailable 2025-11-30 06:40:32 -08:00
Apple
ff4e9dd06b fix: default city-service NATS_URL to dagi-nats 2025-11-30 06:28:55 -08:00
Apple
0640227de0 fix: allow optional name for node guardian/steward summaries 2025-11-30 06:24:52 -08:00
Apple
39f76912ae fix: proxy /api/nodes/* to city-service public endpoints 2025-11-30 06:22:24 -08:00
Apple
dd3624018a fix: Add proper Next.js rewrites for agent/microdao API
- /api/agents/:agentId/dashboard -> /city/agents/:agentId/dashboard
- /api/microdao/* -> /city/microdao/*
- /api/public/* -> /public/*
- /api/city/* -> /city/*

Fixes 404 errors on agent/microdao cabinet pages
2025-11-30 06:17:25 -08:00
Apple
3e778e0f81 docs: MVP seed completed + orphan audit
- TASK_PHASE_MVP_SEED_REAL_ENTITIES: marked as completed
- TASK_PHASE_MVP_VERIFY_NO_ORPHANS: orphan verification task
- orphans_20251130.md: audit report with fixes applied

Fixes applied on NODE1:
- 13 governance agents now have DAIS identity
- 4 test agents now have home_microdao_id
- All 18 agents, 9 microDAOs, 23 rooms verified
2025-11-30 06:05:03 -08:00
Apple
4ccdb30159 feat: MVP seed real entities (RECOVERY)
- DAIS identities for all core agents
- City governance: DAARWIZZ, DARIO, DARIA
- District leads: SOUL, Helion, GREENFOOD
- District teams: Spirit, Logic, Energia
- Core agents: CLAN, DRUID, EONARCH, YAROMIR
- MicroDAOs: daarion (root), energyunion, greenfood, soul-retreat
- Agent assignments & permissions
- District rooms for SOUL, ENERGYUNION, GREENFOOD
2025-11-30 05:13:30 -08:00
Apple
aa7d831734 docs: add SOUL District Protocol v1 (Wellness/Retreat)
- SOUL as District Lead Agent
- Spirit (Guidance) + Logic (Information) AI agents
- Events, Masters, Locations, Guidance modules
- Node model for retreat centers
- 10 District Rooms
- XR/VR ready architecture
2025-11-30 04:59:17 -08:00
Apple
6864e1ce22 docs: add ENERGYUNION District Protocol + Nodes Interface Architecture UPDATE
- ENERGYUNION: DePIN/Energy/Compute District with Helion & Energia agents
- Nodes UPDATE: Unified node model (physical object + local brain + DAIS agent)
- No auto-created nodes - all nodes registered dynamically
2025-11-30 04:27:45 -08:00
Apple
39a01cf474 docs: add GREENFOOD District Protocol v1 (IndustryOps/Supply-Chain) 2025-11-30 02:46:58 -08:00
Apple
e5bfb19e71 fix(web): handle undefined values in incident transform 2025-11-29 17:17:01 -08:00
Apple
fc0a9b3189 fix(web): transform snake_case API response to camelCase for governance/incidents 2025-11-29 17:14:59 -08:00
Apple
4a30f6c1a9 fix(web): use Docker service name as default for API proxy 2025-11-29 17:12:03 -08:00
Apple
c68b81fad1 fix(web): use INTERNAL_API_URL for API rewrites proxy 2025-11-29 17:09:50 -08:00
Apple
52520eda93 fix(city-service): use datetime type for created_at/updated_at fields 2025-11-29 17:08:02 -08:00
Apple
90ecc7e8f6 fix(city-service): align incidents API with actual DB schema
- Use correct column names: created_by_dais_id, target_scope_type, assigned_to_dais_id
- Add UUID parsing for incident IDs
- Fix incident_history to use actor_dais_id and new_value columns
2025-11-29 17:06:44 -08:00
Apple
e078a24540 feat(city-service): add Governance, Audit, Incidents API endpoints
- Added repo_governance.py with database operations
- Added routes_governance.py (/api/v1/governance/*)
- Added routes_audit.py (/api/v1/audit/*)
- Added routes_incidents.py (/api/v1/incidents/*)
- Updated main.py to include new routers
2025-11-29 17:01:58 -08:00
Apple
beed5308f1 fix(governance): Rename AgentStatus to AgentGovStatus to avoid conflict
Conflicts with existing AgentStatus from agents.ts
2025-11-29 16:43:07 -08:00
Apple
ec9ff3e633 feat(governance): Migrate Governance Engine to Next.js (apps/web)
BREAKING: Replace old MicroDAO voting with Agent Governance Engine

## New Files
- apps/web/src/lib/types/governance.ts
- apps/web/src/lib/api/governance.ts
- apps/web/src/lib/api/audit.ts
- apps/web/src/lib/api/incidents.ts
- apps/web/src/components/governance/GovernanceLevelBadge.tsx
- apps/web/src/components/governance/ReportButton.tsx
- apps/web/src/components/governance/CityGovernancePanel.tsx
- apps/web/src/components/governance/AuditDashboard.tsx
- apps/web/src/components/governance/IncidentsList.tsx
- apps/web/src/app/audit/page.tsx
- apps/web/src/app/incidents/page.tsx

## Updated Files
- apps/web/src/app/governance/page.tsx - New City Governance UI
- apps/web/src/components/Navigation.tsx - Shield icon for Governance

## Task
docs/tasks/TASK_PHASE_GOVERNANCE_MIGRATION_NEXTJS.md
2025-11-29 16:41:28 -08:00
Apple
2008332ce1 feat(governance): Integrate ReportButton across UI
- Add ReportButton to CityRoomView header
- Add ReportButton to AgentCabinet header
- Add GOVERNANCE link to main Navigation
- Import Shield icon from lucide-react
2025-11-29 16:18:43 -08:00
Apple
91a4c6be5b feat(governance): District & MicroDAO Governance Panels
- Add DistrictGovernancePanel component
- Add MicroDAOGovernancePanel component with team management
- Add /governance/district/:id route
- Add /governance/microdao/:id route
- Seed City Governance Agents on NODE1
2025-11-29 16:16:42 -08:00
Apple
57749ac10c docs: Update TASK_PHASE_GOVERNANCE_ENGINE checklist 2025-11-29 16:06:45 -08:00
Apple
bef55b2aa6 feat(governance): Frontend integration and pages
- Integrate GovernanceRolesBlock into AgentCabinet
- Add ReportButton component for creating incidents
- Add GovernancePage with tabs (City/Audit/Incidents)
- Add /governance route to App.tsx
- Export governance components from index.ts
2025-11-29 16:06:17 -08:00
Apple
e233d32ae7 feat(governance): Governance Engine MVP implementation
- Backend:
  - Migration 032: agent_gov_level, status, incidents, permissions tables
  - Domain types for governance layer
  - Permission Engine with all governance checks
  - Governance Service (promote/demote/roles)
  - Revocation Service (revoke/suspend/reinstate)
  - Audit Service (events filtering and stats)
  - Incidents Service (create/assign/escalate/resolve)
  - REST API routes for governance, audit, incidents

- Frontend:
  - TypeScript types for governance
  - API clients for governance, audit, incidents
  - GovernanceLevelBadge component
  - CityGovernancePanel component
  - AuditDashboard component
  - IncidentsList component with detail modal

Based on: Agent_Governance_Protocol_v1.md
2025-11-29 16:02:06 -08:00
Apple
2627205663 feat(governance): Agent Governance Protocol v1 - Constitution of DAARION.city 2025-11-29 15:44:05 -08:00
Apple
93a736c8fc feat(dais): DAIS Layer Architecture v1
## DAIS = DAARION Agent Identity System

- Complete architecture document for agent identity
- DAIS Identity = паспорт + сім-карта + soulbound-token
- Trust Levels: guest → agent → verified → orchestrator → operator
- Keys: ed25519, x25519, secp256k1 (future: PQC)
- Wallet: Polygon, TON, Ethereum
- Lifecycle: Creation → Issuance → Keys → Wallet → Assignment → Execution → Promotion → Revocation

## Key concepts:
- Every agent = digital personality with DAIS
- DAIS connects all layers: City, District, MicroDAO, Nodes, Rooms
- Foundation for Governance and Permissions
- Web3/SIWE ready

Doc #14 in foundation series
2025-11-29 15:40:30 -08:00