diff --git a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx index cf89257d2c..aaf7af5f09 100644 --- a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx +++ b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx @@ -24,6 +24,7 @@ import {useCallback, useEffect, useMemo, useRef, useState} from "react" import type {SchemaProperty} from "@agenta/entities/shared" +import {workflowBuildKitEnabledAtomFamily} from "@agenta/entities/workflow" import {ConfigAccordionSection} from "@agenta/ui/components/presentational" import {useDrillInUI} from "@agenta/ui/drill-in" import {cn} from "@agenta/ui/styles" @@ -38,7 +39,7 @@ import { Wrench, } from "@phosphor-icons/react" import {Button, Tabs, Tag, Tooltip, Typography} from "antd" -import {useAtomValue} from "jotai" +import {useAtomValue, useStore} from "jotai" import {useOptionalDrillIn} from "../components/MoleculeDrillInContext" @@ -122,17 +123,30 @@ export function AgentTemplateControl({ // is restored on Cancel, giving the same draft-then-save feel as the item drawers. const [openSection, setOpenSection] = useState(null) const sectionSnapshot = useRef | null>(null) + // Snapshot + restore for the build-kit enabled atom (lives outside config; needs separate tracking). + const store = useStore() + const revisionIdRef = useRef(null) + const buildKitEnabledSnapshot = useRef(null) const openSectionDrawer = useCallback( (key: "model-harness" | "advanced") => { sectionSnapshot.current = value ?? {} + buildKitEnabledSnapshot.current = store.get( + workflowBuildKitEnabledAtomFamily(revisionIdRef.current ?? ""), + ) setOpenSection(key) }, - [value], + [value, store], ) const cancelSection = useCallback(() => { if (sectionSnapshot.current) onChange(sectionSnapshot.current) + if (buildKitEnabledSnapshot.current !== null) { + store.set( + workflowBuildKitEnabledAtomFamily(revisionIdRef.current ?? ""), + buildKitEnabledSnapshot.current, + ) + } setOpenSection(null) - }, [onChange]) + }, [onChange, store]) const saveSection = useCallback(() => setOpenSection(null), []) // Layout (accordion / tabs / cards) is a global persisted preference; the panel only reads it. @@ -153,6 +167,7 @@ export function AgentTemplateControl({ // useModelHarness) and bound-trigger scoping both key off it. const drillIn = useOptionalDrillIn() const revisionId = drillIn?.entityId ?? null + revisionIdRef.current = revisionId // Triggers bound to this agent (for the section count badge). The section body and the header // add-dropdown derive scoping from the same hook. const {count: triggerCount} = useAgentTriggers(revisionId) diff --git a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useBuildKit.tsx b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useBuildKit.tsx index 662745e689..7d73312f8e 100644 --- a/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useBuildKit.tsx +++ b/web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useBuildKit.tsx @@ -149,7 +149,7 @@ export function useBuildKit({ const [buildKitEnabled, setBuildKitEnabled] = useAtom( useMemo(() => workflowBuildKitEnabledAtomFamily(revisionId ?? ""), [revisionId]), ) - const [buildKitExpanded, setBuildKitExpanded] = useState(true) + const [buildKitExpanded, setBuildKitExpanded] = useState(false) const overlayTools = useMemo( () => (Array.isArray(agentTemplateOverlay?.tools) ? agentTemplateOverlay.tools : []), @@ -193,6 +193,7 @@ export function useBuildKit({
-

- Where the model credential comes from when this agent runs. -

-
{authControls}
+ {!authExpanded ? ( + + {props.llm + ? connection.mode === "agenta" + ? "Agenta-managed" + : "Self-managed" + : ""} + + ) : ( + + )} + + + {authExpanded ? ( +
+

+ Where the model credential comes from when this agent runs. +

+ {authControls} +
+ ) : null} ) : null} {hasExecutionGroup ? ( -
-
+
+
-

- Where the agent's tools and code run, and what that sandbox may touch. -

-
- {sandboxProps.kind && ( - setSection("sandbox", {...sandbox, kind: v})} - withTooltip={withTooltip} - disabled={disabled} - /> + {!execExpanded ? ( + + {sandbox.kind ? `Sandbox: ${String(sandbox.kind)}` : ""} + + ) : ( + )} - {sandboxProps.permissions ? ( -
- {permissionOverrideHint} - | null) ?? - null - } - onChange={(v) => - setSection("sandbox", {...sandbox, permissions: v}) - } - disabled={disabled} - /> + + + {execExpanded ? ( +
+

+ Where the agent's tools and code run, and what that sandbox may + touch. +

+
+ {sandboxProps.kind && ( + + setSection("sandbox", {...sandbox, kind: v}) + } + withTooltip={withTooltip} + disabled={disabled} + /> + )} + {sandboxProps.permissions ? ( +
+ {permissionOverrideHint} + | null) ?? null + } + onChange={(v) => + setSection("sandbox", { + ...sandbox, + permissions: v, + }) + } + disabled={disabled} + /> +
+ ) : null}
- ) : null} -
+
+ ) : null}
) : null} {hasPermissionsGroup ? ( -
-
+
+
-

- What the agent may do on its own before it must ask. -

-
- {headlessSchema ? ( - isPiHarness ? ( -
- - Permission policy isn't used by the Pi harness. -
- ) : ( - - setSection("runner", { - ...runner, - interactions: {...runnerInteractions, headless: v}, - }) - } - withTooltip={withTooltip} - disabled={disabled} - /> - ) - ) : null} - {hasClaudePermissions ? ( -
-
- - Claude permissions - - - Claude harness - -
- - | undefined - )?.default_mode - } - /> + {!permsExpanded ? ( + + Auto + + ) : ( + + )} + + + {permsExpanded ? ( +
+

+ What the agent may do on its own before it must ask. +

+
+ {headlessSchema ? ( + isPiHarness ? ( +
+ + Permission policy isn't used by the Pi harness. +
+ ) : ( + + setSection("runner", { + ...runner, + interactions: { + ...runnerInteractions, + headless: v, + }, + }) + } + withTooltip={withTooltip} + disabled={disabled} + /> + ) + ) : null} + {hasClaudePermissions ? ( +
+
+ + Claude permissions + + + Claude harness + +
+ + | undefined + )?.default_mode + } + /> +
+ ) : null}
- ) : null} -
+
+ ) : null}
) : null}