dify/packages/contracts/generated/api/console/agent/zod.gen.ts
yyh f203ab7f1d
fix(agent-v2): include workflow references in agent list (#37567)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-06-17 05:56:53 +00:00

2416 lines
63 KiB
TypeScript

// This file is auto-generated by @hey-api/openapi-ts
import * as z from 'zod'
/**
* SuggestedQuestionsResponse
*/
export const zSuggestedQuestionsResponse = z.object({
data: z.array(z.string()),
})
/**
* SimpleResultResponse
*/
export const zSimpleResultResponse = z.object({
result: z.string(),
})
/**
* AgentDriveDownloadResponse
*/
export const zAgentDriveDownloadResponse = z.object({
url: z.string(),
})
/**
* AgentDrivePreviewResponse
*/
export const zAgentDrivePreviewResponse = z.object({
binary: z.boolean(),
key: z.string(),
size: z.int().nullish(),
text: z.string().nullish(),
truncated: z.boolean(),
})
/**
* MessageFeedbackPayload
*/
export const zMessageFeedbackPayload = z.object({
content: z.string().nullish(),
message_id: z.string(),
rating: z.enum(['dislike', 'like']).nullish(),
})
/**
* AgentDriveDeleteResponse
*/
export const zAgentDriveDeleteResponse = z.object({
config_version_id: z.string().nullish(),
removed_keys: z.array(z.string()).optional(),
result: z.string(),
})
/**
* AgentDriveFilePayload
*/
export const zAgentDriveFilePayload = z.object({
upload_file_id: z.string(),
})
/**
* SandboxReadResponse
*/
export const zSandboxReadResponse = z.object({
binary: z.boolean(),
path: z.string(),
size: z.int().nullish(),
text: z.string().nullish(),
truncated: z.boolean(),
})
/**
* AgentSandboxUploadPayload
*/
export const zAgentSandboxUploadPayload = z.object({
conversation_id: z.string().min(1),
path: z.string().min(1),
})
/**
* IconType
*/
export const zIconType = z.enum(['emoji', 'image', 'link'])
/**
* AgentAppCreatePayload
*/
export const zAgentAppCreatePayload = z.object({
description: z.string().max(400).nullish(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: zIconType.nullish(),
name: z.string().min(1),
role: z.string().max(255).optional().default(''),
})
/**
* AgentAppUpdatePayload
*/
export const zAgentAppUpdatePayload = z.object({
description: z.string().max(400).nullish(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: zIconType.nullish(),
max_active_requests: z.int().nullish(),
name: z.string().min(1),
role: z.string().max(255).nullish(),
use_icon_as_answer_icon: z.boolean().nullish(),
})
/**
* DeletedTool
*/
export const zDeletedTool = z.object({
provider_id: z.string(),
tool_name: z.string(),
type: z.string(),
})
/**
* Site
*/
export const zSite = z.object({
chat_color_theme: z.string().nullish(),
chat_color_theme_inverted: z.boolean(),
copyright: z.string().nullish(),
custom_disclaimer: z.string().nullish(),
default_language: z.string(),
description: z.string().nullish(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
icon_url: z.string().nullable(),
privacy_policy: z.string().nullish(),
show_workflow_steps: z.boolean(),
title: z.string(),
use_icon_as_answer_icon: z.boolean(),
})
/**
* Tag
*/
export const zTag = z.object({
id: z.string(),
name: z.string(),
type: z.string(),
})
export const zJsonValue = z
.union([
z.string(),
z.int(),
z.number(),
z.boolean(),
z.record(z.string(), z.unknown()),
z.array(z.unknown()),
])
.nullable()
/**
* WorkflowPartial
*/
export const zWorkflowPartial = z.object({
created_at: z.int().nullish(),
created_by: z.string().nullish(),
id: z.string(),
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
})
/**
* AgentConfigSnapshotSummaryResponse
*/
export const zAgentConfigSnapshotSummaryResponse = z.object({
agent_id: z.string().nullish(),
created_at: z.int().nullish(),
created_by: z.string().nullish(),
id: z.string(),
summary: z.string().nullish(),
version: z.int(),
version_note: z.string().nullish(),
})
/**
* AgentConfigSnapshotListResponse
*/
export const zAgentConfigSnapshotListResponse = z.object({
data: z.array(zAgentConfigSnapshotSummaryResponse),
})
/**
* ComposerSaveStrategy
*/
export const zComposerSaveStrategy = z.enum([
'node_job_only',
'save_as_new_agent',
'save_as_new_version',
'save_to_current_version',
'save_to_roster',
])
/**
* ComposerBindingPayload
*/
export const zComposerBindingPayload = z.object({
agent_id: z.string().nullish(),
binding_type: z.enum(['inline_agent', 'roster_agent']),
current_snapshot_id: z.string().nullish(),
})
/**
* ComposerSoulLockPayload
*/
export const zComposerSoulLockPayload = z.object({
locked: z.boolean().optional().default(true),
unlocked_from_version_id: z.string().nullish(),
})
/**
* ComposerVariant
*/
export const zComposerVariant = z.enum(['agent_app', 'workflow'])
/**
* ComposerCandidateCapabilities
*/
export const zComposerCandidateCapabilities = z.object({
human_roster_available: z.boolean().optional().default(false),
})
/**
* ComposerKnowledgePlaceholderResponse
*/
export const zComposerKnowledgePlaceholderResponse = z.object({
id: z.string(),
placeholder_name: z.string(),
})
/**
* ComposerValidationWarningResponse
*/
export const zComposerValidationWarningResponse = z.object({
code: z.string(),
id: z.string().nullish(),
kind: z.string().nullish(),
message: z.string().nullish(),
surface: z.string().nullish(),
})
/**
* AgentComposerValidateResponse
*/
export const zAgentComposerValidateResponse = z.object({
errors: z.array(z.string()).optional(),
knowledge_retrieval_placeholder: z.array(zComposerKnowledgePlaceholderResponse).optional(),
result: z.literal('success'),
warnings: z.array(zComposerValidationWarningResponse).optional(),
})
/**
* ComposerValidationFindingsResponse
*/
export const zComposerValidationFindingsResponse = z.object({
knowledge_retrieval_placeholder: z.array(zComposerKnowledgePlaceholderResponse).optional(),
warnings: z.array(zComposerValidationWarningResponse).optional(),
})
/**
* AgentDriveItemResponse
*/
export const zAgentDriveItemResponse = z.object({
created_at: z.int().nullish(),
file_kind: z.string(),
hash: z.string().nullish(),
key: z.string(),
mime_type: z.string().nullish(),
size: z.int().nullish(),
})
/**
* AgentDriveListResponse
*/
export const zAgentDriveListResponse = z.object({
items: z.array(zAgentDriveItemResponse).optional(),
})
/**
* AgentFeatureToggleConfig
*/
export const zAgentFeatureToggleConfig = z.object({
enabled: z.boolean().optional().default(false),
})
/**
* AgentTextToSpeechFeatureConfig
*/
export const zAgentTextToSpeechFeatureConfig = z.object({
autoPlay: z.string().nullish(),
enabled: z.boolean().optional().default(false),
language: z.string().nullish(),
voice: z.string().nullish(),
})
/**
* AgentDriveFileResponse
*/
export const zAgentDriveFileResponse = z.object({
drive_key: z.string(),
file_id: z.string(),
mime_type: z.string().nullish(),
name: z.string(),
size: z.int().nullish(),
})
/**
* AgentDriveFileCommitResponse
*/
export const zAgentDriveFileCommitResponse = z.object({
config_version_id: z.string().nullish(),
file: zAgentDriveFileResponse,
})
/**
* AgentLogItemResponse
*/
export const zAgentLogItemResponse = z.object({
answer: z.string(),
answer_tokens: z.int(),
conversation_id: z.string(),
conversation_name: z.string().nullish(),
created_at: z.int().nullish(),
currency: z.string(),
error: z.string().nullish(),
from_account_id: z.string().nullish(),
from_end_user_id: z.string().nullish(),
from_source: z.string().nullish(),
id: z.string(),
latency: z.number(),
message_id: z.string(),
message_tokens: z.int(),
query: z.string(),
source: z.string().nullish(),
status: z.string(),
total_price: z.string(),
total_tokens: z.int(),
updated_at: z.int().nullish(),
})
/**
* AgentLogListResponse
*/
export const zAgentLogListResponse = z.object({
data: z.array(zAgentLogItemResponse),
has_more: z.boolean(),
limit: z.int(),
page: z.int(),
total: z.int(),
})
/**
* AgentThought
*/
export const zAgentThought = z.object({
chain_id: z.string().nullish(),
created_at: z.int().nullish(),
files: z.array(z.string()),
id: z.string(),
message_chain_id: z.string().nullish(),
message_id: z.string(),
observation: z.string().nullish(),
position: z.int(),
thought: z.string().nullish(),
tool: z.string().nullish(),
tool_input: z.string().nullish(),
tool_labels: zJsonValue,
})
/**
* MessageFile
*/
export const zMessageFile = z.object({
belongs_to: z.string().nullish(),
filename: z.string(),
id: z.string(),
mime_type: z.string().nullish(),
size: z.int().nullish(),
transfer_method: z.string(),
type: z.string(),
upload_file_id: z.string().nullish(),
url: z.string().nullish(),
})
/**
* AgentReferencingWorkflowResponse
*/
export const zAgentReferencingWorkflowResponse = z.object({
app_icon: z.string().nullish(),
app_icon_background: z.string().nullish(),
app_icon_type: z.string().nullish(),
app_id: z.string(),
app_mode: z.string(),
app_name: z.string(),
app_updated_at: z.int().nullish(),
node_ids: z.array(z.string()).optional(),
workflow_id: z.string(),
workflow_version: z.string(),
})
/**
* AgentReferencingWorkflowsResponse
*/
export const zAgentReferencingWorkflowsResponse = z.object({
data: z.array(zAgentReferencingWorkflowResponse).optional(),
})
/**
* SandboxFileEntryResponse
*/
export const zSandboxFileEntryResponse = z.object({
mtime: z.int().nullish(),
name: z.string(),
size: z.int().nullish(),
type: z.enum(['dir', 'file', 'other', 'symlink']),
})
/**
* SandboxListResponse
*/
export const zSandboxListResponse = z.object({
entries: z.array(zSandboxFileEntryResponse).optional(),
path: z.string(),
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
*
* Validated metadata extracted from a Skill package.
*/
export const zSkillManifest = z.object({
description: z.string(),
entry_path: z.string(),
files: z.array(z.string()),
hash: z.string(),
name: z.string(),
size: z.int(),
})
/**
* 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(),
})
/**
* AgentSkillStandardizeResponse
*/
export const zAgentSkillStandardizeResponse = z.object({
manifest: zSkillManifest,
skill: zAgentSkillRefConfig,
})
/**
* AgentSkillUploadResponse
*/
export const zAgentSkillUploadResponse = z.object({
manifest: zSkillManifest,
skill: zAgentSkillRefConfig,
})
/**
* AgentStatisticSummaryResponse
*/
export const zAgentStatisticSummaryResponse = z.object({
average_response_time: z.number(),
average_session_interactions: z.number(),
currency: z.string(),
tokens_per_second: z.number(),
total_conversations: z.int(),
total_end_users: z.int(),
total_messages: z.int(),
total_price: z.string(),
total_tokens: z.int(),
user_satisfaction_rate: z.number(),
})
/**
* ModelConfigPartial
*/
export const zModelConfigPartial = z.object({
created_at: z.int().nullish(),
created_by: z.string().nullish(),
model: zJsonValue.nullish(),
pre_prompt: z.string().nullish(),
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
})
/**
* AgentAppPublishedReferenceResponse
*/
export const zAgentAppPublishedReferenceResponse = z.object({
app_icon: z.string().nullish(),
app_icon_background: z.string().nullish(),
app_icon_type: z.string().nullish(),
app_id: z.string(),
app_name: z.string(),
})
/**
* AgentAppPartial
*/
export const zAgentAppPartial = z.object({
access_mode: z.string().nullish(),
active_config_is_published: z.boolean().optional().default(false),
app_id: z.string().nullish(),
author_name: z.string().nullish(),
bound_agent_id: z.string().nullish(),
create_user_name: z.string().nullish(),
created_at: z.int().nullish(),
created_by: z.string().nullish(),
description: z.string().nullish(),
has_draft_trigger: z.boolean().nullish(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
icon_url: z.string().nullable(),
id: z.string(),
is_starred: z.boolean().optional().default(false),
max_active_requests: z.int().nullish(),
mode: z.string(),
model_config: zModelConfigPartial.nullish(),
name: z.string(),
published_reference_count: z.int().optional().default(0),
published_references: z.array(zAgentAppPublishedReferenceResponse).optional(),
role: z.string().nullish(),
tags: z.array(zTag).optional(),
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
use_icon_as_answer_icon: z.boolean().nullish(),
workflow: zWorkflowPartial.nullish(),
})
/**
* AgentAppPagination
*/
export const zAgentAppPagination = z.object({
data: z.array(zAgentAppPartial),
has_more: z.boolean(),
limit: z.int(),
page: z.int(),
total: z.int(),
})
/**
* LLMMode
*
* Enum class for large language model mode.
*/
export const zLlmMode = z.enum(['chat', 'completion'])
/**
* ModelConfig
*/
export const zModelConfig = z.object({
completion_params: z.record(z.string(), z.unknown()).optional(),
mode: zLlmMode,
name: z.string(),
provider: z.string(),
})
/**
* AppDetailWithSite
*/
export const zAppDetailWithSite = z.object({
access_mode: z.string().nullish(),
active_config_is_published: z.boolean().optional().default(false),
api_base_url: z.string().nullish(),
app_id: z.string().nullish(),
bound_agent_id: z.string().nullish(),
created_at: z.int().nullish(),
created_by: z.string().nullish(),
deleted_tools: z.array(zDeletedTool).optional(),
description: z.string().nullish(),
enable_api: z.boolean(),
enable_site: z.boolean(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
icon_url: z.string().nullable(),
id: z.string(),
max_active_requests: z.int().nullish(),
mode: z.string(),
model_config: zModelConfig.nullish(),
name: z.string(),
role: z.string().nullish(),
site: zSite.nullish(),
tags: z.array(zTag).optional(),
tracing: zJsonValue.nullish(),
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
use_icon_as_answer_icon: z.boolean().nullish(),
workflow: zWorkflowPartial.nullish(),
})
/**
* AgentKind
*
* Agent implementation family.
*
* This leaves room for future non-Dify agent implementations while keeping
* the current roster/workflow APIs scoped to Dify Agent.
*/
export const zAgentKind = z.enum(['dify_agent'])
/**
* AgentIconType
*
* Supported icon storage formats for Agent roster entries.
*/
export const zAgentIconType = z.enum(['emoji', 'image', 'link'])
/**
* AgentPublishedReferenceResponse
*/
export const zAgentPublishedReferenceResponse = z.object({
app_icon: z.string().nullish(),
app_icon_background: z.string().nullish(),
app_icon_type: z.string().nullish(),
app_id: z.string(),
app_mode: z.string(),
app_name: z.string(),
app_updated_at: z.int().nullish(),
node_ids: z.array(z.string()).optional(),
workflow_id: z.string(),
workflow_version: z.string(),
})
/**
* AgentScope
*
* Visibility and lifecycle scope of an Agent record.
*/
export const zAgentScope = z.enum(['roster', 'workflow_only'])
/**
* AgentSource
*
* Origin that created or imported the Agent.
*/
export const zAgentSource = z.enum(['agent_app', 'imported', 'roster', 'system', 'workflow'])
/**
* AgentStatus
*
* Soft lifecycle state for Agent records.
*/
export const zAgentStatus = z.enum(['active', 'archived'])
/**
* AgentInviteOptionResponse
*/
export const zAgentInviteOptionResponse = z.object({
active_config_is_published: z.boolean().optional().default(false),
active_config_snapshot: zAgentConfigSnapshotSummaryResponse.nullish(),
active_config_snapshot_id: z.string().nullish(),
agent_kind: zAgentKind,
app_id: z.string().nullish(),
archived_at: z.int().nullish(),
archived_by: z.string().nullish(),
created_at: z.int().nullish(),
created_by: z.string().nullish(),
description: z.string(),
existing_node_ids: z.array(z.string()).optional(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: zAgentIconType.nullish(),
id: z.string(),
in_current_workflow_count: z.int().optional().default(0),
is_in_current_workflow: z.boolean().optional().default(false),
name: z.string(),
published_node_reference_count: z.int().optional().default(0),
published_reference_count: z.int().optional().default(0),
published_references: z.array(zAgentPublishedReferenceResponse).optional(),
role: z.string().optional().default(''),
scope: zAgentScope,
source: zAgentSource,
status: zAgentStatus,
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
workflow_id: z.string().nullish(),
workflow_node_id: z.string().nullish(),
})
/**
* AgentInviteOptionsResponse
*/
export const zAgentInviteOptionsResponse = z.object({
data: z.array(zAgentInviteOptionResponse),
has_more: z.boolean(),
limit: z.int(),
page: z.int(),
total: z.int(),
})
/**
* AgentComposerAgentResponse
*/
export const zAgentComposerAgentResponse = z.object({
active_config_snapshot_id: z.string().nullish(),
description: z.string(),
id: z.string(),
name: z.string(),
scope: zAgentScope,
status: zAgentStatus,
})
/**
* 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),
})
/**
* AgentSoulPromptConfig
*/
export const zAgentSoulPromptConfig = z.object({
system_prompt: z.string().optional().default(''),
})
/**
* AgentHumanContactConfig
*/
export const zAgentHumanContactConfig = z.object({
channel: z.string().max(64).nullish(),
contact_id: z.string().max(255).nullish(),
contact_method: z.string().max(64).nullish(),
email: z.string().max(255).nullish(),
human_id: z.string().max(255).nullish(),
id: z.string().max(255).nullish(),
method: z.string().max(64).nullish(),
name: z.string().max(255).nullish(),
tenant_id: z.string().max(255).nullish(),
})
/**
* WorkflowNodeJobMode
*/
export const zWorkflowNodeJobMode = z.enum(['let_agent_figure_it_out', 'tell_agent_what_to_do'])
/**
* WorkflowPreviousNodeOutputRef
*/
export const zWorkflowPreviousNodeOutputRef = z.object({
key: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
node_id: z.string().max(255).nullish(),
output: z.string().max(255).nullish(),
selector: z.array(z.union([z.string(), z.int(), z.number(), z.boolean(), z.null()])).nullish(),
value_selector: z
.array(z.union([z.string(), z.int(), z.number(), z.boolean(), z.null()]))
.nullish(),
variable: z.string().max(255).nullish(),
variable_selector: z
.array(z.union([z.string(), z.int(), z.number(), z.boolean(), z.null()]))
.nullish(),
})
/**
* DeclaredOutputType
*/
export const zDeclaredOutputType = z.enum([
'array',
'boolean',
'file',
'number',
'object',
'string',
])
/**
* AgentComposerNodeJobCandidatesResponse
*/
export const zAgentComposerNodeJobCandidatesResponse = z.object({
declare_output_types: z.array(zDeclaredOutputType).optional(),
human_contacts: z.array(zAgentHumanContactConfig).optional(),
previous_node_outputs: z.array(zWorkflowPreviousNodeOutputRef).optional(),
})
/**
* AgentComposerDifyToolCandidateResponse
*/
export const zAgentComposerDifyToolCandidateResponse = z.object({
description: z.string().nullish(),
granularity: z.string().nullish(),
id: z.string().nullish(),
name: z.string().nullish(),
plugin_id: z.string().nullish(),
provider: z.string().nullish(),
provider_id: z.string().nullish(),
tools_count: z.int().nullish(),
})
/**
* AgentKnowledgeDatasetConfig
*/
export const zAgentKnowledgeDatasetConfig = z.object({
description: z.string().nullish(),
id: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
})
/**
* AgentComposerSkillCandidateResponse
*/
export const zAgentComposerSkillCandidateResponse = 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(),
kind: z.literal('skill').optional().default('skill'),
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(),
})
/**
* AgentComposerFileCandidateResponse
*/
export const zAgentComposerFileCandidateResponse = z.object({
drive_key: z.string().max(512).nullish(),
file_id: z.string().max(255).nullish(),
id: z.string().max(255).nullish(),
kind: z.literal('file').optional().default('file'),
name: z.string().max(255).nullish(),
reference: z.string().max(255).nullish(),
remote_url: z.string().nullish(),
tenant_id: z.string().max(255).nullish(),
transfer_method: z.string().max(64).nullish(),
type: z.string().max(64).nullish(),
upload_file_id: z.string().max(255).nullish(),
url: z.string().nullish(),
})
/**
* SimpleAccount
*/
export const zSimpleAccount = z.object({
email: z.string(),
id: z.string(),
name: z.string(),
})
/**
* ConversationAnnotation
*/
export const zConversationAnnotation = z.object({
account: zSimpleAccount.nullish(),
content: z.string(),
created_at: z.int().nullish(),
id: z.string(),
question: z.string().nullish(),
})
/**
* ConversationAnnotationHitHistory
*/
export const zConversationAnnotationHitHistory = z.object({
annotation_create_account: zSimpleAccount.nullish(),
created_at: z.int().nullish(),
id: z.string(),
})
/**
* Feedback
*/
export const zFeedback = z.object({
content: z.string().nullish(),
from_account: zSimpleAccount.nullish(),
from_end_user_id: z.string().nullish(),
from_source: z.string(),
rating: z.string(),
})
/**
* ExecutionContentType
*/
export const zExecutionContentType = z.enum(['human_input'])
/**
* EnvSuggestion
*/
export const zEnvSuggestion = z.object({
key: z.string(),
reason: z.string().optional().default(''),
secret_likely: z.boolean().optional().default(false),
})
/**
* CliToolSuggestion
*/
export const zCliToolSuggestion = z.object({
command: z.string().optional().default(''),
description: z.string().optional().default(''),
env_suggestions: z.array(zEnvSuggestion).optional(),
inferred_from: z.string().optional().default(''),
install_commands: z.array(z.string()).optional(),
name: z.string(),
})
/**
* SkillToolInferenceResult
*/
export const zSkillToolInferenceResult = z.object({
cli_tools: z.array(zCliToolSuggestion).optional(),
inferable: z.boolean(),
reason: z.string().nullish(),
})
/**
* AgentAverageResponseTimeStatisticResponse
*/
export const zAgentAverageResponseTimeStatisticResponse = z.object({
date: z.string(),
latency: z.number(),
})
/**
* AgentAverageSessionInteractionStatisticResponse
*/
export const zAgentAverageSessionInteractionStatisticResponse = z.object({
date: z.string(),
interactions: z.number(),
})
/**
* AgentDailyConversationStatisticResponse
*/
export const zAgentDailyConversationStatisticResponse = z.object({
conversation_count: z.int(),
date: z.string(),
})
/**
* AgentDailyEndUserStatisticResponse
*/
export const zAgentDailyEndUserStatisticResponse = z.object({
date: z.string(),
terminal_count: z.int(),
})
/**
* AgentDailyMessageStatisticResponse
*/
export const zAgentDailyMessageStatisticResponse = z.object({
date: z.string(),
message_count: z.int(),
})
/**
* AgentTokenUsageStatisticResponse
*/
export const zAgentTokenUsageStatisticResponse = z.object({
currency: z.string(),
date: z.string(),
token_count: z.int(),
total_price: z.string(),
})
/**
* AgentTokensPerSecondStatisticResponse
*/
export const zAgentTokensPerSecondStatisticResponse = z.object({
date: z.string(),
tps: z.number(),
})
/**
* AgentUserSatisfactionRateStatisticResponse
*/
export const zAgentUserSatisfactionRateStatisticResponse = z.object({
date: z.string(),
rate: z.number(),
})
/**
* AgentStatisticChartsResponse
*/
export const zAgentStatisticChartsResponse = z.object({
average_response_time: z.array(zAgentAverageResponseTimeStatisticResponse).optional(),
average_session_interactions: z
.array(zAgentAverageSessionInteractionStatisticResponse)
.optional(),
daily_conversations: z.array(zAgentDailyConversationStatisticResponse).optional(),
daily_end_users: z.array(zAgentDailyEndUserStatisticResponse).optional(),
daily_messages: z.array(zAgentDailyMessageStatisticResponse).optional(),
token_usage: z.array(zAgentTokenUsageStatisticResponse).optional(),
tokens_per_second: z.array(zAgentTokensPerSecondStatisticResponse).optional(),
user_satisfaction_rate: z.array(zAgentUserSatisfactionRateStatisticResponse).optional(),
})
/**
* AgentStatisticSummaryEnvelopeResponse
*/
export const zAgentStatisticSummaryEnvelopeResponse = z.object({
charts: zAgentStatisticChartsResponse,
source: z.string(),
summary: zAgentStatisticSummaryResponse,
})
/**
* AgentConfigRevisionOperation
*
* Audit operation recorded for Agent Soul version/revision changes.
*/
export const zAgentConfigRevisionOperation = z.enum([
'create_version',
'save_current_version',
'save_new_agent',
'save_new_version',
'save_to_roster',
])
/**
* AgentConfigRevisionResponse
*/
export const zAgentConfigRevisionResponse = z.object({
created_at: z.int().nullish(),
created_by: z.string().nullish(),
current_snapshot_id: z.string(),
id: z.string(),
operation: zAgentConfigRevisionOperation,
previous_snapshot_id: z.string().nullish(),
revision: z.int(),
summary: z.string().nullish(),
version_note: z.string().nullish(),
})
/**
* AgentEnvVariableConfig
*/
export const zAgentEnvVariableConfig = z.object({
default: z
.union([
z.string(),
z.int(),
z.number(),
z.boolean(),
z.array(z.string()),
z.array(z.int()),
z.array(z.number()),
z.array(z.boolean()),
])
.nullish(),
env_name: z.string().max(255).nullish(),
key: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
required: z.boolean().optional().default(false),
type: z.string().max(64).nullish(),
value: z
.union([
z.string(),
z.int(),
z.number(),
z.boolean(),
z.array(z.string()),
z.array(z.int()),
z.array(z.number()),
z.array(z.boolean()),
])
.nullish(),
variable: z.string().max(255).nullish(),
})
/**
* AgentHumanToolConfig
*/
export const zAgentHumanToolConfig = z.object({
description: z.string().nullish(),
enabled: z.boolean().optional().default(true),
name: z.string().max(255).nullish(),
})
/**
* AgentSoulHumanConfig
*/
export const zAgentSoulHumanConfig = z.object({
contacts: z.array(zAgentHumanContactConfig).optional(),
tools: z.array(zAgentHumanToolConfig).optional(),
})
/**
* AgentKnowledgeQueryConfig
*/
export const zAgentKnowledgeQueryConfig = z.object({
query: z.string().nullish(),
score_threshold: z.number().gte(0).lte(1).nullish(),
score_threshold_enabled: z.boolean().nullish(),
top_k: z.int().gte(1).nullish(),
})
/**
* AgentKnowledgeQueryMode
*/
export const zAgentKnowledgeQueryMode = z.enum(['generated_query', 'user_query'])
/**
* AgentSoulKnowledgeConfig
*/
export const zAgentSoulKnowledgeConfig = z.object({
datasets: z.array(zAgentKnowledgeDatasetConfig).optional(),
query_config: zAgentKnowledgeQueryConfig.optional(),
query_mode: zAgentKnowledgeQueryMode.nullish(),
})
/**
* AgentMemoryArtifactConfig
*/
export const zAgentMemoryArtifactConfig = z.object({
id: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
type: z.string().max(64).nullish(),
url: z.string().nullish(),
})
/**
* AgentSoulMemoryConfig
*/
export const zAgentSoulMemoryConfig = z.object({
artifacts: z.array(zAgentMemoryArtifactConfig).optional(),
budget: z.string().nullish(),
scope: z.string().nullish(),
})
/**
* 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),
})
/**
* AgentSandboxProviderConfig
*/
export const zAgentSandboxProviderConfig = z.object({
cpu: z.int().gte(1).nullish(),
env: z.array(zAgentEnvVariableConfig).optional(),
image: z.string().nullish(),
working_dir: z.string().nullish(),
})
/**
* AgentSoulSandboxConfig
*/
export const zAgentSoulSandboxConfig = z.object({
config: zAgentSandboxProviderConfig.optional(),
provider: z.string().nullish(),
})
/**
* AgentFileRefConfig
*/
export const zAgentFileRefConfig = z.object({
drive_key: z.string().max(512).nullish(),
file_id: z.string().max(255).nullish(),
id: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
reference: z.string().max(255).nullish(),
remote_url: z.string().nullish(),
tenant_id: z.string().max(255).nullish(),
transfer_method: z.string().max(64).nullish(),
type: z.string().max(64).nullish(),
upload_file_id: z.string().max(255).nullish(),
url: z.string().nullish(),
})
/**
* AgentSoulSkillsFilesConfig
*/
export const zAgentSoulSkillsFilesConfig = z.object({
files: z.array(zAgentFileRefConfig).optional(),
skills: z.array(zAgentSkillRefConfig).optional(),
})
/**
* WorkflowNodeJobMetadata
*/
export const zWorkflowNodeJobMetadata = z.object({
agent_soul: z.record(z.string(), z.unknown()).nullish(),
file_refs: z.array(zAgentFileRefConfig).nullish(),
})
/**
* DeclaredArrayItem
*
* Per-item shape for an ``array``-typed declared output.
*
* PRD §OUTPUT 配置框 keeps arrays one level deep on first version; nested arrays
* are rejected so the runtime type checker and JSON Schema stay easy to reason
* about. Stage 4 §4.2.
*/
export const zDeclaredArrayItem = z.object({
children: z
.array(
z.object({
array_item: z
.object({
children: z.array(z.record(z.string(), z.unknown())).optional(),
description: z.string().nullish(),
type: z.enum(['array', 'boolean', 'file', 'number', 'object', 'string']).optional(),
})
.optional(),
children: z.array(z.record(z.string(), z.unknown())).optional(),
description: z.string().nullish(),
file: z.record(z.string(), z.unknown()).optional(),
name: z.string(),
required: z.boolean().optional(),
type: z.enum(['array', 'boolean', 'file', 'number', 'object', 'string']),
}),
)
.optional(),
description: z.string().nullish(),
type: zDeclaredOutputType,
})
/**
* DeclaredOutputFileConfig
*
* File-type output metadata. Both lists empty means "any file accepted".
*/
export const zDeclaredOutputFileConfig = z.object({
extensions: z.array(z.string()).optional(),
mime_types: z.array(z.string()).optional(),
})
/**
* AgentCliToolAuthorizationStatus
*
* Authorization state for Agent-scoped CLI tools.
*
* Missing status keeps backward compatibility with draft rows and CLI tools that
* do not need pre-authorization. Explicit denied-like states are blocked by the
* composer/publish validators and skipped by runtime request builders.
*/
export const zAgentCliToolAuthorizationStatus = z.enum([
'allowed',
'authorized',
'denied',
'forbidden',
'not_required',
'pending',
'pre_authorized',
'unauthorized',
])
/**
* AgentPermissionConfig
*/
export const zAgentPermissionConfig = z.object({
allowed: z.boolean().nullish(),
state: z.string().max(64).nullish(),
status: z.string().max(64).nullish(),
})
/**
* AgentSecretRefConfig
*/
export const zAgentSecretRefConfig = z.object({
credential_id: z.string().max(255).nullish(),
env_name: z.string().max(255).nullish(),
id: z.string().max(255).nullish(),
key: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
permission: zAgentPermissionConfig.nullish(),
permission_status: z.string().max(64).nullish(),
provider: z.string().max(255).nullish(),
provider_credential_id: z.string().max(255).nullish(),
ref: z.string().max(255).nullish(),
type: z.string().max(64).nullish(),
value: z.string().max(255).nullish(),
variable: z.string().max(255).nullish(),
})
/**
* AgentSoulEnvConfig
*/
export const zAgentSoulEnvConfig = z.object({
secret_refs: z.array(zAgentSecretRefConfig).optional(),
variables: z.array(zAgentEnvVariableConfig).optional(),
})
/**
* AgentCliToolEnvConfig
*/
export const zAgentCliToolEnvConfig = z.object({
secret_refs: z.array(zAgentSecretRefConfig).optional(),
variables: z.array(zAgentEnvVariableConfig).optional(),
})
/**
* AgentCliToolRiskLevel
*
* Risk marker for CLI tool bootstrap commands.
*/
export const zAgentCliToolRiskLevel = z.enum(['dangerous', 'safe', 'unknown'])
/**
* AgentCliToolConfig
*/
export const zAgentCliToolConfig = z.object({
approved: z.boolean().optional().default(false),
authorization_status: zAgentCliToolAuthorizationStatus.nullish(),
command: z.string().nullish(),
dangerous: z.boolean().optional().default(false),
dangerous_accepted: z.boolean().optional().default(false),
dangerous_acknowledged: z.boolean().optional().default(false),
dangerous_command: z.boolean().optional().default(false),
description: z.string().nullish(),
enabled: z.boolean().optional().default(true),
env: zAgentCliToolEnvConfig.optional(),
id: z.string().max(255).nullish(),
inferred_from: z.string().max(255).nullish(),
install: z.string().nullish(),
install_command: z.string().nullish(),
install_commands: z.array(z.string()).optional(),
invoke_metadata: z.record(z.string(), z.unknown()).optional(),
label: z.string().max(255).nullish(),
name: z.string().max(255).nullish(),
permission: zAgentPermissionConfig.nullish(),
pre_authorized: z.boolean().nullish(),
requires_confirmation: z.boolean().optional().default(false),
risk_accepted: z.boolean().optional().default(false),
risk_level: zAgentCliToolRiskLevel.nullish(),
setup_command: z.string().nullish(),
tool_name: z.string().max(255).nullish(),
})
/**
* AgentComposerSoulCandidatesResponse
*/
export const zAgentComposerSoulCandidatesResponse = z.object({
cli_tools: z.array(zAgentCliToolConfig).optional(),
dify_tools: z.array(zAgentComposerDifyToolCandidateResponse).optional(),
human_contacts: z.array(zAgentHumanContactConfig).optional(),
knowledge_datasets: z.array(zAgentKnowledgeDatasetConfig).optional(),
skills_files: z
.array(
z.union([
z
.object({
kind: z.literal('skill'),
})
.and(zAgentComposerSkillCandidateResponse),
z
.object({
kind: z.literal('file'),
})
.and(zAgentComposerFileCandidateResponse),
]),
)
.optional(),
})
/**
* AgentComposerCandidatesResponse
*/
export const zAgentComposerCandidatesResponse = z.object({
allowed_node_job_candidates: zAgentComposerNodeJobCandidatesResponse.optional(),
allowed_soul_candidates: zAgentComposerSoulCandidatesResponse.optional(),
capabilities: zComposerCandidateCapabilities.optional(),
truncated: z.boolean().optional().default(false),
variant: zComposerVariant,
})
/**
* AgentModerationIOConfig
*/
export const zAgentModerationIoConfig = z.object({
enabled: z.boolean().optional().default(false),
preset_response: z.string().nullish(),
})
/**
* AgentModerationProviderConfig
*/
export const zAgentModerationProviderConfig = z.object({
api_based_extension_id: z.string().nullish(),
inputs_config: zAgentModerationIoConfig.nullish(),
keywords: z.string().nullish(),
outputs_config: zAgentModerationIoConfig.nullish(),
})
/**
* AgentSensitiveWordAvoidanceFeatureConfig
*/
export const zAgentSensitiveWordAvoidanceFeatureConfig = z.object({
config: zAgentModerationProviderConfig.nullish(),
enabled: z.boolean().optional().default(false),
type: z.string().nullish(),
})
export const zJsonValue2 = z.unknown()
/**
* HumanInputFormSubmissionData
*/
export const zHumanInputFormSubmissionData = z.object({
action_id: z.string(),
action_text: z.string(),
node_id: z.string(),
node_title: z.string(),
rendered_content: z.string(),
submitted_data: z.record(z.string(), zJsonValue2).nullish(),
})
/**
* AgentModelResponseFormatConfig
*/
export const zAgentModelResponseFormatConfig = z.object({
type: z.string().max(64).nullish(),
})
/**
* AgentSoulModelSettings
*/
export const zAgentSoulModelSettings = z.object({
frequency_penalty: z.number().nullish(),
max_tokens: z.int().nullish(),
presence_penalty: z.number().nullish(),
response_format: zAgentModelResponseFormatConfig.nullish(),
stop: z.array(z.string()).nullish(),
temperature: z.number().nullish(),
top_p: z.number().nullish(),
})
/**
* AgentSoulModelConfig
*
* Stable model selection for Agent runtime without storing secret values.
*/
export const zAgentSoulModelConfig = z.object({
credential_ref: zAgentSoulModelCredentialRef.nullish(),
model: z.string().min(1).max(255),
model_provider: z.string().min(1).max(255),
model_settings: zAgentSoulModelSettings.optional(),
plugin_id: z.string().min(1).max(255),
})
/**
* AgentSuggestedQuestionsAfterAnswerFeatureConfig
*/
export const zAgentSuggestedQuestionsAfterAnswerFeatureConfig = z.object({
enabled: z.boolean().optional().default(false),
model: zAgentSoulModelConfig.nullish(),
prompt: z.string().nullish(),
})
/**
* AgentAppFeaturesPayload
*
* Presentation features configurable on an Agent App.
*
* All fields are optional; an omitted field is reset to its disabled/empty
* default (the config form sends the full desired feature state on save).
*/
export const zAgentAppFeaturesPayload = 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(),
})
/**
* 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(),
})
/**
* DeclaredOutputCheckConfig
*
* File-output content check via a model-based comparison against a benchmark file.
*
* Per PRD §OUTPUT 配置框, output check is **file-only** and optional. Stage 4 §4.3.
*/
export const zDeclaredOutputCheckConfig = z.object({
benchmark_file_ref: zAgentFileRefConfig.nullish(),
enabled: z.boolean().optional().default(false),
model_ref: zAgentSoulModelConfig.nullish(),
prompt: z.string().nullish(),
})
/**
* 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.nullish(),
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
.union([
z.string(),
z.int(),
z.number(),
z.boolean(),
z.array(z.string()),
z.array(z.int()),
z.array(z.number()),
z.array(z.boolean()),
])
.nullable(),
)
.optional(),
tool_name: z.string().min(1).max(255).nullish(),
})
/**
* AgentSoulToolsConfig
*/
export const zAgentSoulToolsConfig = z.object({
cli_tools: z.array(zAgentCliToolConfig).optional(),
dify_tools: z.array(zAgentSoulDifyToolConfig).optional(),
})
/**
* AgentSoulConfig
*/
export const zAgentSoulConfig = z.object({
app_features: zAgentSoulAppFeaturesConfig.optional(),
app_variables: z.array(zAppVariableConfig).optional(),
env: zAgentSoulEnvConfig.optional(),
human: zAgentSoulHumanConfig.optional(),
knowledge: zAgentSoulKnowledgeConfig.optional(),
memory: zAgentSoulMemoryConfig.optional(),
misc_legacy: zAgentSoulAppFeaturesConfig.optional(),
model: zAgentSoulModelConfig.nullish(),
prompt: zAgentSoulPromptConfig.optional(),
sandbox: zAgentSoulSandboxConfig.optional(),
schema_version: z.int().optional().default(1),
skills_files: zAgentSoulSkillsFilesConfig.optional(),
tools: zAgentSoulToolsConfig.optional(),
})
/**
* AgentAppComposerResponse
*/
export const zAgentAppComposerResponse = z.object({
active_config_snapshot: zAgentConfigSnapshotSummaryResponse,
agent: zAgentComposerAgentResponse,
agent_soul: zAgentSoulConfig,
save_options: z.array(zComposerSaveStrategy),
validation: zComposerValidationFindingsResponse.nullish(),
variant: z.literal('agent_app'),
})
/**
* AgentConfigSnapshotDetailResponse
*/
export const zAgentConfigSnapshotDetailResponse = z.object({
agent_id: z.string().nullish(),
config_snapshot: zAgentSoulConfig,
created_at: z.int().nullish(),
created_by: z.string().nullish(),
id: z.string(),
revisions: z.array(zAgentConfigRevisionResponse).optional(),
summary: z.string().nullish(),
version: z.int(),
version_note: z.string().nullish(),
})
/**
* OutputErrorStrategy
*
* Per-output failure handling strategy.
*
* Mirrors ``graphon.ErrorStrategy`` but scoped to a single declared output of
* a Workflow Agent Node. The runtime applies the strategy after type check or
* output check fails and any configured retry attempts have been exhausted.
*/
export const zOutputErrorStrategy = z.enum(['default_value', 'fail_branch', 'stop'])
/**
* DeclaredOutputRetryConfig
*
* Per-output retry configuration that mirrors ``graphon.RetryConfig`` shape.
*/
export const zDeclaredOutputRetryConfig = z.object({
enabled: z.boolean().optional().default(false),
max_retries: z.int().gte(0).lte(10).optional().default(0),
retry_interval_ms: z.int().gte(0).lte(60000).optional().default(0),
})
/**
* DeclaredOutputFailureStrategy
*
* Per-output failure handling.
*
* A single strategy applies to both ``type_check`` and ``output_check`` failures
* (PRD does not distinguish them at the UX level). Stage 4 §4.4.
*/
export const zDeclaredOutputFailureStrategy = z.object({
default_value: z.unknown().optional(),
on_failure: zOutputErrorStrategy.optional().default('stop'),
retry: zDeclaredOutputRetryConfig.optional(),
})
/**
* DeclaredOutputConfig
*
* One declared output of a Workflow Agent Node.
*
* Stage 4 normalizes the shape: ``check`` is singular (was ``checks: list`` in
* stage 3), and ``failure_strategy`` defaults to a populated value so runtime
* code can call ``output.failure_strategy.on_failure`` without None-guards.
*/
export const zDeclaredOutputConfig = z.object({
array_item: zDeclaredArrayItem.nullish(),
check: zDeclaredOutputCheckConfig.nullish(),
children: z
.array(
z.object({
array_item: z
.object({
children: z.array(z.record(z.string(), z.unknown())).optional(),
description: z.string().nullish(),
type: z.enum(['array', 'boolean', 'file', 'number', 'object', 'string']).optional(),
})
.optional(),
children: z.array(z.record(z.string(), z.unknown())).optional(),
description: z.string().nullish(),
file: z.record(z.string(), z.unknown()).optional(),
name: z.string(),
required: z.boolean().optional(),
type: z.enum(['array', 'boolean', 'file', 'number', 'object', 'string']),
}),
)
.optional(),
description: z.string().nullish(),
failure_strategy: zDeclaredOutputFailureStrategy.optional(),
file: zDeclaredOutputFileConfig.nullish(),
id: z.string().nullish(),
name: z.string().min(1).max(255),
required: z.boolean().optional().default(true),
type: zDeclaredOutputType,
})
/**
* WorkflowNodeJobConfig
*/
export const zWorkflowNodeJobConfig = z.object({
declared_outputs: z.array(zDeclaredOutputConfig).optional(),
human_contacts: z.array(zAgentHumanContactConfig).optional(),
metadata: zWorkflowNodeJobMetadata.optional(),
mode: zWorkflowNodeJobMode.optional().default('tell_agent_what_to_do'),
previous_node_output_refs: z.array(zWorkflowPreviousNodeOutputRef).optional(),
schema_version: z.int().optional().default(1),
workflow_prompt: z.string().optional().default(''),
})
/**
* ComposerSavePayload
*/
export const zComposerSavePayload = z.object({
agent_soul: zAgentSoulConfig.nullish(),
binding: zComposerBindingPayload.nullish(),
client_revision_id: z.string().nullish(),
idempotency_key: z.string().nullish(),
new_agent_name: z.string().min(1).max(255).nullish(),
node_job: zWorkflowNodeJobConfig.nullish(),
save_strategy: zComposerSaveStrategy,
soul_lock: zComposerSoulLockPayload.optional(),
variant: zComposerVariant,
version_note: z.string().nullish(),
})
/**
* ButtonStyle
*
* Button styles for user actions.
*/
export const zButtonStyle = z.enum(['accent', 'default', 'ghost', 'primary'])
/**
* UserActionConfig
*
* User action configuration.
*/
export const zUserActionConfig = z.object({
button_style: zButtonStyle.optional().default('default'),
id: z.string().max(20),
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'),
})
/**
* ValueSourceType
*
* ValueSourceType records whether the value comes from a static setting
* in form definiton, or a variable while the workflow is running.
*/
export const zValueSourceType = z.enum(['constant', 'variable'])
/**
* StringSource
*
* Default configuration for form inputs.
*/
export const zStringSource = z.object({
selector: z.array(z.string()).optional(),
type: zValueSourceType,
value: z.string().optional().default(''),
})
/**
* ParagraphInputConfig
*
* Form input definition.
*/
export const zParagraphInputConfig = z.object({
default: zStringSource.nullish(),
output_variable_name: z.string(),
type: z.literal('paragraph').optional().default('paragraph'),
})
/**
* StringListSource
*/
export const zStringListSource = z.object({
selector: z.array(z.string()).optional(),
type: zValueSourceType,
value: z.array(z.string()).optional(),
})
/**
* SelectInputConfig
*/
export const zSelectInputConfig = z.object({
option_source: zStringListSource,
output_variable_name: z.string(),
type: z.literal('select').optional().default('select'),
})
export const zFormInputConfig = z.discriminatedUnion('type', [
zParagraphInputConfig.extend({ type: z.literal('paragraph') }),
zSelectInputConfig.extend({ type: z.literal('select') }),
zFileInputConfig.extend({ type: z.literal('file') }),
zFileListInputConfig.extend({ type: z.literal('file-list') }),
])
/**
* HumanInputFormDefinition
*/
export const zHumanInputFormDefinition = z.object({
actions: z.array(zUserActionConfig).optional(),
display_in_ui: z.boolean().optional().default(false),
expiration_time: z.int(),
form_content: z.string(),
form_id: z.string(),
form_token: z.string().nullish(),
inputs: z.array(zFormInputConfig).optional(),
node_id: z.string(),
node_title: z.string(),
resolved_default_values: z.record(z.string(), z.unknown()).optional(),
})
/**
* HumanInputContent
*/
export const zHumanInputContent = z.object({
form_definition: zHumanInputFormDefinition.nullish(),
form_submission_data: zHumanInputFormSubmissionData.nullish(),
submitted: z.boolean(),
type: zExecutionContentType.optional().default('human_input'),
workflow_run_id: z.string(),
})
/**
* MessageDetailResponse
*/
export const zMessageDetailResponse = z.object({
agent_thoughts: z.array(zAgentThought).optional(),
annotation: zConversationAnnotation.nullish(),
annotation_hit_history: zConversationAnnotationHitHistory.nullish(),
answer_tokens: z.int().nullish(),
conversation_id: z.string(),
created_at: z.int().nullish(),
error: z.string().nullish(),
extra_contents: z.array(zHumanInputContent).optional(),
feedbacks: z.array(zFeedback).optional(),
from_account_id: z.string().nullish(),
from_end_user_id: z.string().nullish(),
from_source: z.string(),
id: z.string(),
inputs: z.record(z.string(), zJsonValue),
message: zJsonValue.nullish(),
message_files: z.array(zMessageFile).optional(),
message_metadata_dict: zJsonValue.nullish(),
message_tokens: z.int().nullish(),
parent_message_id: z.string().nullish(),
provider_response_latency: z.number().nullish(),
query: z.string(),
re_sign_file_url_answer: z.string(),
status: z.string(),
workflow_run_id: z.string().nullish(),
})
/**
* MessageInfiniteScrollPaginationResponse
*/
export const zMessageInfiniteScrollPaginationResponse = z.object({
data: z.array(zMessageDetailResponse),
has_more: z.boolean(),
limit: z.int(),
})
/**
* AgentAppPartial
*/
export const zAgentAppPartialWritable = z.object({
access_mode: z.string().nullish(),
active_config_is_published: z.boolean().optional().default(false),
app_id: z.string().nullish(),
author_name: z.string().nullish(),
bound_agent_id: z.string().nullish(),
create_user_name: z.string().nullish(),
created_at: z.int().nullish(),
created_by: z.string().nullish(),
description: z.string().nullish(),
has_draft_trigger: z.boolean().nullish(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
id: z.string(),
is_starred: z.boolean().optional().default(false),
max_active_requests: z.int().nullish(),
mode: z.string(),
model_config: zModelConfigPartial.nullish(),
name: z.string(),
published_reference_count: z.int().optional().default(0),
published_references: z.array(zAgentAppPublishedReferenceResponse).optional(),
role: z.string().nullish(),
tags: z.array(zTag).optional(),
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
use_icon_as_answer_icon: z.boolean().nullish(),
workflow: zWorkflowPartial.nullish(),
})
/**
* AgentAppPagination
*/
export const zAgentAppPaginationWritable = z.object({
data: z.array(zAgentAppPartialWritable),
has_more: z.boolean(),
limit: z.int(),
page: z.int(),
total: z.int(),
})
/**
* Site
*/
export const zSiteWritable = z.object({
chat_color_theme: z.string().nullish(),
chat_color_theme_inverted: z.boolean(),
copyright: z.string().nullish(),
custom_disclaimer: z.string().nullish(),
default_language: z.string(),
description: z.string().nullish(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
privacy_policy: z.string().nullish(),
show_workflow_steps: z.boolean(),
title: z.string(),
use_icon_as_answer_icon: z.boolean(),
})
/**
* AppDetailWithSite
*/
export const zAppDetailWithSiteWritable = z.object({
access_mode: z.string().nullish(),
active_config_is_published: z.boolean().optional().default(false),
api_base_url: z.string().nullish(),
app_id: z.string().nullish(),
bound_agent_id: z.string().nullish(),
created_at: z.int().nullish(),
created_by: z.string().nullish(),
deleted_tools: z.array(zDeletedTool).optional(),
description: z.string().nullish(),
enable_api: z.boolean(),
enable_site: z.boolean(),
icon: z.string().nullish(),
icon_background: z.string().nullish(),
icon_type: z.string().nullish(),
id: z.string(),
max_active_requests: z.int().nullish(),
mode: z.string(),
model_config: zModelConfig.nullish(),
name: z.string(),
role: z.string().nullish(),
site: zSiteWritable.nullish(),
tags: z.array(zTag).optional(),
tracing: zJsonValue.nullish(),
updated_at: z.int().nullish(),
updated_by: z.string().nullish(),
use_icon_as_answer_icon: z.boolean().nullish(),
workflow: zWorkflowPartial.nullish(),
})
export const zGetAgentQuery = z.object({
creator_ids: z.array(z.string()).optional(),
is_created_by_me: z.boolean().optional(),
limit: z.int().gte(1).lte(100).optional().default(20),
mode: z
.enum([
'advanced-chat',
'agent',
'agent-chat',
'all',
'channel',
'chat',
'completion',
'workflow',
])
.optional()
.default('all'),
name: z.string().optional(),
page: z.int().gte(1).lte(99999).optional().default(1),
sort_by: z
.enum(['earliest_created', 'last_modified', 'recently_created'])
.optional()
.default('last_modified'),
tag_ids: z.array(z.string()).optional(),
})
/**
* Agent app list
*/
export const zGetAgentResponse = zAgentAppPagination
export const zPostAgentBody = zAgentAppCreatePayload
/**
* Agent app created successfully
*/
export const zPostAgentResponse = zAppDetailWithSite
export const zGetAgentInviteOptionsQuery = z.object({
app_id: z.string().optional(),
keyword: z.string().optional(),
limit: z.int().gte(1).lte(100).optional().default(20),
page: z.int().gte(1).optional().default(1),
})
/**
* Agent invite options
*/
export const zGetAgentInviteOptionsResponse = zAgentInviteOptionsResponse
export const zDeleteAgentByAgentIdPath = z.object({
agent_id: z.string(),
})
/**
* Agent app deleted successfully
*/
export const zDeleteAgentByAgentIdResponse = z.void()
export const zGetAgentByAgentIdPath = z.object({
agent_id: z.string(),
})
/**
* Agent app detail
*/
export const zGetAgentByAgentIdResponse = zAppDetailWithSite
export const zPutAgentByAgentIdBody = zAgentAppUpdatePayload
export const zPutAgentByAgentIdPath = z.object({
agent_id: z.string(),
})
/**
* Agent app updated successfully
*/
export const zPutAgentByAgentIdResponse = zAppDetailWithSite
export const zGetAgentByAgentIdChatMessagesPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdChatMessagesQuery = z.object({
conversation_id: z.string(),
first_id: z.string().optional(),
limit: z.int().gte(1).lte(100).optional().default(20),
})
/**
* Success
*/
export const zGetAgentByAgentIdChatMessagesResponse = zMessageInfiniteScrollPaginationResponse
export const zGetAgentByAgentIdChatMessagesByMessageIdSuggestedQuestionsPath = z.object({
agent_id: z.string(),
message_id: z.string(),
})
/**
* Suggested questions retrieved successfully
*/
export const zGetAgentByAgentIdChatMessagesByMessageIdSuggestedQuestionsResponse
= zSuggestedQuestionsResponse
export const zPostAgentByAgentIdChatMessagesByTaskIdStopPath = z.object({
agent_id: z.string(),
task_id: z.string(),
})
/**
* Task stopped successfully
*/
export const zPostAgentByAgentIdChatMessagesByTaskIdStopResponse = zSimpleResultResponse
export const zGetAgentByAgentIdComposerPath = z.object({
agent_id: z.string(),
})
/**
* Agent app composer state
*/
export const zGetAgentByAgentIdComposerResponse = zAgentAppComposerResponse
export const zPutAgentByAgentIdComposerBody = zComposerSavePayload
export const zPutAgentByAgentIdComposerPath = z.object({
agent_id: z.string(),
})
/**
* Agent app composer saved
*/
export const zPutAgentByAgentIdComposerResponse = zAgentAppComposerResponse
export const zGetAgentByAgentIdComposerCandidatesPath = z.object({
agent_id: z.string(),
})
/**
* Agent app composer candidates
*/
export const zGetAgentByAgentIdComposerCandidatesResponse = zAgentComposerCandidatesResponse
export const zPostAgentByAgentIdComposerValidateBody = zComposerSavePayload
export const zPostAgentByAgentIdComposerValidatePath = z.object({
agent_id: z.string(),
})
/**
* Agent app composer validation result
*/
export const zPostAgentByAgentIdComposerValidateResponse = zAgentComposerValidateResponse
export const zGetAgentByAgentIdDriveFilesPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdDriveFilesQuery = z.object({
prefix: z.string().optional().default(''),
})
/**
* Drive entries
*/
export const zGetAgentByAgentIdDriveFilesResponse = zAgentDriveListResponse
export const zGetAgentByAgentIdDriveFilesDownloadPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdDriveFilesDownloadQuery = z.object({
key: z.string().min(1),
})
/**
* Signed URL
*/
export const zGetAgentByAgentIdDriveFilesDownloadResponse = zAgentDriveDownloadResponse
export const zGetAgentByAgentIdDriveFilesPreviewPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdDriveFilesPreviewQuery = z.object({
key: z.string().min(1),
})
/**
* Preview
*/
export const zGetAgentByAgentIdDriveFilesPreviewResponse = zAgentDrivePreviewResponse
export const zPostAgentByAgentIdFeaturesBody = zAgentAppFeaturesPayload
export const zPostAgentByAgentIdFeaturesPath = z.object({
agent_id: z.string(),
})
/**
* Features updated successfully
*/
export const zPostAgentByAgentIdFeaturesResponse = zSimpleResultResponse
export const zPostAgentByAgentIdFeedbacksBody = zMessageFeedbackPayload
export const zPostAgentByAgentIdFeedbacksPath = z.object({
agent_id: z.string(),
})
/**
* Feedback updated successfully
*/
export const zPostAgentByAgentIdFeedbacksResponse = zSimpleResultResponse
export const zDeleteAgentByAgentIdFilesPath = z.object({
agent_id: z.string(),
})
export const zDeleteAgentByAgentIdFilesQuery = z.object({
key: z.string().min(1),
})
/**
* File removed
*/
export const zDeleteAgentByAgentIdFilesResponse = zAgentDriveDeleteResponse
export const zPostAgentByAgentIdFilesBody = zAgentDriveFilePayload
export const zPostAgentByAgentIdFilesPath = z.object({
agent_id: z.string(),
})
/**
* File committed into the agent drive
*/
export const zPostAgentByAgentIdFilesResponse = zAgentDriveFileCommitResponse
export const zGetAgentByAgentIdLogsPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdLogsQuery = z.object({
end: z.string().optional(),
keyword: z.string().optional(),
limit: z.int().gte(1).lte(100).optional().default(20),
page: z.int().gte(1).optional().default(1),
source: z.string().optional(),
start: z.string().optional(),
status: z.string().optional(),
})
/**
* Agent logs
*/
export const zGetAgentByAgentIdLogsResponse = zAgentLogListResponse
export const zGetAgentByAgentIdMessagesByMessageIdPath = z.object({
agent_id: z.string(),
message_id: z.string(),
})
/**
* Message retrieved successfully
*/
export const zGetAgentByAgentIdMessagesByMessageIdResponse = zMessageDetailResponse
export const zGetAgentByAgentIdReferencingWorkflowsPath = z.object({
agent_id: z.string(),
})
/**
* Referencing workflows listed successfully
*/
export const zGetAgentByAgentIdReferencingWorkflowsResponse = zAgentReferencingWorkflowsResponse
export const zGetAgentByAgentIdSandboxFilesPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdSandboxFilesQuery = z.object({
conversation_id: z.string().min(1),
path: z.string().optional().default('.'),
})
/**
* Listing returned
*/
export const zGetAgentByAgentIdSandboxFilesResponse = zSandboxListResponse
export const zGetAgentByAgentIdSandboxFilesReadPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdSandboxFilesReadQuery = z.object({
conversation_id: z.string().min(1),
path: z.string().min(1),
})
/**
* Preview returned
*/
export const zGetAgentByAgentIdSandboxFilesReadResponse = zSandboxReadResponse
export const zPostAgentByAgentIdSandboxFilesUploadBody = zAgentSandboxUploadPayload
export const zPostAgentByAgentIdSandboxFilesUploadPath = z.object({
agent_id: z.string(),
})
/**
* Uploaded
*/
export const zPostAgentByAgentIdSandboxFilesUploadResponse = zSandboxUploadResponse
export const zPostAgentByAgentIdSkillsStandardizePath = z.object({
agent_id: z.string(),
})
/**
* Skill standardized into drive
*/
export const zPostAgentByAgentIdSkillsStandardizeResponse = zAgentSkillStandardizeResponse
export const zPostAgentByAgentIdSkillsUploadPath = z.object({
agent_id: z.string(),
})
/**
* Skill validated
*/
export const zPostAgentByAgentIdSkillsUploadResponse = zAgentSkillUploadResponse
export const zDeleteAgentByAgentIdSkillsBySlugPath = z.object({
agent_id: z.string(),
slug: z.string(),
})
/**
* Skill removed
*/
export const zDeleteAgentByAgentIdSkillsBySlugResponse = zAgentDriveDeleteResponse
export const zPostAgentByAgentIdSkillsBySlugInferToolsPath = z.object({
agent_id: z.string(),
slug: z.string(),
})
/**
* Inference result (draft suggestions, nothing persisted)
*/
export const zPostAgentByAgentIdSkillsBySlugInferToolsResponse = zSkillToolInferenceResult
export const zGetAgentByAgentIdStatisticsSummaryPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdStatisticsSummaryQuery = z.object({
end: z.string().optional(),
source: z.string().optional(),
start: z.string().optional(),
})
/**
* Agent monitoring summary and chart data
*/
export const zGetAgentByAgentIdStatisticsSummaryResponse = zAgentStatisticSummaryEnvelopeResponse
export const zGetAgentByAgentIdVersionsPath = z.object({
agent_id: z.string(),
})
/**
* Agent versions
*/
export const zGetAgentByAgentIdVersionsResponse = zAgentConfigSnapshotListResponse
export const zGetAgentByAgentIdVersionsByVersionIdPath = z.object({
agent_id: z.string(),
version_id: z.string(),
})
/**
* Agent version detail
*/
export const zGetAgentByAgentIdVersionsByVersionIdResponse = zAgentConfigSnapshotDetailResponse