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.
30 lines
911 B
TypeScript
30 lines
911 B
TypeScript
import type { ConnectorId, TaskType } from "@shared/types";
|
|
import { CONNECTORS } from "./connectors";
|
|
|
|
export const ROLE_DEPARTMENT_HINTS: Record<string, TaskType> = {
|
|
engineering: "code",
|
|
research: "research",
|
|
marketing: "content",
|
|
product: "content",
|
|
hr: "management",
|
|
finance: "management",
|
|
executive: "management",
|
|
design: "content",
|
|
customer_support: "content",
|
|
operations: "management",
|
|
sales: "content",
|
|
legal: "management",
|
|
};
|
|
|
|
export function inferTaskType(department: string | null | undefined): TaskType {
|
|
if (!department) return "general";
|
|
const lower = department.toLowerCase();
|
|
return ROLE_DEPARTMENT_HINTS[lower] ?? "general";
|
|
}
|
|
|
|
export function getConnectorStrengths(connectorId: ConnectorId): string {
|
|
const definition = CONNECTORS.find((c) => c.id === connectorId);
|
|
if (!definition) return "General-purpose AI connector.";
|
|
return definition.description;
|
|
}
|