From 8f89a6179b5504618b44a2e7cd38fc1d73e11bb8 Mon Sep 17 00:00:00 2001 From: zyqzyq Date: Mon, 27 Apr 2026 19:54:24 +0800 Subject: [PATCH 1/2] feat: add param type dynamic-tree-select --- pkg/entities/plugin_entities/agent_declaration.go | 8 +++++--- pkg/entities/plugin_entities/constant.go | 12 +++++++----- pkg/entities/plugin_entities/tool_declaration.go | 8 +++++--- pkg/entities/plugin_entities/trigger_declaration.go | 6 ++++-- pkg/entities/requests/dynamic_select.go | 1 + 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/pkg/entities/plugin_entities/agent_declaration.go b/pkg/entities/plugin_entities/agent_declaration.go index 7c008c08b..94a37d693 100644 --- a/pkg/entities/plugin_entities/agent_declaration.go +++ b/pkg/entities/plugin_entities/agent_declaration.go @@ -29,8 +29,9 @@ const ( AGENT_STRATEGY_PARAMETER_TYPE_FILES AgentStrategyParameterType = FILES AGENT_STRATEGY_PARAMETER_TYPE_APP_SELECTOR AgentStrategyParameterType = APP_SELECTOR AGENT_STRATEGY_PARAMETER_TYPE_MODEL_SELECTOR AgentStrategyParameterType = MODEL_SELECTOR - AGENT_STRATEGY_PARAMETER_TYPE_TOOLS_SELECTOR AgentStrategyParameterType = TOOLS_SELECTOR - AGENT_STRATEGY_PARAMETER_TYPE_ANY AgentStrategyParameterType = ANY + AGENT_STRATEGY_PARAMETER_TYPE_TOOLS_SELECTOR AgentStrategyParameterType = TOOLS_SELECTOR + AGENT_STRATEGY_PARAMETER_TYPE_ANY AgentStrategyParameterType = ANY + AGENT_STRATEGY_PARAMETER_TYPE_DYNAMIC_TREE_SELECT AgentStrategyParameterType = DYNAMIC_TREE_SELECT ) func isAgentStrategyParameterType(fl validator.FieldLevel) bool { @@ -47,7 +48,8 @@ func isAgentStrategyParameterType(fl validator.FieldLevel) bool { string(AGENT_STRATEGY_PARAMETER_TYPE_APP_SELECTOR), string(AGENT_STRATEGY_PARAMETER_TYPE_MODEL_SELECTOR), string(AGENT_STRATEGY_PARAMETER_TYPE_TOOLS_SELECTOR), - string(AGENT_STRATEGY_PARAMETER_TYPE_ANY): + string(AGENT_STRATEGY_PARAMETER_TYPE_ANY), + string(AGENT_STRATEGY_PARAMETER_TYPE_DYNAMIC_TREE_SELECT): return true } return false diff --git a/pkg/entities/plugin_entities/constant.go b/pkg/entities/plugin_entities/constant.go index 2a44f0795..2b1b3f0ec 100644 --- a/pkg/entities/plugin_entities/constant.go +++ b/pkg/entities/plugin_entities/constant.go @@ -15,14 +15,16 @@ const ( TOOLS_SELECTOR = "array[tools]" ANY = "any" // DynamicSelect - DYNAMIC_SELECT = "dynamic-select" - ARRAY = "array" + DYNAMIC_SELECT = "dynamic-select" + DYNAMIC_TREE_SELECT = "dynamic-tree-select" + ARRAY = "array" OBJECT = "object" CHECKBOX = "checkbox" ) type ParameterOption struct { - Value string `json:"value" yaml:"value" validate:"required"` - Label I18nObject `json:"label" yaml:"label" validate:"required"` - Icon string `json:"icon" yaml:"icon" validate:"omitempty"` + Value string `json:"value" yaml:"value" validate:"required"` + Label I18nObject `json:"label" yaml:"label" validate:"required"` + Icon string `json:"icon" yaml:"icon" validate:"omitempty"` + Children []ParameterOption `json:"children,omitempty" yaml:"children,omitempty" validate:"omitempty,dive"` } diff --git a/pkg/entities/plugin_entities/tool_declaration.go b/pkg/entities/plugin_entities/tool_declaration.go index 41891b369..6bddb271d 100644 --- a/pkg/entities/plugin_entities/tool_declaration.go +++ b/pkg/entities/plugin_entities/tool_declaration.go @@ -45,9 +45,10 @@ const ( TOOL_PARAMETER_TYPE_APP_SELECTOR ToolParameterType = APP_SELECTOR TOOL_PARAMETER_TYPE_MODEL_SELECTOR ToolParameterType = MODEL_SELECTOR // TOOL_PARAMETER_TYPE_TOOL_SELECTOR ToolParameterType = TOOL_SELECTOR - TOOL_PARAMETER_TYPE_ANY ToolParameterType = ANY - TOOL_PARAMETER_TYPE_DYNAMIC_SELECT ToolParameterType = DYNAMIC_SELECT - TOOL_PARAMETER_ARRAY ToolParameterType = ARRAY + TOOL_PARAMETER_TYPE_ANY ToolParameterType = ANY + TOOL_PARAMETER_TYPE_DYNAMIC_SELECT ToolParameterType = DYNAMIC_SELECT + TOOL_PARAMETER_TYPE_DYNAMIC_TREE_SELECT ToolParameterType = DYNAMIC_TREE_SELECT + TOOL_PARAMETER_ARRAY ToolParameterType = ARRAY TOOL_PARAMETER_OBJECT ToolParameterType = OBJECT TOOL_PARAMETER_TYPE_CHECKBOX ToolParameterType = CHECKBOX ) @@ -67,6 +68,7 @@ func isToolParameterType(fl validator.FieldLevel) bool { string(TOOL_PARAMETER_TYPE_MODEL_SELECTOR), string(TOOL_PARAMETER_TYPE_ANY), string(TOOL_PARAMETER_TYPE_DYNAMIC_SELECT), + string(TOOL_PARAMETER_TYPE_DYNAMIC_TREE_SELECT), string(TOOL_PARAMETER_ARRAY), string(TOOL_PARAMETER_OBJECT), string(TOOL_PARAMETER_TYPE_CHECKBOX): diff --git a/pkg/entities/plugin_entities/trigger_declaration.go b/pkg/entities/plugin_entities/trigger_declaration.go index 6982e6cad..a9c91db2d 100644 --- a/pkg/entities/plugin_entities/trigger_declaration.go +++ b/pkg/entities/plugin_entities/trigger_declaration.go @@ -37,8 +37,9 @@ const ( EVENT_PARAMETER_TYPE_APP_SELECTOR EventParameterType = APP_SELECTOR EVENT_PARAMETER_TYPE_OBJECT EventParameterType = OBJECT EVENT_PARAMETER_TYPE_ARRAY EventParameterType = ARRAY - 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 + EVENT_PARAMETER_TYPE_CHECKBOX EventParameterType = CHECKBOX ) func isEventParameterType(fl validator.FieldLevel) bool { @@ -55,6 +56,7 @@ func isEventParameterType(fl validator.FieldLevel) bool { string(EVENT_PARAMETER_TYPE_OBJECT), string(EVENT_PARAMETER_TYPE_ARRAY), string(EVENT_PARAMETER_TYPE_DYNAMIC_SELECT), + string(EVENT_PARAMETER_TYPE_DYNAMIC_TREE_SELECT), string(EVENT_PARAMETER_TYPE_CHECKBOX): return true } diff --git a/pkg/entities/requests/dynamic_select.go b/pkg/entities/requests/dynamic_select.go index 315db9eec..5c8d24b05 100644 --- a/pkg/entities/requests/dynamic_select.go +++ b/pkg/entities/requests/dynamic_select.go @@ -6,4 +6,5 @@ type RequestDynamicParameterSelect struct { Provider string `json:"provider" validate:"required"` ProviderAction string `json:"provider_action" validate:"required"` Parameter string `json:"parameter" validate:"required"` + Parent *string `json:"parent,omitempty" validate:"omitempty"` } From 890cd2b08f01ef575c642fa33d109bb0d9e6e53b Mon Sep 17 00:00:00 2001 From: zyqzyq Date: Wed, 13 May 2026 17:22:25 +0800 Subject: [PATCH 2/2] support param paramter_values and dynamic_select_lazy_load --- .../plugin_entities/tool_declaration.go | 41 ++++++++++--------- pkg/entities/requests/dynamic_select.go | 13 +++--- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/pkg/entities/plugin_entities/tool_declaration.go b/pkg/entities/plugin_entities/tool_declaration.go index 6bddb271d..e57adb314 100644 --- a/pkg/entities/plugin_entities/tool_declaration.go +++ b/pkg/entities/plugin_entities/tool_declaration.go @@ -45,12 +45,12 @@ const ( TOOL_PARAMETER_TYPE_APP_SELECTOR ToolParameterType = APP_SELECTOR TOOL_PARAMETER_TYPE_MODEL_SELECTOR ToolParameterType = MODEL_SELECTOR // TOOL_PARAMETER_TYPE_TOOL_SELECTOR ToolParameterType = TOOL_SELECTOR - TOOL_PARAMETER_TYPE_ANY ToolParameterType = ANY - TOOL_PARAMETER_TYPE_DYNAMIC_SELECT ToolParameterType = DYNAMIC_SELECT + TOOL_PARAMETER_TYPE_ANY ToolParameterType = ANY + TOOL_PARAMETER_TYPE_DYNAMIC_SELECT ToolParameterType = DYNAMIC_SELECT TOOL_PARAMETER_TYPE_DYNAMIC_TREE_SELECT ToolParameterType = DYNAMIC_TREE_SELECT TOOL_PARAMETER_ARRAY ToolParameterType = ARRAY - TOOL_PARAMETER_OBJECT ToolParameterType = OBJECT - TOOL_PARAMETER_TYPE_CHECKBOX ToolParameterType = CHECKBOX + TOOL_PARAMETER_OBJECT ToolParameterType = OBJECT + TOOL_PARAMETER_TYPE_CHECKBOX ToolParameterType = CHECKBOX ) func isToolParameterType(fl validator.FieldLevel) bool { @@ -124,22 +124,23 @@ type ParameterTemplate struct { } type ToolParameter struct { - Name string `json:"name" yaml:"name" validate:"required,gt=0,lt=1024"` - Label I18nObject `json:"label" yaml:"label" validate:"required"` - HumanDescription I18nObject `json:"human_description" yaml:"human_description" validate:"required"` - Type ToolParameterType `json:"type" yaml:"type" validate:"required,tool_parameter_type"` - Scope *string `json:"scope" yaml:"scope" validate:"omitempty,max=1024,is_scope"` - Form ToolParameterForm `json:"form" yaml:"form" validate:"required,tool_parameter_form"` - LLMDescription string `json:"llm_description" yaml:"llm_description" validate:"omitempty"` - Required bool `json:"required" yaml:"required"` - AutoGenerate *ParameterAutoGenerate `json:"auto_generate" yaml:"auto_generate" validate:"omitempty"` - Template *ParameterTemplate `json:"template" yaml:"template" validate:"omitempty"` - Default any `json:"default" yaml:"default" validate:"omitempty"` - Min *float64 `json:"min" yaml:"min" validate:"omitempty"` - Max *float64 `json:"max" yaml:"max" validate:"omitempty"` - Multiple bool `json:"multiple" yaml:"multiple" validate:"omitempty"` - Precision *int `json:"precision" yaml:"precision" validate:"omitempty"` - Options []ParameterOption `json:"options" yaml:"options" validate:"omitempty,dive"` + Name string `json:"name" yaml:"name" validate:"required,gt=0,lt=1024"` + Label I18nObject `json:"label" yaml:"label" validate:"required"` + HumanDescription I18nObject `json:"human_description" yaml:"human_description" validate:"required"` + Type ToolParameterType `json:"type" yaml:"type" validate:"required,tool_parameter_type"` + Scope *string `json:"scope" yaml:"scope" validate:"omitempty,max=1024,is_scope"` + Form ToolParameterForm `json:"form" yaml:"form" validate:"required,tool_parameter_form"` + LLMDescription string `json:"llm_description" yaml:"llm_description" validate:"omitempty"` + Required bool `json:"required" yaml:"required"` + AutoGenerate *ParameterAutoGenerate `json:"auto_generate" yaml:"auto_generate" validate:"omitempty"` + Template *ParameterTemplate `json:"template" yaml:"template" validate:"omitempty"` + Default any `json:"default" yaml:"default" validate:"omitempty"` + Min *float64 `json:"min" yaml:"min" validate:"omitempty"` + Max *float64 `json:"max" yaml:"max" validate:"omitempty"` + Multiple bool `json:"multiple" yaml:"multiple" validate:"omitempty"` + Precision *int `json:"precision" yaml:"precision" validate:"omitempty"` + Options []ParameterOption `json:"options" yaml:"options" validate:"omitempty,dive"` + DynamicSelectLazyLoad bool `json:"dynamic_select_lazy_load,omitempty" yaml:"dynamic_select_lazy_load,omitempty" validate:"omitempty"` } type ToolDescription struct { diff --git a/pkg/entities/requests/dynamic_select.go b/pkg/entities/requests/dynamic_select.go index 5c8d24b05..7853ee264 100644 --- a/pkg/entities/requests/dynamic_select.go +++ b/pkg/entities/requests/dynamic_select.go @@ -1,10 +1,11 @@ package requests type RequestDynamicParameterSelect struct { - Credentials map[string]any `json:"credentials" validate:"required"` - CredentialType string `json:"credential_type,omitempty" validate:"omitempty"` - Provider string `json:"provider" validate:"required"` - ProviderAction string `json:"provider_action" validate:"required"` - Parameter string `json:"parameter" validate:"required"` - Parent *string `json:"parent,omitempty" validate:"omitempty"` + Credentials map[string]any `json:"credentials" validate:"required"` + CredentialType string `json:"credential_type,omitempty" validate:"omitempty"` + Provider string `json:"provider" validate:"required"` + ProviderAction string `json:"provider_action" validate:"required"` + Parameter string `json:"parameter" validate:"required"` + Parent *string `json:"parent,omitempty" validate:"omitempty"` + ParameterValues map[string]any `json:"parameter_values,omitempty" validate:"omitempty"` }