Skip to content

Feat/add param dynamic tree select#725

Open
zyqzyq wants to merge 5 commits into
langgenius:mainfrom
zyqzyq:feat/add_param_dynamic_tree_select
Open

Feat/add param dynamic tree select#725
zyqzyq wants to merge 5 commits into
langgenius:mainfrom
zyqzyq:feat/add_param_dynamic_tree_select

Conversation

@zyqzyq
Copy link
Copy Markdown

@zyqzyq zyqzyq commented May 6, 2026

Description

Add dynamic-tree-select parameter type support to the plugin daemon, enabling tool/trigger/agent-strategy parameters to render hierarchical tree-structured options with dynamic loading. This is the plugin-daemon counterpart of the Dify main repo change in #35837.

Fixes langgenius/dify#35837

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • Other

Essential Checklist

Testing

  • I have tested the changes locally and confirmed they work as expected
  • I have added unit tests where necessary and they pass successfully

Bug Fix (if applicable)

  • I have used GitHub syntax to close the related issue (e.g., Fixes #123 or Closes #123)

Additional Information

Changes

  1. pkg/entities/plugin_entities/constant.go — Add DYNAMIC_TREE_SELECT = "dynamic-tree-select" constant and Children []ParameterOption field to ParameterOption struct for hierarchical data support
  2. pkg/entities/plugin_entities/tool_declaration.go — Add TOOL_PARAMETER_TYPE_DYNAMIC_TREE_SELECT constant and register it in isToolParameterType validator
  3. pkg/entities/plugin_entities/trigger_declaration.go — Add EVENT_PARAMETER_TYPE_DYNAMIC_TREE_SELECT constant and register it in isEventParameterType validator
  4. pkg/entities/plugin_entities/agent_declaration.go — Add AGENT_STRATEGY_PARAMETER_TYPE_DYNAMIC_TREE_SELECT constant and register it in isAgentStrategyParameterType validator
  5. pkg/entities/requests/dynamic_select.go — Add Parent *string field to RequestDynamicParameterSelect for lazy-loading child nodes

Key design

  • The new dynamic-tree-select type extends the existing dynamic-select pattern by adding a children field to ParameterOption, enabling recursive tree structures
  • The optional parent field in the request allows plugins to implement lazy-loading of child nodes on demand
  • The parameter type is registered across tool, trigger, and agent-strategy parameter systems for consistency

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request go Pull requests that update go code plugin-daemon labels May 6, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the DYNAMIC_TREE_SELECT parameter type for agent strategies, tools, and triggers, while adding a Parent field to dynamic parameter select requests. The ParameterOption struct now supports hierarchical data via a recursive Children field. Feedback points out that EventParameterOption in trigger_declaration.go lacks a similar Children field, creating an inconsistency that prevents triggers from supporting hierarchical options.

EVENT_PARAMETER_TYPE_DYNAMIC_SELECT EventParameterType = DYNAMIC_SELECT
EVENT_PARAMETER_TYPE_CHECKBOX EventParameterType = CHECKBOX
EVENT_PARAMETER_TYPE_DYNAMIC_SELECT EventParameterType = DYNAMIC_SELECT
EVENT_PARAMETER_TYPE_DYNAMIC_TREE_SELECT EventParameterType = DYNAMIC_TREE_SELECT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dynamic-tree-select parameter type is being added to triggers, but the EventParameterOption struct (defined earlier in this file and used by EventParameter.Options) has not been updated to include a Children field. This is inconsistent with the changes made to ParameterOption in constant.go, which now supports hierarchy for tools and agent strategies. To ensure triggers can also support hierarchical options in their declarations, EventParameterOption should be updated to include a recursive Children field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code plugin-daemon size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add tool plugin param dynamic-tree-select support tree param

1 participant