feat(agents): 完成云智能体工作台与交互流程
This commit is contained in:
@@ -7,6 +7,9 @@ export interface CloudAgentDraft {
|
||||
system_prompt: string;
|
||||
draft_revision: number;
|
||||
updated_at: string;
|
||||
configuration: CloudAgentConfiguration;
|
||||
published_version: number | null;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export interface CloudAgentPage {
|
||||
@@ -25,4 +28,137 @@ export interface SaveCloudAgentDraft {
|
||||
name: string;
|
||||
purpose: string;
|
||||
system_prompt: string;
|
||||
configuration?: CloudAgentConfiguration;
|
||||
}
|
||||
|
||||
export interface CloudAgentConfiguration {
|
||||
model: string;
|
||||
tools: string[];
|
||||
knowledges: string[];
|
||||
mcps: string[];
|
||||
skills: string[];
|
||||
preload_skills: string[];
|
||||
subagents: string[];
|
||||
tool_approval_mode: 'default' | 'always_trust';
|
||||
max_execution_steps: number;
|
||||
max_output_tokens: number;
|
||||
max_run_seconds: number;
|
||||
}
|
||||
|
||||
export const EMPTY_CLOUD_CONFIGURATION: CloudAgentConfiguration = {
|
||||
model: '', tools: [], knowledges: [], mcps: [], skills: [], preload_skills: [], subagents: [],
|
||||
tool_approval_mode: 'default', max_execution_steps: 40, max_output_tokens: 4096, max_run_seconds: 600,
|
||||
};
|
||||
|
||||
export interface CloudAgentEntry {
|
||||
slug: string; name: string; purpose: string; published_version: number;
|
||||
is_creator?: boolean; payer?: string;
|
||||
}
|
||||
export interface CloudResource { key: string; name: string; description?: string }
|
||||
export interface CloudCatalog {
|
||||
models: { id: string; name: string }[];
|
||||
resources: Partial<Record<'tools' | 'knowledges' | 'mcps' | 'skills' | 'subagents', CloudResource[]>>;
|
||||
pricing: { unit: string; usage_unit: string; unit_size: number; points_per_unit: string; version: number };
|
||||
}
|
||||
export interface CloudApplication { id: string; name: string; enabled: boolean }
|
||||
export interface CloudKey { id: string; prefix: string; revoked_at: string | null }
|
||||
export interface CloudAccess {
|
||||
published_version: number | null; enabled: boolean; share_url: string;
|
||||
versions: { version: number; draft_revision: number; created_at: string }[];
|
||||
grants: { account_id: string; enabled: boolean }[];
|
||||
applications: CloudApplication[];
|
||||
api_url: string;
|
||||
}
|
||||
export interface CloudThread {
|
||||
thread_id: string; client_thread_id: string | null; agent_slug: string; title: string;
|
||||
mode: 'published' | 'preview'; updated_at: string; run_id: string | null; status: string; unread: boolean;
|
||||
draft_revision?: number;
|
||||
}
|
||||
export interface CloudRun {
|
||||
agent_run_id: string; request_id: string; thread_id: string; agent_slug: string;
|
||||
status: string; output: string; version: string;
|
||||
error?: { type: string; message: string };
|
||||
interrupt?: CloudInterrupt;
|
||||
}
|
||||
export interface CloudInterrupt {
|
||||
status?: string; message?: string; run_id?: string;
|
||||
questions?: unknown[]; approval?: Record<string, unknown>; interrupt_info?: unknown;
|
||||
}
|
||||
export interface CloudMessage {
|
||||
id: number; role: 'user' | 'assistant' | 'system'; content: string; request_id: string;
|
||||
run_id: string | null; created_at: string;
|
||||
}
|
||||
export interface CloudHistory {
|
||||
thread_id: string; messages: CloudMessage[]; run: CloudRun | null; next_offset: number | null;
|
||||
}
|
||||
export interface CloudRequest {
|
||||
request_id: string; thread_id: string; run_id: string | null; status: string; version: string;
|
||||
}
|
||||
export interface CloudPrompt {
|
||||
request_id: string; thread_id: string; query: string; expected_revision?: number;
|
||||
attachment_file_ids?: string[];
|
||||
}
|
||||
export interface CloudScheduleInput {
|
||||
name: string; prompt: string; cron_expression: string; timezone: string; enabled: boolean;
|
||||
}
|
||||
export interface CloudSchedule extends CloudScheduleInput {
|
||||
id: string; agent_slug: string; next_run_at: string | null;
|
||||
runs?: { status: string; thread_id: string; error_message?: string; conversation_available: boolean }[];
|
||||
}
|
||||
export interface CloudCost {
|
||||
id: string; status: string; reserved_points: string; actual_points: string | null; created_at: string;
|
||||
context: { agent_slug: string; version: string; caller_kind: string; caller_id: string; run_id: string; request_id: string };
|
||||
}
|
||||
export interface CloudAttachment { file_id: string; file_name: string; file_size: number; path: string; original_path: string; request_id?: string | null }
|
||||
export interface CloudUpload { object_name: string; file_name: string; file_type: string; parse_supported: boolean; parse_methods: string[] }
|
||||
export interface CloudFile { name: string; path: string; directory_path: string; is_dir: boolean; size: number }
|
||||
export interface CloudKnowledge { kb_id: string; name: string; description: string; embedding_model: string }
|
||||
export interface CloudKnowledgeFile { file_id: string; name: string; size: number; status: string; error: string | null; chunk_count: number }
|
||||
type Op<Input, Output> = { input: Input; output: Output };
|
||||
type Agent = { slug: string };
|
||||
type Application = { application_id: string };
|
||||
type Schedule = Agent & { job_id: string };
|
||||
type Thread = { thread_id: string };
|
||||
type Run = { run_id: string };
|
||||
type Operation = { operation_id: string };
|
||||
export interface CloudAgentOperations {
|
||||
knowledge: Op<Agent, { databases: CloudKnowledge[]; models: { id: string; name: string; dimension: number }[] }>;
|
||||
createKnowledge: Op<Agent & Operation & { name: string; embedding_model: string }, CloudKnowledge>;
|
||||
knowledgeFiles: Op<Agent & { kb_id: string; offset?: number }, { files: CloudKnowledgeFile[]; next_offset: number | null }>;
|
||||
processKnowledge: Op<Agent & Operation & { kb_id: string; file_id: string }, { task_id: string }>;
|
||||
catalog: Op<Record<string, never>, CloudCatalog>;
|
||||
received: Op<Record<string, never>, { agents: CloudAgentEntry[] }>;
|
||||
entry: Op<Agent, CloudAgentEntry>;
|
||||
publish: Op<Agent & Operation & { expected_revision: number }, { version: number; draft_revision: number }>;
|
||||
access: Op<Agent, CloudAccess>;
|
||||
setEnabled: Op<Agent & { enabled: boolean }, { enabled: boolean }>;
|
||||
users: Op<{ query: string }, { users: { account_id: string; username: string; display_name: string }[] }>;
|
||||
share: Op<Agent & { account_id: string; enabled: boolean }, { account_id: string; enabled: boolean }>;
|
||||
createApplication: Op<Agent & Operation & { name: string }, CloudApplication>;
|
||||
setApplicationEnabled: Op<Application & { enabled: boolean }, { enabled: boolean }>;
|
||||
keys: Op<Application, { keys: CloudKey[] }>;
|
||||
createKey: Op<Application & Operation, { id: string; prefix: string; secret: string }>;
|
||||
revokeKey: Op<Application & { key_id: string }, { revoked: boolean }>;
|
||||
costs: Op<{ slug?: string }, { unit: string; items: CloudCost[] }>;
|
||||
threads: Op<{ slug?: string; offset?: number }, { threads: CloudThread[]; next_offset: number | null }>;
|
||||
createThread: Op<Agent & Thread & { preview: boolean; expected_revision?: number }, { thread_id: string; client_thread_id: string }>;
|
||||
history: Op<Thread & { offset?: number }, CloudHistory>;
|
||||
viewed: Op<Thread & Run, { viewed: boolean }>;
|
||||
submit: Op<Agent & CloudPrompt, CloudRequest>;
|
||||
preview: Op<Agent & CloudPrompt, CloudRequest>;
|
||||
request: Op<{ request_id: string }, CloudRequest>;
|
||||
cancelRequest: Op<{ request_id: string }, { status: string }>;
|
||||
run: Op<Run, CloudRun>;
|
||||
cancelRun: Op<Run, { status: string }>;
|
||||
resume: Op<Run & Operation & { decision: Record<string, unknown> }, { run_id: string; status: string }>;
|
||||
schedules: Op<Agent, { jobs: CloudSchedule[] }>;
|
||||
createSchedule: Op<Agent & Operation & CloudScheduleInput, CloudSchedule>;
|
||||
updateSchedule: Op<Schedule & CloudScheduleInput, CloudSchedule>;
|
||||
deleteSchedule: Op<Schedule, { deleted: boolean }>;
|
||||
runSchedule: Op<Schedule & Operation, { thread_id: string; status: string }>;
|
||||
attachments: Op<Thread, { attachments: CloudAttachment[] }>;
|
||||
parseAttachment: Op<{ object_name: string; parse_method: string }, { parsed_object_name: string }>;
|
||||
confirmAttachment: Op<Thread & { attachments: { object_name: string; file_type?: string; parsed_object_name?: string }[] }, { attachments: CloudAttachment[] }>;
|
||||
deleteAttachment: Op<Thread & { file_id: string }, { message: string }>;
|
||||
files: Op<Thread & { path: string }, { files: CloudFile[] }>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user