Railyard side of PY1.4 (ADR RY-0003). Acceptance: 1. Bridge `ai` gives a Scribase project environment one key (ry_ai_..., shown once, to the Scribase control plane only, stored here as SHA-256; `rotate` revokes the old one) and a one-time link to /connect/ai (15 minutes), the only place a provider key is typed. It is sealed with AES-256-GCM under RAILYARD_CREDENTIALS_KEY, bound to org and provider, and only a four-character hint is ever read back. 2. BYOK only: POST /api/v1/ai/chat/completions (OpenAI-compatible) refuses with 403 byok_required when the org has not connected the provider the model names, and never calls Relay then. When it does call, the customer's key fills that provider's slot and every other slot carries a refusal marker, so Relay (caller credential wins) can never use our keys, not even on failover; a test pins the slot list to Relay's PROVIDER_KEY_SLOTS. Credentials in a request body are refused. 3. Daily and monthly token caps per key (429 with the period); usage (atomic rpc) and one trace per call (model, provider, status, tokens, latency), read per project key by the bridge `ai_usage` route for the Scribase tab; Relay traces carry tensorzero::tags for the same filter. 4. Copy says "your provider bills you directly"; no credits are included anywhere (copy lint over the connect page and every gateway message). apps/relay/config/tenants/README.md records the tenant rules. Migration: apps/console/db/migrations/0003_ai_gateway.sql (idempotent; applied twice to a scratch local cluster by test/migration.test.ts). Env: RELAY_URL (var), RELAY_TENANT_KEY, RAILYARD_CREDENTIALS_KEY (secrets). Tests: console 63/63 (gateway 6, bridge 12, migration 3, repo 5), tsc clean, tests/contract 3/3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
945 B
JSON
33 lines
945 B
JSON
{
|
|
"name": "@railyard/console",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "Railyard console: sign-in, the money ladder, apps, usage and billing (RYP-D1).",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "next dev --port 3020",
|
|
"build": "next build",
|
|
"cf:build": "opennextjs-cloudflare build",
|
|
"cf:deploy": "opennextjs-cloudflare deploy",
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "node --test test/*.test.ts app/api/v1/deploys/*.test.ts app/api/v1/bridge/scribase/*.test.ts lib/ai/*.test.ts",
|
|
"test:bundle": "node --test test/bundle-secrets.test.ts"
|
|
},
|
|
"dependencies": {
|
|
"next": "14.2.35",
|
|
"react": "18.3.1",
|
|
"react-dom": "18.3.1"
|
|
},
|
|
"devDependencies": {
|
|
"@opennextjs/cloudflare": "1.15.1",
|
|
"@types/node": "22.9.0",
|
|
"@types/react": "18.3.12",
|
|
"@types/react-dom": "18.3.1",
|
|
"typescript": "5.6.3",
|
|
"wrangler": "4.139.0"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.18"
|
|
}
|
|
}
|