feat(agents): Add GitHub agent import feature
- Implemented GitHub agent browser in CCAgents component - Created GitHubAgentBrowser component for browsing and importing agents - Added Rust commands for fetching and importing agents from GitHub - Updated API layer with GitHub agent import methods - Updated Cargo.toml with new dependencies - Fixed Tauri configuration and capabilities - Added dropdown menu for import options - Implemented search and preview functionality for GitHub agents
This commit is contained in:
@@ -171,6 +171,30 @@ export interface Agent {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface AgentExport {
|
||||
version: number;
|
||||
exported_at: string;
|
||||
agent: {
|
||||
name: string;
|
||||
icon: string;
|
||||
system_prompt: string;
|
||||
default_task?: string;
|
||||
model: string;
|
||||
sandbox_enabled: boolean;
|
||||
enable_file_read: boolean;
|
||||
enable_file_write: boolean;
|
||||
enable_network: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GitHubAgentFile {
|
||||
name: string;
|
||||
path: string;
|
||||
download_url: string;
|
||||
size: number;
|
||||
sha: string;
|
||||
}
|
||||
|
||||
export interface AgentRun {
|
||||
id?: number;
|
||||
agent_id: number;
|
||||
@@ -456,15 +480,42 @@ export const api = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets sessions for a specific project
|
||||
* @param projectId - The project ID to get sessions for
|
||||
* @returns Promise resolving to an array of sessions
|
||||
* Fetch list of agents from GitHub repository
|
||||
* @returns Promise resolving to list of available agents on GitHub
|
||||
*/
|
||||
async getProjectSessions(projectId: string): Promise<Session[]> {
|
||||
async fetchGitHubAgents(): Promise<GitHubAgentFile[]> {
|
||||
try {
|
||||
return await invoke<Session[]>("get_project_sessions", { projectId });
|
||||
return await invoke<GitHubAgentFile[]>('fetch_github_agents');
|
||||
} catch (error) {
|
||||
console.error("Failed to get project sessions:", error);
|
||||
console.error("Failed to fetch GitHub agents:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetch and preview a specific agent from GitHub
|
||||
* @param downloadUrl - The download URL for the agent file
|
||||
* @returns Promise resolving to the agent export data
|
||||
*/
|
||||
async fetchGitHubAgentContent(downloadUrl: string): Promise<AgentExport> {
|
||||
try {
|
||||
return await invoke<AgentExport>('fetch_github_agent_content', { downloadUrl });
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch GitHub agent content:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Import an agent directly from GitHub
|
||||
* @param downloadUrl - The download URL for the agent file
|
||||
* @returns Promise resolving to the imported agent
|
||||
*/
|
||||
async importAgentFromGitHub(downloadUrl: string): Promise<Agent> {
|
||||
try {
|
||||
return await invoke<Agent>('import_agent_from_github', { downloadUrl });
|
||||
} catch (error) {
|
||||
console.error("Failed to import agent from GitHub:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user