feat: configurable judgment backend (Command Code and custom endpoints) - #136
Merged
Merged
Conversation
pi-typesafe 0.8.0 resolves and validates the backend: the names "typesafe", "openrouter", and "commandcode", or an endpoint object with its own label, host, path, keyEnv, and defaultModel. The spec goes to createTypeSafe, authState, and ensureApiKey unchanged, so the status line describes the key the requests use. A non-TypeSafe backend names its label, host, and model in /warden status, the /warden enable dialog, and the /warden test confirmation, and the consent disclosure names the real destination host. The TypeSafe key and the login store never go to an endpoint object. An unknown typesafeBackend name, or an object the judge refuses, no longer silently falls back to typesafe: judgments turn off with the refusal message shown once and in /warden status, and nothing is sent to api.typesafe.ai because a value was mistyped.
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
typesafeBackendin the user config now takes:"commandcode": judgments go toapi.commandcode.aiunder/provider/v1/systemone, with the key fromCOMMANDCODE_API_KEYand the modeltypesafe/jev.An endpoint object for any server that speaks the same decisions protocol (
POST /v1/systemone):{ "label": "Corp judge gateway", "host": "https://gw.example.com", "path": "/judge/systemone", "keyEnv": "GW_JUDGE_KEY", "defaultModel": "jev-1.13" }This uses pi-typesafe 0.8.0, which resolves and validates both forms.
Why
Two backends were hardcoded, so a third host serving Jev, or a self-hosted server, needed a code change and a release (#134).
Behavior
.pi/pi-warden.jsonstill cannot settypesafeBackend, in the string or the object form.keyEnvvariable.TYPESAFE_API_KEYand the/typesafe loginstore are never sent to it./warden status, the/warden enabledialog and the/warden testconfirmation name the label, host and model sent, and the consent text names the real host."typesafe". It now turns judgments off and shows the refusal once and in/warden status. A mistyped value never sends judgments to api.typesafe.ai.defaultModelturns judgments off with one notice instead of failing on every request.Verification
npm run check: typecheck clean, 1197 tests pass, 0 fail, build clean. Main: 1186 pass.createTypeSafeunchanged; an unknown name and an invalid object turning judgments off without creating a client; the project file not setting either form; status and consent naming the custom label and host; key messages naming the object'skeyEnv.eval:replayscript key inpackage.json.Closes #134. Refs #34.