feat(routing): add dynamic agent profile routing (#2698)

This commit is contained in:
Carlos Florêncio
2026-08-21 22:04:17 +01:00
committed by GitHub
parent 66efcb88e1
commit 94e7b0245f
230 changed files with 15932 additions and 898 deletions
@@ -9,6 +9,7 @@ const store = {
workflows: { items: [{ id: "workflow", name: "Delivery", hidden: false }] },
agentProfiles: { items: [] },
executors: { items: [] },
features: { dynamicAgentRouting: false },
};
vi.mock("@/components/state-provider", () => ({
@@ -19,6 +19,7 @@ import { IconInfoCircle } from "@tabler/icons-react";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@kandev/ui/tooltip";
import { CliModeIcon } from "@/components/cli-mode-icon";
import { useAppStore } from "@/components/state-provider";
import { useFeature } from "@/hooks/domains/features/use-feature";
import { useSettingsData } from "@/hooks/domains/settings/use-settings-data";
import { useWorkflows } from "@/hooks/use-workflows";
import { useWorkflowSteps, stepPlaceholder } from "@/hooks/use-workflow-steps";
@@ -29,6 +30,7 @@ import {
} from "@/components/github/issue-watch-placeholders";
import { RepoFilterSelector } from "@/components/github/repo-filter-selector";
import { STEP_DEFAULT, resolveProfileId } from "@/lib/watcher-profile-default";
import { isSelectableAgentProfile } from "@/lib/state/slices/settings/types";
import type {
RepoFilter,
IssueWatch,
@@ -120,6 +122,12 @@ function useWatchFormData(workspaceId: string) {
const allWorkflows = useAppStore((state) => state.workflows.items);
const workflows = useMemo(() => allWorkflows.filter((w) => !w.hidden), [allWorkflows]);
const agentProfiles = useAppStore((state) => state.agentProfiles.items);
const dynamicRoutingEnabled = useFeature("dynamicAgentRouting");
const selectableAgentProfiles = useMemo(
() =>
agentProfiles.filter((profile) => isSelectableAgentProfile(profile, dynamicRoutingEnabled)),
[agentProfiles, dynamicRoutingEnabled],
);
const executors = useAppStore((state) => state.executors.items);
const allExecutorProfiles = useMemo(
() =>
@@ -129,7 +137,7 @@ function useWatchFormData(workspaceId: string) {
[executors],
);
return { workflows, agentProfiles, allExecutorProfiles };
return { workflows, agentProfiles: selectableAgentProfiles, allExecutorProfiles };
}
function SectionHeader({ children }: { children: React.ReactNode }) {
@@ -8,6 +8,7 @@ const store = {
workspaces: { activeId: "ws-1", items: [] },
workflows: { items: [{ id: "workflow", name: "Delivery", hidden: false }] },
agentProfiles: { items: [] },
features: { dynamicAgentRouting: true },
executors: { items: [] },
prompts: { items: [], loaded: true, loading: false },
};
@@ -19,6 +19,7 @@ import { IconInfoCircle } from "@tabler/icons-react";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@kandev/ui/tooltip";
import { CliModeIcon } from "@/components/cli-mode-icon";
import { useAppStore } from "@/components/state-provider";
import { useFeature } from "@/hooks/domains/features/use-feature";
import { useSettingsData } from "@/hooks/domains/settings/use-settings-data";
import { useWorkflows } from "@/hooks/use-workflows";
import {
@@ -30,6 +31,7 @@ import { DEFAULT_REVIEW_WATCH_PROMPT } from "@/components/github/review-watch-pl
import { ReviewWatchPromptField } from "@/components/github/review-watch-prompt-field";
import { RepoFilterSelector } from "@/components/github/repo-filter-selector";
import { STEP_DEFAULT, resolveProfileId } from "@/lib/watcher-profile-default";
import { isSelectableAgentProfile } from "@/lib/state/slices/settings/types";
import type {
RepoFilter,
ReviewWatch,
@@ -194,6 +196,12 @@ function useWatchFormData(workspaceId: string) {
const allWorkflows = useAppStore((state) => state.workflows.items);
const workflows = useMemo(() => allWorkflows.filter((w) => !w.hidden), [allWorkflows]);
const agentProfiles = useAppStore((state) => state.agentProfiles.items);
const dynamicRoutingEnabled = useFeature("dynamicAgentRouting");
const selectableAgentProfiles = useMemo(
() =>
agentProfiles.filter((profile) => isSelectableAgentProfile(profile, dynamicRoutingEnabled)),
[agentProfiles, dynamicRoutingEnabled],
);
const executors = useAppStore((state) => state.executors.items);
const allExecutorProfiles = useMemo(
() =>
@@ -203,7 +211,7 @@ function useWatchFormData(workspaceId: string) {
[executors],
);
return { workflows, agentProfiles, allExecutorProfiles };
return { workflows, agentProfiles: selectableAgentProfiles, allExecutorProfiles };
}
// --- Section header ---