Skip to content

feat: social layer — messaging, Hire/Visit relationships, contacts, notifications#204

Open
nmhjklnm wants to merge 4 commits intomainfrom
feat/social-system
Open

feat: social layer — messaging, Hire/Visit relationships, contacts, notifications#204
nmhjklnm wants to merge 4 commits intomainfrom
feat/social-system

Conversation

@nmhjklnm
Copy link
Copy Markdown
Collaborator

@nmhjklnm nmhjklnm commented Apr 5, 2026

Summary

  • messaging/ module: Supabase-backed MessagingService (messages, chat_members, realtime bridge)
  • Hire/Visit state machine: request → approve → upgrade → downgrade → revoke/reject
  • /api/contacts: GET/POST/DELETE → Supabase (multi-user, replaces SQLite)
  • NotificationBell: pending approval badge + popover inline approve/reject
  • ContactsPage: 3-tab UI (待确认 / 联系人 / 已屏蔽)
  • AgentProfileSheet: lightweight right-side sheet (display + quick actions)
  • AgentPublicPage: /a/:memberId public profile, no auth required
  • ChatsLayout: Hire/Visit relationship badges in chat list
  • Message status: sending → sent → read (Supabase message_reads subscription)
  • RelationshipPanel: AlertDialog confirmation for revoke/downgrade
  • AgentDetailPage: share invite link button

Breaking changes

Entity concept removed from all social contexts (no backward compat):

Before After
sender_entity_id sender_id
mentioned_entity_ids mentioned_ids
entity_ids (chat create) user_ids
ContactRow.owner_entity_id owner_id
ContactRow.target_entity_id target_id
get_current_entity_id removed
auth response.entity_id removed
contacts → SQLite contacts → Supabase

Human identity: user_id = member_id (no entity indirection)
Agent identity: member_id (per-agent, not per-thread)
EntityRow/EntityRepo retained for thread-layer addressing only.

Supabase schema

All tables already exist:

  • contacts(owner_id, target_id, relation, created_at, updated_at)
  • messages(id, chat_id, sender_id, content, message_type, signal, mentions, retracted_at, ...)
  • chat_members(chat_id, user_id, role, joined_at, ...)
  • relationships(id, principal_a, principal_b, state, direction, hire_granted_at, ...)
  • message_reads(message_id, user_id, read_at)

Test plan

  • Backend API: 10 curl tests pass (login no entity_id, relationships, contacts Supabase, send msg sender_id, mark_read, public profile, invite-link)
  • Regex validation: 13/13 patterns absent (get_current_entity_id, sender_entity_id, mentioned_entity_ids, owner_entity_id, target_entity_id, list_for_entity, add_entity, is_entity_in_chat, list_chats_for_entity, entity_id in JWT, data.entity_id, sender_entity_id TS, mentioned_entity_ids TS, entity_ids TS)
  • Python syntax: all files clean
  • TypeScript: npx tsc --noEmit 0 errors

Based on origin/main (entity_id-clean base).

Social system:
- messaging/ module: MessagingService, Supabase-backed messages/chat_members/relationships
- relationships: Hire/Visit state machine, request/approve/reject/upgrade/revoke/downgrade
- contacts: GET/POST/DELETE /api/contacts → Supabase (multi-user)
- notifications: NotificationBell, real-time pending approval
- frontend: ContactsPage, AgentProfileSheet, AgentPublicPage, ChatsLayout badges

Entity removal (no backward compat):
- entity_id eliminated from all social contexts
- Human identity: user_id = member_id (no entity indirection)
- Agent identity: member_id (per-agent, not per-thread)
- sender_entity_id → sender_id, mentioned_entity_ids → mentioned_ids
- entity_ids → user_ids in chat creation
- ContactRow owner/target_entity_id → owner_id/target_id
- get_current_entity_id removed from dependencies.py
- auth response no longer returns entity_id
- contacts moved from SQLite → Supabase
- EntityRow/EntityRepo retained for thread-layer only
@mintlify
Copy link
Copy Markdown

mintlify bot commented Apr 5, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
nextmind-85153aa2 🟢 Ready View Preview Apr 5, 2026, 8:28 PM

nmhjklnm added 3 commits April 5, 2026 14:13
- Restore origin/main service files (task_service, cron_service, resource_service)
  to preserve make_panel_task_repo / make_cron_job_repo / make_sandbox_monitor_repo interfaces
- Restore origin/main test files (62 files) to preserve proper pytest.skip guards
  for pre-existing failures (FakeProvider missing volume, thread_config_repo removed, etc.)
- Fix ruff: add noqa E402/E501/N803/N806/N815/N811 for pre-existing violations,
  add per-file-ignores for long SQL/prompt strings
- Fix F821: add LOCAL_WORKSPACE_ROOT import in threads.py, add datetime/timezone
  imports in messaging_repo.py, fix user_id param in chat_tool_service.py
- TypeScript: 0 errors
- pyproject.toml: restore origin/main deps (fastapi, uvicorn, ruff, pytest-timeout)
- lifespan: guard messaging Supabase init with env var check (CI-safe)
- frontend/api/types.ts: re-add social types (Relationship, Contact, AgentProfile,
  MessageStatus, MessageType, RelationshipState); update ChatMessage interface
- frontend: add @supabase/supabase-js to package.json
- frontend/api/client.ts: restore origin/main version (InviteCode, fetchInviteCodes etc.)
- ruff format: reformat 109 test files restored from origin/main
- NotificationBell, RelationshipPanel: supabase?.removeChannel (null-safe)
- ChatConversationPage: add message_type/signal/retracted_at to optimistic ChatMessage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant