feat(ops): פאנל "מתאמי-סוכנים" ב-/operations — מעבר-אדפטר בכפתור (any→any)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s

שלב-ה-UI של מנגנון מעבר-האדפטר (PR #247). הכפתור ב-/operations מריץ את
scripts/migrate_agent_adapter.py בהוסט דרך גשר-court-fetch (הקונטיינר לא יכול
לבצע — צריך FS-הוסט + DB-המובנה), בדיוק כמו כפתורי-pm2.

- court_fetch_service/server.py: endpoint /adapter-migration מאומת (Bearer,
  COURT_FETCH_SHARED_SECRET) שמריץ את הסקריפט עם allowlist-פעולות ו-args אטומיים
  (exec, ללא shell; הסקריפט מאמת). symbol-light לשמירת G12 בשכבת mcp-server.
- web/app.py: proxy POST /api/operations/agents/migrate-adapter → הגשר.
- web-ui: useMigrateAdapter (operations.ts) + AgentAdaptersPanel לפי המוקאפ
  המאושר 02d-operations-adapters.html: roster per-role (מתאם נוכחי+מודל+בורר-יעד),
  סרגל-חירום גלובלי (הכל→Gemini/החזר→Claude), preflight בדיאלוג + toggle שחרור-כלים,
  דגלי מועבר/א-סימטרי. מחזר usePaperclipAgents לתצוגה.

עיצוב אושר ע"י חיים בשער Claude Design (פרויקט IA Redesign X17).
נבדק: tsc --noEmit נקי, eslint נקי.

Invariants: G12 (גשר symbol-light; הסקריפט בשכבת scripts/ הוא שמדבר Paperclip),
INV-MC1 (שתי החברות יחד), INV-IA "מקום אחד" (/operations). המשך FU-8a.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-13 12:06:40 +00:00
parent b9e4c1fde4
commit 64612240d5
5 changed files with 428 additions and 0 deletions

View File

@@ -228,3 +228,43 @@ export function useResetAgentSession() {
onError: (e) => toast.error(`האיפוס נכשל: ${String(e)}`),
});
}
// ── Agent adapter migration ────────────────────────────────────────────────
// Migrate an agent (or "all") between run-engines (claude_local / gemini_local /
// deepseek_local) in BOTH companies. Host-side (runs scripts/migrate_agent_adapter.py
// via the court-fetch bridge), so the script's exit code + output are relayed so
// the panel can render preflight warnings. A non-zero exit on a "check" is an
// informative refusal, not a transport error — callers inspect exit_code.
export type MigrateAction = "check" | "apply" | "revert" | "verify";
export type MigrateAdapterRequest = {
action: MigrateAction;
agent?: string; // agent display-name, or "all"
to?: string; // target adapter (for check/apply)
model?: string;
relax_tools?: boolean;
};
export type MigrateAdapterResult = {
ok: boolean;
exit_code: number;
stdout: string;
stderr: string;
};
/** Run an adapter migration action on the host bridge. Caller handles toasts —
* the meaning of the result depends on the action (preflight vs apply vs verify). */
export function useMigrateAdapter() {
const qc = useQueryClient();
return useMutation({
mutationFn: (body: MigrateAdapterRequest) =>
apiRequest<MigrateAdapterResult>("/api/operations/agents/migrate-adapter", {
method: "POST",
body,
}),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ["settings", "paperclip-agents"] });
qc.invalidateQueries({ queryKey: ["operations", "agents"] });
},
});
}