vibesurf 0.1.20__py3-none-any.whl → 0.1.22__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 (43) hide show
  1. vibe_surf/_version.py +2 -2
  2. vibe_surf/agents/browser_use_agent.py +1 -1
  3. vibe_surf/agents/prompts/vibe_surf_prompt.py +1 -0
  4. vibe_surf/backend/api/task.py +1 -1
  5. vibe_surf/backend/api/voices.py +481 -0
  6. vibe_surf/backend/database/migrations/v004_add_voice_profiles.sql +35 -0
  7. vibe_surf/backend/database/models.py +38 -1
  8. vibe_surf/backend/database/queries.py +189 -1
  9. vibe_surf/backend/main.py +2 -0
  10. vibe_surf/backend/shared_state.py +1 -1
  11. vibe_surf/backend/voice_model_config.py +25 -0
  12. vibe_surf/browser/agen_browser_profile.py +2 -0
  13. vibe_surf/browser/agent_browser_session.py +5 -4
  14. vibe_surf/chrome_extension/background.js +271 -25
  15. vibe_surf/chrome_extension/content.js +147 -0
  16. vibe_surf/chrome_extension/permission-iframe.html +38 -0
  17. vibe_surf/chrome_extension/permission-request.html +104 -0
  18. vibe_surf/chrome_extension/scripts/api-client.js +61 -0
  19. vibe_surf/chrome_extension/scripts/file-manager.js +53 -12
  20. vibe_surf/chrome_extension/scripts/main.js +53 -12
  21. vibe_surf/chrome_extension/scripts/permission-iframe-request.js +188 -0
  22. vibe_surf/chrome_extension/scripts/permission-request.js +118 -0
  23. vibe_surf/chrome_extension/scripts/session-manager.js +30 -4
  24. vibe_surf/chrome_extension/scripts/settings-manager.js +690 -3
  25. vibe_surf/chrome_extension/scripts/ui-manager.js +961 -147
  26. vibe_surf/chrome_extension/scripts/user-settings-storage.js +422 -0
  27. vibe_surf/chrome_extension/scripts/voice-recorder.js +514 -0
  28. vibe_surf/chrome_extension/sidepanel.html +106 -29
  29. vibe_surf/chrome_extension/styles/components.css +35 -0
  30. vibe_surf/chrome_extension/styles/input.css +164 -1
  31. vibe_surf/chrome_extension/styles/layout.css +1 -1
  32. vibe_surf/chrome_extension/styles/settings-environment.css +138 -0
  33. vibe_surf/chrome_extension/styles/settings-forms.css +7 -7
  34. vibe_surf/chrome_extension/styles/variables.css +51 -0
  35. vibe_surf/tools/voice_asr.py +79 -8
  36. {vibesurf-0.1.20.dist-info → vibesurf-0.1.22.dist-info}/METADATA +9 -13
  37. {vibesurf-0.1.20.dist-info → vibesurf-0.1.22.dist-info}/RECORD +41 -34
  38. vibe_surf/chrome_extension/icons/convert-svg.js +0 -33
  39. vibe_surf/chrome_extension/icons/logo-preview.html +0 -187
  40. {vibesurf-0.1.20.dist-info → vibesurf-0.1.22.dist-info}/WHEEL +0 -0
  41. {vibesurf-0.1.20.dist-info → vibesurf-0.1.22.dist-info}/entry_points.txt +0 -0
  42. {vibesurf-0.1.20.dist-info → vibesurf-0.1.22.dist-info}/licenses/LICENSE +0 -0
  43. {vibesurf-0.1.20.dist-info → vibesurf-0.1.22.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,188 @@
1
+ // Permission iframe request script
2
+ // This script runs inside the iframe to request microphone permissions
3
+
4
+ (function() {
5
+ 'use strict';
6
+
7
+ console.log('[PermissionIframe] Permission iframe script loaded');
8
+ console.log('[PermissionIframe] Current URL:', window.location.href);
9
+ console.log('[PermissionIframe] Parent origin:', window.parent.location.origin);
10
+ console.log('[PermissionIframe] Is secure context:', window.isSecureContext);
11
+
12
+ const statusEl = document.getElementById('status');
13
+
14
+ // Function to request microphone permission
15
+ async function requestMicrophonePermission() {
16
+ try {
17
+ console.log('[PermissionIframe] Starting microphone permission request...');
18
+ console.log('[PermissionIframe] Window location:', window.location.href);
19
+ console.log('[PermissionIframe] Is top window:', window === window.top);
20
+ console.log('[PermissionIframe] Document domain:', document.domain);
21
+
22
+ // Check if media devices are available
23
+ if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
24
+ throw new Error('Media devices not supported in this context');
25
+ }
26
+
27
+ console.log('[PermissionIframe] Media devices available, requesting getUserMedia...');
28
+ statusEl.textContent = 'Requesting microphone access...';
29
+ statusEl.className = 'status loading';
30
+
31
+ // Request microphone access with minimal constraints
32
+ console.log('[PermissionIframe] About to call getUserMedia...');
33
+ const stream = await navigator.mediaDevices.getUserMedia({
34
+ audio: true,
35
+ video: false
36
+ });
37
+
38
+ console.log('[PermissionIframe] Permission granted! Stream received');
39
+ console.log('[PermissionIframe] Stream tracks:', stream.getTracks().length);
40
+
41
+ // Stop all tracks immediately after getting permission
42
+ stream.getTracks().forEach(track => {
43
+ console.log('[PermissionIframe] Stopping track:', track.kind);
44
+ track.stop();
45
+ });
46
+
47
+ // Update status
48
+ statusEl.textContent = 'Microphone access granted!';
49
+ statusEl.className = 'status success';
50
+
51
+ // Send success message to parent window
52
+ console.log('[PermissionIframe] Sending success message to parent...');
53
+ console.log('[PermissionIframe] Parent window:', window.parent);
54
+
55
+ // First try to send to parent window
56
+ try {
57
+ window.parent.postMessage({
58
+ type: 'MICROPHONE_PERMISSION_RESULT',
59
+ success: true,
60
+ granted: true,
61
+ source: 'iframe'
62
+ }, '*');
63
+ console.log('[PermissionIframe] PostMessage to parent sent successfully');
64
+ } catch (postMessageError) {
65
+ console.error('[PermissionIframe] Failed to send postMessage to parent:', postMessageError);
66
+ }
67
+
68
+ // Also try to send to extension if available
69
+ if (typeof chrome !== 'undefined' && chrome.runtime) {
70
+ try {
71
+ chrome.runtime.sendMessage({
72
+ type: 'MICROPHONE_PERMISSION_RESULT',
73
+ success: true,
74
+ granted: true,
75
+ source: 'iframe'
76
+ }, (response) => {
77
+ if (chrome.runtime.lastError) {
78
+ console.log('[PermissionIframe] Chrome runtime error:', chrome.runtime.lastError);
79
+ } else {
80
+ console.log('[PermissionIframe] Extension message sent successfully:', response);
81
+ }
82
+ });
83
+ } catch (e) {
84
+ console.error('[PermissionIframe] Could not send to extension:', e);
85
+ }
86
+ }
87
+
88
+ return true;
89
+
90
+ } catch (error) {
91
+ console.error('[PermissionIframe] Permission request failed:', error);
92
+ console.error('[PermissionIframe] Error details:', {
93
+ name: error.name,
94
+ message: error.message,
95
+ stack: error.stack
96
+ });
97
+
98
+ // Update status with error
99
+ let errorMessage = '';
100
+ let userMessage = '';
101
+
102
+ if (error.name === 'NotAllowedError') {
103
+ errorMessage = 'Microphone access denied';
104
+ userMessage = 'Please allow microphone access when prompted by your browser';
105
+ } else if (error.name === 'NotFoundError') {
106
+ errorMessage = 'No microphone found';
107
+ userMessage = 'Please ensure a microphone is connected';
108
+ } else if (error.name === 'NotReadableError') {
109
+ errorMessage = 'Microphone in use';
110
+ userMessage = 'Please close other apps using the microphone';
111
+ } else if (error.name === 'SecurityError') {
112
+ errorMessage = 'Security restriction';
113
+ userMessage = 'Cannot access microphone due to security settings';
114
+ } else {
115
+ errorMessage = 'Permission failed';
116
+ userMessage = error.message;
117
+ }
118
+
119
+ statusEl.textContent = `${errorMessage}: ${userMessage}`;
120
+ statusEl.className = 'status error';
121
+
122
+ // Send error message to parent window
123
+ console.log('[PermissionIframe] Sending error message to parent...');
124
+ console.log('[PermissionIframe] Error details:', { name: error.name, message: error.message });
125
+
126
+ // First try to send to parent window
127
+ try {
128
+ window.parent.postMessage({
129
+ type: 'MICROPHONE_PERMISSION_RESULT',
130
+ success: false,
131
+ granted: false,
132
+ error: error.message,
133
+ errorName: error.name,
134
+ userMessage: userMessage,
135
+ source: 'iframe'
136
+ }, '*');
137
+ console.log('[PermissionIframe] Error postMessage to parent sent successfully');
138
+ } catch (postMessageError) {
139
+ console.error('[PermissionIframe] Failed to send error postMessage to parent:', postMessageError);
140
+ }
141
+
142
+ // Also try to send to extension if available
143
+ if (typeof chrome !== 'undefined' && chrome.runtime) {
144
+ try {
145
+ chrome.runtime.sendMessage({
146
+ type: 'MICROPHONE_PERMISSION_RESULT',
147
+ success: false,
148
+ granted: false,
149
+ error: error.message,
150
+ errorName: error.name,
151
+ userMessage: userMessage,
152
+ source: 'iframe'
153
+ }, (response) => {
154
+ if (chrome.runtime.lastError) {
155
+ console.log('[PermissionIframe] Chrome runtime error for error message:', chrome.runtime.lastError);
156
+ } else {
157
+ console.log('[PermissionIframe] Error extension message sent successfully:', response);
158
+ }
159
+ });
160
+ } catch (e) {
161
+ console.error('[PermissionIframe] Could not send error to extension:', e);
162
+ }
163
+ }
164
+
165
+ return false;
166
+ }
167
+ }
168
+
169
+ // Start permission request when iframe loads
170
+ if (document.readyState === 'loading') {
171
+ document.addEventListener('DOMContentLoaded', requestMicrophonePermission);
172
+ } else {
173
+ requestMicrophonePermission();
174
+ }
175
+
176
+ // Also listen for messages from parent requesting permission
177
+ window.addEventListener('message', (event) => {
178
+ console.log('[PermissionIframe] Received message from parent:', event.data);
179
+
180
+ if (event.data && event.data.type === 'REQUEST_MICROPHONE_PERMISSION') {
181
+ console.log('[PermissionIframe] Parent requested permission, starting request...');
182
+ requestMicrophonePermission();
183
+ }
184
+ });
185
+
186
+ console.log('[PermissionIframe] Permission iframe script initialized');
187
+
188
+ })();
@@ -0,0 +1,118 @@
1
+ // Permission Request Page Script
2
+ // Handles microphone permission request in new tab
3
+
4
+ const statusEl = document.getElementById('status');
5
+
6
+ // Add debug logging
7
+ console.log('[PermissionPage] Permission page loaded');
8
+ console.log('[PermissionPage] Location:', window.location.href);
9
+ console.log('[PermissionPage] Media devices available:', !!navigator.mediaDevices);
10
+ console.log('[PermissionPage] getUserMedia available:', !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia));
11
+
12
+ document.getElementById('allowBtn').onclick = async function() {
13
+ console.log('[PermissionPage] Allow button clicked');
14
+ console.log('[PermissionPage] Current URL:', window.location.href);
15
+ console.log('[PermissionPage] Media devices available:', !!navigator.mediaDevices);
16
+ console.log('[PermissionPage] getUserMedia available:', !!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia));
17
+ console.log('[PermissionPage] Is secure context:', window.isSecureContext);
18
+ console.log('[PermissionPage] Chrome runtime available:', !!(typeof chrome !== 'undefined' && chrome.runtime));
19
+
20
+ statusEl.className = 'loading';
21
+ statusEl.textContent = 'Requesting microphone access...';
22
+
23
+ try {
24
+ // Check if media devices are available
25
+ if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
26
+ throw new Error('Media devices not supported in this context');
27
+ }
28
+
29
+ console.log('[PermissionPage] Requesting getUserMedia...');
30
+ console.log('[PermissionPage] About to call getUserMedia with constraints: {audio: true, video: false}');
31
+
32
+ // This will trigger Chrome's standard permission popup in the address bar
33
+ const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: false});
34
+
35
+ console.log('[PermissionPage] Permission granted, stream received');
36
+ console.log('[PermissionPage] Stream tracks:', stream.getTracks().length);
37
+
38
+ // Stop the stream immediately after getting permission
39
+ stream.getTracks().forEach(track => track.stop());
40
+
41
+ statusEl.className = 'success';
42
+ statusEl.textContent = 'Permission granted! You can close this tab.';
43
+
44
+ // Send success message to voice recorder
45
+ console.log('[PermissionPage] Sending success message');
46
+ chrome.runtime.sendMessage({
47
+ type: "MICROPHONE_PERMISSION_RESULT",
48
+ granted: true
49
+ });
50
+
51
+ // Close tab after a short delay
52
+ setTimeout(() => window.close(), 2000);
53
+
54
+ } catch (error) {
55
+ console.error('[PermissionPage] Permission error:', error);
56
+ console.error('[PermissionPage] Error details:', {
57
+ name: error.name,
58
+ message: error.message,
59
+ stack: error.stack
60
+ });
61
+
62
+ statusEl.className = 'error';
63
+
64
+ // Provide more user-friendly error messages
65
+ let errorMessage = '';
66
+ let debugInfo = '';
67
+
68
+ if (error.name === 'NotAllowedError') {
69
+ errorMessage = 'Microphone access was denied. Please check your browser permissions.';
70
+ debugInfo = 'Try clicking the microphone icon in your browser\'s address bar to allow access.';
71
+ } else if (error.name === 'NotFoundError') {
72
+ errorMessage = 'No microphone found on this device.';
73
+ debugInfo = 'Please ensure a microphone is connected and try again.';
74
+ } else if (error.name === 'NotReadableError') {
75
+ errorMessage = 'Microphone is already in use by another application.';
76
+ debugInfo = 'Please close other applications that might be using the microphone.';
77
+ } else if (error.name === 'SecurityError') {
78
+ errorMessage = 'Security restrictions prevent microphone access.';
79
+ debugInfo = 'This might be due to browser security settings or the page context.';
80
+ } else {
81
+ errorMessage = `Permission denied: ${error.message}`;
82
+ debugInfo = `Error type: ${error.name}`;
83
+ }
84
+
85
+ statusEl.textContent = errorMessage;
86
+
87
+ // Add debug info to the page
88
+ const debugDiv = document.createElement('div');
89
+ debugDiv.style.marginTop = '10px';
90
+ debugDiv.style.fontSize = '12px';
91
+ debugDiv.style.color = '#666';
92
+ debugDiv.textContent = debugInfo;
93
+ statusEl.appendChild(debugDiv);
94
+
95
+ // Send error message to voice recorder
96
+ chrome.runtime.sendMessage({
97
+ type: "MICROPHONE_PERMISSION_RESULT",
98
+ granted: false,
99
+ error: error.message,
100
+ errorName: error.name,
101
+ userMessage: errorMessage
102
+ });
103
+ }
104
+ };
105
+
106
+ document.getElementById('denyBtn').onclick = function() {
107
+ console.log('[PermissionPage] Deny button clicked');
108
+ statusEl.className = 'error';
109
+ statusEl.textContent = 'Permission denied by user';
110
+
111
+ chrome.runtime.sendMessage({
112
+ type: "MICROPHONE_PERMISSION_RESULT",
113
+ granted: false,
114
+ error: "User denied permission"
115
+ });
116
+
117
+ setTimeout(() => window.close(), 1500);
118
+ };
@@ -653,11 +653,37 @@ class VibeSurfSessionManager {
653
653
 
654
654
  // Cleanup
655
655
  destroy() {
656
- this.stopActivityPolling();
657
- this.eventListeners.clear();
658
- this.currentSession = null;
659
- this.activityLogs = [];
656
+ // Prevent multiple cleanup calls
657
+ if (this.isDestroying) {
658
+ console.log('[SessionManager] Cleanup already in progress, skipping...');
659
+ return;
660
+ }
660
661
 
662
+ this.isDestroying = true;
663
+ console.log('[SessionManager] Destroying session manager...');
664
+
665
+ try {
666
+ this.stopActivityPolling();
667
+ this.eventListeners.clear();
668
+
669
+ // Clear any ongoing requests
670
+ if (this.pollingTimer) {
671
+ clearTimeout(this.pollingTimer);
672
+ this.pollingTimer = null;
673
+ }
674
+
675
+ // Reset state
676
+ this.currentSession = null;
677
+ this.currentTaskId = null;
678
+ this.activityLogs = [];
679
+ this.isPolling = false;
680
+
681
+ console.log('[SessionManager] Session manager cleanup complete');
682
+ } catch (error) {
683
+ console.error('[SessionManager] Error during destroy:', error);
684
+ } finally {
685
+ this.isDestroying = false;
686
+ }
661
687
  }
662
688
 
663
689
  // Status helpers