2026-02-16 20:42:58 +09:00
|
|
|
import { getAgentDisplayName } from "../shared/agent-display-names";
|
|
|
|
|
|
|
|
|
|
const CORE_AGENT_ORDER = [
|
|
|
|
|
getAgentDisplayName("sisyphus"),
|
|
|
|
|
getAgentDisplayName("hephaestus"),
|
|
|
|
|
getAgentDisplayName("prometheus"),
|
|
|
|
|
getAgentDisplayName("atlas"),
|
|
|
|
|
] as const;
|
2026-02-08 16:25:25 +09:00
|
|
|
|
|
|
|
|
export function reorderAgentsByPriority(
|
|
|
|
|
agents: Record<string, unknown>,
|
|
|
|
|
): Record<string, unknown> {
|
|
|
|
|
const ordered: Record<string, unknown> = {};
|
|
|
|
|
const seen = new Set<string>();
|
|
|
|
|
|
|
|
|
|
for (const key of CORE_AGENT_ORDER) {
|
|
|
|
|
if (Object.prototype.hasOwnProperty.call(agents, key)) {
|
|
|
|
|
ordered[key] = agents[key];
|
|
|
|
|
seen.add(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(agents)) {
|
|
|
|
|
if (!seen.has(key)) {
|
|
|
|
|
ordered[key] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ordered;
|
|
|
|
|
}
|