mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-06 18:38:51 +00:00
Page saved commits directly, batch metadata and file statistics, and bound file-filter scans to Git batches. Keep the snapshot index stat cache instead of clearing and rebuilding it on every capture. Inspect current changes explicitly in a disposable repository borrowing saved objects read-only. Offload Git work from API event loops and discard stale UI responses when the selection or workspace changes. Verified with 42 Python tests and 3 frontend tests, including unchanged saved-repository contents after inspection, unusual filenames, filtering, and a 25-process ceiling for a ten-entry history page.
21 lines
801 B
Python
21 lines
801 B
Python
from __future__ import annotations
|
|
|
|
import asyncio
|
|
|
|
from helpers.api import ApiHandler, Request, Response
|
|
from plugins._time_travel.helpers.time_travel import TimeTravelError, TimeTravelService, resolve_workspace
|
|
|
|
|
|
class HistoryPresent(ApiHandler):
|
|
async def process(self, input: dict, request: Request) -> dict | Response:
|
|
try:
|
|
workspace = resolve_workspace(
|
|
str(input.get("context_id") or ""),
|
|
workspace_id=str(input.get("workspace_id") or ""),
|
|
context_loader=self.use_context,
|
|
)
|
|
present = await asyncio.to_thread(TimeTravelService(workspace).present_summary)
|
|
return {"ok": True, "present": present}
|
|
except TimeTravelError as exc:
|
|
return {"ok": False, "error": str(exc)}
|