Files
devplacepy/.env.example
T
retoorandClaude Sonnet 5 569f1dcc64 Add OpenCode Zen support, model health/stats dashboard, and gateway fallback fixes
AI gateway:
- Add a generic, admin-selectable `client_profile` field on gateway_providers
  (e.g. "opencode") so a provider needing special request headers (OpenCode
  Zen's client-identity spoofing) is configured like any other provider, not
  hardcoded by name.
- Track per-(provider, model) reliability/speed/latency health in memory,
  seeded from the existing gateway_usage_ledger at startup - purely
  observational, never influences routing.
- New Stats tab on /admin/gateway: request volume, latency, per-model
  breakdowns, and reliability weight, charted with a vendored Chart.js and
  devplace's own theme tokens.
- Record which model a failed request actually fell back to
  (fallback_used_route), surfaced in the Recent Failures table.
- Stop excluding context_length errors from fallback, and skip a primary
  attempt outright when its known context window is already too small for
  the estimated request size, going straight to the fallback.
- gateway_usage_ledger's provider/fallback_used_route columns and indexes
  are ensured centrally in database/schema.py's init_db(), the single point
  of truth for this table's schema.
- Non-OpenAI upstream routing and client-model passthrough; trust only the
  upstream's own X-Gateway-Model header for served-model attribution.

Devii agent:
- Fix a real lockup: plan/verify tools could be individually disabled via
  the admin tool toggles while still being required by the protocol gate,
  permanently bricking any task that needed tools. They can no longer be
  disabled, and the gate now also checks the tool is actually offered.
- Fix compaction being silently calibrated for a 1M-token model while
  running a much smaller one: context budget is now percentage-based and
  the summarizer's own request is sized to fit the real model.
- Give a specific, actionable retry message when plan()'s own arguments get
  cut off by the output limit, and tighten its schema to discourage
  overlong plans.

Other:
- Backup service: offload completed backups to a remote Hetzner Storage Box.
- Container manager: fix orphan blob leaks from sync races, add a two-phase
  plan/execute `system prune` CLI command.
- Admin gateway UI: replace the JS-rendered model/provider tables with
  server-rendered forms and pages.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DhmEkvutuwtzFVcLbTrhdo
2026-09-09 07:38:24 +02:00

62 lines
2.8 KiB
Bash

# Copy to .env and adjust. Loaded by docker-compose (env_file) and by the app
# at startup (python-dotenv). .env is git-ignored; this example is committed.
# Session signing key. CHANGE THIS for any real deployment.
SECRET_KEY=change-me
# Database. Leave unset to use the shared data/devplace.db (the Docker app
# container bind-mounts ./ to /app, so it reads and writes the same file as
# `make dev`). Set only to point at a different SQLite file.
# DEVPLACE_DATABASE_URL=sqlite:////app/data/devplace.db
# Single root for ALL runtime data (DB, uploads, VAPID keys, locks, bot state,
# zip/fork staging, container workspaces). Lives OUTSIDE the package and is never
# served via /static. Defaults to <repo>/data. The docker daemon must be able to
# bind-mount this dir for container /app mounts; point it at a persistent volume
# in production. nginx also reads <DEVPLACE_DATA_DIR>/uploads to serve uploads.
# DEVPLACE_DATA_DIR=/var/lib/devplace
# Container Manager (admin-only, enabled via docker-compose.containers.yml).
# Host the /p/<slug> ingress proxy dials to reach a published container port.
# On the host: 127.0.0.1 (default). Containerized app reaching host ports:
# host.docker.internal.
# DEVPLACE_CONTAINER_PROXY_HOST=host.docker.internal
# GID of /var/run/docker.sock on the host (getent group docker | cut -d: -f3),
# so the UID-1000 app can use the socket.
# DOCKER_GID=999
# Public origin for absolute URLs (SEO, canonical links, push). Empty = derive
# from the request.
DEVPLACE_SITE_URL=
# Host port the nginx front door binds (Docker only - the app container's own
# internal port stays fixed).
PORT=10500
# Port the uvicorn process itself binds to for `make dev`/`make prod` (bare
# metal, no Docker/nginx in front). Also what the app calls itself on
# internally (DEVII_BASE_URL default, INTERNAL_GATEWAY_URL). Unrelated to
# PORT above - leave unset unless running bare metal on a non-default port.
# DEVPLACE_PORT=10500
# nginx upload ceiling. Must be >= the admin-configurable max_upload_size_mb.
NGINX_MAX_BODY_SIZE=50m
# Optional nginx micro-cache for proxied GETs.
NGINX_CACHE_ENABLED=false
NGINX_CACHE_MAX_SIZE=1g
# Run the app container as this host user so shared files keep dev ownership.
DEVPLACE_UID=1000
DEVPLACE_GID=1000
# OpenCode Zen client identity (devplacepy/services/openai_gateway/opencode_zen.py).
# Optional: both already default to these exact values, which match the real
# opencode CLI's own headers - only override if opencode ships a new version
# and Zen starts rejecting the old one. The provider's base URL, API key, and
# which model(s) route to it are NOT set here - those live in the
# gateway_providers/gateway_models tables, configured at /admin/gateway
# (provider client profile "OpenCode Zen").
# OPENCODE_CLIENT_NAME=cli
# OPENCODE_CLIENT_USER_AGENT=opencode/1.18.29 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.15