Repository navigation
feat(upstreams): request headers alongside the API key, as in the enterprise gateway - #38
Merged
Merged
Conversation
…erprise gateway
Pins core v0.3.0, which models upstream credentials as an API key plus an
ordered header table plus optional OAuth.
The connection step replaces the credential-type select (key / env /
OAuth) with:
- an authentication mode (API key or OAuth)
- an API key field that says which header the key is sent in for the
chosen or detected protocol, and accepts `${VAR}`. The key is optional:
local services and relays that authenticate with their own header do
not need one
- a header editor. Saved values that are secrets are not filled back in;
leaving one blank keeps it, the same convention the enterprise gateway
uses. A saved key can be removed explicitly
Saved OAuth credentials are still replaced as a whole, because the
refresh token and client secret never come back from core.
Also fixes two sentinel option values in the proxy and price sheet selects
that were literal NUL bytes. They worked, but git treated both files as
binary, so their diffs were invisible in review. The sentinels are now
names with a leading space, which core rejects as real names, and a test
keeps control characters out of the sources.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Why
The upstream dialog could only store one credential (a key, an environment variable, or an OAuth refresh token). Relays that authenticate with their own header, or that need
anthropic-versionor an organization header pinned, could not be connected. The enterprise gateway already edits upstream credentials as a header table; core v0.3.0 (ThinkWatchProject/ThinkWatch-Core#34) adopts the same model, and this PR brings the UI in line.What changes
Connection step
x-api-key,Authorization: Bearer,x-goog-api-key) for the chosen or detected protocol. Core computes this, not the UI. The field accepts${VAR}, and an environment reference is shown in plain text. The key is optional.Plumbing
types.tsfollowstw-api0.3.0:SecretView,HeaderView,OAuthView,SecretChange,HeaderInput,OAuthChange;CredentialInputis removed.preview_providertakes the wholeProviderPreviewRequest, including the selected protocol.Unrelated fix found while reviewing the diff
ConnectionSection.tsxandBillingSection.tsxas binary and their diffs did not render. They are now names with a leading space, which core rejects as real names.src/source.test.tskeeps control characters out of the sources. (Both files still show as binary in this PR's diff because the base version is binary. They render normally from the next change.)Tests
upstreamForm.test.ts: keep, set and remove for the key; saved header values kept by name, case-insensitively; OAuth kept or replaced when switching modes; what counts as a connection change; required-field messages for header rows.pnpm typecheck,pnpm test,cargo fmt --check,cargo clippy -D warningsandcargo testpass locally.🤖 Generated with Claude Code