feat: add pluggable workflow orchestrator controls

This commit is contained in:
john
2026-07-24 20:59:01 +08:00
parent 3fd1db8c2f
commit 46ea22b342
16 changed files with 1327 additions and 2 deletions
+55
View File
@@ -198,6 +198,48 @@ export type SystemDisclosurePolicyState = {
lastRefreshError?: string | null;
};
export type OrchestratorMode = 'off' | 'shadow' | 'canary' | 'active';
export type OrchestratorConfig = {
mode: OrchestratorMode;
primaryEngine: string;
fallbackEngine: string;
serviceUrl: string;
requestTimeoutMs: number;
rolloutPercent: number;
userAllowlist: string[];
workflowAllowlist: string[];
fallbackToNative: boolean;
requireHealthy: boolean;
};
export type OrchestratorRuntime = {
killSwitch: boolean;
configured: boolean;
effective: boolean;
reason: string | null;
executesLangGraph: boolean;
shadowsLangGraph: boolean;
};
export type OrchestratorEngineDescriptor = {
id: string;
label: string;
kind: string;
configured: boolean;
capabilities: string[];
};
export type OrchestratorConfigState = {
config: OrchestratorConfig;
configVersion: number;
updatedBy: string | null;
updatedAt: number | null;
source: string;
runtime: OrchestratorRuntime;
engines: OrchestratorEngineDescriptor[];
};
// ─── Summary ──────────────────────────────────────────────────────────────────
export async function fetchAdminSummary() {
@@ -217,6 +259,19 @@ export async function updateSystemDisclosurePolicy(config: SystemDisclosurePolic
});
}
// ─── Workflow Orchestrator ───────────────────────────────────────────────────
export async function fetchOrchestratorConfig() {
return adminFetch<OrchestratorConfigState>('/admin-api/orchestrator/config');
}
export async function updateOrchestratorConfig(config: OrchestratorConfig) {
return adminFetch<OrchestratorConfigState>('/admin-api/orchestrator/config', {
method: 'PUT',
body: JSON.stringify({ config }),
});
}
// ─── Users ────────────────────────────────────────────────────────────────────
export async function fetchAdminUsers(params: {