Add HTTP gateway with streaming chat and multi-client conversation mapping (#1)
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m15s

Reviewed-on: MoA/agent#1
Co-authored-by: highperfocused <highperfocused@pm.me>
Co-committed-by: highperfocused <highperfocused@pm.me>
This commit was merged in pull request #1.
This commit is contained in:
2026-03-12 14:47:45 +01:00
committed by highperfocused
parent 440c8480af
commit 089bd7bd48
19 changed files with 2484 additions and 320 deletions

View File

@@ -1,4 +1,19 @@
# ── Ollama (local / self-hosted) ────────────────────────────────────────────────
# ── Run mode ────────────────────────────────────────────────────────────────
# gateway (default) starts HTTP API + streaming endpoint + simple web UI
# single runs one-shot mode (PROMPT/stdin) and exits
RUN_MODE=gateway
# ── Gateway server ───────────────────────────────────────────────────────────
GATEWAY_HOST=0.0.0.0
GATEWAY_PORT=8787
# Set to * or a specific origin for browser apps hosted elsewhere
# GATEWAY_CORS_ORIGIN=*
# Optional bearer token required on every API request
# GATEWAY_AUTH_TOKEN=replace-me
# Disable built-in web UI at /
GATEWAY_ENABLE_WEB_UI=true
# ── Ollama (local / self-hosted) ────────────────────────────────────────────
# To use a local Ollama instance, override PROVIDER and MODEL:
# PROVIDER=ollama
# MODEL=llama3.2 # or qwen2.5-coder, mistral, deepseek-r1:14b …
@@ -12,7 +27,7 @@
# Locally (no Docker): change to http://localhost:11434/v1
#
# OLLAMA_BASE_URL=http://host.docker.internal:11434/v1
# OLLAMA_CONTEXT_WINDOW=32768 # tokens passed as num_ctx
# OLLAMA_CONTEXT_WINDOW=32768
# OLLAMA_MAX_TOKENS=8192
# ── Model ────────────────────────────────────────────────────────────────────
@@ -22,7 +37,7 @@
PROVIDER=anthropic
MODEL=claude-sonnet-4-20250514
# ── Authentication ───────────────────────────────────────────────────────────
# ── Authentication ───────────────────────────────────────────────────────────
# Generic API key for the selected PROVIDER (injected at runtime, not stored).
API_KEY=sk-ant-...
@@ -36,36 +51,37 @@ API_KEY=sk-ant-...
# XAI_API_KEY=...
# OPENROUTER_API_KEY=...
# ── Prompt ────────────────────────────────────────────────────────────────────
# The user message to send. Alternatively pipe via stdin.
PROMPT=List all .ts files in the current directory.
# ── Prompt (single mode only) ───────────────────────────────────────────────
# Used only when RUN_MODE=single.
# PROMPT=List all .ts files in the current directory.
# ── System prompt ────────────────────────────────────────────────────────────
# ── System prompt ────────────────────────────────────────────────────────────
# Completely replaces the default system prompt (optional).
# SYSTEM_PROMPT=You are a helpful assistant. Work inside /app only.
# Appended to the (possibly overridden) system prompt (optional).
# APPEND_SYSTEM_PROMPT=Always answer in English.
# ── Thinking ─────────────────────────────────────────────────────────────────
# off | minimal | low | medium | high | xhigh (default: off)
# ── Thinking ─────────────────────────────────────────────────────────────────
# off | minimal | low | medium | high | xhigh
THINKING_LEVEL=off
# ── Tools ────────────────────────────────────────────────────────────────────
# all → read, bash, edit, write (default)
# readonly → read only
# ── Tools ────────────────────────────────────────────────────────────────────
# all → read, bash, edit, write (default)
# readonly → read, grep, find, ls
# none → no built-in tools
# Or a comma-separated list: read,bash
# Or a comma-separated subset of coding tools: read,bash,edit,write
TOOLS=all
# ── Working directory ────────────────────────────────────────────────────────
# ── Working directory ────────────────────────────────────────────────────────
# Directory the agent reads/writes. Maps to the Docker volume mount point.
CWD=/app
# ── Session persistence ──────────────────────────────────────────────────────
# true → persist session files under CWD; false/unset → in-memory (default)
SESSION_PERSIST=false
# ── Session persistence ──────────────────────────────────────────────────────
# true → persist agent sessions and gateway conversation index under CWD/.gateway
# false → in-memory sessions only
SESSION_PERSIST=true
# ── Verbose tool logging ─────────────────────────────────────────────────────
# ── Verbose tool logging ─────────────────────────────────────────────────────
# true → log tool start/end events to stderr
VERBOSE_TOOLS=false