Merge feature/smart-backup: partition-aware flash backup and restore

Adds esp_smart_backup and esp_smart_restore tools with chunked reads,
adaptive sizing, skip-empty detection, gzip compression, SHA256
verification, and an esp_backup_plan prompt for pre-flight planning.

Hardened against 11 code review findings including path traversal
protection, atomic manifest writes, and timeout caps.
This commit is contained in:
Ryan Malloy 2026-02-25 17:01:22 -07:00
commit c6a55a5e8f
4 changed files with 1133 additions and 0 deletions

View File

@ -103,6 +103,14 @@ All tools follow a consistent pattern: they return a JSON object with a `success
| `esp_list_tools` | List all tools by category |
| `esp_health_check` | Environment health check |
### Smart Backup (2 tools + 1 prompt)
| Tool | Description |
|------|-------------|
| `esp_smart_backup` | Partition-aware flash backup with chunked reads, skip-empty, and compression |
| `esp_smart_restore` | Restore a partition-aware backup with SHA256 verification before flashing |
| `esp_backup_plan` *(prompt)* | Generate an informed backup plan based on device partition layout |
### Product Catalog (5 tools)
| Tool | Description |

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",