Skip to content

feat: add macOS Desktop portable build (D0-Mac) - #59

Merged
pppolf merged 7 commits into
CWNU-Open-Source-Community:mainfrom
pppolf:feat/macos-desktop-build
Aug 14, 2026
Merged

pppolf merged 7 commits into
CWNU-Open-Source-Community:mainfrom
pppolf:feat/macos-desktop-build

Conversation

@pppolf

@pppolf pppolf commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • 为 Desktop 增加 macOS 便携构建(D0-Mac):cmd/cyberagent-desktop 按构建标签拆分为共享 desktop 壳与 Windows/darwin 平台实现。macOS 使用系统自带 WKWebView(无 WebView2 式预检)、有界严格转义的 osascript 启动失败对话框;工作区启动器只通过固定 /usr/bin/open 打开已验证的 .app(Finder、Terminal、Antigravity、PyCharm、WebStorm、Visual Studio Code)。Windows 专属的 Credential Manager、ConPTY 用户终端、Safe Web/WFP、受控宿主执行在 macOS 保持失败关闭,未放宽任何权限边界。
  • scripts/build-desktop-darwin.sh 产出 ad-hoc 签名、未公证的 build/desktop/Prayu.app,含与 Windows 端一致的连续双构建 SHA-256 可复现校验;scripts/check-macos-compat.sh 校验 Mach-O/架构/codesign/部署目标/元数据与 operator-preview 包边界,release_ready=false 直到签名、公证与人工 macOS 矩阵完成。
  • 修复 macOS 渲染器来源校验:Wails 在 macOS 使用自定义 wails:// scheme(请求 Host 为 wails),进程内 API 网关现在按平台固定受信 Host(Windows 保持 wails.localhost),并加平台隔离守卫测试。
  • 部署目标统一钉到 Go 1.25 的 macOS 11 最低版本(CGO 编译/链接 flags 与 LSMinimumSystemVersion 对齐),消除 macOS 26 SDK 下 "built for newer macOS version" 告警刷屏。
  • 前端检查固定在 Node.js 24 基线:本地 Node 版本不符时构建脚本会在构建前明确报错(与 CI/README 一致)。
  • CI 新增 desktop-macos 任务(macos-latest,可复现构建 + 产物上传);Windows 任务与 wv2runtime.error 边界保持不变。边界见 ADR 0097(上游已占用 0096 编号,合并时已重编号)。
  • 已合并上游 main(Docker 生命周期所有权切片 / schema v97),冲突已解决。

Validation

  • go test -tags "desktop" -count=1 ./cmd/cyberagent-desktop ./internal/desktop ./internal/webui
  • go build ./...、go vet ./...(含合并上游 v97 后的验证)
  • Node 24 下完整 ./scripts/build-desktop-darwin.sh -VerifyReproducible:npm ci / check:api / 225 项前端测试 / Vite / Go 测试 / 连续双构建 SHA-256 一致 / codesign / 兼容检查全绿
  • macOS 实机烟测:应用启动、隔离数据目录创建、渲染器资源与 API 请求全部放行(临时插桩验证 0 拒绝后已移除)、优雅退出
  • Windows 侧无法在 macOS 本机编译,由 CI 的 Windows Desktop 任务验证共享代码拆分

Audit

  • 无凭证或本地数据入库
  • Policy、Workspace、Sandbox 与持久化边界复核:仅新增 darwin 平台实现,共享逻辑逐行搬迁,Windows 行为不变
  • README.md、项目记忆账本与 ADR 0097 已更新

pppolf added 7 commits August 14, 2026 12:16
Split cmd/cyberagent-desktop by build tag: shared shell code under desktop,
Windows WebView2/Acrylic/registry launcher code under windows, and a new
darwin port. macOS uses bundled WKWebView with no runtime prerequisite probe,
reports startup failures through a bounded strictly escaped osascript dialog,
and launches workspace launchers only through the fixed /usr/bin/open with a
validated .app set. Windows-only seams (Credential Manager, ConPTY terminal,
Safe Web/WFP, controlled host execution) keep failing closed on macOS.

scripts/build-desktop-darwin.sh emits an ad-hoc-signed, un-notarized
build/desktop/Prayu.app with the same consecutive-build SHA-256
reproducibility check, and scripts/check-macos-compat.sh verifies Mach-O,
code signature, metadata, and operator-preview package boundaries. The
renderer reserves the native traffic-light space in the macOS titlebar.
Add a desktop-macos job that builds the embedded renderer, runs the
desktop-tagged boundary tests, builds the portable .app with the
reproducibility check, and uploads the bundle with its release metadata
and compatibility report.
Add ADR 0096 and update the Desktop plan, project memory/status ledgers, and
READMEs to document the darwin build-tag port, the open-based workspace
launcher, the ad-hoc-signed portable .app, and the failing-closed Windows-only
seams on macOS.
The frontend test environment is pinned to the Node.js 24 baseline used by
CI and documented in the README. Newer local Node versions (for example
v26) break the jsdom test environment, so the darwin build script now fails
fast before the frontend checks with an actionable nvm/-SkipFrontend
message instead of dumping unrelated test failures.

The reproducibility comparison also keeps the second binary next to the
first and reports both hashes when consecutive builds differ, so release
diagnostics no longer discard the only evidence.
The Wails AssetServer serves the macOS renderer from the custom wails://
scheme whose request.Host is wails, not the Windows wails.localhost host.
The shared origin gate rejected every macOS renderer request as Forbidden,
leaving a white window, so the trusted host is now pinned per platform:
wails.localhost on Windows and wails on macOS, still guarded by the
wails.io User-Agent token and the empty server-form URL authority.
Platform divergence guard tests lock each host to its own OS.
The macOS 26 SDK compiled the cgo objects at deployment target 26.0 while
the external linker targeted 11.0, flooding every build with
'built for newer macOS version' warnings. The darwin build script now pins
CGO_CFLAGS and CGO_LDFLAGS to -mmacosx-version-min=11.0, the bundle declares
LSMinimumSystemVersion 11.0.0, and the compatibility checklist verifies the
Mach-O deployment target matches the Go 1.25 macOS 11 minimum.
…build

# Conflicts:
#	docs/PROJECT_MEMORY.md
#	docs/PROJECT_STATUS.md
@pppolf
pppolf merged commit fd18a47 into CWNU-Open-Source-Community:main Aug 14, 2026
5 checks passed
@pppolf
pppolf deleted the feat/macos-desktop-build branch August 14, 2026 06:38
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