Skip to content

Commit c878e4b

Browse files
createpjfclaude
andcommitted
feat: V3.0.0 — Cloud Gateway + Model Registry + Admin Dashboard
Cloud Gateway: - Model registry with DB-backed CRUD and admin API - Scoring engine with quality/speed/cost/code routing - Provider access control with plan-based gating - Admin dashboard: user management, pagination, search, validation - Bug fixes: regex state leak, prefix fallback, atomic updates, XSS Desktop: - Brave Search integration - Chat window with full conversation support - Thinking model support (extended reasoning) - Spotlight V2 with streaming - Local model support (Ollama + LM Studio) - Global shortcuts, usage tracking, analytics Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent db11677 commit c878e4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+12316
-732
lines changed

.github/workflows/build.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ jobs:
3131
- run: cd apps/desktop && npx tsc --noEmit
3232
- run: cd apps/desktop && npx vitest run
3333

34+
test-cloud-gateway:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: oven-sh/setup-bun@v2
39+
- run: cd apps/cloud-gateway && bun install
40+
- run: cd apps/cloud-gateway && bun test
41+
- run: cd apps/cloud-gateway && bunx tsc --noEmit
42+
3443
build-macos:
35-
needs: [test-gateway, test-desktop]
44+
needs: [test-gateway, test-desktop, test-cloud-gateway]
3645
runs-on: macos-14
3746
strategy:
3847
matrix:
@@ -118,3 +127,38 @@ jobs:
118127
push: true
119128
tags: ${{ steps.meta.outputs.tags }}
120129
labels: ${{ steps.meta.outputs.labels }}
130+
131+
docker-cloud-gateway:
132+
needs: [test-cloud-gateway]
133+
runs-on: ubuntu-latest
134+
if: startsWith(github.ref, 'refs/tags/v')
135+
permissions:
136+
contents: read
137+
packages: write
138+
steps:
139+
- uses: actions/checkout@v4
140+
141+
- name: Log in to GitHub Container Registry
142+
uses: docker/login-action@v3
143+
with:
144+
registry: ghcr.io
145+
username: ${{ github.actor }}
146+
password: ${{ secrets.GITHUB_TOKEN }}
147+
148+
- name: Docker meta
149+
id: meta
150+
uses: docker/metadata-action@v5
151+
with:
152+
images: ghcr.io/${{ github.repository }}/cloud-gateway
153+
tags: |
154+
type=semver,pattern={{version}}
155+
type=semver,pattern={{major}}.{{minor}}
156+
type=sha
157+
158+
- name: Build and push
159+
uses: docker/build-push-action@v6
160+
with:
161+
context: apps/cloud-gateway
162+
push: true
163+
tags: ${{ steps.meta.outputs.tags }}
164+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ jobs:
4949
- name: Run tests
5050
run: cd apps/desktop && npx vitest run
5151

52+
test-cloud-gateway:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup Bun
58+
uses: oven-sh/setup-bun@v2
59+
60+
- name: Install dependencies
61+
run: cd apps/cloud-gateway && bun install
62+
63+
- name: Run tests
64+
run: cd apps/cloud-gateway && bun test
65+
66+
- name: TypeScript check
67+
run: cd apps/cloud-gateway && bunx tsc --noEmit
68+
5269
docker-gateway:
5370
needs: test-gateway
5471
runs-on: ubuntu-latest
@@ -67,3 +84,24 @@ jobs:
6784
sleep 2
6885
curl -sf http://localhost:3001/health | grep -q '"status":"ok"'
6986
docker stop gw
87+
88+
docker-cloud-gateway:
89+
needs: test-cloud-gateway
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Build Docker image
95+
run: docker build -t routebox-cloud-gateway apps/cloud-gateway
96+
97+
- name: Smoke test container
98+
run: |
99+
docker run -d --name cgw -p 3002:3001 \
100+
-e DATABASE_URL=postgres://x:x@localhost/x \
101+
-e JWT_SECRET=test-secret-for-ci \
102+
-e STRIPE_SECRET_KEY=sk_test_fake \
103+
-e STRIPE_WEBHOOK_SECRET=whsec_fake \
104+
routebox-cloud-gateway
105+
sleep 3
106+
curl -sf http://localhost:3002/health || true
107+
docker stop cgw

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Changelog
22

3+
## 3.0.0 (2026-03-06)
4+
5+
### Cloud Gateway
6+
- **Model Registry**: Dynamic model CRUD with DB-backed registry, admin API + UI
7+
- **Scoring Engine**: Intelligent model routing with quality/speed/cost/code scoring, request context analysis (code detection, CJK support), configurable weights per strategy
8+
- **Provider Access Control**: Per-provider enable/disable with plan-based gating (free/pro)
9+
- **Admin Dashboard Enhancements**:
10+
- User management: edit plan (free/pro), adjust balance with audit trail
11+
- Pagination for users and transactions tables
12+
- Email search for user lookup
13+
- Loading states and error recovery
14+
- Client-side form validation for model registry
15+
- XSS fix in registry edit (ID-based lookup replaces inline JSON)
16+
- **Bug Fixes**:
17+
- Fixed stateful regex causing inconsistent code block detection across requests
18+
- Fixed prefix-match models incorrectly flagged as fallback in scoring engine
19+
- Fixed score clamping causing unstable sort order among top models
20+
- Atomic updateModel — single SQL UPDATE instead of N separate queries
21+
- Improved CJK detection and weighted token estimation
22+
23+
### Desktop App
24+
- Brave Search integration
25+
- Dedicated Chat window with full conversation support
26+
- Thinking model support (extended thinking / reasoning)
27+
- Spotlight V2 with streaming chat
28+
- Local model support (Ollama + LM Studio)
29+
- Global keyboard shortcuts for Spotlight and Chat
30+
- Usage tracking and analytics pages
31+
332
## 1.0.0 (2026-02-28)
433

534
### Features

apps/cloud-gateway/.dockerignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
node_modules
2+
.env
3+
.env.*
4+
!.env.example
5+
*.test.ts
6+
src/test-setup.ts
7+
.git
8+
.gitignore
9+
.dockerignore
10+
docker-compose.yml
11+
nginx.conf
12+
nginx-init.conf
13+
monitoring/
14+
scripts/
15+
openapi.yaml
16+
README.md
17+
*.md
18+
._*

apps/cloud-gateway/.env.example

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Database
2+
DATABASE_URL=postgres://routebox:your_password@localhost:5432/routebox
3+
DB_PASSWORD=your_password
4+
5+
# JWT
6+
JWT_SECRET=your-256-bit-secret-change-me-in-production
7+
8+
# Polar (payment provider — https://polar.sh)
9+
POLAR_ACCESS_TOKEN=polar_oat_...
10+
POLAR_WEBHOOK_SECRET=polar_whs_...
11+
POLAR_PRODUCT_CREDIT_5=uuid-of-5-dollar-product
12+
POLAR_PRODUCT_CREDIT_20=uuid-of-20-dollar-product
13+
POLAR_PRODUCT_PRO=uuid-of-pro-subscription-product
14+
15+
# App URL (for checkout redirect)
16+
APP_URL=https://routebox.dev
17+
18+
# Pooled Provider API Keys
19+
OPENAI_API_KEY=sk-proj-...
20+
ANTHROPIC_API_KEY=sk-ant-...
21+
GOOGLE_API_KEY=AIza...
22+
DEEPSEEK_API_KEY=sk-...
23+
MINIMAX_API_KEY=
24+
KIMI_API_KEY=
25+
OPENROUTER_API_KEY=sk-or-v1-...
26+
27+
# Sentry (optional — error tracking)
28+
SENTRY_DSN=https://xxx@xxx.ingest.sentry.io/xxx
29+
30+
# Redis (optional — distributed rate limiting, falls back to in-memory)
31+
REDIS_URL=redis://redis:6379
32+
33+
# Admin Dashboard (comma-separated emails allowed to access /admin)
34+
ADMIN_EMAILS=your-email@example.com
35+
36+
# Grafana
37+
GF_SECURITY_ADMIN_PASSWORD=admin

apps/cloud-gateway/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM oven/bun:1-alpine
2+
3+
# Install curl for Docker health checks
4+
RUN apk add --no-cache curl
5+
6+
# Create non-root user
7+
RUN addgroup -g 1001 -S routebox && \
8+
adduser -S routebox -u 1001 -G routebox
9+
10+
WORKDIR /app
11+
12+
# Install deps
13+
COPY package.json bun.lock* ./
14+
RUN bun install --frozen-lockfile --production
15+
16+
# Copy source
17+
COPY . .
18+
19+
# Fix permissions and switch to non-root user
20+
RUN chown -R routebox:routebox /app
21+
USER routebox
22+
23+
EXPOSE 3001
24+
25+
CMD ["bun", "run", "src/index.ts"]

0 commit comments

Comments
 (0)