zhenyu.hu 3 недель назад
Родитель
Сommit
55b9a35b11
4 измененных файлов с 30 добавлено и 6 удалено
  1. 12 5
      docs/plans/todo-15-static-package-data.md
  2. 1 1
      docs/plans/todos.md
  3. 3 0
      pyproject.toml
  4. 14 0
      tests/test_packaging.py

+ 12 - 5
docs/plans/todo-15-static-package-data.md

@@ -1,6 +1,6 @@
 # Todo 15 Static Package Data Plan
 
-**Status:** in_progress
+**Status:** done
 
 ## Goal
 
@@ -53,8 +53,15 @@ unzip -l dist/agent_lab-0.1.0-py3-none-any.whl | rg "agent_lab/presentation/stat
 
 ## Verification
 
-Expected result:
+Result:
 
-- Packaging test passes.
-- Full suite passes.
-- Built wheel contains the three static UI files.
+- Red run passed as expected: `tests/test_packaging.py` failed because `tool.setuptools.package-data` was missing.
+- `uv run pytest tests/test_packaging.py` passed.
+- `uv run pytest` passed: 35 tests, 1 existing Starlette deprecation warning.
+- `uv build` passed after rerunning with permission to access the user uv cache.
+- `unzip -l dist/agent_lab-0.1.0-py3-none-any.whl | rg "agent_lab/presentation/static/(index.html|app.js|styles.css)"` found all three static UI assets.
+
+## Evaluation
+
+- `pyproject.toml` now declares package data for static HTML, JS, and CSS.
+- The built wheel contains `agent_lab/presentation/static/index.html`, `app.js`, and `styles.css`.

+ 1 - 1
docs/plans/todos.md

@@ -41,5 +41,5 @@
 | 12 | done | `docs/plans/todo-12-round-stats.md` | Move round statistics to structured backend events for token counts, cached tokens, TTFT, elapsed time, and per-turn summaries. | `uv run pytest tests/test_debug_runtime.py tests/test_websocket_api.py`; `uv run pytest`. |
 | 13 | done | `docs/plans/todo-13-real-queue-websocket-loop.md` | Make runtime queues real producer/consumer boundaries and let WebSocket run separate upstream/downstream tasks. | `uv run pytest tests/test_debug_runtime.py tests/test_websocket_api.py`; `uv run pytest`. |
 | 14 | done | `docs/plans/todo-14-message-role-validation.md` | Reject provider-invalid API message roles and malformed tool replies before network calls. | `uv run pytest tests/test_websocket_api.py tests/test_event_agent.py`; `uv run pytest`. |
-| 15 | in_progress | `docs/plans/todo-15-static-package-data.md` | Include static UI assets in installed package builds. | Build/package inspection proves `index.html`, JS, and CSS are present. |
+| 15 | done | `docs/plans/todo-15-static-package-data.md` | Include static UI assets in installed package builds. | `uv run pytest tests/test_packaging.py`; `uv run pytest`; `uv build`; wheel inspection. |
 | 16 | pending | `docs/plans/todo-16-tool-error-isolation.md` | Convert EventAgent tool handler exceptions into structured tool-result errors instead of aborting the session. | Tests prove a failing tool returns an error payload and the WebSocket run stays structured. |

+ 3 - 0
pyproject.toml

@@ -28,6 +28,9 @@ build-backend = "setuptools.build_meta"
 [tool.setuptools.packages.find]
 where = ["src"]
 
+[tool.setuptools.package-data]
+"agent_lab.presentation" = ["static/*.html", "static/*.js", "static/*.css"]
+
 [tool.pytest.ini_options]
 asyncio_mode = "auto"
 pythonpath = ["src"]

+ 14 - 0
tests/test_packaging.py

@@ -0,0 +1,14 @@
+import tomllib
+from pathlib import Path
+
+
+def test_static_ui_assets_are_declared_as_package_data():
+    pyproject = tomllib.loads(Path("pyproject.toml").read_text())
+
+    package_data = pyproject["tool"]["setuptools"]["package-data"]
+
+    assert set(package_data["agent_lab.presentation"]) >= {
+        "static/*.html",
+        "static/*.js",
+        "static/*.css",
+    }