Skip to content

feat(tui): rename gateway provider to netGate, name custom providers - #137

Merged
quickbeard merged 1 commit into
mainfrom
netgate-provider-rename
Jul 30, 2026
Merged

quickbeard merged 1 commit into
mainfrom
netgate-provider-rename

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

What

Port of the hub's provider-identity split (quickbeard/codev-hub#212) to CoDev Code's own config writers:

  • SSO-issued gateway keys — the configure flow (including its manual key-paste branch) now writes provider.netgate with display name netGate instead of provider.aigateway / AI Gateway, and pins model: "netgate/<model>".
  • Custom provider flow gains an optional, ASCII-only provider name as its first prompt, replacing the raw provider-id prompt. The id is slugged from it ([a-z0-9-], 32-char cap) with a live → id: <slug> preview under the field; a blank or unusable name falls back to ai-gateway / AI Gateway, and the name is written as the provider block's display name so the model picker shows it instead of the bare id.
Name: "Acme AI Gateway"  ->  id: acme-ai-gateway
Name: "My_Gateway 2.0"   ->  id: my-gateway-2-0
Name: "" or "!!!"        ->  ai-gateway / AI Gateway

New packages/codev-gateway/src/provider.ts is the single owner of the identities and the slug (mirrors hub src/lib/provider.ts, minus the detection helpers — codev-code has no id-based config attribution).

auth.json interop

The hub now persists provider_id / provider_name in the shared ~/.codev-hub/auth.json for manually-named keys, and treats saveApiKey as a whole-block write where an omitted pair clears it. auth-file.ts adopts the same rule: the pair is modeled on ApiKeyCreds, and a provider-less save (the SSO flow minting a fresh gateway key) explicitly clears a stale hub-written manual identity — the previous read-merge-write spread would have silently preserved it and the hub would misattribute the new key.

Back-compat

  • Pre-rename provider.aigateway blocks are left in place: Config.updateGlobal only merges, never deletes, so re-running codev configure leaves the old block (and its picker entry) next to the new netgate one until the hub's next full-file rewrite converges the config. Documented in the CHANGELOG.
  • Hub releases older than its own rename (feat(sandbox): named egress rules for the broker #212) can't attribute a netgate config as CoDev-managed; the merged hub recognizes netgate, ai-gateway, and legacy aigateway.
  • All touched files are fork-only, so no DIVERGENCES.md rows.

Testing

  • New test/provider.test.ts: slug table (ported from the hub's), 32-char cap without trailing dash, fallback identity.
  • config-block.test.ts flipped to netgate/netGate; asserts the custom block carries name.
  • auth-file.test.ts: provider pair round-trips and is cleared by a provider-less save.
  • bun test in packages/codev-gateway (35 pass) and bun run typecheck in both codev-gateway and tui; targeted test/cli/cmd/tui/provider-options.test.ts still green.

🤖 Generated with Claude Code

Port of codev-hub PR #212. The SSO configure flow now writes the
provider block as provider.netgate / "netGate" instead of
provider.aigateway / "AI Gateway"; the Custom provider flow asks for an
optional provider name, slugs it into the id ([a-z0-9-], 32-char cap)
with a live preview, falls back to ai-gateway / "AI Gateway", and writes
the name as the block's display name. auth-file.ts models the hub's
provider_id/provider_name pair and clears it on provider-less saves so a
fresh SSO key never keeps a stale manual identity.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard force-pushed the netgate-provider-rename branch from d78ffb0 to b5c32f1 Compare July 30, 2026 10:28
@quickbeard
quickbeard merged commit e01c083 into main Jul 30, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the netgate-provider-rename branch July 30, 2026 10:33
quickbeard added a commit that referenced this pull request Jul 30, 2026
…dels (#139)

A config model entry with no `modalities` resolves image input to false, so
ProviderTransform.message replaced an attached image with an "ERROR: Cannot
read image" note before the request and the model answered that it couldn't
see anything — even when the endpoint supports vision.

Both blocks written by @codev/gateway (netGate configure flow and the custom
provider flow) now declare `attachment: true` and
`modalities: { input: ["text", "image"], output: ["text"] }` per model,
mirroring codev-hub PR #219 so hub-written and self-configured codev.json
stay identical. Every gateway model is now declared vision-capable including
text-only ones: for those the endpoint rejects or ignores the image rather
than the client silently dropping it.

Tests cover the two upstream paths this depends on — config modality →
model capability, and the part filtering in transform — plus the end-to-end
PATCH body from the custom-provider TUI flow. That view test was already
failing on main (it waits on the "Provider id" prompt renamed to "Provider
name" in #137, and predates the provider `name` field); repaired here since
it asserts the payload this changes.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
quickbeard added a commit that referenced this pull request Aug 2, 2026
The exit-transcript and custom-provider-name entries in 1.18.4-5 shipped
without their PR links; git log -S traces both texts to #134 and #137.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant