feat(proxy,chat): add per-task/schedule/chat proxy pool routing and @task mentions

- Support pool auto-rotation mode alongside inherit/direct/node/custom proxy routes across gateway and MITM proxy
- Add GET /api/proxy/routes/{scope}/{owner_id}, task create/DTO proxy_route, and schedule proxy persistence + propagation
- Add list_proxy_pool and set_task_proxy chat agent tools and @task mention search/context injection
- Wire shared proxy/pool selectors into tasks, schedules, chat sandbox popover, and container routes UI
This commit is contained in:
ji ruo committed 2026-12-03 00:10:50 +08:00
1 parent b18cf89b77
commit 778e49317d
28 files changed
+1683 -124

No files matched your search

+13
View File
@@ -25,6 +25,7 @@ import type {
CompanyScopeMutation,
CompanyScopeRule,
ContainerProxyRoute,
ContainerRouteStatusItem,
Conversation,
ConvTokenSummary,
CoverageAssetRefs,
@@ -416,6 +417,9 @@ export type ScheduleInput = {
start_time: string;
end_time?: string;
start_immediately?: boolean;
proxy_mode?: "inherit" | "direct" | "pool" | "proxy" | string;
proxy_pool_id?: string;
proxy_url?: string;
task_ids: number[];
};
@@ -431,6 +435,9 @@ function schedulePayload(input: ScheduleInput) {
start_time: input.start_time,
end_time: input.end_time ?? "",
start_immediately: input.start_immediately ?? false,
proxy_mode: input.proxy_mode ?? "inherit",
proxy_pool_id: input.proxy_pool_id ?? "",
proxy_url: input.proxy_url ?? "",
task_ids: input.task_ids,
};
}
@@ -499,6 +506,7 @@ export const api = {
workerCount?: number;
interceptRules?: AssetInterceptRuleInput[];
schedule?: ScheduleInput;
proxyRoute?: { mode: "inherit" | "direct" | "pool" | "proxy"; proxy_pool_id?: string; proxy_url?: string; note?: string };
}) =>
post<Task>("/tasks", {
name: input.name ?? "",
@@ -520,6 +528,7 @@ export const api = {
worker_count: input.workerCount ?? 0, // 0 = 用全局默认 workers
intercept_rules: input.interceptRules ?? [], // 任务级资产拦截规则
schedule: input.schedule ? schedulePayload(input.schedule) : undefined,
proxy_route: input.proxyRoute && input.proxyRoute.mode !== "inherit" ? input.proxyRoute : undefined,
}),
schedules: () => get<{ schedules: TaskSchedule[] }>("/schedules").then((r) => arr(r.schedules)),
renameSchedule: (id: number, name: string) => patch<TaskSchedule>(`/schedules/${id}/metadata`, { name }),
@@ -1940,6 +1949,10 @@ export const api = {
// ---- Per-Container Proxy Routes & Transparent Gateway (#218 Phase 3/4) ----
proxyRoutes: () => get<ProxyRoutesState>("/proxy/routes"),
proxyRoute: (scope: string, ownerId: string) =>
get<ContainerRouteStatusItem & { global_proxy?: string }>(
`/proxy/routes/${encodeURIComponent(scope)}/${encodeURIComponent(ownerId)}`,
),
putProxyRoute: (
scope: string,
ownerId: string,