diff --git a/api/openapi/markdown/console-swagger.md b/api/openapi/markdown/console-swagger.md index da9b3d7d66..249a0feb8b 100644 --- a/api/openapi/markdown/console-swagger.md +++ b/api/openapi/markdown/console-swagger.md @@ -10705,6 +10705,44 @@ Supported icon storage formats for Agent roster entries. | skills_files | [AgentSoulSkillsFilesConfig](#agentsoulskillsfilesconfig) | | No | | tools | [AgentSoulToolsConfig](#agentsoultoolsconfig) | | No | +#### AgentSoulDifyToolConfig + +One Dify Plugin Tool configured on Agent Soul. + +The API backend prepares this persisted product shape into +``DifyPluginToolConfig`` before sending a run request to Agent backend. +``provider_id`` keeps compatibility with existing Agent tool config payloads; +new callers should send ``plugin_id`` + ``provider`` when available. + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| credential_ref | [AgentSoulDifyToolCredentialRef](#agentsouldifytoolcredentialref) | | No | +| credential_type | string | *Enum:* `"api-key"`, `"oauth2"`, `"unauthorized"` | No | +| description | string | | No | +| enabled | boolean | | No | +| name | string | | No | +| parameter_overrides | object | | No | +| plugin_id | string | | No | +| provider | string | | No | +| provider_id | string | | No | +| provider_type | string | | No | +| runtime_parameters | object | | No | +| tool_name | string | | Yes | + +#### AgentSoulDifyToolCredentialRef + +Reference to a stored Dify Plugin Tool credential. + +Secret values are resolved only at runtime. The legacy ``credential_id`` +field is accepted by :class:`AgentSoulDifyToolConfig` and normalized here so +old Agent tool payloads can be read while new payloads stay explicit. + +| Name | Type | Description | Required | +| ---- | ---- | ----------- | -------- | +| id | string | | No | +| provider | string | | No | +| type | string | *Enum:* `"provider"`, `"tool"` | No | + #### AgentSoulEnvConfig | Name | Type | Description | Required | @@ -10782,7 +10820,7 @@ Reference to model credentials resolved only at runtime. | Name | Type | Description | Required | | ---- | ---- | ----------- | -------- | | cli_tools | [ object ] | | No | -| dify_tools | [ object ] | | No | +| dify_tools | [ [AgentSoulDifyToolConfig](#agentsouldifytoolconfig) ] | | No | #### AgentThought diff --git a/packages/contracts/generated/api/console/agents/types.gen.ts b/packages/contracts/generated/api/console/agents/types.gen.ts index 8a4540f933..330ee24840 100644 --- a/packages/contracts/generated/api/console/agents/types.gen.ts +++ b/packages/contracts/generated/api/console/agents/types.gen.ts @@ -121,9 +121,7 @@ export type AgentSoulToolsConfig = { cli_tools?: Array<{ [key: string]: unknown }> - dify_tools?: Array<{ - [key: string]: unknown - }> + dify_tools?: Array } export type AgentKnowledgeQueryMode = 'generated_query' | 'user_query' @@ -134,6 +132,32 @@ export type AgentSoulModelCredentialRef = { type: string } +export type AgentSoulDifyToolConfig = { + credential_ref?: AgentSoulDifyToolCredentialRef + credential_type?: 'api-key' | 'oauth2' | 'unauthorized' + description?: string | null + enabled?: boolean + name?: string | null + parameter_overrides?: { + [key: string]: unknown + } + plugin_id?: string | null + provider?: string | null + provider_id?: string | null + provider_type?: string + runtime_parameters?: { + [key: string]: unknown + } + tool_name: string + [key: string]: unknown +} + +export type AgentSoulDifyToolCredentialRef = { + id?: string | null + provider?: string | null + type?: 'provider' | 'tool' +} + export type GetAgentsData = { body?: never path?: never diff --git a/packages/contracts/generated/api/console/agents/zod.gen.ts b/packages/contracts/generated/api/console/agents/zod.gen.ts index f84b5fc411..503f99f487 100644 --- a/packages/contracts/generated/api/console/agents/zod.gen.ts +++ b/packages/contracts/generated/api/console/agents/zod.gen.ts @@ -78,14 +78,6 @@ export const zAgentSoulSkillsFilesConfig = z.object({ skills: z.array(z.record(z.string(), z.unknown())).optional(), }) -/** - * AgentSoulToolsConfig - */ -export const zAgentSoulToolsConfig = z.object({ - cli_tools: z.array(z.record(z.string(), z.unknown())).optional(), - dify_tools: z.array(z.record(z.string(), z.unknown())).optional(), -}) - /** * AgentKnowledgeQueryMode */ @@ -124,6 +116,54 @@ export const zAgentSoulModelConfig = z.object({ plugin_id: z.string().min(1).max(255), }) +/** + * AgentSoulDifyToolCredentialRef + * + * Reference to a stored Dify Plugin Tool credential. + * + * Secret values are resolved only at runtime. The legacy ``credential_id`` + * field is accepted by :class:`AgentSoulDifyToolConfig` and normalized here so + * old Agent tool payloads can be read while new payloads stay explicit. + */ +export const zAgentSoulDifyToolCredentialRef = z.object({ + id: z.string().max(255).nullish(), + provider: z.string().max(255).nullish(), + type: z.enum(['provider', 'tool']).optional().default('tool'), +}) + +/** + * AgentSoulDifyToolConfig + * + * One Dify Plugin Tool configured on Agent Soul. + * + * The API backend prepares this persisted product shape into + * ``DifyPluginToolConfig`` before sending a run request to Agent backend. + * ``provider_id`` keeps compatibility with existing Agent tool config payloads; + * new callers should send ``plugin_id`` + ``provider`` when available. + */ +export const zAgentSoulDifyToolConfig = z.object({ + credential_ref: zAgentSoulDifyToolCredentialRef.optional(), + credential_type: z.enum(['api-key', 'oauth2', 'unauthorized']).optional().default('api-key'), + description: z.string().nullish(), + enabled: z.boolean().optional().default(true), + name: z.string().max(255).nullish(), + parameter_overrides: z.record(z.string(), z.unknown()).optional(), + plugin_id: z.string().max(255).nullish(), + provider: z.string().max(255).nullish(), + provider_id: z.string().max(255).nullish(), + provider_type: z.string().optional().default('builtin'), + runtime_parameters: z.record(z.string(), z.unknown()).optional(), + tool_name: z.string().min(1).max(255), +}) + +/** + * AgentSoulToolsConfig + */ +export const zAgentSoulToolsConfig = z.object({ + cli_tools: z.array(z.record(z.string(), z.unknown())).optional(), + dify_tools: z.array(zAgentSoulDifyToolConfig).optional(), +}) + /** * AgentSoulConfig */ diff --git a/packages/contracts/generated/api/console/apps/types.gen.ts b/packages/contracts/generated/api/console/apps/types.gen.ts index fb65c57af3..3dc1396ce4 100644 --- a/packages/contracts/generated/api/console/apps/types.gen.ts +++ b/packages/contracts/generated/api/console/apps/types.gen.ts @@ -1430,9 +1430,7 @@ export type AgentSoulToolsConfig = { cli_tools?: Array<{ [key: string]: unknown }> - dify_tools?: Array<{ - [key: string]: unknown - }> + dify_tools?: Array } export type DeclaredOutputConfig = { @@ -1525,6 +1523,26 @@ export type AgentSoulModelCredentialRef = { type: string } +export type AgentSoulDifyToolConfig = { + credential_ref?: AgentSoulDifyToolCredentialRef + credential_type?: 'api-key' | 'oauth2' | 'unauthorized' + description?: string | null + enabled?: boolean + name?: string | null + parameter_overrides?: { + [key: string]: unknown + } + plugin_id?: string | null + provider?: string | null + provider_id?: string | null + provider_type?: string + runtime_parameters?: { + [key: string]: unknown + } + tool_name: string + [key: string]: unknown +} + export type DeclaredArrayItem = { description?: string | null type: DeclaredOutputType @@ -1562,6 +1580,12 @@ export type UserActionConfig = { export type FormInputConfig = unknown +export type AgentSoulDifyToolCredentialRef = { + id?: string | null + provider?: string | null + type?: 'provider' | 'tool' +} + 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 af299d2bcd..95600c836e 100644 --- a/packages/contracts/generated/api/console/apps/zod.gen.ts +++ b/packages/contracts/generated/api/console/apps/zod.gen.ts @@ -1533,14 +1533,6 @@ export const zAgentSoulSkillsFilesConfig = z.object({ skills: z.array(z.record(z.string(), z.unknown())).optional(), }) -/** - * AgentSoulToolsConfig - */ -export const zAgentSoulToolsConfig = z.object({ - cli_tools: z.array(z.record(z.string(), z.unknown())).optional(), - dify_tools: z.array(z.record(z.string(), z.unknown())).optional(), -}) - /** * WorkflowNodeJobMode */ @@ -1771,25 +1763,6 @@ export const zAgentSoulModelConfig = z.object({ plugin_id: z.string().min(1).max(255), }) -/** - * AgentSoulConfig - */ -export const zAgentSoulConfig = z.object({ - app_features: z.record(z.string(), z.unknown()).optional(), - app_variables: z.array(zAppVariableConfig).optional(), - env: zAgentSoulEnvConfig.optional(), - human: zAgentSoulHumanConfig.optional(), - knowledge: zAgentSoulKnowledgeConfig.optional(), - memory: zAgentSoulMemoryConfig.optional(), - misc_legacy: z.record(z.string(), z.unknown()).optional(), - model: zAgentSoulModelConfig.optional(), - prompt: zAgentSoulPromptConfig.optional(), - sandbox: zAgentSoulSandboxConfig.optional(), - schema_version: z.int().optional().default(1), - skills_files: zAgentSoulSkillsFilesConfig.optional(), - tools: zAgentSoulToolsConfig.optional(), -}) - /** * DeclaredOutputCheckConfig * @@ -1842,6 +1815,73 @@ export const zDeclaredArrayItem = z.object({ export const zFormInputConfig = z.unknown() +/** + * AgentSoulDifyToolCredentialRef + * + * Reference to a stored Dify Plugin Tool credential. + * + * Secret values are resolved only at runtime. The legacy ``credential_id`` + * field is accepted by :class:`AgentSoulDifyToolConfig` and normalized here so + * old Agent tool payloads can be read while new payloads stay explicit. + */ +export const zAgentSoulDifyToolCredentialRef = z.object({ + id: z.string().max(255).nullish(), + provider: z.string().max(255).nullish(), + type: z.enum(['provider', 'tool']).optional().default('tool'), +}) + +/** + * AgentSoulDifyToolConfig + * + * One Dify Plugin Tool configured on Agent Soul. + * + * The API backend prepares this persisted product shape into + * ``DifyPluginToolConfig`` before sending a run request to Agent backend. + * ``provider_id`` keeps compatibility with existing Agent tool config payloads; + * new callers should send ``plugin_id`` + ``provider`` when available. + */ +export const zAgentSoulDifyToolConfig = z.object({ + credential_ref: zAgentSoulDifyToolCredentialRef.optional(), + credential_type: z.enum(['api-key', 'oauth2', 'unauthorized']).optional().default('api-key'), + description: z.string().nullish(), + enabled: z.boolean().optional().default(true), + name: z.string().max(255).nullish(), + parameter_overrides: z.record(z.string(), z.unknown()).optional(), + plugin_id: z.string().max(255).nullish(), + provider: z.string().max(255).nullish(), + provider_id: z.string().max(255).nullish(), + provider_type: z.string().optional().default('builtin'), + runtime_parameters: z.record(z.string(), z.unknown()).optional(), + tool_name: z.string().min(1).max(255), +}) + +/** + * AgentSoulToolsConfig + */ +export const zAgentSoulToolsConfig = z.object({ + cli_tools: z.array(z.record(z.string(), z.unknown())).optional(), + dify_tools: z.array(zAgentSoulDifyToolConfig).optional(), +}) + +/** + * AgentSoulConfig + */ +export const zAgentSoulConfig = z.object({ + app_features: z.record(z.string(), z.unknown()).optional(), + app_variables: z.array(zAppVariableConfig).optional(), + env: zAgentSoulEnvConfig.optional(), + human: zAgentSoulHumanConfig.optional(), + knowledge: zAgentSoulKnowledgeConfig.optional(), + memory: zAgentSoulMemoryConfig.optional(), + misc_legacy: z.record(z.string(), z.unknown()).optional(), + model: zAgentSoulModelConfig.optional(), + prompt: zAgentSoulPromptConfig.optional(), + sandbox: zAgentSoulSandboxConfig.optional(), + schema_version: z.int().optional().default(1), + skills_files: zAgentSoulSkillsFilesConfig.optional(), + tools: zAgentSoulToolsConfig.optional(), +}) + /** * OutputErrorStrategy *