mirror of
https://github.com/langgenius/dify.git
synced 2026-06-09 17:32:00 +08:00
262 lines
7.1 KiB
TypeScript
262 lines
7.1 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import * as z from 'zod'
|
|
|
|
/**
|
|
* AgentIconType
|
|
*
|
|
* Supported icon storage formats for Agent roster entries.
|
|
*/
|
|
export const zAgentIconType = z.enum(['emoji', 'image', 'link'])
|
|
|
|
/**
|
|
* RosterAgentUpdatePayload
|
|
*/
|
|
export const zRosterAgentUpdatePayload = z.object({
|
|
description: z.string().nullish(),
|
|
icon: z.string().max(255).nullish(),
|
|
icon_background: z.string().max(255).nullish(),
|
|
icon_type: zAgentIconType.optional(),
|
|
name: z.string().min(1).max(255).nullish(),
|
|
})
|
|
|
|
/**
|
|
* AppVariableConfig
|
|
*/
|
|
export const zAppVariableConfig = z.object({
|
|
default: z.unknown().optional(),
|
|
name: z.string().min(1).max(255),
|
|
required: z.boolean().optional().default(false),
|
|
type: z.string().min(1).max(64),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulEnvConfig
|
|
*/
|
|
export const zAgentSoulEnvConfig = z.object({
|
|
secret_refs: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
variables: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulHumanConfig
|
|
*/
|
|
export const zAgentSoulHumanConfig = z.object({
|
|
contacts: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
tools: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulMemoryConfig
|
|
*/
|
|
export const zAgentSoulMemoryConfig = z.object({
|
|
artifacts: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
budget: z.string().nullish(),
|
|
scope: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulPromptConfig
|
|
*/
|
|
export const zAgentSoulPromptConfig = z.object({
|
|
system_prompt: z.string().optional().default(''),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulSandboxConfig
|
|
*/
|
|
export const zAgentSoulSandboxConfig = z.object({
|
|
config: z.record(z.string(), z.unknown()).optional(),
|
|
provider: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulSkillsFilesConfig
|
|
*/
|
|
export const zAgentSoulSkillsFilesConfig = z.object({
|
|
files: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
skills: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
})
|
|
|
|
/**
|
|
* AgentKnowledgeQueryMode
|
|
*/
|
|
export const zAgentKnowledgeQueryMode = z.enum(['generated_query', 'user_query'])
|
|
|
|
/**
|
|
* AgentSoulKnowledgeConfig
|
|
*/
|
|
export const zAgentSoulKnowledgeConfig = z.object({
|
|
datasets: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
query_config: z.record(z.string(), z.unknown()).optional(),
|
|
query_mode: zAgentKnowledgeQueryMode.optional(),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulModelCredentialRef
|
|
*
|
|
* Reference to model credentials resolved only at runtime.
|
|
*/
|
|
export const zAgentSoulModelCredentialRef = z.object({
|
|
id: z.string().max(255).nullish(),
|
|
provider: z.string().max(255).nullish(),
|
|
type: z.string().min(1).max(64),
|
|
})
|
|
|
|
/**
|
|
* AgentSoulModelConfig
|
|
*
|
|
* Stable model selection for Agent runtime without storing secret values.
|
|
*/
|
|
export const zAgentSoulModelConfig = z.object({
|
|
credential_ref: zAgentSoulModelCredentialRef.optional(),
|
|
model: z.string().min(1).max(255),
|
|
model_provider: z.string().min(1).max(255),
|
|
model_settings: z.record(z.string(), z.unknown()).optional(),
|
|
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(),
|
|
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('plugin'),
|
|
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(),
|
|
})
|
|
|
|
/**
|
|
* RosterAgentCreatePayload
|
|
*/
|
|
export const zRosterAgentCreatePayload = z.object({
|
|
agent_soul: zAgentSoulConfig.optional(),
|
|
description: z.string().optional().default(''),
|
|
icon: z.string().max(255).nullish(),
|
|
icon_background: z.string().max(255).nullish(),
|
|
icon_type: zAgentIconType.optional(),
|
|
name: z.string().min(1).max(255),
|
|
version_note: z.string().nullish(),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zGetAgentsResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zPostAgentsBody = zRosterAgentCreatePayload
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zPostAgentsResponse = z.record(z.string(), z.unknown())
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zGetAgentsInviteOptionsResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zDeleteAgentsByAgentIdPath = z.object({
|
|
agent_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zDeleteAgentsByAgentIdResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zGetAgentsByAgentIdPath = z.object({
|
|
agent_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zGetAgentsByAgentIdResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zPatchAgentsByAgentIdBody = zRosterAgentUpdatePayload
|
|
|
|
export const zPatchAgentsByAgentIdPath = z.object({
|
|
agent_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zPatchAgentsByAgentIdResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zGetAgentsByAgentIdVersionsPath = z.object({
|
|
agent_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zGetAgentsByAgentIdVersionsResponse = z.record(z.string(), z.unknown())
|
|
|
|
export const zGetAgentsByAgentIdVersionsByVersionIdPath = z.object({
|
|
agent_id: z.string(),
|
|
version_id: z.string(),
|
|
})
|
|
|
|
/**
|
|
* Success
|
|
*/
|
|
export const zGetAgentsByAgentIdVersionsByVersionIdResponse = z.record(z.string(), z.unknown())
|