Spaces:
Running
Running
add rely terminal and tool use to it and add an agent builder to it so we'll
Browse files- agent-builder.html +414 -0
- components/footer.js +2 -1
- components/navbar.js +2 -1
- editor.html +51 -24
- index.html +5 -5
- style.css +49 -2
agent-builder.html
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AI Agent Builder - CodeCollab Pro</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<link rel="stylesheet" href="style.css">
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 12 |
+
<script src="https://unpkg.com/uuid@8.3.2/dist/uuid.min.js"></script>
|
| 13 |
+
</head>
|
| 14 |
+
<body class="bg-gray-50">
|
| 15 |
+
<custom-navbar></custom-navbar>
|
| 16 |
+
|
| 17 |
+
<main class="pt-20 min-h-screen">
|
| 18 |
+
<!-- Header -->
|
| 19 |
+
<section class="bg-gradient-to-r from-indigo-600 to-purple-600 text-white py-8">
|
| 20 |
+
<div class="container mx-auto px-6">
|
| 21 |
+
<h1 class="text-3xl font-bold mb-2">AI Agent Builder</h1>
|
| 22 |
+
<p class="text-indigo-100">Create intelligent coding agents with custom tools and capabilities</p>
|
| 23 |
+
</div>
|
| 24 |
+
</section>
|
| 25 |
+
|
| 26 |
+
<div class="container mx-auto px-6 py-8">
|
| 27 |
+
<div class="grid lg:grid-cols-3 gap-8">
|
| 28 |
+
<!-- Agent Configuration Panel -->
|
| 29 |
+
<div class="lg:col-span-1">
|
| 30 |
+
<div class="bg-white rounded-xl shadow-lg p-6">
|
| 31 |
+
<h2 class="text-xl font-bold text-gray-800 mb-4">Agent Configuration</h2>
|
| 32 |
+
|
| 33 |
+
<div class="space-y-4">
|
| 34 |
+
<div>
|
| 35 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Agent Name</label>
|
| 36 |
+
<input type="text" id="agentName" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="My Coding Agent">
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
<div>
|
| 40 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Model</label>
|
| 41 |
+
<select id="agentModel" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
| 42 |
+
<option value="gpt-4">GPT-4</option>
|
| 43 |
+
<option value="gpt-3.5-turbo">GPT-3.5 Turbo</option>
|
| 44 |
+
<option value="claude-3">Claude 3</option>
|
| 45 |
+
<option value="llama-2">Llama 2</option>
|
| 46 |
+
</select>
|
| 47 |
+
</div>
|
| 48 |
+
|
| 49 |
+
<div>
|
| 50 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">System Prompt</label>
|
| 51 |
+
<textarea id="systemPrompt" rows="4" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="You are an expert coding assistant..."></textarea>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div>
|
| 55 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Temperature</label>
|
| 56 |
+
<input type="range" id="temperature" min="0" max="1" step="0.1" value="0.7" class="w-full">
|
| 57 |
+
<div class="flex justify-between text-xs text-gray-500">
|
| 58 |
+
<span>Precise</span>
|
| 59 |
+
<span id="tempValue">0.7</span>
|
| 60 |
+
<span>Creative</span>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<div>
|
| 65 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Max Tokens</label>
|
| 66 |
+
<input type="number" id="maxTokens" value="2048" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<button id="createAgent" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-semibold py-2 px-4 rounded-lg transition">
|
| 70 |
+
Create Agent
|
| 71 |
+
</button>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<!-- Tools Panel -->
|
| 76 |
+
<div class="bg-white rounded-xl shadow-lg p-6 mt-6">
|
| 77 |
+
<h2 class="text-xl font-bold text-gray-800 mb-4">Available Tools</h2>
|
| 78 |
+
<div class="space-y-2">
|
| 79 |
+
<label class="flex items-center space-x-3 cursor-pointer">
|
| 80 |
+
<input type="checkbox" class="tool-checkbox" value="code-executor" checked class="w-4 h-4 text-indigo-600 rounded">
|
| 81 |
+
<span class="text-sm">Code Executor</span>
|
| 82 |
+
</label>
|
| 83 |
+
<label class="flex items-center space-x-3 cursor-pointer">
|
| 84 |
+
<input type="checkbox" class="tool-checkbox" value="file-system" checked class="w-4 h-4 text-indigo-600 rounded">
|
| 85 |
+
<span class="text-sm">File System</span>
|
| 86 |
+
</label>
|
| 87 |
+
<label class="flex items-center space-x-3 cursor-pointer">
|
| 88 |
+
<input type="checkbox" class="tool-checkbox" value="web-search" class="w-4 h-4 text-indigo-600 rounded">
|
| 89 |
+
<span class="text-sm">Web Search</span>
|
| 90 |
+
</label>
|
| 91 |
+
<label class="flex items-center space-x-3 cursor-pointer">
|
| 92 |
+
<input type="checkbox" class="tool-checkbox" value="api-caller" class="w-4 h-4 text-indigo-600 rounded">
|
| 93 |
+
<span class="text-sm">API Caller</span>
|
| 94 |
+
</label>
|
| 95 |
+
<label class="flex items-center space-x-3 cursor-pointer">
|
| 96 |
+
<input type="checkbox" class="tool-checkbox" value="database" class="w-4 h-4 text-indigo-600 rounded">
|
| 97 |
+
<span class="text-sm">Database Access</span>
|
| 98 |
+
</label>
|
| 99 |
+
<label class="flex items-center space-x-3 cursor-pointer">
|
| 100 |
+
<input type="checkbox" class="tool-checkbox" value="git" class="w-4 h-4 text-indigo-600 rounded">
|
| 101 |
+
<span class="text-sm">Git Operations</span>
|
| 102 |
+
</label>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<!-- Main Workspace -->
|
| 108 |
+
<div class="lg:col-span-2">
|
| 109 |
+
<!-- Agent Chat Interface -->
|
| 110 |
+
<div class="bg-white rounded-xl shadow-lg p-6 mb-6">
|
| 111 |
+
<div class="flex justify-between items-center mb-4">
|
| 112 |
+
<h2 class="text-xl font-bold text-gray-800">Agent Workspace</h2>
|
| 113 |
+
<div class="flex items-center space-x-2">
|
| 114 |
+
<div class="w-3 h-3 bg-green-500 rounded-full animate-pulse"></div>
|
| 115 |
+
<span class="text-sm text-gray-600">Agent Ready</span>
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<div id="chatMessages" class="bg-gray-50 rounded-lg p-4 h-96 overflow-y-auto mb-4">
|
| 120 |
+
<div class="text-center text-gray-500 py-8">
|
| 121 |
+
<i data-feather="cpu" class="w-12 h-12 mx-auto mb-3 text-gray-400"></i>
|
| 122 |
+
<p>Create an agent to start interacting</p>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<div class="flex space-x-2">
|
| 127 |
+
<input type="text" id="chatInput" placeholder="Type your message..." class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" disabled>
|
| 128 |
+
<button id="sendMessage" class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-2 rounded-lg transition flex items-center space-x-2" disabled>
|
| 129 |
+
<i data-feather="send" class="w-4 h-4"></i>
|
| 130 |
+
<span>Send</span>
|
| 131 |
+
</button>
|
| 132 |
+
</div>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<!-- Tool Execution Log -->
|
| 136 |
+
<div class="bg-white rounded-xl shadow-lg p-6">
|
| 137 |
+
<div class="flex justify-between items-center mb-4">
|
| 138 |
+
<h2 class="text-xl font-bold text-gray-800">Tool Execution Log</h2>
|
| 139 |
+
<button id="clearLog" class="text-gray-500 hover:text-gray-700">
|
| 140 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 141 |
+
</button>
|
| 142 |
+
</div>
|
| 143 |
+
<div id="toolLog" class="bg-gray-900 text-gray-100 rounded-lg p-4 h-64 overflow-y-auto font-mono text-sm">
|
| 144 |
+
<div class="text-gray-500">Tool execution events will appear here...</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
|
| 150 |
+
<!-- Saved Agents -->
|
| 151 |
+
<div class="mt-8">
|
| 152 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-4">Your Agents</h2>
|
| 153 |
+
<div id="savedAgents" class="grid md:grid-cols-3 gap-4">
|
| 154 |
+
<div class="bg-white rounded-lg shadow p-4 text-center text-gray-500">
|
| 155 |
+
<i data-feather="package" class="w-8 h-8 mx-auto mb-2"></i>
|
| 156 |
+
<p>No saved agents yet</p>
|
| 157 |
+
</div>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
</main>
|
| 162 |
+
|
| 163 |
+
<custom-footer></custom-footer>
|
| 164 |
+
|
| 165 |
+
<script src="components/navbar.js"></script>
|
| 166 |
+
<script src="components/footer.js"></script>
|
| 167 |
+
<script src="script.js"></script>
|
| 168 |
+
<script>
|
| 169 |
+
let currentAgent = null;
|
| 170 |
+
let agents = [];
|
| 171 |
+
|
| 172 |
+
// Temperature slider update
|
| 173 |
+
document.getElementById('temperature').addEventListener('input', (e) => {
|
| 174 |
+
document.getElementById('tempValue').textContent = e.target.value;
|
| 175 |
+
});
|
| 176 |
+
|
| 177 |
+
// Create Agent
|
| 178 |
+
document.getElementById('createAgent').addEventListener('click', () => {
|
| 179 |
+
const name = document.getElementById('agentName').value || 'Unnamed Agent';
|
| 180 |
+
const model = document.getElementById('agentModel').value;
|
| 181 |
+
const systemPrompt = document.getElementById('systemPrompt').value || 'You are a helpful coding assistant.';
|
| 182 |
+
const temperature = parseFloat(document.getElementById('temperature').value);
|
| 183 |
+
const maxTokens = parseInt(document.getElementById('maxTokens').value);
|
| 184 |
+
|
| 185 |
+
const selectedTools = Array.from(document.querySelectorAll('.tool-checkbox:checked'))
|
| 186 |
+
.map(cb => cb.value);
|
| 187 |
+
|
| 188 |
+
const agent = {
|
| 189 |
+
id: uuid.v4(),
|
| 190 |
+
name,
|
| 191 |
+
model,
|
| 192 |
+
systemPrompt,
|
| 193 |
+
temperature,
|
| 194 |
+
maxTokens,
|
| 195 |
+
tools: selectedTools,
|
| 196 |
+
createdAt: new Date().toISOString()
|
| 197 |
+
};
|
| 198 |
+
|
| 199 |
+
currentAgent = agent;
|
| 200 |
+
agents.push(agent);
|
| 201 |
+
|
| 202 |
+
// Enable chat interface
|
| 203 |
+
document.getElementById('chatInput').disabled = false;
|
| 204 |
+
document.getElementById('sendMessage').disabled = false;
|
| 205 |
+
|
| 206 |
+
// Update UI
|
| 207 |
+
updateSavedAgents();
|
| 208 |
+
initializeChat();
|
| 209 |
+
addToolLog(`Agent "${name}" created with tools: ${selectedTools.join(', ')}`, 'success');
|
| 210 |
+
});
|
| 211 |
+
|
| 212 |
+
// Initialize Chat
|
| 213 |
+
function initializeChat() {
|
| 214 |
+
const chatMessages = document.getElementById('chatMessages');
|
| 215 |
+
chatMessages.innerHTML = `
|
| 216 |
+
<div class="mb-4">
|
| 217 |
+
<div class="flex items-start space-x-3">
|
| 218 |
+
<div class="w-8 h-8 bg-indigo-500 rounded-full flex items-center justify-center">
|
| 219 |
+
<i data-feather="cpu" class="w-4 h-4 text-white"></i>
|
| 220 |
+
</div>
|
| 221 |
+
<div class="flex-1">
|
| 222 |
+
<div class="bg-gray-100 rounded-lg p-3">
|
| 223 |
+
<p class="text-sm text-gray-800">Hello! I'm ${currentAgent.name}. I have access to the following tools: ${currentAgent.tools.join(', ')}. How can I help you today?</p>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
`;
|
| 229 |
+
feather.replace();
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
// Send Message
|
| 233 |
+
document.getElementById('sendMessage').addEventListener('click', sendMessage);
|
| 234 |
+
document.getElementById('chatInput').addEventListener('keypress', (e) => {
|
| 235 |
+
if (e.key === 'Enter') sendMessage();
|
| 236 |
+
});
|
| 237 |
+
|
| 238 |
+
function sendMessage() {
|
| 239 |
+
const input = document.getElementById('chatInput');
|
| 240 |
+
const message = input.value.trim();
|
| 241 |
+
|
| 242 |
+
if (!message || !currentAgent) return;
|
| 243 |
+
|
| 244 |
+
const chatMessages = document.getElementById('chatMessages');
|
| 245 |
+
|
| 246 |
+
// Add user message
|
| 247 |
+
chatMessages.innerHTML += `
|
| 248 |
+
<div class="mb-4">
|
| 249 |
+
<div class="flex items-start space-x-3 justify-end">
|
| 250 |
+
<div class="flex-1 text-right">
|
| 251 |
+
<div class="bg-indigo-600 text-white rounded-lg p-3 inline-block">
|
| 252 |
+
<p class="text-sm">${message}</p>
|
| 253 |
+
</div>
|
| 254 |
+
</div>
|
| 255 |
+
<div class="w-8 h-8 bg-gray-500 rounded-full flex items-center justify-center">
|
| 256 |
+
<i data-feather="user" class="w-4 h-4 text-white"></i>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
`;
|
| 261 |
+
|
| 262 |
+
input.value = '';
|
| 263 |
+
|
| 264 |
+
// Simulate agent thinking and tool usage
|
| 265 |
+
setTimeout(() => {
|
| 266 |
+
addToolLog('🤖 Processing request...', 'info');
|
| 267 |
+
simulateAgentResponse(message);
|
| 268 |
+
}, 1000);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
function simulateAgentResponse(userMessage) {
|
| 272 |
+
const chatMessages = document.getElementById('chatMessages');
|
| 273 |
+
const tools = currentAgent.tools;
|
| 274 |
+
|
| 275 |
+
let response = '';
|
| 276 |
+
let toolUsed = '';
|
| 277 |
+
|
| 278 |
+
// Simple response simulation based on message and available tools
|
| 279 |
+
if (userMessage.toLowerCase().includes('run') || userMessage.toLowerCase().includes('execute')) {
|
| 280 |
+
if (tools.includes('code-executor')) {
|
| 281 |
+
toolUsed = 'code-executor';
|
| 282 |
+
response = 'I\'ll execute that code for you using the code executor tool.';
|
| 283 |
+
setTimeout(() => {
|
| 284 |
+
addToolLog('🔧 Using code-executor tool...', 'tool');
|
| 285 |
+
addToolLog('✅ Code executed successfully', 'success');
|
| 286 |
+
}, 2000);
|
| 287 |
+
} else {
|
| 288 |
+
response = 'I don\'t have access to the code executor tool. Please enable it in the agent configuration.';
|
| 289 |
+
}
|
| 290 |
+
} else if (userMessage.toLowerCase().includes('file') || userMessage.toLowerCase().includes('save')) {
|
| 291 |
+
if (tools.includes('file-system')) {
|
| 292 |
+
toolUsed = 'file-system';
|
| 293 |
+
response = 'I\'ll help you manage files using the file system tool.';
|
| 294 |
+
setTimeout(() => {
|
| 295 |
+
addToolLog('📁 Using file-system tool...', 'tool');
|
| 296 |
+
addToolLog('✅ File operation completed', 'success');
|
| 297 |
+
}, 2000);
|
| 298 |
+
} else {
|
| 299 |
+
response = 'I don\'t have access to file system operations.';
|
| 300 |
+
}
|
| 301 |
+
} else if (userMessage.toLowerCase().includes('search') || userMessage.toLowerCase().includes('find')) {
|
| 302 |
+
if (tools.includes('web-search')) {
|
| 303 |
+
toolUsed = 'web-search';
|
| 304 |
+
response = 'Let me search for that information using the web search tool.';
|
| 305 |
+
setTimeout(() => {
|
| 306 |
+
addToolLog('🌐 Using web-search tool...', 'tool');
|
| 307 |
+
addToolLog('🔍 Found 5 relevant results', 'success');
|
| 308 |
+
}, 2000);
|
| 309 |
+
} else {
|
| 310 |
+
response = 'I don\'t have access to web search functionality.';
|
| 311 |
+
}
|
| 312 |
+
} else {
|
| 313 |
+
response = 'I understand your request. Let me help you with that task using my available capabilities.';
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
// Add agent response
|
| 317 |
+
setTimeout(() => {
|
| 318 |
+
chatMessages.innerHTML += `
|
| 319 |
+
<div class="mb-4">
|
| 320 |
+
<div class="flex items-start space-x-3">
|
| 321 |
+
<div class="w-8 h-8 bg-indigo-500 rounded-full flex items-center justify-center">
|
| 322 |
+
<i data-feather="cpu" class="w-4 h-4 text-white"></i>
|
| 323 |
+
</div>
|
| 324 |
+
<div class="flex-1">
|
| 325 |
+
<div class="bg-gray-100 rounded-lg p-3">
|
| 326 |
+
<p class="text-sm text-gray-800">${response}</p>
|
| 327 |
+
${toolUsed ? `<p class="text-xs text-gray-500 mt-1">Used tool: ${toolUsed}</p>` : ''}
|
| 328 |
+
</div>
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
</div>
|
| 332 |
+
`;
|
| 333 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 334 |
+
feather.replace();
|
| 335 |
+
}, 1500);
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
function addToolLog(message, type = 'info') {
|
| 339 |
+
const toolLog = document.getElementById('toolLog');
|
| 340 |
+
const timestamp = new Date().toLocaleTimeString();
|
| 341 |
+
const colorClass = {
|
| 342 |
+
'info': 'text-gray-300',
|
| 343 |
+
'success': 'text-green-400',
|
| 344 |
+
'tool': 'text-blue-400',
|
| 345 |
+
'error': 'text-red-400'
|
| 346 |
+
}[type] || 'text-gray-300';
|
| 347 |
+
|
| 348 |
+
toolLog.innerHTML += `<div class="${colorClass}">[${timestamp}] ${message}</div>`;
|
| 349 |
+
toolLog.scrollTop = toolLog.scrollHeight;
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
function updateSavedAgents() {
|
| 353 |
+
const container = document.getElementById('savedAgents');
|
| 354 |
+
|
| 355 |
+
if (agents.length === 0) {
|
| 356 |
+
container.innerHTML = `
|
| 357 |
+
<div class="bg-white rounded-lg shadow p-4 text-center text-gray-500">
|
| 358 |
+
<i data-feather="package" class="w-8 h-8 mx-auto mb-2"></i>
|
| 359 |
+
<p>No saved agents yet</p>
|
| 360 |
+
</div>
|
| 361 |
+
`;
|
| 362 |
+
} else {
|
| 363 |
+
container.innerHTML = agents.map(agent => `
|
| 364 |
+
<div class="bg-white rounded-lg shadow p-4 hover:shadow-lg transition cursor-pointer" onclick="loadAgent('${agent.id}')">
|
| 365 |
+
<div class="flex items-center justify-between mb-2">
|
| 366 |
+
<h3 class="font-semibold text-gray-800">${agent.name}</h3>
|
| 367 |
+
<span class="text-xs bg-indigo-100 text-indigo-700 px-2 py-1 rounded">${agent.model}</span>
|
| 368 |
+
</div>
|
| 369 |
+
<p class="text-sm text-gray-600 mb-2">${agent.tools.length} tools</p>
|
| 370 |
+
<div class="flex flex-wrap gap-1">
|
| 371 |
+
${agent.tools.slice(0, 3).map(tool =>
|
| 372 |
+
`<span class="text-xs bg-gray-100 text-gray-600 px-2 py-1 rounded">${tool}</span>`
|
| 373 |
+
).join('')}
|
| 374 |
+
${agent.tools.length > 3 ? `<span class="text-xs text-gray-500">+${agent.tools.length - 3} more</span>` : ''}
|
| 375 |
+
</div>
|
| 376 |
+
</div>
|
| 377 |
+
`).join('');
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
feather.replace();
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
function loadAgent(agentId) {
|
| 384 |
+
currentAgent = agents.find(a => a.id === agentId);
|
| 385 |
+
if (currentAgent) {
|
| 386 |
+
document.getElementById('agentName').value = currentAgent.name;
|
| 387 |
+
document.getElementById('agentModel').value = currentAgent.model;
|
| 388 |
+
document.getElementById('systemPrompt').value = currentAgent.systemPrompt;
|
| 389 |
+
document.getElementById('temperature').value = currentAgent.temperature;
|
| 390 |
+
document.getElementById('maxTokens').value = currentAgent.maxTokens;
|
| 391 |
+
|
| 392 |
+
// Update checkboxes
|
| 393 |
+
document.querySelectorAll('.tool-checkbox').forEach(cb => {
|
| 394 |
+
cb.checked = currentAgent.tools.includes(cb.value);
|
| 395 |
+
});
|
| 396 |
+
|
| 397 |
+
// Enable chat
|
| 398 |
+
document.getElementById('chatInput').disabled = false;
|
| 399 |
+
document.getElementById('sendMessage').disabled = false;
|
| 400 |
+
|
| 401 |
+
initializeChat();
|
| 402 |
+
addToolLog(`Loaded agent: ${currentAgent.name}`, 'success');
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
// Clear log
|
| 407 |
+
document.getElementById('clearLog').addEventListener('click', () => {
|
| 408 |
+
document.getElementById('toolLog').innerHTML = '<div class="text-gray-500">Log cleared...</div>';
|
| 409 |
+
});
|
| 410 |
+
|
| 411 |
+
feather.replace();
|
| 412 |
+
</script>
|
| 413 |
+
</body>
|
| 414 |
+
</html>
|
components/footer.js
CHANGED
|
@@ -122,8 +122,9 @@ class CustomFooter extends HTMLElement {
|
|
| 122 |
<li><a href="/features.html">Features</a></li>
|
| 123 |
<li><a href="/pricing.html">Pricing</a></li>
|
| 124 |
<li><a href="/editor.html">Live Editor</a></li>
|
|
|
|
| 125 |
<li><a href="/templates.html">Templates</a></li>
|
| 126 |
-
|
| 127 |
</div>
|
| 128 |
|
| 129 |
<div class="footer-section">
|
|
|
|
| 122 |
<li><a href="/features.html">Features</a></li>
|
| 123 |
<li><a href="/pricing.html">Pricing</a></li>
|
| 124 |
<li><a href="/editor.html">Live Editor</a></li>
|
| 125 |
+
<li><a href="/agent-builder.html">AI Agent Builder</a></li>
|
| 126 |
<li><a href="/templates.html">Templates</a></li>
|
| 127 |
+
</ul>
|
| 128 |
</div>
|
| 129 |
|
| 130 |
<div class="footer-section">
|
components/navbar.js
CHANGED
|
@@ -132,8 +132,9 @@ class CustomNavbar extends HTMLElement {
|
|
| 132 |
<li><a href="/">Home</a></li>
|
| 133 |
<li><a href="#features">Features</a></li>
|
| 134 |
<li><a href="/editor.html">Editor</a></li>
|
|
|
|
| 135 |
<li><a href="/dashboard.html">Dashboard</a></li>
|
| 136 |
-
|
| 137 |
<div class="auth-buttons">
|
| 138 |
<button class="btn-primary" onclick="window.location.href='/login.html'">Sign In</button>
|
| 139 |
</div>
|
|
|
|
| 132 |
<li><a href="/">Home</a></li>
|
| 133 |
<li><a href="#features">Features</a></li>
|
| 134 |
<li><a href="/editor.html">Editor</a></li>
|
| 135 |
+
<li><a href="/agent-builder.html">Agent Builder</a></li>
|
| 136 |
<li><a href="/dashboard.html">Dashboard</a></li>
|
| 137 |
+
<li>
|
| 138 |
<div class="auth-buttons">
|
| 139 |
<button class="btn-primary" onclick="window.location.href='/login.html'">Sign In</button>
|
| 140 |
</div>
|
editor.html
CHANGED
|
@@ -46,44 +46,71 @@
|
|
| 46 |
</div>
|
| 47 |
</div>
|
| 48 |
</header>
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 60 |
</div>
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
<textarea id="codeEditor" class="h-full">// Welcome to CodeCollab Pro Editor!
|
| 64 |
function greet(name) {
|
| 65 |
console.log(`Hello, ${name}! Welcome to CodeCollab Pro.`);
|
| 66 |
}
|
| 67 |
|
| 68 |
greet('Developer');</textarea>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
</div>
|
| 70 |
</div>
|
| 71 |
|
| 72 |
-
<!--
|
| 73 |
-
<div class="
|
| 74 |
<div class="px-4 py-2 border-b border-gray-700 flex items-center justify-between">
|
| 75 |
-
<span class="text-sm font-medium">
|
| 76 |
-
<
|
| 77 |
-
<
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
</div>
|
| 80 |
-
<div id="
|
| 81 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
-
|
| 86 |
-
<!-- Collaborators Bar -->
|
| 87 |
<div class="bg-gray-800 border-t border-gray-700 px-4 py-2">
|
| 88 |
<div class="flex items-center justify-between">
|
| 89 |
<div class="flex items-center space-x-2">
|
|
|
|
| 46 |
</div>
|
| 47 |
</div>
|
| 48 |
</header>
|
| 49 |
+
<div class="flex flex-col h-full">
|
| 50 |
+
<!-- Editor and Output -->
|
| 51 |
+
<div class="flex-1 flex overflow-hidden">
|
| 52 |
+
<!-- Code Editor -->
|
| 53 |
+
<div class="flex-1 flex flex-col">
|
| 54 |
+
<div class="bg-gray-800 px-4 py-2 border-b border-gray-700 flex items-center justify-between">
|
| 55 |
+
<span class="text-sm font-medium">main.js</span>
|
| 56 |
+
<div class="flex items-center space-x-4 text-sm text-gray-400">
|
| 57 |
+
<span>Line 1, Col 1</span>
|
| 58 |
+
<span>UTF-8</span>
|
| 59 |
+
<span>LF</span>
|
| 60 |
+
</div>
|
| 61 |
</div>
|
| 62 |
+
<div class="flex-1 overflow-hidden">
|
| 63 |
+
<textarea id="codeEditor" class="h-full">// Welcome to CodeCollab Pro Editor!
|
|
|
|
| 64 |
function greet(name) {
|
| 65 |
console.log(`Hello, ${name}! Welcome to CodeCollab Pro.`);
|
| 66 |
}
|
| 67 |
|
| 68 |
greet('Developer');</textarea>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<!-- Console/Output -->
|
| 73 |
+
<div class="w-96 bg-gray-800 border-l border-gray-700 flex flex-col">
|
| 74 |
+
<div class="px-4 py-2 border-b border-gray-700 flex items-center justify-between">
|
| 75 |
+
<span class="text-sm font-medium">Console</span>
|
| 76 |
+
<button id="clearConsole" class="text-gray-400 hover:text-gray-200">
|
| 77 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 78 |
+
</button>
|
| 79 |
+
</div>
|
| 80 |
+
<div id="console" class="flex-1 p-4 overflow-y-auto font-mono text-sm">
|
| 81 |
+
<div class="text-gray-500">Console output will appear here...</div>
|
| 82 |
+
</div>
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
|
| 86 |
+
<!-- Terminal Section -->
|
| 87 |
+
<div class="h-48 bg-gray-900 border-t border-gray-700 flex flex-col">
|
| 88 |
<div class="px-4 py-2 border-b border-gray-700 flex items-center justify-between">
|
| 89 |
+
<span class="text-sm font-medium text-gray-300">Terminal</span>
|
| 90 |
+
<div class="flex items-center space-x-2">
|
| 91 |
+
<button id="terminalClear" class="text-gray-400 hover:text-gray-200">
|
| 92 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 93 |
+
</button>
|
| 94 |
+
<select id="terminalShell" class="bg-gray-700 text-gray-300 px-2 py-1 rounded text-xs">
|
| 95 |
+
<option value="bash">bash</option>
|
| 96 |
+
<option value="powershell">powershell</option>
|
| 97 |
+
<option value="cmd">cmd</option>
|
| 98 |
+
</select>
|
| 99 |
+
</div>
|
| 100 |
</div>
|
| 101 |
+
<div id="terminal" class="flex-1 p-3 overflow-y-auto font-mono text-sm text-gray-300">
|
| 102 |
+
<div class="terminal-line">
|
| 103 |
+
<span class="text-green-400">$</span>
|
| 104 |
+
<span class="ml-2">Welcome to CodeCollab Pro Terminal</span>
|
| 105 |
+
</div>
|
| 106 |
+
<div class="terminal-input flex items-center mt-1">
|
| 107 |
+
<span class="text-green-400">$</span>
|
| 108 |
+
<input type="text" id="terminalInput" class="ml-2 bg-transparent outline-none flex-1" placeholder="Type a command...">
|
| 109 |
+
</div>
|
| 110 |
</div>
|
| 111 |
</div>
|
| 112 |
</div>
|
| 113 |
+
<!-- Collaborators Bar -->
|
|
|
|
| 114 |
<div class="bg-gray-800 border-t border-gray-700 px-4 py-2">
|
| 115 |
<div class="flex items-center justify-between">
|
| 116 |
<div class="flex items-center space-x-2">
|
index.html
CHANGED
|
@@ -54,13 +54,13 @@
|
|
| 54 |
<p class="text-gray-600">Code together with your team in real-time. See cursors, edits, and collaborate seamlessly.</p>
|
| 55 |
</div>
|
| 56 |
<div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition transform hover:-translate-y-2">
|
| 57 |
-
<div class="w-12 h-12 bg-
|
| 58 |
-
<i data-feather="
|
| 59 |
</div>
|
| 60 |
-
<h3 class="text-xl font-semibold mb-3">
|
| 61 |
-
<p class="text-gray-600">
|
| 62 |
</div>
|
| 63 |
-
|
| 64 |
<div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mb-4">
|
| 65 |
<i data-feather="git-branch" class="text-purple-600"></i>
|
| 66 |
</div>
|
|
|
|
| 54 |
<p class="text-gray-600">Code together with your team in real-time. See cursors, edits, and collaborate seamlessly.</p>
|
| 55 |
</div>
|
| 56 |
<div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition transform hover:-translate-y-2">
|
| 57 |
+
<div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mb-4">
|
| 58 |
+
<i data-feather="cpu" class="text-purple-600"></i>
|
| 59 |
</div>
|
| 60 |
+
<h3 class="text-xl font-semibold mb-3">AI-Powered Tools</h3>
|
| 61 |
+
<p class="text-gray-600">Build custom AI agents with advanced tool integration and intelligent code assistance.</p>
|
| 62 |
</div>
|
| 63 |
+
<div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition transform hover:-translate-y-2">
|
| 64 |
<div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mb-4">
|
| 65 |
<i data-feather="git-branch" class="text-purple-600"></i>
|
| 66 |
</div>
|
style.css
CHANGED
|
@@ -84,7 +84,6 @@ html {
|
|
| 84 |
-webkit-text-fill-color: transparent;
|
| 85 |
background-clip: text;
|
| 86 |
}
|
| 87 |
-
|
| 88 |
/* Loading spinner */
|
| 89 |
.spinner {
|
| 90 |
border: 3px solid #f3f3f3;
|
|
@@ -98,4 +97,52 @@ html {
|
|
| 98 |
@keyframes spin {
|
| 99 |
0% { transform: rotate(0deg); }
|
| 100 |
100% { transform: rotate(360deg); }
|
| 101 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
-webkit-text-fill-color: transparent;
|
| 85 |
background-clip: text;
|
| 86 |
}
|
|
|
|
| 87 |
/* Loading spinner */
|
| 88 |
.spinner {
|
| 89 |
border: 3px solid #f3f3f3;
|
|
|
|
| 97 |
@keyframes spin {
|
| 98 |
0% { transform: rotate(0deg); }
|
| 99 |
100% { transform: rotate(360deg); }
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
/* Terminal styles */
|
| 103 |
+
.terminal-input input {
|
| 104 |
+
background: transparent !important;
|
| 105 |
+
border: none !important;
|
| 106 |
+
outline: none !important;
|
| 107 |
+
color: inherit;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.terminal-line {
|
| 111 |
+
margin-bottom: 2px;
|
| 112 |
+
word-wrap: break-word;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/* Agent builder styles */
|
| 116 |
+
.agent-status {
|
| 117 |
+
animation: pulse 2s infinite;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
@keyframes pulse {
|
| 121 |
+
0% { opacity: 1; }
|
| 122 |
+
50% { opacity: 0.7; }
|
| 123 |
+
100% { opacity: 1; }
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/* Tool execution log styles */
|
| 127 |
+
.tool-log-entry {
|
| 128 |
+
font-family: 'Courier New', monospace;
|
| 129 |
+
font-size: 0.875rem;
|
| 130 |
+
padding: 2px 0;
|
| 131 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
/* Chat message styles */
|
| 135 |
+
.chat-message {
|
| 136 |
+
animation: slideInUp 0.3s ease-out;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
@keyframes slideInUp {
|
| 140 |
+
from {
|
| 141 |
+
opacity: 0;
|
| 142 |
+
transform: translateY(10px);
|
| 143 |
+
}
|
| 144 |
+
to {
|
| 145 |
+
opacity: 1;
|
| 146 |
+
transform: translateY(0);
|
| 147 |
+
}
|
| 148 |
+
}
|