2.3 KiB
2.3 KiB
TASK: harness serve — OpenAI-compatible front door (OWUI is the client)
Context
DESIGN.md "OWUI front door" section (hermes killed): OpenWebUI = interactive
front door with Cloudron SSO + admin RBAC we don't build. MOPAC serves
OpenAI-compatible /v1/chat/completions; each stack/vertical registers as
a "model" in OWUI. OWUI chat and webhooks (harness events, already live)
are two doors into the same conductor loop.
Scope
harness servesubcommand (Go stdlib net/http, same style as events):POST /v1/chat/completions— OpenAI request/response shapes (model, messages, temperature, max_tokens; reply = single assistant message + usage). NON-streaming v0; return an explicit error ifstream:trueis requested (OWUI tolerates non-streaming providers).GET /v1/models— lists servable "models" from config (the class -> tier map is the catalog: each class is exposed as modelmopac-<class>).- Bearer auth (vkey), constant-time; unauthenticated = 401 generic.
- v0 STATELESS: OWUI sends full conversation history each call — run one bounded conductor turn over the assembled history, return the final text. No session storage.
- Model routing: request.model (e.g.
mopac-primary) maps through the existing[models]tier map; unknown model = 400 naming valid ones.
- Config:
[serve]section (port, default 8090;enabled_modelsoptional subset). Coexists withharness eventson its own port. - Reuse the conductor turn machinery
onceuses — no copy-paste; if the turn package needs a small refactor to accept history, do it cleanly. - Tool use inside serve turns: v0 = tools OFF (pure chat path), noted in README as Next.
Build discipline
- ALL DEV IN DOCKER (digest-pinned builder, dev.sh gets a
serverunner). - Tests: fake OpenAI client against the real server — auth, model map, history assembly, usage accounting, unknown-model 400.
- Docs standard: README section + config table rows + status table update.
- NEVER broad pkill; kill exact PIDs.
- Commits in logical chunks, push to origin main.
Deliverable
REPORT-20260829-0000-serve.md in ~/.coordinate/inbox-pmo/: endpoints,
the model catalog as configured, test results, exact OWUI connection
settings (base URL + vkey) for Charles to plug in, and what's Next
(streaming, tools).