Skip to content

Commit 651dd3c

Browse files
committed
ignore temp data
1 parent fe4020d commit 651dd3c

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

.e2bignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ dist
1717
.pytype
1818
__pypackages__
1919
chroma_db_memory
20+
.credentials
21+
agent_file_system
2022
build_template.py
2123
e2b.toml
2224
scripts/

app/ui_layer/adapters/browser_adapter.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,17 +738,21 @@ async def _on_start(self) -> None:
738738
if assets_path.exists():
739739
self._app.router.add_static("/assets/", assets_path)
740740

741-
# Serve favicon
742-
favicon_path = frontend_dist / "favicon.svg"
743-
if favicon_path.exists():
744-
self._app.router.add_get(
745-
"/favicon.svg",
746-
lambda _: web.FileResponse(favicon_path)
747-
)
741+
# Serve static files from dist/ (public/ files copied by Vite build)
742+
# This must come before the SPA catch-all so images, fonts, etc. are served directly
743+
_dist = frontend_dist # capture for closure
744+
745+
async def _static_or_spa(request: web.Request) -> web.StreamResponse:
746+
"""Serve static file from dist/ if it exists, otherwise index.html for SPA routing."""
747+
req_path = request.match_info.get("path", "")
748+
if req_path:
749+
file_path = _dist / req_path
750+
if file_path.is_file():
751+
return web.FileResponse(file_path)
752+
return web.FileResponse(_dist / "index.html")
748753

749-
# Serve index.html for all non-API routes (SPA routing)
750754
self._app.router.add_get("/", self._spa_handler)
751-
self._app.router.add_get("/{path:.*}", self._spa_handler)
755+
self._app.router.add_get("/{path:.*}", _static_or_spa)
752756
else:
753757
# Fallback to inline HTML for development without build
754758
self._app.router.add_get("/", self._index_handler)

build_template.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,20 @@ def build_template(template_name: str) -> str:
139139
print(f" Pre-installing: {cmd}")
140140
template = template.run_cmd(cmd, user="root")
141141

142-
# Copy full CraftBot code
142+
# Copy full CraftBot code and build frontend
143143
template = (
144144
template
145145
.copy(".", "/home/user/agent/")
146+
# Remove credentials/data that should not be in the template
147+
.run_cmd("rm -rf /home/user/agent/.credentials /home/user/agent/agent_file_system /home/user/agent/chroma_db_memory")
148+
.run_cmd(
149+
"cd /home/user/agent/app/ui_layer/browser/frontend"
150+
" && npm install --legacy-peer-deps"
151+
" && npm run build"
152+
" && rm -rf node_modules"
153+
" && echo 'Frontend built successfully'"
154+
" || echo 'WARN: Frontend build failed - will use fallback UI'"
155+
)
146156
.run_cmd(
147157
"sed -i 's/\\r$//' /home/user/agent/e2b-start.sh"
148158
" && chmod +x /home/user/agent/e2b-start.sh"

e2b-start.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fi
9393

9494
# Launch the agent in the background
9595
cd "$AGENT_DIR"
96+
export GUI_MODE_ENABLED=False
9697
echo "[e2b-start] Launching python3 -m app.main --browser ..." | tee -a "$LOG_FILE"
9798
nohup python3 -m app.main --browser >> "$LOG_FILE" 2>&1 &
9899
AGENT_PID=$!

0 commit comments

Comments
 (0)