feat(frontend): support des providers OpenCode cloud (#92)
Ajoute l'UI de configuration des providers OpenCode cloud dans le wizard first-run (sélection, édition, sauvegarde, suppression), le domaine et les ports associés, ainsi que les adapters HTTP/mock correspondants. Build + 952 tests verts, comportements clés vérifiés en exécution réelle, y compris un test de couverture ajouté pour le parcours d'édition. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -34,6 +34,7 @@ import type {
|
||||
MemoryType,
|
||||
McpToolCatalogue,
|
||||
McpToolPolicy,
|
||||
OpenCodeProviderCatalogEntry,
|
||||
EffectivePermissions,
|
||||
PairedDevice,
|
||||
PairingCode,
|
||||
@ -99,6 +100,7 @@ import type {
|
||||
ReattachResult,
|
||||
RemoteGateway,
|
||||
ReviewPluginPackageInput,
|
||||
SaveOpenCodeProviderProfileInput,
|
||||
SkillGateway,
|
||||
StoppedLiveAgent,
|
||||
SystemGateway,
|
||||
@ -1272,6 +1274,20 @@ export const MOCK_REFERENCE_PROFILES: AgentProfile[] = [
|
||||
},
|
||||
];
|
||||
|
||||
/** Static mock catalogue mirroring the backend OpenCode cloud-provider list. */
|
||||
const MOCK_OPENCODE_PROVIDERS: OpenCodeProviderCatalogEntry[] = [
|
||||
{
|
||||
providerId: "anthropic",
|
||||
displayName: "Anthropic",
|
||||
models: ["claude-sonnet-5", "claude-opus-4-8", "claude-haiku-4-5"],
|
||||
},
|
||||
{
|
||||
providerId: "openrouter",
|
||||
displayName: "OpenRouter",
|
||||
models: ["openrouter/auto", "qwen/qwen3-coder"],
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* In-memory profiles gateway. Tracks configured profiles and a first-run flag so
|
||||
* the wizard can be driven and tested fully offline. By default it reports the
|
||||
@ -1342,6 +1358,30 @@ export class MockProfileGateway implements ProfileGateway {
|
||||
opencode: input.opencode ?? seed.opencode,
|
||||
});
|
||||
}
|
||||
|
||||
async listOpenCodeProviders(): Promise<OpenCodeProviderCatalogEntry[]> {
|
||||
return structuredClone(MOCK_OPENCODE_PROVIDERS);
|
||||
}
|
||||
|
||||
async saveOpenCodeProviderProfile(
|
||||
input: SaveOpenCodeProviderProfileInput,
|
||||
): Promise<AgentProfile> {
|
||||
const saved: AgentProfile = {
|
||||
...structuredClone(input.profile),
|
||||
opencode: undefined,
|
||||
opencodeProvider: {
|
||||
providerId: input.providerId,
|
||||
model: input.model,
|
||||
// The mock never seals a real secret; the ref is opaque either way.
|
||||
apiKeyRef: `mock-secret-${input.profile.id}`,
|
||||
},
|
||||
};
|
||||
const i = this.profiles.findIndex((p) => p.id === saved.id);
|
||||
if (i >= 0) this.profiles[i] = saved;
|
||||
else this.profiles.push(saved);
|
||||
this.configured = true;
|
||||
return structuredClone(saved);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user