fix: hide tool controls a nested AI agent cannot use

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-09-18 15:35:54 +02:00
co-authored by Claude Opus 5
parent 01b38320ea
commit 37648ed682
4 changed files with 13 additions and 4 deletions
@@ -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')
)
)
@@ -1246,7 +1246,7 @@
linkedToolsModuleId
)
: (flowModule.value.tools ?? [])}
onSelectTool={noToolNavigation
onSelectTool={noToolNavigation || isAgentTool
? undefined
: (toolId) => selectionManager.selectId(toolId, { openPanel: true })}
onAddTool={flowModuleSchemaMap
@@ -232,6 +232,7 @@
/>
<TopLevelNode
label="AI Agent"
chevron={false}
onSelect={() => {
dispatch('pickAiAgentTool')
dispatch('close')
@@ -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 @@
>
<span class="grow min-w-0 flex items-center gap-2">
{#if config}
{@render iconWithText(config.icon, config.showChevron, config.iconClass ?? '')}
{@render iconWithText(config.icon, chevron ?? config.showChevron, config.iconClass ?? '')}
{/if}
</span>
{#if returnIcon && selected}