From e350d57b127d32bdc76ac164f5122eadba915491 Mon Sep 17 00:00:00 2001 From: WilliamClifton-dev <177295528+WilliamClifton-dev@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:50:09 +0800 Subject: [PATCH 1/2] fix: protect internal API routes --- README.en.md | 86 +++++++++-------------------- README.md | 71 +++++++++--------------- docs/deployment/quickstart.md | 37 ++++++++++++- docs/verification-baseline.zh-CN.md | 22 ++++++++ src/agentloom/api.py | 44 +++++++++++++++ tests/test_approvals_api.py | 39 +++++++++++-- tests/test_internal_policy_api.py | 30 ++++++++-- tests/test_tasks_api.py | 67 +++++++++++++++++++++- 8 files changed, 278 insertions(+), 118 deletions(-) create mode 100644 docs/verification-baseline.zh-CN.md diff --git a/README.en.md b/README.en.md index 9d6aaab..78bb6fb 100644 --- a/README.en.md +++ b/README.en.md @@ -13,25 +13,18 @@ approval checks, replay protection, and replayable Evidence. The project originally validated this control path through a software-repair scenario on [AgentTeams](https://github.com/agentscope-ai/AgentTeams). AgentTeams, Higress, Matrix, and MinIO are reference integrations, not the Gateway's core -runtime boundary. - -> **Verification baseline (2026-08-25):** AgentTeams `v1.1.2` completed the -> `Administrator -> Manager -> Investigator -> Verifier -> authenticated Higress -> -> Policy Broker -> immutable Docker pytest sandbox` path with -> `minimax-cn / MiniMax-M2.5` and exactly one governed `SUCCEEDED` ToolCall. -> Historical clean-clone Lite evidence is **339 passed / 0 failed / 3 skipped -> (opt-in Docker tests)**; the frozen `v0.1.0` gate is **375 passed / 3 skipped**. -> The latest public-main GitHub Actions gate built the immutable sandbox -> image and passed **380 tests / 0 skipped**; the current worktree collects 380 tests. The -> versioned Task 24 benchmark is **6 PASSED / 0 NOT_RUN**. The Skill catalog is -> **2 PUBLISHED / 4 QUARANTINED**; team-original `patch-scope-validator` v1.0.1 -> has three strictly replayed governed invocations. Human L2 approval is `APPROVED`, -> and upstream PR [#1141](https://github.com/agentscope-ai/AgentTeams/pull/1141) remains -> `OPEN`. The real recording, anonymous public playback, and formal `v0.1.0` -> Release are verified. The audited eight-entry P0 package is complete with -> SHA-256 `0c5dfeb0ba6665609a14129a76cc1c239aed882a17e930c144aa5d3b88f6c306`; -> The project is now frozen as a reproducible resume-grade prototype; new -> AgentTeams features and competition-page work are out of scope. +runtime boundary. This is a reproducible resume-grade prototype, not a production +standalone Gateway distribution. + +## Current Verification + +| Scope | Result | Notes | +| --- | --- | --- | +| Local Lite | `382 passed / 3 skipped` | Current PR worktree; skipped tests require Docker. Ruff and strict mypy pass. | +| GitHub Actions Full | `380 passed / 0 skipped` | Latest verified public `main` baseline; this PR is awaiting CI. | +| Task 24 benchmark | `6 PASSED / 0 NOT_RUN` | Archived three-case, two-mode benchmark. | + +These numbers describe different environments. See the [verification baseline and history](docs/verification-baseline.zh-CN.md) for archived integration and release evidence. ## Project Positioning @@ -45,20 +38,6 @@ runtime boundary. - Boundary: this is not a code-review product or an Agent orchestrator, and it does not replace OpenCodeReview or AgentTeams -## Verification Evidence - -- Paid evidence Provider: `minimax-cn / MiniMax-M2.5` -- Task 24 completed the three-case, two-mode matrix 6/6; Task 17 proves one - complete governed ToolCall path -- Latest public-main gate: 380 passed / 0 skipped with the immutable Docker - sandbox tests enabled; frozen `v0.1.0` gate: 375 passed / 3 skipped; - current local Lite snapshot: 377 passed / 3 skipped / 0 failed (380 collected); - Ruff, strict - mypy, and pip-audit pass -- Skill status: `code-review-and-quality` and team-original - `patch-scope-validator` v1.0.1 are `PUBLISHED`; four upstream Skills remain - `QUARANTINED` - Historical competition evidence remains indexed in the [preliminary submission record](docs/competition/agentloom-preliminary-submission.md). The Gateway boundary and migration plan are in the @@ -86,7 +65,7 @@ The full design is in the [AgentLoom architecture](docs/architecture/agentloom-a ## Model-Free Quick Start -Prerequisites: Python 3.12 and Git. These commands make no model or paid API call. +Prerequisites: Windows 10/11, PowerShell 7, Python 3.12, and Git. The [Windows quickstart](docs/deployment/quickstart.md) provides one install/demo path, expected output, evidence locations, and troubleshooting. It makes no model or paid API call. ```powershell python -m venv .venv @@ -105,6 +84,8 @@ Run either deterministic repair case without an LLM or cloud quota: ``` Replace `severity-normalization` with `pagination-boundary` for the second case. +Inspect the independent verification summary at +`artifacts/demo/severity-normalization/artifacts/test-results.txt`. Launch the local evidence control panel with: ```powershell @@ -184,31 +165,18 @@ uses the pinned Docker backend and does not export that acknowledgement. Never put the signing key, model credentials, or raw provider secrets in committed MCP, Worker, or Provider Profile configuration. -## Historical Evidence - -> The items below are retained for audit and reproduction. They are **not the -> current evidence baseline**. Qwen and DeepSeek remain disabled because their -> accounts have no balance. MiniMax and StepFun are authorized subscription -> Providers, but every new run must use a unique run ID and exact Provider/model -> evidence. The accepted Task 24 report remains immutable MiniMax history; a -> future MiniMax or StepFun diagnostic must never overwrite it. Do not replay -> historical paid paths as if they were new. - -- On 2026-08-04, Qwen `qwen3.7-plus` completed an unattended repair that passed - independent visible, host-only hidden, and static checks. The generated patch - SHA-256 is - `7d9d571a833eabaedf97eac73dad50f6290bfa332d3ef504882398ba2e6d0833`. - Strict run evidence remains at - `artifacts/agentteams/live-repair-pagination-qwen-unattended-03.json`; independent - verification remains under - `artifacts/live-repair/AL-LIVE-PAGINATION-UNATTENDED-20260804-03/verified/artifacts/`. -- The earlier StepFun four-role rollback and DeepSeek message-baseline evidence - remain historical inputs to the Human L2 approval record. Their redacted - summary is in - [L2 approval and upstream contribution evidence](docs/competition/l2-approval-and-upstream-contribution-evidence.md). -- Historical replay entry points remain `scripts/competition-demo.ps1 -Mode replay` - and `scripts/competition-rollback-demo.ps1 -Mode replay`. Replay is model-free; - live mode is a separate, explicitly paid and authorized operation. +The FastAPI control plane's `/internal/*` routes are also a trusted boundary. +`create_app` requires a deployment-injected `internal_api_token` of at least 32 +ASCII characters; callers must send `Authorization: Bearer `. Read the +token from process environment or a secret manager during deployment. If the +service is network-accessible, restrict it at the gateway and use TLS. Missing +or invalid tokens receive `401` before task transitions, approvals, or Grant +verification run. + +Historical live evidence is retained for audit. Qwen and DeepSeek remain disabled; +new paid runs require a unique run ID and exact Provider/model evidence. The +archived Task 24 report must not be overwritten. Historical replay is model-free; +live mode is a separate, explicitly paid and authorized operation. ## Project Status diff --git a/README.md b/README.md index e42b53b..9ee5f91 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ AgentLoom 是一个 **Agent Tool Policy Gateway** 原型。当 Agent 想调用工具(改代码、跑测试、写文件)时,Gateway 强制校验:调用方身份 / 短时一次性授权 / 参数白名单 / 审批 / 沙箱 / 可回放证据。任何一项不通过 = 拒绝并留证据。 -**这个项目展示的工程能力**:多 Agent 系统的边界设计、HMAC 签名授权、防重放 nonce、不可变 Docker 沙箱、可观测证据链、Pydantic 契约测试——所有跑通的 380 项测试 + 6 项 AgentTeams 端到端任务都基于此。 +**这个项目展示的工程能力**:多 Agent 系统的边界设计、HMAC 签名授权、防重放 nonce、不可变 Docker 沙箱、可观测证据链和 Pydantic 契约测试。可以先运行无模型 Demo,再查看分层验证证据。 **招聘者快速查看**:[两分钟项目速览](docs/portfolio-brief.zh-CN.md) · [公开 Demo(3:41)](docs/demo.html) · [无模型快速开始](#无模型快速开始) @@ -18,22 +18,15 @@ AgentLoom 是一个 **Agent Tool Policy Gateway** 原型。当 Agent 想调用 2026 年的 Agent 已经能写代码、改 bug、跑测试。但**它们能不能被信任**,是另一个问题。一次工具调用出错就可能删错文件、跑错测试、泄露密钥。AgentLoom 解决的是 Agent 工具调用层的可治理性——给 Agent 调用工具加上"权限校验 + 不可抵赖的证据",让 Agent 在工程团队里可被审计、可被回滚、可被审批。 ---- +## 当前验证状态 -AgentLoom 是一个 Agent Tool Policy Gateway 原型,为 Agent 工具调用提供身份绑定、 -短时单次 Grant、参数与路径限制、审批、防重放和可回放 Evidence。 +| 范围 | 结果 | 说明 | +| --- | --- | --- | +| 本地 Lite | `382 passed / 3 skipped` | 当前 PR 工作树的默认测试;跳过项需要 Docker。 | +| GitHub Actions Full | `380 passed / 0 skipped` | 已验证的 public `main` 基线;本次 PR 尚待 CI 运行。 | +| Task 24 基准 | `6 PASSED / 0 NOT_RUN` | 三个案例分别在两种模式下完成。 | -> `v0.1.0` 门禁为 **375 passed / 3 skipped**。当前 public main 的 GitHub Actions -> 会构建不可变沙箱镜像;最新 Full 证据为 **380 passed / 0 skipped**,当前工作树 -> 收集 380 项测试;Task 24 两模式基准为 -> **6 PASSED / 0 NOT_RUN**。Skill 目录状态为 **2 PUBLISHED / 4 QUARANTINED**; -> 团队原创 `patch-scope-validator` v1.0.1 的三次治理调用均已严格重开。 -> Human L2 审批为 `APPROVED`,上游 PR -> [#1141](https://github.com/agentscope-ai/AgentTeams/pull/1141) 仍为 `OPEN`。 -> 真人录制、匿名公开播放和正式 `v0.1.0` Release 均已验证。最终八项 P0 -> 提交包已完成审计,SHA-256 为 -> `0c5dfeb0ba6665609a14129a76cc1c239aed882a17e930c144aa5d3b88f6c306`; -> 项目当前冻结为可复现的简历版原型,不再以竞赛页面或新的 AgentTeams 功能为开发目标。 +这些数字描述不同验证环境,不能互相替代。完整历史记录和发布摘要见[验证证据](docs/verification-baseline.zh-CN.md)。 ## 项目定位 @@ -45,16 +38,9 @@ AgentLoom 是一个 Agent Tool Policy Gateway 原型,为 Agent 工具调用提 ## 验证证据 -- 当前付费证据 Provider:`minimax-cn / MiniMax-M2.5` -- Task 24 三案例两模式矩阵完成 6/6;Task 17 证明一条完整受治理 ToolCall 链路 -- 最新 public main Full 门禁:启用不可变 Docker 沙箱测试后 380 passed / 0 skipped; - 冻结 `v0.1.0` 门禁:375 passed / 3 skipped;当前本地 Lite 快照: - 377 passed / 3 skipped / 0 failed(当前工作树共收集 380 项);Ruff、strict mypy、pip-audit 通过 -- Skill 状态:`code-review-and-quality` 与团队原创 `patch-scope-validator` v1.0.1 - 为 `PUBLISHED`,其余四个上游 Skill 保持 `QUARANTINED` - -完整历史竞赛证据仍见[初赛提交记录](docs/competition/agentloom-preliminary-submission.md)。 -Gateway 的目标边界和迁移计划见[产品规格](docs/specs/agent-tool-policy-gateway.md)。 +受治理 ToolCall 的端到端记录、Task 24 基准和历史发布证据见 +[验证基线与历史记录](docs/verification-baseline.zh-CN.md)。竞赛材料另见 +[初赛提交记录](docs/competition/agentloom-preliminary-submission.md)。Gateway 的目标边界和迁移计划见[产品规格](docs/specs/agent-tool-policy-gateway.md)。 ## 架构 @@ -77,7 +63,10 @@ pytest 放入全新、禁网、只读挂载工作区的 Docker 沙箱运行。 ## 无模型快速开始 -前置条件:Python 3.12 和 Git。以下命令不会调用模型或付费 API。 +前置条件:Windows 10/11、PowerShell 7、Python 3.12 和 Git。以下命令不会调用模型或付费 API。 + +完整的单入口流程(安装、确定性 Demo、预期输出、证据位置和故障排查)见 +[Windows 快速开始](docs/deployment/quickstart.md)。 ```powershell python -m venv .venv @@ -96,6 +85,12 @@ python -m venv .venv ``` 将 `severity-normalization` 替换成 `pagination-boundary` 即可运行第二个案例。 +查看 Demo 的验证摘要: + +```powershell +Get-Content .\artifacts\demo\severity-normalization\artifacts\test-results.txt +``` + 本地证据控制面板的启动方式为: ```powershell @@ -167,25 +162,11 @@ $env:AGENTLOOM_POLICY_SIGNING_KEY = "replace-with-a-local-development-secret" 签名密钥、模型凭据和 Provider 原始密钥都不得写入已提交的 MCP、Worker 或 Provider Profile 配置。 -## 历史证据 - -> 以下内容仅为审计和复现而保留,**不是当前证据基线**。Qwen、DeepSeek 因账户 -> 无余额继续禁用。MiniMax 和 StepFun 均已获得订阅调用授权,但每次新运行必须使用 -> 唯一 run ID 并记录准确 Provider/模型;StepFun 证据不得混入只允许 MiniMax 的 -> Task 24 版本化基准。不得把历史付费链路冒充为新运行。 - -- 2026-08-04,Qwen `qwen3.7-plus` 曾完成无人值守修复,并通过独立的可见测试、 - 主机专属隐藏测试和静态检查。生成补丁 SHA-256 为 - `7d9d571a833eabaedf97eac73dad50f6290bfa332d3ef504882398ba2e6d0833`。 - 严格运行证据仍位于 - `artifacts/agentteams/live-repair-pagination-qwen-unattended-03.json`,独立验证证据仍位于 - `artifacts/live-repair/AL-LIVE-PAGINATION-UNATTENDED-20260804-03/verified/artifacts/`。 -- 更早的 StepFun 四角色回滚和 DeepSeek 消息基线证据仍作为 Human L2 审批记录的 - 历史输入。脱敏摘要见 - [L2 审批与上游贡献证据](docs/competition/l2-approval-and-upstream-contribution-evidence.md)。 -- 历史回放入口保留为 `scripts/competition-demo.ps1 -Mode replay` 和 - `scripts/competition-rollback-demo.ps1 -Mode replay`。回放无需模型;Live 模式是独立、 - 必须明确付费并授权的操作。 +FastAPI 控制面中的 `/internal/*` 路由同样属于受信边界:`create_app` 要求部署方注入 +至少 32 个字符的 `internal_api_token`,调用方必须发送 +`Authorization: Bearer `。该 token 只应通过进程环境或密钥管理注入;如果服务 +被部署到可访问网络,仍需在网关层限制来源并配置 TLS。缺少或错误 token 会返回 `401`, +不会进入任务迁移、审批或 Grant 验证逻辑。 ## 项目状态 diff --git a/docs/deployment/quickstart.md b/docs/deployment/quickstart.md index a2e3aa9..95228e7 100644 --- a/docs/deployment/quickstart.md +++ b/docs/deployment/quickstart.md @@ -2,7 +2,8 @@ This path runs a deterministic repair without Docker, AgentTeams, or a cloud model. It is the fastest way to confirm that a clone and its Python environment -work. +work. It is also the recommended first link for a reviewer: the run is bounded, +repeatable, and leaves inspectable evidence. ## Requirements @@ -19,13 +20,34 @@ Set-Location AgentLoom .\scripts\bootstrap.ps1 -Profile lite .\scripts\demo.ps1 -.\.venv\Scripts\agentloom tui ``` The bootstrap creates `.venv`, installs AgentLoom, and applies the local SQLite migrations. The demo runs the `severity-normalization` Case and writes ignored evidence under `artifacts/demo/severity-normalization/`. +Expected output ends with: + +```text +Demo passed. Evidence: ...\artifacts\demo\severity-normalization +``` + +Inspect the independent verification summary with: + +```powershell +Get-Content .\artifacts\demo\severity-normalization\artifacts\test-results.txt +``` + +The file should contain `PATCHED TESTS: PASSED`, `HIDDEN TESTS: PASSED`, and +`STATIC CHECKS: PASSED`. The surrounding directory also contains the patch, +risk report, verification result, and redacted evidence JSON. + +Open the local evidence panel separately with: + +```powershell +.\.venv\Scripts\agentloom tui +``` + Run the second bounded Case with: ```powershell @@ -34,3 +56,14 @@ Run the second bounded Case with: Neither command requires or reads a model API key. For the four-role runtime, continue with [full AgentTeams deployment](windows-agentteams.md). + +## Common failures + +- **Python version error:** install Python 3.12 and rerun bootstrap. AgentLoom + deliberately rejects 3.11 and 3.13 so the evidence environment stays fixed. +- **Demo output already exists:** choose a new output directory with + `.\scripts\demo.ps1 -OutputRoot .\artifacts\demo\my-run`; the runner refuses + to overwrite evidence from an earlier run. +- **TUI cannot start:** run bootstrap first and verify that + `.venv\Scripts\agentloom.exe` exists. The TUI is a local evidence viewer; it + does not replace the deterministic verification command. diff --git a/docs/verification-baseline.zh-CN.md b/docs/verification-baseline.zh-CN.md new file mode 100644 index 0000000..b426808 --- /dev/null +++ b/docs/verification-baseline.zh-CN.md @@ -0,0 +1,22 @@ +# 验证基线与历史记录 + +此页区分当前工作树验证、已合并主线结果和历史集成记录。不同环境的数字不能互相替代。 + +## 当前验证 + +- 当前 PR 工作树 Lite:`382 passed / 3 skipped`;Ruff 和 strict mypy 通过。三个跳过项为可选 Docker 测试。 +- public `main` 最近记录的 Full 门禁:`380 passed / 0 skipped`,CI 构建锁定的沙箱镜像后运行。本 PR 的 Full 门禁结果待 GitHub Actions 完成后更新。 +- Task 24 三案例、两种模式基准:`6 PASSED / 0 NOT_RUN`。这是已归档基准,不是本次改动刚产生的结果。 +- 冻结 `v0.1.0` 门禁:`375 passed / 3 skipped`。 + +当前付费链路记录的 Provider 是 `minimax-cn / MiniMax-M2.5`。Task 17 记录一条完整受治理 ToolCall。Skill 状态、原始证据引用和发布包审计摘要由仓库中的版本化证据文件维护;这些记录不等于新运行结果。 + +## 历史运行 + +以下材料仅用于审计和复现,不是当前验证基线。Qwen 与 DeepSeek 因账户无余额保持禁用。每次新的 MiniMax 或 StepFun 运行都必须使用唯一 run ID 并记录准确 Provider/模型;StepFun 记录不得计入只接受 MiniMax 的 Task 24 版本化基准。 + +- 2026-08-04,Qwen `qwen3.7-plus` 曾完成无人值守修复,通过独立可见测试、主机专属隐藏测试和静态检查。补丁 SHA-256:`7d9d571a833eabaedf97eac73dad50f6290bfa332d3ef504882398ba2e6d0833`。运行摘要位于 `artifacts/agentteams/live-repair-pagination-qwen-unattended-03.json`;独立验证产物位于 `artifacts/live-repair/AL-LIVE-PAGINATION-UNATTENDED-20260804-03/verified/artifacts/`。 +- 早期 StepFun 四角色回滚和 DeepSeek 消息基线是 Human L2 审批记录的历史输入。脱敏摘要见[审批与上游贡献证据](competition/l2-approval-and-upstream-contribution-evidence.md)。 +- 历史回放入口为 `scripts/competition-demo.ps1 -Mode replay` 与 `scripts/competition-rollback-demo.ps1 -Mode replay`。回放无需模型;Live 模式是独立的付费并授权操作。 + +完整竞赛沿革见[初赛提交记录](competition/agentloom-preliminary-submission.md)。架构目标和迁移计划见[产品规格](specs/agent-tool-policy-gateway.md)。 diff --git a/src/agentloom/api.py b/src/agentloom/api.py index 386ffd0..7613e26 100644 --- a/src/agentloom/api.py +++ b/src/agentloom/api.py @@ -1,9 +1,12 @@ """FastAPI control-plane entry point.""" +from hmac import compare_digest from typing import Annotated from fastapi import FastAPI, Query from fastapi.responses import JSONResponse +from starlette.datastructures import Headers +from starlette.types import ASGIApp, Receive, Scope, Send from agentloom.contracts import ( ApprovalCreate, @@ -25,12 +28,53 @@ VersionConflict, ) +_INTERNAL_AUTH_ERROR = { + "error": { + "code": "INTERNAL_AUTHENTICATION_REQUIRED", + "message": "A valid internal API bearer token is required.", + "details": {}, + } +} + + +class InternalAPIBearerAuthMiddleware: + """Require a configured bearer token for every internal control-plane route.""" + + def __init__(self, app: ASGIApp, token: bytes) -> None: + self._app = app + self._token = token + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + if scope["type"] == "http" and scope.get("path", "").startswith("/internal/"): + authorization = Headers(scope=scope).get("authorization", "") + scheme, separator, supplied_token = authorization.partition(" ") + if ( + scheme.lower() != "bearer" + or not separator + or not compare_digest(supplied_token.encode("utf-8"), self._token) + ): + await JSONResponse( + status_code=401, + content=_INTERNAL_AUTH_ERROR, + headers={"WWW-Authenticate": "Bearer"}, + )(scope, receive, send) + return + await self._app(scope, receive, send) + def create_app( database: Database, grant_authorizer: SkillGrantAuthorizer | None = None, + *, + internal_api_token: str, ) -> FastAPI: + if not internal_api_token.isascii() or len(internal_api_token) < 32: + raise ValueError("internal API token must contain at least 32 ASCII characters") app = FastAPI(title="AgentLoom API", version="0.1.0") + app.add_middleware( + InternalAPIBearerAuthMiddleware, + token=internal_api_token.encode("ascii"), + ) @app.post("/api/tasks", response_model=TaskRecord, status_code=201) def create_task(request: TaskCreate) -> TaskRecord: diff --git a/tests/test_approvals_api.py b/tests/test_approvals_api.py index f0050df..3c51b77 100644 --- a/tests/test_approvals_api.py +++ b/tests/test_approvals_api.py @@ -9,13 +9,20 @@ from agentloom.api import create_app from agentloom.storage import Database +INTERNAL_API_TOKEN = "local-test-internal-api-token-32-bytes-minimum" + @pytest_asyncio.fixture async def client(tmp_path: Path) -> AsyncIterator[httpx.AsyncClient]: database = Database(f"sqlite:///{tmp_path / 'agentloom.db'}") database.create_schema() - transport = httpx.ASGITransport(app=create_app(database)) - async with httpx.AsyncClient(transport=transport, base_url="http://test") as api_client: + transport = httpx.ASGITransport( + app=create_app(database, internal_api_token=INTERNAL_API_TOKEN) + ) + async with httpx.AsyncClient( + transport=transport, + base_url="http://test", + ) as api_client: yield api_client @@ -50,14 +57,19 @@ async def test_approval_api_creates_reads_and_decides_exact_request( task = (await client.post("/api/tasks", json=task_payload())).json() created_response = await client.post( "/internal/approvals", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json=approval_payload(task["taskId"]), ) assert created_response.status_code == 201 pending = created_response.json() - read_response = await client.get(f"/internal/approvals/{pending['approvalId']}") + read_response = await client.get( + f"/internal/approvals/{pending['approvalId']}", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + ) decision_response = await client.post( f"/internal/approvals/{pending['approvalId']}/decisions", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json={ "expectedApprovalVersion": 0, "status": "APPROVED", @@ -79,6 +91,7 @@ async def test_approval_api_rejects_unknown_task_and_stale_decision( ) -> None: missing_response = await client.post( "/internal/approvals", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json=approval_payload("task-missing"), ) assert missing_response.status_code == 404 @@ -86,7 +99,11 @@ async def test_approval_api_rejects_unknown_task_and_stale_decision( task = (await client.post("/api/tasks", json=task_payload())).json() approval = ( - await client.post("/internal/approvals", json=approval_payload(task["taskId"])) + await client.post( + "/internal/approvals", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + json=approval_payload(task["taskId"]), + ) ).json() endpoint = f"/internal/approvals/{approval['approvalId']}/decisions" request = { @@ -95,8 +112,18 @@ async def test_approval_api_rejects_unknown_task_and_stale_decision( "actor": "agentloom-developer", "reason": "External write is not approved.", } - assert (await client.post(endpoint, json=request)).status_code == 200 - stale_response = await client.post(endpoint, json={**request, "status": "APPROVED"}) + assert ( + await client.post( + endpoint, + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + json=request, + ) + ).status_code == 200 + stale_response = await client.post( + endpoint, + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + json={**request, "status": "APPROVED"}, + ) assert stale_response.status_code == 409 assert stale_response.json()["error"]["code"] == "APPROVAL_VERSION_CONFLICT" diff --git a/tests/test_internal_policy_api.py b/tests/test_internal_policy_api.py index d3ff913..d0bbcd1 100644 --- a/tests/test_internal_policy_api.py +++ b/tests/test_internal_policy_api.py @@ -15,6 +15,8 @@ from agentloom.policy import InMemoryNonceStore, SkillGrantAuthorizer from agentloom.storage import Database +INTERNAL_API_TOKEN = "local-test-internal-api-token-32-bytes-minimum" + def authorizer() -> SkillGrantAuthorizer: return SkillGrantAuthorizer( @@ -97,13 +99,23 @@ async def test_internal_policy_api_verifies_grant_once(tmp_path: Path) -> None: grant_authorizer = authorizer() database = Database(f"sqlite:///{tmp_path / 'agentloom.db'}") database.create_schema() - transport = httpx.ASGITransport(app=create_app(database, grant_authorizer)) + transport = httpx.ASGITransport( + app=create_app( + database, + grant_authorizer, + internal_api_token=INTERNAL_API_TOKEN, + ) + ) request = { "signedGrant": signed_grant(grant_authorizer), "parameterDigest": "b" * 64, } - async with httpx.AsyncClient(transport=transport, base_url="http://test") as client: + async with httpx.AsyncClient( + transport=transport, + base_url="http://test", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + ) as client: accepted = await client.post("/internal/policy/grants/verify", json=request) replayed = await client.post("/internal/policy/grants/verify", json=request) @@ -118,9 +130,19 @@ async def test_internal_policy_api_rejects_parameter_mismatch(tmp_path: Path) -> grant_authorizer = authorizer() database = Database(f"sqlite:///{tmp_path / 'agentloom.db'}") database.create_schema() - transport = httpx.ASGITransport(app=create_app(database, grant_authorizer)) + transport = httpx.ASGITransport( + app=create_app( + database, + grant_authorizer, + internal_api_token=INTERNAL_API_TOKEN, + ) + ) - async with httpx.AsyncClient(transport=transport, base_url="http://test") as client: + async with httpx.AsyncClient( + transport=transport, + base_url="http://test", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + ) as client: response = await client.post( "/internal/policy/grants/verify", json={ diff --git a/tests/test_tasks_api.py b/tests/test_tasks_api.py index d510307..2e12050 100644 --- a/tests/test_tasks_api.py +++ b/tests/test_tasks_api.py @@ -8,12 +8,16 @@ from agentloom.api import create_app from agentloom.storage import Database +INTERNAL_API_TOKEN = "local-test-internal-api-token-32-bytes-minimum" + @pytest_asyncio.fixture async def client(tmp_path: Path) -> AsyncIterator[httpx.AsyncClient]: database = Database(f"sqlite:///{tmp_path / 'agentloom.db'}") database.create_schema() - transport = httpx.ASGITransport(app=create_app(database)) + transport = httpx.ASGITransport( + app=create_app(database, internal_api_token=INTERNAL_API_TOKEN) + ) async with httpx.AsyncClient(transport=transport, base_url="http://test") as api_client: yield api_client @@ -91,6 +95,55 @@ async def test_create_task_rejects_unknown_fields(client: httpx.AsyncClient) -> assert response.status_code == 422 +@pytest.mark.asyncio +@pytest.mark.parametrize( + "authorization", + [None, "Bearer invalid-token", "Basic invalid-token", b"Bearer \xff"], +) +async def test_internal_task_transition_requires_bearer_token( + client: httpx.AsyncClient, + authorization: str | bytes | None, +) -> None: + created = (await client.post("/api/tasks", json=task_payload())).json() + headers: dict[str, str] | dict[bytes, bytes] + if isinstance(authorization, bytes): + headers = {b"Authorization": authorization} + elif authorization is None: + headers = {} + else: + headers = {"Authorization": authorization} + + response = await client.post( + f"/internal/tasks/{created['taskId']}/transitions", + headers=headers, + json={ + "expectedPlanVersion": 0, + "status": "PLANNED", + "reason": "Coordinator produced a plan.", + }, + ) + + assert response.status_code == 401 + assert response.json() == { + "error": { + "code": "INTERNAL_AUTHENTICATION_REQUIRED", + "message": "A valid internal API bearer token is required.", + "details": {}, + } + } + + +def test_internal_api_rejects_short_tokens(tmp_path: Path) -> None: + database = Database(f"sqlite:///{tmp_path / 'agentloom.db'}") + database.create_schema() + + with pytest.raises(ValueError, match="at least 32 ASCII characters"): + create_app(database, internal_api_token="short") + + with pytest.raises(ValueError, match="at least 32 ASCII characters"): + create_app(database, internal_api_token="这是一个超过三十二字符的中文认证密钥") + + @pytest.mark.asyncio async def test_task_transition_advances_state_and_plan_version( client: httpx.AsyncClient, @@ -99,6 +152,7 @@ async def test_task_transition_advances_state_and_plan_version( response = await client.post( f"/internal/tasks/{created['taskId']}/transitions", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json={ "expectedPlanVersion": 0, "status": "PLANNED", @@ -122,10 +176,17 @@ async def test_task_transition_rejects_stale_plan_version( "status": "PLANNED", "reason": "Coordinator produced a plan.", } - assert (await client.post(endpoint, json=request)).status_code == 200 + assert ( + await client.post( + endpoint, + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, + json=request, + ) + ).status_code == 200 response = await client.post( endpoint, + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json={**request, "status": "INVESTIGATING"}, ) @@ -142,6 +203,7 @@ async def test_task_transition_rejects_invalid_state_edge( response = await client.post( f"/internal/tasks/{created['taskId']}/transitions", + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json={ "expectedPlanVersion": 0, "status": "COMPLETED", @@ -172,6 +234,7 @@ async def test_task_can_finish_as_cancelled_after_approval_rejection( for status in transitions: response = await client.post( endpoint, + headers={"Authorization": f"Bearer {INTERNAL_API_TOKEN}"}, json={ "expectedPlanVersion": current["planVersion"], "status": status, From f686c3d540550d435efa786926a1d33188c60b92 Mon Sep 17 00:00:00 2001 From: WilliamClifton-dev <177295528+WilliamClifton-dev@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:51:52 +0800 Subject: [PATCH 2/2] feat: add secure control plane startup --- README.en.md | 20 ++++++++++++++------ README.md | 17 ++++++++++++----- pyproject.toml | 1 + src/agentloom/api.py | 17 +++++++++++++++++ src/agentloom/cli.py | 27 +++++++++++++++++++++++++++ src/agentloom/tui.py | 37 +++++++++++++++++++++++++++++-------- tests/test_cli.py | 34 ++++++++++++++++++++++++++++++++++ tests/test_tasks_api.py | 11 ++++++++++- tests/test_tui.py | 21 +++++++++++++++++++++ uv.lock | 29 ++++++++++++++++++++++++++++- 10 files changed, 193 insertions(+), 21 deletions(-) diff --git a/README.en.md b/README.en.md index 78bb6fb..d0b0978 100644 --- a/README.en.md +++ b/README.en.md @@ -166,12 +166,20 @@ put the signing key, model credentials, or raw provider secrets in committed MCP Worker, or Provider Profile configuration. The FastAPI control plane's `/internal/*` routes are also a trusted boundary. -`create_app` requires a deployment-injected `internal_api_token` of at least 32 -ASCII characters; callers must send `Authorization: Bearer `. Read the -token from process environment or a secret manager during deployment. If the -service is network-accessible, restrict it at the gateway and use TLS. Missing -or invalid tokens receive `401` before task transitions, approvals, or Grant -verification run. +Apply database migrations, then inject a token of at least 32 ASCII characters +through the process environment or a secret manager before starting the service: + +```powershell +.venv\Scripts\alembic upgrade head +$env:AGENTLOOM_INTERNAL_API_TOKEN = "replace-with-at-least-32-ascii-characters" +.venv\Scripts\agentloom serve +``` + +The service binds only to `127.0.0.1:8000` by default. Bind to another address +only behind a gateway that restricts sources and configures TLS. Callers must +send `Authorization: Bearer ` to `/internal/*`. A missing token prevents +startup; missing or invalid request tokens receive `401` before approval, +transition, or Grant verification logic runs. Historical live evidence is retained for audit. Qwen and DeepSeek remain disabled; new paid runs require a unique run ID and exact Provider/model evidence. The diff --git a/README.md b/README.md index 9ee5f91..b5afc0a 100644 --- a/README.md +++ b/README.md @@ -162,11 +162,18 @@ $env:AGENTLOOM_POLICY_SIGNING_KEY = "replace-with-a-local-development-secret" 签名密钥、模型凭据和 Provider 原始密钥都不得写入已提交的 MCP、Worker 或 Provider Profile 配置。 -FastAPI 控制面中的 `/internal/*` 路由同样属于受信边界:`create_app` 要求部署方注入 -至少 32 个字符的 `internal_api_token`,调用方必须发送 -`Authorization: Bearer `。该 token 只应通过进程环境或密钥管理注入;如果服务 -被部署到可访问网络,仍需在网关层限制来源并配置 TLS。缺少或错误 token 会返回 `401`, -不会进入任务迁移、审批或 Grant 验证逻辑。 +FastAPI 控制面中的 `/internal/*` 路由同样属于受信边界。启动服务前先应用数据库迁移, +再从进程环境或密钥管理注入至少 32 个 ASCII 字符的 token: + +```powershell +.venv\Scripts\alembic upgrade head +$env:AGENTLOOM_INTERNAL_API_TOKEN = "replace-with-at-least-32-ascii-characters" +.venv\Scripts\agentloom serve +``` + +服务默认只绑定 `127.0.0.1:8000`;只有在网关限制来源并配置 TLS 后才应绑定其他地址。 +调用方访问 `/internal/*` 时必须发送 `Authorization: Bearer `。缺少 token 时服务拒绝 +启动,缺少或错误的请求 token 返回 `401`,不会进入审批、状态迁移或 Grant 验证逻辑。 ## 项目状态 diff --git a/pyproject.toml b/pyproject.toml index 2e69a14..d3a7f6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,6 +22,7 @@ dependencies = [ "sqlalchemy>=2.0,<3", "textual>=5,<6", "typer>=0.16,<1", + "uvicorn>=0.35,<1", ] [project.optional-dependencies] diff --git a/src/agentloom/api.py b/src/agentloom/api.py index 7613e26..e393e02 100644 --- a/src/agentloom/api.py +++ b/src/agentloom/api.py @@ -1,5 +1,6 @@ """FastAPI control-plane entry point.""" +import os from hmac import compare_digest from typing import Annotated @@ -36,6 +37,8 @@ } } +INTERNAL_API_TOKEN_ENV = "AGENTLOOM_INTERNAL_API_TOKEN" + class InternalAPIBearerAuthMiddleware: """Require a configured bearer token for every internal control-plane route.""" @@ -236,6 +239,20 @@ def verify_grant( return app +def create_app_from_env(database_url: str) -> FastAPI: + """Build the control-plane app from process configuration. + + The internal bearer token intentionally has no CLI or URL fallback: it must + be supplied through the process environment or an external secret manager. + """ + token = os.environ.get(INTERNAL_API_TOKEN_ENV) + if token is None: + raise RuntimeError( + f"{INTERNAL_API_TOKEN_ENV} must be set to start the internal API" + ) + return create_app(Database(database_url), internal_api_token=token) + + def _task_not_found(task_id: str) -> JSONResponse: return JSONResponse( status_code=404, diff --git a/src/agentloom/cli.py b/src/agentloom/cli.py index 1e5b373..2f3bbd0 100644 --- a/src/agentloom/cli.py +++ b/src/agentloom/cli.py @@ -9,6 +9,7 @@ import typer from sqlalchemy.exc import SQLAlchemyError +from agentloom.api import create_app_from_env from agentloom.l2_approval import ( L2ApprovalError, L2ApprovalVerifier, @@ -42,6 +43,32 @@ _DEFAULT_ROUTE_REHEARSAL_ROOT = _ROOT / "artifacts" / "routes" / "rehearsal" +@app.command() +def serve( + database: Annotated[ + str, + typer.Option(help="SQLAlchemy URL for the control-plane database."), + ] = "sqlite:///agentloom.db", + host: Annotated[ + str, + typer.Option(help="Bind address; keep the default on localhost for development."), + ] = "127.0.0.1", + port: Annotated[ + int, + typer.Option(min=1, max=65535, help="HTTP port for the FastAPI control plane."), + ] = 8000, +) -> None: + """Start the FastAPI control plane using AGENTLOOM_INTERNAL_API_TOKEN.""" + try: + api = create_app_from_env(database) + import uvicorn + + uvicorn.run(api, host=host, port=port, log_level="info") + except (RuntimeError, OSError, ImportError) as exc: + typer.echo(f"agentloom API failed to start: {exc}", err=True) + raise typer.Exit(code=1) from exc + + @app.callback() def main() -> None: """AgentLoom operator commands.""" diff --git a/src/agentloom/tui.py b/src/agentloom/tui.py index 3563f87..d485e9d 100644 --- a/src/agentloom/tui.py +++ b/src/agentloom/tui.py @@ -35,6 +35,10 @@ class DemoRunError(RuntimeError): """Raised when the TUI cannot list or execute a local demo case.""" + def __init__(self, message: str, *, artifacts_dir: Path | None = None) -> None: + self.artifacts_dir = artifacts_dir + super().__init__(message) + class ApprovalQueueError(RuntimeError): """Raised when a local Human approval action cannot be recorded safely.""" @@ -120,7 +124,9 @@ def run_case(self, case_id: str) -> DemoRunSummary: database = Database(f"sqlite:///{output_root / 'agentloom.db'}") events = tuple(database.list_task_events(result.task.task_id)) except (DemoCaseError, MockRepairError, OSError, ValidationError) as exc: - raise DemoRunError(str(exc)) from exc + raise DemoRunError( + str(exc), artifacts_dir=output_root if output_root.exists() else None + ) from exc return DemoRunSummary( case=cases[case_id], task_id=result.task.task_id, @@ -580,11 +586,12 @@ def show_run_summary(self, summary: DemoRunSummary) -> None: ) self.query_one("#artifact-details", Static).update( Text( - "ARTIFACTS\n" + "RUN EVIDENCE\n" + f"Status: {summary.task_status}\n" f"Task: {summary.task_id}\n" f"Root cause: {summary.root_cause}\n" - f"Patch SHA-256: {summary.patch_sha256 or 'N/A (state-machine demo)'}\n" - f"Path: {self._display_path(summary.artifacts_dir)}" + f"Evidence: {self._display_path(summary.artifacts_dir)}\n" + f"Patch SHA-256: {summary.patch_sha256 or 'N/A (state-machine demo)'}" ) ) @@ -774,7 +781,7 @@ def _run_case_in_worker(self, case_id: str) -> None: try: summary = self._service.run_case(case_id) except DemoRunError as exc: - self.call_from_thread(self._show_run_error, str(exc)) + self.call_from_thread(self._show_run_error, exc) return self.call_from_thread(self.show_run_summary, summary) @@ -782,7 +789,7 @@ def _run_failure_retry_in_worker(self) -> None: try: summary = self._service.run_failure_retry_demo() except DemoRunError as exc: - self.call_from_thread(self._show_run_error, str(exc)) + self.call_from_thread(self._show_run_error, exc) return self.call_from_thread(self.show_run_summary, summary) @@ -803,6 +810,9 @@ def _show_running(self, case_id: str) -> None: self.query_one("#run-status", Static).update( Text(f"RUNNING | validating and repairing {case_id}") ) + self.query_one("#artifact-details", Static).update( + Text("RUN EVIDENCE\nWaiting for the run to produce evidence.") + ) self._render_roles( ( RoleStatus("Manager", "RUNNING", "Task lifecycle started."), @@ -816,6 +826,9 @@ def _show_retry_running(self) -> None: self.query_one("#run-status", Static).update( Text("RUNNING | failure -> rollback -> one retry") ) + self.query_one("#artifact-details", Static).update( + Text("RUN EVIDENCE\nWaiting for the run to produce evidence.") + ) self._render_roles( ( RoleStatus("Manager", "RUNNING", "Retry budget is bounded to one attempt."), @@ -825,8 +838,16 @@ def _show_retry_running(self) -> None: ) ) - def _show_run_error(self, message: str) -> None: - self.query_one("#run-status", Static).update(Text(f"FAILED | {message}")) + def _show_run_error(self, error: DemoRunError) -> None: + self.query_one("#run-status", Static).update(Text("FAILED | run stopped")) + evidence = ( + self._display_path(error.artifacts_dir) + if error.artifacts_dir is not None + else "Unavailable; failure occurred before evidence was written." + ) + self.query_one("#artifact-details", Static).update( + Text(f"RUN FAILED\nReason: {error}\nEvidence: {evidence}") + ) self._render_roles( ( RoleStatus("Manager", "FAILED", "Task did not complete."), diff --git a/tests/test_cli.py b/tests/test_cli.py index 7aa31d8..9276d20 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -32,6 +32,40 @@ def test_tui_command_exposes_local_case_and_output_options() -> None: assert "--auto-run" in output +def test_serve_requires_token_before_starting_server( + monkeypatch: pytest.MonkeyPatch, +) -> None: + monkeypatch.delenv("AGENTLOOM_INTERNAL_API_TOKEN", raising=False) + result = CliRunner().invoke(app, ["serve"]) + + assert result.exit_code == 1 + assert "AGENTLOOM_INTERNAL_API_TOKEN must be set" in result.output + + +def test_serve_passes_configured_app_to_localhost_server( + monkeypatch: pytest.MonkeyPatch, +) -> None: + token = "local-test-internal-api-token-32-bytes-minimum" + sentinel = object() + captured: dict[str, object] = {} + monkeypatch.setenv("AGENTLOOM_INTERNAL_API_TOKEN", token) + monkeypatch.setattr("agentloom.cli.create_app_from_env", lambda url: sentinel) + monkeypatch.setattr( + "uvicorn.run", + lambda api, **kwargs: captured.update(api=api, **kwargs), + ) + + result = CliRunner().invoke(app, ["serve"]) + + assert result.exit_code == 0 + assert captured == { + "api": sentinel, + "host": "127.0.0.1", + "port": 8000, + "log_level": "info", + } + + def test_tui_requires_all_live_evidence_layers(tmp_path: Path) -> None: result = CliRunner().invoke( app, diff --git a/tests/test_tasks_api.py b/tests/test_tasks_api.py index 2e12050..4f28d90 100644 --- a/tests/test_tasks_api.py +++ b/tests/test_tasks_api.py @@ -5,7 +5,7 @@ import pytest import pytest_asyncio -from agentloom.api import create_app +from agentloom.api import create_app, create_app_from_env from agentloom.storage import Database INTERNAL_API_TOKEN = "local-test-internal-api-token-32-bytes-minimum" @@ -144,6 +144,15 @@ def test_internal_api_rejects_short_tokens(tmp_path: Path) -> None: create_app(database, internal_api_token="这是一个超过三十二字符的中文认证密钥") +def test_internal_api_env_factory_requires_process_token( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.delenv("AGENTLOOM_INTERNAL_API_TOKEN", raising=False) + + with pytest.raises(RuntimeError, match="AGENTLOOM_INTERNAL_API_TOKEN must be set"): + create_app_from_env(f"sqlite:///{tmp_path / 'agentloom.db'}") + + @pytest.mark.asyncio async def test_task_transition_advances_state_and_plan_version( client: httpx.AsyncClient, diff --git a/tests/test_tui.py b/tests/test_tui.py index f8452d9..f841184 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -189,6 +189,27 @@ async def test_tui_renders_case_and_completed_evidence(tmp_path: Path) -> None: assert "PASSED" in str(app.query_one("#run-status", Static).render()) +@pytest.mark.asyncio +async def test_tui_surfaces_failure_reason_and_redacted_evidence_path( + tmp_path: Path, +) -> None: + service = DemoRunService(cases_root=CASES, runs_root=tmp_path / "runs") + app = AgentLoomApp(service, public_output=True) + artifacts_dir = tmp_path / "private" / "run-123" + + async with app.run_test(size=(90, 44)): + app._show_run_error( + DemoRunError("verification artifact is invalid", artifacts_dir=artifacts_dir) + ) + + status = str(app.query_one("#run-status", Static).render()) + evidence = str(app.query_one("#artifact-details", Static).render()) + assert "FAILED" in status + assert "Reason: verification artifact is invalid" in evidence + assert "Evidence: " in evidence + assert str(tmp_path) not in evidence + + @pytest.mark.asyncio async def test_tui_renders_bound_live_agentteams_evidence(tmp_path: Path) -> None: service = DemoRunService(cases_root=CASES, runs_root=tmp_path / "runs") diff --git a/uv.lock b/uv.lock index e9aadd0..118ef35 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 5 requires-python = "==3.12.*" [[package]] @@ -19,10 +19,12 @@ dependencies = [ { name = "sqlalchemy" }, { name = "textual" }, { name = "typer" }, + { name = "uvicorn" }, ] [package.optional-dependencies] dev = [ + { name = "build" }, { name = "mypy" }, { name = "pip-audit" }, { name = "pytest" }, @@ -33,6 +35,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "alembic", specifier = ">=1.16,<2" }, + { name = "build", marker = "extra == 'dev'", specifier = ">=1.3,<2" }, { name = "fastapi", specifier = ">=0.116,<1" }, { name = "httpx", specifier = ">=0.28,<1" }, { name = "jinja2", specifier = ">=3.1,<4" }, @@ -49,6 +52,7 @@ requires-dist = [ { name = "sqlalchemy", specifier = ">=2.0,<3" }, { name = "textual", specifier = ">=5,<6" }, { name = "typer", specifier = ">=0.16,<1" }, + { name = "uvicorn", specifier = ">=0.35,<1" }, ] provides-extras = ["dev"] @@ -115,6 +119,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e5/ca/78d423b324b8d77900030fa59c4aa9054261ef0925631cd2501dd015b7b7/boolean_py-5.0-py3-none-any.whl", hash = "sha256:ef28a70bd43115208441b53a045d1549e2f0ec6e3d08a9d142cbc41c1938e8d9", size = 26577, upload-time = "2025-04-03T10:39:48.449Z" }, ] +[[package]] +name = "build" +version = "1.6.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "os_name == 'nt'" }, + { name = "packaging" }, + { name = "pyproject-hooks" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/bd/67/4898a44ea4f3f8e213b0954ec0aa0a16971d62a6212d6ea3931e97115b99/build-1.6.1.tar.gz", hash = "sha256:51cc11666391ab6f092070437ac747002ff46f3e4113a3622177ee6b488bfc53", size = 113427, upload-time = "2026-09-10T07:56:00.417Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ad/9b/9fb3585dabcd73a1b2a6267f63f62649347c9e6d072c9fde365b105abb2c/build-1.6.1-py3-none-any.whl", hash = "sha256:ecd351a4be9d35a9eaaba244a7687143c9c7d4aea6ac964e7e7ddab20cbcf4e7", size = 31179, upload-time = "2026-09-10T07:55:59.148Z" }, +] + [[package]] name = "cachecontrol" version = "0.14.4" @@ -857,6 +875,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/10/bd/c038d7cc38edc1aa5bf91ab8068b63d4308c66c4c8bb3cbba7dfbc049f9c/pyparsing-3.3.2-py3-none-any.whl", hash = "sha256:850ba148bd908d7e2411587e247a1e4f0327839c40e2e5e6d05a007ecc69911d", size = 122781, upload-time = "2026-01-21T03:57:55.912Z" }, ] +[[package]] +name = "pyproject-hooks" +version = "1.3.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6d/5d/f2ddeef4a855a102aaae5e97826a0260007522ab504421b75addfdb1517c/pyproject_hooks-1.3.3.tar.gz", hash = "sha256:defda19b854fa0d3bd4f76ea4ddcba8abd7dcfcdd585a6690ade050744fc5f43", size = 21013, upload-time = "2026-09-16T08:58:03.999Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/85/11/044d1ae1b4ec0d7af88ee5bc91e081be1022533032b906a7bdabdbb60977/pyproject_hooks-1.3.3-py3-none-any.whl", hash = "sha256:5fc53fdac9f7bd63fbcdc868fb5f90b4784d78a53a3d3388cd738b807441a20b", size = 10724, upload-time = "2026-09-16T08:58:02.96Z" }, +] + [[package]] name = "pytest" version = "9.1.1"