vibesurf 0.1.9a6__py3-none-any.whl → 0.1.11__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.
- vibe_surf/_version.py +2 -2
- vibe_surf/agents/browser_use_agent.py +68 -45
- vibe_surf/agents/prompts/report_writer_prompt.py +73 -0
- vibe_surf/agents/prompts/vibe_surf_prompt.py +85 -172
- vibe_surf/agents/report_writer_agent.py +380 -226
- vibe_surf/agents/vibe_surf_agent.py +878 -814
- vibe_surf/agents/views.py +130 -0
- vibe_surf/backend/api/activity.py +3 -1
- vibe_surf/backend/api/browser.py +70 -0
- vibe_surf/backend/api/config.py +8 -5
- vibe_surf/backend/api/files.py +59 -50
- vibe_surf/backend/api/models.py +2 -2
- vibe_surf/backend/api/task.py +47 -13
- vibe_surf/backend/database/manager.py +24 -18
- vibe_surf/backend/database/queries.py +199 -192
- vibe_surf/backend/database/schemas.py +1 -1
- vibe_surf/backend/main.py +80 -3
- vibe_surf/backend/shared_state.py +30 -35
- vibe_surf/backend/utils/encryption.py +3 -1
- vibe_surf/backend/utils/llm_factory.py +41 -36
- vibe_surf/browser/agent_browser_session.py +308 -62
- vibe_surf/browser/browser_manager.py +71 -100
- vibe_surf/browser/utils.py +5 -3
- vibe_surf/browser/watchdogs/dom_watchdog.py +0 -45
- vibe_surf/chrome_extension/background.js +88 -0
- vibe_surf/chrome_extension/manifest.json +3 -1
- vibe_surf/chrome_extension/scripts/api-client.js +13 -0
- vibe_surf/chrome_extension/scripts/file-manager.js +482 -0
- vibe_surf/chrome_extension/scripts/history-manager.js +658 -0
- vibe_surf/chrome_extension/scripts/modal-manager.js +487 -0
- vibe_surf/chrome_extension/scripts/session-manager.js +52 -11
- vibe_surf/chrome_extension/scripts/settings-manager.js +1214 -0
- vibe_surf/chrome_extension/scripts/ui-manager.js +1530 -3163
- vibe_surf/chrome_extension/sidepanel.html +47 -7
- vibe_surf/chrome_extension/styles/activity.css +934 -0
- vibe_surf/chrome_extension/styles/base.css +76 -0
- vibe_surf/chrome_extension/styles/history-modal.css +791 -0
- vibe_surf/chrome_extension/styles/input.css +568 -0
- vibe_surf/chrome_extension/styles/layout.css +186 -0
- vibe_surf/chrome_extension/styles/responsive.css +454 -0
- vibe_surf/chrome_extension/styles/settings-environment.css +165 -0
- vibe_surf/chrome_extension/styles/settings-forms.css +389 -0
- vibe_surf/chrome_extension/styles/settings-modal.css +141 -0
- vibe_surf/chrome_extension/styles/settings-profiles.css +244 -0
- vibe_surf/chrome_extension/styles/settings-responsive.css +144 -0
- vibe_surf/chrome_extension/styles/settings-utilities.css +25 -0
- vibe_surf/chrome_extension/styles/variables.css +54 -0
- vibe_surf/cli.py +5 -22
- vibe_surf/common.py +35 -0
- vibe_surf/llm/openai_compatible.py +148 -93
- vibe_surf/logger.py +99 -0
- vibe_surf/{controller/vibesurf_tools.py → tools/browser_use_tools.py} +233 -221
- vibe_surf/tools/file_system.py +415 -0
- vibe_surf/{controller → tools}/mcp_client.py +4 -3
- vibe_surf/tools/report_writer_tools.py +21 -0
- vibe_surf/tools/vibesurf_tools.py +657 -0
- vibe_surf/tools/views.py +120 -0
- {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.11.dist-info}/METADATA +23 -3
- vibesurf-0.1.11.dist-info/RECORD +93 -0
- vibe_surf/chrome_extension/styles/main.css +0 -2338
- vibe_surf/chrome_extension/styles/settings.css +0 -1100
- vibe_surf/controller/file_system.py +0 -53
- vibe_surf/controller/views.py +0 -37
- vibesurf-0.1.9a6.dist-info/RECORD +0 -71
- /vibe_surf/{controller → tools}/__init__.py +0 -0
- {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.11.dist-info}/WHEEL +0 -0
- {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.11.dist-info}/entry_points.txt +0 -0
- {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.11.dist-info}/licenses/LICENSE +0 -0
- {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.11.dist-info}/top_level.txt +0 -0
vibe_surf/browser/utils.py
CHANGED
|
@@ -22,7 +22,9 @@ import numpy as np
|
|
|
22
22
|
from typing import Optional, Tuple, List, Any
|
|
23
23
|
import io
|
|
24
24
|
|
|
25
|
-
logger
|
|
25
|
+
from vibe_surf.logger import get_logger
|
|
26
|
+
|
|
27
|
+
logger = get_logger(__name__)
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
# List of common font file names (Prioritize preferred ones first)
|
|
@@ -601,7 +603,7 @@ def highlight_screenshot(screenshot_base64: str, elements: List[List[Any]]) -> s
|
|
|
601
603
|
|
|
602
604
|
# --- Default if all corners overlap (Logic unchanged) ---
|
|
603
605
|
if not found_non_overlapping_spot:
|
|
604
|
-
logger.debug(f"Could not avoid label overlap for index {highlight_index}. Defaulting to top-left.")
|
|
606
|
+
# logger.debug(f"Could not avoid label overlap for index {highlight_index}. Defaulting to top-left.")
|
|
605
607
|
chosen_label_bg_box, potential_text_ref_pos = calculate_label_placement(
|
|
606
608
|
corner='top_left', # Default corner from original code
|
|
607
609
|
outline_box=draw_box_outline,
|
|
@@ -618,7 +620,7 @@ def highlight_screenshot(screenshot_base64: str, elements: List[List[Any]]) -> s
|
|
|
618
620
|
potential_text_ref_pos[0] + w_padding // 2,
|
|
619
621
|
potential_text_ref_pos[1] + h_padding // 2) # ** OFFSET FROM ORIGINAL CODE **
|
|
620
622
|
else:
|
|
621
|
-
logger.debug(f"Default top-left placement failed for index {highlight_index}. Skipping label.")
|
|
623
|
+
# logger.debug(f"Default top-left placement failed for index {highlight_index}. Skipping label.")
|
|
622
624
|
chosen_label_bg_box = None
|
|
623
625
|
chosen_text_pos = None
|
|
624
626
|
|
|
@@ -72,51 +72,6 @@ class CustomDOMWatchdog(DOMWatchdog):
|
|
|
72
72
|
self.logger.debug(f'🔍 DOMWatchdog.on_BrowserStateRequestEvent: Tabs info: {tabs_info}')
|
|
73
73
|
|
|
74
74
|
try:
|
|
75
|
-
# Fast path for empty pages
|
|
76
|
-
if not_a_meaningful_website:
|
|
77
|
-
self.logger.debug(f'⚡ Skipping BuildDOMTree for empty target: {page_url}')
|
|
78
|
-
self.logger.info(f'📸 Not taking screenshot for empty page: {page_url} (non-http/https URL)')
|
|
79
|
-
|
|
80
|
-
# Create minimal DOM state
|
|
81
|
-
content = SerializedDOMState(_root=None, selector_map={})
|
|
82
|
-
|
|
83
|
-
# Skip screenshot for empty pages
|
|
84
|
-
screenshot_b64 = None
|
|
85
|
-
|
|
86
|
-
# Try to get page info from CDP, fall back to defaults if unavailable
|
|
87
|
-
try:
|
|
88
|
-
page_info = await self._get_page_info()
|
|
89
|
-
except Exception as e:
|
|
90
|
-
self.logger.debug(f'Failed to get page info from CDP for empty page: {e}, using fallback')
|
|
91
|
-
# Use default viewport dimensions
|
|
92
|
-
viewport = self.browser_session.browser_profile.viewport or {'width': 1280, 'height': 720}
|
|
93
|
-
page_info = PageInfo(
|
|
94
|
-
viewport_width=viewport['width'],
|
|
95
|
-
viewport_height=viewport['height'],
|
|
96
|
-
page_width=viewport['width'],
|
|
97
|
-
page_height=viewport['height'],
|
|
98
|
-
scroll_x=0,
|
|
99
|
-
scroll_y=0,
|
|
100
|
-
pixels_above=0,
|
|
101
|
-
pixels_below=0,
|
|
102
|
-
pixels_left=0,
|
|
103
|
-
pixels_right=0,
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
return BrowserStateSummary(
|
|
107
|
-
dom_state=content,
|
|
108
|
-
url=page_url,
|
|
109
|
-
title='Empty Tab',
|
|
110
|
-
tabs=tabs_info,
|
|
111
|
-
screenshot=screenshot_b64,
|
|
112
|
-
page_info=page_info,
|
|
113
|
-
pixels_above=0,
|
|
114
|
-
pixels_below=0,
|
|
115
|
-
browser_errors=[],
|
|
116
|
-
is_pdf_viewer=False,
|
|
117
|
-
recent_events=self._get_recent_events_str() if include_recent_events else None,
|
|
118
|
-
)
|
|
119
|
-
|
|
120
75
|
# Execute DOM building and screenshot capture in parallel
|
|
121
76
|
dom_task = None
|
|
122
77
|
screenshot_task = None
|
|
@@ -174,6 +174,10 @@ class VibeSurfBackground {
|
|
|
174
174
|
result = await this.showNotification(message.data);
|
|
175
175
|
break;
|
|
176
176
|
|
|
177
|
+
case 'COPY_TO_CLIPBOARD':
|
|
178
|
+
result = await this.copyToClipboard(message.text);
|
|
179
|
+
break;
|
|
180
|
+
|
|
177
181
|
case 'HEALTH_CHECK':
|
|
178
182
|
result = { status: 'healthy', timestamp: Date.now() };
|
|
179
183
|
break;
|
|
@@ -198,6 +202,10 @@ class VibeSurfBackground {
|
|
|
198
202
|
result = await this.openFileSystem(message.data?.filePath);
|
|
199
203
|
break;
|
|
200
204
|
|
|
205
|
+
case 'GET_ALL_TABS':
|
|
206
|
+
result = await this.getAllTabs();
|
|
207
|
+
break;
|
|
208
|
+
|
|
201
209
|
default:
|
|
202
210
|
console.warn('[VibeSurf] Unknown message type:', message.type);
|
|
203
211
|
result = { error: 'Unknown message type' };
|
|
@@ -536,6 +544,86 @@ class VibeSurfBackground {
|
|
|
536
544
|
}
|
|
537
545
|
}
|
|
538
546
|
|
|
547
|
+
async copyToClipboard(text) {
|
|
548
|
+
console.log('[VibeSurf] Handling clipboard request, text length:', text?.length);
|
|
549
|
+
|
|
550
|
+
try {
|
|
551
|
+
// For Chrome extensions running in service worker context,
|
|
552
|
+
// clipboard access is limited. We need to inject script into active tab.
|
|
553
|
+
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
|
554
|
+
|
|
555
|
+
if (!tab) {
|
|
556
|
+
throw new Error('No active tab found');
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// Check if we can inject script into this tab
|
|
560
|
+
if (tab.url.startsWith('chrome://') || tab.url.startsWith('chrome-extension://') ||
|
|
561
|
+
tab.url.startsWith('edge://') || tab.url.startsWith('moz-extension://')) {
|
|
562
|
+
throw new Error('Cannot access clipboard from this type of page');
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Inject script to handle clipboard operation
|
|
566
|
+
const results = await chrome.scripting.executeScript({
|
|
567
|
+
target: { tabId: tab.id },
|
|
568
|
+
func: (textToCopy) => {
|
|
569
|
+
try {
|
|
570
|
+
// Method 1: Try modern clipboard API
|
|
571
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
572
|
+
return navigator.clipboard.writeText(textToCopy).then(() => {
|
|
573
|
+
return { success: true, method: 'modern' };
|
|
574
|
+
}).catch((error) => {
|
|
575
|
+
console.warn('Modern clipboard API failed:', error);
|
|
576
|
+
// Fall back to execCommand
|
|
577
|
+
return fallbackCopy();
|
|
578
|
+
});
|
|
579
|
+
} else {
|
|
580
|
+
// Method 2: Fall back to execCommand
|
|
581
|
+
return Promise.resolve(fallbackCopy());
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function fallbackCopy() {
|
|
585
|
+
try {
|
|
586
|
+
const textArea = document.createElement('textarea');
|
|
587
|
+
textArea.value = textToCopy;
|
|
588
|
+
textArea.style.position = 'fixed';
|
|
589
|
+
textArea.style.left = '-999999px';
|
|
590
|
+
textArea.style.top = '-999999px';
|
|
591
|
+
textArea.style.opacity = '0';
|
|
592
|
+
document.body.appendChild(textArea);
|
|
593
|
+
textArea.focus();
|
|
594
|
+
textArea.select();
|
|
595
|
+
textArea.setSelectionRange(0, textArea.value.length);
|
|
596
|
+
|
|
597
|
+
const success = document.execCommand('copy');
|
|
598
|
+
document.body.removeChild(textArea);
|
|
599
|
+
|
|
600
|
+
return { success: success, method: 'execCommand' };
|
|
601
|
+
} catch (error) {
|
|
602
|
+
return { success: false, error: error.message };
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
} catch (error) {
|
|
606
|
+
return { success: false, error: error.message };
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
args: [text]
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
const result = await results[0].result;
|
|
613
|
+
console.log('[VibeSurf] Clipboard operation result:', result);
|
|
614
|
+
|
|
615
|
+
if (result.success) {
|
|
616
|
+
return { success: true, method: result.method };
|
|
617
|
+
} else {
|
|
618
|
+
throw new Error(result.error || 'Clipboard operation failed');
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
} catch (error) {
|
|
622
|
+
console.error('[VibeSurf] Clipboard operation failed:', error);
|
|
623
|
+
return { success: false, error: error.message };
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
539
627
|
// Cleanup method for extension unload
|
|
540
628
|
async cleanup() {
|
|
541
629
|
|
|
@@ -235,6 +235,10 @@ class VibeSurfAPIClient {
|
|
|
235
235
|
return this.post('/tasks/stop', { reason });
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
async addNewTask(newTask) {
|
|
239
|
+
return this.post('/tasks/add-new-task', { reason: newTask });
|
|
240
|
+
}
|
|
241
|
+
|
|
238
242
|
// Activity APIs
|
|
239
243
|
async getTaskInfo(taskId) {
|
|
240
244
|
return this.get(`/activity/${taskId}`);
|
|
@@ -416,6 +420,15 @@ class VibeSurfAPIClient {
|
|
|
416
420
|
return this.put('/config/controller', configData);
|
|
417
421
|
}
|
|
418
422
|
|
|
423
|
+
// Browser APIs
|
|
424
|
+
async getActiveBrowserTab() {
|
|
425
|
+
return this.get('/browser/active-tab');
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
async getAllBrowserTabs() {
|
|
429
|
+
return this.get('/browser/all-tabs');
|
|
430
|
+
}
|
|
431
|
+
|
|
419
432
|
// Utility methods
|
|
420
433
|
delay(ms) {
|
|
421
434
|
return new Promise(resolve => setTimeout(resolve, ms));
|