91606d9c9ea342b36319eba103f5e90f05744f2e
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
238eb635c5 |
Configure the Coach from the environment
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
An instance can now be pointed at a model entirely from its environment — so a
container is redeployed with the Coach already working, and nobody has to open
an admin screen:
COACH_PROVIDER=compatible
COACH_BASE_URL=https://ai.example.com # WITHOUT /v1 — the adapter adds it
COACH_MODEL=vendor/model-name
COACH_API_KEY=sk-... # or the provider's own variable
Naming a provider is the whole configuration, so it also turns the Coach on: an
instance started this way that then reported itself "off" would be a puzzle with
no clue in it.
Three decisions worth stating:
- The environment is the *base*, the way DEFAULTS is, and the saved file is
layered on top: an admin who picked a provider in the app meant it, and this
only fills what is absent.
- The key is deliberately NOT a field of the config. That object is cached,
written to data/coach.json by any admin action, and included in the backup the
docs tell people to make. envCredentialFor reads it from the process
environment instead, so it is written nowhere and never surfaced by any route
that reports configuration. A pasted credential still outranks it, and a filed
one that fails to decrypt stays a failure rather than quietly falling back to
a key nobody knows is being spent.
- What the environment supplies is stripped before the file is written. A saved
config used to be written back whole, which would have frozen this start-up's
values on disk — and since the file outranks the environment, a later change
to COACH_MODEL would have been silently ignored.
Verified through the server's own path (config → credentialFor → jobEnv →
adapter) against the OpenAI-compatible router this fork runs on: a chest+triceps
request came back as a six-exercise routine with the cardio row first and
correctly marked `mode: cardio`.
|
||
|
|
87bfd6d4c4 |
Rebrand to KuentaGYM, and start a new profile in pounds and Spanish
The app is now KuentaGYM everywhere a user can see it, and a fresh profile no longer starts on upstream's English/kg defaults. Both are this fork's decisions, so both are pinned by tests rather than left to a find-and-replace. Rename (1,270 references, 149 files) - Visible surfaces: the Login/Home/mobile-onboarding wordmark, the Settings version line, the printed plan, the PWA title + manifest, and the 17 branded strings across all 14 locale packs. - Infrastructure: repo links, the container images and the release endpoints now name git.dploy.lol/dsantillan/kuentagym; .gitea/workflows/docker-publish.yml publishes to this forge's registry instead of gitea.com. - The Android/iOS application id stays ch.duartesantos.opengym on purpose: changing it would make the mobile app a different app that could never update an installed copy. Three things the mechanical pass would have broken, fixed here - The update check asked gitlab.com for upstream's releases and would have installed upstream's APK, putting the old name back on the phone. It now reads this fork's Gitea releases API (the assets shape differs), with the tests rewritten to the payload Gitea actually returns. - Renaming the mobile state/pairing files (opengym-state.json, opengym-remote.json) would lose the on-device copy of a history whose WebView storage may have been evicted, and silently unpair the device. Both are read under their old names and written forward under the new ones. - Renaming the exported plan-file marker (openGym_plan) rejected every plan shared before the rename as "not a plan file". Both markers are accepted. Defaults: pounds and Spanish - DEF.unit = 'lb', DEF.lang = 'es', plus every fallback that independently assumed en/kg (the <html lang> attribute, the Settings pickers, the Store, the MCP, the Coach payload). - Server-generated push copy existed only in English and pt-BR, so a Spanish profile would have been notified in English; Spanish added. - The demo seed states unit: 'kg' — its seeded numbers are kilograms, and inheriting the new default would have introduced an 82.4 lb lifter benching 60. - The module-level language in i18n-core stays English: it is the only language whose strings need no pack, so `t()`, dates, numbers and lists agree before a pack loads. Starting there on 'es' formats a Spanish-shaped UI with English strings. Also - api/package.json's test glob missed push-messages.test.js and verify-error.test.js, which sat beside the modules they cover and never ran. - README, docs/, website/ and the issue templates no longer describe upstream's GitLab/GitHub pipeline, Discord, sponsorship or public demo as if they were this fork's; upstream history and attribution are preserved (NOTICE.md). |
||
|
|
6d9d7a6cba | coach (built-in): #160 findings 4/5/6/11 — forget keeps today's count, the instance cap is reserved at enqueue from its own counter instead of the 100-entry log, forget drops queued work, aborts the HTTP call and discards a late result, scheduled reviews advance on the server's own record and wait for an unread proposal | ||
|
|
02c75b320d |
Coach: ein API-Key gilt fuer die ganze Instanz, Warm-ups zaehlen nicht, Retries bei 429/5xx, sichtbare Admin-Felder
- Instanz-Modus: nur eine persoenliche Anmeldung (Setup-Token/OAuth) bindet sich an das erste Profil, ein API-Key ist gemessen und wird von allen Profilen unter den Tageslimits geteilt. Die Bindung passiert jetzt wirklich beim Einreihen eines Jobs (jobs.enqueue), vorher gab es sie nur in den Tests. - HTTP-Adapter: 429/500/502/503/504/529 werden zweimal mit kurzer Pause wiederholt, ein 4xx nie. retryDelayMs fuer Tests. - Payload: Warm-up-Saetze wie in progression.js aus readSession/stalls, done/planned, Top-Satz, setsByBodyPart und workingWeights herausgefiltert; in vollen Sessions als warmup:true markiert, common.md sagt dem Modell, was das ist. - Admin-Karte: .field im Card hat jetzt eine sichtbare Flaeche, die Limit-Zahlenfelder sind echte Felder statt weisser Browser-Boxen; Text zu 'Whose account pays' unterscheidet API-Key und persoenliche Anmeldung. - Neuer Test e2e-apikey: Key ueber die Admin-Routen einlegen, Modelle listen, Review durch die echte Queue gegen einen lokalen Anthropic/OpenAI/Gemini-Stand-in, inkl. Header, Cache-Block, Schema, Retry und Auth-Fehler. api 150, frontend 1029, mcp 45 gruen. |
||
|
|
9edcdaa9f3 |
Coach: Vorschlaege bleiben, Diagramme in den Karten, Workout-Debrief, Vergleich auf der Instanz, Routine verbessern
Was der Coach vorgeschlagen hat, verschwindet nach Ja/Nein nicht mehr: die Chat-Zeile traegt eine Referenz ins Log, das jetzt jede Aenderung samt before/after (auch abgelehnte), Notizen, Evidenz und bei Plaenen die Routinen behaelt; eine Recap-Karte im Thread und ein Verlauf- Sheet oeffnen alles wieder. Unter jeder Review liegen die Zahlen aus dem zitierten Fenster — Sessions, Dauer, Volumen, Koerpergewicht als Kurve mit Ziel, geschaetztes 1RM erste→letzte Session, Saetze pro Koerperregion — auf dem Geraet gerechnet (lib/coach-insights.js). Neu: Job-Art `debrief` (eine Session, kein Planeingriff: Score 1–10, lief gut / beobachten / naechstes Mal; validateDebrief im Core, eigener Prompt), Vergleich mit anderen auf der Instanz (Admin-Schalter `community`, pro Person Opt-in serverseitig, Mediane ab drei Teilnehmern, Epley-1RM, lb→kg; auch als `cohort` im Prompt), und "Routine verbessern" als fokussierte Review. Schnell-Chips ueber dem Composer, deutsche Strings, Doku, Changelog. Tests: api 136, frontend 799, mcp 36. |
||
|
|
7047346da1 |
Coach: Anthropic, OpenAI, Gemini und jeder OpenAI-kompatible Endpunkt per API-Key
Vier Provider, die nur HTTPS sprechen — kein Agent-SDK, keine CLI, kein coach-User:
sie laufen auf dem Default-Image. Eine Factory (core/adapters/http.js) bildet jede
Antwort auf den bestehenden {code,text,stderr}-Vertrag ab, damit die Pipeline nichts
Neues lernen muss: 401/403 werden 'auth', ein abgeschnittenes JSON 'provider' statt
die einzige Reparaturrunde zu verbrennen. Ollama/LM Studio/vLLM/OpenRouter laufen
ueber dieselbe Chat-Completions-Form mit eigener Basis-URL und optionalem Key.
coach.json haelt Key, Modell und Bindung jetzt PRO Provider — Wechseln wirft nichts
mehr weg; die flache v1.2.11-Datei wird einmalig hochgehoben. Das Privilege-Gate
fragt den Adapter, ob er ueberhaupt einen Prozess startet. Die Admin-Karte zeigt
endlich den API-Key-Knopf auch bei Anthropic, listet Modelle vom Endpunkt und
nimmt eine Basis-URL entgegen.
|
||
|
|
ef61df50f2 |
Coach: the Codex provider, and a credential that stays out of your backups
The Codex CLI adapter, its runtime and sandbox in the coach image only, and the one placement decision this PR exists to get right. Codex keeps a refreshable sign-in cache of its own rather than taking a token on the environment, so it needs somewhere durable to write. That is ./coach-auth — a sibling of ./data, never a folder inside it, mounted separately, owned by `coach`, mode 0700. The placement is the point. docs/SELF_HOSTING §5 tells owners to back up with `tar czf … data/`, so anything under ./data lands in every archive people are instructed to produce. Workout history belongs there; a live refresh token does not — it keeps working after that archive is copied to a laptop or a cloud drive. Keeping the cache outside ./data is what lets the backup instructions stay true about what they capture, and §5 now says so explicitly rather than leaving the reader to find out. I got to define this rather than fix it: no Codex path was ever committed here, so the nested layout the fork had never reached this repo. A test asserts the sibling relationship directly, because "outside ./data" is the kind of invariant a later refactor breaks by tidying. bubblewrap and the Codex CLI are added in the coach target only — bubblewrap is a Codex requirement, so an owner who never opted in carries neither. The image job now asserts both directions: present and runnable in the coach image (codex-cli 0.147.0, bubblewrap 0.11.2, /coach-auth as coach:0700), and absent from the default one. Codex is usable through the existing connect route with an API key, which needs no new surface. Its ChatGPT device-code sign-in is not in this PR — see the PR description for what that still needs. api 73/73, frontend 404/404, both image targets built and inspected, 11 locales in sync at 767, library in sync at 1324. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
49be4e0626 |
Coach: the Claude provider, and an AI runtime you only carry if you ask
The Agent SDK adapter, its dependency, and the packaging that keeps both out of the image an owner gets when they never wanted the Coach. api/Dockerfile builds two targets. The default one runs `npm ci --omit=optional` and ships no AI runtime at all (~158 MB); `--target coach` drops that flag and adds @anthropic-ai/claude-agent-sdk (~455 MB). The SDK's runtime ships as a per-platform package, so on this Alpine base the lockfile resolves the musl build — the kind of thing that only fails on somebody else's machine, which is why the new api-image CI job builds *and runs* both targets rather than merely building them. Both targets now create the unprivileged `coach` user. That is not a Claude detail: canDropPrivileges() fails closed, so without it every job is refused — including the fixture provider that exists so the loop can be walked before an account is connected. The shipped image could not run one. The adapter imports the SDK lazily, so an absent runtime stays an ordinary reportable state rather than a boot crash: check() says so, isConnected() goes false, and /api/config carries no coach key. Four SDK options are what make this safe next to ./data — tools: [] (no Read, no Bash, no Grep), settingSources: [], skills: [], strictMcpConfig. They are one frozen exported object, asserted by value, so re-enabling one is a red build rather than a quiet capability grant. Verified against the SDK's own type definitions rather than from memory. Two things the fork's draft had wrong: SDKResultError carries no `errors` field, so `message.errors?.join()` was dead code and the failure reason now comes from `subtype` and `stop_reason`; and the client-app version string was hardcoded at 1.2.3 two releases after it stopped being true, so it is read from package.json. The credential connect/disconnect routes land here as promised in 2/6 — they serve a credential, and until this PR there was no provider that had one. authMode and the per-profile pair still wait for the side that consumes them. api 72/72 on macOS and on Linux as uid 65534 with the SDK absent; both image targets built and run; library in sync at 1324. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
7be3978476 |
Coach: server plumbing, consent, payload boundary, credential model
First of six. Everything here is transport and boundary: a job can run, its answer can be parsed, and nothing yet judges whether that answer is safe to act on. The validator and the apply path are the next PR, and the seam is explicit — jobs.js carries an answer no further than `unvalidated`, and a test pins that so the next PR has something to replace. Whose account pays, settled first because it decides what the rest may be: instance one account in coach.json, for the single-profile instance profile one account per profile, in its own coach-auth-<uid>.json In instance mode the credential binds to the first profile that spends it and every other profile is refused — no job, not a dismissible warning. A warning moves the decision onto whoever clicks past it and the decision is about somebody's personal subscription. A profile credential is deliberately not a field on state-<uid>.json: that blob syncs and travels in the user's export, and a credential in a backup is the mistake we are avoiding, not repeating. openGym does not interpret any provider's terms; it offers the shape that does not need the interpretation and refuses the shape that does. The privilege drop now fails closed. It only ever engaged when the server ran as root, so adding a USER line to the Dockerfile for unrelated hardening would have silently left the provider runtime on the server's uid. On Linux, no drop means no job, and the admin card says so. ./data is no longer sealed with a blanket 0700. It is a host bind mount and this container is root, so sealing it landed on the host as root-owned and took the owner's own directory hostage — backup scripts, jq, the MCP server in issue #19. The files that hold secrets carry 0600 themselves instead, which is what the directory mode was standing in for; db.json gained an explicit mode rather than inheriting umask once the blanket came off. Bodyweight and per-side, folded in rather than deferred: v1.2.4 made `weight` mean *added* load on a bodyweight exercise, so it is 0 on a good session and every load-shaped signal reads flat. Uncorrected, the Coach would have looked at a working push-up progression and proposed adding weight to a push-up. The payload carries bodyweight/side/repsMax, the session reader carries set count, and the prompts say reps then sets are the progression and per-side targets step in twos. coach-parity.test.js pins the server's three copied reading rules against the frontend's originals over a table of configs — modeOf was never actually pinned, and it is the one that was predicted to drift. No AI dependency lands here: api/ still installs @simplewebauthn/server and web-push and nothing else. Jobs run against the in-repo fixture provider, so CI needs no account, no network and no image build. 33 api tests, 361 frontend tests (169 of them parity), locales in sync. |