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
File without changes
@@ -0,0 +1,3 @@
1
+ """
2
+ API Models and Request/Response schemas for VibeSurf Backend
3
+ """
@@ -0,0 +1,243 @@
1
+ """
2
+ Activity Logs Router - Simplified
3
+
4
+ Handles retrieval of activity logs from VibeSurf agents and task history from database.
5
+ """
6
+
7
+ from fastapi import APIRouter, Depends, HTTPException
8
+ from sqlalchemy.ext.asyncio import AsyncSession
9
+ from typing import List, Optional
10
+ import logging
11
+ from datetime import datetime
12
+
13
+ from ..database import get_db_session
14
+ from ..database.queries import TaskQueries
15
+ from .models import ActivityQueryRequest, SessionActivityQueryRequest
16
+
17
+ logger = logging.getLogger(__name__)
18
+
19
+ router = APIRouter(prefix="/activity", tags=["activity"])
20
+
21
+ # Task History Endpoints
22
+
23
+ @router.get("/tasks")
24
+ async def get_recent_tasks(
25
+ limit: int = -1,
26
+ db: AsyncSession = Depends(get_db_session)
27
+ ):
28
+ """Get recent tasks across all sessions"""
29
+ try:
30
+ # Handle -1 as "get all" and validate other values
31
+ if limit != -1 and (limit < 1 or limit > 1000):
32
+ limit = -1
33
+
34
+ tasks = await TaskQueries.get_recent_tasks(db, limit)
35
+
36
+ return {
37
+ "tasks": [
38
+ {
39
+ "task_id": task.task_id,
40
+ "session_id": task.session_id,
41
+ "task_description": task.task_description,
42
+ "status": task.status.value,
43
+ "task_result": task.task_result,
44
+ "error_message": task.error_message,
45
+ "report_path": task.report_path,
46
+ "created_at": task.created_at.isoformat(),
47
+ "started_at": task.started_at.isoformat() if task.started_at else None,
48
+ "completed_at": task.completed_at.isoformat() if task.completed_at else None
49
+ }
50
+ for task in tasks
51
+ ],
52
+ "total_count": len(tasks),
53
+ "limit": limit
54
+ }
55
+ except Exception as e:
56
+ logger.error(f"Failed to get recent tasks: {e}")
57
+ raise HTTPException(status_code=500, detail=f"Failed to get recent tasks: {str(e)}")
58
+
59
+ @router.get("/sessions")
60
+ async def get_all_sessions(
61
+ limit: int = -1,
62
+ offset: int = 0,
63
+ db: AsyncSession = Depends(get_db_session)
64
+ ):
65
+ """Get all sessions with task counts and metadata"""
66
+ try:
67
+ # Handle -1 as "get all" and validate other values
68
+ if limit != -1 and (limit < 1 or limit > 1000):
69
+ limit = -1
70
+
71
+ sessions = await TaskQueries.get_all_sessions(db, limit, offset)
72
+
73
+ return {
74
+ "sessions": sessions,
75
+ "total_count": len(sessions),
76
+ "limit": limit,
77
+ "offset": offset
78
+ }
79
+ except Exception as e:
80
+ logger.error(f"Failed to get all sessions: {e}")
81
+ raise HTTPException(status_code=500, detail=f"Failed to get all sessions: {str(e)}")
82
+
83
+ @router.get("/sessions/{session_id}/tasks")
84
+ async def get_session_tasks(
85
+ session_id: str,
86
+ db: AsyncSession = Depends(get_db_session)
87
+ ):
88
+ """Get all tasks for a session from database"""
89
+ try:
90
+ tasks = await TaskQueries.get_tasks_by_session(db, session_id)
91
+
92
+ return {
93
+ "session_id": session_id,
94
+ "tasks": [
95
+ {
96
+ "task_id": task.task_id,
97
+ "task_description": task.task_description,
98
+ "status": task.status.value,
99
+ "task_result": task.task_result,
100
+ "llm_profile_name": task.llm_profile_name,
101
+ "workspace_dir": task.workspace_dir,
102
+ "mcp_server_config": task.mcp_server_config,
103
+ "error_message": task.error_message,
104
+ "report_path": task.report_path,
105
+ "created_at": task.created_at.isoformat(),
106
+ "started_at": task.started_at.isoformat() if task.started_at else None,
107
+ "completed_at": task.completed_at.isoformat() if task.completed_at else None
108
+ }
109
+ for task in tasks
110
+ ],
111
+ "total_count": len(tasks)
112
+ }
113
+ except Exception as e:
114
+ logger.error(f"Failed to get tasks for session {session_id}: {e}")
115
+ raise HTTPException(status_code=500, detail=f"Failed to get session tasks: {str(e)}")
116
+
117
+ @router.get("/{task_id}")
118
+ async def get_task_info(
119
+ task_id: str,
120
+ db: AsyncSession = Depends(get_db_session)
121
+ ):
122
+ """Get task information and result from database"""
123
+ try:
124
+ task = await TaskQueries.get_task(db, task_id)
125
+ if not task:
126
+ raise HTTPException(status_code=404, detail="Task not found")
127
+
128
+ return {
129
+ "task_id": task.task_id,
130
+ "session_id": task.session_id,
131
+ "task_description": task.task_description,
132
+ "status": task.status.value,
133
+ "upload_files_path": task.upload_files_path,
134
+ "mcp_server_config": task.mcp_server_config,
135
+ "llm_profile_name": task.llm_profile_name,
136
+ "task_result": task.task_result,
137
+ "error_message": task.error_message,
138
+ "report_path": task.report_path,
139
+ "created_at": task.created_at.isoformat(),
140
+ "started_at": task.started_at.isoformat() if task.started_at else None,
141
+ "completed_at": task.completed_at.isoformat() if task.completed_at else None,
142
+ "metadata": task.task_metadata
143
+ }
144
+ except HTTPException:
145
+ raise
146
+ except Exception as e:
147
+ logger.error(f"Failed to get task info for {task_id}: {e}")
148
+ raise HTTPException(status_code=500, detail=f"Failed to get task info: {str(e)}")
149
+
150
+ # Real-time VibeSurf Agent Activity Log Endpoints
151
+
152
+ @router.get("/sessions/{session_id}/activity")
153
+ async def get_session_activity_logs(
154
+ session_id: str,
155
+ query: SessionActivityQueryRequest = Depends()
156
+ ):
157
+ """Get real-time VibeSurf agent activity logs for a specific session"""
158
+ from ..shared_state import vibesurf_agent
159
+
160
+ if not vibesurf_agent:
161
+ logger.error(f"❌ VibeSurf agent not initialized")
162
+ raise HTTPException(status_code=503, detail="VibeSurf agent not initialized")
163
+
164
+ try:
165
+ # Get activity logs from VibeSurfAgent
166
+ if query.message_index is not None:
167
+ # First get all logs to check the current state
168
+ all_logs = vibesurf_agent.get_activity_logs(session_id)
169
+
170
+ # Get specific log entry by index
171
+ activity_log = vibesurf_agent.get_activity_logs(session_id, query.message_index)
172
+
173
+ if activity_log is None:
174
+ return {
175
+ "session_id": session_id,
176
+ "activity_log": None,
177
+ "message_index": query.message_index,
178
+ "total_available": len(all_logs) if all_logs else 0,
179
+ "message": f"No activity log found at index {query.message_index}"
180
+ }
181
+
182
+ return {
183
+ "session_id": session_id,
184
+ "activity_log": activity_log,
185
+ "message_index": query.message_index,
186
+ "total_available": len(all_logs) if all_logs else 0
187
+ }
188
+ else:
189
+ # Get all activity logs for the session
190
+ activity_logs = vibesurf_agent.get_activity_logs(session_id)
191
+
192
+ if activity_logs is None:
193
+ return {
194
+ "session_id": session_id,
195
+ "activity_logs": [],
196
+ "total_count": 0,
197
+ "message": "No activity logs found for this session"
198
+ }
199
+
200
+ # Apply limit (-1 means no limit)
201
+ original_count = len(activity_logs)
202
+ if query.limit != -1 and query.limit > 0 and len(activity_logs) > query.limit:
203
+ activity_logs = activity_logs[-query.limit:]
204
+
205
+ return {
206
+ "session_id": session_id,
207
+ "activity_logs": activity_logs,
208
+ "total_count": len(activity_logs),
209
+ "original_total": original_count
210
+ }
211
+
212
+ except Exception as e:
213
+ logger.error(f"❌ Failed to get VibeSurf activity logs for session {session_id}: {e}")
214
+ logger.exception("Full traceback:")
215
+ raise HTTPException(status_code=500, detail=f"Failed to get activity logs: {str(e)}")
216
+
217
+
218
+ @router.get("/sessions/{session_id}/latest_activity")
219
+ async def get_latest_activity(session_id: str):
220
+ """Get the latest activity for a session (both task info and VibeSurf logs)"""
221
+
222
+ try:
223
+ from ..shared_state import vibesurf_agent
224
+ result = {
225
+ "session_id": session_id,
226
+ "latest_vibesurf_log": None,
227
+ "latest_task": None
228
+ }
229
+
230
+ # Get latest VibeSurf activity log
231
+ if vibesurf_agent:
232
+ try:
233
+ activity_logs = vibesurf_agent.get_activity_logs(session_id)
234
+ if activity_logs:
235
+ result["latest_vibesurf_log"] = activity_logs[-1]
236
+ except Exception as e:
237
+ logger.warning(f"Failed to get VibeSurf activity for {session_id}: {e}")
238
+
239
+ return result
240
+
241
+ except Exception as e:
242
+ logger.error(f"Failed to get latest activity for session {session_id}: {e}")
243
+ raise HTTPException(status_code=500, detail=f"Failed to get latest activity: {str(e)}")