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.
This commit is contained in:
Duarte Santos committed 2026-08-29 17:15:22 +02:00
1 parent 697f1b1269
commit 7047346da1
18 files changed
+957 -68

No files matched your search

+4 -4
View File
@@ -16,8 +16,8 @@ const cfg = await import('../coach/config.js');
function connectInstance(token = 'tok-instance') {
cfg.reset();
cfg.save({
enabled: true, provider: 'claude', authMode: 'instance', boundUid: null,
auth: { type: 'cli-token', account: 'owner@example.test', data: cfg.encrypt({ token }) }
enabled: true, provider: 'claude', authMode: 'instance', boundUid: {},
auth: { claude: { type: 'cli-token', account: 'owner@example.test', data: cfg.encrypt({ token }) } }
});
}
@@ -26,10 +26,10 @@ test('instance mode: the first profile to spend the credential binds it', () =>
const first = cfg.credentialFor('alice');
assert.equal(first.ok, true);
assert.equal(first.auth.token, 'tok-instance');
assert.equal(cfg.load().boundUid, null, 'resolving alone must not bind — only spending does');
assert.equal(cfg.boundUidFor(), null, 'resolving alone must not bind — only spending does');
cfg.bindInstanceCredential('alice');
assert.equal(cfg.load().boundUid, 'alice');
assert.equal(cfg.boundUidFor(), 'alice');
});
test('instance mode: a second profile is refused, not warned', () => {