Skip to content

Commit ed9bcf3

Browse files
committed
merge V1.4.5 into improvement/agent-app-sync
2 parents 2a58463 + c50d10c commit ed9bcf3

159 files changed

Lines changed: 32620 additions & 5056 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
1+
# Docker build context filter. Patterns match from the repository root;
2+
# `**/` makes one match at any depth.
3+
4+
# VCS, caches and build output. The Dockerfile builds the browser UI and the
5+
# npm trees itself, for the image's own platform: a node_modules or dist/
6+
# copied from a Windows or macOS checkout would carry the wrong native
7+
# binaries, so none may enter the context.
18
.git
29
.gitignore
3-
__pycache__
4-
*.py[cod]
5-
*.log
10+
.github
11+
**/__pycache__
12+
**/*.py[cod]
13+
**/*.log
14+
**/node_modules
15+
**/dist
16+
**/build
17+
**/*.egg-info
618
.venv
719
venv
8-
node_modules
9-
chroma_db
1020
__pypackages__
1121
.cache
1222
.mypy_cache
1323
.pytype
14-
build
15-
dist
24+
.pytest_cache
25+
.ruff_cache
1626
.DS_Store
17-
.github
1827
install.sh
1928
install.bat
20-
*.egg-info
2129
OmniParser_CraftOS
2230
debug_images
2331
workspace
2432

33+
# Not needed to run CraftBot: the Rust installer (its target/ directory alone
34+
# can be gigabytes) and the test suite.
35+
launcher
36+
tests
37+
2538
# ---------------------------------------------------------------------------
26-
# Secrets and per-machine runtime state — never belongs in an image.
39+
# Secrets and per-machine runtime state: never belongs in an image.
2740
#
2841
# `COPY . .` takes whatever is in the build context, i.e. a developer's working
2942
# tree, and the release workflow pushes the resulting image to a public
@@ -33,6 +46,10 @@ workspace
3346
# exactly once, on someone's laptop. (Same failure as the old PyInstaller spec's
3447
# blanket app/data entry, which shipped 1.1 GB of one machine's memory index
3548
# and databases.) Keep this list in step with .gitignore.
49+
#
50+
# The image still gets every shipped default: app/config/<name>.default.json
51+
# and app/data/agent_file_system_template/ are copied into the /data volume on
52+
# first start (app/state_sync.py).
3653
# ---------------------------------------------------------------------------
3754

3855
# Secrets and credentials
@@ -60,6 +77,10 @@ chroma_db_memory
6077
.craftbot
6178
**/.craftbot
6279
.craftbot-managed
80+
.craftbot-image-id
81+
.agent-ready
82+
craftbot.pid
83+
ui.json
6384
logs
6485
**/logs
6586
**/agent_logs.txt
@@ -71,8 +92,11 @@ logs
7192
**/onboarding_config.json
7293
**/gui/config
7394
**/.whatsapp_web_sessions
95+
# ...except the shipped templates the agent's files are created from.
96+
!app/data/agent_file_system_template/USER.md
97+
!app/data/agent_file_system_template/CONVERSATION_HISTORY.md
7498

75-
# Provisioned runtimes and build caches — re-fetched inside the image
99+
# Provisioned runtimes and build caches: re-fetched inside the image
76100
runtime
77101
wheelhouse
78102
downloads-cache

‎.env.example‎

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
1-
# CraftBot - Environment Configuration
2-
# You need at least ONE API key from a supported LLM provider.
3-
4-
# --- LLM Provider API Keys (set at least one) ---
5-
OPENAI_API_KEY=
6-
GOOGLE_API_KEY=
7-
ANTHROPIC_API_KEY=
8-
BYTEPLUS_API_KEY=
9-
10-
# --- Optional: Remote Ollama server URL ---
11-
REMOTE_MODEL_URL=
12-
# --- Optional: OmniParser Gradio server URL ---
13-
# Leave empty to use default http://localhost:7861
14-
# Or set to a remote/cloud Gradio URL
15-
OMNIPARSER_BASE_URL=
16-
17-
# Google (/google login)
18-
GOOGLE_CLIENT_ID=
19-
# Optional Figma OAuth app credentials. PAT connection works without these.
20-
# Public apps need Figma approval; do not commit real client secrets.
21-
FIGMA_CLIENT_ID=
22-
FIGMA_CLIENT_SECRET=
23-
GOOGLE_CLIENT_SECRET=
24-
25-
# LinkedIn (/linkedin login)
26-
LINKEDIN_CLIENT_ID=
27-
LINKEDIN_CLIENT_SECRET=
28-
29-
# Slack (/slack invite)
30-
SLACK_SHARED_CLIENT_ID=
31-
SLACK_SHARED_CLIENT_SECRET=
32-
33-
# Telegram (/telegram invite)
34-
TELEGRAM_SHARED_BOT_TOKEN=
35-
TELEGRAM_SHARED_BOT_USERNAME=
36-
37-
# Telegram (telegram user connect)
38-
TELEGRAM_API_ID=
39-
TELEGRAM_API_HASH=
40-
41-
# Notion (/notion invite)
42-
NOTION_SHARED_CLIENT_ID=
43-
NOTION_SHARED_CLIENT_SECRET=
1+
# CraftBot: optional environment variables
2+
#
3+
# API keys are NOT read from this file or from any .env file. Enter your LLM
4+
# API key in the browser onboarding on first start (change it later under
5+
# Settings). CraftBot stores it in app/config/settings.json in its data folder.
6+
#
7+
# Everything below is optional and read from the process environment:
8+
# - Docker Compose: copy this file to .env next to docker-compose.yml.
9+
# Compose reads .env and passes these values into the container.
10+
# - Source install: set them in the terminal before running craftbot.py
11+
# (macOS/Linux: export NAME=value, Windows PowerShell: $env:NAME = "value").
12+
# Leave a value empty to keep the default.
13+
14+
# --- Proxy ------------------------------------------------------------------
15+
# Used by every download (Python, pip, npm, Node.js) and by CraftBot itself.
16+
# Keep localhost in NO_PROXY so CraftBot can reach its own servers.
17+
HTTPS_PROXY=
18+
HTTP_PROXY=
19+
NO_PROXY=localhost,127.0.0.1
20+
21+
# --- Mirrors ----------------------------------------------------------------
22+
# Python packages, e.g. https://pypi.tuna.tsinghua.edu.cn/simple
23+
PIP_INDEX_URL=
24+
# npm packages, e.g. https://registry.npmmirror.com
25+
npm_config_registry=
26+
# Embedding model download, e.g. https://hf-mirror.com
27+
HF_ENDPOINT=
28+
# URL rewrites for CraftBot's runtime downloads (Python, Node.js, PocketBase,
29+
# embedding model): semicolon-separated prefix=replacement pairs. Downloads
30+
# are still checked against their pinned SHA-256 checksums.
31+
# e.g. https://nodejs.org/dist/=https://npmmirror.com/mirrors/node/
32+
CRAFTBOT_MIRRORS=
33+
34+
# --- Location (source install only; the Docker image sets both itself) -------
35+
# Keep all CraftBot data and downloaded runtimes in this folder instead.
36+
# CRAFTBOT_HOME=/path/to/craftbot-data
37+
# Interface the UI and backend listen on (default: localhost only).
38+
# CRAFTBOT_BIND_HOST=0.0.0.0

‎.github/workflows/install-e2e.yml‎

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
name: Install E2E
2+
3+
# A real install, start to finish, on every OS and architecture CraftBot
4+
# ships for: the full locked dependency set, the Node sidecar and npm trees,
5+
# then the agent started headless until it reports ready and the browser UI
6+
# answers. Each job uses whatever Python the runner image ships with (never
7+
# actions/setup-python): the point is to prove that the Python a user
8+
# launches the install with does not matter. One job deliberately launches
9+
# it with an old Python 3.8.
10+
#
11+
# State goes to a throwaway CRAFTBOT_HOME, so runtimes, data and the ready
12+
# marker land in the job's temp directory.
13+
14+
on:
15+
pull_request:
16+
paths:
17+
- "install.py"
18+
- "craftbot.py"
19+
- "run.py"
20+
- "main.py"
21+
- "installer/**"
22+
- "app/paths.py"
23+
- "app/provision/**"
24+
- "app/python_runtime.py"
25+
- "app/node_runtime.py"
26+
- "app/downloads.py"
27+
- "requirements.txt"
28+
- "requirements/**"
29+
- "agent-app/spec/**"
30+
- ".github/workflows/install-e2e.yml"
31+
workflow_dispatch:
32+
33+
concurrency:
34+
group: install-e2e-${{ github.ref }}
35+
cancel-in-progress: true
36+
37+
jobs:
38+
install:
39+
name: Install E2E (${{ matrix.label }})
40+
runs-on: ${{ matrix.os }}
41+
timeout-minutes: 90
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- os: windows-latest
47+
label: windows-x86_64
48+
python: python
49+
- os: macos-15
50+
label: macos-arm64
51+
python: python3
52+
- os: macos-15-intel
53+
label: macos-x86_64
54+
python: python3
55+
- os: ubuntu-22.04
56+
label: linux-x86_64
57+
python: python3
58+
- os: ubuntu-24.04-arm
59+
label: linux-aarch64
60+
python: python3
61+
- os: ubuntu-22.04
62+
label: linux-x86_64, launched with Python 3.8
63+
python: python3.8
64+
old_python: true
65+
66+
env:
67+
PY: ${{ matrix.python }}
68+
# Output reaches the log as it happens, and box-drawing characters
69+
# survive a pipe on Windows. The launcher sets the same for its runs.
70+
PYTHONUNBUFFERED: "1"
71+
PYTHONIOENCODING: utf-8
72+
READY_TIMEOUT: "900"
73+
74+
defaults:
75+
run:
76+
shell: bash
77+
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v4
81+
82+
- name: Install an old Python 3.8 to launch with
83+
if: matrix.old_python
84+
run: |
85+
sudo add-apt-repository -y ppa:deadsnakes/ppa
86+
sudo apt-get update
87+
sudo apt-get install -y python3.8
88+
89+
- name: Prepare
90+
run: |
91+
set -euo pipefail
92+
# Forward slashes on Windows too: both bash and Python accept them.
93+
tmp="$RUNNER_TEMP"
94+
if command -v cygpath >/dev/null 2>&1; then tmp="$(cygpath -m "$tmp")"; fi
95+
mkdir -p "$tmp/craftbot-home" "$tmp/e2e-logs"
96+
echo "E2E_TMP=$tmp" >> "$GITHUB_ENV"
97+
echo "CRAFTBOT_HOME=$tmp/craftbot-home" >> "$GITHUB_ENV"
98+
echo "launching interpreter: $(command -v "$PY")"
99+
"$PY" -c 'import sys, platform; print(sys.version); print(platform.platform(), platform.machine())'
100+
echo "STARTED_AT=$(date +%s)" >> "$GITHUB_ENV"
101+
102+
# stdin is closed: an install that stops to ask a question fails here
103+
# instead of hanging, exactly as it would behind the setup window.
104+
- name: Install (install.py --no-launch)
105+
timeout-minutes: 60
106+
run: |
107+
set -uo pipefail
108+
t0=$(date +%s)
109+
"$PY" install.py --no-launch < /dev/null 2>&1 | tee "$E2E_TMP/e2e-logs/install.log"
110+
code=${PIPESTATUS[0]}
111+
echo "T_INSTALL=$(( $(date +%s) - t0 ))" >> "$GITHUB_ENV"
112+
exit "$code"
113+
114+
- name: Start headless (craftbot.py start --no-open-browser)
115+
timeout-minutes: 20
116+
run: |
117+
set -uo pipefail
118+
t0=$(date +%s)
119+
"$PY" craftbot.py start --no-open-browser < /dev/null 2>&1 | tee "$E2E_TMP/e2e-logs/start.log"
120+
code=${PIPESTATUS[0]}
121+
echo "T_START=$(( $(date +%s) - t0 ))" >> "$GITHUB_ENV"
122+
echo "READY_FROM=$t0" >> "$GITHUB_ENV"
123+
exit "$code"
124+
125+
- name: Wait for the agent to report ready
126+
run: |
127+
set -euo pipefail
128+
marker="$CRAFTBOT_HOME/.agent-ready"
129+
deadline=$(( READY_FROM + READY_TIMEOUT ))
130+
until [ -f "$marker" ]; do
131+
if [ "$(date +%s)" -ge "$deadline" ]; then
132+
echo "::error::$marker did not appear within ${READY_TIMEOUT}s of starting"
133+
exit 1
134+
fi
135+
sleep 5
136+
done
137+
echo "T_READY=$(( $(date +%s) - READY_FROM ))" >> "$GITHUB_ENV"
138+
echo "ready marker: $marker"
139+
for f in craftbot.pid ui.json; do
140+
if [ -f "$CRAFTBOT_HOME/$f" ]; then echo "$f: $(cat "$CRAFTBOT_HOME/$f")"; fi
141+
done
142+
143+
- name: The browser UI answers on port 7925
144+
run: |
145+
set -uo pipefail
146+
t0=$(date +%s)
147+
code=000
148+
for _ in $(seq 1 60); do
149+
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 http://localhost:7925/ || true)
150+
[ "$code" = "200" ] && break
151+
sleep 2
152+
done
153+
echo "T_HTTP=$(( $(date +%s) - t0 ))" >> "$GITHUB_ENV"
154+
echo "http://localhost:7925/ answered HTTP $code"
155+
[ "$code" = "200" ] || { echo "::error::http://localhost:7925/ answered HTTP $code, expected 200"; exit 1; }
156+
157+
- name: Stop
158+
if: always()
159+
run: |
160+
"$PY" craftbot.py stop < /dev/null || true
161+
162+
- name: Timings
163+
if: always()
164+
run: |
165+
total=$(( $(date +%s) - ${STARTED_AT:-$(date +%s)} ))
166+
{
167+
echo "### Install E2E timings: ${{ matrix.label }}"
168+
echo
169+
echo "Launched with \`$("$PY" --version 2>&1)\` ($PY)"
170+
echo
171+
echo "| Stage | Seconds |"
172+
echo "|---|---|"
173+
echo "| install.py --no-launch | ${T_INSTALL:-failed} |"
174+
echo "| craftbot.py start | ${T_START:-not reached} |"
175+
echo "| start to .agent-ready | ${T_READY:-not reached} |"
176+
echo "| ready to HTTP 200 on :7925 | ${T_HTTP:-not reached} |"
177+
echo "| total | $total |"
178+
} | tee -a "$GITHUB_STEP_SUMMARY"
179+
180+
- name: Collect logs
181+
if: failure()
182+
run: |
183+
logs="$E2E_TMP/e2e-logs"
184+
cp craftbot.log "$logs/" 2>/dev/null || true
185+
if [ -d "$CRAFTBOT_HOME/logs" ]; then cp -R "$CRAFTBOT_HOME/logs" "$logs/state-logs"; fi
186+
for f in craftbot.pid ui.json; do
187+
cp "$CRAFTBOT_HOME/$f" "$logs/" 2>/dev/null || true
188+
done
189+
tail -n 80 craftbot.log 2>/dev/null || true
190+
191+
- name: Upload logs
192+
if: failure()
193+
uses: actions/upload-artifact@v4
194+
with:
195+
name: install-e2e-logs-${{ strategy.job-index }}
196+
path: ${{ runner.temp }}/e2e-logs
197+
if-no-files-found: ignore

0 commit comments

Comments
 (0)