refactor(connectors): drop dead CLI command field after pi-mono migration
The CLI-adapter era `connector.command` field became vestigial once every provider dispatch went through pi-ai. The schema still required a non-empty command, so onboarding saveConnector silently rejected every Pi Mono row (which carries an empty default). Remove the field from the payload chain (renderer → IPC schema → DB CRUD → run dispatch → worker job), narrow RunJob.taskId to match EnqueueRunPayload, and drop the dead helper plus its test. Schema column stays NOT NULL for DB compatibility; seedConnectors writes a literal empty string so no migration is needed.
This commit is contained in:
1 parent
dac59f56c2
commit
88a1f8b334
29 files changed
+17
-171
No files matched your search
@@ -16,53 +16,6 @@ export const ROLE_DEPARTMENT_HINTS: Record<string, TaskType> = {
|
||||
legal: "management",
|
||||
};
|
||||
|
||||
/**
|
||||
* Preferred provider ordering per task type. Resolved against `CONNECTORS` at
|
||||
* module load so `TASK_TYPE_PREFERENCE` stays in sync with the pi-mono catalog
|
||||
* without hard-coded id lists.
|
||||
*/
|
||||
const PROVIDER_PREFERENCE: Record<TaskType, string[]> = {
|
||||
code: ["anthropic", "openai", "xai", "groq", "google", "openrouter", "mistral", "cerebras"],
|
||||
research: ["google", "anthropic", "openai", "openrouter", "xai", "mistral", "groq"],
|
||||
content: ["anthropic", "openai", "google", "mistral", "openrouter", "groq", "xai"],
|
||||
management: ["anthropic", "openai", "google", "mistral", "openrouter", "groq", "xai"],
|
||||
general: ["anthropic", "openai", "google", "openrouter", "mistral", "xai", "groq"],
|
||||
};
|
||||
|
||||
function connectorsByProvider(provider: string): ConnectorId[] {
|
||||
return CONNECTORS.filter((c) => c.provider === provider).map((c) => c.id);
|
||||
}
|
||||
|
||||
function buildPreference(taskType: TaskType): ConnectorId[] {
|
||||
const preferred: ConnectorId[] = [];
|
||||
const seen = new Set<ConnectorId>();
|
||||
for (const provider of PROVIDER_PREFERENCE[taskType]) {
|
||||
for (const id of connectorsByProvider(provider)) {
|
||||
if (!seen.has(id)) {
|
||||
preferred.push(id);
|
||||
seen.add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ensure every catalog entry appears in the preference list so callers can
|
||||
// always resolve to *some* connector even when the provider is not ranked.
|
||||
for (const connector of CONNECTORS) {
|
||||
if (!seen.has(connector.id)) {
|
||||
preferred.push(connector.id);
|
||||
seen.add(connector.id);
|
||||
}
|
||||
}
|
||||
return preferred;
|
||||
}
|
||||
|
||||
export const TASK_TYPE_PREFERENCE: Record<TaskType, ConnectorId[]> = {
|
||||
code: buildPreference("code"),
|
||||
research: buildPreference("research"),
|
||||
content: buildPreference("content"),
|
||||
management: buildPreference("management"),
|
||||
general: buildPreference("general"),
|
||||
};
|
||||
|
||||
export function inferTaskType(department: string | null | undefined): TaskType {
|
||||
if (!department) return "general";
|
||||
const lower = department.toLowerCase();
|
||||
|
||||
Reference in new issue
Block a user