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/backend/api/task.py
CHANGED
|
@@ -21,10 +21,13 @@ from ..shared_state import (
|
|
|
21
21
|
execute_task_background,
|
|
22
22
|
is_task_running,
|
|
23
23
|
get_active_task_info,
|
|
24
|
-
clear_active_task
|
|
24
|
+
clear_active_task,
|
|
25
|
+
browser_manager
|
|
25
26
|
)
|
|
26
27
|
|
|
27
|
-
logger
|
|
28
|
+
from vibe_surf.logger import get_logger
|
|
29
|
+
|
|
30
|
+
logger = get_logger(__name__)
|
|
28
31
|
|
|
29
32
|
router = APIRouter(prefix="/tasks", tags=["tasks"])
|
|
30
33
|
|
|
@@ -75,16 +78,16 @@ async def submit_task(
|
|
|
75
78
|
task_id = uuid7str()
|
|
76
79
|
|
|
77
80
|
# Get MCP server config for saving
|
|
78
|
-
from ..shared_state import
|
|
81
|
+
from ..shared_state import vibesurf_tools, active_mcp_server
|
|
79
82
|
mcp_server_config = task_request.mcp_server_config
|
|
80
|
-
if not mcp_server_config and
|
|
81
|
-
mcp_server_config =
|
|
82
|
-
|
|
83
|
+
if not mcp_server_config and vibesurf_tools and hasattr(vibesurf_tools, 'mcp_server_config'):
|
|
84
|
+
mcp_server_config = vibesurf_tools.mcp_server_config
|
|
85
|
+
|
|
83
86
|
# Ensure we have a valid MCP server config (never None)
|
|
84
87
|
if mcp_server_config is None:
|
|
85
88
|
mcp_server_config = {"mcpServers": {}}
|
|
86
89
|
logger.info("Using default empty MCP server configuration")
|
|
87
|
-
|
|
90
|
+
|
|
88
91
|
# DEBUG: Log the type and content of mcp_server_config
|
|
89
92
|
logger.info(f"mcp_server_config type: {type(mcp_server_config)}, value: {mcp_server_config}")
|
|
90
93
|
|
|
@@ -139,16 +142,17 @@ async def _ensure_llm_initialized(llm_profile):
|
|
|
139
142
|
"""Ensure LLM is initialized with the specified profile"""
|
|
140
143
|
from ..utils.llm_factory import create_llm_from_profile
|
|
141
144
|
from ..shared_state import vibesurf_agent
|
|
142
|
-
|
|
145
|
+
|
|
143
146
|
if not vibesurf_agent:
|
|
144
147
|
raise HTTPException(status_code=503, detail="VibeSurf agent not initialized")
|
|
145
|
-
|
|
148
|
+
|
|
146
149
|
# Always create new LLM instance to ensure we're using the right profile
|
|
147
150
|
new_llm = create_llm_from_profile(llm_profile)
|
|
148
|
-
|
|
149
|
-
# Update vibesurf agent's LLM
|
|
150
|
-
vibesurf_agent
|
|
151
|
-
|
|
151
|
+
|
|
152
|
+
# Update vibesurf agent's LLM and register with token cost service
|
|
153
|
+
if vibesurf_agent and vibesurf_agent.token_cost_service:
|
|
154
|
+
vibesurf_agent.llm = vibesurf_agent.token_cost_service.register_llm(new_llm)
|
|
155
|
+
logger.info(f"LLM updated and registered for token tracking for profile: {llm_profile['profile_name']}")
|
|
152
156
|
|
|
153
157
|
|
|
154
158
|
@router.post("/pause")
|
|
@@ -259,6 +263,36 @@ async def stop_task(control_request: TaskControlRequest):
|
|
|
259
263
|
raise HTTPException(status_code=500, detail=f"Failed to stop task: {str(e)}")
|
|
260
264
|
|
|
261
265
|
|
|
266
|
+
@router.post("/add-new-task")
|
|
267
|
+
async def add_new_task(control_request: TaskControlRequest):
|
|
268
|
+
"""Add a new task or follow-up instruction during execution"""
|
|
269
|
+
from ..shared_state import vibesurf_agent
|
|
270
|
+
|
|
271
|
+
if not vibesurf_agent:
|
|
272
|
+
raise HTTPException(status_code=503, detail="VibeSurf agent not initialized")
|
|
273
|
+
|
|
274
|
+
if not is_task_running():
|
|
275
|
+
raise HTTPException(status_code=400, detail="No active task to add new instruction to")
|
|
276
|
+
|
|
277
|
+
try:
|
|
278
|
+
# Use the reason field as the new task content
|
|
279
|
+
new_task = control_request.reason or "No additional task provided"
|
|
280
|
+
|
|
281
|
+
# Add the new task to the running agent
|
|
282
|
+
await vibesurf_agent.add_new_task(new_task)
|
|
283
|
+
|
|
284
|
+
return {
|
|
285
|
+
"success": True,
|
|
286
|
+
"message": "New task added successfully",
|
|
287
|
+
"operation": "add_new_task",
|
|
288
|
+
"new_task": new_task
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
except Exception as e:
|
|
292
|
+
logger.error(f"Failed to add new task: {e}")
|
|
293
|
+
raise HTTPException(status_code=500, detail=f"Failed to add new task: {str(e)}")
|
|
294
|
+
|
|
295
|
+
|
|
262
296
|
@router.get("/detailed-status")
|
|
263
297
|
async def get_detailed_task_status():
|
|
264
298
|
"""Get detailed task execution status with vibesurf information"""
|
|
@@ -13,11 +13,14 @@ from .models import Base
|
|
|
13
13
|
from typing import AsyncGenerator
|
|
14
14
|
import logging
|
|
15
15
|
|
|
16
|
-
logger
|
|
16
|
+
from vibe_surf.logger import get_logger
|
|
17
|
+
|
|
18
|
+
logger = get_logger(__name__)
|
|
19
|
+
|
|
17
20
|
|
|
18
21
|
class DatabaseManager:
|
|
19
22
|
"""Database connection and session management"""
|
|
20
|
-
|
|
23
|
+
|
|
21
24
|
def __init__(self, database_url: str = None):
|
|
22
25
|
"""Initialize database manager
|
|
23
26
|
|
|
@@ -29,7 +32,7 @@ class DatabaseManager:
|
|
|
29
32
|
'VIBESURF_DATABASE_URL',
|
|
30
33
|
f'sqlite+aiosqlite:///{os.path.join(shared_state.workspace_dir, "vibe_surf.db")}'
|
|
31
34
|
)
|
|
32
|
-
|
|
35
|
+
|
|
33
36
|
# Configure engine based on database type
|
|
34
37
|
if self.database_url.startswith('sqlite'):
|
|
35
38
|
# SQLite configuration for development
|
|
@@ -52,23 +55,23 @@ class DatabaseManager:
|
|
|
52
55
|
pool_recycle=3600,
|
|
53
56
|
echo=False
|
|
54
57
|
)
|
|
55
|
-
|
|
58
|
+
|
|
56
59
|
self.async_session_factory = sessionmaker(
|
|
57
|
-
self.engine,
|
|
58
|
-
class_=AsyncSession,
|
|
60
|
+
self.engine,
|
|
61
|
+
class_=AsyncSession,
|
|
59
62
|
expire_on_commit=False
|
|
60
63
|
)
|
|
61
|
-
|
|
64
|
+
|
|
62
65
|
async def create_tables(self):
|
|
63
66
|
"""Create all database tables"""
|
|
64
67
|
async with self.engine.begin() as conn:
|
|
65
68
|
await conn.run_sync(Base.metadata.create_all)
|
|
66
|
-
|
|
69
|
+
|
|
67
70
|
async def drop_tables(self):
|
|
68
71
|
"""Drop all database tables"""
|
|
69
72
|
async with self.engine.begin() as conn:
|
|
70
73
|
await conn.run_sync(Base.metadata.drop_all)
|
|
71
|
-
|
|
74
|
+
|
|
72
75
|
async def get_session(self) -> AsyncGenerator[AsyncSession, None]:
|
|
73
76
|
"""Get async database session"""
|
|
74
77
|
async with self.async_session_factory() as session:
|
|
@@ -80,50 +83,53 @@ class DatabaseManager:
|
|
|
80
83
|
raise
|
|
81
84
|
finally:
|
|
82
85
|
await session.close()
|
|
83
|
-
|
|
86
|
+
|
|
84
87
|
async def close(self):
|
|
85
88
|
"""Close database connections"""
|
|
86
89
|
await self.engine.dispose()
|
|
87
90
|
|
|
91
|
+
|
|
88
92
|
# Dependency for FastAPI
|
|
89
93
|
async def get_db_session() -> AsyncGenerator[AsyncSession, None]:
|
|
90
94
|
"""FastAPI dependency for database sessions"""
|
|
91
95
|
from .. import shared_state
|
|
92
|
-
|
|
96
|
+
|
|
93
97
|
if not shared_state.db_manager:
|
|
94
98
|
raise RuntimeError("Database manager not initialized. Call initialize_vibesurf_components() first.")
|
|
95
|
-
|
|
99
|
+
|
|
96
100
|
async for session in shared_state.db_manager.get_session():
|
|
97
101
|
yield session
|
|
98
102
|
|
|
103
|
+
|
|
99
104
|
# Database initialization script
|
|
100
105
|
async def init_database():
|
|
101
106
|
"""Initialize database with tables"""
|
|
102
107
|
from .. import shared_state
|
|
103
|
-
|
|
108
|
+
|
|
104
109
|
logger.info("🗄️ Initializing VibeSurf database...")
|
|
105
|
-
|
|
110
|
+
|
|
106
111
|
try:
|
|
107
112
|
if not shared_state.db_manager:
|
|
108
113
|
raise RuntimeError("Database manager not initialized. Call initialize_vibesurf_components() first.")
|
|
109
|
-
|
|
114
|
+
|
|
110
115
|
await shared_state.db_manager.create_tables()
|
|
111
116
|
logger.info("✅ Database tables created successfully")
|
|
112
117
|
logger.info("✅ VibeSurf database ready for single-task execution")
|
|
113
|
-
|
|
118
|
+
|
|
114
119
|
except Exception as e:
|
|
115
120
|
logger.error(f"❌ Database initialization failed: {e}")
|
|
116
121
|
raise
|
|
117
122
|
|
|
123
|
+
|
|
118
124
|
if __name__ == "__main__":
|
|
119
125
|
# For standalone execution, initialize a temporary db_manager
|
|
120
126
|
import os
|
|
121
127
|
from .. import shared_state
|
|
122
|
-
|
|
128
|
+
|
|
123
129
|
workspace_dir = os.getenv("VIBESURF_WORKSPACE", os.path.join(os.path.dirname(__file__), "../vibesurf_workspace"))
|
|
124
130
|
database_url = os.getenv(
|
|
125
131
|
'VIBESURF_DATABASE_URL',
|
|
126
132
|
f'sqlite+aiosqlite:///{os.path.join(workspace_dir, "vibe_surf.db")}'
|
|
127
133
|
)
|
|
128
134
|
shared_state.db_manager = DatabaseManager(database_url)
|
|
129
|
-
asyncio.run(init_database())
|
|
135
|
+
asyncio.run(init_database())
|