Skip to content

Commit 2797e46

Browse files
authored
Merge pull request #19 from YuJunZhiXue/trae
修改了claude code 中长任务工具调用
2 parents 2a0239a + bf006a6 commit 2797e46

70 files changed

Lines changed: 6855 additions & 2988 deletions

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: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Git 相关
2+
.git
3+
.github
4+
.gitignore
5+
6+
# 环境配置
7+
.env
8+
.env.local
9+
.env.*.local
10+
.venv
11+
venv
12+
env/
13+
14+
# Python 缓存
15+
__pycache__/
16+
**/__pycache__/
17+
**/*.pyc
18+
**/*.pyo
19+
**/*.pyd
20+
.Python
21+
*.so
22+
*.egg
23+
*.egg-info/
24+
dist/
25+
build/
26+
.pytest_cache/
27+
.coverage
28+
htmlcov/
29+
30+
# 日志和数据
31+
*.log
32+
data/
33+
logs/
34+
outputs/
35+
temp/
36+
tmp/
37+
38+
# 前端
39+
frontend/node_modules/
40+
frontend/dist/
41+
frontend/.vite/
42+
frontend/.turbo/
43+
44+
# IDE
45+
.vscode/
46+
.idea/
47+
*.swp
48+
*.swo
49+
*~
50+
.DS_Store
51+
52+
# 文档(构建时不需要)
53+
*.md
54+
!README.md
55+
SESSION_*.md
56+
FIX_*.md
57+
QUICK_*.md
58+
START_*.md
59+
TOOL_*.md
60+
61+
# 测试文件
62+
tests/
63+
test_*.py
64+
*_test.py
65+
66+
# 其他
67+
.dockerignore
68+
Dockerfile*
69+
docker-compose*.yml

.env.example

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
ADMIN_KEY=change-me-now
22
PORT=7860
33
WORKERS=1
4-
ENGINE_MODE=hybrid
5-
BROWSER_POOL_SIZE=2
4+
LOG_LEVEL=INFO
65
MAX_INFLIGHT=1
6+
MAX_RETRIES=3
77
ACCOUNT_MIN_INTERVAL_MS=1200
88
REQUEST_JITTER_MIN_MS=120
99
REQUEST_JITTER_MAX_MS=360
10-
MAX_RETRIES=2
11-
TOOL_MAX_RETRIES=2
12-
EMPTY_RESPONSE_RETRIES=1
1310
RATE_LIMIT_BASE_COOLDOWN=600
1411
RATE_LIMIT_MAX_COOLDOWN=3600
15-
STREAM_KEEPALIVE_INTERVAL=5
1612
ACCOUNTS_FILE=/workspace/data/accounts.json
1713
USERS_FILE=/workspace/data/users.json
1814
CAPTURES_FILE=/workspace/data/captures.json
19-
CONFIG_FILE=/workspace/data/config.json
15+
CONTEXT_GENERATED_DIR=/workspace/data/context_files
16+
CONTEXT_CACHE_FILE=/workspace/data/context_cache.json
17+
UPLOADED_FILES_FILE=/workspace/data/uploaded_files.json
18+
CONTEXT_AFFINITY_FILE=/workspace/data/session_affinity.json
19+
CONTEXT_INLINE_MAX_CHARS=4000
20+
CONTEXT_FORCE_FILE_MAX_CHARS=10000
21+
CONTEXT_ATTACHMENT_TTL_SECONDS=1800
22+
CONTEXT_UPLOAD_PARSE_TIMEOUT_SECONDS=60

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Docker Build and Push
33
on:
44
push:
55
branches: [ "main" ]
6-
tags: [ 'v*.*.*' ]
6+
tags: [ "v*.*.*" ]
77

88
env:
99
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
@@ -39,10 +39,11 @@ jobs:
3939
type=sha,format=short
4040
4141
- name: Build and push
42-
uses: docker/build-push-action@v5
42+
uses: docker/build-push-action@v6
4343
with:
4444
context: .
4545
push: true
46+
platforms: linux/amd64,linux/arm64
4647
tags: ${{ steps.meta.outputs.tags }}
4748
labels: ${{ steps.meta.outputs.labels }}
4849
cache-from: type=gha

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ dist/
44
dist-ssr/
55
*.local
66

7-
8-
97
# Python
108
__pycache__/
119
*.py[cod]
@@ -34,9 +32,14 @@ fix_*.py
3432
.vscode/
3533
.idea/
3634
.claude/
35+
.worktrees/
3736
.gitignore
3837
*.suo
3938
*.ntvs
4039
*.njsproj
4140
*.sln
4241
*.sw?
42+
43+
# local cleanup
44+
tests/
45+
docs/superpowers/

Dockerfile

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,73 @@
1-
# Stage 1: Build Frontend
2-
FROM node:20-slim AS frontend-builder
1+
# syntax=docker/dockerfile:1.7
2+
3+
# Stage 1: Build frontend assets once on the build platform.
4+
FROM --platform=$BUILDPLATFORM node:20-bookworm-slim AS frontend-builder
35
WORKDIR /app
46
COPY frontend/package*.json ./
5-
RUN npm install
7+
RUN npm ci
68
COPY frontend/ ./
79
RUN npm run build
810

9-
# Stage 2: Backend + Final Image
10-
FROM python:3.12-slim
11+
# Stage 2: Runtime image.
12+
FROM python:3.12-slim-bookworm
1113
WORKDIR /workspace
1214

13-
# Always refresh apt cache first (never cache this layer)
14-
RUN apt-get update
15+
ENV DEBIAN_FRONTEND=noninteractive \
16+
PYTHONIOENCODING=utf-8 \
17+
PYTHONUNBUFFERED=1 \
18+
PYTHONDONTWRITEBYTECODE=1 \
19+
PIP_NO_CACHE_DIR=1 \
20+
PORT=7860 \
21+
WORKERS=1 \
22+
LOG_LEVEL=INFO \
23+
PYTHONPATH=/workspace
1524

16-
# Install system dependencies for headless Firefox (Camoufox)
17-
# Use || true on packages that may differ across Debian versions
18-
RUN apt-get install -y --no-install-recommends \
19-
wget \
20-
curl \
25+
RUN apt-get update && apt-get install -y --no-install-recommends \
2126
ca-certificates \
27+
curl \
28+
wget \
29+
libasound2 \
30+
libatk-bridge2.0-0 \
31+
libatk1.0-0 \
32+
libcups2 \
33+
libdbus-1-3 \
34+
libdbus-glib-1-2 \
35+
libdrm2 \
36+
libgbm1 \
37+
libglib2.0-0 \
38+
libgtk-3-0 \
39+
libnspr4 \
40+
libnss3 \
41+
libpangocairo-1.0-0 \
42+
libpulse0 \
2243
libx11-6 \
44+
libx11-xcb1 \
2345
libxcb1 \
24-
libxrandr2 \
2546
libxcomposite1 \
2647
libxdamage1 \
27-
libxfixes3 \
2848
libxext6 \
49+
libxfixes3 \
2950
libxkbcommon0 \
30-
libdbus-1-3 \
31-
libgtk-3-0 \
32-
libdrm2 \
33-
libgbm1 \
51+
libxrandr2 \
3452
libxshmfence1 \
35-
libatk1.0-0 \
36-
libatk-bridge2.0-0 \
37-
libpangocairo-1.0-0 \
38-
libcups2 \
39-
libnss3 \
40-
libnspr4 \
41-
libglib2.0-0 \
4253
fonts-liberation \
43-
&& apt-get install -y --no-install-recommends fonts-noto-cjk || true \
44-
&& apt-get install -y --no-install-recommends libdbus-glib-1-2 || true \
45-
&& apt-get install -y --no-install-recommends libasound2 libasound2t64 || true \
46-
&& apt-get install -y --no-install-recommends libpulse0 || true \
47-
&& apt-get install -y --no-install-recommends libx11-xcb1 || true \
54+
fonts-noto-cjk \
4855
&& rm -rf /var/lib/apt/lists/*
4956

50-
ENV PYTHONIOENCODING=utf-8
51-
ENV PYTHONUNBUFFERED=1
52-
ENV PYTHONDONTWRITEBYTECODE=1
53-
54-
COPY backend/requirements.txt ./backend/
55-
RUN pip install --no-cache-dir -r backend/requirements.txt
57+
COPY backend/requirements.txt /tmp/requirements.txt
58+
RUN pip install -r /tmp/requirements.txt
5659

57-
# Download Camoufox browser at build time
60+
# Download Camoufox browser at build time so runtime hosts do not need to fetch it again.
5861
RUN python -m camoufox fetch
5962

6063
COPY backend/ ./backend/
6164
COPY start.py ./
6265
COPY --from=frontend-builder /app/dist ./frontend/dist
63-
64-
# Create data and logs directories
65-
RUN mkdir -p /workspace/data /workspace/logs
66+
RUN mkdir -p /workspace/data /workspace/logs /workspace/frontend
6667

6768
EXPOSE 7860
6869

69-
ENV PORT=7860
70-
ENV FRONTEND_DIST_DIR=/workspace/frontend/dist
71-
ENV ACCOUNTS_FILE=/workspace/data/accounts.json
72-
ENV USERS_FILE=/workspace/data/users.json
73-
ENV CAPTURES_FILE=/workspace/data/captures.json
74-
ENV PYTHONPATH=/workspace
75-
7670
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
77-
CMD curl -f http://localhost:${PORT}/healthz || exit 1
71+
CMD curl -fsS "http://127.0.0.1:${PORT:-7860}/healthz" || exit 1
7872

79-
CMD ["python", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
73+
CMD ["sh", "-c", "python -m uvicorn backend.main:app --host 0.0.0.0 --port ${PORT:-7860} --workers ${WORKERS:-1}"]

0 commit comments

Comments
 (0)