jasybeaar commited on
Commit
bb811b6
Β·
1 Parent(s): b45dfc9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -129
README.md CHANGED
@@ -1,184 +1,149 @@
1
- # DriveCore
2
 
3
- An AI-powered incident response, forensic analysis, and branch debugging platform.
4
 
5
- DriveCore helps engineering and security teams:
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
- ## ✨ Features
 
 
15
 
16
- | Module | What it does |
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
- ## πŸ— Tech stack
27
 
28
- - **Framework**: [TanStack Start](https://tanstack.com/start) (React 19 + Vite 7, SSR on Cloudflare Workers)
29
- - **Styling**: Tailwind CSS v4 + shadcn/ui + semantic design tokens
30
- - **Backend**: Lovable Cloud (managed Postgres, Auth, Storage, Edge Functions)
31
- - **AI**: Lovable AI Gateway (Gemini 2.5 Flash by default β€” no API key required)
32
- - **Routing**: File-based routes under `src/routes/`
33
- - **Server logic**: `createServerFn` handlers under `src/server/`
 
 
34
 
35
  ---
36
 
37
- ## πŸš€ Quick Start
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
- ### 2. Clone and install
45
 
46
- ```bash
47
- git clone https://github.com/<your-org>/guardian-owl-56.git
48
- cd guardian-owl-56
49
- bun install
 
 
50
  ```
51
 
52
- ### 3. Environment
53
 
54
- The `.env` file is **auto-managed by Lovable Cloud** and already contains:
55
 
56
- ```
57
- VITE_SUPABASE_URL=...
58
- VITE_SUPABASE_PUBLISHABLE_KEY=...
59
- VITE_SUPABASE_PROJECT_ID=...
60
- ```
61
 
62
- Do **not** edit it manually. Server-side secrets (set via Lovable Cloud β†’ Secrets):
 
 
 
 
 
 
 
 
63
 
64
- | Secret | Purpose |
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
- ### 4. Run locally
70
 
 
 
 
 
 
 
 
71
  ```bash
72
- bun run dev
 
73
  ```
74
 
75
- Open <http://localhost:5173>. Sign up / log in β€” the dashboard requires an authenticated session.
76
-
77
- ### 5. Build
78
-
79
  ```bash
80
- bun run build # production build (Cloudflare Worker bundle)
81
- bun run preview # preview the build locally
82
  ```
83
 
84
- ---
85
-
86
- ## πŸ” Security posture
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
- POST https://project--bff39f15-1e2d-4d34-8f4b-7070bac6dbae.lovable.app/api/public/branch-debug
109
- Authorization: Bearer $BRANCH_DEBUG_TOKEN
110
- Content-Type: application/json
111
-
112
- {
113
- "diff": "<unified git diff>",
114
- "failureDescription": "what broke and how"
115
- }
116
  ```
117
 
118
- A reference CLI lives in [`cli/eventdash-debug.mjs`](./cli/eventdash-debug.mjs). Typical use:
 
 
 
 
 
 
 
119
 
 
120
  ```bash
121
- git diff main...HEAD | \
122
- BRANCH_DEBUG_TOKEN=xxxx \
123
- node cli/eventdash-debug.mjs --failure "checkout returns 500 on EU customers"
124
  ```
125
 
126
  ---
127
 
128
- ## πŸ“ Project structure
129
 
130
- ```
131
- src/
132
- β”œβ”€β”€ routes/ # File-based routes (TanStack Start)
133
- β”‚ β”œβ”€β”€ __root.tsx # Root shell + providers
134
- β”‚ β”œβ”€β”€ index.tsx # Landing page
135
- β”‚ β”œβ”€β”€ auth.tsx # Sign in / sign up
136
- β”‚ β”œβ”€β”€ dashboard.tsx # Authenticated layout (sidebar + Outlet)
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
- ## πŸ§ͺ Common tasks
160
 
161
- | Task | Command / location |
162
- | --------------------- | ---------------------------------------------------------------------------------------------------- |
163
- | Add a route | Create `src/routes/<name>.tsx` β€” auto-registered |
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
- ## 🀝 Working with Lovable + GitHub
172
 
173
- This repo is **bidirectionally synced** with the Lovable editor:
174
 
175
- - Edits in Lovable β†’ auto-pushed to GitHub.
176
- - Pushes to GitHub β†’ auto-pulled into Lovable.
177
-
178
- So you can code locally, in your IDE, or in the Lovable chat β€” whichever fits the moment. Open the project at <https://lovable.dev/projects/bff39f15-1e2d-4d34-8f4b-7070bac6dbae>.
 
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 ⚑*