Add partition-aware smart backup and restore

Adds SmartBackupManager component that reads the partition table first,
then backs up each partition individually with chunked reads to stay
under the 300s MCP timeout. Solves timeout issues on large flash devices
(e.g. 16 MB ESP32-P4).

Tools: esp_smart_backup, esp_smart_restore
Prompt: esp_backup_plan (estimates backup time per partition)

Features:
- Adaptive chunk sizing based on measured throughput
- Skip-empty detection (0xFF regions)
- Optional gzip compression per partition
- SHA256 manifest for integrity verification
- Dry-run mode for time estimation
- Progress reporting via MCP context
This commit is contained in:
Ryan Malloy 2026-02-25 16:09:10 -07:00
parent f8dfa90fba
commit 9fa314dae9
3 changed files with 1072 additions and 0 deletions

View File

@ -15,6 +15,7 @@ from .product_catalog import ProductCatalog
from .production_tools import ProductionTools
from .qemu_manager import QemuManager
from .security_manager import SecurityManager
from .smart_backup import SmartBackupManager
# Component registry for dynamic loading
COMPONENT_REGISTRY = {
@ -28,6 +29,7 @@ COMPONENT_REGISTRY = {
"diagnostics": Diagnostics,
"qemu_manager": QemuManager,
"product_catalog": ProductCatalog,
"smart_backup": SmartBackupManager,
}
__all__ = [
@ -41,5 +43,6 @@ __all__ = [
"Diagnostics",
"QemuManager",
"ProductCatalog",
"SmartBackupManager",
"COMPONENT_REGISTRY",
]

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ from .components import (
ProductionTools,
QemuManager,
SecurityManager,
SmartBackupManager,
)
from .config import ESPToolServerConfig, get_config, set_config
@ -72,6 +73,7 @@ class ESPToolServer:
self.components["chip_control"] = ChipControl(self.app, self.config)
self.components["flash_manager"] = FlashManager(self.app, self.config)
self.components["partition_manager"] = PartitionManager(self.app, self.config)
self.components["smart_backup"] = SmartBackupManager(self.app, self.config)
# Advanced features
self.components["security_manager"] = SecurityManager(self.app, self.config)
@ -179,6 +181,10 @@ class ESPToolServer:
"esp_performance_profile",
"esp_diagnostic_report",
],
"smart_backup": [
"esp_smart_backup",
"esp_smart_restore",
],
"product_catalog": [
"esp_product_search",
"esp_product_info",