HUB
Sign inSign up

goldvalleysolutions/core-bot

By goldvalleysolutions

•Updated about 1 month ago

Gold Valley Bot Core: the base image every Gold Valley bot is built FROM.

Image
0

150

goldvalleysolutions/core-bot repository overview

⁠Gold Valley Bots: Bot Core

The common base image every Gold Valley bot is built FROM.

⁠What it is

Bot Core (goldvalleysolutions/core-bot) is one Docker image with everything generic a bot needs: first-boot /setup, chat with history, bot admin, approvals in chat, user logins and access policy, memory, an allowlisted tool set, scheduled jobs, MCP at /mcp (off by default), /health, and the Gold Valley Solutions theme. Each product bot lives in its own repo and adds only its job layer: a bot/ folder (bot.yaml, role.md, skills/, tools/, theme) copied onto Core with COPY bot/ /bot/.

⁠Quick start

Only Docker is needed (Docker Desktop, Colima or Linux; amd64 or arm64). Core runs on its own with no bot pack (stub model, $0), which is enough to try /setup and chat:

docker pull goldvalleysolutions/core-bot:0.3
docker run -d --name core-bot -p 8080:8080 -v core-bot-data:/data goldvalleysolutions/core-bot:0.3

Open http://localhost:8080⁠ and complete setup (/setup: bot-admin login, who can use the bot, LLM provider and model, self-test). Every page redirects there until setup is done. curl -f http://localhost:8080/health works before and after setup. If host port 8080 is taken, change the left side, e.g. -p 8081:8080.

To try Core with the sample bot pack from a clone of this repo:

docker run -d --name hello-bot -p 8080:8080 -v hello-bot-data:/data \
  -v "$PWD/tests/fixtures/sample-bot:/bot:ro" goldvalleysolutions/core-bot:0.3

Email is per bot. The mail-server setup step, the admin Email tab, the email.send tool and the smtp line in /health appear only when the bot's bot.yaml declares email (email.send in tools_allowed or an smtp entry in connectors).

Connectivity rule. MCP (/mcp) is the only general external interface. There is no general REST API, no /openapi.json, /docs or /redoc. The web UI's own session-authenticated pages and /health are the only other routes. A bot may add a per-integration inbound webhook under /r/<slug>/ only when that integration needs one, and it must verify the sender's signature. See docs/mcp.md⁠.

⁠Configuration

ItemValueNotes
Port8080 (container)Runs as non-root user 10001; map with -p <host>:8080
Volume/databot.db + bot.key; back up both; delete the volume to start over
Bot pack/botProduct bots COPY bot/ /bot/; empty in Core
ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, XAI_API_KEYoptionalPresence preselects the provider on /setup (in that order); keys can also be entered on /setup and are stored encrypted
GVS_TRUSTED_PROXIESoptionalComma-separated peer IPs trusted for X-Forwarded-Proto; default 127.0.0.1,::1
GVS_LLM_MAX_TOKENSoptionalmax_tokens for every LLM call; integer 1-8192, default 1024

More detail:

ItemWhereNotes
Bot manifestbot/bot.yaml in the bot repo; fixture tests/fixtures/sample-bot/bot.yamlValidated by make lint-bot BOT=<path> against schema/bot.schema.json
Imagesgoldvalleysolutions/core-bot (Docker Hub), goldvalleysolutions/<slug>-botBot images build FROM a pinned core X.Y (ARG CORE, core: in bot.yaml); see docs/extending.md⁠
Data/data/bot.db + /data/bot.keyOne SQLite DB for settings, encrypted secrets, role/skill edits, memory, chat history and logs. Master key is 0600. Image role and skill files are seeded into it on first boot. Delete the volume to start over
Port8080Runs as a non-root user
External interface/mcp onlyNo general REST API or OpenAPI docs; per-integration webhooks under /r/<slug>/ must verify signatures
MCP/mcpOff by default; bot-admin token; docs/mcp.md⁠
Chat history/ sidebarPer visitor (gvs_uid cookie), per signed-in user or per admin user; only the owner can open or delete a chat (admins may open others' chats read-only from Needs approval)
AccessAdmin → Usersaccess_policy: anyone (default) or signed_in; chat_rate_per_min (default 20); GVS_TRUSTED_PROXIES env
Scheduled jobsjobs in /bot/services/*.pycore.sdk.jobs.Job: daily HH:MM or cron, in the bot's timezone setting; schedule editable via setting jobs.<name>.schedule; run_now() on demand; no overlap, errors logged, clean shutdown. See docs/extending.md⁠
RetentionAdmin → Advanced → DataVisitor chats deleted after 90 days idle, admin chats kept, log kept 365 days (0 = forever). Cleanup runs daily in-process and is logged. Shows bot.db size and row counts
LLM provider default/setup model stepPreselects the first provider with a key (env ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, XAI_API_KEY, or a saved key), in that order; none → Anthropic. Only presence is checked; key values are never rendered. A blank model uses the provider's recommended default (Anthropic: claude-sonnet-5-5)
PDF textcore.pdfextract_pdf_text / extract_pdf_text_async: child process (minimal env, no secrets), 5 s timeout, RLIMIT_CPU and RLIMIT_AS (512 MB), at most min(CPUs, 4) at once (PdfExtractBusy past that), 32 MB inflate cap, 2 MiB text cap; refuses with a user-safe PdfExtractError naming the file. See docs/extending.md⁠
LLM reply lengthGVS_LLM_MAX_TOKENS envmax_tokens sent to every LLM adapter. Default 1024; integer 1–8192, anything else falls back to 1024 with a warning. A reply stopped by the limit logs a warning (no content)
Spend capbot adminDefault $25/month; override in admin; fallback to stub at the cap
VersionVERSIONDrives image tags X.Y.Z, X.Y, sha-<7>. Never latest

⁠Admin and security

Bot admin (client staff)GVS operator (signed token)
LLM provider, model, API key✅✅
Tool / connector credentials✅✅
Theme, spend cap, health, MCP (approvals are decided inline in chat)✅✅
Users tab: who can use the bot, user logins (add, reset, remove)✅✅
Role, skills, allowed tools❌ 404✅
Memory, activity logs, chats, users❌ 404✅

Bot admin is created on /setup. The admin panel always needs the admin sign-in.

Who can use this bot? (setup step, later Admin → Users): Anyone (no login; the default, and what existing bots migrate to) or Signed-in users only. Under Signed-in users only, chat and the bot's user pages (@user_level routes such as a ticket board or manual search) send logged-out browsers to /login; users get logins from Admin → Users. A signed-in user's chats are theirs on any device (user:<name>), like an admin's. Admin-only bot pages stay admin.

Approvals in chat. Nothing sits above the admin tabs. The Chat tab shows a badge with the number of pending approvals; the history sidebar marks conversations with a pending card (a count dot); cards stay in their own conversation. Requests from visitors, signed-in users or MCP appear in a Needs approval group at the top of the admin's sidebar. Opening one shows that conversation (or the MCP requests) read-only: the admin can Approve or Deny, never chat into someone else's thread. After a decision the model writes a short follow-up; after a Deny it says the admin declined it.

Security. Passwords: at least 12 characters for the admin (setup) and for users (add and reset), with an inline error otherwise; existing hashes keep working. PBKDF2-SHA256, 600,000 rounds (older hashes are upgraded transparently at the next sign-in). Login lockout: 5 failures for one account from one IP lock it for 15 minutes (admin and user logins; logged as login.failed / login.locked). Visitor/user chat rate limit: setting chat_rate_per_min (default 20 per gvs_uid or user, 3x that per IP; 0 = off; admins are not limited). Both limits are kept in memory per process: a restart clears every lockout and counter, and several workers or replicas each count on their own (run one process per bot, as the image does). Details: docs/security.md⁠. Every response sends CSP ('self', no inline script), X-Frame-Options: DENY / frame-ancestors 'none', Referrer-Policy: strict-origin-when-cross-origin and X-Content-Type-Options: nosniff. Over HTTPS cookies get Secure and responses get HSTS. HTTPS is the request scheme (uvicorn --proxy-headers) or X-Forwarded-Proto: https from a peer in GVS_TRUSTED_PROXIES (comma-separated IPs, default 127.0.0.1,::1). The session cookie gvs_sid lasts 24 h (Max-Age=86400). The GVS operator login is cli/gvs-root login (short-lived Ed25519 token, keys/gvs_root.pub). No password, no self-hoster root. A Powered by Gold Valley Solutions footer always shows.

⁠Repo contents

PathWhat is in it
core/The application: app, setup, admin, auth, chat loop, LLM adapters, tools, memory, jobs, MCP, PDF text, UI, SDK for bots
schema/bot.schema.json, the bot.yaml schema (make lint-bot)
cli/gvs-root, the GVS operator login (signed Ed25519 token)
keys/gvs_root.pub, the operator public key baked into the image
scripts/verify-local.sh, new_bot.py (+ new_bot_templates/), smoke.sh, mcp_e2e.py
tests/pytest unit tests, Playwright e2e (tests/e2e), fixtures incl. sample-bot
docs/extending.md (building a bot), mcp.md, security.md, UI style guide
Dockerfile, docker-bake.hcl, Makefile, VERSIONImage build, developer commands, version
.github/workflows/release.yml (main-only Docker Hub publish), dockerhub-description.yml (Docker Hub overview from this README), publish.yml (GHCR on test, when enabled)

⁠Build and test from source

git clone https://github.com/goldvalleysolutions/gvs-core-bot.git && cd gvs-core-bot
python3.12 -m venv .venv && . .venv/bin/activate
make install        # pinned, hash-checked dev dependencies
make check          # ruff + pytest + pip-audit + lint-bot
make build          # core-bot:<VERSION>, :<X.Y>, :local
make smoke          # build, /health = 200 within 60 s
scripts/verify-local.sh   # all local checks; paste its Local verification block into the PR

make help lists every target. New bot repo: make new-bot SLUG=<slug>, then docs/extending.md⁠. Rules: AGENTS.md⁠.

⁠Browser (e2e) tests

tests/e2e/ is a Playwright suite (Python playwright pinned in requirements-dev.txt). Each test starts a real uvicorn server on a temp /data with the stub model, and runs in two projects: [desktop] (1280x800) and [mobile] (iPhone 13 profile). Provider HTTP (OpenRouter, OpenAI, Anthropic, xAI) is faked in-process, so no keys and no cost.

make browsers       # once: python -m playwright install chromium
make e2e            # e2e only; fails (not skips) if Chromium is missing
make test           # unit + e2e (e2e runs last; skips clearly if no browser)
make e2e-live       # opt-in: ONE cheap OpenRouter chat; needs OPENROUTER_API_KEY

pytest -q (and so gvs-factory verify-local.sh) runs the suite; it must pass. On a failure, a screenshot and a trace are saved to tests/e2e/artifacts/ (gitignored); open a trace with python -m playwright show-trace <file>.zip. The live test is marked @pytest.mark.live, deselected by default and skipped unless GVS_E2E_LIVE=1. New tests: use the server / ready / page fixtures and tests/e2e/helpers.py.

Building a new bot: make new-bot SLUG=<slug>, then docs/extending.md⁠. MCP: docs/mcp.md⁠. Rules: AGENTS.md⁠. PRs go to test; only Mike merges main. Run make lint && make test && make audit locally. Checks run locally before merge: gvs-factory scripts/verify-local.sh on the PR head commit (CI minutes standard v2). Paste its Local verification block into the PR description; PR-triggered CI is removed.

⁠Versioning and releases

PRs go to test; only Mike merges test into main. A merge to main runs release.yml, which publishes goldvalleysolutions/core-bot as X.Y.Z and X.Y from VERSION (never latest, linux/amd64 + linux/arm64), creates GitHub release vX.Y.Z, Manual runs are dry runs. A README change merged to main updates this Docker Hub description (dockerhub-description.yml). Changes: CHANGELOG.md⁠.

⁠License

Apache License 2.0. See LICENSE⁠ and NOTICE⁠. © 2026 Gold Valley Solutions LLC.

Tag summary
Recent tags
Content type
Image
Digest
sha256:d59b05a10…
Size
59.3 MB
Last updated
about 1 month ago
docker pull goldvalleysolutions/core-bot:0.3