Skip to content

Choose a tag to compare

@LeoOfGit LeoOfGit released this 25 Oct 09:14

🇺🇸 [v17] - WinGet De-elevation & Native Uninstaller Pipeline, Concurrent Pre-download Engine, PNPM Full Integration & Hybrid Management, Adaptive Task Monitor, Venv Repair Wizard, Package Search Delegate Redesign & Self-Hosting Guard

🇨🇳 [v17] - WinGet 用户级提权卸载双层保障、并发预下载引擎、PNPM 后端与全局混合纳管、自适应任务监控、虚拟环境修复向导、包搜索委托重构与宿主自保护 (中文说明)

本次 V17 版本是一次里程碑式的架构升级与体验飞跃。针对管理员模式下 WinGet 卸载用户级程序的底层限制,构建了“原生注册表卸载器 + Windows 令牌降权执行”的双层彻底清理保障;WinGet 批量更新引入了基于线程池的并发预下载流水线;Node.js 模块全面整合 pnpm 现代化包管理器并支持与 npm 全局包混合并存、精准路由;新增了自适应宽窄屏的任务监控浮窗;针对损坏的 Python 虚拟环境推出了三合一修复向导;全新重构了包搜索与添加对话框为轻量级原生 Delegate 架构,彻底消除列表点选迟滞与双击失效;同时引入了源码开发模式下的宿主环境文件锁自保护机制与 Wheel 离线下载/导出能力。

🛡️ WinGet 用户级程序提权卸载双层保障体系 (De-elevation & Native Uninstaller)

  • 核心痛点解决:OmniPack 默认以管理员权限启动以支撑系统级操作,但 WinGet 1.29+ 版本内置了安全拦截(0x8A15007D:禁止在提权上下文中卸载用户级应用),导致常规卸载强行中断。
  • 一级保障(ARP 原生卸载器解析):深度扫描 HKLM/HKCU 注册表卸载键值,精准定位应用原生卸载程序(UninstallString / QuietUninstallString)。针对 MSI 安装包自动转译为 MsiExec.exe /X {GUID},针对标准 EXE 卸载程序自动追加静默参数(/SILENT, /S, /qb),并通过 start "" /wait 保证在终端中同步等待,彻底清理应用程序文件、快捷方式与注册表,不留磁盘垃圾残留。
  • 二级保障(Windows 令牌降权执行器 core/de_elevate.py):针对绿色便携版(Portable)等无注册表项的 WinGet 应用,通过 advapi32.GetTokenInformation + TokenLinkedToken 获取当前会话绑定的标准用户(Medium Integrity)主令牌(若无分割令牌则抓取 explorer.exe 桌面进程令牌),调用 CreateProcessWithTokenW 降权启动 winget uninstall。顶层入口暴露 --de-elevate 参数,单文件打包后依然可秒级调用。
  • UWP/MSIX 卸载重构:识别 MSIX\... 前缀包,自动路由至 PowerShell Get-AppxPackage | Remove-AppxPackage,解决微软商店应用在管理员环境下的卸载难题。

⚡ WinGet 批量更新并发预下载流水线 (Concurrent Pre-Download Engine)

  • 多线程并发预下载 (WingetConcurrentDownloadWorker):在执行批量更新前,利用 ThreadPoolExecutor 并发拉取待更新应用的安装包与清单(winget download),消除长时间串行下载阻塞。
  • 本地清单离线安装:自动解析下载缓存目录中的 <pkg_id>.installer.yaml 清单文件,后续安装指令直接以 --manifest <path> 模式在终端中顺序静默执行,极大提升批量升级速度与网络容错率。

📦 PNPM 现代化后端接入与全局包混合纳管 (PNPM Integration & Hybrid Management)

  • pnpm 引擎完整支持:配置中心新增 use_pnpm 开关与 pnpm_path 自定义路径,支持自动探测系统 PATH、%LOCALAPPDATA%\pnpm 及 %APPDATA%\npm。
  • 全局环境混合扫描与精准操作路由:自动扫描并解析 pnpm list -g --json,与全局 npm 包合并展示;全局包卡片智能显示高亮橙色 [pnpm] 标识;卸载或更新时,系统根据包的实际安装来源自动分发为 npm 或 pnpm 命令,互不干扰、精准执行。
  • 健壮的输出流解析 (extract_json_from_output):基于 json.JSONDecoder.raw_decode,从夹杂有更新提示、警告信息与 banner 的终端输出中稳健剥离出合法 JSON 数据。

🏷️ SemVer 2.0.0 规范比对与全渠道(Channel/Dist-Tags)实时感知

  • 语义化版本规范比对:实现完全符合 SemVer 2.0.0 规范的 parse_semver、semver_compare 与 is_newer_semver,正确判定预发布阶段(如 1.2.3 > 1.2.3-alpha.1),支持点分隔与短横线混合语法。
  • 扩展渠道识别:支持 10 类频道识别正则(alpha, beta, rc, canary, next, nightly, preview, dev, insiders, experimental)。
  • 高速 dist-tags 获取与动态配置更新:NpmDistTagsWorker 优先通过 HTTP 直连 npm registry 获取 dist-tags,秒级响应;包配置对话框支持动态刷新远端渠道,切换更新渠道后即时根据 SemVer 计算最新版本并触发更新。

📊 自适应任务监控浮动面板 (TaskMonitorWidget)

  • 自适应宽/窄屏布局:常驻于控制台与终端之间,自适应宽屏(34px 单行紧凑)与窄屏(72px 双行拓展)模式,任务启动时自动分配合理的面板高度。
  • 多步骤全流程追踪:为 WinGet、Python、Node.js 运行时安装等核心流程提供标准多步骤指示(如:获取源 -> 下载包 -> 校验签名 -> 系统安装)。
  • 精细化网络指标:实时呈现已下载/总字节数、瞬时下载速度、剩余时间(ETA)、动态进度条,并提供直达官方 Release 页面的逃逸按钮。

🛠️ Python 虚拟环境破损诊断与一键修复向导 (EnvRepairDialog)

  • 破损状态感知:Environment 数据模型新增 is_broken 与 broken_reason;当虚拟环境关联的底层 Python 解释器丢失或损坏时,卡片呈现显眼的 ⚠️ Damaged 状态与红色修复入口。
  • 三合一修复向导:
    • 策略 A(自动重装):通过系统包管理器自动重新安装缺失的对应版本 Python;
    • 策略 B(环境迁移):一键将该虚拟环境无缝重定向迁移绑定到当前系统中已有的其它有效 Python 解释器;
    • 策略 C(手动命令):生成并一键复制手动终端修复命令。

🔒 源码开发宿主环境自保护机制 (Self-Hosting Guard)

  • 宿主环境识别 (is_self_hosting_env):在以源码方式开发/运行 OmniPack 时,自动识别当前正在托管主程序进程的虚拟环境(匹配 sys.prefix 与 sys.executable,在打包后的 Frozen 独立环境下自动放行)。
  • 文件锁拦截与告警:宿主环境卡片显示 [当前宿主] 高亮标签;当尝试在该环境中更新/卸载被进程占用的核心库(如 PySide6)或升级解释器时,触发拦截弹窗,规避 Windows 文件锁(WinError 32 / WinError 5)导致的崩溃。

📥 Python Wheel 批量离线下载与 URL 导出

  • Wheel 离线下载 (DownloadWheelsWorker):在虚拟环境卡片菜单中支持一键为所有待更新的包批量下载 .whl 安装文件至本地目录。
  • 下载直链批量导出 (ExportWhlUrlsWorker):结合 PyPI JSON API 与 Simple 索引,智能解析适配平台的 wheel 下载直链并一键导出为文本列表。

⚙️ 后端运行时自检与跨 Shell 命令渲染强化

  • 后台自动安装缺失后端 (BackendAutoInstallerWorker):软件启动后后台异步自检 uv 与 pnpm,若开启自动安装选项则自动静默部署并写入持久化配置。设置中心同步支持手动安装与在线更新。
  • 命令渲染器语法保护 (ShellCommandRenderer):针对 Windows start "" /wait 语法做特殊保护,避免 subprocess.list2cmdline 将 "" 转义导致 cmd 语法错误;针对 PowerShell 自动转译为 Start-Process -Wait;多段命令根据 Shell 类型智能使用 & 或 ; 连接。
  • 设置中心异步优化:引入 SystemUrlDetectThread 在后台异步探测系统级镜像源,彻底消除打开设置面板时的微卡顿。

🔍 包搜索与添加交互体验革新 (Package Search & Delegate Redesign)

  • Qt 原生委托渲染重构 (PackageItemDelegate):彻底废除在 QListWidget 中为每个条目挂载子部件(setItemWidget)的传统模式,改用 Qt 官方标准的 QStyledItemDelegate 进行轻量自绘。
  • 点选与双击事件拦截根治:彻底消除原 QLabel/QWidget 容器对鼠标事件的拦截与吞噬。列表项现已支持任意文字或间隙区域的100% 灵敏单击、双击直达配置/安装、以及键盘回车键(itemActivated)秒级确认。
  • 重复点击响应与选区状态健全:同时联动 itemClicked 与 itemSelectionChanged 信号,确保用户即使重复点击已选中的条目,输入框亦能即时刷新并重新激活下一步按钮。
  • 搜索定时器智能阻断与异步竞态隔离:用户在匹配列表中点选条目时,即刻终止正在倒计时的防抖搜索定时器(_search_timer);取消正在运行的后台 worker 时严格递增 _search_seq 序号,彻底阻断迟滞网络响应对当前列表的重绘冲刷,杜绝界面闪烁与选中状态被清空。
  • 精确匹配自动高亮:搜索结果返回时,若列表中存在与当前输入框完全匹配的项,自动将其置为当前选中高亮项,显著提升搜索装包直觉体验。

This major V17 release introduces comprehensive architectural upgrades: a dual-tier de-elevation and native uninstaller pipeline to bypass elevated WinGet restrictions when removing user-scope packages, a concurrent pre-download engine for batch updates, full pnpm backend integration with hybrid global package management, SemVer 2.0.0 compliance with dynamic dist-tags channel detection, an adaptive task monitor panel, a 3-way virtual environment repair wizard, a lightweight item delegate redesign for package search, and a self-hosting execution guard.

🛡️ WinGet De-elevation & Native Uninstaller Pipeline

  • User-Scope Uninstall Fix under Administrator: Overcomes the WinGet 1.29+ elevated blockage (0x8A15007D) when attempting to uninstall user-scoped packages while OmniPack runs with administrative privileges.
  • Tier 1 (ARP Registry Uninstaller): Inspects HKLM and HKCU uninstall registries to locate the official uninstaller executable (UninstallString / QuietUninstallString). Automatically converts MSI packages to MsiExec.exe /X {GUID} and appends silent switches (/SILENT, /S, /qb) to ensure complete file and registry cleanup without leftovers.
  • Tier 2 (Token De-elevation Fallback core/de_elevate.py): For portable and registry-less applications, duplicates the standard user (Medium Integrity) token from TokenLinkedToken (or the desktop explorer.exe shell) and spawns non-elevated winget uninstall via CreateProcessWithTokenW. CLI entry point exposed as --de-elevate.
  • UWP/MSIX Direct Removal: Dispatches MSIX packages directly to PowerShell Get-AppxPackage | Remove-AppxPackage.

⚡ WinGet Concurrent Pre-Download Engine

  • Multi-threaded Pre-downloads (WingetConcurrentDownloadWorker): Downloads packages and manifests concurrently using a configurable ThreadPoolExecutor ahead of batch updates, avoiding serial network bottlenecks.
  • Local Manifest Execution: Discovers <pkg_id>.installer.yaml files within download directories and runs offline installations sequentially with --manifest <path>.

📦 PNPM Backend Integration & Hybrid Global Management

  • Full pnpm Engine Support: Configurable via use_pnpm and pnpm_path with automatic path discovery across standard Windows directories and PATH.
  • Hybrid Global Scanning & Intelligent Routing: Seamlessly scans and merges pnpm list -g --json with npm global packages. Displays an orange [pnpm] badge on relevant package cards and dispatches remove/update commands to the respective package manager automatically.
  • Resilient JSON Output Parsing (extract_json_from_output): Extracts structured JSON from command outputs even when surrounded by update notifications and console banners.

🏷️ SemVer 2.0.0 Engine & Dynamic Dist-Tags Perception

  • Strict SemVer Compliance: Implements parse_semver, semver_compare, and is_newer_semver supporting prerelease phases (e.g. 1.2.3 > 1.2.3-alpha.1) across hyphenated and dotted notations.
  • Extended Channel Detection: Recognizes 10 prerelease channels (alpha, beta, rc, canary, next, nightly, preview, dev, insiders, experimental).
  • High-Speed HTTP Dist-Tags: Queries npm registry directly via HTTP before falling back to CLI npm view, and recalculates updates immediately when the channel changes in package settings.

📊 Adaptive Task Monitor Panel (TaskMonitorWidget)

  • Responsive Wide/Narrow Modes: Automatically toggles between a 34px single-line bar and a 72px expanded view according to available width, dynamically allocating splitter heights.
  • Multi-Step Flow Tracking: Visualizes 4-step execution pipelines (Fetch Release -> Download Pkg -> Verify Signature -> System Install) for runtimes and WinGet upgrades.
  • Live Transfer Metrics: Reports bytes downloaded, total size, download speed, ETA, and provides an escape URL button linking directly to release artifacts.

🛠️ Virtual Environment Repair Wizard (EnvRepairDialog)

  • Broken Environment State Tracking: Flags environments whose underlying Python interpreters are missing or damaged (is_broken / broken_reason) with a prominent ⚠️ Damaged indicator.
  • 3-Way Remediation: Offers automatic re-installation of the missing Python version, one-click migration/re-pointing to an existing system Python interpreter, or manual command generation.

🔒 Self-Hosting Environment Protection Guard

  • Host Detection (is_self_hosting_env): Identifies when a virtual environment is currently hosting the running OmniPack process in source development mode (bypassed in frozen standalone mode).
  • File-Lock Collision Prevention: Marks host cards with a [当前宿主] badge and intercepts modifications to locked libraries (e.g. PySide6) or the active interpreter to prevent Windows file lock crashes (WinError 32 / WinError 5).

📥 Python Wheel Batch Download & URL Export

  • Wheel Downloader (DownloadWheelsWorker): Downloads matching .whl binaries for outdated packages to a local folder in batch.
  • Download URL Exporter (ExportWhlUrlsWorker): Queries PyPI JSON APIs and Simple indexes to extract platform-compatible wheel download URLs into a shareable text list.

⚙️ Automated Backend Bootstrapping & Shell Rendering Fixes

  • Silent Backend Auto-Installer (BackendAutoInstallerWorker): Automatically detects and installs missing uv and pnpm engines in the background upon launch.
  • Shell Command Quoting & Wait Fixes (ShellCommandRenderer): Preserves empty title arguments in Windows start "" /wait commands, maps to Start-Process -Wait in PowerShell, and connects chained commands with appropriate delimiters (& vs ;).
  • Async System Source Detection (SystemUrlDetectThread): Performs system source profile probing in a dedicated thread to ensure zero UI freezing when opening the settings dialog.

🔍 Package Search & Delegate Architecture Redesign

  • Lightweight Item Delegate (PackageItemDelegate): Replaces heavy setItemWidget child widgets with Qt's standard QStyledItemDelegate, streamlining item rendering and reducing memory overhead.
  • Mouse Event Interception & Double-Click Fix: Eliminates child QLabel/QWidget mouse-event hijacking. Item click, double-click to proceed/install, and keyboard Enter activation now trigger with 100% responsiveness across all title and description zones.
  • Robust Selection & Re-click Synchronization: Connects both itemClicked and itemSelectionChanged signals, allowing users to re-populate the search input and re-enable proceeding even when clicking an already selected item.
  • Timer Cancellation & Async Race-Condition Guard: Immediately halts the pending 500ms debounce _search_timer upon item selection; increments _search_seq upon worker cancellation to isolate delayed network responses from wiping the active selection.
  • Exact-Match Auto-Selection: Automatically highlights and selects the item when a returned search match exactly equals the current search query.