209c454d6c
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
4.4 KiB
4.4 KiB
id, title, status, wave, depends_on, plan, requirements, acceptance_criteria, system_design
| id | title | status | wave | depends_on | plan | requirements | acceptance_criteria | system_design | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| task-05-profile-editor | Profile editor provider section (frontend) | done | 3 |
|
plan.md |
|
|
|
Task 05: Profile editor provider section (frontend)
Summary
Add a provider section to the agent profile editor: a provider-kind control
(Native / OpenAI-compatible), a base-URL input, and an API-key secret
picker (reusing the existing profile secret component). The whole section is
hidden unless the profile API projection reports provider_supported.
Scope
- Provider section component + wiring into the profile editor form and its store slice / API client.
- Client validation mirroring the backend: non-empty absolute http(s) base URL,
no
/in the model whenopenai_compatible; block save with localized inline errors. - All copy via
t()/<Trans>; add keys in all five locales (pnpm run i18n:zh-hantfor the Traditional Chinese pair).
Exclusions
- No backend changes (task-01 owns the contract).
- No dynamic provider-option resolution changes.
Implementation acceptance conditions
- The section renders only for a
provider_supportedagent; switching toNativehides the base-URL and key fields and the saved payload clears them. - Save is blocked with a localized message for an empty/relative base URL or a
slash-containing model while
OpenAI-compatibleis selected. - Desktop and mobile Playwright specs cover showing the section, entering a base URL + key, and the validation block; one-column touch layout, no horizontal document overflow on mobile.
Verification
cd apps && pnpm --filter @kandev/web test -- <provider section hook/validation test files>cd apps/web && pnpm run typecheckcd apps/web && pnpm run lintcd apps/web && pnpm run i18n:checkcd apps/web && pnpm e2e:run <provider profile spec> -- --retries=0cd apps/web && pnpm e2e:run --project mobile-chrome <mobile provider profile spec> -- --retries=0
Likely files
apps/web/components/settings/**/agent-profile*editor + new provider section- profile store slice + API client types
apps/web/src/locales/*/new keysapps/web/e2e/tests/settings/**desktop + mobile specs
Risks
- Secret picker reuse: confirm the existing profile env-var secret component can be driven for a single-value field without the key/value pair UI.
IMPLEMENTATION NOTE (2026-08-31)
- Section component:
apps/web/components/settings/profile-edit/provider-section.tsx(kind select +OpenAICompatibleProviderFieldssub-component), rendered fromagent-profile-page.tsxProfileEditorBody, gated ondraft.providerSupported. - Validation:
apps/web/lib/settings/provider-config-validation.ts(providerConfigInvalidReasonKeyreturns an i18n key), wired into theuseSettingsSaveContributorcanSave/invalidReason. - Wire mapping:
provider_kind/provider_base_url/provider_api_key_secret_idinagent-profile.tstypes,agent-profile-normalize.ts(both directions;provider_supportedread-only, never sent back),agent-profile-page-state.tssave payload (base URL + key cleared when kind is notopenai_compatible),agent-profile-dirty.ts(isProviderConfigDirty),app/actions/agents.ts. - i18n: 12 keys in
en/pt-pt/zh-cn;zh-hk/zh-twhand-added (pnpm run i18n:zh-hantfails on a pre-existingdynamicProfileSettingsresidual unrelated to this change); pseudo regenerated;i18n:checkpasses. - Test support:
MockAgentadvertisesOpenAICompatibleProviderAgent(internal/agent/agents/mock.go) somock-agentprofiles reportprovider_supported: truefor e2e and utility coverage. - Tests:
lib/settings/provider-config-validation.test.ts,agent-profile-normalize.test.tsprovider round-trip; e2eagent-profile-provider.spec.ts+mobile-agent-profile-provider.spec.ts(need the full e2e stack to run). - Provider profiles take their model as free-text (AC-001.2), so no per-profile
model probe is wired and none is required; AC-003.1 (revised) makes this the
intended design, with the probe executor accepting
ProviderGatewayAuthfor a future caller.