ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s

This commit is contained in:
2026-08-20 13:12:50 +00:00
commit b119135836
10275 changed files with 3284984 additions and 0 deletions
@@ -0,0 +1,35 @@
import json
from pathlib import Path
from evidence import retain_step_screenshots, sha256_file, write_json, write_manifest
def test_screenshots_are_copied_and_history_is_rewritten(tmp_path: Path) -> None:
temporary_screenshot = tmp_path / "temporary.png"
temporary_screenshot.write_bytes(b"not-a-real-png-but-stable")
run_dir = tmp_path / "run"
history = {"history": [{"state": {"screenshot_path": str(temporary_screenshot)}}]}
retained, records = retain_step_screenshots(history, run_dir)
retained_path = run_dir / "screenshots" / "step-001.png"
assert retained_path.read_bytes() == temporary_screenshot.read_bytes()
assert retained["history"][0]["state"]["screenshot_path"] == "screenshots/step-001.png"
assert records[0]["sha256"] == sha256_file(retained_path)
assert history["history"][0]["state"]["screenshot_path"] == str(temporary_screenshot)
def test_manifest_hashes_retained_artifacts(tmp_path: Path) -> None:
write_json(tmp_path / "summary.json", {"status": "complete"})
manifest_path = write_manifest(tmp_path, {"experiment": "test", "credential_retained": False})
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
assert manifest["credential_retained"] is False
assert manifest["artifacts"] == [
{
"path": "summary.json",
"bytes": (tmp_path / "summary.json").stat().st_size,
"sha256": sha256_file(tmp_path / "summary.json"),
}
]