AI Catalog Item Enable Flow Logic
TL;DR
- Traced enable flow for Explore namespace (isGlobal=true) through ai_catalog_item_actions.vue and ai_catalog_item_consumer_modal.vue
- Traced enable flow for Project namespace (isGlobal=false, projectPath set), including showEnable conditions and useAddProjectModal branching
- Identified two modal paths: AiCatalogItemConsumerModal (enableGroupAndProject=true) vs AddProjectItemConsumerModal for pre-enabled groups
- ai_catalog_flows_show.vue and ai_catalog_agents_show.vue both implement addFlowToTarget/addAgentToTarget and addFlowToProject/addAgentToProject methods
- Compiled a scenario table mapping namespace/item type combinations to the modal used and resulting behavior
Explore Namespace Flow (isGlobal = true)
Looking at ai_catalog_item_actions.vue lines 165-166, showEnableFromGlobal is true when isGlobal && !item.foundational. At lines 202-203, useAddProjectModal returns false (since !this.isGlobal evaluates to false), so the flow uses AiCatalogItemConsumerModal instead. Line 215 shows enableModalProps returns { enableGroupAndProject: true }. Within ai_catalog_item_consumer_modal.vue, when enableGroupAndProject=true, the modal displays both group and project dropdowns along with their triggers.
Project Namespace Flow (isGlobal = false, projectPath set)
Lines 151-155 in ai_catalog_item_actions.vue show that showEnable is true when canAdminConsumer && !isGlobal && !isEnabled (for private items), or simply canAdminConsumer && !isGlobal (for public items). The useAddProjectModal logic at lines 202-203 works as follows: if hasParentConsumer=true AND !item.public, it uses AddProjectItemConsumerModal (the existing modal for cases where the group is already enabled); otherwise, it falls back to AiCatalogItemConsumerModal with enableGroupAndProject: true. Both ai_catalog_flows_show.vue and ai_catalog_agents_show.vue implement addFlowToTarget/addAgentToTarget (which handles group and project enablement in sequence) as well as addFlowToProject/addAgentToProject (which handles just the project consumer creation).
Scenario Summary Table
Explore namespace (public item): AiCatalogItemConsumerModal with enableGroupAndProject=true → Group+Project dropdowns, triggers. Explore namespace (private item): same modal → Static group/project (pre-selected), triggers. Project namespace (group NOT enabled): same modal → Enables group then project. Project namespace (group IS enabled, private): AddProjectItemConsumerModal → Just project selection.
ryer.io