feat(wave): #119/#122/#131/#132 verts + sprint plugins ESM/persistance #135/#136/#139
État d'intégration confiné à la branche batch. Les tickets #119 (skills → capacités agent découvrables), #122 (override permissions par défaut), #131 (effort par agent/presets) et #132 (outil MCP d'édition du contexte projet) sont verts en périmètre. Le sprint plugins multi-fichiers ESM / persistance plugin-owned (#135/#136/#139) est co-implémenté dans les MÊMES fichiers de câblage (frontend/src/ports/index.ts, backend/src/lib.rs, domain/ports.rs, backend/dto.rs), inséparable sans staging interactif (indisponible ici). Commit unique volontaire : préserve l'état vert QA sans découpe hunk risquée. NON mergé vers develop tant que #137 (QA e2e plugins) n'est pas vert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -25,7 +25,13 @@ import { useAgents } from "./useAgents";
|
||||
import { correlateModelServerStatus } from "./modelServerLaunch";
|
||||
import { AgentLimitBadge } from "./AgentLimitBadge";
|
||||
import { ModelServerLaunchBadge } from "./ModelServerLaunchBadge";
|
||||
import type { ResolvedAgentSystemPermissions } from "@/domain";
|
||||
import type {
|
||||
Agent,
|
||||
AgentProfile,
|
||||
EffortOption,
|
||||
EffortSelection,
|
||||
ResolvedAgentSystemPermissions,
|
||||
} from "@/domain";
|
||||
|
||||
export interface AgentsPanelProps {
|
||||
/** The project whose agents to manage. */
|
||||
@ -237,7 +243,7 @@ export function AgentsPanel({ projectId, projectRoot = "" }: AgentsPanelProps) {
|
||||
// Determine if a template is chosen → profile selector is hidden (template imposes it).
|
||||
const hasTemplate = newTemplateId !== "";
|
||||
|
||||
const profileLabel = (profile: import("@/domain").AgentProfile): string => {
|
||||
const profileLabel = (profile: AgentProfile): string => {
|
||||
const model =
|
||||
profile.model ??
|
||||
profile.opencode?.model ??
|
||||
@ -365,12 +371,9 @@ export function AgentsPanel({ projectId, projectRoot = "" }: AgentsPanelProps) {
|
||||
const isSelected = a.id === vm.selectedAgentId;
|
||||
const isRunning = a.id === activeAgentId;
|
||||
const live = vm.liveAgents.find((candidate) => candidate.agentId === a.id);
|
||||
const agentProfile = vm.profiles.find((p) => p.id === a.profileId) ?? null;
|
||||
const profileName =
|
||||
(() => {
|
||||
const p = vm.profiles.find((p) => p.id === a.profileId);
|
||||
return p ? profileLabel(p) : null;
|
||||
})() ??
|
||||
a.profileId;
|
||||
(agentProfile ? profileLabel(agentProfile) : null) ?? a.profileId;
|
||||
const agentDrift = drift.driftByAgentId.get(a.id);
|
||||
// Source of this agent's last orchestration delegation (mcp vs
|
||||
// file), if any has been observed. Absent ⇒ no badge.
|
||||
@ -480,6 +483,14 @@ export function AgentsPanel({ projectId, projectRoot = "" }: AgentsPanelProps) {
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<EffortSelector
|
||||
agent={a}
|
||||
profile={agentProfile}
|
||||
busy={vm.busy}
|
||||
onChange={(effort) =>
|
||||
void vm.updateAgentEffort(a.id, effort)
|
||||
}
|
||||
/>
|
||||
{agentDrift && (
|
||||
<Button
|
||||
size="sm"
|
||||
@ -706,6 +717,141 @@ export function AgentsPanel({ projectId, projectRoot = "" }: AgentsPanelProps) {
|
||||
);
|
||||
}
|
||||
|
||||
const EFFORT_DEFAULT_VALUE = "__profile_default__";
|
||||
const EFFORT_CUSTOM_VALUE = "__custom_effort__";
|
||||
|
||||
const GENERIC_EFFORT_OPTIONS: EffortOption[] = [
|
||||
{
|
||||
value: "low",
|
||||
label: "Rapide (par défaut)",
|
||||
hint: "Fallback générique léger.",
|
||||
},
|
||||
{
|
||||
value: "medium",
|
||||
label: "Standard (par défaut)",
|
||||
hint: "Fallback générique équilibré.",
|
||||
},
|
||||
{
|
||||
value: "high",
|
||||
label: "Approfondi (par défaut)",
|
||||
hint: "Fallback générique profond.",
|
||||
},
|
||||
];
|
||||
|
||||
function rawEffortValue(selection: EffortSelection | undefined): string {
|
||||
return selection?.value ?? "";
|
||||
}
|
||||
|
||||
function EffortSelector({
|
||||
agent,
|
||||
profile,
|
||||
busy,
|
||||
onChange,
|
||||
}: {
|
||||
agent: Agent;
|
||||
profile: AgentProfile | null;
|
||||
busy: boolean;
|
||||
onChange: (effort: EffortSelection | null) => void;
|
||||
}) {
|
||||
const nativeOptions = profile?.effortOptions ?? [];
|
||||
const hasNativeOptions = nativeOptions.length > 0;
|
||||
const displayedOptions = hasNativeOptions
|
||||
? nativeOptions
|
||||
: GENERIC_EFFORT_OPTIONS;
|
||||
const [customText, setCustomText] = useState(rawEffortValue(agent.effort));
|
||||
const [forceCustom, setForceCustom] = useState(agent.effort?.kind === "custom");
|
||||
|
||||
useEffect(() => {
|
||||
setCustomText(rawEffortValue(agent.effort));
|
||||
setForceCustom(agent.effort?.kind === "custom");
|
||||
}, [agent.id, agent.effort]);
|
||||
|
||||
let selectedOption = EFFORT_DEFAULT_VALUE;
|
||||
if (forceCustom) {
|
||||
selectedOption = EFFORT_CUSTOM_VALUE;
|
||||
} else if (
|
||||
hasNativeOptions &&
|
||||
agent.effort?.kind === "preset" &&
|
||||
nativeOptions.some((option) => option.value === agent.effort?.value)
|
||||
) {
|
||||
selectedOption = `preset:${agent.effort.value}`;
|
||||
} else if (
|
||||
!hasNativeOptions &&
|
||||
agent.effort &&
|
||||
displayedOptions.some((option) => option.value === agent.effort?.value)
|
||||
) {
|
||||
selectedOption = `fallback:${agent.effort.value}`;
|
||||
} else if (agent.effort) {
|
||||
selectedOption = EFFORT_CUSTOM_VALUE;
|
||||
}
|
||||
|
||||
const customVisible = selectedOption === EFFORT_CUSTOM_VALUE;
|
||||
|
||||
function commitCustom() {
|
||||
const value = customText.trim();
|
||||
if (value.length === 0) return;
|
||||
if (agent.effort?.kind === "custom" && agent.effort.value === value) return;
|
||||
onChange({ kind: "custom", value });
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="flex min-w-[11rem] max-w-full flex-wrap items-center gap-1.5">
|
||||
<SmallDropdown
|
||||
aria-label={`effort for ${agent.name}`}
|
||||
value={selectedOption}
|
||||
disabled={busy}
|
||||
onChange={(value) => {
|
||||
if (value === EFFORT_DEFAULT_VALUE) {
|
||||
setForceCustom(false);
|
||||
onChange(null);
|
||||
return;
|
||||
}
|
||||
if (value === EFFORT_CUSTOM_VALUE) {
|
||||
setForceCustom(true);
|
||||
setCustomText(rawEffortValue(agent.effort));
|
||||
return;
|
||||
}
|
||||
if (value.startsWith("preset:")) {
|
||||
setForceCustom(false);
|
||||
onChange({ kind: "preset", value: value.slice("preset:".length) });
|
||||
return;
|
||||
}
|
||||
if (value.startsWith("fallback:")) {
|
||||
setForceCustom(false);
|
||||
onChange({ kind: "custom", value: value.slice("fallback:".length) });
|
||||
}
|
||||
}}
|
||||
options={[
|
||||
{ value: EFFORT_DEFAULT_VALUE, label: "Effort: profil" },
|
||||
...displayedOptions.map((option) => ({
|
||||
value: `${hasNativeOptions ? "preset" : "fallback"}:${option.value}`,
|
||||
label: option.label,
|
||||
})),
|
||||
{ value: EFFORT_CUSTOM_VALUE, label: "Personnalisé" },
|
||||
]}
|
||||
/>
|
||||
{customVisible && (
|
||||
<Input
|
||||
aria-label={`custom effort for ${agent.name}`}
|
||||
value={customText}
|
||||
disabled={busy}
|
||||
placeholder="valeur brute"
|
||||
onChange={(event) => setCustomText(event.target.value)}
|
||||
onBlur={commitCustom}
|
||||
onKeyDown={(event) => {
|
||||
event.stopPropagation();
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
commitCustom();
|
||||
}
|
||||
}}
|
||||
className="h-8 min-w-[8rem] flex-1 px-2 text-xs"
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function NetworkPermissionBadge({
|
||||
state,
|
||||
}: {
|
||||
|
||||
Reference in New Issue
Block a user