vibesurf 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of vibesurf might be problematic. Click here for more details.

Files changed (70) hide show
  1. vibe_surf/__init__.py +12 -0
  2. vibe_surf/_version.py +34 -0
  3. vibe_surf/agents/__init__.py +0 -0
  4. vibe_surf/agents/browser_use_agent.py +1106 -0
  5. vibe_surf/agents/prompts/__init__.py +1 -0
  6. vibe_surf/agents/prompts/vibe_surf_prompt.py +176 -0
  7. vibe_surf/agents/report_writer_agent.py +360 -0
  8. vibe_surf/agents/vibe_surf_agent.py +1632 -0
  9. vibe_surf/backend/__init__.py +0 -0
  10. vibe_surf/backend/api/__init__.py +3 -0
  11. vibe_surf/backend/api/activity.py +243 -0
  12. vibe_surf/backend/api/config.py +740 -0
  13. vibe_surf/backend/api/files.py +322 -0
  14. vibe_surf/backend/api/models.py +257 -0
  15. vibe_surf/backend/api/task.py +300 -0
  16. vibe_surf/backend/database/__init__.py +13 -0
  17. vibe_surf/backend/database/manager.py +129 -0
  18. vibe_surf/backend/database/models.py +164 -0
  19. vibe_surf/backend/database/queries.py +922 -0
  20. vibe_surf/backend/database/schemas.py +100 -0
  21. vibe_surf/backend/llm_config.py +182 -0
  22. vibe_surf/backend/main.py +137 -0
  23. vibe_surf/backend/migrations/__init__.py +16 -0
  24. vibe_surf/backend/migrations/init_db.py +303 -0
  25. vibe_surf/backend/migrations/seed_data.py +236 -0
  26. vibe_surf/backend/shared_state.py +601 -0
  27. vibe_surf/backend/utils/__init__.py +7 -0
  28. vibe_surf/backend/utils/encryption.py +164 -0
  29. vibe_surf/backend/utils/llm_factory.py +225 -0
  30. vibe_surf/browser/__init__.py +8 -0
  31. vibe_surf/browser/agen_browser_profile.py +130 -0
  32. vibe_surf/browser/agent_browser_session.py +416 -0
  33. vibe_surf/browser/browser_manager.py +296 -0
  34. vibe_surf/browser/utils.py +790 -0
  35. vibe_surf/browser/watchdogs/__init__.py +0 -0
  36. vibe_surf/browser/watchdogs/action_watchdog.py +291 -0
  37. vibe_surf/browser/watchdogs/dom_watchdog.py +954 -0
  38. vibe_surf/chrome_extension/background.js +558 -0
  39. vibe_surf/chrome_extension/config.js +48 -0
  40. vibe_surf/chrome_extension/content.js +284 -0
  41. vibe_surf/chrome_extension/dev-reload.js +47 -0
  42. vibe_surf/chrome_extension/icons/convert-svg.js +33 -0
  43. vibe_surf/chrome_extension/icons/logo-preview.html +187 -0
  44. vibe_surf/chrome_extension/icons/logo.png +0 -0
  45. vibe_surf/chrome_extension/manifest.json +53 -0
  46. vibe_surf/chrome_extension/popup.html +134 -0
  47. vibe_surf/chrome_extension/scripts/api-client.js +473 -0
  48. vibe_surf/chrome_extension/scripts/main.js +491 -0
  49. vibe_surf/chrome_extension/scripts/markdown-it.min.js +3 -0
  50. vibe_surf/chrome_extension/scripts/session-manager.js +599 -0
  51. vibe_surf/chrome_extension/scripts/ui-manager.js +3687 -0
  52. vibe_surf/chrome_extension/sidepanel.html +347 -0
  53. vibe_surf/chrome_extension/styles/animations.css +471 -0
  54. vibe_surf/chrome_extension/styles/components.css +670 -0
  55. vibe_surf/chrome_extension/styles/main.css +2307 -0
  56. vibe_surf/chrome_extension/styles/settings.css +1100 -0
  57. vibe_surf/cli.py +357 -0
  58. vibe_surf/controller/__init__.py +0 -0
  59. vibe_surf/controller/file_system.py +53 -0
  60. vibe_surf/controller/mcp_client.py +68 -0
  61. vibe_surf/controller/vibesurf_controller.py +616 -0
  62. vibe_surf/controller/views.py +37 -0
  63. vibe_surf/llm/__init__.py +21 -0
  64. vibe_surf/llm/openai_compatible.py +237 -0
  65. vibesurf-0.1.0.dist-info/METADATA +97 -0
  66. vibesurf-0.1.0.dist-info/RECORD +70 -0
  67. vibesurf-0.1.0.dist-info/WHEEL +5 -0
  68. vibesurf-0.1.0.dist-info/entry_points.txt +2 -0
  69. vibesurf-0.1.0.dist-info/licenses/LICENSE +201 -0
  70. vibesurf-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,491 @@
1
+ // Main Entry Point - VibeSurf Chrome Extension
2
+ // Initializes and coordinates all components of the extension
3
+
4
+ console.log('[VibeSurf] Main script starting...');
5
+
6
+ class VibeSurfApp {
7
+ constructor() {
8
+ this.apiClient = null;
9
+ this.sessionManager = null;
10
+ this.uiManager = null;
11
+ this.settings = {};
12
+ this.isInitialized = false;
13
+
14
+ console.log('[VibeSurf] Application starting...');
15
+ }
16
+
17
+ async initialize() {
18
+ try {
19
+ console.log('[VibeSurf] Initializing application...');
20
+
21
+ // Load settings from storage
22
+ await this.loadSettings();
23
+
24
+ // Initialize API client
25
+ this.initializeAPIClient();
26
+
27
+ // Check backend connectivity
28
+ await this.checkBackendConnection();
29
+
30
+ // Initialize session manager
31
+ this.initializeSessionManager();
32
+
33
+ // Initialize UI manager
34
+ await this.initializeUIManager();
35
+
36
+ // Setup global error handling
37
+ this.setupErrorHandling();
38
+
39
+ // Setup periodic health checks
40
+ this.setupHealthChecks();
41
+
42
+ this.isInitialized = true;
43
+
44
+ console.log('[VibeSurf] Application initialized successfully');
45
+
46
+ // Show success notification
47
+ chrome.runtime.sendMessage({
48
+ type: 'SHOW_NOTIFICATION',
49
+ data: {
50
+ title: 'VibeSurf Ready',
51
+ message: 'Extension is ready to automate your browsing tasks!'
52
+ }
53
+ });
54
+
55
+ } catch (error) {
56
+ console.error('[VibeSurf] Initialization failed:', error);
57
+ this.handleInitializationError(error);
58
+ }
59
+ }
60
+
61
+ async loadSettings() {
62
+ try {
63
+ const result = await chrome.storage.local.get('settings');
64
+ this.settings = result.settings || {};
65
+
66
+ // Apply default settings if not present
67
+ const defaultSettings = {
68
+ backendUrl: 'http://localhost:9335',
69
+ defaultSessionPrefix: 'vibesurf_',
70
+ pollingFrequency: 1000,
71
+ notifications: {
72
+ enabled: true,
73
+ taskComplete: true,
74
+ taskError: true
75
+ },
76
+ ui: {
77
+ theme: 'auto',
78
+ autoScroll: true,
79
+ compactMode: false
80
+ },
81
+ debug: false
82
+ };
83
+
84
+ this.settings = { ...defaultSettings, ...this.settings };
85
+
86
+ // Save merged settings back
87
+ await chrome.storage.local.set({ settings: this.settings });
88
+
89
+ console.log('[VibeSurf] Settings loaded:', this.settings);
90
+ } catch (error) {
91
+ console.error('[VibeSurf] Failed to load settings:', error);
92
+ this.settings = {};
93
+ }
94
+ }
95
+
96
+ initializeAPIClient() {
97
+ const backendUrl = this.settings.backendUrl || 'http://localhost:8000';
98
+ this.apiClient = new VibeSurfAPIClient(backendUrl);
99
+
100
+ console.log('[VibeSurf] API client initialized with URL:', backendUrl);
101
+ }
102
+
103
+ async checkBackendConnection() {
104
+ try {
105
+ console.log('[VibeSurf] Checking backend connection...');
106
+
107
+ const healthCheck = await this.apiClient.healthCheck();
108
+
109
+ if (healthCheck.status === 'healthy') {
110
+ console.log('[VibeSurf] Backend connection successful');
111
+
112
+ // Update badge to show connected status
113
+ chrome.runtime.sendMessage({
114
+ type: 'UPDATE_BADGE',
115
+ data: { text: '●', color: '#28a745' }
116
+ });
117
+
118
+ } else {
119
+ throw new Error('Backend health check failed');
120
+ }
121
+
122
+ } catch (error) {
123
+ console.error('[VibeSurf] Backend connection failed:', error);
124
+
125
+ // Update badge to show disconnected status
126
+ chrome.runtime.sendMessage({
127
+ type: 'UPDATE_BADGE',
128
+ data: { text: '●', color: '#dc3545' }
129
+ });
130
+
131
+ // Show warning notification
132
+ chrome.runtime.sendMessage({
133
+ type: 'SHOW_NOTIFICATION',
134
+ data: {
135
+ title: 'VibeSurf Backend Disconnected',
136
+ message: 'Cannot connect to VibeSurf backend. Please check if the server is running.'
137
+ }
138
+ });
139
+
140
+ throw error;
141
+ }
142
+ }
143
+
144
+ initializeSessionManager() {
145
+ this.sessionManager = new VibeSurfSessionManager(this.apiClient);
146
+
147
+ // Configure polling frequency from settings
148
+ if (this.settings.pollingFrequency) {
149
+ this.sessionManager.pollingFrequency = this.settings.pollingFrequency;
150
+ }
151
+
152
+ console.log('[VibeSurf] Session manager initialized');
153
+ }
154
+
155
+ async initializeUIManager() {
156
+ this.uiManager = new VibeSurfUIManager(this.sessionManager, this.apiClient);
157
+
158
+ // Initialize UI with loaded data
159
+ await this.uiManager.initialize();
160
+
161
+ console.log('[VibeSurf] UI manager initialized');
162
+ }
163
+
164
+ setupErrorHandling() {
165
+ // Global error handler for unhandled promise rejections
166
+ window.addEventListener('unhandledrejection', (event) => {
167
+ console.error('[VibeSurf] Unhandled promise rejection:', event.reason);
168
+
169
+ if (this.settings.notifications?.enabled) {
170
+ chrome.runtime.sendMessage({
171
+ type: 'SHOW_NOTIFICATION',
172
+ data: {
173
+ title: 'VibeSurf Error',
174
+ message: 'An unexpected error occurred. Check the console for details.'
175
+ }
176
+ });
177
+ }
178
+ });
179
+
180
+ // Global error handler for script errors
181
+ window.addEventListener('error', (event) => {
182
+ console.error('[VibeSurf] Script error:', event.error);
183
+ });
184
+
185
+ console.log('[VibeSurf] Error handling setup complete');
186
+ }
187
+
188
+ setupHealthChecks() {
189
+ // Periodic backend health check
190
+ setInterval(async () => {
191
+ try {
192
+ const healthCheck = await this.apiClient.healthCheck();
193
+
194
+ if (healthCheck.status === 'healthy') {
195
+ // Update badge to green if we're connected
196
+ chrome.runtime.sendMessage({
197
+ type: 'UPDATE_BADGE',
198
+ data: { text: '●', color: '#28a745' }
199
+ });
200
+ } else {
201
+ // Update badge to red if health check fails
202
+ chrome.runtime.sendMessage({
203
+ type: 'UPDATE_BADGE',
204
+ data: { text: '●', color: '#dc3545' }
205
+ });
206
+ }
207
+
208
+ } catch (error) {
209
+ // Silently handle health check failures
210
+ console.warn('[VibeSurf] Health check failed:', error.message);
211
+
212
+ chrome.runtime.sendMessage({
213
+ type: 'UPDATE_BADGE',
214
+ data: { text: '●', color: '#dc3545' }
215
+ });
216
+ }
217
+ }, 30000); // Check every 30 seconds
218
+
219
+ console.log('[VibeSurf] Health checks setup complete');
220
+ }
221
+
222
+ handleInitializationError(error) {
223
+ console.error('[VibeSurf] Initialization error:', error);
224
+
225
+ // Show error in UI
226
+ const errorElement = document.createElement('div');
227
+ errorElement.className = 'initialization-error';
228
+ errorElement.innerHTML = `
229
+ <div style="padding: 20px; text-align: center; color: #dc3545;">
230
+ <h3>VibeSurf Initialization Failed</h3>
231
+ <p>${error.message}</p>
232
+ <button id="retry-initialization-btn" style="
233
+ padding: 8px 16px;
234
+ border: 1px solid #dc3545;
235
+ background: #dc3545;
236
+ color: white;
237
+ border-radius: 4px;
238
+ cursor: pointer;
239
+ margin-top: 10px;
240
+ ">Retry</button>
241
+ </div>
242
+ `;
243
+
244
+ document.body.innerHTML = '';
245
+ document.body.appendChild(errorElement);
246
+
247
+ // Add proper retry event listener
248
+ const retryBtn = document.getElementById('retry-initialization-btn');
249
+ retryBtn.addEventListener('click', () => {
250
+ console.log('[VibeSurf] Retrying initialization...');
251
+ this.retryInitialization();
252
+ });
253
+
254
+ // Update badge to show error
255
+ chrome.runtime.sendMessage({
256
+ type: 'UPDATE_BADGE',
257
+ data: { text: '!', color: '#dc3545' }
258
+ });
259
+
260
+ // Show error notification
261
+ chrome.runtime.sendMessage({
262
+ type: 'SHOW_NOTIFICATION',
263
+ data: {
264
+ title: 'VibeSurf Error',
265
+ message: `Initialization failed: ${error.message}`
266
+ }
267
+ });
268
+ }
269
+
270
+ async retryInitialization() {
271
+ console.log('[VibeSurf] Retrying initialization...');
272
+
273
+ try {
274
+ // Clear any existing error UI
275
+ const errorElement = document.querySelector('.initialization-error');
276
+ if (errorElement) {
277
+ errorElement.remove();
278
+ }
279
+
280
+ // Restore the original HTML structure
281
+ document.body.innerHTML = `
282
+ <div id="app" class="vibesurf-container">
283
+ <!-- Header -->
284
+ <header class="header">
285
+ <div class="header-left">
286
+ <div class="logo">
287
+ <div class="logo-content">
288
+ <span class="logo-text">VibeSurf Activity Logs</span>
289
+ <div class="session-info">
290
+ <span class="session-label">Session:</span>
291
+ <span id="session-id">-</span>
292
+ <button id="copy-session-btn" class="copy-btn" title="Copy Session ID">
293
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
294
+ <path d="M16 1H4C2.9 1 2 1.9 2 3V17H4V3H16V1ZM19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z" fill="currentColor"/>
295
+ </svg>
296
+ </button>
297
+ </div>
298
+ </div>
299
+ </div>
300
+ </div>
301
+ <div class="header-right">
302
+ <button id="new-session-btn" class="icon-btn" title="New Session">
303
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
304
+ <path d="M12 4V20M4 12H20" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
305
+ </svg>
306
+ </button>
307
+ <button id="history-btn" class="icon-btn" title="Chat History">
308
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
309
+ <path d="M3 3V11A4 4 0 0 0 7 15H17L21 19V3H3Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
310
+ </svg>
311
+ </button>
312
+ <button id="settings-btn" class="icon-btn" title="Settings">
313
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
314
+ <path d="M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z" stroke="currentColor" stroke-width="2"/>
315
+ </svg>
316
+ </button>
317
+ </div>
318
+ </header>
319
+
320
+ <!-- Main Content -->
321
+ <main class="main-content">
322
+ <div class="activity-section">
323
+ <div id="activity-log" class="activity-log">
324
+ <div class="loading-message" style="text-align: center; padding: 20px; color: #666;">
325
+ <div>Connecting to VibeSurf...</div>
326
+ </div>
327
+ </div>
328
+ </div>
329
+ <div id="control-panel" class="control-panel hidden"></div>
330
+ </main>
331
+
332
+ <!-- Input Section -->
333
+ <footer class="input-section">
334
+ <div class="input-container">
335
+ <div class="input-main">
336
+ <div class="textarea-container">
337
+ <textarea id="task-input" class="task-input" placeholder="Describe your browsing task..." rows="3"></textarea>
338
+ <div class="input-actions">
339
+ <button id="attach-file-btn" class="action-btn attach-btn" title="Attach Files">
340
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
341
+ <path d="M21.44 11.05L12.25 20.24C11.1242 21.3658 9.59722 21.9983 8.005 21.9983C6.41278 21.9983 4.88583 21.3658 3.76 20.24C2.63417 19.1142 2.00166 17.5872 2.00166 15.995C2.00166 14.4028 2.63417 12.8758 3.76 11.75L12.33 3.18C13.0806 2.42944 14.0986 2.00696 15.16 2.00696C16.2214 2.00696 17.2394 2.42944 17.99 3.18C18.7406 3.93056 19.163 4.94859 19.163 6.01C19.163 7.07141 18.7406 8.08944 17.99 8.84L10.07 16.76C9.69469 17.1353 9.1897 17.3442 8.665 17.3442C8.1403 17.3442 7.63531 17.1353 7.26 16.76C6.88469 16.3847 6.67581 15.8797 6.67581 15.355C6.67581 14.8303 6.88469 14.3253 7.26 13.95L15.19 6.02" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
342
+ </svg>
343
+ </button>
344
+ <button id="send-btn" class="action-btn send-btn" title="Send Task">
345
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
346
+ <path d="M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
347
+ </svg>
348
+ </button>
349
+ </div>
350
+ </div>
351
+ </div>
352
+ <div class="input-footer">
353
+ <select id="llm-profile-select" class="llm-select compact"></select>
354
+ </div>
355
+ </div>
356
+ <input type="file" id="file-input" class="hidden" multiple accept="*/*">
357
+ </footer>
358
+ </div>
359
+ `;
360
+
361
+ // Reset state
362
+ this.isInitialized = false;
363
+ this.apiClient = null;
364
+ this.sessionManager = null;
365
+ this.uiManager = null;
366
+
367
+ // Retry initialization
368
+ await this.initialize();
369
+
370
+ } catch (error) {
371
+ console.error('[VibeSurf] Retry initialization failed:', error);
372
+ this.handleInitializationError(error);
373
+ }
374
+ }
375
+
376
+ // Settings management
377
+ async updateSettings(newSettings) {
378
+ this.settings = { ...this.settings, ...newSettings };
379
+
380
+ try {
381
+ await chrome.storage.local.set({ settings: this.settings });
382
+
383
+ // Apply settings to components
384
+ if (newSettings.backendUrl && this.apiClient) {
385
+ this.apiClient.setBaseURL(newSettings.backendUrl);
386
+
387
+ // Re-check backend connection
388
+ await this.checkBackendConnection();
389
+ }
390
+
391
+ if (newSettings.pollingFrequency && this.sessionManager) {
392
+ this.sessionManager.pollingFrequency = newSettings.pollingFrequency;
393
+ }
394
+
395
+ console.log('[VibeSurf] Settings updated:', newSettings);
396
+
397
+ } catch (error) {
398
+ console.error('[VibeSurf] Failed to update settings:', error);
399
+ throw error;
400
+ }
401
+ }
402
+
403
+ // Current tab context
404
+ async getCurrentTabContext() {
405
+ try {
406
+ const tabInfo = await chrome.runtime.sendMessage({ type: 'GET_CURRENT_TAB' });
407
+ return tabInfo;
408
+ } catch (error) {
409
+ console.error('[VibeSurf] Failed to get current tab context:', error);
410
+ return null;
411
+ }
412
+ }
413
+
414
+ // Cleanup method
415
+ destroy() {
416
+ console.log('[VibeSurf] Cleaning up application...');
417
+
418
+ if (this.uiManager) {
419
+ this.uiManager.destroy();
420
+ }
421
+
422
+ if (this.sessionManager) {
423
+ this.sessionManager.destroy();
424
+ }
425
+
426
+ this.isInitialized = false;
427
+ console.log('[VibeSurf] Application cleanup complete');
428
+ }
429
+
430
+ // Get application status
431
+ getStatus() {
432
+ return {
433
+ initialized: this.isInitialized,
434
+ hasActiveSession: this.sessionManager?.isSessionActive() || false,
435
+ hasActiveTask: this.sessionManager?.hasActiveTask() || false,
436
+ currentSessionId: this.sessionManager?.getCurrentSessionId() || null,
437
+ backendUrl: this.settings.backendUrl || 'Not configured',
438
+ taskStatus: this.sessionManager?.getTaskStatus() || null
439
+ };
440
+ }
441
+ }
442
+
443
+ // Initialize the application when DOM is loaded
444
+ document.addEventListener('DOMContentLoaded', async () => {
445
+ console.log('[VibeSurf] DOM loaded, initializing application...');
446
+
447
+ // Create global app instance
448
+ window.vibeSurfApp = new VibeSurfApp();
449
+
450
+ try {
451
+ await window.vibeSurfApp.initialize();
452
+ } catch (error) {
453
+ console.error('[VibeSurf] Failed to initialize app:', error);
454
+ }
455
+ });
456
+
457
+ // Handle page unload
458
+ window.addEventListener('beforeunload', () => {
459
+ if (window.vibeSurfApp) {
460
+ window.vibeSurfApp.destroy();
461
+ }
462
+ });
463
+
464
+ // Make app accessible for debugging
465
+ if (typeof window !== 'undefined') {
466
+ window.VibeSurfApp = VibeSurfApp;
467
+ }
468
+
469
+ // Handle messages from background script
470
+ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
471
+ console.log('[VibeSurf] Received message from background:', message.type);
472
+
473
+ if (window.vibeSurfApp) {
474
+ switch (message.type) {
475
+ case 'GET_APP_STATUS':
476
+ sendResponse(window.vibeSurfApp.getStatus());
477
+ break;
478
+
479
+ case 'UPDATE_SETTINGS':
480
+ window.vibeSurfApp.updateSettings(message.data)
481
+ .then(() => sendResponse({ success: true }))
482
+ .catch(error => sendResponse({ success: false, error: error.message }));
483
+ return true; // Keep message channel open for async response
484
+
485
+ default:
486
+ console.warn('[VibeSurf] Unknown message type:', message.type);
487
+ }
488
+ }
489
+ });
490
+
491
+ console.log('[VibeSurf] Main script loaded');