feat(renderer): rewrite providers UI on pi-mono catalog shape
Onboarding ProvidersStep now reads the 26-entry CONNECTOR_CATALOG and renders featured connectors (claude-pro, openai-codex, anthropic, openai, amazon-bedrock) up front with a collapsible advanced list for the remaining 21. Each auth kind gets a dedicated card component: OAuth button flow, inline API-key form, and a cloud deep-link to Settings. Delete legacy Claude/Codex/Gemini hardcoded cards and the compatible-API slot rotation. Swap ModelManagement Settings panel for the new ProvidersPanel driven by credentialsList IPC.
This commit is contained in:
1 parent
6a25379995
commit
7fdd3c16bf
17 files changed
+692
-1422
No files matched your search
@@ -6,9 +6,25 @@ import type {
|
||||
DepartmentId,
|
||||
} from "@shared/types";
|
||||
import { isConnectorExecutionReady } from "@shared/connector-policy";
|
||||
import { findConnectorCatalogEntry } from "@shared/connector-catalog";
|
||||
import { safeJson } from "../../../lib/safe-json";
|
||||
import { getBudgetPolicyAmountDollars } from "../../../lib/budget-policy-input";
|
||||
|
||||
/**
|
||||
* Connectors whose models accept a thinking-effort hint. Derived from the
|
||||
* pi-mono catalog provider id so renderer stays in sync with Agent A's data
|
||||
* without hard-coding hyphen-vs-underscore id literals.
|
||||
*/
|
||||
function connectorSupportsThinkingEffort(connectorId: string): boolean {
|
||||
const entry = findConnectorCatalogEntry(connectorId);
|
||||
if (!entry) return false;
|
||||
return (
|
||||
entry.provider === "anthropic" ||
|
||||
entry.provider === "openai" ||
|
||||
entry.provider === "openai-codex"
|
||||
);
|
||||
}
|
||||
|
||||
export type AgentFormMode = "create" | "edit";
|
||||
|
||||
export interface UseAgentFormArgs {
|
||||
@@ -90,10 +106,7 @@ export function useAgentForm({
|
||||
typeof existingMeta.thinkingEffort === "string" ? existingMeta.thinkingEffort : "",
|
||||
);
|
||||
|
||||
const supportsEffort =
|
||||
connectorId === "claude_local" ||
|
||||
connectorId === "codex_local" ||
|
||||
(mode === "edit" && typeof connectorId === "string" && connectorId.startsWith("claude_compat"));
|
||||
const supportsEffort = connectorSupportsThinkingEffort(connectorId);
|
||||
|
||||
const selectedConnectorRecord =
|
||||
(mode === "edit" ? connectors : executionReadyConnectors).find(
|
||||
@@ -115,40 +128,22 @@ export function useAgentForm({
|
||||
setModel(result.data[0]?.id ?? "");
|
||||
}
|
||||
})();
|
||||
if (connectorId !== "claude_local" && connectorId !== "codex_local") {
|
||||
if (!connectorSupportsThinkingEffort(connectorId)) {
|
||||
setThinkingEffort("");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof connectorId === "string" && connectorId.startsWith("claude_compat")) {
|
||||
const compat = connectors.find((c) => c.id === connectorId);
|
||||
const raw = compat?.model ?? "";
|
||||
const models = raw
|
||||
.split(",")
|
||||
.map((m) => m.trim())
|
||||
.filter(Boolean)
|
||||
.map((m) => ({ id: m, label: m }));
|
||||
setAvailableModels(models);
|
||||
if (persistedConnectorId && connectorId !== persistedConnectorId && models.length > 0) {
|
||||
setModel(models[0].id);
|
||||
}
|
||||
} else {
|
||||
void (async () => {
|
||||
const result = await window.agentCompany.listConnectorModels(connectorId);
|
||||
if (result.ok) {
|
||||
setAvailableModels(result.data);
|
||||
if (persistedConnectorId && connectorId !== persistedConnectorId) {
|
||||
setModel(result.data[0]?.id ?? "");
|
||||
}
|
||||
void (async () => {
|
||||
const result = await window.agentCompany.listConnectorModels(connectorId);
|
||||
if (result.ok) {
|
||||
setAvailableModels(result.data);
|
||||
if (persistedConnectorId && connectorId !== persistedConnectorId) {
|
||||
setModel(result.data[0]?.id ?? "");
|
||||
}
|
||||
})();
|
||||
}
|
||||
if (
|
||||
connectorId !== "claude_local" &&
|
||||
!(typeof connectorId === "string" && connectorId.startsWith("claude_compat")) &&
|
||||
connectorId !== "codex_local"
|
||||
) {
|
||||
}
|
||||
})();
|
||||
if (!connectorSupportsThinkingEffort(connectorId)) {
|
||||
setThinkingEffort("");
|
||||
}
|
||||
}, [connectorId, mode, persistedConnectorId, connectors]);
|
||||
|
||||
Reference in new issue
Block a user