feat(update): integrate managed installs and recoverable in-app updates (#6168)
Add owner-aware Stable and Preview updates with explicit consent, verified release plans, protected process handoff and bounded service recovery. Keep configuration and conversations separate from program rollback. Include the compact About controls, Windows long-path support, native package recovery checks and optional macOS Dock lifecycle integration. Preserve documented guidance for installations owned by other managers. This code integration does not publish packages, enable signing or advance the public update channel. Co-authored-by: chengyongru <61816729+chengyongru@users.noreply.github.com>
This commit is contained in:
1 parent
76da55994b
commit
fbb61a373f
216 files changed
+27948
-1084
No files matched your search
@@ -146,6 +146,14 @@ _SYSTEM_ROUTES = {
|
||||
"/api/settings/pairing/deny": "pairing-deny",
|
||||
"/api/settings/mcp-presets": "mcp-list",
|
||||
"/api/settings/version-check": "version-check",
|
||||
"/api/settings/nanobot-update/channel": "update-channel",
|
||||
"/api/settings/nanobot-update/plan": "update-plan-read",
|
||||
"/api/settings/nanobot-update/plan/create": "update-plan-create",
|
||||
"/api/settings/nanobot-update/job": "update-job-read",
|
||||
"/api/settings/nanobot-update/job/prepare": "update-job-prepare",
|
||||
"/api/settings/nanobot-update/job/settle": "update-job-settle",
|
||||
"/api/settings/nanobot-update/job/execute": "update-job-execute",
|
||||
"/api/settings/nanobot-update/job/retry": "update-job-retry",
|
||||
**{
|
||||
path: f"mcp-{action}"
|
||||
for path, action in _MCP_PRESET_ACTIONS_BY_PATH.items()
|
||||
@@ -153,6 +161,12 @@ _SYSTEM_ROUTES = {
|
||||
}
|
||||
|
||||
_SETTINGS_MUTATION_PATHS = frozenset({
|
||||
"/api/settings/nanobot-update/channel",
|
||||
"/api/settings/nanobot-update/plan/create",
|
||||
"/api/settings/nanobot-update/job/prepare",
|
||||
"/api/settings/nanobot-update/job/settle",
|
||||
"/api/settings/nanobot-update/job/execute",
|
||||
"/api/settings/nanobot-update/job/retry",
|
||||
"/api/settings/runtime-config/update",
|
||||
"/api/settings/update",
|
||||
"/api/settings/model-configurations/create",
|
||||
@@ -251,19 +265,21 @@ class WebUISettingsRouter:
|
||||
self._mcp_reload = mcp_reload
|
||||
self._image_generation_reload = image_generation_reload
|
||||
self._mcp_oauth_redirect_uri = mcp_oauth_redirect_uri
|
||||
self._mcp_oauth = McpOAuthManager()
|
||||
self._mcp_oauth = McpOAuthManager(bus.admission)
|
||||
self._restart_sections: set[str] = set()
|
||||
self._restart_baselines: dict[str, dict[str, Any]] = {}
|
||||
self._restart_changes: dict[str, str] = {}
|
||||
self._models = model_domain.ModelSettingsHandler(settings, logger)
|
||||
self._models = model_domain.ModelSettingsHandler(settings, logger, bus.admission)
|
||||
self._capabilities = capability_domain.CapabilitySettingsHandler(
|
||||
settings,
|
||||
logger,
|
||||
)
|
||||
self._system = system_domain.SystemSettingsHandler(settings, logger)
|
||||
self._system = system_domain.SystemSettingsHandler(settings, logger, bus.admission)
|
||||
|
||||
async def close(self) -> None:
|
||||
"""Release state owned by settings domains."""
|
||||
await self._mcp_oauth.close()
|
||||
await self._models.close()
|
||||
await self._system.close()
|
||||
|
||||
async def dispatch(
|
||||
@@ -303,6 +319,8 @@ class WebUISettingsRouter:
|
||||
return await asyncio.to_thread(self._handle_settings_usage)
|
||||
|
||||
domain, action = route
|
||||
if action.startswith("update-") and self._runtime_surface == "native":
|
||||
return self._error_response(409, "Update this installation through Nanobot Desktop.")
|
||||
restart_before = (
|
||||
await asyncio.to_thread(self._restart_values, action)
|
||||
if action in {"runtime-config-update", "image-update", "web-search-update"}
|
||||
@@ -318,6 +336,14 @@ class WebUISettingsRouter:
|
||||
"features-enable",
|
||||
"channel-configure",
|
||||
"channel-connect",
|
||||
"update-channel",
|
||||
"version-check",
|
||||
"update-plan-create",
|
||||
"update-plan-read",
|
||||
"update-job-prepare",
|
||||
"update-job-settle",
|
||||
"update-job-execute",
|
||||
"update-job-retry",
|
||||
}
|
||||
),
|
||||
)
|
||||
@@ -362,7 +388,12 @@ class WebUISettingsRouter:
|
||||
self._restart_changes[action] = result.restart_section
|
||||
# Reversible changes are tracked separately from installation and reload failures.
|
||||
result.payload["requires_restart"] = False
|
||||
return self._render_result(result)
|
||||
response = self._render_result(result)
|
||||
if action.startswith("update-") or action == "version-check":
|
||||
# A saved review is immutable, but its local validity and permission
|
||||
# are not. Never reuse a cached success after an installation changes.
|
||||
response.headers["Cache-Control"] = "no-store"
|
||||
return response
|
||||
|
||||
def _restart_values(self, action: str) -> dict[str, Any]:
|
||||
config = self.settings.config.load()
|
||||
|
||||
Reference in new issue
Block a user