vibesurf 0.1.10__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.

Files changed (51) hide show
  1. vibe_surf/_version.py +2 -2
  2. vibe_surf/agents/browser_use_agent.py +68 -45
  3. vibe_surf/agents/prompts/report_writer_prompt.py +73 -0
  4. vibe_surf/agents/prompts/vibe_surf_prompt.py +85 -172
  5. vibe_surf/agents/report_writer_agent.py +380 -226
  6. vibe_surf/agents/vibe_surf_agent.py +879 -825
  7. vibe_surf/agents/views.py +130 -0
  8. vibe_surf/backend/api/activity.py +3 -1
  9. vibe_surf/backend/api/browser.py +9 -5
  10. vibe_surf/backend/api/config.py +8 -5
  11. vibe_surf/backend/api/files.py +59 -50
  12. vibe_surf/backend/api/models.py +2 -2
  13. vibe_surf/backend/api/task.py +45 -12
  14. vibe_surf/backend/database/manager.py +24 -18
  15. vibe_surf/backend/database/queries.py +199 -192
  16. vibe_surf/backend/database/schemas.py +1 -1
  17. vibe_surf/backend/main.py +4 -2
  18. vibe_surf/backend/shared_state.py +28 -35
  19. vibe_surf/backend/utils/encryption.py +3 -1
  20. vibe_surf/backend/utils/llm_factory.py +41 -36
  21. vibe_surf/browser/agent_browser_session.py +0 -4
  22. vibe_surf/browser/browser_manager.py +14 -8
  23. vibe_surf/browser/utils.py +5 -3
  24. vibe_surf/browser/watchdogs/dom_watchdog.py +0 -45
  25. vibe_surf/chrome_extension/background.js +4 -0
  26. vibe_surf/chrome_extension/scripts/api-client.js +13 -0
  27. vibe_surf/chrome_extension/scripts/file-manager.js +27 -71
  28. vibe_surf/chrome_extension/scripts/session-manager.js +21 -3
  29. vibe_surf/chrome_extension/scripts/ui-manager.js +831 -48
  30. vibe_surf/chrome_extension/sidepanel.html +21 -4
  31. vibe_surf/chrome_extension/styles/activity.css +365 -5
  32. vibe_surf/chrome_extension/styles/input.css +139 -0
  33. vibe_surf/cli.py +4 -22
  34. vibe_surf/common.py +35 -0
  35. vibe_surf/llm/openai_compatible.py +148 -93
  36. vibe_surf/logger.py +99 -0
  37. vibe_surf/{controller/vibesurf_tools.py → tools/browser_use_tools.py} +233 -219
  38. vibe_surf/tools/file_system.py +415 -0
  39. vibe_surf/{controller → tools}/mcp_client.py +4 -3
  40. vibe_surf/tools/report_writer_tools.py +21 -0
  41. vibe_surf/tools/vibesurf_tools.py +657 -0
  42. vibe_surf/tools/views.py +120 -0
  43. {vibesurf-0.1.10.dist-info → vibesurf-0.1.11.dist-info}/METADATA +6 -2
  44. {vibesurf-0.1.10.dist-info → vibesurf-0.1.11.dist-info}/RECORD +49 -43
  45. vibe_surf/controller/file_system.py +0 -53
  46. vibe_surf/controller/views.py +0 -37
  47. /vibe_surf/{controller → tools}/__init__.py +0 -0
  48. {vibesurf-0.1.10.dist-info → vibesurf-0.1.11.dist-info}/WHEEL +0 -0
  49. {vibesurf-0.1.10.dist-info → vibesurf-0.1.11.dist-info}/entry_points.txt +0 -0
  50. {vibesurf-0.1.10.dist-info → vibesurf-0.1.11.dist-info}/licenses/LICENSE +0 -0
  51. {vibesurf-0.1.10.dist-info → vibesurf-0.1.11.dist-info}/top_level.txt +0 -0
@@ -77,14 +77,8 @@ class VibeSurfFileManager {
77
77
 
78
78
  console.log('[FileManager] File upload response:', response);
79
79
 
80
- // If SessionManager doesn't trigger the event, handle it directly
81
- if (response && response.files) {
82
- console.log('[FileManager] Manually handling uploaded files');
83
- this.handleFilesUploaded({
84
- sessionId: this.sessionManager.getCurrentSessionId(),
85
- files: response.files
86
- });
87
- }
80
+ // SessionManager will emit 'filesUploaded' event, no need to handle manually
81
+ // Remove duplicate handling that was causing files to appear twice
88
82
 
89
83
  this.emit('loading', { hide: true });
90
84
  this.emit('notification', {
@@ -306,9 +300,6 @@ class VibeSurfFileManager {
306
300
  `file:///${cleanPath}` :
307
301
  `file:///${cleanPath.replace(/^\//, '')}`; // Remove leading slash and add triple slash
308
302
 
309
- // Create Windows format path for system open
310
- const windowsPath = cleanPath.replace(/\//g, '\\');
311
-
312
303
  // Show user notification about the action
313
304
  this.emit('notification', {
314
305
  message: `Opening file: ${cleanPath}`,
@@ -318,43 +309,33 @@ class VibeSurfFileManager {
318
309
  // Use setTimeout to prevent UI blocking
319
310
  setTimeout(async () => {
320
311
  try {
321
- // Primary strategy: Try browser open first for HTML files (more reliable)
322
- if (fileUrl.toLowerCase().endsWith('.html') || fileUrl.toLowerCase().endsWith('.htm')) {
323
- try {
324
- const opened = window.open(fileUrl, '_blank', 'noopener,noreferrer');
325
- if (opened) {
326
- this.emit('notification', {
327
- message: 'File opened in browser',
328
- type: 'success'
329
- });
330
- return;
331
- } else {
332
- // If browser is blocked, try system open
333
- await this.trySystemOpen(windowsPath, fileUrl);
334
- return;
335
- }
336
- } catch (browserError) {
337
- await this.trySystemOpen(windowsPath, fileUrl);
312
+ // For user-clicked file links, use OPEN_FILE_URL to keep tab open
313
+ // This prevents the auto-close behavior in OPEN_FILE_SYSTEM
314
+ const fileOpenResponse = await chrome.runtime.sendMessage({
315
+ type: 'OPEN_FILE_URL',
316
+ data: { fileUrl: fileUrl }
317
+ });
318
+
319
+ if (fileOpenResponse && fileOpenResponse.success) {
320
+ this.emit('notification', {
321
+ message: 'File opened in browser tab',
322
+ type: 'success'
323
+ });
324
+ return;
325
+ }
326
+
327
+ // If OPEN_FILE_URL fails, try direct browser open
328
+ try {
329
+ const opened = window.open(fileUrl, '_blank', 'noopener,noreferrer');
330
+ if (opened) {
331
+ this.emit('notification', {
332
+ message: 'File opened in browser',
333
+ type: 'success'
334
+ });
338
335
  return;
339
336
  }
340
- } else {
341
- // For non-HTML files, try system open first
342
- const systemSuccess = await this.trySystemOpen(windowsPath, fileUrl);
343
- if (systemSuccess) return;
344
-
345
- // Fallback to browser if system open fails
346
- try {
347
- const opened = window.open(fileUrl, '_blank', 'noopener,noreferrer');
348
- if (opened) {
349
- this.emit('notification', {
350
- message: 'File opened in browser',
351
- type: 'success'
352
- });
353
- return;
354
- }
355
- } catch (browserError) {
356
- console.error('[FileManager] Failed to open file:', browserError);
357
- }
337
+ } catch (browserError) {
338
+ console.error('[FileManager] Browser open failed:', browserError);
358
339
  }
359
340
 
360
341
  // Last resort: Copy path to clipboard
@@ -381,31 +362,6 @@ class VibeSurfFileManager {
381
362
  }
382
363
  }
383
364
 
384
- async trySystemOpen(windowsPath, fileUrl) {
385
- try {
386
- const systemOpenPromise = chrome.runtime.sendMessage({
387
- type: 'OPEN_FILE_SYSTEM',
388
- data: { filePath: windowsPath }
389
- });
390
-
391
- // Add timeout to prevent hanging
392
- const systemOpenResponse = await Promise.race([
393
- systemOpenPromise,
394
- new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 3000))
395
- ]);
396
-
397
- if (systemOpenResponse && systemOpenResponse.success) {
398
- this.emit('notification', {
399
- message: 'File opened with system default application',
400
- type: 'success'
401
- });
402
- return true;
403
- }
404
- return false;
405
- } catch (systemError) {
406
- return false;
407
- }
408
- }
409
365
 
410
366
  async copyToClipboardFallback(fileUrl) {
411
367
  try {
@@ -333,6 +333,24 @@ class VibeSurfSessionManager {
333
333
  }
334
334
  }
335
335
 
336
+ async addNewTaskToPaused(newTaskDescription) {
337
+ try {
338
+ const response = await this.apiClient.addNewTask(newTaskDescription);
339
+
340
+ this.emit('newTaskAdded', {
341
+ sessionId: this.currentSession?.id,
342
+ newTask: newTaskDescription,
343
+ response
344
+ });
345
+
346
+ return response;
347
+ } catch (error) {
348
+ console.error('[SessionManager] Add new task failed:', error);
349
+ this.emit('taskError', { error: error.message, action: 'add_new_task' });
350
+ throw error;
351
+ }
352
+ }
353
+
336
354
  // Activity polling
337
355
  startActivityPolling() {
338
356
  if (this.isPolling) {
@@ -389,7 +407,7 @@ class VibeSurfSessionManager {
389
407
  // New activity log received
390
408
  const newLog = { ...activityLog };
391
409
 
392
- // Add timestamp if not present
410
+ // Add timestamp if not present - this should now be handled by UI
393
411
  if (!newLog.timestamp) {
394
412
  newLog.timestamp = new Date().toISOString();
395
413
  }
@@ -479,7 +497,7 @@ class VibeSurfSessionManager {
479
497
  if (missingLogs.length > 0) {
480
498
 
481
499
  for (const log of missingLogs) {
482
- // Add timestamp if not present
500
+ // Add timestamp if not present - this should now be handled by UI
483
501
  if (!log.timestamp) {
484
502
  log.timestamp = new Date().toISOString();
485
503
  }
@@ -515,7 +533,7 @@ class VibeSurfSessionManager {
515
533
  // 完全同步:用服务器端的logs替换本地logs
516
534
  const previousCount = this.activityLogs.length;
517
535
 
518
- // 添加timestamp给没有的logs
536
+ // Add timestamp to logs that don't have them
519
537
  const processedLogs = serverLogs.map(log => ({
520
538
  ...log,
521
539
  timestamp: log.timestamp || new Date().toISOString()