# TrueIntent

TrueIntent is a modern, purpose-driven full-stack dating platform built to emphasize transparent, high-integrity relationship matching. Unlike traditional swipe-and-chat software, TrueIntent forces transparency around relationship goals, compatibility metrics, and user availability to reduce dating fatigue and foster deeper connections.

## Tech Stack & Architecture

- **Frontend SPA**: React 18+ powered by Vite. Styles are built entirely with a custom Tailwind CSS configuration. Animations leverage the high-performance `motion/react` framework.
- **Backend Service**: Express.js custom server (running in Node.js) with native TypeScript support (`tsx`).
- **Data Layer**: SQLite persistence layer (`dating.db`) utilizing fast prepared synchronous statements (`better-sqlite3`).
- **Real-Time Communication**: Custom WebSockets for instant messages, real-time typing indicators, read-receipt updates, and peer-to-peer WebRTC video stream signaling.
- **AI Integration**: Native, low-latency `@google/genai` Integration with Gemini-3.5-flash. Generates profiles, customized prompts, and streaming personalized icebreakers.

---

## Core Features & Workflows

### 1. Transparent Matching & Intent Badges
- Profiles display clear badges representing the user's core intent (e.g., *Lifetime Partner*, *Long-term*, *Casual Dating*, *New Friends*, *Still figuring it out*).
- System computes compatibility scores based on mutual answers to onboarding interest questions and compatibility quizzes.

### 2. Personalized AI Icebreakers (Gemini-Powered)
- **Single Swiper Opener**: On profile views during matching, users can click "AI Icebreaker" to stream a customized greeting matching the target's biography/interests.
- **Interactive Multi-Opener Suggestions**: Inside an active chat, users can click the Sparkles icon or access the suggestion screen to load three styled openers:
  1. *Witty & Playful*: Humorous, light-spirited openers.
  2. *Thoughtful & Deep*: Direct and engaging inquiries referencing exact shared hobbies.
  3. *Light & Easy*: Smooth, casual conversational starters.
- **Low-Latency Streaming**: Prompts are optimized with Gemini streaming chunks (`generateContentStream`), delivering instantaneous, real-time wording updates.

### 3. Do Not Disturb (DND) Control
- Users can enable DND indefinitely or schedule timed expirations (30 Minutes, 1 Hour, 8 Hours, or Overnight).
- While active, other users see a "Do Not Disturb" status visual in active chat lists and profile overlays.
- Incoming video calls are automatically silenced on the recipient's viewport and logged as silenced notifications, while callers receive a polite busy notification.

### 4. Interactive Multimedia Chat & WebRTC Calling
- In-app text chat with audio messages, photo attachments, and direct location-sharing.
- Typing indicators and selective read receipts.
- Direct video calling powered by WebRTC. Post-call ratings and summaries are logged securely in SQLite.

---

## Agent Discovery & Useful Resources (RFC 8288 & DNS-AID & ARD)

- **Universal AI Agent Tools Catalog**: `GET /api/tools` or `GET /.well-known/tools.json` (`rel="tools"`, `rel="tools-catalog"`, `Content-Type: application/json`). Universal discovery catalog registering all 7 certified platform tools (`match_profiles`, `get_profile`, `generate_icebreaker`, `analyze_compatibility`, `verify_intent`, `search_profiles`, `send_message`). Supports multi-format export via query parameter: `?format=openai` (OpenAI function calling), `?format=anthropic` (Anthropic Claude tool use), `?format=gemini` (Gemini SDK function declarations), and `?format=mcp` (MCP 2024-11-05). Supports search (`?q=term`), category filtering (`?category=matchmaking`), individual tool inspect (`GET /api/tools/:name`), and direct HTTP execution (`POST /api/tools/:name/execute`).
- **Agentic Resource Discovery (ARD) Manifest**: `GET /.well-known/ai-catalog.json` or `GET /.well-known/ard.json` (`rel="ai-catalog"`, `rel="ard"`, `rel="agentic-resource-discovery"`, `Content-Type: application/ai-catalog+json, application/json`). Returns the standard Agentic Resource Discovery manifest adhering to the AI Catalog 1.0 specification with domain-anchored URNs, capability declarations for MCP servers (`application/mcp-server-card+json`), A2A agents (`application/a2a-agent-card+json`), OpenAPI 3.1 REST APIs (`application/openapi+json`), WebMCP tools (`application/webmcp+json`), Agent Skills Discovery Index (`application/agent-skills+json`), OAuth Protected Resource Metadata (`application/oauth-protected-resource+json`), and progressive trust manifests with representative semantic queries.
- **WebMCP (Web Model Context Protocol)**: Browser-native AI agent tool interface exposed via `navigator.modelContext` and declarative `<script type="application/webmcp+json">` on all pages. Exposes client-side callable tools (`match_profiles`, `get_profile`, `generate_icebreaker`, `analyze_compatibility`, `verify_intent`, `search_profiles`, `send_message`) with zero-latency in-browser execution. Discovery manifest available at `GET /.well-known/webmcp.json` (`rel="webmcp"`).
- **Agent Skills Discovery Index (RFC v0.2.0)**: `GET /.well-known/agent-skills/index.json` (`rel="agent-skills"`, `Content-Type: application/json`). Returns the standardized Agent Skills Discovery index declaring available agent skills (`matchmaking`, `icebreaker-generation`, `intent-verification`, `compatibility-analysis`, `profile-search`), their respective `SKILL.md` URLs, and SHA256 integrity digests.
- **Model Context Protocol (MCP) Server Card (SEP-1649)**: `GET /.well-known/mcp.json` or `GET /.well-known/mcp/server-card.json` (`rel="mcp-server-card"`, `Content-Type: application/json`). Exposes MCP tool definitions (`match_profiles`, `get_profile`, `generate_icebreaker`, `analyze_compatibility`, `verify_intent`, `search_profiles`), resource URIs (`trueintent://taxonomy/intents`, `trueintent://profiles/active`, `trueintent://standards/agent-etiquette`), and prompt templates for autonomous agent integration.
- **MCP Streamable HTTP / SSE Endpoint**: `POST /api/mcp` (JSON-RPC 2.0) and `GET /api/mcp/sse` (Server-Sent Events transport).
- **Auth.md Agent Registration & Authentication Specification**: `GET /auth.md` (`rel="auth"`, `rel="service-doc"`, `Content-Type: text/markdown`). Provides complete agent registration procedures, token flows, identity types, and claims schemas.
- **Dynamic Client Registration (RFC 7591)**: `POST /api/oauth/register` (registers autonomous agents and issues `client_id` / `client_secret`).
- **OpenID Connect Discovery 1.0**: `GET /.well-known/openid-configuration` (`rel="openid-configuration"`, `Content-Type: application/json`). Returns standard OIDC discovery metadata containing `issuer`, `authorization_endpoint`, `token_endpoint`, `jwks_uri`, and supported scopes/grant types.
- **OAuth 2.0 Authorization Server Metadata (RFC 8414)**: `GET /.well-known/oauth-authorization-server` (`rel="oauth-authorization-server"`, `Content-Type: application/json`). Returns RFC 8414 server metadata for automated agent authentication with full `agent_auth` block.
- **OAuth 2.0 Protected Resource Metadata (RFC 9700)**: `GET /.well-known/oauth-protected-resource` (`rel="oauth-protected-resource"`, `Content-Type: application/json`). Returns resource identifier, `authorization_servers` list, supported scopes, and bearer authentication methods.
- **OAuth 2.0 Combined Discovery Metadata**: `GET /.well-known/oauth-metadata` or `GET /api/oauth/metadata` (`rel="oauth-metadata"`, `Content-Type: application/json`). Unified catalog combining RFC 8414 Authorization Server Metadata and RFC 9700 Protected Resource Metadata.
- **Pushed Authorization Requests (PAR / RFC 9126)**: `POST /api/oauth/par` (`rel="pushed-authorization-request"`). Generates request URIs (`urn:ietf:params:oauth:request_uri:...`) preventing parameter tampering.
- **Device Authorization Grant (RFC 8628)**: `POST /api/oauth/device` (`rel="device-authorization"`). Supports autonomous bots and terminal/headless client authentication flows.
- **OAuth Token Endpoint**: `POST /oauth/token` or `POST /api/oauth/token` (supports `client_credentials`, `authorization_code`, and `refresh_token` flows).
- **API Catalog (RFC 9727 / RFC 9264)**: `GET /.well-known/api-catalog` (`rel="api-catalog"`, `Content-Type: application/linkset+json`). Returns linkset linking all API endpoints with `service-desc` (OpenAPI spec), `service-doc` (Markdown & API documentation), and `status` (health endpoint).
- **Web Bot Auth & JWKS Directory (RFC 9421 / Message Signatures)**: `GET /.well-known/http-message-signatures-directory` and `GET /.well-known/jwks.json` (`rel="http-message-signatures-directory"`, `rel="jwks"`). Used by remote services and receiving sites to verify TrueIntentBot signed agent requests.
- **Markdown for Agents (Content Negotiation)**: Send `Accept: text/markdown` with any document/page request (e.g., `GET /`, `GET /explore`, `GET /chat`) to receive structured Markdown instead of HTML.
- **LLM Context & Documentation**: `GET /llms.txt` (`rel="help"`, `rel="describedby"`)
- **OpenAPI 3.0 Specification**: `GET /openapi.json` (`rel="service-desc"`)
- **Agent Discovery Manifest**: `GET /.well-known/agent.json` (`rel="agent"`)
- **DNS-AID Entrypoint**: `GET /.well-known/dns-aid` (`rel="dns-aid"`, `Content-Type: application/json`).
- **DNS-AID JSON Manifest**: `GET /.well-known/dns-aid.json` (`rel="dns-aid"`).
- **DNS-AID Zone Records**: `GET /.well-known/dns-aid.zone` (`rel="dns-aid-zone"`).
- **DNS-AID DNSSEC Signed Zone**: `GET /.well-known/dns-aid.signed.zone` (`rel="dns-aid-signed-zone"`).
- **DNS-AID Records API**: `GET /.well-known/dns-aid/records` (`Content-Type: application/json`).
- **DNS-over-HTTPS (DoH) & DNSSEC Resolver**: `GET /dns-query` or `GET /api/dns-query` (Returns `AD: true`).
- **Sitemap XML**: `GET /sitemap.xml` (`rel="sitemap"`)
- **Robots Rules & Content Signals**: `GET /robots.txt` (`rel="robots"`, `Content-Signal: ai-train=no, search=yes, ai-input=no`)

---

## DNS for AI Discovery (DNS-AID) & DNSSEC Signed Zone (draft-mozleywilliams-dnsop-dnsaid)

TrueIntent publishes standard DNS-AID ServiceMode records (RFC 9460) with `alpn` and `endpoint` parameters, signed with DNSSEC (RFC 4033 / 4034 / 4035 / 6605 Algorithm 13 ECDSAP256SHA256) so validating resolvers receive Authenticated Data (`AD: true`).

### 1. Root Organization Index Record
```dns
_index._agents.trueintent-dating.com.  3600 IN TXT "v=aid1; agents=match:mcp,icebreaker:a2a,api:https; cap=/openapi.json; policy=/llms.txt; realm=dating.trueintent"
```

### 2. ServiceMode SVCB & HTTPS Records with ALPN and Endpoint Parameters
```dns
; Match & Discovery Agent (MCP Protocol, ServiceMode Priority 1)
_match._agents.trueintent-dating.com.       3600 IN SVCB 1 trueintent-dating.com. alpn="mcp" port=443 endpoint="/api/mcp" cap="/.well-known/agent.json" cap-sha256="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" policy="/llms.txt" realm="dating.trueintent.match"

; Gemini Streaming Icebreaker Agent (A2A Protocol, ServiceMode Priority 1)
_icebreaker._agents.trueintent-dating.com.  3600 IN SVCB 1 trueintent-dating.com. alpn="a2a" port=443 endpoint="/api/generate-icebreaker" cap="/openapi.json" policy="/llms.txt" realm="dating.trueintent.icebreaker"

; Core REST & WebRTC Service (HTTPS ServiceMode Priority 1)
_api._agents.trueintent-dating.com.         3600 IN HTTPS 1 trueintent-dating.com. alpn="h2,h3" port=443 endpoint="/api" cap="/openapi.json" policy="/llms.txt" realm="dating.trueintent.rest"

; Multi-Protocol Hub Binding
_agents.trueintent-dating.com.              3600 IN SVCB 1 trueintent-dating.com. alpn="mcp,a2a,https" port=443 endpoint="/api" cap="/.well-known/agent.json" policy="/llms.txt" realm="dating.trueintent"

; Apex HTTPS Record
trueintent-dating.com.                      3600 IN HTTPS 1 . alpn="h2,h3" port=443 endpoint="/" cap="/openapi.json" policy="/llms.txt"
```

### 3. DNSSEC Public Keys & Delegation Signer
```dns
; Key Signing Key (KSK) - Tag 12213
trueintent-dating.com.  3600 IN DNSKEY 257 3 13 bTkoP7Y6WTf3+0/4FgXxRF7NQt+IeY4OpFq/FpQioIL5Epgw1pvsXXQ26rPY3z3zyotL5X/zRQxqxX8/pQ6ysw==

; Zone Signing Key (ZSK) - Tag 7477
trueintent-dating.com.  3600 IN DNSKEY 256 3 13 qSP5lLzJDFS/1nSCrcnyclB4b6YRntUX8bAKKw5msMlDDhy4FFUn6kQiiA4rakFcJSFHvcRP4Zv+/EZY1EJ1fA==

; Delegation Signer (DS) for Parent Zone / Registrar
trueintent-dating.com.  3600 IN DS 12213 13 2 1C05D3940909495FF1F788123360DDB68A663A4418B4E1C9BE3BCF0DA5D85291
```

### 4. DNS-AID & AID v1.x TXT Records
```dns
; AID Protocol v1.x primary machine-readable agent identity record for Matchmaking AI
_agent.trueintent-dating.com.            3600 IN TXT "v=aid1;u=https://trueintent-dating.com/api/mcp;p=mcp;a=pat,bearer;s=TrueIntent Matchmaking AI;d=https://trueintent-dating.com/llms.txt;c=/.well-known/agent.json;ard=/.well-known/ai-catalog.json;skills=/.well-known/agent-skills/index.json;realm=dating.trueintent"

; DNS-AID collective agent protocols and discovery hub TXT record
_agents.trueintent-dating.com.           3600 IN TXT "v=aid1;u=https://trueintent-dating.com/api;p=mcp,a2a,https;a=bearer,oauth2;s=TrueIntent Dating AI Agents Hub;d=/llms.txt;ard=/.well-known/ai-catalog.json;c=/.well-known/agent.json;realm=dating.trueintent"

; DNS-AID organization agent index (draft-mozleywilliams-dnsop-dnsaid)
_index._agents.trueintent-dating.com.    3600 IN TXT "v=aid1; agents=match:mcp,icebreaker:a2a,api:https,compatibility:mcp,intent:a2a; cap=/openapi.json; policy=/llms.txt; realm=dating.trueintent; ard=/.well-known/ai-catalog.json; skills=/.well-known/agent-skills/index.json; mcp=/.well-known/mcp.json; agent=/.well-known/agent.json"

; Autonomous Matchmaking AI Agent MCP endpoint and capability specification
_match._aid.trueintent-dating.com.       3600 IN TXT "v=aid1; proto=mcp; port=443; endpoint=/api/mcp; cap=/.well-known/agent.json; policy=/llms.txt; realm=dating.trueintent.match; ard=/.well-known/ai-catalog.json; skills=/.well-known/agent-skills/matchmaking/SKILL.md"

; Gemini Icebreaker Generation Agent A2A endpoint and skill metadata
_icebreaker._aid.trueintent-dating.com.  3600 IN TXT "v=aid1; proto=a2a; port=443; endpoint=/api/generate-icebreaker; cap=/openapi.json; policy=/llms.txt; realm=dating.trueintent.icebreaker; skills=/.well-known/agent-skills/icebreaker-generation/SKILL.md"

; Mutual Intent & Compatibility Analysis Agent endpoint
_compatibility._aid.trueintent-dating.com. 3600 IN TXT "v=aid1; proto=mcp,a2a; port=443; endpoint=/api/mcp; cap=/.well-known/agent.json; policy=/llms.txt; realm=dating.trueintent.compatibility; skills=/.well-known/agent-skills/compatibility-analysis/SKILL.md"

; Intent Tier Verification and Anti-Ghosting Protocol Agent endpoint
_intent._aid.trueintent-dating.com.      3600 IN TXT "v=aid1; proto=mcp,a2a; port=443; endpoint=/api/mcp; cap=/.well-known/agent.json; policy=/llms.txt; realm=dating.trueintent.intent; skills=/.well-known/agent-skills/intent-verification/SKILL.md"

; Core Dating Platform REST API and WebRTC signalling HTTPS endpoint
_api._aid.trueintent-dating.com.         3600 IN TXT "v=aid1; proto=https; port=443; endpoint=/api; cap=/openapi.json; policy=/llms.txt; realm=dating.trueintent.rest; auth=/.well-known/oauth-protected-resource"

; TrueIntent multi-protocol AI agent service umbrella TXT record
_trueintent._aid.trueintent-dating.com.  3600 IN TXT "v=aid1; proto=mcp,a2a,https; port=443; endpoint=/api; cap=/openapi.json; policy=/llms.txt; agent=/.well-known/agent.json; ard=/.well-known/ai-catalog.json; realm=dating.trueintent"

; Direct TXT mapping for _match._agents service node
_match._agents.trueintent-dating.com.    3600 IN TXT "v=aid1; proto=mcp; port=443; endpoint=/api/mcp; cap=/.well-known/agent.json; policy=/llms.txt; realm=dating.trueintent.match"

; Direct TXT mapping for _icebreaker._agents service node
_icebreaker._agents.trueintent-dating.com. 3600 IN TXT "v=aid1; proto=a2a; port=443; endpoint=/api/generate-icebreaker; cap=/openapi.json; policy=/llms.txt; realm=dating.trueintent.icebreaker"

; Direct TXT mapping for _api._agents service node
_api._agents.trueintent-dating.com.      3600 IN TXT "v=aid1; proto=https; port=443; endpoint=/api; cap=/openapi.json; policy=/llms.txt; realm=dating.trueintent.rest"

; Root Apex DNS-AID discovery TXT record
trueintent-dating.com.                   3600 IN TXT "v=aid1; agents=match:mcp,icebreaker:a2a,api:https; ard=/.well-known/ai-catalog.json; agent=/.well-known/agent.json; policy=/llms.txt; mcp=/.well-known/mcp.json; auth=/.well-known/oauth-protected-resource"
```

---

## API & Backend Endpoints

### Authentication & Profiles
- `POST /api/auth/register` / `POST /api/auth/login` — Standard credentials check.
- `POST /api/profile/update` — Save bio, interest flags, location coordinates, and preference matching criteria.
- `POST /api/profile/settings` — Update global and secure settings (e.g., Read Receipts, DND options).
- `POST /api/profile/visibility` — Toggle public discovery status online or offline.
- `POST /api/profile/dnd` — Toggle DND status on or off with scheduled expiring times.

### AI Capabilities (Gemini 3.5 API)
- `POST /api/generate-bio` — Streams a tailored bio based on selected vibes and bullets.
- `POST /api/generate-prompt` — Generates a creative prompt response for user profiles.
- `POST /api/generate-icebreaker` — Generates and streams a personalized opener for matching.
- `POST /api/generate-icebreaker-suggestions` — Curates a JSON package with three targeted openers (Witty, Thoughtful, Casual).

### Interactions & Match Decks
- `GET /api/profiles` — Discovery deck with preference filtering.
- `POST /api/swipe` / `POST /api/swipe/undo` — Core match logic.
- `GET /api/matches` — List confirmed matches.
- `POST /api/messages` — Read and write real-time chat messages.
- `POST /api/calls/start` / `POST /api/calls/update` / `POST /api/calls/rate` — Manage signaling paths and metadata for WebRTC calls.

### DNS-AID & DNSSEC Endpoints
- `GET /.well-known/dns-aid.json` — Structured JSON manifest.
- `GET /.well-known/dns-aid.zone` — Master RFC 1035 zone file.
- `GET /.well-known/dns-aid.signed.zone` — DNSSEC-signed master zone file with RRSIG and NSEC chains.
- `GET /dns-query?name={fqdn}&type={type}` — RFC 8484 DNS-over-HTTPS resolver returning `AD: true` (Authenticated Data).
- `GET /api/dns-aid` — Inspection endpoint for DNSSEC trust chains and ServiceMode records.
