diff --git a/.gitignore b/.gitignore index 56a2445..4d7fd6c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ archive/ .claude.json .port_sessions/ tasks/ +router_session_parquet/ # Environment files .env diff --git a/PARITY_CHECKLIST.md b/PARITY_CHECKLIST.md index d115823..1277af4 100644 --- a/PARITY_CHECKLIST.md +++ b/PARITY_CHECKLIST.md @@ -822,7 +822,7 @@ Mirrored / scaffold areas needing real implementation: - [ ] Token budget calculations ### Tier 3 — Nice-to-Have Features -- [x] Local web GUI (FastAPI + vanilla JS SPA) → `src/gui/__main__.py`, `src/gui/server.py`, `src/gui/static/*`; launch with `python -m src.gui` or `claw-code-gui` +- [x] Local web GUI (FastAPI + vanilla JS SPA) → `src/gui/__main__.py`, `backend/api/server.py`, `frontend/legacy-static/*`; launch with `python -m src.gui` or `claw-code-gui` - [ ] TUI/Ink component library - [ ] Voice mode - [ ] VIM mode and keybinding system diff --git a/README.md b/README.md index 9fffe25..a010c0d 100644 --- a/README.md +++ b/README.md @@ -545,7 +545,7 @@ workspace 可以通过 `.claw-policy.json` / `.codex-policy.json` / `.claw-hooks 有,但只对 bundled skill 生效: - `format_skills_for_system_prompt()` 把 skill 列表渲染进系统提示,帮助模型“知道”有哪些 skill,见 `src/bundled_skills.py:268-289` -- GUI 也有 `/api/skills` 列表,见 `src/gui/server.py` +- GUI 也有 `/api/skills` 列表,见 `backend/api/server.py` 但它没有: diff --git a/backend/__init__.py b/backend/__init__.py new file mode 100644 index 0000000..5ff838a --- /dev/null +++ b/backend/__init__.py @@ -0,0 +1 @@ +"""Backend API package for the claw-code agent workbench.""" diff --git a/backend/api/__init__.py b/backend/api/__init__.py new file mode 100644 index 0000000..d2052ad --- /dev/null +++ b/backend/api/__init__.py @@ -0,0 +1 @@ +"""HTTP API layer for the claw-code agent workbench.""" diff --git a/src/gui/server.py b/backend/api/server.py similarity index 97% rename from src/gui/server.py rename to backend/api/server.py index 2745435..4bd6bf2 100644 --- a/src/gui/server.py +++ b/backend/api/server.py @@ -17,22 +17,22 @@ from fastapi.responses import FileResponse, JSONResponse from fastapi.staticfiles import StaticFiles from pydantic import BaseModel, Field -from ..agent_runtime import LocalCodingAgent -from ..agent_slash_commands import get_slash_command_specs -from ..agent_types import ( +from src.agent_runtime import LocalCodingAgent +from src.agent_slash_commands import get_slash_command_specs +from src.agent_types import ( AgentPermissions, AgentRuntimeConfig, ModelConfig, ) -from ..bundled_skills import get_bundled_skills -from ..session_store import ( +from src.bundled_skills import get_bundled_skills +from src.session_store import ( DEFAULT_AGENT_SESSION_DIR, StoredAgentSession, load_agent_session, ) -STATIC_DIR = Path(__file__).parent / 'static' +STATIC_DIR = Path(__file__).resolve().parents[2] / 'frontend' / 'legacy-static' # --------------------------------------------------------------------------- diff --git a/src/gui/static/app.css b/frontend/legacy-static/app.css similarity index 100% rename from src/gui/static/app.css rename to frontend/legacy-static/app.css diff --git a/src/gui/static/app.js b/frontend/legacy-static/app.js similarity index 100% rename from src/gui/static/app.js rename to frontend/legacy-static/app.js diff --git a/src/gui/static/index.html b/frontend/legacy-static/index.html similarity index 100% rename from src/gui/static/index.html rename to frontend/legacy-static/index.html diff --git a/pyproject.toml b/pyproject.toml index 0b6ddf0..8057d02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,13 @@ dependencies = [ "fastapi>=0.110", "uvicorn>=0.27", "pydantic>=2.5", + "openpyxl>=3.1", + "pyarrow>=15", +] + +[project.optional-dependencies] +dev = [ + "httpx>=0.28", ] [project.urls] @@ -51,11 +58,10 @@ include-package-data = true [tool.setuptools.packages.find] where = ["."] -include = ["src*"] +include = ["src*", "backend*"] [tool.setuptools.package-data] src = [ "reference_data/*.json", - "gui/static/*", "skills/bundled/*/SKILL.md", ] diff --git a/src/gui/__main__.py b/src/gui/__main__.py index 5840ef0..f0b7d71 100644 --- a/src/gui/__main__.py +++ b/src/gui/__main__.py @@ -9,8 +9,9 @@ from pathlib import Path import uvicorn +from backend.api.server import AgentState, create_app + from ..session_store import DEFAULT_AGENT_SESSION_DIR -from .server import AgentState, create_app def main() -> None: diff --git a/tests/test_gui_server.py b/tests/test_gui_server.py index e52bd89..87eb36b 100644 --- a/tests/test_gui_server.py +++ b/tests/test_gui_server.py @@ -15,7 +15,7 @@ from pathlib import Path from fastapi.testclient import TestClient -from src.gui.server import AgentState, create_app +from backend.api.server import AgentState, create_app def _build_client(tmp: Path) -> tuple[TestClient, AgentState]: