Update README.md
Browse files
README.md
CHANGED
|
@@ -1,184 +1,149 @@
|
|
| 1 |
-
# DriveCore
|
| 2 |
|
| 3 |
-
An AI-powered incident response, forensic analysis, and branch debugging platform.
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
- **Triage incidents** with an AI agent pipeline (intake β enrichment β analysis β response).
|
| 8 |
-
- **Run forensic analysis** on suspicious URLs and uploaded files with built-in SSRF protection.
|
| 9 |
-
- **Debug failing branches** by feeding a git diff (or raw snippet) + failure description and getting ranked root-cause suspects β with an IP Shield that strips secrets and tokenizes identifiers before anything leaves your machine.
|
| 10 |
-
- **Track compliance, coaching, and reports** from a single dashboard.
|
| 11 |
|
| 12 |
---
|
| 13 |
|
| 14 |
-
##
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| 18 |
-
| **Incidents** | Create, analyze, and resolve incidents. AI agent enriches each event with severity, recommended actions, and an audit trail. |
|
| 19 |
-
| **Forensic** | Submit URLs/files for automated forensic analysis. Public-URL inputs are guarded against SSRF (loopback, RFC1918, link-local, cloud metadata IPs blocked). |
|
| 20 |
-
| **Branch Debug** | Paste a git diff or code snippet + failure description β get ranked suspects with file path, line range, mechanism, and confidence. Includes a sanitization audit. |
|
| 21 |
-
| **Coaching / Compliance / Reports** | Workflow surfaces for review, learnings, and exportable reports. |
|
| 22 |
-
| **CLI / VS Code Extension** | Hit the same Branch Debug analyzer from your terminal or editor via a token-protected public endpoint. |
|
| 23 |
|
| 24 |
---
|
| 25 |
|
| 26 |
-
##
|
| 27 |
|
| 28 |
-
|
| 29 |
-
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
---
|
| 36 |
|
| 37 |
-
##
|
| 38 |
-
|
| 39 |
-
### 1. Prerequisites
|
| 40 |
-
|
| 41 |
-
- [Bun](https://bun.sh) β₯ 1.0 (or npm/pnpm)
|
| 42 |
-
- A Lovable account with this project synced to your GitHub
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
```
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
```
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
-
|
| 57 |
-
VITE_SUPABASE_URL=...
|
| 58 |
-
VITE_SUPABASE_PUBLISHABLE_KEY=...
|
| 59 |
-
VITE_SUPABASE_PROJECT_ID=...
|
| 60 |
-
```
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
-
| -------------------- | ----------------------------------------------------------------- |
|
| 66 |
-
| `LOVABLE_API_KEY` | AI Gateway access (auto-provided) |
|
| 67 |
-
| `BRANCH_DEBUG_TOKEN` | Bearer token for the public Branch Debug endpoint (CLI / VS Code) |
|
| 68 |
|
| 69 |
-
##
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
```bash
|
| 72 |
-
|
|
|
|
| 73 |
```
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
### 5. Build
|
| 78 |
-
|
| 79 |
```bash
|
| 80 |
-
bun
|
| 81 |
-
bun run preview # preview the build locally
|
| 82 |
```
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
This app ships with several hardening layers β keep them in place:
|
| 89 |
-
|
| 90 |
-
- **Auth on every server function** via `requireSupabaseAuth` middleware (`src/integrations/supabase/auth-middleware.ts`).
|
| 91 |
-
- **Row-level data ownership** β incident analysis checks `user_id` against the authenticated session.
|
| 92 |
-
- **SSRF guard** in the forensic pipeline (blocks loopback, private, link-local, and metadata IPs).
|
| 93 |
-
- **Public API hardening** β `/api/public/branch-debug` requires `Authorization: Bearer $BRANCH_DEBUG_TOKEN`, enforces CORS, and caps payloads at 256 KB.
|
| 94 |
-
- **XSS-safe rendering** β code snippets in the audit modal are HTML-escaped before highlighting.
|
| 95 |
-
- **Storage RLS** β `incident-files` bucket policies restrict users to their own folders.
|
| 96 |
-
- **`SECURITY DEFINER` functions** β execute revoked from `anon` and `authenticated`; called only from trusted server contexts.
|
| 97 |
-
- **IP Shield** β Branch Debug strips secrets (API keys, JWTs, `sk-β¦`), removes comments, and tokenizes identifiers (`fn_0001`) before sending anything to the AI gateway. Real names are restored only on the response.
|
| 98 |
-
|
| 99 |
-
When adding new server functions, **always** attach `.middleware([requireSupabaseAuth])` unless the route is intentionally public β and if it is public, document why and add a token check.
|
| 100 |
-
|
| 101 |
-
---
|
| 102 |
-
|
| 103 |
-
## π§° Branch Debug from CLI / VS Code
|
| 104 |
-
|
| 105 |
-
A token-protected public endpoint is exposed at:
|
| 106 |
|
|
|
|
| 107 |
```
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
"failureDescription": "what broke and how"
|
| 115 |
-
}
|
| 116 |
```
|
| 117 |
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
|
|
|
| 120 |
```bash
|
| 121 |
-
|
| 122 |
-
BRANCH_DEBUG_TOKEN=xxxx \
|
| 123 |
-
node cli/eventdash-debug.mjs --failure "checkout returns 500 on EU customers"
|
| 124 |
```
|
| 125 |
|
| 126 |
---
|
| 127 |
|
| 128 |
-
##
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
β βββ dashboard.index.tsx # Dashboard home
|
| 138 |
-
β βββ dashboard.forensic.tsx
|
| 139 |
-
β βββ dashboard.branch-debug.tsx
|
| 140 |
-
β βββ dashboard.coaching.tsx
|
| 141 |
-
β βββ dashboard.compliance.tsx
|
| 142 |
-
β βββ dashboard.reports.tsx
|
| 143 |
-
β βββ api/public/ # Public/webhook endpoints
|
| 144 |
-
βββ server/ # createServerFn handlers (auth-gated)
|
| 145 |
-
β βββ incidents.functions.ts
|
| 146 |
-
β βββ forensic.functions.ts
|
| 147 |
-
β βββ branch-debug.functions.ts
|
| 148 |
-
βββ components/ # UI + feature components
|
| 149 |
-
βββ integrations/supabase/ # Auto-generated client + middleware
|
| 150 |
-
βββ styles.css # Tailwind v4 + design tokens
|
| 151 |
-
|
| 152 |
-
supabase/
|
| 153 |
-
βββ config.toml # Cloud config (do not edit project_id)
|
| 154 |
-
βββ migrations/ # SQL migrations
|
| 155 |
-
```
|
| 156 |
|
| 157 |
---
|
| 158 |
|
| 159 |
-
##
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
| Add a server function | Create `src/server/<name>.functions.ts` with `createServerFn(...).middleware([requireSupabaseAuth])` |
|
| 165 |
-
| DB schema change | Use the Lovable Cloud migration tool β never edit `supabase/types.ts` manually |
|
| 166 |
-
| Add a secret | Lovable Cloud β Secrets (or ask the AI agent) |
|
| 167 |
-
| Theme tweak | `src/styles.css` β extend semantic tokens, not raw Tailwind colors |
|
| 168 |
|
| 169 |
---
|
| 170 |
|
| 171 |
-
##
|
| 172 |
|
| 173 |
-
|
| 174 |
|
| 175 |
-
-
|
| 176 |
-
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
| 179 |
|
| 180 |
---
|
| 181 |
|
| 182 |
## π License
|
| 183 |
|
| 184 |
Proprietary β internal use only unless otherwise specified.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DriveCore πβ‘
|
| 2 |
|
| 3 |
+
**An AI-powered incident response, forensic analysis, and branch debugging platform for autonomous vehicle fleets.**
|
| 4 |
|
| 5 |
+
> Built for the AMD Developer Cloud Hackathon β Track 1: AI Agents & Agentic Workflows
|
| 6 |
+
> Powered by **Qwen3** running on **AMD Instinct GPU** via **LangChain** multi-agent pipeline.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
---
|
| 9 |
|
| 10 |
+
## What is DriveCore?
|
| 11 |
+
|
| 12 |
+
DriveCore routes every autonomous vehicle incident, near miss, and sensor log through a multi-step AI agent pipeline β surfacing root causes, compliance concerns, and operator coaching plans in seconds.
|
| 13 |
|
| 14 |
+
When an AV has an incident (GNSS failure, unexpected stop, software regression), engineers spend hours manually triaging logs and writing reports. DriveCore automates that entire workflow using a 5-step LangChain agent pipeline powered by Qwen3 on AMD GPU.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## β¨ Features
|
| 19 |
|
| 20 |
+
| Module | What it does |
|
| 21 |
+
|---|---|
|
| 22 |
+
| **Incident Analysis** | Submit text or file-based incident reports. Five AI agents intake, enrich, analyze root causes, generate response plans, and draft formal safety reports. |
|
| 23 |
+
| **Branch Debug** | Paste a git diff or code snippet + failure description β get ranked root-cause suspects with file path, line range, confidence, and mechanism. IP Shield strips secrets before anything reaches the AI. |
|
| 24 |
+
| **Forensic Debrief** | Three-stage post-deployment forensic pipeline: code-only hypotheses β log correlation β full ROS bag / sensor data trace. |
|
| 25 |
+
| **Compliance Concerns** | Aggregated view of all compliance flags across incidents, referenced to AV standards (NHTSA AV Policy, ISO 26262, SAE J3016, FMVSS, UN R157). |
|
| 26 |
+
| **Coaching Recommendations** | Operator and engineer action items surfaced from all completed analyses. |
|
| 27 |
+
| **Safety Reports** | Browse and export completed incident analyses as Markdown reports. |
|
| 28 |
|
| 29 |
---
|
| 30 |
|
| 31 |
+
## π€ AI Agent Pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
DriveCore uses a **5-step LangChain agentic workflow** powered by **Qwen3 on AMD Instinct GPU**:
|
| 34 |
|
| 35 |
+
```
|
| 36 |
+
Step 1: Intake Agent β Classifies incident, extracts vehicle ID, timestamp, severity (P1/P2/P3)
|
| 37 |
+
Step 2: Enrichment Agent β Identifies affected AV subsystems (GNSS, LiDAR, perception, planning, control)
|
| 38 |
+
Step 3: Risk Agent β Root cause analysis ranked by confidence (ISO 26262, SAE J3016, NHTSA)
|
| 39 |
+
Step 4: Response Agent β Immediate actions, short-term fixes, long-term prevention measures
|
| 40 |
+
Step 5: Documentation Agent β Formal Markdown safety report + Qwen's Personal Recommendation
|
| 41 |
```
|
| 42 |
|
| 43 |
+
Each step feeds into the next, forming a genuine multi-agent reasoning chain β not just a single LLM call.
|
| 44 |
|
| 45 |
+
---
|
| 46 |
|
| 47 |
+
## π Tech Stack
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
| Layer | Technology |
|
| 50 |
+
|---|---|
|
| 51 |
+
| **AI Model** | Qwen3 (open-source) via Ollama |
|
| 52 |
+
| **Agent Framework** | LangChain (multi-step agentic pipeline) |
|
| 53 |
+
| **GPU Compute** | AMD Instinct MI300X via AMD Developer Cloud |
|
| 54 |
+
| **Backend** | FastAPI (Python), OpenAI-compatible API |
|
| 55 |
+
| **Frontend** | React 19 + TanStack Start + Vite + Tailwind CSS v4 |
|
| 56 |
+
| **Database** | Supabase (Postgres + Auth) |
|
| 57 |
+
| **Deployment** | AMD Developer Cloud (GPU backend) |
|
| 58 |
|
| 59 |
+
---
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
+
## π Quick Start
|
| 62 |
|
| 63 |
+
### Prerequisites
|
| 64 |
+
- AMD Developer Cloud account with GPU droplet
|
| 65 |
+
- Docker
|
| 66 |
+
- Ollama
|
| 67 |
+
- Bun β₯ 1.0
|
| 68 |
+
|
| 69 |
+
### 1. Clone the repo
|
| 70 |
```bash
|
| 71 |
+
git clone https://github.com/nextgenframes/DriveCore.git
|
| 72 |
+
cd DriveCore
|
| 73 |
```
|
| 74 |
|
| 75 |
+
### 2. Install dependencies
|
|
|
|
|
|
|
|
|
|
| 76 |
```bash
|
| 77 |
+
bun install
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
+
### 3. Set up environment variables
|
| 81 |
+
```bash
|
| 82 |
+
cp .env.example .env
|
| 83 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
+
Edit `.env`:
|
| 86 |
```
|
| 87 |
+
VITE_SUPABASE_URL=your_supabase_url
|
| 88 |
+
VITE_SUPABASE_PUBLISHABLE_KEY=your_anon_key
|
| 89 |
+
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
|
| 90 |
+
AI_BASE_URL=http://your_amd_gpu_ip:8006
|
| 91 |
+
AI_API_KEY=dummy
|
| 92 |
+
AI_MODEL=qwen3
|
|
|
|
|
|
|
| 93 |
```
|
| 94 |
|
| 95 |
+
### 4. Start the Qwen3 backend on AMD GPU
|
| 96 |
+
```bash
|
| 97 |
+
# Inside your AMD GPU container
|
| 98 |
+
ollama serve &
|
| 99 |
+
ollama pull qwen3
|
| 100 |
+
pip install langchain langchain-ollama fastapi uvicorn
|
| 101 |
+
uvicorn backend:app --host 0.0.0.0 --port 8006 &
|
| 102 |
+
```
|
| 103 |
|
| 104 |
+
### 5. Run the frontend
|
| 105 |
```bash
|
| 106 |
+
bun run dev --host 0.0.0.0 --port 30000
|
|
|
|
|
|
|
| 107 |
```
|
| 108 |
|
| 109 |
---
|
| 110 |
|
| 111 |
+
## π API Endpoints
|
| 112 |
|
| 113 |
+
| Endpoint | Method | Description |
|
| 114 |
+
|---|---|---|
|
| 115 |
+
| `/health` | GET | Health check β confirms Qwen3 is running |
|
| 116 |
+
| `/triage` | POST | Full 5-step agentic incident triage pipeline |
|
| 117 |
+
| `/branch-debug` | POST | Git diff root cause analysis |
|
| 118 |
+
| `/forensic` | POST | Forensic content analysis |
|
| 119 |
+
| `/v1/chat/completions` | POST | OpenAI-compatible endpoint |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
---
|
| 122 |
|
| 123 |
+
## π Security
|
| 124 |
|
| 125 |
+
- **IP Shield** β Branch Debug strips API keys, JWTs, and secrets before sending to AI
|
| 126 |
+
- **SSRF Guard** β Forensic pipeline blocks loopback, private, and cloud metadata IPs
|
| 127 |
+
- **Auth** β Supabase authentication with row-level security
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
---
|
| 130 |
|
| 131 |
+
## π Hackathon
|
| 132 |
|
| 133 |
+
Built for **AMD Developer Cloud Hackathon β Track 1: AI Agents & Agentic Workflows**
|
| 134 |
|
| 135 |
+
- β
LangChain multi-step agentic pipeline
|
| 136 |
+
- β
Qwen3 open-source model
|
| 137 |
+
- β
Running on AMD Instinct GPU via AMD Developer Cloud
|
| 138 |
+
- β
Real AV safety use case (incident triage, branch debug, forensic analysis)
|
| 139 |
+
- β
OpenAI-compatible API
|
| 140 |
|
| 141 |
---
|
| 142 |
|
| 143 |
## π License
|
| 144 |
|
| 145 |
Proprietary β internal use only unless otherwise specified.
|
| 146 |
+
|
| 147 |
+
---
|
| 148 |
+
|
| 149 |
+
*Powered by AMD Instinct GPU β‘*
|