From b545a9ea93f51432910add18d008b8f5f7dd4be3 Mon Sep 17 00:00:00 2001 From: zyssyz123 <916125788@qq.com> Date: Thu, 25 Jun 2026 19:43:17 +0800 Subject: [PATCH] fix(agent): accept files section in agent soul (#37947) --- api/models/agent_config_entities.py | 6 +++++ .../agent/test_agent_composer_entities.py | 18 +++++++++++++ .../generated/api/console/agent/types.gen.ts | 20 +++++++++++++++ .../generated/api/console/agent/zod.gen.ts | 25 +++++++++++++++++++ .../generated/api/console/apps/types.gen.ts | 20 +++++++++++++++ .../generated/api/console/apps/zod.gen.ts | 25 +++++++++++++++++++ 6 files changed, 114 insertions(+) diff --git a/api/models/agent_config_entities.py b/api/models/agent_config_entities.py index 2f81495e9f9..c1faa5a6975 100644 --- a/api/models/agent_config_entities.py +++ b/api/models/agent_config_entities.py @@ -162,6 +162,11 @@ class AgentSkillRefConfig(AgentFlexibleConfig): manifest_files: list[str] | None = None +class AgentSoulFilesConfig(BaseModel): + skills: list[AgentSkillRefConfig] = Field(default_factory=list) + files: list[AgentFileRefConfig] = Field(default_factory=list) + + class AgentPermissionConfig(BaseModel): model_config = ConfigDict(extra="ignore") @@ -677,6 +682,7 @@ class AgentSoulConfig(BaseModel): knowledge: AgentSoulKnowledgeConfig = Field(default_factory=AgentSoulKnowledgeConfig) human: AgentSoulHumanConfig = Field(default_factory=AgentSoulHumanConfig) env: AgentSoulEnvConfig = Field(default_factory=AgentSoulEnvConfig) + files: AgentSoulFilesConfig = Field(default_factory=AgentSoulFilesConfig) sandbox: AgentSoulSandboxConfig = Field(default_factory=AgentSoulSandboxConfig) memory: AgentSoulMemoryConfig = Field(default_factory=AgentSoulMemoryConfig) model: AgentSoulModelConfig | None = None diff --git a/api/tests/unit_tests/services/agent/test_agent_composer_entities.py b/api/tests/unit_tests/services/agent/test_agent_composer_entities.py index de77da5ef99..43323ca49b4 100644 --- a/api/tests/unit_tests/services/agent/test_agent_composer_entities.py +++ b/api/tests/unit_tests/services/agent/test_agent_composer_entities.py @@ -27,6 +27,24 @@ def test_workflow_variant_rejects_agent_app_only_fields(): ) +def test_workflow_variant_accepts_agent_soul_files_section(): + payload = ComposerSavePayload.model_validate( + { + "variant": ComposerVariant.WORKFLOW, + "save_strategy": ComposerSaveStrategy.NODE_JOB_ONLY, + "agent_soul": { + "schema_version": 1, + "prompt": {"system_prompt": "jjjj"}, + "files": {"skills": [], "files": []}, + }, + } + ) + + assert payload.agent_soul is not None + assert payload.agent_soul.files.skills == [] + assert payload.agent_soul.files.files == [] + + def test_agent_app_variant_rejects_workflow_node_job(): with pytest.raises(ValueError): ComposerSavePayload.model_validate( diff --git a/packages/contracts/generated/api/console/agent/types.gen.ts b/packages/contracts/generated/api/console/agent/types.gen.ts index 0ed40efed16..b7bb7886ea1 100644 --- a/packages/contracts/generated/api/console/agent/types.gen.ts +++ b/packages/contracts/generated/api/console/agent/types.gen.ts @@ -544,6 +544,7 @@ export type AgentSoulConfig = { app_features?: AgentSoulAppFeaturesConfig app_variables?: Array env?: AgentSoulEnvConfig + files?: AgentSoulFilesConfig human?: AgentSoulHumanConfig knowledge?: AgentSoulKnowledgeConfig memory?: AgentSoulMemoryConfig @@ -555,6 +556,11 @@ export type AgentSoulConfig = { tools?: AgentSoulToolsConfig } +export type AgentSoulFilesConfig = { + files?: Array + skills?: Array +} + export type ComposerBindingPayload = { agent_id?: string | null binding_type: 'inline_agent' | 'roster_agent' @@ -1429,6 +1435,20 @@ export type AgentFileRefConfig = { [key: string]: unknown } +export type AgentSkillRefConfig = { + description?: string | null + file_id?: string | null + full_archive_file_id?: string | null + full_archive_key?: string | null + id?: string | null + manifest_files?: Array | null + name?: string | null + path?: string | null + skill_md_file_id?: string | null + skill_md_key?: string | null + [key: string]: unknown +} + export type AgentCliToolAuthorizationStatus = | 'allowed' | 'authorized' diff --git a/packages/contracts/generated/api/console/agent/zod.gen.ts b/packages/contracts/generated/api/console/agent/zod.gen.ts index 47a067a348c..7fc2ef994c8 100644 --- a/packages/contracts/generated/api/console/agent/zod.gen.ts +++ b/packages/contracts/generated/api/console/agent/zod.gen.ts @@ -1465,6 +1465,30 @@ export const zAgentFileRefConfig = z.object({ url: z.string().nullish(), }) +/** + * AgentSkillRefConfig + */ +export const zAgentSkillRefConfig = z.object({ + description: z.string().nullish(), + file_id: z.string().max(255).nullish(), + full_archive_file_id: z.string().max(255).nullish(), + full_archive_key: z.string().max(512).nullish(), + id: z.string().max(255).nullish(), + manifest_files: z.array(z.string()).nullish(), + name: z.string().max(255).nullish(), + path: z.string().nullish(), + skill_md_file_id: z.string().max(255).nullish(), + skill_md_key: z.string().max(512).nullish(), +}) + +/** + * AgentSoulFilesConfig + */ +export const zAgentSoulFilesConfig = z.object({ + files: z.array(zAgentFileRefConfig).optional(), + skills: z.array(zAgentSkillRefConfig).optional(), +}) + /** * WorkflowNodeJobMetadata */ @@ -2122,6 +2146,7 @@ export const zAgentSoulConfig = z.object({ app_features: zAgentSoulAppFeaturesConfig.optional(), app_variables: z.array(zAppVariableConfig).optional(), env: zAgentSoulEnvConfig.optional(), + files: zAgentSoulFilesConfig.optional(), human: zAgentSoulHumanConfig.optional(), knowledge: zAgentSoulKnowledgeConfig.optional(), memory: zAgentSoulMemoryConfig.optional(), diff --git a/packages/contracts/generated/api/console/apps/types.gen.ts b/packages/contracts/generated/api/console/apps/types.gen.ts index 0a7db919b16..720d9095518 100644 --- a/packages/contracts/generated/api/console/apps/types.gen.ts +++ b/packages/contracts/generated/api/console/apps/types.gen.ts @@ -1812,6 +1812,7 @@ export type AgentSoulConfig = { app_features?: AgentSoulAppFeaturesConfig app_variables?: Array env?: AgentSoulEnvConfig + files?: AgentSoulFilesConfig human?: AgentSoulHumanConfig knowledge?: AgentSoulKnowledgeConfig memory?: AgentSoulMemoryConfig @@ -1823,6 +1824,11 @@ export type AgentSoulConfig = { tools?: AgentSoulToolsConfig } +export type AgentSoulFilesConfig = { + files?: Array + skills?: Array +} + export type AgentComposerBindingResponse = { agent_id?: string | null binding_type: WorkflowAgentBindingType @@ -2501,6 +2507,20 @@ export type AgentFileRefConfig = { [key: string]: unknown } +export type AgentSkillRefConfig = { + description?: string | null + file_id?: string | null + full_archive_file_id?: string | null + full_archive_key?: string | null + id?: string | null + manifest_files?: Array | null + name?: string | null + path?: string | null + skill_md_file_id?: string | null + skill_md_key?: string | null + [key: string]: unknown +} + export type OutputErrorStrategy = 'default_value' | 'fail_branch' | 'stop' export type DeclaredOutputRetryConfig = { diff --git a/packages/contracts/generated/api/console/apps/zod.gen.ts b/packages/contracts/generated/api/console/apps/zod.gen.ts index c57f5e799b3..a5c20e46624 100644 --- a/packages/contracts/generated/api/console/apps/zod.gen.ts +++ b/packages/contracts/generated/api/console/apps/zod.gen.ts @@ -2853,6 +2853,30 @@ export const zAgentFileRefConfig = z.object({ url: z.string().nullish(), }) +/** + * AgentSkillRefConfig + */ +export const zAgentSkillRefConfig = z.object({ + description: z.string().nullish(), + file_id: z.string().max(255).nullish(), + full_archive_file_id: z.string().max(255).nullish(), + full_archive_key: z.string().max(512).nullish(), + id: z.string().max(255).nullish(), + manifest_files: z.array(z.string()).nullish(), + name: z.string().max(255).nullish(), + path: z.string().nullish(), + skill_md_file_id: z.string().max(255).nullish(), + skill_md_key: z.string().max(512).nullish(), +}) + +/** + * AgentSoulFilesConfig + */ +export const zAgentSoulFilesConfig = z.object({ + files: z.array(zAgentFileRefConfig).optional(), + skills: z.array(zAgentSkillRefConfig).optional(), +}) + /** * WorkflowNodeJobMetadata */ @@ -3599,6 +3623,7 @@ export const zAgentSoulConfig = z.object({ app_features: zAgentSoulAppFeaturesConfig.optional(), app_variables: z.array(zAppVariableConfig).optional(), env: zAgentSoulEnvConfig.optional(), + files: zAgentSoulFilesConfig.optional(), human: zAgentSoulHumanConfig.optional(), knowledge: zAgentSoulKnowledgeConfig.optional(), memory: zAgentSoulMemoryConfig.optional(),