sync: 鍚屾灞€鍩熺綉鏈€鏂颁唬鐮?(source master @ b69568e4)
This commit is contained in:
1 parent
4f7f07504a
commit
8bc8b0e082
1651 files changed
+278599
-11416
No files matched your search
@@ -560,6 +560,7 @@ async def apply_replacements_route(request: Request, body: ApplyRequest) -> Appl
|
||||
await asyncio.to_thread(_write_manifest, root, backup_id, norm, changed, replaced_total, datetime.now(UTC).isoformat())
|
||||
|
||||
await _refresh_cache_safe()
|
||||
await _sync_sandbox_paths([item.file for item in changed])
|
||||
logger.info("Skill address apply: %d files, %d replacements, backup=%s", len(changed), replaced_total, backup_id)
|
||||
return ApplyResponse(changed_files=changed, replaced_total=replaced_total, backup_id=backup_id, warnings=warnings)
|
||||
|
||||
@@ -616,6 +617,7 @@ async def apply_replacements_stream(request: Request, body: ApplyRequest) -> Str
|
||||
await asyncio.to_thread(_write_manifest, root, backup_id, norm, changed, replaced_total, datetime.now(UTC).isoformat())
|
||||
|
||||
await _refresh_cache_safe()
|
||||
await _sync_sandbox_paths([item.file for item in changed])
|
||||
logger.info("Skill address apply(stream): %d files, %d replacements, backup=%s", len(changed), replaced_total, backup_id)
|
||||
result = ApplyResponse(changed_files=changed, replaced_total=replaced_total, backup_id=backup_id, warnings=warnings)
|
||||
yield _ndjson({"type": "result", **result.model_dump()})
|
||||
@@ -699,6 +701,7 @@ async def rollback(request: Request, backup_id: str) -> RollbackResponse:
|
||||
|
||||
restored = await asyncio.to_thread(_restore_backup, root, backup_root)
|
||||
await _refresh_cache_safe()
|
||||
await _sync_sandbox_paths(restored)
|
||||
logger.info("Skill address rollback: backup=%s, restored %d files", backup_id, len(restored))
|
||||
return RollbackResponse(backup_id=backup_id, restored_files=restored)
|
||||
|
||||
@@ -711,3 +714,15 @@ async def _refresh_cache_safe() -> None:
|
||||
await refresh_skills_system_prompt_cache_async()
|
||||
except Exception: # noqa: BLE001 — cache refresh is best-effort
|
||||
logger.warning("Failed to refresh skills prompt cache", exc_info=True)
|
||||
|
||||
|
||||
async def _sync_sandbox_paths(relative_paths: list[str]) -> None:
|
||||
"""Copy rewritten skill files into the model-facing sandbox view."""
|
||||
if not relative_paths:
|
||||
return
|
||||
try:
|
||||
from deerflow.sandbox.skill_view import sync_skill_sandbox_relative_paths
|
||||
|
||||
await asyncio.to_thread(sync_skill_sandbox_relative_paths, relative_paths)
|
||||
except Exception: # noqa: BLE001 — the canonical write already succeeded
|
||||
logger.warning("Failed to sync skill address edits into the sandbox view", exc_info=True)
|
||||
Reference in new issue
Block a user