vibesurf 0.1.9a6__py3-none-any.whl → 0.1.10__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.
Files changed (41) hide show
  1. vibe_surf/_version.py +2 -2
  2. vibe_surf/agents/vibe_surf_agent.py +25 -15
  3. vibe_surf/backend/api/browser.py +66 -0
  4. vibe_surf/backend/api/task.py +2 -1
  5. vibe_surf/backend/main.py +76 -1
  6. vibe_surf/backend/shared_state.py +2 -0
  7. vibe_surf/browser/agent_browser_session.py +312 -62
  8. vibe_surf/browser/browser_manager.py +57 -92
  9. vibe_surf/browser/watchdogs/dom_watchdog.py +43 -43
  10. vibe_surf/chrome_extension/background.js +84 -0
  11. vibe_surf/chrome_extension/manifest.json +3 -1
  12. vibe_surf/chrome_extension/scripts/file-manager.js +526 -0
  13. vibe_surf/chrome_extension/scripts/history-manager.js +658 -0
  14. vibe_surf/chrome_extension/scripts/modal-manager.js +487 -0
  15. vibe_surf/chrome_extension/scripts/session-manager.js +31 -8
  16. vibe_surf/chrome_extension/scripts/settings-manager.js +1214 -0
  17. vibe_surf/chrome_extension/scripts/ui-manager.js +770 -3186
  18. vibe_surf/chrome_extension/sidepanel.html +27 -4
  19. vibe_surf/chrome_extension/styles/activity.css +574 -0
  20. vibe_surf/chrome_extension/styles/base.css +76 -0
  21. vibe_surf/chrome_extension/styles/history-modal.css +791 -0
  22. vibe_surf/chrome_extension/styles/input.css +429 -0
  23. vibe_surf/chrome_extension/styles/layout.css +186 -0
  24. vibe_surf/chrome_extension/styles/responsive.css +454 -0
  25. vibe_surf/chrome_extension/styles/settings-environment.css +165 -0
  26. vibe_surf/chrome_extension/styles/settings-forms.css +389 -0
  27. vibe_surf/chrome_extension/styles/settings-modal.css +141 -0
  28. vibe_surf/chrome_extension/styles/settings-profiles.css +244 -0
  29. vibe_surf/chrome_extension/styles/settings-responsive.css +144 -0
  30. vibe_surf/chrome_extension/styles/settings-utilities.css +25 -0
  31. vibe_surf/chrome_extension/styles/variables.css +54 -0
  32. vibe_surf/cli.py +1 -0
  33. vibe_surf/controller/vibesurf_tools.py +0 -2
  34. {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.10.dist-info}/METADATA +18 -2
  35. {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.10.dist-info}/RECORD +39 -23
  36. vibe_surf/chrome_extension/styles/main.css +0 -2338
  37. vibe_surf/chrome_extension/styles/settings.css +0 -1100
  38. {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.10.dist-info}/WHEEL +0 -0
  39. {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.10.dist-info}/entry_points.txt +0 -0
  40. {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.10.dist-info}/licenses/LICENSE +0 -0
  41. {vibesurf-0.1.9a6.dist-info → vibesurf-0.1.10.dist-info}/top_level.txt +0 -0
@@ -73,49 +73,49 @@ class CustomDOMWatchdog(DOMWatchdog):
73
73
 
74
74
  try:
75
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
- )
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
119
 
120
120
  # Execute DOM building and screenshot capture in parallel
121
121
  dom_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;
@@ -536,6 +540,86 @@ class VibeSurfBackground {
536
540
  }
537
541
  }
538
542
 
543
+ async copyToClipboard(text) {
544
+ console.log('[VibeSurf] Handling clipboard request, text length:', text?.length);
545
+
546
+ try {
547
+ // For Chrome extensions running in service worker context,
548
+ // clipboard access is limited. We need to inject script into active tab.
549
+ const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
550
+
551
+ if (!tab) {
552
+ throw new Error('No active tab found');
553
+ }
554
+
555
+ // Check if we can inject script into this tab
556
+ if (tab.url.startsWith('chrome://') || tab.url.startsWith('chrome-extension://') ||
557
+ tab.url.startsWith('edge://') || tab.url.startsWith('moz-extension://')) {
558
+ throw new Error('Cannot access clipboard from this type of page');
559
+ }
560
+
561
+ // Inject script to handle clipboard operation
562
+ const results = await chrome.scripting.executeScript({
563
+ target: { tabId: tab.id },
564
+ func: (textToCopy) => {
565
+ try {
566
+ // Method 1: Try modern clipboard API
567
+ if (navigator.clipboard && navigator.clipboard.writeText) {
568
+ return navigator.clipboard.writeText(textToCopy).then(() => {
569
+ return { success: true, method: 'modern' };
570
+ }).catch((error) => {
571
+ console.warn('Modern clipboard API failed:', error);
572
+ // Fall back to execCommand
573
+ return fallbackCopy();
574
+ });
575
+ } else {
576
+ // Method 2: Fall back to execCommand
577
+ return Promise.resolve(fallbackCopy());
578
+ }
579
+
580
+ function fallbackCopy() {
581
+ try {
582
+ const textArea = document.createElement('textarea');
583
+ textArea.value = textToCopy;
584
+ textArea.style.position = 'fixed';
585
+ textArea.style.left = '-999999px';
586
+ textArea.style.top = '-999999px';
587
+ textArea.style.opacity = '0';
588
+ document.body.appendChild(textArea);
589
+ textArea.focus();
590
+ textArea.select();
591
+ textArea.setSelectionRange(0, textArea.value.length);
592
+
593
+ const success = document.execCommand('copy');
594
+ document.body.removeChild(textArea);
595
+
596
+ return { success: success, method: 'execCommand' };
597
+ } catch (error) {
598
+ return { success: false, error: error.message };
599
+ }
600
+ }
601
+ } catch (error) {
602
+ return { success: false, error: error.message };
603
+ }
604
+ },
605
+ args: [text]
606
+ });
607
+
608
+ const result = await results[0].result;
609
+ console.log('[VibeSurf] Clipboard operation result:', result);
610
+
611
+ if (result.success) {
612
+ return { success: true, method: result.method };
613
+ } else {
614
+ throw new Error(result.error || 'Clipboard operation failed');
615
+ }
616
+
617
+ } catch (error) {
618
+ console.error('[VibeSurf] Clipboard operation failed:', error);
619
+ return { success: false, error: error.message };
620
+ }
621
+ }
622
+
539
623
  // Cleanup method for extension unload
540
624
  async cleanup() {
541
625
 
@@ -14,7 +14,9 @@
14
14
  "notifications",
15
15
  "sidePanel",
16
16
  "contextMenus",
17
- "tabs"
17
+ "tabs",
18
+ "clipboardWrite",
19
+ "scripting"
18
20
  ],
19
21
  "host_permissions": [
20
22
  "http://localhost:*/*",