No description
Find a file
amertensreplit f44c3ed247 Guided AI provider setup with model discovery
Task: Replace free-text model entry in Admin → Providers with a guided
flow (Name → API type → API endpoint → API token → Test connection) that
auto-discovers available models after a successful connection test and
presents them in a Select positioned right after the API endpoint field.

Model-independent connection test (key fix):
- The setup connection test no longer requires a model, removing the
  chicken-and-egg where discovery could never run. test-connection's model
  is now optional: when a model is supplied it does a full chat round-trip;
  when omitted it verifies credentials via the provider's models endpoint and
  reports how many models are available. The form sends no model on the
  initial test, so a successful test now reliably triggers discovery.

Backend:
- aiAnalysis.ts: added listProviderModels(provider) — GETs {baseUrl}/models
  using Bearer auth for openai/custom and x-api-key + anthropic-version for
  anthropic. Normalizes data[].id (falls back to models[].id/.name),
  dedupes + sorts, and redacts secrets in error messages via the existing
  redactSecrets helper.
- providers.ts: added POST /providers/list-models accepting ad-hoc config
  (apiType, baseUrl, optional apiToken, optional providerId). Falls back to
  the stored token by providerId when token omitted; returns { ok, models,
  message } and never leaks the token.

API contract:
- openapi.yaml: added /providers/list-models path, ProviderListModelsInput
  and ProviderModelsResult schemas. Regenerated zod + react-query client via
  the api-spec codegen workflow (orval).

Admin UI (admin.tsx):
- New ModelField component renders a loading state, a Select when models are
  discovered, or a manual free-text input fallback (with hint) when discovery
  returns nothing — so saving always works for custom endpoints.
- Field order follows the guided flow: Name → API type → API endpoint →
  API token → Test connection, with the model selector appearing after the
  token once discovery succeeds. A successful test automatically triggers
  discovery; editing endpoint or token resets discovery state.

Verified: workspace typecheck passes, api-server tests 59/59 pass, live curl
of the new endpoint returns graceful errors without leaking the token.

Replit-Task-Id: 8d300a47-0b45-4677-9e9e-aa041bf03e98
2026-06-10 21:13:35 +00:00
.agents/memory Add skill version timeline (fingerprint lineage) 2026-06-10 19:47:39 +00:00
artifacts Guided AI provider setup with model discovery 2026-06-10 21:13:35 +00:00
lib Guided AI provider setup with model discovery 2026-06-10 21:13:35 +00:00
scripts Initial commit 2026-05-28 23:37:31 +00:00
.gitignore Initial commit 2026-05-28 23:37:31 +00:00
.npmrc Initial commit 2026-05-28 23:37:31 +00:00
.replit Register api-server Vitest suite as a CI-style validation step 2026-06-10 19:53:29 +00:00
.replitignore Initial commit 2026-05-28 23:37:31 +00:00
package.json Initial commit 2026-05-28 23:37:31 +00:00
pnpm-lock.yaml Add automated tests for skill version detection 2026-06-10 19:48:10 +00:00
pnpm-workspace.yaml Initial commit 2026-05-28 23:37:31 +00:00
replit.md SkillGuard: complete frontend wiring and harden backend 2026-06-08 14:59:17 +00:00
tsconfig.base.json Initial commit 2026-05-28 23:37:31 +00:00
tsconfig.json Initial commit 2026-05-28 23:37:31 +00:00