feat(settings): add Nous Portal provider (#175)
CI / ci (push) Canceled after 0s

Settings gains hermes' `nous` slug as a fourth provider on every
surface and the Provider Keys page — endpoint
https://inference-api.nousresearch.com/v1, NOUS_API_KEY, the
5-level OpenAI-compatible effort ladder, switch flagship
anthropic/claude-sonnet-5 (live-probed: the portal's docs-listed
Hermes-4 ids 404 — the inference API serves the OpenRouter catalog,
so the switch keeps the app's sonnet posture billed through Nous).
The probe speaks plain OpenAI chat-completions; an unkeyed test
borrows the shared Portal session's agent_key (the engine's own
credential — hermes' nous runtime is OAuth-only, and a portal key
and subscription bill the same account credits), gated to the
official https endpoint so the implicit credential never rides a
user-edited URL. Pass readiness rides the same fallback, so a
logged-in machine runs passes with no key. Suite 635.

Closes #175
This commit is contained in:
AlexKucera committed 2026-11-05 15:59:41 +01:00
1 parent d305f822aa
commit b2db859887
15 files changed
+410 -30

No files matched your search

+27
View File
@@ -250,6 +250,33 @@ private func pollReaped(_ pid: pid_t) async throws -> Bool {
// link; once the key is provided via Settings, Run Pass re-enables (pane
// re-entry refreshes).
// Scenario: Keyless Nous pass readiness — From user story #175
// Given a pass surface switched to Nous Portal and hermes logged into
// the Portal (the shared auth.json session — the engine's credential;
// the .env key is optional and bills the same account credits)
// When refreshPassReadiness runs
// Then the pass reads .ready with NO key (the session agent_key stands
// in), and with no login either it names the missing key honestly.
@Test @MainActor func `nous pass readiness rides the portal login without a key`() async throws {
let mentor = MentorSessionModel()
let writer = RecordingWriter()
writer.cannedReads[.pass1] = (SurfaceModelConfig(provider: .nous, model: "anthropic/claude-sonnet-5", effort: nil), nil)
mentor.passReadinessWriter = writer
let dir = FileManager.default.temporaryDirectory.appendingPathComponent("nous-readiness-\(UUID().uuidString)")
try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
let authPath = dir.appendingPathComponent("auth.json").path
try #"{"providers":{"nous":{"agent_key":"ak-shared-123"}}}"#.write(toFile: authPath, atomically: true, encoding: .utf8)
mentor.portalAuthPath = authPath
await mentor.refreshPassReadiness()
#expect(mentor.readiness(for: .pass1) == .ready)
// No key and no login — the honest missing-key verdict.
mentor.portalAuthPath = dir.appendingPathComponent("missing.json").path
await mentor.refreshPassReadiness()
#expect(mentor.readiness(for: .pass1) == .missingKey(providerLabel: "Nous Portal"))
}
/// B1 readiness pins: refreshPassReadiness over the injected RecordingWriter
/// — keyed provider reads .ready, an unkeyed one reads .missingKey with its
/// label, a key landing re-enables on the next refresh (the pane's .task),