From 37648ed682e3b43b2a893d273ad03229f8f404cf Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 18 Sep 2026 15:35:54 +0200 Subject: [PATCH] fix: hide tool controls a nested AI agent cannot use Co-Authored-By: Claude Opus 5 --- .../lib/components/flows/content/AiAgentStepInputs.svelte | 7 ++++++- .../components/flows/content/FlowModuleComponent.svelte | 2 +- .../src/lib/components/flows/map/InsertModuleInner.svelte | 1 + .../src/lib/components/flows/pickers/TopLevelNode.svelte | 7 +++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/components/flows/content/AiAgentStepInputs.svelte b/frontend/src/lib/components/flows/content/AiAgentStepInputs.svelte index 37fcfe8d1c..e23981d3ba 100644 --- a/frontend/src/lib/components/flows/content/AiAgentStepInputs.svelte +++ b/frontend/src/lib/components/flows/content/AiAgentStepInputs.svelte @@ -226,10 +226,15 @@ }) }) + // No editor adds tools to an agent used as a tool, so its Tools section only shows the ones + // written into the flow by hand, read-only. + let toolsHidden = $derived(isAgentTool && tools.length === 0) let scopedFields = $derived( AGENT_FIELDS.filter( (spec) => - agentFieldAppliesTo(spec, schemaProperties) && (!filter || filter.includes(spec.key)) + agentFieldAppliesTo(spec, schemaProperties) && + (!filter || filter.includes(spec.key)) && + !(toolsHidden && spec.group === 'tools') ) ) diff --git a/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte b/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte index 6c2093caa6..0024d5b1a6 100644 --- a/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte +++ b/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte @@ -1246,7 +1246,7 @@ linkedToolsModuleId ) : (flowModule.value.tools ?? [])} - onSelectTool={noToolNavigation + onSelectTool={noToolNavigation || isAgentTool ? undefined : (toolId) => selectionManager.selectId(toolId, { openPanel: true })} onAddTool={flowModuleSchemaMap diff --git a/frontend/src/lib/components/flows/map/InsertModuleInner.svelte b/frontend/src/lib/components/flows/map/InsertModuleInner.svelte index 7c75d97fab..f08e2f9f77 100644 --- a/frontend/src/lib/components/flows/map/InsertModuleInner.svelte +++ b/frontend/src/lib/components/flows/map/InsertModuleInner.svelte @@ -232,6 +232,7 @@ /> { dispatch('pickAiAgentTool') dispatch('close') diff --git a/frontend/src/lib/components/flows/pickers/TopLevelNode.svelte b/frontend/src/lib/components/flows/pickers/TopLevelNode.svelte index 8cd69e9e18..627b7c2174 100644 --- a/frontend/src/lib/components/flows/pickers/TopLevelNode.svelte +++ b/frontend/src/lib/components/flows/pickers/TopLevelNode.svelte @@ -22,11 +22,14 @@ /** Highlight with the neutral hover surface instead of the accent, for transient * (hover/keyboard) selection rather than the persistent category selection. */ neutral?: boolean + /** Overrides the label's default chevron, for an entry that inserts directly here instead of + * opening a sub-menu. */ + chevron?: boolean onSelect: () => void onHover?: () => void } - let { label, selected, returnIcon, neutral = false, onSelect, onHover }: Props = $props() + let { label, selected, returnIcon, neutral = false, chevron, onSelect, onHover }: Props = $props() interface IconConfig { icon: ComponentType @@ -73,7 +76,7 @@ > {#if config} - {@render iconWithText(config.icon, config.showChevron, config.iconClass ?? '')} + {@render iconWithText(config.icon, chevron ?? config.showChevron, config.iconClass ?? '')} {/if} {#if returnIcon && selected}