Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
# Docker build context filter. Patterns match from the repository root;
# `**/` makes one match at any depth.

# VCS, caches and build output. The Dockerfile builds the browser UI and the
# npm trees itself, for the image's own platform: a node_modules or dist/
# copied from a Windows or macOS checkout would carry the wrong native
# binaries, so none may enter the context.
.git
.gitignore
__pycache__
*.py[cod]
*.log
.github
**/__pycache__
**/*.py[cod]
**/*.log
**/node_modules
**/dist
**/build
**/*.egg-info
.venv
venv
node_modules
chroma_db
__pypackages__
.cache
.mypy_cache
.pytype
build
dist
.pytest_cache
.ruff_cache
.DS_Store
.github
install.sh
install.bat
*.egg-info
OmniParser_CraftOS
debug_images
workspace

# Not needed to run CraftBot: the Rust installer (its target/ directory alone
# can be gigabytes) and the test suite.
launcher
tests

# ---------------------------------------------------------------------------
# Secrets and per-machine runtime state — never belongs in an image.
# Secrets and per-machine runtime state: never belongs in an image.
#
# `COPY . .` takes whatever is in the build context, i.e. a developer's working
# tree, and the release workflow pushes the resulting image to a public
Expand All @@ -33,6 +46,10 @@ workspace
# exactly once, on someone's laptop. (Same failure as the old PyInstaller spec's
# blanket app/data entry, which shipped 1.1 GB of one machine's memory index
# and databases.) Keep this list in step with .gitignore.
#
# The image still gets every shipped default: app/config/<name>.default.json
# and app/data/agent_file_system_template/ are copied into the /data volume on
# first start (app/state_sync.py).
# ---------------------------------------------------------------------------

# Secrets and credentials
Expand Down Expand Up @@ -60,6 +77,10 @@ chroma_db_memory
.craftbot
**/.craftbot
.craftbot-managed
.craftbot-image-id
.agent-ready
craftbot.pid
ui.json
logs
**/logs
**/agent_logs.txt
Expand All @@ -71,8 +92,11 @@ logs
**/onboarding_config.json
**/gui/config
**/.whatsapp_web_sessions
# ...except the shipped templates the agent's files are created from.
!app/data/agent_file_system_template/USER.md
!app/data/agent_file_system_template/CONVERSATION_HISTORY.md

# Provisioned runtimes and build caches — re-fetched inside the image
# Provisioned runtimes and build caches: re-fetched inside the image
runtime
wheelhouse
downloads-cache
Expand Down
81 changes: 38 additions & 43 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
# CraftBot - Environment Configuration
# You need at least ONE API key from a supported LLM provider.

# --- LLM Provider API Keys (set at least one) ---
OPENAI_API_KEY=
GOOGLE_API_KEY=
ANTHROPIC_API_KEY=
BYTEPLUS_API_KEY=

# --- Optional: Remote Ollama server URL ---
REMOTE_MODEL_URL=
# --- Optional: OmniParser Gradio server URL ---
# Leave empty to use default http://localhost:7861
# Or set to a remote/cloud Gradio URL
OMNIPARSER_BASE_URL=

# Google (/google login)
GOOGLE_CLIENT_ID=
# Optional Figma OAuth app credentials. PAT connection works without these.
# Public apps need Figma approval; do not commit real client secrets.
FIGMA_CLIENT_ID=
FIGMA_CLIENT_SECRET=
GOOGLE_CLIENT_SECRET=

# LinkedIn (/linkedin login)
LINKEDIN_CLIENT_ID=
LINKEDIN_CLIENT_SECRET=

# Slack (/slack invite)
SLACK_SHARED_CLIENT_ID=
SLACK_SHARED_CLIENT_SECRET=

# Telegram (/telegram invite)
TELEGRAM_SHARED_BOT_TOKEN=
TELEGRAM_SHARED_BOT_USERNAME=

# Telegram (telegram user connect)
TELEGRAM_API_ID=
TELEGRAM_API_HASH=

# Notion (/notion invite)
NOTION_SHARED_CLIENT_ID=
NOTION_SHARED_CLIENT_SECRET=
# CraftBot: optional environment variables
#
# API keys are NOT read from this file or from any .env file. Enter your LLM
# API key in the browser onboarding on first start (change it later under
# Settings). CraftBot stores it in app/config/settings.json in its data folder.
#
# Everything below is optional and read from the process environment:
# - Docker Compose: copy this file to .env next to docker-compose.yml.
# Compose reads .env and passes these values into the container.
# - Source install: set them in the terminal before running craftbot.py
# (macOS/Linux: export NAME=value, Windows PowerShell: $env:NAME = "value").
# Leave a value empty to keep the default.

# --- Proxy ------------------------------------------------------------------
# Used by every download (Python, pip, npm, Node.js) and by CraftBot itself.
# Keep localhost in NO_PROXY so CraftBot can reach its own servers.
HTTPS_PROXY=
HTTP_PROXY=
NO_PROXY=localhost,127.0.0.1

# --- Mirrors ----------------------------------------------------------------
# Python packages, e.g. https://pypi.tuna.tsinghua.edu.cn/simple
PIP_INDEX_URL=
# npm packages, e.g. https://registry.npmmirror.com
npm_config_registry=
# Embedding model download, e.g. https://hf-mirror.com
HF_ENDPOINT=
# URL rewrites for CraftBot's runtime downloads (Python, Node.js, PocketBase,
# embedding model): semicolon-separated prefix=replacement pairs. Downloads
# are still checked against their pinned SHA-256 checksums.
# e.g. https://nodejs.org/dist/=https://npmmirror.com/mirrors/node/
CRAFTBOT_MIRRORS=

# --- Location (source install only; the Docker image sets both itself) -------
# Keep all CraftBot data and downloaded runtimes in this folder instead.
# CRAFTBOT_HOME=/path/to/craftbot-data
# Interface the UI and backend listen on (default: localhost only).
# CRAFTBOT_BIND_HOST=0.0.0.0
197 changes: 197 additions & 0 deletions .github/workflows/install-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
name: Install E2E

# A real install, start to finish, on every OS and architecture CraftBot
# ships for: the full locked dependency set, the Node sidecar and npm trees,
# then the agent started headless until it reports ready and the browser UI
# answers. Each job uses whatever Python the runner image ships with (never
# actions/setup-python): the point is to prove that the Python a user
# launches the install with does not matter. One job deliberately launches
# it with an old Python 3.8.
#
# State goes to a throwaway CRAFTBOT_HOME, so runtimes, data and the ready
# marker land in the job's temp directory.

on:
pull_request:
paths:
- "install.py"
- "craftbot.py"
- "run.py"
- "main.py"
- "installer/**"
- "app/paths.py"
- "app/provision/**"
- "app/python_runtime.py"
- "app/node_runtime.py"
- "app/downloads.py"
- "requirements.txt"
- "requirements/**"
- "agent-app/spec/**"
- ".github/workflows/install-e2e.yml"
workflow_dispatch:

concurrency:
group: install-e2e-${{ github.ref }}
cancel-in-progress: true

jobs:
install:
name: Install E2E (${{ matrix.label }})
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
label: windows-x86_64
python: python
- os: macos-15
label: macos-arm64
python: python3
- os: macos-15-intel
label: macos-x86_64
python: python3
- os: ubuntu-22.04
label: linux-x86_64
python: python3
- os: ubuntu-24.04-arm
label: linux-aarch64
python: python3
- os: ubuntu-22.04
label: linux-x86_64, launched with Python 3.8
python: python3.8
old_python: true

env:
PY: ${{ matrix.python }}
# Output reaches the log as it happens, and box-drawing characters
# survive a pipe on Windows. The launcher sets the same for its runs.
PYTHONUNBUFFERED: "1"
PYTHONIOENCODING: utf-8
READY_TIMEOUT: "900"

defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install an old Python 3.8 to launch with
if: matrix.old_python
run: |
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y python3.8

- name: Prepare
run: |
set -euo pipefail
# Forward slashes on Windows too: both bash and Python accept them.
tmp="$RUNNER_TEMP"
if command -v cygpath >/dev/null 2>&1; then tmp="$(cygpath -m "$tmp")"; fi
mkdir -p "$tmp/craftbot-home" "$tmp/e2e-logs"
echo "E2E_TMP=$tmp" >> "$GITHUB_ENV"
echo "CRAFTBOT_HOME=$tmp/craftbot-home" >> "$GITHUB_ENV"
echo "launching interpreter: $(command -v "$PY")"
"$PY" -c 'import sys, platform; print(sys.version); print(platform.platform(), platform.machine())'
echo "STARTED_AT=$(date +%s)" >> "$GITHUB_ENV"

# stdin is closed: an install that stops to ask a question fails here
# instead of hanging, exactly as it would behind the setup window.
- name: Install (install.py --no-launch)
timeout-minutes: 60
run: |
set -uo pipefail
t0=$(date +%s)
"$PY" install.py --no-launch < /dev/null 2>&1 | tee "$E2E_TMP/e2e-logs/install.log"
code=${PIPESTATUS[0]}
echo "T_INSTALL=$(( $(date +%s) - t0 ))" >> "$GITHUB_ENV"
exit "$code"

- name: Start headless (craftbot.py start --no-open-browser)
timeout-minutes: 20
run: |
set -uo pipefail
t0=$(date +%s)
"$PY" craftbot.py start --no-open-browser < /dev/null 2>&1 | tee "$E2E_TMP/e2e-logs/start.log"
code=${PIPESTATUS[0]}
echo "T_START=$(( $(date +%s) - t0 ))" >> "$GITHUB_ENV"
echo "READY_FROM=$t0" >> "$GITHUB_ENV"
exit "$code"

- name: Wait for the agent to report ready
run: |
set -euo pipefail
marker="$CRAFTBOT_HOME/.agent-ready"
deadline=$(( READY_FROM + READY_TIMEOUT ))
until [ -f "$marker" ]; do
if [ "$(date +%s)" -ge "$deadline" ]; then
echo "::error::$marker did not appear within ${READY_TIMEOUT}s of starting"
exit 1
fi
sleep 5
done
echo "T_READY=$(( $(date +%s) - READY_FROM ))" >> "$GITHUB_ENV"
echo "ready marker: $marker"
for f in craftbot.pid ui.json; do
if [ -f "$CRAFTBOT_HOME/$f" ]; then echo "$f: $(cat "$CRAFTBOT_HOME/$f")"; fi
done

- name: The browser UI answers on port 7925
run: |
set -uo pipefail
t0=$(date +%s)
code=000
for _ in $(seq 1 60); do
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 http://localhost:7925/ || true)
[ "$code" = "200" ] && break
sleep 2
done
echo "T_HTTP=$(( $(date +%s) - t0 ))" >> "$GITHUB_ENV"
echo "http://localhost:7925/ answered HTTP $code"
[ "$code" = "200" ] || { echo "::error::http://localhost:7925/ answered HTTP $code, expected 200"; exit 1; }

- name: Stop
if: always()
run: |
"$PY" craftbot.py stop < /dev/null || true

- name: Timings
if: always()
run: |
total=$(( $(date +%s) - ${STARTED_AT:-$(date +%s)} ))
{
echo "### Install E2E timings: ${{ matrix.label }}"
echo
echo "Launched with \`$("$PY" --version 2>&1)\` ($PY)"
echo
echo "| Stage | Seconds |"
echo "|---|---|"
echo "| install.py --no-launch | ${T_INSTALL:-failed} |"
echo "| craftbot.py start | ${T_START:-not reached} |"
echo "| start to .agent-ready | ${T_READY:-not reached} |"
echo "| ready to HTTP 200 on :7925 | ${T_HTTP:-not reached} |"
echo "| total | $total |"
} | tee -a "$GITHUB_STEP_SUMMARY"

- name: Collect logs
if: failure()
run: |
logs="$E2E_TMP/e2e-logs"
cp craftbot.log "$logs/" 2>/dev/null || true
if [ -d "$CRAFTBOT_HOME/logs" ]; then cp -R "$CRAFTBOT_HOME/logs" "$logs/state-logs"; fi
for f in craftbot.pid ui.json; do
cp "$CRAFTBOT_HOME/$f" "$logs/" 2>/dev/null || true
done
tail -n 80 craftbot.log 2>/dev/null || true

- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: install-e2e-logs-${{ strategy.job-index }}
path: ${{ runner.temp }}/e2e-logs
if-no-files-found: ignore
Loading
Loading