Skip to content

feat: 1.6.0 自定义组件与工坊 v2、单二进制多模式伴侣宿主、剪贴板组件与架构/CI 门禁收口 - #604

Merged
Tianyu199509 merged 16 commits into
mainfrom
feat/custom-widget
Nov 22, 2026
Merged

Tianyu199509 merged 16 commits into
mainfrom
feat/custom-widget

Conversation

@Tianyu199509

@Tianyu199509 Tianyu199509 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

说明:本 PR 仍为 feat/custom-widget 分支阶段性整合(Draft),暂不发版。本轮在保留既有基线提交 5fd6da16 的基础上,按主题追加 3 个提交(c1a7dd41、4243b2f1、d23e5a5b),同步最新 1.6.0 架构收敛、自定义组件工坊 v2 与仓库 CI 门禁。

主要变更

  1. 声明式自定义组件、格子工坊 v2 与 MCP 桥接

    • 声明式清单统一升级至纯平 schemaVersion: 1(root + elements + popovers + 语义图标),14 套官方精选模板覆盖全部 13 种语言,能力注册表扩展至 12 大能力域 / 37 项原子能力;交互型组件继续运行在受硬配额限制的 QuickJS 隔离沙箱(logic.js)内。
    • 新增 Studio AI v2 工作区引擎、增量补丁与双通/状态分支校验,以及 8 项 MCP/CLI 工具(含 deskbox_get_studio_context 上下文读取与暂存-预览确认提交机制);并将 CustomWidgets / Studio / Ai / AiMonitor 服务按领域目录分层收敛。
    • 模板中心升级为行级虚拟化 ItemsRepeater + v2__ 静态 PNG 缩略图缓存(单槽串行渲染即刻释放,修复前两张模板因亚克力合成导致的透明底采样问题,并规避 UniformGridLayout 滚轮回弹与右上角空位);停放/隐藏的自定义格子在工坊内点「放到桌面」/保存时自动解除隐藏并上屏,且保存后保持工坊打开。
  2. 单二进制多模式伴侣宿主、AotSmoke 迁出与原生/打包升级

    • 将独立设置宿主收回单一 DeskBox.exe(按 --settings / --studio / --mcp 启动短生命周期伴侣进程,通过当前用户鉴权命名管道通信),移除 src/DeskBox.Settings 工程与 EverythingSdk 第三方二进制。
    • 将 Native AOT Smoke Harness 从主工程迁出至 tests/DeskBox.AotSmoke/;拆分 Directory.Build.targets 与 src/Directory.Build.props,.NET SDK 对齐 10.0.404。
    • 升级 Rust 原生模块与 DeskBox.ThumbnailProxy(新增独立 media_session 代理工作模式),完善 Direct / Store Native AOT 打包与 PGO/mstat 分析脚本。
  3. 剪贴板、搜索、桌面整理、内置组件与核心稳健性

    • 剪贴板历史组件、Alt+V 全局快捷粘贴弹窗、离线图片 OCR、大载荷外置与 DPAPI 静态加密脱敏;全局搜索弹窗(计算器/命令面板/推荐区编辑模式与文件夹分组)并平稳退役独立搜索桌面组件;桌面整理预览与分流工作台升级。
    • 随手记独立小窗/行内输入与 Markdown 镜像、音乐同步歌词与频谱、一瞥与待办体验优化、格子组标签栏与拖拽体系完善(含提权会话拖出与 Windows 10 壳层拖拽兼容)、持久化/备份还原/多渠道共存迁移与启动稳健性加固、13 种语言本地化完整对齐。
  4. 仓库治理、双授权与 CI 门禁

    • 取消跟踪内部架构/需求/验收/审计文档与本地发布运维脚本并纳入 .gitignore,新增 .githooks/pre-commit 本地防泄漏拦截。
    • 扩展 .github/workflows/ci.yml:补齐内部文档防泄漏、AI 组件契约门禁、13 语本地化门禁、Rust 单元测试、直装版本一致性、锁定模式还原,以及 Store 渠道与 Native AOT Smoke Harness 编译验证。
    • 新增双轨授权声明 LICENSING.md(GPL-3.0-only + Commercial License),同步更新 README.md、README.zh-CN.md、CHANGELOG.md、CONTRIBUTING.md 与 SUPPORT.md。

本地门禁验证(推送前)

  • python -X utf8 scripts/check_ai_widget_contract.py:通过(8 MCP/CLI 工具、13 语言一致)
  • python -X utf8 scripts/check_ai_widget_localization.py:通过(13 语言、5342 key、重点前缀英文回退 0/310)
  • .\scripts\Test-DeskBoxDirectReleaseConsistency.ps1:通过(1.6.0 一致)
  • cargo test --manifest-path native/Cargo.toml --locked:86 / 86 通过(deskbox-native 56 + deskbox-thumbnail-proxy 28 + deskbox-audio-session-fixture 2)
  • dotnet restore .\DeskBox.sln --locked-mode -p:Platform=x64 -p:RuntimeIdentifier=win-x64:通过
  • dotnet build .\src\DeskBox\DeskBox.csproj --configuration Release --no-restore -p:Platform=x64 -p:RuntimeIdentifier=win-x64:0 警告 0 错误
  • Store 渠道编译门禁(DeskBoxDistribution=Store):0 警告 0 错误
  • Native AOT Smoke Harness 编译门禁(DeskBoxAotSmokeHarness=true):0 警告 0 错误
  • 提交归属检查与内部文档防泄漏检查(origin/main..HEAD / git ls-files):0 违规 / 0 泄漏

@Tianyu199509
Tianyu199509 force-pushed the feat/custom-widget branch 4 times, most recently from 135cf3a to 9e164d1 Compare November 10, 2026 11:19
- 自定义组件与格子工坊:新增原生 WinUI 3 声明式自定义组件引擎(零 WebView 开销)与 QuickJS 沙盒脚本引擎、26 项能力模块与内置模板、远程模板/提示词目录(catalog/widgets.v1.json & prompts.v1.json)、AI 对话精修流、.dbxwidget 导入导出、deskbox:// 深链及 --mcp / Agent 桥;工坊升级 Fluent 2 布局,支持「精选模板 / 我的格子」切换与多语言 i18n 架构
- 格子组导航重塑与切换收口:新增「等宽并列(EqualTabs)」模式(字高等高细分隔线、高亮主色、底部分隔线)与「并排显示(Tabs)」Win11 原生联通标签页(同心圆角、连通底边、溢出左右滚动箭头、Ctrl+滚轮平移、横排左右边缘光效、长按拖拽实时弹簧让位与滞后防抖、按当前材质/主题色半透渲染的拆出预览窗);修复冷启动首次切 Tab 渲染窗口未同步导致的图标空状态,并将加载占位简化为半透圆角矩形
- 剪贴板历史组件与快捷粘贴:新增独立剪贴板格子与快捷粘贴弹窗,支持文本/富文本/图片/文件/色值采集、本地 OCR、文本转换、置顶、应用排除规则、大文本外置存储与敏感凭据 DPAPI 静态加密,完成旧随手记剪贴板运行时退役与配置迁移
- 独立设置伴侣进程:新增 DeskBox.Settings 伴侣宿主工程,经鉴权命名管道承载设置 IPC 契约,关闭窗口即回收设置 UI 内存;修正显式架构构建下 BuildAndCopyDeskBoxSettings 的 Platform 属性透传与无头 CI 测试宿主 WinRT 静态激活守卫
- 核心组件与搜索增强:搜索弹窗升级命令面板、计算器/网页求值、文件详情预览与推荐区编辑;随手记新增独立置顶小窗、行内输入快捷键优化与本地 Markdown 镜像;音乐组件新增音频频谱可视化、LRCLIB 与本地多格式同步滚动歌词;一瞥组件新增多表盘样式与节假日/日程融合;待办新增自然语言日期解析與导出工作流
- 底座、拖拽与多语言收口:提权会话向外拖出自动切换指针跟踪拖拽与幽灵窗,完善跨源传输意图矩阵与撤销身份保护;新增桌面底层/普通窗口分层模式与阴影防闪;移除 H.NotifyIcon 与 EverythingSdk.dll 切换至原生自绘托盘与 IPC;同步 13 语言词条、NuGet 锁文件与 1.6.0 版本信息
…CI gates

- Remove tracked internal architecture/acceptance/requirements/press-kit/audit docs and local ops scripts from Git history while preserving them via .gitignore
- Add .githooks/pre-commit and CI leak/contract/localization/Rust/Store/AotSmoke gates
- Add LICENSING.md and update README, CHANGELOG, CONTRIBUTING, SUPPORT, and public docs for 1.6.0
…es, virtualized gallery, and MCP v2

- Migrate declarative manifests to pure flat schema v1 (root + elements + popovers + semantic icons) across all 14 official templates and 13 locales
- Expand capability registry to 12 domain packs / 37 atomic capabilities and refactor CustomWidgets, Studio, Ai, and AiMonitor services into dedicated domain folders
- Add Studio AI v2 workspace engine, incremental patch tools, 8-tool MCP/CLI bridge with deskbox_get_studio_context and stage-and-preview commit flow
- Upgrade Studio gallery to row-virtualized ItemsRepeater with v2 static PNG cache, opaque thumbnail surface rendering, and parked-widget auto-reveal on save
…and harden platform/native/tests

- Merge DeskBox.Settings back into single-binary DeskBox.exe (--settings / --studio / --mcp) and remove redundant companion project and Everything third-party binaries
- Relocate Native AOT smoke harnesses into tests/DeskBox.AotSmoke, add Directory.Build.targets & src/Directory.Build.props, and bump SDK to 10.0.404
- Upgrade Rust native & thumbnail proxy (including isolated media session worker) and Direct/Store packaging & PGO inspection scripts
- Harden persistence, cloud backup/restore, drag-drop, startup, localization (13 locales), and anti-mud/hygiene test contracts
@Tianyu199509 Tianyu199509 changed the title feat: 1.6.0 自定义组件与工坊 Fluent 2 升级、剪贴板组件、独立设置宿主与体验收口 feat: 1.6.0 自定义组件与工坊 v2、单二进制多模式伴侣宿主、剪贴板组件与架构/CI 门禁收口 Nov 20, 2026
Expand ShortcutFixture's temp root with GetLongPathNameW so Windows CI runners whose %TEMP% uses an 8.3 short path (e.g. RUNNER~1) match the canonical long path returned by IShellLinkW::GetPath.
…elease data root

- Restore -p:WindowsAppSdkBootstrapInitialize=false on the CI Test step so DeskBox.dll is compiled without MddBootstrapAutoInitializer (OnNoMatch_ShowUI modal hang on headless runners)
- Add internal DeskBoxDataPathService.TestRootOverride and wire it in TestEnvironment.Initialize so Release test runs isolate DeskBoxDataPathService.Current off %LOCALAPPDATA%\DeskBox without exposing env overrides in retail builds
…CRLF logicJs patch-mode comparison

PR #604 CI failed 4/7357 while all four passed locally; each traced to a
machine-environment assumption rather than a product regression:

- AiInbox end-to-end test left Language=System, so Chinese UI assertions
  followed the runner's en-US culture; pin zh-CN in the test settings.
- Studio turn parser re-derived LogicJsPatchMode by comparing the
  newline-normalized workspace script against the raw current script, so a
  CRLF baseline (CI checkout / Windows clipboard) misreported KeepExisting
  as Replace on script-less edit turns; normalize the baseline with the
  same StudioWorkspaceEngine.NormalizeNewlines and add a CRLF regression
  assertion.
- Progressive rematerialization test awaited without a dispatcher sync
  context, letting continuations resume on thread-pool threads and race
  slice callbacks mid-shrink (observed count 37 instead of 24); install
  DispatcherQueueSynchronizationContext on the dedicated queue.
- Drag-window end-to-end test asserted the SPI_GETDRAGFULLWINDOWS-gated
  HasDragWindow, which is off by default on CI server images; probe the
  shell drag window handle policy-independently and assert the policy gate
  stays consistent instead.

Full suite green locally: 7357/7357 (x64).
…ivation

Same family as 7d58f45: BuildWorkspaceTurnResult compared the workspace's
newline-normalized effectiveLogicJs against the raw originalLogicJs, so a CRLF
baseline (Windows clipboard / CRLF checkout) misreported KeepExisting as Replace
on UI-only edit turns, producing phantom script revisions. Normalize the
baseline with StudioWorkspaceEngine.NormalizeNewlines and pin it with a CRLF
regression test that also keeps real script edits on Replace.
… trailers

The attribution gate only grepped commit-message trailers on pull_request
events; forged-author commits (proven by external PR #644 passing Run #639)
and impersonated pushes sailed through. SHAs and the trigger user now flow
through env:, the check covers push and pull_request, the trigger account
must be the single repository owner, and every commit in range must carry
the single-identity author/committer email whitelist. New-ref pushes fall
back to checking the tip commit only.
…f process abort

deskbox_native.dll loads into DeskBox.exe, but the workspace-wide
panic="abort" turned any internal edge-case panic into instant host
termination. The workspace now unwinds and all eight status-returning FFI
exports run under a catch_unwind guard that degrades to
DESKBOX_NATIVE_STATUS_INTERNAL_ERROR (8); the out-of-process thumbnail
proxy keeps panic=abort via -C panic=abort in its build script, and the
AOT contract test pins the new split plus the guard.
…off validation

The loopback-proxy hop bypassed the direct client's SSRF-hardened connect
callback, and 198.18.0.0/15 DNS answers were allowed unconditionally. Blindly
blocking that range would cut off every Clash/mihomo TUN user (all public DNS
resolves into it), so the gate is topology-aware: literal 198.18.x.x hosts are
always rejected; DNS answers in the range are rejected unless a local TUN
adapter owns a fake-IP unicast address, in which case only the adapter's own
addresses and the 198.18.0.0/.0.1/.0.2 and 198.19.255.255 stack specials stay
blocked. The proxy hop now re-validates the target right before handoff via
ValidateTargetUriForProxyHandoffAsync, closing the resolver-answer TOCTOU.
…n-flight media whitelist, opt-in export

Four privacy/concurrency closures for the clipboard history:
- Content hashes and image filenames switch from raw SHA-256 to deterministic
  HMAC-SHA256 under a DPAPI-protected machine+user key (h1: prefix), so
  persisted digests can no longer confirm candidate secrets offline while
  dedup and self-write suppression keep working; legacy records migrate on
  load (text recompute, image file rename via the storage ops kernel).
- Background OCR text that matches the high-confidence-secret classifier now
  flips IsSensitive so at-rest DPAPI encryption actually applies to secret
  screenshots.
- Captured media registers in an in-flight whitelist until ingestion
  registers it, so concurrent orphan sweeps can no longer delete fresh
  screenshots into permanent broken entries.
- Manual backup export gains an "include clipboard history" option (default
  off, threaded through the IPC facade); on-device automatic snapshots keep
  including the clipboard so local recovery stays complete.
…gning, channel-scoped privilege expiry, frozen ratchet

Closes the three attack chains from the pre-merge review:

MCP commit chain: external Agent commits that overwrite an existing widget,
clear its data, or declare privileged capabilities now require approval in
DeskBox's own UI (native prompt, auto-deny after 60s, fail closed without a
UI dispatcher) — "confirm with the user" tool text is no longer treated as
consent, and deskbox_upsert_widget is annotated destructive. Staged bundles
use a three-state lease (begin/complete/abort) so a failed workspace write
stays retryable and concurrent replays are rejected instead of silently
lying success or creating duplicates.

Privilege expiry: an ExecutableSurfaceHash (normalized script + privileged
manifest nodes) is recorded on every workspace write. Studio saves extend
trust silently; Agent/OTA/import overwrites with a changed surface revoke
positive privileged overrides (LocalNetwork/LocalFileAccess/CommandExecution),
and command execution is never granted implicitly anymore — Official-origin
default trust included; first run prompts, the explicit override carries it.

Catalog supply chain: remote-catalog OTA entries must carry a contentSha256
plus an ECDSA P-256 signature verifiable against a built-in offline public
key before any automatic upgrade (the private key never enters the repo);
publish_widget_catalog.py signs entries via --private-key and fails closed on
unsigned executable entries. The anti-mud ratchet freezes legacy mega-file
baselines at their measured size (headroom 40 -> 3) with an explicit
v1.6.1-split debt tag.

Full suite green locally: 7368/7368 (x64).
… 1.6.0 trust boundaries

- Replace code-built AgentCommitApprovalWindow with native Fluent 2 XAML dialog (Deny default focus, DPI/work-area clamping, UI-thread shutdown, 13-locale copy)
- Strip machine-bound credential/permission files on untrusted backup restores and remove redundant local grantMac/DPAPI-anchor state; separate signed Official OTA vs Studio host write trust preservation
- Unify RFC 2544 (198.18.0.0/15) Fake-IP validation without vendor NIC-name heuristics so router gateways, system proxies, and TUN/TAP adapters all work
- Add portable plaintext clipboard backup export/rebase, fast 10-byte DPAPI media header short-circuit, and unvirtualized plain stream reads for non-clipboard media
- Distinguish additive vs unparseable future schemas in ResilientJsonStore and keep unknown WidgetKind values stateless per WidgetConfig instance
- Ensure MSIX/Store compatibility (package-safe update/relaunch guards, deskbox://startup quiet-exit parity, unconditional XAML loop lifeline, Win10 Segoe MDL2 glyph fallbacks, and Privacy Policy Settings link)
@Tianyu199509
Tianyu199509 marked this pull request as ready for review November 22, 2026 01:58
@Tianyu199509
Tianyu199509 merged commit cb4d252 into main Nov 22, 2026
1 check passed
@Tianyu199509
Tianyu199509 deleted the feat/custom-widget branch November 22, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant