chore(agent-v2): sync changes (#38442)

Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: zyssyz123 <916125788@qq.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: 林玮 (Jade Lin) <linw1995@icloud.com>
Co-authored-by: 盐粒 Yanli <mail@yanli.one>
This commit is contained in:
yyh
2026-07-06 13:51:33 +00:00
committed by GitHub
co-authored by Joel zyssyz123 autofix-ci[bot] 林玮 盐粒 Yanli
parent bdb3469ca0
commit d0ea5a5e0d
180 changed files with 4929 additions and 1512 deletions
@@ -1178,11 +1178,11 @@ export const read = {
}
/**
* Upload one Agent App sandbox file as a Dify ToolFile mapping
* Upload one Agent App sandbox file and return a signed download URL
*/
export const post16 = oc
.route({
description: 'Upload one Agent App sandbox file as a Dify ToolFile mapping',
description: 'Upload one Agent App sandbox file and return a signed download URL',
inputStructure: 'detailed',
method: 'POST',
operationId: 'postAgentByAgentIdSandboxFilesUpload',
@@ -442,8 +442,7 @@ export type AgentSandboxUploadPayload = {
}
export type SandboxUploadResponse = {
file: SandboxToolFileResponse
path: string
url: string
}
export type AgentSkillUploadResponse = {
@@ -1008,11 +1007,6 @@ export type SandboxFileEntryResponse = {
type: 'dir' | 'file' | 'other' | 'symlink'
}
export type SandboxToolFileResponse = {
reference: string
transfer_method?: 'tool_file'
}
export type SkillManifest = {
description: string
entry_path: string
@@ -1116,6 +1110,7 @@ export type AgentSource = 'agent_app' | 'imported' | 'roster' | 'system' | 'work
export type AgentStatus = 'active' | 'archived'
export type AgentSoulAppFeaturesConfig = {
file_upload?: AgentFileUploadFeatureConfig
opening_statement?: string | null
retriever_resource?: AgentFeatureToggleConfig | null
sensitive_word_avoidance?: AgentSensitiveWordAvoidanceFeatureConfig | null
@@ -1428,6 +1423,16 @@ export type AgentConfigRevisionOperation
| 'save_new_version'
| 'save_to_roster'
export type AgentFileUploadFeatureConfig = {
allowed_file_extensions?: Array<string>
allowed_file_types?: Array<FileType>
allowed_file_upload_methods?: Array<FileTransferMethod>
enabled?: boolean
image?: AgentFileUploadImageFeatureConfig
number_limits?: number
[key: string]: unknown
}
export type AgentSecretRefConfig = {
credential_id?: string | null
env_name?: string | null
@@ -1679,6 +1684,15 @@ export type FormInputConfig
export type JsonValue2 = unknown
export type FileType = 'audio' | 'custom' | 'document' | 'image' | 'video'
export type FileTransferMethod = 'datasource_file' | 'local_file' | 'remote_url' | 'tool_file'
export type AgentFileUploadImageFeatureConfig = {
enabled?: boolean
[key: string]: unknown
}
export type AgentKnowledgeDatasetConfig = {
description?: string | null
id?: string | null
@@ -1801,10 +1815,6 @@ export type StringListSource = {
value?: Array<string>
}
export type FileType = 'audio' | 'custom' | 'document' | 'image' | 'video'
export type FileTransferMethod = 'datasource_file' | 'local_file' | 'remote_url' | 'tool_file'
export type AgentKnowledgeMetadataCondition = {
comparison_operator:
| '<'
@@ -212,6 +212,13 @@ export const zAgentSandboxUploadPayload = z.object({
path: z.string().min(1),
})
/**
* SandboxUploadResponse
*/
export const zSandboxUploadResponse = z.object({
url: z.string(),
})
/**
* AgentConfigSnapshotRestoreResponse
*/
@@ -865,22 +872,6 @@ export const zSandboxListResponse = z.object({
truncated: z.boolean().optional().default(false),
})
/**
* SandboxToolFileResponse
*/
export const zSandboxToolFileResponse = z.object({
reference: z.string(),
transfer_method: z.literal('tool_file').optional().default('tool_file'),
})
/**
* SandboxUploadResponse
*/
export const zSandboxUploadResponse = z.object({
file: zSandboxToolFileResponse,
path: z.string(),
})
/**
* SkillManifest
*
@@ -1926,19 +1917,6 @@ export const zAgentAppFeaturesPayload = z.object({
text_to_speech: zAgentTextToSpeechFeatureConfig.nullish(),
})
/**
* AgentSoulAppFeaturesConfig
*/
export const zAgentSoulAppFeaturesConfig = z.object({
opening_statement: z.string().nullish(),
retriever_resource: zAgentFeatureToggleConfig.nullish(),
sensitive_word_avoidance: zAgentSensitiveWordAvoidanceFeatureConfig.nullish(),
speech_to_text: zAgentFeatureToggleConfig.nullish(),
suggested_questions: z.array(z.string()).nullish(),
suggested_questions_after_answer: zAgentSuggestedQuestionsAfterAnswerFeatureConfig.nullish(),
text_to_speech: zAgentTextToSpeechFeatureConfig.nullish(),
})
export const zJsonValue2 = z.unknown()
/**
@@ -1953,6 +1931,54 @@ export const zHumanInputFormSubmissionData = z.object({
submitted_data: z.record(z.string(), zJsonValue2).nullish(),
})
/**
* FileType
*/
export const zFileType = z.enum(['audio', 'custom', 'document', 'image', 'video'])
/**
* FileTransferMethod
*/
export const zFileTransferMethod = z.enum([
'datasource_file',
'local_file',
'remote_url',
'tool_file',
])
/**
* AgentFileUploadImageFeatureConfig
*/
export const zAgentFileUploadImageFeatureConfig = z.object({
enabled: z.boolean().optional().default(true),
})
/**
* AgentFileUploadFeatureConfig
*/
export const zAgentFileUploadFeatureConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
enabled: z.boolean().optional().default(true),
image: zAgentFileUploadImageFeatureConfig.optional(),
number_limits: z.int().optional().default(3),
})
/**
* AgentSoulAppFeaturesConfig
*/
export const zAgentSoulAppFeaturesConfig = z.object({
file_upload: zAgentFileUploadFeatureConfig.optional(),
opening_statement: z.string().nullish(),
retriever_resource: zAgentFeatureToggleConfig.nullish(),
sensitive_word_avoidance: zAgentSensitiveWordAvoidanceFeatureConfig.nullish(),
speech_to_text: zAgentFeatureToggleConfig.nullish(),
suggested_questions: z.array(z.string()).nullish(),
suggested_questions_after_answer: zAgentSuggestedQuestionsAfterAnswerFeatureConfig.nullish(),
text_to_speech: zAgentTextToSpeechFeatureConfig.nullish(),
})
/**
* AgentKnowledgeDatasetConfig
*/
@@ -2182,6 +2208,29 @@ export const zUserActionConfig = z.object({
title: z.string().max(100),
})
/**
* FileInputConfig
*/
export const zFileInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
output_variable_name: z.string(),
type: z.literal('file').optional().default('file'),
})
/**
* FileListInputConfig
*/
export const zFileListInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
number_limits: z.int().gte(0).optional().default(0),
output_variable_name: z.string(),
type: z.literal('file-list').optional().default('file-list'),
})
/**
* AgentKnowledgeModelConfig
*/
@@ -2204,8 +2253,9 @@ export const zAgentKnowledgeQueryMode = z.enum(['generated_query', 'user_query']
*
* Agent v2 stores knowledge as explicit ``knowledge.sets`` rather than the
* legacy flat ``datasets`` / ``query_mode`` / ``query_config`` shape. Each
* set owns its own query policy, so ``user_query`` must carry an explicit
* ``value`` while ``generated_query`` leaves that value empty.
* set owns its own query policy. Mode-dependent completeness, such as
* requiring ``value`` for ``user_query``, is enforced by composer publish
* validation so draft saves can persist partially configured knowledge sets.
*/
export const zAgentKnowledgeQueryConfig = z.object({
mode: zAgentKnowledgeQueryMode,
@@ -2235,8 +2285,9 @@ export const zAgentKnowledgeWeightedScoreConfig = z.object({
* Per-set retrieval policy for Agent v2 knowledge retrieval.
*
* Retrieval settings now live on each knowledge set instead of one shared
* flat config. A set may use either ``multiple`` retrieval with ``top_k`` or
* ``single`` retrieval with a required model config.
* flat config. Mode-dependent completeness, such as requiring ``top_k`` for
* ``multiple`` or a model for ``single``, is enforced by composer publish
* validation so draft saves can persist partially configured knowledge sets.
*/
export const zAgentKnowledgeRetrievalConfig = z.object({
mode: z.enum(['multiple', 'single']),
@@ -2249,44 +2300,6 @@ export const zAgentKnowledgeRetrievalConfig = z.object({
weights: zAgentKnowledgeWeightedScoreConfig.nullish(),
})
/**
* FileType
*/
export const zFileType = z.enum(['audio', 'custom', 'document', 'image', 'video'])
/**
* FileTransferMethod
*/
export const zFileTransferMethod = z.enum([
'datasource_file',
'local_file',
'remote_url',
'tool_file',
])
/**
* FileInputConfig
*/
export const zFileInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
output_variable_name: z.string(),
type: z.literal('file').optional().default('file'),
})
/**
* FileListInputConfig
*/
export const zFileListInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
number_limits: z.int().gte(0).optional().default(0),
output_variable_name: z.string(),
type: z.literal('file-list').optional().default('file-list'),
})
/**
* AgentKnowledgeMetadataCondition
*/
@@ -2331,6 +2344,8 @@ export const zAgentKnowledgeMetadataConditions = z.object({
* The Python attribute uses ``metadata_model_config`` for clarity because the
* model belongs to metadata filtering specifically, while the external API and
* generated schema keep the historical ``model_config`` field name via alias.
* Mode-dependent completeness is enforced by composer publish validation so
* draft saves can persist partially configured metadata filters.
*/
export const zAgentKnowledgeMetadataFilteringConfig = z.object({
conditions: zAgentKnowledgeMetadataConditions.nullish(),
@@ -3029,11 +3029,11 @@ export const read = {
}
/**
* Upload one workflow Agent sandbox file as a Dify ToolFile mapping
* Upload one workflow Agent sandbox file and return a signed download URL
*/
export const post41 = oc
.route({
description: 'Upload one workflow Agent sandbox file as a Dify ToolFile mapping',
description: 'Upload one workflow Agent sandbox file and return a signed download URL',
inputStructure: 'detailed',
method: 'POST',
operationId: 'postAppsByAppIdWorkflowRunsByWorkflowRunIdAgentNodesByNodeIdSandboxFilesUpload',
@@ -873,8 +873,7 @@ export type WorkflowAgentSandboxUploadPayload = {
}
export type SandboxUploadResponse = {
file: SandboxToolFileResponse
path: string
url: string
}
export type WorkflowCommentBasicList = {
@@ -1807,11 +1806,6 @@ export type SandboxFileEntryResponse = {
type: 'dir' | 'file' | 'other' | 'symlink'
}
export type SandboxToolFileResponse = {
reference: string
transfer_method?: 'tool_file'
}
export type WorkflowCommentBasic = {
content: string
created_at?: number | null
@@ -2368,6 +2362,7 @@ export type AgentSource = 'agent_app' | 'imported' | 'roster' | 'system' | 'work
export type AgentStatus = 'active' | 'archived'
export type AgentSoulAppFeaturesConfig = {
file_upload?: AgentFileUploadFeatureConfig
opening_statement?: string | null
retriever_resource?: AgentFeatureToggleConfig | null
sensitive_word_avoidance?: AgentSensitiveWordAvoidanceFeatureConfig | null
@@ -2627,6 +2622,16 @@ export type WorkflowFileUploadPreviewConfigPayload = {
mode?: string | null
}
export type AgentFileUploadFeatureConfig = {
allowed_file_extensions?: Array<string>
allowed_file_types?: Array<FileType>
allowed_file_upload_methods?: Array<FileTransferMethod>
enabled?: boolean
image?: AgentFileUploadImageFeatureConfig
number_limits?: number
[key: string]: unknown
}
export type AgentFeatureToggleConfig = {
enabled?: boolean
[key: string]: unknown
@@ -2873,6 +2878,15 @@ export type FileListInputConfig = {
type?: 'file-list'
}
export type FileType = 'audio' | 'custom' | 'document' | 'image' | 'video'
export type FileTransferMethod = 'datasource_file' | 'local_file' | 'remote_url' | 'tool_file'
export type AgentFileUploadImageFeatureConfig = {
enabled?: boolean
[key: string]: unknown
}
export type AgentModerationProviderConfig = {
api_based_extension_id?: string | null
inputs_config?: AgentModerationIoConfig | null
@@ -2942,10 +2956,6 @@ export type StringListSource = {
value?: Array<string>
}
export type FileType = 'audio' | 'custom' | 'document' | 'image' | 'video'
export type FileTransferMethod = 'datasource_file' | 'local_file' | 'remote_url' | 'tool_file'
export type AgentModerationIoConfig = {
enabled?: boolean
preset_response?: string | null
@@ -564,6 +564,13 @@ export const zWorkflowAgentSandboxUploadPayload = z.object({
path: z.string().min(1),
})
/**
* SandboxUploadResponse
*/
export const zSandboxUploadResponse = z.object({
url: z.string(),
})
/**
* WorkflowCommentCreatePayload
*/
@@ -1673,22 +1680,6 @@ export const zSandboxListResponse = z.object({
truncated: z.boolean().optional().default(false),
})
/**
* SandboxToolFileResponse
*/
export const zSandboxToolFileResponse = z.object({
reference: z.string(),
transfer_method: z.literal('tool_file').optional().default('tool_file'),
})
/**
* SandboxUploadResponse
*/
export const zSandboxUploadResponse = z.object({
file: zSandboxToolFileResponse,
path: z.string(),
})
/**
* AccountWithRoleResponse
*/
@@ -3466,6 +3457,63 @@ export const zUserActionConfig = z.object({
title: z.string().max(100),
})
/**
* FileType
*/
export const zFileType = z.enum(['audio', 'custom', 'document', 'image', 'video'])
/**
* FileTransferMethod
*/
export const zFileTransferMethod = z.enum([
'datasource_file',
'local_file',
'remote_url',
'tool_file',
])
/**
* FileInputConfig
*/
export const zFileInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
output_variable_name: z.string(),
type: z.literal('file').optional().default('file'),
})
/**
* FileListInputConfig
*/
export const zFileListInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
number_limits: z.int().gte(0).optional().default(0),
output_variable_name: z.string(),
type: z.literal('file-list').optional().default('file-list'),
})
/**
* AgentFileUploadImageFeatureConfig
*/
export const zAgentFileUploadImageFeatureConfig = z.object({
enabled: z.boolean().optional().default(true),
})
/**
* AgentFileUploadFeatureConfig
*/
export const zAgentFileUploadFeatureConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
enabled: z.boolean().optional().default(true),
image: zAgentFileUploadImageFeatureConfig.optional(),
number_limits: z.int().optional().default(3),
})
/**
* AgentSuggestedQuestionsAfterAnswerModelConfig
*
@@ -3662,44 +3710,6 @@ export const zAgentSoulToolsConfig = z.object({
dify_tools: z.array(zAgentSoulDifyToolConfig).optional(),
})
/**
* FileType
*/
export const zFileType = z.enum(['audio', 'custom', 'document', 'image', 'video'])
/**
* FileTransferMethod
*/
export const zFileTransferMethod = z.enum([
'datasource_file',
'local_file',
'remote_url',
'tool_file',
])
/**
* FileInputConfig
*/
export const zFileInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
output_variable_name: z.string(),
type: z.literal('file').optional().default('file'),
})
/**
* FileListInputConfig
*/
export const zFileListInputConfig = z.object({
allowed_file_extensions: z.array(z.string()).optional(),
allowed_file_types: z.array(zFileType).optional(),
allowed_file_upload_methods: z.array(zFileTransferMethod).optional(),
number_limits: z.int().gte(0).optional().default(0),
output_variable_name: z.string(),
type: z.literal('file-list').optional().default('file-list'),
})
/**
* AgentModerationIOConfig
*/
@@ -3731,6 +3741,7 @@ export const zAgentSensitiveWordAvoidanceFeatureConfig = z.object({
* AgentSoulAppFeaturesConfig
*/
export const zAgentSoulAppFeaturesConfig = z.object({
file_upload: zAgentFileUploadFeatureConfig.optional(),
opening_statement: z.string().nullish(),
retriever_resource: zAgentFeatureToggleConfig.nullish(),
sensitive_word_avoidance: zAgentSensitiveWordAvoidanceFeatureConfig.nullish(),
@@ -3762,8 +3773,9 @@ export const zAgentKnowledgeQueryMode = z.enum(['generated_query', 'user_query']
*
* Agent v2 stores knowledge as explicit ``knowledge.sets`` rather than the
* legacy flat ``datasets`` / ``query_mode`` / ``query_config`` shape. Each
* set owns its own query policy, so ``user_query`` must carry an explicit
* ``value`` while ``generated_query`` leaves that value empty.
* set owns its own query policy. Mode-dependent completeness, such as
* requiring ``value`` for ``user_query``, is enforced by composer publish
* validation so draft saves can persist partially configured knowledge sets.
*/
export const zAgentKnowledgeQueryConfig = z.object({
mode: zAgentKnowledgeQueryMode,
@@ -3793,8 +3805,9 @@ export const zAgentKnowledgeWeightedScoreConfig = z.object({
* Per-set retrieval policy for Agent v2 knowledge retrieval.
*
* Retrieval settings now live on each knowledge set instead of one shared
* flat config. A set may use either ``multiple`` retrieval with ``top_k`` or
* ``single`` retrieval with a required model config.
* flat config. Mode-dependent completeness, such as requiring ``top_k`` for
* ``multiple`` or a model for ``single``, is enforced by composer publish
* validation so draft saves can persist partially configured knowledge sets.
*/
export const zAgentKnowledgeRetrievalConfig = z.object({
mode: z.enum(['multiple', 'single']),
@@ -3972,6 +3985,8 @@ export const zAgentKnowledgeMetadataConditions = z.object({
* The Python attribute uses ``metadata_model_config`` for clarity because the
* model belongs to metadata filtering specifically, while the external API and
* generated schema keep the historical ``model_config`` field name via alias.
* Mode-dependent completeness is enforced by composer publish validation so
* draft saves can persist partially configured metadata filters.
*/
export const zAgentKnowledgeMetadataFilteringConfig = z.object({
conditions: zAgentKnowledgeMetadataConditions.nullish(),
@@ -315,7 +315,8 @@ export type MessageMetadata = {
}
export type OpenApiErrorCode
= | 'app_unavailable'
= | 'agent_not_published'
| 'app_unavailable'
| 'bad_gateway'
| 'bad_request'
| 'completion_request_error'
@@ -398,6 +398,7 @@ export const zMemberRoleUpdatePayload = z.object({
* OpenApiErrorCode
*/
export const zOpenApiErrorCode = z.enum([
'agent_not_published',
'app_unavailable',
'bad_gateway',
'bad_request',