Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d434130785 | ||
|
|
6f4eb56e0e | ||
|
|
b74794c55c | ||
|
|
ebc2e9a64d | ||
|
|
61d0976463 | ||
|
|
096b804e5e | ||
|
|
e1401adbba | ||
|
|
fafb49a633 | ||
|
|
c090cc786e | ||
|
|
fdb9a3b9ed | ||
|
|
217e37ec6f | ||
|
|
2587c46b4a | ||
|
|
daf3d50ac1 | ||
|
|
822332b74d | ||
|
|
9ccb6b38e6 |
No files matched your search
@@ -55,3 +55,11 @@ native/system/test/bin/
|
||||
|
||||
# Local CI output
|
||||
/.ci/
|
||||
|
||||
# Tauri desktop build outputs (the prebuilt tree is a release artifact)
|
||||
/src-tauri/target/
|
||||
/src-tauri/resources/
|
||||
/src-tauri/gen/
|
||||
|
||||
# Local Cargo/CI working data (never committed)
|
||||
/.build/
|
||||
@@ -24,6 +24,7 @@ steps:
|
||||
depends_on: [install]
|
||||
environment:
|
||||
CI: "true"
|
||||
DSH_CLIENT_TITLE: "Marqdo Harness"
|
||||
commands:
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@11.28.5 --activate
|
||||
@@ -38,18 +39,3 @@ steps:
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@11.28.5 --activate
|
||||
- MQDH_TEST_INSTALL=1 MARQDO_CI_OUT=.ci bash scripts/ci.sh
|
||||
|
||||
package:
|
||||
image: node:24.22.3-bookworm
|
||||
depends_on: [test]
|
||||
when:
|
||||
- event: tag
|
||||
environment:
|
||||
MQDH_BUNDLE_NODE: "1"
|
||||
MQDH_PACKAGE_WORK: /tmp/mqdh-package-work
|
||||
commands:
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@11.28.5 --activate
|
||||
- MARQDO_CI_OUT=.ci bash scripts/package.sh
|
||||
- cat .ci/package-evidence.json
|
||||
- cat .ci/mqdh-release.json
|
||||
@@ -0,0 +1,58 @@
|
||||
# MQDH Tauri Linux installer lane.
|
||||
#
|
||||
# One frozen source SHA produces the portable archive (existing cold-install
|
||||
# contract) plus the Linux `.deb` installer from the same tree. The `.deb` is
|
||||
# the user-facing artifact; the archive stays an advanced/diagnostic asset.
|
||||
#
|
||||
# Windows and macOS are separate workflows with native-agent labels. They are
|
||||
# not simulated on this Linux agent: without a matching agent those jobs stay
|
||||
# BLOCKED. A Linux-only beta may be published explicitly as a scoped release;
|
||||
# it never claims three-platform completion.
|
||||
when:
|
||||
- event: [push, pull_request, manual, tag]
|
||||
|
||||
steps:
|
||||
install:
|
||||
image: node:24.22.3-bookworm
|
||||
environment:
|
||||
CI: "true"
|
||||
commands:
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@11.28.5 --activate
|
||||
- pnpm install --frozen-lockfile
|
||||
|
||||
build:
|
||||
image: node:24.22.3-bookworm
|
||||
depends_on: [install]
|
||||
environment:
|
||||
CI: "true"
|
||||
commands:
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@11.28.5 --activate
|
||||
- pnpm run build
|
||||
|
||||
installer:
|
||||
image: git.cflmy.cn/cflmy/mqdh-tauri-build:0.2.0
|
||||
depends_on: [build]
|
||||
environment:
|
||||
CI: "true"
|
||||
MARQDO_CI_OUT: .ci
|
||||
MQDH_PACKAGE_WORK: /tmp/mqdh-package-work
|
||||
commands:
|
||||
- bash scripts/tauri/build-linux.sh
|
||||
- cat .ci/mqdh-release.json
|
||||
- cat .ci/release-evidence.json
|
||||
|
||||
publish:
|
||||
image: node:24.22.3-bookworm
|
||||
depends_on: [installer]
|
||||
when:
|
||||
- event: tag
|
||||
environment:
|
||||
MQDH_GITEA_TOKEN:
|
||||
from_secret: gitea_token
|
||||
CI: "true"
|
||||
commands:
|
||||
- version="${CI_COMMIT_TAG#mqdh-v}"
|
||||
- test "$version" != "$CI_COMMIT_TAG"
|
||||
- node scripts/release.ts --version "$version" --source "$CI_COMMIT_SHA" --assets .ci --publish
|
||||
@@ -0,0 +1,22 @@
|
||||
# MQDH Tauri macOS DMG lane (BLOCKED until a native macOS agent exists).
|
||||
#
|
||||
# Signing/notarization requires an Apple Developer ID in protected secrets.
|
||||
# Without the agent and credentials this workflow is not run and no artifact is
|
||||
# claimed; Linux cross-compilation is never presented as macOS acceptance.
|
||||
when:
|
||||
- event: manual
|
||||
|
||||
labels:
|
||||
platform: macos
|
||||
|
||||
steps:
|
||||
build:
|
||||
image: ghcr.io/cirruslabs/macos-runner:sonoma
|
||||
commands:
|
||||
- bash scripts/tauri/build-macos.sh
|
||||
|
||||
evidence:
|
||||
image: ghcr.io/cirruslabs/macos-runner:sonoma
|
||||
depends_on: [build]
|
||||
commands:
|
||||
- cat .ci/release-evidence.json
|
||||
@@ -0,0 +1,23 @@
|
||||
# MQDH Tauri Windows NSIS lane (BLOCKED until a native Windows agent exists).
|
||||
#
|
||||
# The step is labelled so Woodpecker only schedules it on an agent that declares
|
||||
# `platform=windows`. Without that agent the pipeline does not run this workflow
|
||||
# and no Windows installer is produced or claimed. Native build/install smoke
|
||||
# must happen on real Windows; Wine or cross-builds are not acceptance.
|
||||
when:
|
||||
- event: manual
|
||||
|
||||
labels:
|
||||
platform: windows
|
||||
|
||||
steps:
|
||||
build:
|
||||
image: mcr.microsoft.com/windows/servercore:ltsc2022
|
||||
commands:
|
||||
- pwsh -NoProfile -File scripts/tauri/build-windows.ps1
|
||||
|
||||
evidence:
|
||||
image: mcr.microsoft.com/windows/servercore:ltsc2022
|
||||
depends_on: [build]
|
||||
commands:
|
||||
- pwsh -NoProfile -Command "Get-Content .ci/release-evidence.json"
|
||||
@@ -1,18 +1,22 @@
|
||||
# 应用发行、安装与更新
|
||||
|
||||
> **2026-12-03 更新(#31)**:桌面安装形态改为 **Tauri 2**,主产物为 Linux `.deb`、
|
||||
> Windows NSIS `.exe`、macOS `.dmg`;portable `.tar.gz` 保留为高级/诊断资产。
|
||||
> 桌面壳、生命周期、安全与三平台状态以 [TAURI.md](TAURI.md) 为唯一现行规范;
|
||||
> 本文的发行清单、更新与数据边界继续有效。
|
||||
|
||||
MQDH 是**默认对外发行**的单用户应用:用户下载安装包,在自己的电脑上安装,不依赖 Rust、Node、pnpm 或源码 checkout。应用安装与 `MQDH_HOME`(会话、私人知识、运行证据、Marqdo 运行时)严格分离。
|
||||
|
||||
## 1. 平台矩阵
|
||||
|
||||
| 平台 | 首版 | 状态 |
|
||||
| --- | --- | --- |
|
||||
| Linux x86_64 glibc ≥ 2.39 | `.tar.gz`(内置 Node 运行时 + 用户级 `install.sh`) | 已发布公共 Beta `0.1.0-beta.1`(2026-12-02,未签名) |
|
||||
| Windows x86_64 | `.tar.gz`(内置 Node 运行时 + 用户级 `install.ps1` + `mqdh.cmd`) | 实验性:已构建并冷安装验证;未签名、无原生 CI lane,应用内更新未验证 |
|
||||
| Linux aarch64 | 未发布 | `UNVERIFIED`;不生成同名制品 |
|
||||
| macOS arm64/x64 | 未发布 | `UNVERIFIED`;没有签名/公证证书 |
|
||||
| Windows arm64 | 未发布 | `UNVERIFIED` |
|
||||
| 平台 | 主安装产物 | 高级/诊断资产 | 状态 |
|
||||
| --- | --- | --- | --- |
|
||||
| Linux x86_64 glibc ≥ 2.39 | `.deb`(Tauri,内置 Node 运行时,用户级安装) | `marqdo-harness-<v>-x86_64-unknown-linux-gnu.tar.gz` | 可构建;真实安装验收按发行记录 |
|
||||
| Linux aarch64 | 未发布 | — | `UNVERIFIED`;不生成同名制品 |
|
||||
| Windows x64 | NSIS `-setup.exe`(Tauri,currentUser) | 不再以 portable ZIP 作为官方路径 | **BLOCKED**:无原生 Windows agent |
|
||||
| macOS arm64 | `.dmg`(Tauri) | — | **BLOCKED**:无原生 macOS agent 与签名/公证凭据 |
|
||||
|
||||
`detectPlatform` 对未发布目标返回 `supported=false` 与具体原因;更新检查在下载前按 manifest 的 target/min_glibc/Node/CLI 兼容范围拒绝。应用不继承 DSH 桌面或官方发布声明。
|
||||
`detectPlatform` 对未发布目标返回 `supported=false` 与具体原因;更新检查在下载前按 manifest 的 target/min_glibc/Node/CLI 兼容范围拒绝。应用不继承 DSH 桌面或官方发布声明。三平台主产物、安装器验收与安全边界见 [TAURI.md](TAURI.md)。
|
||||
|
||||
当前公共 Beta 发行身份(唯一来源是 Gitea Release):
|
||||
|
||||
@@ -41,7 +45,7 @@ MQDH_HOME/ # 用户数据,卸载默认保留
|
||||
|
||||
`mqdh` wrapper 优先使用安装树内的 `runtime/node`,否则要求系统 Node ≥ 24;应用包因此不要求用户预装 Node。`SOURCE_SHA` 与 `packages/marqdo/harness/package.json` 固定应用身份。
|
||||
|
||||
### Windows x86_64(实验性)
|
||||
### Windows x86_64 portable(历史实验,非官方安装路径)
|
||||
|
||||
```text
|
||||
%LOCALAPPDATA%\MQDH\ # 默认安装前缀(-Prefix 可改)
|
||||
@@ -127,9 +131,9 @@ mqdh update rollback --confirm [--json]
|
||||
```sh
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build # 10/10 gates
|
||||
MQDH_PACKAGE_WORK=/path bash scripts/package.sh
|
||||
# .ci/: 归档、.sha256、mqdh-release.json、release-evidence.json、package-evidence.json
|
||||
MQDH_GITEA_TOKEN=... node scripts/release.ts --version 0.1.0 \
|
||||
bash scripts/tauri/build-linux.sh # deb + portable 归档 + 冷 smoke + 安装器证据
|
||||
# .ci/: deb、归档、.sha256、mqdh-release.json(含 installers)、release-evidence.json、package-evidence.json
|
||||
MQDH_GITEA_TOKEN=... node scripts/release.ts --version 0.2.0-beta.1 \
|
||||
--source "$(git rev-parse HEAD)" --assets .ci # dry-run
|
||||
MQDH_GITEA_TOKEN=... node scripts/release.ts ... --publish # 不可变发布
|
||||
```
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
| [NETWORK.md](NETWORK.md) | 默认出口、代理/镜像/离线、审计与拒绝码 |
|
||||
| [BOOTSTRAP.md](BOOTSTRAP.md) | 首次启动状态机、`doctor`/`repair`、离线与失败处理 |
|
||||
| [DIAGNOSTICS.md](DIAGNOSTICS.md) | 本地脱敏报告、去重/限额与显式 Issue 提交 |
|
||||
| [TAURI.md](TAURI.md) | 桌面壳、后端生命周期、安全边界、三平台安装器与 BLOCKED 状态(唯一现行桌面规范) |
|
||||
| [DISTRIBUTION.md](DISTRIBUTION.md) | 平台矩阵、安装布局、发行清单、更新/回退 |
|
||||
| [RELEASING.md](RELEASING.md) | 构建、签名、发布与发布后验证 |
|
||||
| [STATUS.md](STATUS.md) | 唯一现状与门禁矩阵(PASS/PARTIAL/UNVERIFIED) |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 发布流程
|
||||
|
||||
发布工具:`scripts/package.sh`(构建 + 冷安装验证)、`scripts/release-manifest.ts`(清单/签名/证据)、`scripts/release.ts`(Gitea 发布,默认 dry-run)。凭据只来自环境,不写入仓库、日志或制品。
|
||||
发布工具:`scripts/tauri/build-linux.sh`(Tauri deb + portable 归档 + 冷 smoke)、`scripts/package.sh`(portable 构建 + 冷安装验证)、`scripts/release-manifest.ts`(清单/签名/证据)、`scripts/tauri/attach-installers.mjs`(安装器摘要)、`scripts/release.ts`(Gitea 发布,默认 dry-run)。凭据只来自环境,不写入仓库、日志或制品。桌面安装合同见 [TAURI.md](TAURI.md)。
|
||||
|
||||
## 1. 发布前
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
```sh
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
MQDH_PACKAGE_WORK=/var/tmp/mqdh-package bash scripts/package.sh
|
||||
DSH_CLIENT_TITLE="Marqdo Harness" pnpm run build
|
||||
bash scripts/tauri/build-linux.sh
|
||||
```
|
||||
|
||||
输出 `.ci/`:
|
||||
@@ -35,6 +35,7 @@ MQDH_PACKAGE_WORK=/var/tmp/mqdh-package bash scripts/package.sh
|
||||
|
||||
```powershell
|
||||
pnpm install --frozen-lockfile --ignore-scripts
|
||||
$env:DSH_CLIENT_TITLE = "Marqdo Harness"
|
||||
pnpm run build
|
||||
$env:MQDH_NODE24_DIR = 'C:\path\to\node24'
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\package-windows.ps1 -RuntimeDeps C:\path\to\runtime-deps
|
||||
|
||||
@@ -21,7 +21,7 @@ sha256 `68cbb8f878af47a44a8e0ff7625b647ff4b8ac5817cda02e0a31fdc658fdcd7d`,
|
||||
| R04 独立 clone 构建 | PASS | 对 `origin/main` 做 depth-1 独立 clone:`pnpm install --frozen-lockfile` 后 `pnpm run build` 10/10 gates PASS(235.73s),无父仓/兄弟源码。 |
|
||||
| R05 上游基线 + 下游测试 | PASS | 上游 `pnpm run build` 10/10 gates PASS;下游 28 项测试 PASS(1 项网络安装测试由 `MQDH_TEST_INSTALL=1` 单独通过)。 |
|
||||
| R06 上游同步演练 | UNVERIFIED | 当前镜像 HEAD 等于基线,没有更新的上游提交;`scripts/upstream.sh candidate` 已实现,未执行真实合并。 |
|
||||
| R07 发布路径分离 | PASS | 删除上游发布/上传/桌面打包工作流;下游包名、命令、发行地址独立;仓库内无官方凭证。 |
|
||||
| R07 发布路径分离 | PASS | 删除上游发布/上传/桌面打包工作流;下游包名、命令、发行地址独立;仓库内无官方凭证。2026-12-03 起 Tauri 2 为唯一桌面封装(`docs/mqdh/TAURI.md`)。 |
|
||||
| R08 无 Marqdo 生产源码副本 | PASS | 仓库只含应用代码;CLI/Bundle/Tool 由运行时安装;测试使用发布资产或自写 fixture。 |
|
||||
|
||||
## 安装与更新(E)
|
||||
@@ -118,9 +118,9 @@ sha256 `68cbb8f878af47a44a8e0ff7625b647ff4b8ac5817cda02e0a31fdc658fdcd7d`,
|
||||
|
||||
| 门禁 | 状态 | 证据或限制 |
|
||||
| --- | --- | --- |
|
||||
| DIST-01 清单 schema、命名、tag/证据、Linux tar 冷安装 | PASS(已发布) | `mqdh-v0.1.0-beta.1`:`mqdh-release.json` + `.sha256` + `release-evidence.json`(含 `cli@63562d8…` 运行时依赖);归档 786,741,787 B / sha256 `68cbb8f8…`;冷安装/`doctor`/`dump-config` 通过;未签名。 |
|
||||
| DIST-02 Linux `.deb`/AppImage、用户级安装/卸载 | PARTIAL | 用户级 `install.sh`/`--uninstall` 已实现并测试;`.deb`/AppImage 未构建。 |
|
||||
| DIST-03 macOS/Windows 构建与冷安装 | PARTIAL | Windows x86_64 已提供正式便携 ZIP(`MQDH-<version>-win-x64.zip`:解压双击 `MQDH.exe`,无终端/安装脚本;冷解压 + 工作台 HTTP + 离线 bootstrap 已验证);未签名、无原生 Windows CI lane、应用内更新未验证;EXE 安装器/桌面集成/前端品牌化见 `#25`;macOS 无签名/公证证书,`UNVERIFIED`。 |
|
||||
| DIST-01 清单 schema、命名、tag/证据、Linux tar 冷安装 | PASS(已发布) | `mqdh-v0.1.0-beta.1`:`mqdh-release.json` + `.sha256` + `release-evidence.json`(含 `cli@63562d8…` 运行时依赖);归档 786,741,787 B / sha256 `68cbb8f8…`;冷安装/`doctor`/`dump-config` 通过;未签名。0.2.0-beta.1 起安装器摘要追加到同一清单。 |
|
||||
| DIST-02 Linux `.deb` 安装器 | PARTIAL | Tauri `.deb` 构建与解包 smoke 已实现(`scripts/tauri/build-linux.sh`);真实桌面安装/卸载与系统菜单验收以发行记录为准,AppImage 不在本期范围。 |
|
||||
| DIST-03 macOS/Windows 构建与冷安装 | BLOCKED | 官方安装路径为 Tauri NSIS `.exe` / `.dmg`;无原生 Windows/macOS agent 与签名/公证凭据,`.woodpecker/tauri-windows.yml`、`tauri-macos.yml` 已就绪但不会在 Linux agent 上伪造运行。此前的 Windows portable ZIP 属历史实验证据,不是官方安装路径。 |
|
||||
| DIST-04 签名、SBOM、代理/镜像、离线安装 | PARTIAL | Ed25519 清单签名/验证与测试密钥通过;官方密钥、SBOM、离线应用更新未运行。 |
|
||||
| DIST-05 更新检查/安装/回退、通知与对账 | PARTIAL | `update check` 对真实 Release 可用;`install/rollback` 仍只用本地发布服务器完成真实切换与回退;自动下载/安装按政策关闭,通知/对账未实现。 |
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
# MQDH 桌面壳(Tauri 2)现行合同
|
||||
|
||||
> 状态:2026-12-03 起生效。本文是 MQDH 桌面封装与安装包的**唯一现行规范**,
|
||||
> 依据 [marqdo-app-harness#31](https://git.cflmy.cn/cflmy/marqdo-app-harness/issues/31)。
|
||||
> 它取代此前“恢复 Electron 独立桌面发行”的路线;此前发布的 portable 归档与
|
||||
> Windows 实验发行保留为历史事实,不再是官方桌面安装路径。
|
||||
|
||||
## 1. 一个工作台、一个产品
|
||||
|
||||
```
|
||||
系统安装器 (deb / NSIS / DMG)
|
||||
└─ Tauri 2 壳(仅窗口、启动、退出、受限导航)
|
||||
└─ 既有 /mqdh 工作台(同一 React/Web UI,不复制页面)
|
||||
└─ 受控 loopback Harness 服务(既有 Node 后端,不重写业务)
|
||||
└─ 独立发行的 CLI / Worker / Bundle / Tool / Ext
|
||||
```
|
||||
|
||||
- 工作台、路由、业务状态、主题、生态中心继续由现有 `/mqdh` 实现。
|
||||
- Tauri 壳不实现业务 API、不实现第二套更新器、不做第二个前端。
|
||||
- Marqdo 运行时仍由 Bootstrap/生态中心按既有发行合同独立安装和升级。
|
||||
- 浏览器入口与桌面入口共用同一工作台;浏览器入口保留为开发、自部署和诊断路径。
|
||||
|
||||
## 2. 源码位置与唯一版本
|
||||
|
||||
| 路径 | 责任 |
|
||||
| --- | --- |
|
||||
| `src-tauri/` | Tauri 壳:窗口、后端进程生命周期、受限导航、单实例、日志 |
|
||||
| `src-tauri/tauri.conf.json` | 产品名、bundle identifier、权限、各平台安装器配置 |
|
||||
| `src-tauri/capabilities/` | 最小 capability(只启用 `core:default`,无 shell/fs/http/process 权限) |
|
||||
| `scripts/tauri/` | 资源准备、Linux/Windows/macOS 构建、安装器证据附加 |
|
||||
| `.woodpecker/tauri-linux.yml` | Linux deb 构建与受保护发布 |
|
||||
| `.woodpecker/tauri-windows.yml` / `tauri-macos.yml` | 原生 Windows/macOS lane(需要对应 label 的 agent) |
|
||||
|
||||
产品版本只存在于 `packages/marqdo/harness/package.json`。构建脚本读取该值并通过
|
||||
`tauri build --config '{"version":"..."}'` 传给打包器;壳的 `--version` 由
|
||||
`build.rs` 从同一文件嵌入。**不得**在 `tauri.conf.json` 手工维护第二份版本。
|
||||
|
||||
## 3. 后端生命周期
|
||||
|
||||
```text
|
||||
桌面启动 → 读取 MQDH_HOME → 定位安装资源树与 runtime/node
|
||||
→ 以子进程启动 scripts/mqdh.mjs --host 127.0.0.1 --port 0 --no-open
|
||||
→ 读取既有服务打印的就绪 URL(含一次性 token)
|
||||
→ 窗口加载 http://127.0.0.1:<port>/...
|
||||
退出 → 向本实例拥有的进程组发送 SIGTERM(Windows 用 taskkill /T)
|
||||
→ 超时后 SIGKILL;不触碰用户独立运行的服务或其它实例
|
||||
```
|
||||
|
||||
- 只绑定 loopback,端口由 OS 分配;就绪不是“端口可连接”,而是既有服务自己打印的
|
||||
带 token URL 出现。
|
||||
- 就绪超时 120 秒;失败显示可恢复提示并写入 `MQDH_HOME/logs/mqdh-desktop.log`
|
||||
(token 在写日志前脱敏)。
|
||||
- 单实例由 `tauri-plugin-single-instance` 保证;第二次启动聚焦并复用已有窗口。
|
||||
- 默认不常驻后台;关闭窗口即退出本实例拥有的后端进程树。
|
||||
|
||||
## 4. 安全边界
|
||||
|
||||
- capability 只有 `core:default`;WebView 没有通用 shell、任意文件、任意进程或
|
||||
sidecar 参数能力。
|
||||
- 导航只允许 Tauri 本地页和**本实例实际监听**的 `127.0.0.1:<port>`;其它 URL 交给
|
||||
系统浏览器打开,不在应用内加载。
|
||||
- 本地服务沿用既有 `/mqdh` 的 token、Origin/Host 与 CSRF 防护;壳不放松这些检查。
|
||||
- 文稿 HTML/SVG 仍由 View 的只读安全模型渲染;桌面壳不把主动内容当可信代码。
|
||||
- 模型凭据、私有知识、会话数据继续由现有 `MQDH_HOME` 策略保护,不进入安装资源、
|
||||
CI 归档或日志。
|
||||
|
||||
## 5. 数据目录与迁移
|
||||
|
||||
- 安装目录(只读应用资源)与 `MQDH_HOME`(用户数据)严格分离。
|
||||
- 壳使用与 CLI/portable 启动器**完全相同**的 `MQDH_HOME` 解析顺序:
|
||||
`MQDH_HOME` 环境变量 → `XDG_DATA_HOME/marqdo-harness` → `~/.local/share/marqdo-harness`。
|
||||
用户从浏览器/portable 路径迁移到桌面安装后,不需要搬动知识、配置或运行时。
|
||||
- 覆盖安装、失败安装、卸载默认保留 `MQDH_HOME`;显式清理数据必须另行确认。
|
||||
|
||||
## 6. 平台与产物
|
||||
|
||||
| 系统 | 目标 | 主产物 | 状态 |
|
||||
| --- | --- | --- | --- |
|
||||
| Linux x86_64 | `x86_64-unknown-linux-gnu` | `.deb`(`mqdh-<version>-linux-x86_64.deb`) | 当前可构建;真实安装验收按发布记录 |
|
||||
| Windows x86_64 | `x86_64-pc-windows-msvc` | NSIS `-setup.exe` | **BLOCKED**:无原生 Windows agent,未产出、未验收 |
|
||||
| macOS Apple Silicon | `aarch64-apple-darwin` | `.dmg` | **BLOCKED**:无原生 macOS agent 与签名/公证凭据 |
|
||||
|
||||
三平台齐全才是一次完整 Epic 发行;在缺少原生 agent 时,允许维护者明确批准的
|
||||
范围化 Linux Beta 发行,但必须在发行说明和根投影中如实标注缺失平台,不得把
|
||||
Linux 包装成三平台完成。Windows/macOS 不接受 Wine、交叉编译或模拟窗口作为验收。
|
||||
|
||||
## 7. 构建与发布
|
||||
|
||||
```sh
|
||||
# CI(Woodpecker)或等价构建机
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
bash scripts/tauri/build-linux.sh # 便携归档 + deb + smoke + 证据附加
|
||||
node scripts/release.ts --version <v> --source "$(git rev-parse HEAD)" --assets .ci --publish
|
||||
```
|
||||
|
||||
- 安装器构建镜像:`git.cflmy.cn/cflmy/mqdh-tauri-build:0.2.0`(Node 24.22.3 +
|
||||
Rust 1.100 + WebKitGTK 4.1 + Tauri CLI 2.13.0);由 `scripts/tauri/build-image.sh` 构建/发布。
|
||||
- `build-linux.sh` 从**同一冻结 SHA** 构建,deb 与 portable 归档来自同一生产树;
|
||||
对最终 deb 字节执行解包、`--version` 与 `--smoke`(真实启动内置后端并等待就绪)。
|
||||
- `attach-installers.mjs` 把安装器摘要追加到现有 `mqdh-release.json` /
|
||||
`release-evidence.json` 的 `installers` 字段;不新建第二套清单。
|
||||
- 发布只上传同一 SHA 的 CI 产物;安装包与归档不可变,不覆盖已有 tag/资产。
|
||||
|
||||
## 8. 更新策略
|
||||
|
||||
- 复用现有更新检查:启动后异步检查、期间低频检查、手动检查。
|
||||
- Tauri 壳**不启用**静默 updater;只展示真实候选、目标平台、渠道、说明与官方下载。
|
||||
- 用户确认后下载官方安装包并用系统安装器覆盖安装;不自动下载、不自动安装、不强制重启。
|
||||
- 应用更新与 CLI/Bundle/Tool 更新保持独立事务。
|
||||
|
||||
## 9. 明确未完成(不得写成 PASS)
|
||||
|
||||
- Windows NSIS 与 macOS DMG:无原生 agent,BLOCKED。
|
||||
- 安装器代码签名、Apple 公证:无凭据,unsigned;发行说明必须披露。
|
||||
- 第二次真实发行 A→B 的更新提醒闭环:待第二次真实发行验证。
|
||||
- 真实模型能力验收沿用 `STATUS.md` 的独立门禁。
|
||||
@@ -0,0 +1,38 @@
|
||||
# ADR 0001:以 Tauri 2 作为 MQDH 唯一桌面封装
|
||||
|
||||
- 状态:Accepted(2026-12-03)
|
||||
- 决策来源:[marqdo-app-harness#31](https://git.cflmy.cn/cflmy/marqdo-app-harness/issues/31),维护者批准
|
||||
- 取代:此前恢复 Electron 独立桌面发行的要求(`apps/desktop` 上游壳不参与 MQDH 产品发行)
|
||||
|
||||
## 背景
|
||||
|
||||
MQDH 已有唯一 `/mqdh` 工作台和受控本地 Harness 服务,但普通用户仍只能通过
|
||||
portable 归档、脚本或浏览器启动。此前方案尝试复用上游 Electron 壳并恢复其发行链路,
|
||||
会形成第二套桌面产品工程,且与“一个工作台、一个产品版本、一套业务实现”的产品决策冲突。
|
||||
|
||||
## 决策
|
||||
|
||||
1. 使用 **Tauri 2** 作为唯一官方桌面封装,壳内只做窗口、启动/停止后端、受限导航、
|
||||
单实例、日志与系统安装封装。
|
||||
2. 不复制 `/mqdh` 页面、不重写业务 API、不把 Harness 改成 Rust。
|
||||
3. 后端复用既有 Node 生产树:安装包携带预构建树与匹配平台的 Node runtime,
|
||||
启动 `scripts/mqdh.mjs` 的既有服务。
|
||||
4. 三平台主产物为 Linux `.deb`、Windows NSIS `.exe`、macOS `.dmg`;三平台由
|
||||
Woodpecker 同一候选并行构建,原生 agent 不可用时标 BLOCKED。
|
||||
5. 不恢复 DSH/Electron 桌面发行;上游 `apps/desktop` 代码可按上游同步策略保留,
|
||||
但不作为 MQDH 产品发行路径。
|
||||
6. 更新保持“只提醒、不自动安装”;壳内不实现第二套 updater。
|
||||
7. 复用现有 `mqdh-release.json` / `release-evidence.json`,以追加 `installers`
|
||||
字段扩展安装器事实,不建立第二套版本表或发布协议。
|
||||
|
||||
## 后果
|
||||
|
||||
- 安装包体积仍包含预构建 Node 树;后续可单独做生产依赖裁剪,但不改变安装器合同。
|
||||
- Windows/macOS 真实交付依赖原生构建 agent 与签名/公证凭据;缺失时如实 BLOCKED。
|
||||
- `src-tauri/` 属于 MQDH 应用仓;主仓只核验、接受和投影,不构建桌面应用。
|
||||
|
||||
## 被否决的替代方案
|
||||
|
||||
- 恢复 Electron 桌面发行:形成第二套产品工程与第二套发行路径,违背 #31。
|
||||
- 把 `/mqdh` 重写为 Rust 业务服务:重写既有 Harness 业务,收益不足。
|
||||
- 仅在 Linux 交叉编译 Windows/macOS 并宣称支持:不是真实目标平台验收,禁止。
|
||||
@@ -0,0 +1,51 @@
|
||||
# Windows x86_64 正式便携 ZIP 记录(2026-12-03)
|
||||
|
||||
Date: 2026-12-03.
|
||||
性质:**正式便携分发形态(experimental 渠道)**;不是受支持平台声明,也不进入根推荐组合。
|
||||
Release:<https://git.cflmy.cn/cflmy/marqdo-app-harness/releases/tag/mqdh-win-portable-2026-12-03>
|
||||
|
||||
## 1. 发行事实
|
||||
|
||||
| 项 | 值 |
|
||||
| --- | --- |
|
||||
| 应用 | Marqdo Harness(MQDH)`0.1.0-beta.1` |
|
||||
| 源提交 | `0dd4bb5edf10d726cddefff78c4bdab1e1b43b8f`(已合入 `main` `9ccb6b38…`) |
|
||||
| 应用构建树 | `0d3a9c43…`(Windows 构建 + 内置离线运行时) |
|
||||
| 文件名 | `MQDH-0.1.0-beta.1-win-x64.zip` |
|
||||
| 大小 / SHA256 | 832,861,190 bytes / `9b090fb5fc0aec8179d67f8fc6bd1543dd3412474a0c582230d756643765c32f` |
|
||||
| 启动器 | `MQDH.exe`(Windows GUI 子系统,无控制台窗口),sha256 见 `package-evidence.json` |
|
||||
| 内置运行时 | `marqdo-3.0.0-rc.7-x86_64-pc-windows-msvc.tar.gz`,sha256 `182a07c7…`,源 `63562d8…`,Bundle `0.3.0` |
|
||||
| 发行证据 | `mqdh-release.json`、`release-evidence.json`、`package-evidence.json`、`.sha256` |
|
||||
|
||||
## 2. 用户路径
|
||||
|
||||
```text
|
||||
下载 ZIP -> 解压 -> 双击 MQDH.exe
|
||||
-> 启动器用 runtime-deps 离线 bootstrap(CLI/Worker/Bundle)
|
||||
-> 打开继承的 DSH Web UI(工作台 HTTP 200)
|
||||
退出:MQDH.exe --stop
|
||||
```
|
||||
|
||||
不需要终端、`install.ps1` 或分卷脚本;用户数据默认 `%LOCALAPPDATA%\MQDH\data`。
|
||||
|
||||
## 3. 验证证据(Windows 11 x64 开发机)
|
||||
|
||||
- 冷解压 ZIP(832,861,190 bytes,SHA256 匹配)→ 双击 `MQDH.exe`:
|
||||
- 启动器 PE subsystem = 2(Windows GUI,无控制台);
|
||||
- 首次启动离线 bootstrap 成功:环境 `cli-3.0.0-rc.7-182a07c798ef`,`source_sha 63562d8…`,Bundle `sha256:4e47b0ff…`;真实 `check`/`call` smoke = 120(见前序记录与内置 runtime 证据);
|
||||
- 工作台 `http://127.0.0.1:<port>/?token=…` 返回 HTTP **200**;
|
||||
- `workbench.url`、`launcher.pid` 写入用户 home;`--stop` 清理后台服务。
|
||||
- `package-evidence.json` 记录 ZIP/启动器/冷启动结果;`release-evidence.json` 记录源 SHA、CLI 依赖、格式 `portable-zip`。
|
||||
|
||||
## 4. 边界
|
||||
|
||||
- **未签名**;Windows SmartScreen 可能提示,需核对 SHA256。EXE 安装器、桌面/开始菜单集成、签名与原生 Windows CI lane 仍属于
|
||||
[marqdo-app-harness#25](https://git.cflmy.cn/cflmy/marqdo-app-harness/issues/25)。
|
||||
- **前端继承 DSH**:按维护者评审,本版只做少量品牌化(产品名/窗口标题;Logo/主题/图标等按 #25 落地),不新建或改版前端;当前入口是继承的 DSH Web UI。
|
||||
- Knowledge/View Tool 无 Windows 归档,bootstrap 显式 `skipped`;应用内 Windows 更新未验证;未做第二台干净主机验证。
|
||||
- 组件独立发行(marqdo#96/#102):只由 app-harness 本仓打包;CLI/Worker/Bundle 来自组件构建并校验;未触发根仓或其它组件构建。
|
||||
- 不进入根推荐组合;Linux 正式预发布另行接受。
|
||||
|
||||
## 5. 打包入口
|
||||
|
||||
`scripts/package-windows-zip.ps1`(正式入口):从已验证 Windows 应用归档解出应用树,移除 `install.ps1`/`mqdh.cmd`,加入 `MQDH.exe` 与 `README-Windows.txt`,写成单一下载 ZIP,并做冷解压启动验证。启动器源码 `scripts/launcher/MqdhLauncher.cs`,构建 `scripts/launcher/build-launcher.ps1`。
|
||||
@@ -31,6 +31,7 @@ Marqdo Harness(MQDH)是 Marqdo 生态的官方单用户应用:安装并校
|
||||
| 默认网络出口/代理/离线/审计 | [NETWORK.md](NETWORK.md) | `src/network/` |
|
||||
| 首次启动、离线与失败处理 | [BOOTSTRAP.md](BOOTSTRAP.md) | `src/bootstrap/` |
|
||||
| 本地脱敏报告与显式 Issue 提交 | [DIAGNOSTICS.md](DIAGNOSTICS.md) | `src/diagnostics/` |
|
||||
| 桌面壳、安装器与三平台状态 | [TAURI.md](TAURI.md) | `src-tauri/`、`scripts/tauri/` |
|
||||
| 平台矩阵、安装布局、更新/回退 | [DISTRIBUTION.md](DISTRIBUTION.md) | `src/distribution/`、`src/release/` |
|
||||
| 构建、签名、发布与发布后验证 | [RELEASING.md](RELEASING.md) | `scripts/release-manifest.ts`、`scripts/release.ts` |
|
||||
| 上游远端、同步与许可 | [UPSTREAM.md](UPSTREAM.md) | `scripts/upstream.sh` |
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
| 路径 | 修改 | 原因 | 能否使用公开 seam | 测试 | 上游 Issue/PR | 移除条件 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| `.github/workflows/*`(发布/上传/桌面打包/Cloudflare/Pages 共 18 个) | 删除 | 防止下游误用官方发布凭证与上传路径;Gitea/Woodpecker 是下游 CI 权威 | 不需要 | 仓库内无这些 workflow;`grep` 审计 | 无(下游发布策略) | 上游发布机制被下游显式复用时重新评估 |
|
||||
| `tsdown.config.ts` | 从 workspace bundle 列表排除 `packages/marqdo/*` | 下游包以 TypeScript 源码由 Node 24 原生类型剥离执行,没有 `lib/types` 产物 | 上游 workspace 配置即公开构建入口 | `pnpm run build` 10/10 gates PASS | 无 | 下游包改为产出 `lib/types` 时 |
|
||||
| `tsdown.config.ts`、`tsconfig.client.json` | 服务端产品包由 Node 原生执行,`@marqdo/mqdh-ui` 使用上游 Client 构建 | 产品浏览器插件通过现有动态模块加载器交付 | 使用同一个 `clientBundle` preset | `pnpm run build:artifacts`、`pnpm run build:check` | 无 | 上游自动识别非标准包组的构建类型时 |
|
||||
| `apps/cli/package.json` | 增加 `@deepseek-ai/cordis-plugin-group` 运行时依赖 | app-boot 将其列为 peer;生产部署闭包需要它 | 上游依赖声明 | `pnpm install --frozen-lockfile`;部署 smoke | 可作为通用打包修复回馈 | 上游把该 peer 改为直接依赖 |
|
||||
| `packages/marqdo/harness`、`packages/marqdo/bundle`、`scripts/mqdh.mjs`、`docs/mqdh` | 新增下游产品代码与文档 | Marqdo Harness 产品能力 | 新包,不改上游 | `scripts/ci.sh` | 无 | 不适用 |
|
||||
| `packages/client/ui-sidebar/src/client/SidebarRoot.tsx` | 为导航行提供 `data-panel-entry` | MQDH 按稳定 ID 设置 Marqdo 选中态,侧栏继续负责交互和布局 | 复用原有组件及选中态 token | Chromium 整页核对浅深色与键盘导航 | 无 | 上游提供导航行样式入口时 |
|
||||
|
||||
## 未修改但依赖的上游 seam
|
||||
|
||||
@@ -15,5 +16,6 @@
|
||||
- `ctx.approval.request`:文稿执行与生态变更的一次性授权。
|
||||
- `ctx.systemPrompt.section`:产品提示词段落。
|
||||
- `ctx.webServer.register`:`/mqdh` 工作台与 JSON API。
|
||||
- `sidebar.brand.mark`、`sidebar.brand.name`、`conversation.hero.brand.mark`、`sidebar.panellist` 和 `main` 槽:产品品牌、只读插件列表及 Marqdo 生态工作台。
|
||||
- `ctx.provide('mqdhRuntime')`:host 与 web 半部共享运行时。
|
||||
- profile/bundle 的 `dsh.bundle.patch`:唯一产品组合入口。
|
||||
@@ -69,7 +69,7 @@ function PanelRow({
|
||||
const active = usePanelInfo(info => info.activePanelId === id)
|
||||
const trailing = useId()
|
||||
return (
|
||||
<div className={clsx(css.panelEntry, wide && css.panelEntryWide, active && css.panelEntryActive)}>
|
||||
<div data-panel-entry={id} className={clsx(css.panelEntry, wide && css.panelEntryWide, active && css.panelEntryActive)}>
|
||||
<Tooltip label={label} delayMs={500} disabled={wide}>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
# Product UI surfaces that imply unsupported installation/session upload.
|
||||
- id: ui-plugin-manager
|
||||
disabled: true
|
||||
- id: ui-brand-official
|
||||
disabled: true
|
||||
- id: ui-agent-preset
|
||||
disabled: true
|
||||
- id: ui-settings-session-log
|
||||
@@ -72,6 +74,9 @@
|
||||
workspace: !!js process.env.MQDH_WORKSPACE
|
||||
maxRunMs: 300000
|
||||
|
||||
- id: mqdh-ui
|
||||
name: '@marqdo/mqdh-ui'
|
||||
|
||||
- id: mqdh-web
|
||||
name: '@marqdo/mqdh-harness/web'
|
||||
config:
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@marqdo/mqdh-harness": "workspace:*"
|
||||
"@marqdo/mqdh-harness": "workspace:*",
|
||||
"@marqdo/mqdh-ui": "workspace:*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -4,6 +4,8 @@ Marqdo Harness product services as one Cordis plugin (host half) plus the `/mqdh
|
||||
|
||||
## Surface
|
||||
|
||||
The left sidebar’s **Marqdo** entry opens the existing workbench in the main panel on its Ecosystem tab. The standalone `/mqdh` URL remains available. Its embedded view uses the same routes and allows framing by its own origin. The embedded workbench follows the shell’s active color scheme. The standalone page follows the browser’s color scheme. The adjacent **Plugins** entry displays the Host inventory with read-only access.
|
||||
|
||||
- `src/index.ts` — `mqdh-harness` plugin: provides `mqdhRuntime`, registers six tools, adds one product prompt section.
|
||||
- `src/web/index.ts` — `mqdh-web` plugin: `/mqdh` page, CSS/JS and same-origin JSON API over `ctx.webServer`.
|
||||
- `src/core/` — home layout, atomic files, lock, bounded process, safe tar, Observation 1, ValueWire.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Marqdo contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
After Width: | Height: | Size: 353 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#343f22" d="M8 8v45l9-5V27l15 12 15-12v21l9 5V8L32 28z"/><path fill="#c59a55" d="m8 8 24 20L56 8 32 38z"/><path fill="#fcf9f4" d="m19 17 13 11 13-11-13 17z"/><path fill="#c59a55" d="m27 49 5-5 5 5-5 7z"/></svg>
|
||||
|
After Width: | Height: | Size: 282 B |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@marqdo/mqdh-harness",
|
||||
"version": "0.1.0-beta.1",
|
||||
"version": "0.2.0-beta.1",
|
||||
"description": "Marqdo Harness product services: ecosystem transactions, document-native execution, private knowledge and the /mqdh workbench",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
* @module @marqdo/mqdh-harness/web/assets
|
||||
*/
|
||||
|
||||
import { readFileSync } from 'node:fs'
|
||||
|
||||
/** The local Marqdo brand mark shared by the workbench and the shell. */
|
||||
export const BRAND_SVG = readFileSync(new URL('../../assets/marqdo.svg', import.meta.url))
|
||||
|
||||
/** The workbench document. */
|
||||
export const APP_HTML = `<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
@@ -15,12 +20,13 @@ export const APP_HTML = `<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Marqdo Harness</title>
|
||||
<link rel="icon" href="/mqdh/brand.svg" type="image/svg+xml">
|
||||
<link rel="stylesheet" href="/mqdh/app.css">
|
||||
<script type="module" src="/mqdh/app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body__MQDH_EMBEDDED__>
|
||||
<header class="top">
|
||||
<div class="brand"><span class="mark">M</span><strong>Marqdo Harness</strong><span class="sub">本地单用户工作台</span></div>
|
||||
<div class="brand"><img src="/mqdh/brand.svg" width="30" height="30" alt=""><strong>Marqdo Harness</strong><span class="sub">本地单用户工作台</span></div>
|
||||
<nav class="links">
|
||||
<a href="/">对话</a>
|
||||
<a href="/mqdh" aria-current="page">工作台</a>
|
||||
@@ -30,15 +36,15 @@ export const APP_HTML = `<!doctype html>
|
||||
</header>
|
||||
<main>
|
||||
<section class="hero">
|
||||
<h1>文档即程序,知识可复用</h1>
|
||||
<p>这里展示真实的已安装状态、私人知识集合、受控执行与运行证据。所有“可用”都来自实际服务,不显示虚构进度。</p>
|
||||
<h1>Marqdo 工作台</h1>
|
||||
<p>查看本地运行时、私人知识和隐私状态。</p>
|
||||
</section>
|
||||
|
||||
<section id="status" class="cards" aria-live="polite">
|
||||
<div class="card"><h2>Runtime</h2><p class="big" id="status-runtime">读取中…</p><p id="status-runtime-detail" class="muted"></p></div>
|
||||
<div class="card"><h2>Std Bundle</h2><p class="big" id="status-std">读取中…</p><p id="status-std-detail" class="muted"></p></div>
|
||||
<div class="card"><h2>私人知识</h2><p class="big" id="status-knowledge">读取中…</p><p id="status-knowledge-detail" class="muted"></p></div>
|
||||
<div class="card"><h2>隐私默认</h2><p class="big" id="status-privacy">读取中…</p><p id="status-privacy-detail" class="muted"></p></div>
|
||||
<div class="card"><h2>隐私</h2><p class="big" id="status-privacy">读取中…</p><p id="status-privacy-detail" class="muted"></p></div>
|
||||
</section>
|
||||
|
||||
<nav class="tabs" role="tablist">
|
||||
@@ -88,7 +94,7 @@ export const APP_HTML = `<!doctype html>
|
||||
|
||||
<section id="tab-ecosystem" class="panel" role="tabpanel" hidden>
|
||||
<h2>生态目录</h2>
|
||||
<p class="muted">固定顺序 Runtime → Tool → Std → Ext → Knowledge。打开、筛选和查看详情不触发下载或执行;有副作用的操作只由按钮显式发起。</p>
|
||||
<p class="muted">按 Runtime、Tool、Std、Ext 和 Knowledge 查看本地环境。</p>
|
||||
<div id="catalog" class="catalog"></div>
|
||||
<div id="ecosystem-detail" class="results"></div>
|
||||
|
||||
@@ -247,97 +253,190 @@ export const APP_HTML = `<!doctype html>
|
||||
|
||||
/** The workbench stylesheet. */
|
||||
export const APP_CSS = `:root {
|
||||
--paper: #f6f2e8;
|
||||
--ink: #26241f;
|
||||
--muted: #6b675d;
|
||||
--olive: #4f6146;
|
||||
--olive-soft: #dfe5d6;
|
||||
--line: #d8d2c4;
|
||||
--danger: #8a3b32;
|
||||
font-family: "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
|
||||
color-scheme: light dark;
|
||||
--background: light-dark(#fafafa, #202124);
|
||||
--surface: light-dark(#fff, #252629);
|
||||
--field: light-dark(#fff, #202124);
|
||||
--ink: light-dark(#202124, #ecedf0);
|
||||
--muted: light-dark(#575d66, #b4b8be);
|
||||
--line: light-dark(#e1e4e8, #37393d);
|
||||
--control-line: #838a94;
|
||||
--hover: light-dark(#eef0f2, #303236);
|
||||
--accent: light-dark(#536742, #a7b996);
|
||||
--accent-line: light-dark(#758668, #78896d);
|
||||
--selection: light-dark(#dce4d6, #414b3a);
|
||||
--status: light-dark(#ebedf0, #333538);
|
||||
--warning-bg: light-dark(#f4e9d9, #463628);
|
||||
--warning-ink: light-dark(#714b22, #f2c89a);
|
||||
--danger: light-dark(#9d3435, #f1a6a5);
|
||||
--radius: 8px;
|
||||
font: 13px / 1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
|
||||
'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* The desktop shell can select a scheme independently of the operating system. */
|
||||
:root[data-mqdh-scheme="light"] { color-scheme: light; }
|
||||
:root[data-mqdh-scheme="dark"] { color-scheme: dark; }
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.7; }
|
||||
a { color: var(--olive); }
|
||||
.top { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 0.9rem 1.6rem; border-bottom: 1px solid var(--line); background: #fbf8f0; flex-wrap: wrap; }
|
||||
.brand { display: flex; align-items: center; gap: 0.6rem; }
|
||||
.brand .mark { width: 1.9rem; height: 1.9rem; border-radius: 0.45rem; background: var(--olive); color: #fff; display: grid; place-items: center; font-weight: 700; }
|
||||
.brand .sub { color: var(--muted); font-size: 0.85rem; }
|
||||
.links a { margin-left: 1rem; text-decoration: none; font-size: 0.92rem; }
|
||||
.links a[aria-current="page"] { border-bottom: 2px solid var(--olive); }
|
||||
main { max-width: 1080px; margin: 0 auto; padding: 1.4rem 1.6rem 4rem; }
|
||||
.hero h1 { font-size: 1.65rem; margin: 0.6rem 0 0.3rem; }
|
||||
.hero p { color: var(--muted); margin-top: 0; }
|
||||
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.9rem; margin: 1.2rem 0; }
|
||||
.card { background: #fffdf8; border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.9rem 1rem; }
|
||||
.card h2 { font-size: 0.9rem; margin: 0; color: var(--muted); font-weight: 600; }
|
||||
.card .big { font-size: 1.15rem; margin: 0.25rem 0; overflow-wrap: anywhere; }
|
||||
.muted { color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
|
||||
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
|
||||
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.55rem 0.8rem; font: inherit; color: var(--muted); cursor: pointer; }
|
||||
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--olive); }
|
||||
.panel h2 { font-size: 1.1rem; margin: 1rem 0 0.6rem; }
|
||||
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
|
||||
.form { background: #fffdf8; border: 1px solid var(--line); border-radius: 0.7rem; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
|
||||
.form.inline { flex-direction: row; align-items: end; }
|
||||
.form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
|
||||
input, select, button { font: inherit; }
|
||||
input, select { padding: 0.45rem 0.55rem; border: 1px solid var(--line); border-radius: 0.4rem; background: #fff; color: var(--ink); }
|
||||
button { padding: 0.5rem 0.9rem; border-radius: 0.45rem; border: 1px solid var(--olive); background: var(--olive); color: #fff; cursor: pointer; }
|
||||
button[data-destructive="true"], button.danger { background: var(--danger); border-color: var(--danger); }
|
||||
button.ghost { background: transparent; color: var(--olive); }
|
||||
button:disabled { opacity: 0.55; cursor: progress; }
|
||||
.catalog { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
|
||||
.group { border: 1px solid var(--line); border-radius: 0.7rem; background: #fffdf8; padding: 0.9rem 1rem; }
|
||||
.group-head { display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline; flex-wrap: wrap; }
|
||||
.group-head h3 { margin: 0; font-size: 1rem; }
|
||||
.group .list { margin-top: 0.6rem; }
|
||||
.panel h3 { font-size: 1rem; margin: 0.8rem 0 0.4rem; }
|
||||
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
|
||||
.list li { background: #fffdf8; border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.75rem 0.9rem; }
|
||||
.list .row { display: flex; justify-content: space-between; gap: 0.7rem; align-items: start; flex-wrap: wrap; }
|
||||
.badge { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.45rem; border-radius: 1rem; background: var(--olive-soft); color: var(--olive); margin-left: 0.35rem; }
|
||||
.badge.warn { background: #f3e4d2; color: #7a4b20; }
|
||||
.results { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
|
||||
.hit { border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.8rem 0.9rem; background: #fffdf8; }
|
||||
.hit h3 { margin: 0 0 0.2rem; font-size: 1rem; }
|
||||
.hit .src { color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
|
||||
.hit pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; margin: 0.5rem 0 0; }
|
||||
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; font-size: 0.9rem; }
|
||||
.facts dt { color: var(--muted); }
|
||||
.facts dd { margin: 0; overflow-wrap: anywhere; }
|
||||
.code { background: #26241f; color: #f3efe5; border-radius: 0.6rem; padding: 0.9rem; overflow: auto; font-size: 0.8rem; max-height: 32rem; }
|
||||
.error { color: var(--danger); min-height: 1.5rem; }
|
||||
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem; border-top: 1px solid var(--line); }
|
||||
.reader-toolbar { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.7rem 0; }
|
||||
.reader-frame { border: 1px solid var(--line); border-radius: 0.6rem; overflow: hidden; background: #fff; }
|
||||
.reader-frame iframe { display: block; width: 100%; min-height: 70vh; border: 0; background: #fff; }
|
||||
.market { border: 1px solid var(--line); border-radius: 0.7rem; background: #fffdf8; padding: 0.9rem 1rem; margin: 1rem 0; }
|
||||
.market-toolbar { display: flex; gap: 0.7rem; align-items: end; flex-wrap: wrap; margin: 0.6rem 0; }
|
||||
.market-toolbar label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.86rem; }
|
||||
.market-toolbar input, .market-toolbar select { min-width: 11rem; }
|
||||
.segmented { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.4rem 0 0.6rem; }
|
||||
.segmented button { background: transparent; color: var(--olive); border-color: var(--line); }
|
||||
.segmented button[aria-selected="true"] { background: var(--olive); color: #fff; }
|
||||
.row-button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: inherit; padding: 0; cursor: pointer; }
|
||||
.row-button:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; }
|
||||
.market .list li { background: #fffdf8; }
|
||||
.source-config { margin-top: 1rem; }
|
||||
.source-config summary { cursor: pointer; color: var(--olive); }
|
||||
.permissions { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.35rem 0; }
|
||||
.permissions span { font-size: 0.78rem; border: 1px solid var(--line); border-radius: 1rem; padding: 0.05rem 0.45rem; }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root { --paper: #17181a; --ink: #e8e6e0; --muted: #aaa79f; --olive: #a7bd94; --olive-soft: #2d352a; --line: #3a3b35; --danger: #e08a80; }
|
||||
body { background: var(--paper); color: var(--ink); }
|
||||
.top, .card, .form, .group, .list li, .hit, .market, .market .list li { background: #20211e; }
|
||||
input, select { background: #262722; color: var(--ink); }
|
||||
.code { background: #0e0f0d; color: #ece9df; }
|
||||
.market-toolbar input, .market-toolbar select { background: #262722; }
|
||||
body { margin: 0; background: var(--background); color: var(--ink); }
|
||||
h1, h2, h3, strong, b { font-weight: 500; }
|
||||
a { color: var(--accent); }
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 24px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: var(--surface);
|
||||
}
|
||||
.brand, .links { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
||||
body[data-embedded] > .top { display: none; }
|
||||
.brand .sub { color: var(--muted); }
|
||||
.links a { text-decoration: none; }
|
||||
.links a[aria-current="page"] { border-bottom: 2px solid var(--accent); }
|
||||
|
||||
main { max-width: 1120px; margin: 0 auto; padding: 24px 24px 40px; }
|
||||
.hero h1 { font-size: 22px; line-height: 28px; margin: 0 0 4px; }
|
||||
.hero p { color: var(--muted); margin: 0; }
|
||||
.cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 152px), 1fr));
|
||||
gap: 16px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.card { min-height: 136px; padding: 14px 16px; }
|
||||
.card h2 { font-size: 13px; margin: 0; color: var(--muted); }
|
||||
.card .big { font-size: 17px; line-height: 24px; font-weight: 500; margin: 6px 0; overflow-wrap: anywhere; }
|
||||
.card .muted { margin: 0; }
|
||||
.muted { color: var(--muted); overflow-wrap: anywhere; }
|
||||
|
||||
.tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0 4px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.tabs button {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-block-end: 2px solid transparent;
|
||||
border-radius: var(--radius) var(--radius) 0 0;
|
||||
padding: 7px 10px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.tabs button[aria-selected="true"] {
|
||||
color: var(--ink);
|
||||
border-block-end-color: var(--accent);
|
||||
font-weight: 500;
|
||||
}
|
||||
.panel h2 { font-size: 17px; line-height: 24px; margin: 16px 0 8px; }
|
||||
.panel > .muted { margin: 0 0 12px; }
|
||||
.panel h3 { font-size: 15px; margin: 12px 0 6px; }
|
||||
.split {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.card, .form, .group, .list li, .hit, .market, .reader-frame {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
}
|
||||
.form { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
|
||||
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: end; }
|
||||
.form label { display: flex; flex-direction: column; gap: 4px; }
|
||||
input, select, textarea, button { font: inherit; max-inline-size: 100%; }
|
||||
input, select, textarea {
|
||||
padding: 6px 8px;
|
||||
border: 1px solid var(--control-line);
|
||||
border-radius: var(--radius);
|
||||
background: var(--field);
|
||||
color: var(--ink);
|
||||
}
|
||||
button {
|
||||
padding: 6px 12px;
|
||||
border: 1px solid var(--control-line);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
cursor: pointer;
|
||||
}
|
||||
button.ghost { background: transparent; border-color: var(--accent-line); color: var(--accent); }
|
||||
button[data-destructive="true"], button.danger { color: var(--danger); }
|
||||
button:disabled { color: var(--muted); cursor: default; }
|
||||
:where(a, button, input, select, textarea, summary):focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
@media (hover: hover) {
|
||||
button:not(:disabled):hover { background-color: var(--hover); }
|
||||
}
|
||||
|
||||
.catalog, .results { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
|
||||
.group, .market { padding: 12px 16px; }
|
||||
.group-head { display: flex; justify-content: space-between; gap: 6px 16px; align-items: baseline; flex-wrap: wrap; }
|
||||
.group-head h3, .group-head p { margin: 0; }
|
||||
.group .list { margin-top: 12px; }
|
||||
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
||||
.list li, .hit { padding: 10px 12px; min-inline-size: 0; }
|
||||
.list .row { display: flex; justify-content: space-between; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
|
||||
.catalog .list li { padding: 12px; }
|
||||
.catalog .row { align-items: flex-start; }
|
||||
.catalog .row > div:first-child { flex: 1 1 240px; min-inline-size: 0; }
|
||||
.catalog .row > div:empty { display: none; }
|
||||
.catalog .row p { margin: 4px 0 0; }
|
||||
.badge {
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 999px;
|
||||
background: var(--status);
|
||||
color: var(--muted);
|
||||
margin-inline-start: 6px;
|
||||
}
|
||||
.badge.warn { background: var(--warning-bg); color: var(--warning-ink); }
|
||||
.results { margin-top: 16px; }
|
||||
.results:empty { display: none; }
|
||||
.hit h3 { margin: 0 0 4px; }
|
||||
.hit .src { color: var(--muted); overflow-wrap: anywhere; }
|
||||
.hit pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }
|
||||
.facts { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr); gap: 4px 16px; }
|
||||
.facts dt { color: var(--muted); overflow-wrap: anywhere; }
|
||||
.facts dd { margin: 0; overflow-wrap: anywhere; }
|
||||
.code {
|
||||
background: light-dark(#eef0f2, #191a1c);
|
||||
color: var(--ink);
|
||||
border-radius: var(--radius);
|
||||
padding: 12px;
|
||||
overflow: auto;
|
||||
max-height: 32rem;
|
||||
}
|
||||
.error { color: var(--danger); min-block-size: 1.5rem; }
|
||||
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; border-top: 1px solid var(--line); }
|
||||
.reader-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
|
||||
.reader-frame { overflow: hidden; }
|
||||
.reader-frame iframe { display: block; width: 100%; min-height: 70vh; border: 0; background: var(--field); }
|
||||
.market { margin: 16px 0; }
|
||||
.market-toolbar { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin: 12px 0; }
|
||||
.market-toolbar label { display: flex; flex-direction: column; gap: 4px; }
|
||||
.segmented { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 10px; }
|
||||
.segmented button[aria-selected="true"], .segmented button[aria-selected="true"]:hover { background: var(--selection); }
|
||||
.row-button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: inherit; padding: 0; }
|
||||
.source-config { margin-top: 16px; }
|
||||
.source-config summary { cursor: pointer; color: var(--accent); }
|
||||
.permissions { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
|
||||
.permissions span { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
main { padding: 1rem; }
|
||||
main, .top { padding-inline: 16px; }
|
||||
.form.inline { flex-direction: column; align-items: stretch; }
|
||||
.links a { margin-left: 0; margin-right: 0.9rem; }
|
||||
}
|
||||
`
|
||||
|
||||
@@ -509,12 +608,12 @@ async function loadEcosystem() {
|
||||
ecosystem.runtime.installed
|
||||
? (ecosystem.runtime.version + ' · ' + ecosystem.runtime.platform + ' · ' + short(ecosystem.runtime.path, 90))
|
||||
: '未安装;首次启动或生态中心可安装受信任 CLI 基础发行',
|
||||
[el('button', { class: 'ghost', type: 'button', text: '检查受信任候选', onclick: () => checkCandidates() })])];
|
||||
[el('button', { class: 'ghost', type: 'button', text: '检查候选', onclick: () => checkCandidates() })])];
|
||||
runtimeRows.push(catalogRow('Bundle',
|
||||
ecosystem.std.installed ? '已校验' : '不可用',
|
||||
ecosystem.std.installed ? (ecosystem.std.version + ' · ' + ecosystem.std.digest + ' · ' + ecosystem.std.modules.length + ' 个模块') : '随 Runtime 作为单一 Bundle 安装,不逐模块启停'));
|
||||
runtimeRows.push(catalogRow('活动环境', environment ? '已记录' : '无',
|
||||
environment ? (environment.id + ' · source ' + (environment.source_sha || 'unknown')) : '没有 current.json',
|
||||
environment ? (environment.id + ' · source ' + (environment.source_sha || 'unknown')) : '尚未激活运行环境',
|
||||
[el('button', { class: 'ghost', type: 'button', text: '查看安装/恢复', onclick: () => $('#install-form').scrollIntoView({ behavior: 'smooth' }) })]));
|
||||
if (ecosystem.staging.length > 0) {
|
||||
runtimeRows.push(catalogRow('候选 staging', '待验证', ecosystem.staging.join(', ') + '(未激活,不会被当作已安装)'));
|
||||
|
||||
@@ -21,7 +21,7 @@ import { parseSourceConfig } from '../market/config.ts'
|
||||
import { MarketError } from '../market/errors.ts'
|
||||
import { ReaderError } from '../reader/errors.ts'
|
||||
import { runProcess } from '../core/process.ts'
|
||||
import { APP_CSS, APP_HTML, APP_JS } from './assets.ts'
|
||||
import { APP_CSS, APP_HTML, BRAND_SVG, APP_JS } from './assets.ts'
|
||||
import { isLoopbackAuthority, isTrustedAuthority } from './trust.ts'
|
||||
|
||||
/** Stable Cordis plugin name. */
|
||||
@@ -125,11 +125,15 @@ function registerRoutes(
|
||||
const url = new URL(req.url ?? '/', `http://${req.headers.host ?? '127.0.0.1'}`)
|
||||
const pathname = url.pathname.replace(/\/+$/, '') || '/'
|
||||
if (pathname === '/mqdh' && (req.method === 'GET' || req.method === 'HEAD')) {
|
||||
const embedded = url.searchParams.get('embedded') === '1'
|
||||
if (embedded) fence(req)
|
||||
const html = APP_HTML.replace('__MQDH_ORIGIN__', JSON.stringify(url.origin))
|
||||
.replace('__MQDH_EMBEDDED__', embedded ? ' data-embedded' : '')
|
||||
const ancestors = embedded ? "'self'" : "'none'"
|
||||
res.writeHead(200, {
|
||||
'content-type': 'text/html; charset=utf-8',
|
||||
'content-length': Buffer.byteLength(html),
|
||||
'content-security-policy': "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; frame-src 'self'; form-action 'self'; base-uri 'none'; frame-ancestors 'none'",
|
||||
'content-security-policy': `default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; frame-src 'self'; form-action 'self'; base-uri 'none'; frame-ancestors ${ancestors}`,
|
||||
'x-content-type-options': 'nosniff',
|
||||
'referrer-policy': 'no-referrer',
|
||||
'cache-control': 'no-store',
|
||||
@@ -137,6 +141,16 @@ function registerRoutes(
|
||||
res.end(req.method === 'HEAD' ? undefined : html)
|
||||
return
|
||||
}
|
||||
if (pathname === '/mqdh/brand.svg' && (req.method === 'GET' || req.method === 'HEAD')) {
|
||||
res.writeHead(200, {
|
||||
'content-type': 'image/svg+xml',
|
||||
'content-length': BRAND_SVG.length,
|
||||
'x-content-type-options': 'nosniff',
|
||||
'cache-control': 'no-cache',
|
||||
})
|
||||
res.end(req.method === 'HEAD' ? undefined : BRAND_SVG)
|
||||
return
|
||||
}
|
||||
if (pathname === '/mqdh/app.css' && req.method === 'GET') {
|
||||
res.writeHead(200, { 'content-type': 'text/css; charset=utf-8', 'cache-control': 'no-store' })
|
||||
res.end(APP_CSS)
|
||||
|
||||
@@ -41,6 +41,9 @@ test('the product bundle disables the Node PTC preset and plugin installation',
|
||||
const byId = new Map(rows.map(row => [row.id, row]))
|
||||
assert.equal(byId.get('preset-ptc')?.disabled, true)
|
||||
assert.equal(byId.get('plugin-manager')?.disabled, true)
|
||||
assert.equal(byId.get('ui-plugin-manager')?.disabled, true)
|
||||
assert.equal(byId.get('ui-brand-official')?.disabled, true)
|
||||
assert.ok(byId.has('mqdh-ui'))
|
||||
assert.equal(byId.get('tool-plugin-manager')?.disabled, true)
|
||||
assert.equal(byId.get('session-log-deepseek')?.disabled, true)
|
||||
assert.equal(byId.get('session-telemetry-otel')?.disabled, true)
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "@marqdo/mqdh-ui",
|
||||
"version": "0.1.0",
|
||||
"description": "Marqdo branding and ecosystem navigation for the shared Harness shell",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/types/index.d.ts",
|
||||
"default": "./lib/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/types/client/index.d.ts",
|
||||
"default": "./lib/client.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dsh": {
|
||||
"client": {
|
||||
"platform": "web",
|
||||
"inject": [
|
||||
"@deepseek-ai/dsh-api-remote-access",
|
||||
"@deepseek-ai/dsh-api-remotes",
|
||||
"@deepseek-ai/dsh-client-locale",
|
||||
"@deepseek-ai/dsh-client-ui-conversation",
|
||||
"@deepseek-ai/dsh-client-ui-layout",
|
||||
"@deepseek-ai/dsh-client-ui-renderer",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar",
|
||||
"@deepseek-ai/dsh-client-ui-theme"
|
||||
]
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/dsh-api-remote-access": "workspace:*",
|
||||
"@deepseek-ai/dsh-api-remotes": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-locale": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-conversation": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-layout": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-primitives": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-theme": "workspace:*",
|
||||
"react": "^18.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
:global([data-panel-entry='marqdo']) {
|
||||
--dsw-focus-ring-color: light-dark(#536742, #a7b996);
|
||||
}
|
||||
|
||||
:global([data-panel-entry='marqdo']):has(> :global(button[aria-current='page'])) {
|
||||
--dsw-alias-interactive-bg-hover: light-dark(#dce4d6, #414b3a);
|
||||
}
|
||||
|
||||
.workbench {
|
||||
flex: 1;
|
||||
min-block-size: 0;
|
||||
min-inline-size: 0;
|
||||
inline-size: 100%;
|
||||
border: 0;
|
||||
background: var(--dsw-alias-bg-base);
|
||||
}
|
||||
|
||||
.inventory {
|
||||
flex: 1;
|
||||
min-block-size: 0;
|
||||
overflow: auto;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
:global([data-platform='darwin']) .workbench {
|
||||
margin-block-start: var(--dsh-frame-top-clearance);
|
||||
}
|
||||
|
||||
:global([data-platform='darwin']) .inventory {
|
||||
padding-block-start: calc(var(--dsh-frame-top-clearance) + 24px);
|
||||
}
|
||||
|
||||
.inventory h1 {
|
||||
margin-block: 0 16px;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.inventory ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.inventory li {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
column-gap: 16px;
|
||||
padding-block: 8px;
|
||||
border-block-end: 1px solid var(--dsw-alias-border-l3);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.inventory li span {
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
||||
import type { PluginInventorySnapshot } from '@deepseek-ai/dsh-api-remotes/client'
|
||||
import { Button, IconPluginPinwheelOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import type { HostObservable, InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { HeroBrandMarkOwnerProps } from '@deepseek-ai/dsh-client-ui-conversation/client'
|
||||
import type { ThemeSnapshot } from '@deepseek-ai/dsh-client-ui-theme/client'
|
||||
import css from './Panels.module.css'
|
||||
|
||||
/** Same-origin artwork used on the workbench and the shell. */
|
||||
export const BRAND_ICON = '/mqdh/brand.svg'
|
||||
|
||||
/**
|
||||
* Brand artwork in the dimensions supplied by each slot.
|
||||
* @param props - Mark dimensions and optional host CSS.
|
||||
* @returns Decorative Marqdo mark.
|
||||
*/
|
||||
export function MarqdoMark({ size, className }: HeroBrandMarkOwnerProps) {
|
||||
return <img className={className} src={BRAND_ICON} width={size} height={size} alt="" />
|
||||
}
|
||||
|
||||
/** Wordmark in the expanded sidebar. */
|
||||
export function MarqdoName({ t }: PropsLocale<'mqdh'>) {
|
||||
return <span>{t('product')}</span>
|
||||
}
|
||||
|
||||
/** Native sidebar glyph for the read-only Plugins panel. */
|
||||
export function PluginsIcon({ size }: PropsRuntime<'sidebar.panellist'>) {
|
||||
return <IconPluginPinwheelOutlineRegular size={size} />
|
||||
}
|
||||
|
||||
/** Theme projection supplied by the shell to the same-origin workbench. */
|
||||
export interface WorkbenchTheme {
|
||||
readonly hooks: {
|
||||
readonly workbenchScheme: HostObservable<ThemeSnapshot['active']['colorScheme']>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the workbench in the current application theme.
|
||||
* @param props - Localized title and the shell's resolved color scheme.
|
||||
* @returns The embedded workbench.
|
||||
*/
|
||||
export function Workbench({ t, useWorkbenchScheme }: PropsLocale<'mqdh'> & InjectFace<WorkbenchTheme>) {
|
||||
const scheme = useWorkbenchScheme(value => value)
|
||||
const frame = useRef<HTMLIFrameElement>(null)
|
||||
const syncScheme = useCallback(() => {
|
||||
const embedded = frame.current?.contentDocument
|
||||
if (embedded?.body?.hasAttribute('data-embedded')) {
|
||||
embedded.documentElement.setAttribute('data-mqdh-scheme', scheme)
|
||||
}
|
||||
}, [scheme])
|
||||
useLayoutEffect(syncScheme, [syncScheme])
|
||||
return <iframe
|
||||
ref={frame}
|
||||
className={css.workbench}
|
||||
title={t('marqdo')}
|
||||
src="/mqdh?embedded=1#ecosystem"
|
||||
onLoad={syncScheme}
|
||||
/>
|
||||
}
|
||||
|
||||
type Inventory = PluginInventorySnapshot['entries']
|
||||
|
||||
/** Read-only inventory callback injected by the browser plugin. */
|
||||
export interface InventoryProps extends PropsLocale<'mqdh'> {
|
||||
readonly loadInventory: () => Promise<Inventory>
|
||||
}
|
||||
|
||||
type InventoryState =
|
||||
| { readonly kind: 'loading' }
|
||||
| { readonly kind: 'failed' }
|
||||
| { readonly kind: 'ready'; readonly entries: Inventory }
|
||||
|
||||
/** The Host's configured plugin list without profile or package mutations. */
|
||||
export function PluginInventory({ loadInventory, t }: InventoryProps) {
|
||||
const [attempt, setAttempt] = useState(0)
|
||||
const [state, setState] = useState<InventoryState>({ kind: 'loading' })
|
||||
useEffect(() => {
|
||||
let current = true
|
||||
setState({ kind: 'loading' })
|
||||
void loadInventory().then((entries) => {
|
||||
if (current) setState({ kind: 'ready', entries })
|
||||
}, () => {
|
||||
if (current) setState({ kind: 'failed' })
|
||||
})
|
||||
return () => { current = false }
|
||||
}, [attempt, loadInventory])
|
||||
return (
|
||||
<section className={css.inventory}>
|
||||
<h1>{t('plugins')}</h1>
|
||||
{state.kind === 'loading' && <p role="status">{t('loading')}</p>}
|
||||
{state.kind === 'failed' && <>
|
||||
<p role="alert">{t('failed')}</p>
|
||||
<Button onClick={() => { setAttempt(attempt + 1) }}>{t('retry')}</Button>
|
||||
</>}
|
||||
{state.kind === 'ready' && (state.entries.length > 0
|
||||
? <ul>{state.entries.map(entry => (
|
||||
<li key={entry.entryId}>
|
||||
{entry.moduleName}
|
||||
<span>{t(!entry.enabled ? 'disabled' : entry.fiberPhase === 'failed' ? 'failedPlugin' : 'enabled')}</span>
|
||||
</li>
|
||||
))}</ul>
|
||||
: <p>{t('empty')}</p>)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
declare module '*.module.css' {
|
||||
const classes: Readonly<Record<string, string>>
|
||||
export default classes
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/** Product-owned contributions to the inherited DSH shell. */
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import type {} from '@deepseek-ai/dsh-api-remote-access/client'
|
||||
import type { PluginInventorySnapshot } from '@deepseek-ai/dsh-api-remotes/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-locale/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
||||
import type { MainPanelId } from '@deepseek-ai/dsh-client-ui-layout/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-theme/client'
|
||||
import { en, zh } from './locales.ts'
|
||||
import { BRAND_ICON, MarqdoMark, MarqdoName, PluginInventory, PluginsIcon, Workbench, type WorkbenchTheme } from './Panels.tsx'
|
||||
|
||||
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
||||
interface LocaleNamespaceMap {
|
||||
/** MQDH brand and navigation copy. */
|
||||
mqdh: keyof typeof en
|
||||
}
|
||||
}
|
||||
|
||||
const NS = 'mqdh'
|
||||
const PLUGINS = 'plugins' as MainPanelId
|
||||
const MARQDO = 'marqdo' as MainPanelId
|
||||
|
||||
/** Services used to register navigation, artwork and the read-only inventory. */
|
||||
export const inject = ['slots', 'locale', 'remote', 'remote.pluginInventory', 'remoteAccess', 'theme']
|
||||
|
||||
/**
|
||||
* Add MQDH branding and the Marqdo entry to the existing shell.
|
||||
* @param ctx - Browser context for the product profile.
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
ctx.effect(() => ctx.locale.register(NS, { en, zh }), 'mqdh: dictionaries')
|
||||
const t = ctx.locale.bind(NS)
|
||||
ctx.effect(() => {
|
||||
const icons = Array.from(document.querySelectorAll<HTMLLinkElement>('link[rel="icon"]'))
|
||||
const previous = icons.map(icon => icon.getAttribute('href'))
|
||||
icons.forEach((icon) => { icon.setAttribute('href', BRAND_ICON) })
|
||||
return () => {
|
||||
icons.forEach((icon, index) => {
|
||||
const href = previous[index]
|
||||
if (href === null || href === undefined) icon.removeAttribute('href')
|
||||
else icon.setAttribute('href', href)
|
||||
})
|
||||
}
|
||||
}, 'mqdh: favicon')
|
||||
ctx.slots.inject('sidebar.brand.mark', () =>
|
||||
ctx.slots.register({ name: 'sidebar.brand.mark' }, MarqdoMark))
|
||||
ctx.slots.inject('sidebar.brand.name', () =>
|
||||
ctx.slots.register({ name: 'sidebar.brand.name', locale: NS }, MarqdoName))
|
||||
ctx.slots.inject('conversation.hero.brand.mark', () =>
|
||||
ctx.slots.register({ name: 'conversation.hero.brand.mark' }, MarqdoMark))
|
||||
|
||||
const workbenchScheme: WorkbenchTheme['hooks']['workbenchScheme'] = {
|
||||
getSnapshot: () => ctx.theme.getTheme().active.colorScheme,
|
||||
subscribe: listener => ctx.on('theme/change', listener),
|
||||
}
|
||||
ctx.slots.inject('main', function* () {
|
||||
yield ctx.slots.register({
|
||||
name: 'main', key: MARQDO, locale: NS, inject: () => ({ hooks: { workbenchScheme } }),
|
||||
}, Workbench)
|
||||
yield ctx.slots.inject('sidebar.panellist', () =>
|
||||
ctx.slots.register({
|
||||
name: 'sidebar.panellist', id: MARQDO, order: 1, label: () => t('marqdo'),
|
||||
}, MarqdoMark))
|
||||
})
|
||||
|
||||
const loadInventory = async (): Promise<PluginInventorySnapshot['entries']> => {
|
||||
const result = await ctx.remote.pluginInventory.list()
|
||||
if (!result.ok) throw new Error('Plugin inventory is unavailable')
|
||||
return result.value.entries
|
||||
}
|
||||
|
||||
ctx.remoteAccess.whenAccess('pluginInventory/list', function* () {
|
||||
yield ctx.slots.inject('main', function* () {
|
||||
yield ctx.slots.register({
|
||||
name: 'main', key: PLUGINS, locale: NS, inject: () => ({ loadInventory }),
|
||||
}, PluginInventory)
|
||||
yield ctx.slots.inject('sidebar.panellist', () =>
|
||||
ctx.slots.register({
|
||||
name: 'sidebar.panellist', id: PLUGINS, order: 0, label: () => t('plugins'),
|
||||
}, PluginsIcon))
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/** Product navigation and read-only plugin inventory in English. */
|
||||
export const en = {
|
||||
product: 'Marqdo Harness',
|
||||
marqdo: 'Marqdo',
|
||||
plugins: 'Plugins',
|
||||
loading: 'Loading plugins…',
|
||||
failed: 'Plugins could not be loaded.',
|
||||
retry: 'Retry',
|
||||
empty: 'No plugins are configured.',
|
||||
enabled: 'Enabled',
|
||||
disabled: 'Disabled',
|
||||
failedPlugin: 'Failed to start',
|
||||
}
|
||||
|
||||
/** Product navigation and read-only plugin inventory in Simplified Chinese. */
|
||||
export const zh: Record<keyof typeof en, string> = {
|
||||
product: 'Marqdo Harness',
|
||||
marqdo: 'Marqdo',
|
||||
plugins: '插件',
|
||||
loading: '正在读取插件…',
|
||||
failed: '无法读取插件',
|
||||
retry: '重试',
|
||||
empty: '当前没有配置插件',
|
||||
enabled: '已启用',
|
||||
disabled: '已停用',
|
||||
failedPlugin: '启动失败',
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Host loader entry for the MQDH browser contribution. */
|
||||
export function apply(): void {}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.base.client.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib/types"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{ "path": "../../../vendor/cordis" },
|
||||
{ "path": "../../api/remote-access/tsconfig.client.json" },
|
||||
{ "path": "../../api/remotes/tsconfig.client.json" },
|
||||
{ "path": "../../client/locale/tsconfig.client.json" },
|
||||
{ "path": "../../client/ui-conversation/tsconfig.client.json" },
|
||||
{ "path": "../../client/ui-layout" },
|
||||
{ "path": "../../client/ui-primitives" },
|
||||
{ "path": "../../client/ui-renderer" },
|
||||
{ "path": "../../client/ui-sidebar" },
|
||||
{ "path": "../../client/ui-slots" },
|
||||
{ "path": "../../client/ui-theme/tsconfig.client.json" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { clientBundle } from '../../client/tsdown.client.ts'
|
||||
|
||||
export default clientBundle(import.meta.dirname, ['lib/types/index.js'])
|
||||
@@ -15575,9 +15575,51 @@ importers:
|
||||
'@marqdo/mqdh-harness':
|
||||
specifier: workspace:*
|
||||
version: link:../harness
|
||||
'@marqdo/mqdh-ui':
|
||||
specifier: workspace:*
|
||||
version: link:../ui
|
||||
|
||||
packages/marqdo/harness: {}
|
||||
|
||||
packages/marqdo/ui:
|
||||
devDependencies:
|
||||
'@deepseek-ai/cordis':
|
||||
specifier: workspace:~
|
||||
version: link:../../../vendor/cordis
|
||||
'@deepseek-ai/dsh-api-remote-access':
|
||||
specifier: workspace:*
|
||||
version: link:../../api/remote-access
|
||||
'@deepseek-ai/dsh-api-remotes':
|
||||
specifier: workspace:*
|
||||
version: link:../../api/remotes
|
||||
'@deepseek-ai/dsh-client-locale':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/locale
|
||||
'@deepseek-ai/dsh-client-ui-conversation':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-conversation
|
||||
'@deepseek-ai/dsh-client-ui-layout':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-layout
|
||||
'@deepseek-ai/dsh-client-ui-primitives':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-primitives
|
||||
'@deepseek-ai/dsh-client-ui-renderer':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-renderer
|
||||
'@deepseek-ai/dsh-client-ui-sidebar':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-sidebar
|
||||
'@deepseek-ai/dsh-client-ui-slots':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-slots
|
||||
'@deepseek-ai/dsh-client-ui-theme':
|
||||
specifier: workspace:*
|
||||
version: link:../../client/ui-theme
|
||||
react:
|
||||
specifier: ^18.2.0
|
||||
version: 18.3.1
|
||||
|
||||
packages/mcp/mcp-account:
|
||||
dependencies:
|
||||
'@deepseek-ai/dsh-brand':
|
||||
|
||||
@@ -25,7 +25,7 @@ if [ ! -f "$root/apps/cli/lib/bin.js" ]; then
|
||||
exit 1
|
||||
fi
|
||||
echo "mqdh ci: building repository artifacts"
|
||||
pnpm run build
|
||||
DSH_CLIENT_TITLE="Marqdo Harness" pnpm run build
|
||||
fi
|
||||
|
||||
cli="${MARQDO_BIN:-}"
|
||||
|
||||
@@ -154,7 +154,7 @@ internal static class MqdhLauncher
|
||||
if (openedUrl != null || line == null) return;
|
||||
Match match = WebUrl.Match(line);
|
||||
if (!match.Success) return;
|
||||
openedUrl = match.Value;
|
||||
openedUrl = "http://127.0.0.1:" + match.Groups[1].Value + "/mqdh";
|
||||
try { File.WriteAllText(UrlFile, openedUrl); } catch { }
|
||||
OpenWorkbench(openedUrl);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Build the MQDH Windows launcher (WinExe, no console window).
|
||||
#
|
||||
# The launcher only starts the bundled runtime and opens the inherited DSH Web
|
||||
# UI; it is not a second application shell. MQDH branding is tracked separately.
|
||||
# UI. Its icon is derived from the shared MQDH artwork.
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
@@ -19,7 +19,8 @@ if (-not $csc) { throw 'C# compiler (csc.exe) not found; install .NET Framework
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
|
||||
$target = Join-Path $OutDir 'MQDH.exe'
|
||||
& $csc /nologo /codepage:65001 /target:winexe /out:$target `
|
||||
$icon = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..\..\packages\marqdo\harness\assets\marqdo.ico')).Path
|
||||
& $csc /nologo /codepage:65001 /target:winexe /out:$target /win32icon:$icon `
|
||||
/r:System.Windows.Forms.dll /r:System.Drawing.dll `
|
||||
(Join-Path $PSScriptRoot 'MqdhLauncher.cs')
|
||||
if ($LASTEXITCODE -ne 0) { throw "launcher compilation failed: $LASTEXITCODE" }
|
||||
|
||||
@@ -87,6 +87,7 @@ async function ensureProfile(dshHome) {
|
||||
for (const [name, target] of [
|
||||
['mqdh-bundle', join(root, 'packages', 'marqdo', 'bundle')],
|
||||
['mqdh-harness', join(root, 'packages', 'marqdo', 'harness')],
|
||||
['mqdh-ui', join(root, 'packages', 'marqdo', 'ui')],
|
||||
]) {
|
||||
const link = join(nodeModules, name)
|
||||
// Junctions are the unprivileged Windows directory link; symbolic links
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$AppArchive,
|
||||
[string]$AppArchive = '',
|
||||
[string]$AppTree = '',
|
||||
[string]$OutDir = (Join-Path $PSScriptRoot '..\.ci'),
|
||||
[string]$SourceSha = '',
|
||||
[string]$LauncherExe = ''
|
||||
@@ -24,19 +24,28 @@ function Read-JsonFile {
|
||||
return [IO.File]::ReadAllText($Path, [Text.Encoding]::UTF8) | ConvertFrom-Json
|
||||
}
|
||||
|
||||
$archive = (Resolve-Path -LiteralPath $AppArchive).Path
|
||||
if (-not (Test-Path -LiteralPath $archive)) { throw "application archive is missing: $AppArchive" }
|
||||
if ($AppArchive -eq '' -and $AppTree -eq '') { throw 'pass -AppArchive or -AppTree' }
|
||||
if ($AppTree -ne '' -and -not (Test-Path -LiteralPath $AppTree)) { throw "application tree is missing: $AppTree" }
|
||||
$archive = ''
|
||||
if ($AppArchive -ne '') {
|
||||
$archive = (Resolve-Path -LiteralPath $AppArchive).Path
|
||||
if (-not (Test-Path -LiteralPath $archive)) { throw "application archive is missing: $AppArchive" }
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
|
||||
|
||||
$work = Join-Path ([IO.Path]::GetTempPath()) ("mqdh-portable-" + [guid]::NewGuid().ToString('N'))
|
||||
New-Item -ItemType Directory -Force -Path $work | Out-Null
|
||||
try {
|
||||
Write-Host "extracting verified application tree from $archive"
|
||||
& tar.exe -xzf $archive -C $work
|
||||
if ($LASTEXITCODE -ne 0) { throw "tar extraction failed: $LASTEXITCODE" }
|
||||
$top = Get-ChildItem -LiteralPath $work -Directory | Select-Object -First 1
|
||||
if (-not $top) { throw 'application archive has no top-level directory' }
|
||||
$tree = $top.FullName
|
||||
if ($AppTree -ne '') {
|
||||
$tree = (Resolve-Path -LiteralPath $AppTree).Path
|
||||
} else {
|
||||
Write-Host "extracting verified application tree from $archive"
|
||||
& tar.exe -xzf $archive -C $work
|
||||
if ($LASTEXITCODE -ne 0) { throw "tar extraction failed: $LASTEXITCODE" }
|
||||
$top = Get-ChildItem -LiteralPath $work -Directory | Select-Object -First 1
|
||||
if (-not $top) { throw 'application archive has no top-level directory' }
|
||||
$tree = $top.FullName
|
||||
}
|
||||
|
||||
$packageJson = Read-JsonFile (Join-Path $tree 'packages\marqdo\harness\package.json')
|
||||
$version = [string]$packageJson.version
|
||||
@@ -62,8 +71,12 @@ try {
|
||||
Copy-Item -LiteralPath $LauncherExe -Destination (Join-Path $tree 'MQDH.exe') -Force
|
||||
Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'launcher\README-Windows.txt') -Destination (Join-Path $tree 'README-Windows.txt') -Force
|
||||
|
||||
$staged = Join-Path $work $folder
|
||||
Move-Item -LiteralPath $tree -Destination $staged
|
||||
if ($AppTree -ne '') {
|
||||
$staged = $tree
|
||||
} else {
|
||||
$staged = Join-Path $work $folder
|
||||
Move-Item -LiteralPath $tree -Destination $staged
|
||||
}
|
||||
|
||||
$zipName = "$folder.zip"
|
||||
$zip = Join-Path $OutDir $zipName
|
||||
@@ -100,22 +113,22 @@ try {
|
||||
New-Item -ItemType Directory -Force -Path $verify | Out-Null
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $verify)
|
||||
$verifyTree = Join-Path $verify $folder
|
||||
$home = Join-Path $verify 'home'
|
||||
New-Item -ItemType Directory -Force -Path $home | Out-Null
|
||||
$userHome = Join-Path $verify 'home'
|
||||
New-Item -ItemType Directory -Force -Path $userHome | Out-Null
|
||||
$previousHome = $env:MQDH_HOME
|
||||
$env:MQDH_HOME = $home
|
||||
$env:MQDH_HOME = $userHome
|
||||
try {
|
||||
$launcher = Start-Process -FilePath (Join-Path $verifyTree 'MQDH.exe') -PassThru
|
||||
$urlFile = Join-Path $home 'workbench.url'
|
||||
$urlFile = Join-Path $userHome 'workbench.url'
|
||||
$deadline = (Get-Date).AddSeconds(180)
|
||||
while (-not (Test-Path -LiteralPath $urlFile) -and (Get-Date) -lt $deadline) { Start-Sleep -Milliseconds 500 }
|
||||
if (-not (Test-Path -LiteralPath $urlFile)) { throw 'portable launcher did not report a workbench URL' }
|
||||
$url = ([IO.File]::ReadAllText($urlFile)).Trim()
|
||||
$response = Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 30
|
||||
if ($response.StatusCode -ne 200) { throw "workbench returned $($response.StatusCode)" }
|
||||
$environment = Get-ChildItem -LiteralPath (Join-Path $home 'ecosystem\environments') -Directory -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
$environment = Get-ChildItem -LiteralPath (Join-Path $userHome 'ecosystem\environments') -Directory -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $environment) { throw 'portable launcher did not install a runtime environment' }
|
||||
$pidFile = Join-Path $home 'launcher.pid'
|
||||
$pidFile = Join-Path $userHome 'launcher.pid'
|
||||
if (Test-Path -LiteralPath $pidFile) {
|
||||
$serverPid = [int](([IO.File]::ReadAllText($pidFile)).Trim())
|
||||
& taskkill.exe /PID $serverPid /T /F | Out-Null
|
||||
@@ -137,7 +150,7 @@ try {
|
||||
version = $version
|
||||
workbench_http = $response.StatusCode
|
||||
runtime_environment = $environment.Name
|
||||
user_home = $home
|
||||
user_home = $userHome
|
||||
launch_requires_terminal = $false
|
||||
}
|
||||
unverified = @('code signing', 'native Windows CI runner', 'EXE installer desktop integration', 'MQDH-branded shell (marqdo-app-harness#25)')
|
||||
|
||||
@@ -32,7 +32,8 @@ mkdir -p "$app"
|
||||
# Copy the prebuilt tree without VCS data or local scratch.
|
||||
tar -C "$root" -cf - \
|
||||
--exclude=.git --exclude=.ci --exclude=.integration-work --exclude=.issue-work \
|
||||
--exclude=.app-verify --exclude=.dsh-build \
|
||||
--exclude=.app-verify --exclude=.dsh-build --exclude=.scratch --exclude=.build \
|
||||
--exclude=src-tauri/target --exclude=src-tauri/resources \
|
||||
--exclude=node_modules/.cache --exclude='*.log' --exclude='*.tsbuildinfo' . | tar -C "$app" -xf -
|
||||
|
||||
git rev-parse HEAD > "$app/SOURCE_SHA"
|
||||
|
||||
@@ -74,6 +74,32 @@ const uploads = [manifestPath, archivePath, sidecarPath, evidencePath]
|
||||
if (await stat(join(assets, 'mqdh-release.json.sig')).then(info => info.isFile()).catch(() => false)) {
|
||||
uploads.push(join(assets, 'mqdh-release.json.sig'))
|
||||
}
|
||||
// Official OS installers are additive assets described by the same manifest.
|
||||
// They are never a second release contract; the root reconcile verifies each
|
||||
// published byte like the portable archive.
|
||||
const installerRows = Array.isArray(manifest.installers) ? manifest.installers as Record<string, unknown>[] : []
|
||||
if (installerRows.length > 0) {
|
||||
if (manifest.signature !== undefined) throw new Error('signed manifests must be produced after installer attachment')
|
||||
for (const row of installerRows) {
|
||||
const name = row.name
|
||||
const format = row.format
|
||||
const target = row.target
|
||||
if (typeof name !== 'string' || typeof format !== 'string' || typeof target !== 'string') {
|
||||
throw new Error('invalid installer record in manifest')
|
||||
}
|
||||
const path = join(assets, name)
|
||||
const info = await stat(path)
|
||||
if (!info.isFile() || info.size !== row.size) throw new Error(`installer ${name} size does not match the manifest`)
|
||||
const bytes = await readFile(path)
|
||||
const installerDigest = createHash('sha256').update(bytes).digest('hex')
|
||||
if (installerDigest !== row.sha256) throw new Error(`installer ${name} digest does not match the manifest`)
|
||||
const installerSidecar = join(assets, `${name}.sha256`)
|
||||
if (!(await readFile(installerSidecar, 'utf8')).startsWith(installerDigest)) {
|
||||
throw new Error(`installer ${name} sidecar does not match`)
|
||||
}
|
||||
uploads.push(path, installerSidecar)
|
||||
}
|
||||
}
|
||||
for (const path of uploads) {
|
||||
const info = await stat(path)
|
||||
if (!info.isFile() || info.size === 0) throw new Error(`missing release asset: ${path}`)
|
||||
@@ -108,7 +134,7 @@ const release = await call('POST', '/releases', JSON.stringify({
|
||||
tag_name: tag,
|
||||
target_commitish: source,
|
||||
name: `Marqdo Harness ${version}`,
|
||||
body: `MQDH ${version} for ${String((manifest.platform as Record<string, unknown> | undefined)?.target ?? 'unknown')}.\n\nSource: \`${source}\`\nManifest: \`mqdh-release.json\`\n`,
|
||||
body: [`MQDH ${version}`, `Platforms: ${(installerRows.length > 0 ? installerRows : String((manifest.platform as Record<string, unknown> | undefined)?.target ?? 'unknown') as unknown as Record<string, unknown>[]).map(row => String(row.target ?? '')).filter(Boolean).join(', ')}`, '', `Source: ${source}`, 'Assets: one portable archive plus the official OS installer(s) described by `mqdh-release.json`; the shell never installs itself.', 'Update discovery is notification-only; no automatic download or install.'].join('\n'),
|
||||
draft: false,
|
||||
prerelease: version.includes('-'),
|
||||
}), 'application/json')
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# MQDH Tauri Linux build image (app-owned; not a shared ecosystem image).
|
||||
#
|
||||
# Base is the same Debian 12 / glibc 2.36 line the deb is built on. `debs/` and
|
||||
# `lists/` are populated by scripts/tauri/build-image.sh from the pinned Debian
|
||||
# bookworm package set so the image build itself needs no apt network access.
|
||||
FROM node:24.22.3-bookworm
|
||||
COPY lists/ /var/lib/apt/lists/
|
||||
COPY debs/ /tmp/debs/
|
||||
RUN cp /tmp/debs/*.deb /var/cache/apt/archives/ \
|
||||
&& apt-get install -y --no-install-recommends --no-download \
|
||||
libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libssl-dev \
|
||||
patchelf pkg-config build-essential file \
|
||||
&& rm -rf /tmp/debs /var/lib/apt/lists/*
|
||||
ENV RUSTUP_HOME=/opt/rustup CARGO_HOME=/opt/cargo
|
||||
RUN curl -sSf --retry 3 https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.100.0 \
|
||||
&& /opt/cargo/bin/cargo --version
|
||||
ENV PATH=/opt/cargo/bin:$PATH
|
||||
RUN npm i -g @tauri-apps/cli@2.13.0 && tauri --version
|
||||
WORKDIR /work
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Attach one platform installer to the existing MQDH release manifest/evidence.
|
||||
*
|
||||
* The manifest keeps its single `asset` (portable archive) for the existing
|
||||
* update/discovery consumers and adds an additive `installers` list describing
|
||||
* official OS installers. The root release contract reads the extra assets from
|
||||
* the published Release, so this is one contract, not a second version table.
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/tauri/attach-installers.mjs \
|
||||
* --installer .ci/mqdh-<v>-linux-x86_64.deb --format deb --target x86_64-unknown-linux-gnu
|
||||
*/
|
||||
import { createHash } from 'node:crypto'
|
||||
import { readFile, writeFile, stat } from 'node:fs/promises'
|
||||
import { basename, join, resolve } from 'node:path'
|
||||
|
||||
const outDir = resolve(process.env.MARQDO_CI_OUT ?? '.ci')
|
||||
const args = process.argv.slice(2)
|
||||
const installers = []
|
||||
for (let index = 0; index < args.length; index++) {
|
||||
const flag = args[index]
|
||||
const value = args[index + 1]
|
||||
if (flag === '--installer') {
|
||||
const path = value
|
||||
const format = args[index + 2]
|
||||
const target = args[index + 3]
|
||||
if (path === undefined || format === undefined || target === undefined
|
||||
|| format.startsWith('--') || target.startsWith('--')) {
|
||||
throw new Error('usage: --installer <path> <format> <target>')
|
||||
}
|
||||
index += 3
|
||||
installers.push({ path: resolve(path), format, target })
|
||||
continue
|
||||
}
|
||||
if (flag === '--format' || flag === '--target' || flag === '--path') {
|
||||
throw new Error('use --installer <path> <format> <target> (one triplet per installer)')
|
||||
}
|
||||
}
|
||||
if (installers.length === 0) throw new Error('at least one --installer is required')
|
||||
|
||||
const manifestPath = join(outDir, 'mqdh-release.json')
|
||||
const evidencePath = join(outDir, 'release-evidence.json')
|
||||
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
|
||||
const evidence = JSON.parse(await readFile(evidencePath, 'utf8'))
|
||||
if (manifest.signature !== undefined) {
|
||||
throw new Error('cannot add installers after the manifest was signed; sign once after packaging')
|
||||
}
|
||||
|
||||
const formatInfo = {
|
||||
deb: { os: 'linux', arch: 'x64', minimum_os: 'Ubuntu 24.04 / Debian 12 (glibc 2.39)' },
|
||||
nsis: { os: 'windows', arch: 'x64', minimum_os: 'Windows 10 22H2 / Windows 11 x64' },
|
||||
dmg: { os: 'macos', arch: 'arm64', minimum_os: 'macOS 11' },
|
||||
}
|
||||
const records = []
|
||||
for (const item of installers) {
|
||||
const info = formatInfo[item.format]
|
||||
if (info === undefined) throw new Error(`unsupported installer format: ${item.format}`)
|
||||
const bytes = await readFile(item.path)
|
||||
const sha256 = createHash('sha256').update(bytes).digest('hex')
|
||||
const size = (await stat(item.path)).size
|
||||
const name = basename(item.path)
|
||||
records.push({ name, size, sha256, target: item.target, ...info, format: item.format, signature: 'unsigned' })
|
||||
await writeFile(join(outDir, `${name}.sha256`), `${sha256} ${name}\n`, { mode: 0o644 })
|
||||
}
|
||||
manifest.installers = records
|
||||
await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, { mode: 0o644 })
|
||||
evidence.installers = records
|
||||
evidence.unverified = Array.from(new Set([
|
||||
...(Array.isArray(evidence.unverified) ? evidence.unverified : []),
|
||||
'installer OS signature/notarization is not configured for this build',
|
||||
]))
|
||||
await writeFile(evidencePath, `${JSON.stringify(evidence, null, 2)}\n`, { mode: 0o644 })
|
||||
process.stdout.write(`${JSON.stringify({ installers: records }, null, 2)}\n`)
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build (and optionally publish) the app-owned Tauri Linux build image.
|
||||
#
|
||||
# The image embeds the pinned Debian bookworm package set used to build the
|
||||
# `.deb`; it is an app build environment, not a shared ecosystem image and not a
|
||||
# product release. Immutable tag: `git.cflmy.cn/cflmy/mqdh-tauri-build:<version>`.
|
||||
#
|
||||
# scripts/tauri/build-image.sh # build only
|
||||
# scripts/tauri/build-image.sh --push # build + push (needs MARQDO_GIT_TOKEN)
|
||||
#
|
||||
# Package inputs: `.build/tauri-image/{debs,lists}` (generated once from a
|
||||
# bookworm container with `apt-get download`/`apt-get update`; see TAURI.md).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
root="$PWD"
|
||||
tag="${MQDH_TAURI_IMAGE_TAG:-0.2.0}"
|
||||
registry="${MQDH_TAURI_IMAGE_REGISTRY:-git.cflmy.cn/cflmy}"
|
||||
context="$root/.build/tauri-image"
|
||||
test -d "$context/debs" || { echo "missing $context/debs" >&2; exit 1; }
|
||||
test -d "$context/lists" || { echo "missing $context/lists" >&2; exit 1; }
|
||||
cp scripts/tauri/Dockerfile "$context/Dockerfile"
|
||||
export DOCKER_CONFIG="${DOCKER_CONFIG:-$root/.build/docker-config}"
|
||||
docker build -t "mqdh-tauri-build:$tag" -f "$context/Dockerfile" "$context"
|
||||
docker tag "mqdh-tauri-build:$tag" "$registry/mqdh-tauri-build:$tag"
|
||||
if [ "${1:-}" = "--push" ]; then
|
||||
: "${MARQDO_GIT_TOKEN:?set MARQDO_GIT_TOKEN to publish the image}"
|
||||
echo "$MARQDO_GIT_TOKEN" | docker login "${registry%%/*}" -u "${MARQDO_GIT_USERNAME:-cflmy}" --password-stdin
|
||||
docker push "$registry/mqdh-tauri-build:$tag"
|
||||
echo "published $registry/mqdh-tauri-build:$tag"
|
||||
fi
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the Linux `.deb` MQDH installer from one frozen source SHA.
|
||||
#
|
||||
# Requires the `mqdh-tauri-build` image (Rust 1.100 + WebKitGTK + Tauri CLI) and
|
||||
# the locked Node workspace already installed/built by the CI lanes.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
version="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' packages/marqdo/harness/package.json | head -1)"
|
||||
test -n "$version"
|
||||
target="x86_64-unknown-linux-gnu"
|
||||
out="${MARQDO_CI_OUT:-.ci}"
|
||||
mkdir -p "$out"
|
||||
|
||||
archive="$out/marqdo-harness-${version}-${target}.tar.gz"
|
||||
if [ ! -f "$archive" ]; then
|
||||
MQDH_PACKAGE_WORK="${MQDH_PACKAGE_WORK:-/tmp/mqdh-package}" bash scripts/package.sh
|
||||
fi
|
||||
test -f "$archive"
|
||||
bash scripts/tauri/prepare-resources.sh
|
||||
|
||||
if [ ! -f src-tauri/icons/icon.ico ] || [ ! -f src-tauri/icons/icon.icns ]; then
|
||||
tauri icon apps/desktop/resources/icon.png --output src-tauri/icons >/dev/null
|
||||
fi
|
||||
|
||||
export MQDH_SOURCE_SHA="$(git rev-parse HEAD)"
|
||||
# Tauri 2.13 downloads a GStreamer asset plugin at deb bundle time. The app does
|
||||
# not enable the asset protocol (`app.security.assetProtocol.enable=false`), and
|
||||
# direct GitHub access is not available in the CI network: fetch any bundler
|
||||
# asset through the reviewed internal mirror instead.
|
||||
export TAURI_BUNDLER_TOOLS_GITHUB_MIRROR="${TAURI_BUNDLER_TOOLS_GITHUB_MIRROR:-https://ghproxy.cflmy.top/}"
|
||||
tauri build --bundles deb --config "{\"version\":\"$version\"}"
|
||||
|
||||
deb="$(find src-tauri/target/release/bundle/deb -maxdepth 1 -name '*.deb' | head -1)"
|
||||
test -n "$deb"
|
||||
final="$out/mqdh-${version}-linux-x86_64.deb"
|
||||
cp "$deb" "$final"
|
||||
|
||||
node scripts/tauri/attach-installers.mjs --installer "$final" deb "$target"
|
||||
|
||||
# Smoke the exact deb bytes: unpack, read the desktop version, start the real
|
||||
# bundled backend on loopback through the packaged tree, then stop it.
|
||||
smoke="$(mktemp -d)"
|
||||
trap 'rm -rf "$smoke"' EXIT
|
||||
dpkg-deb -x "$final" "$smoke/root"
|
||||
binary="$(find "$smoke/root" -type f -name mqdh-desktop | head -1)"
|
||||
test -n "$binary"
|
||||
"$binary" --version
|
||||
MQDH_HOME="$smoke/home" "$binary" --smoke
|
||||
echo "build-linux: OK $final"
|
||||
ls -l "$final" "$out"/mqdh-release.json "$out"/release-evidence.json
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
# MQDH Tauri macOS DMG build (native macOS only).
|
||||
#
|
||||
# Signing/notarization uses the standard Apple Developer ID environment when
|
||||
# present. Without credentials the build is explicitly unsigned; it is never
|
||||
# reported as notarized and cannot be a `supported` release by itself.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
[ "$(uname -s)" = "Darwin" ] || { echo "build-macos.sh requires a native macOS agent" >&2; exit 1; }
|
||||
|
||||
version="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' packages/marqdo/harness/package.json | head -1)"
|
||||
test -n "$version"
|
||||
target="aarch64-apple-darwin"
|
||||
out="${MARQDO_CI_OUT:-.ci}"
|
||||
mkdir -p "$out"
|
||||
corepack enable
|
||||
corepack prepare pnpm@11.28.5 --activate
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
bash scripts/tauri/stage-tree.sh
|
||||
if [ ! -f src-tauri/icons/icon.icns ]; then tauri icon apps/desktop/resources/icon.png --output src-tauri/icons >/dev/null; fi
|
||||
export MQDH_SOURCE_SHA="$(git rev-parse HEAD)"
|
||||
export CI=true
|
||||
if [ -n "${APPLE_SIGNING_IDENTITY:-}" ] && [ -n "${APPLE_ID:-}" ] && [ -n "${APPLE_PASSWORD:-}" ] && [ -n "${APPLE_TEAM_ID:-}" ]; then
|
||||
tauri build --bundles dmg --config "{\"version\":\"$version\"}" --target "$target"
|
||||
signed=1
|
||||
else
|
||||
tauri build --bundles dmg --config "{\"version\":\"$version\"}" --target "$target"
|
||||
signed=0
|
||||
echo "build-macos: no Developer ID credentials; building explicitly unsigned" >&2
|
||||
fi
|
||||
dmg="$(find src-tauri/target/"$target"/release/bundle/dmg -maxdepth 1 -name '*.dmg' | head -1)"
|
||||
test -n "$dmg"
|
||||
final="$out/mqdh-${version}-macos-aarch64.dmg"
|
||||
cp "$dmg" "$final"
|
||||
node scripts/tauri/attach-installers.mjs --installer "$final" --format dmg --target "$target"
|
||||
# Smoke the mounted app on the native host.
|
||||
mount="$(mktemp -d)"
|
||||
hdiutil attach -nobrowse -readonly -mountpoint "$mount" "$final" >/dev/null
|
||||
app="$(find "$mount" -maxdepth 2 -name 'MQDH.app' | head -1)"
|
||||
test -n "$app"
|
||||
"$app/Contents/MacOS/mqdh-desktop" --version
|
||||
MQDH_HOME="$(mktemp -d)" "$app/Contents/MacOS/mqdh-desktop" --smoke
|
||||
hdiutil detach "$mount" >/dev/null
|
||||
if [ "$signed" = "1" ]; then
|
||||
codesign --verify --deep --strict "$app"
|
||||
spctl --assess --type execute "$app"
|
||||
fi
|
||||
echo "build-macos: OK $final (signed=$signed)"
|
||||
@@ -0,0 +1,38 @@
|
||||
# MQDH Tauri Windows NSIS build (native Windows only).
|
||||
#
|
||||
# Runs on a real Windows build agent, not under Wine and not cross-compiled from
|
||||
# Linux. Installation/uninstallation smoke must run on a clean Windows target.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($env:OS -ne 'Windows_NT') { throw 'build-windows.ps1 requires a native Windows agent' }
|
||||
if (-not (Get-Command bash -ErrorAction SilentlyContinue)) { throw 'Git Bash is required for the shared staging scripts' }
|
||||
if (-not (Get-Command node -ErrorAction SilentlyContinue)) { throw 'Node 24 is required' }
|
||||
if (-not (Get-Command pnpm -ErrorAction SilentlyContinue)) { throw 'pnpm 11 is required' }
|
||||
|
||||
$version = (Get-Content packages/marqdo/harness/package.json -Raw | ConvertFrom-Json).version
|
||||
corepack enable
|
||||
corepack prepare pnpm@11.28.5 --activate
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
bash scripts/tauri/stage-tree.sh
|
||||
# The shared staging script bundles the POSIX node name; the Windows runtime is node.exe.
|
||||
if (Test-Path src-tauri/resources/mqdh/runtime/node) {
|
||||
Move-Item -Force src-tauri/resources/mqdh/runtime/node src-tauri/resources/mqdh/runtime/node.exe
|
||||
}
|
||||
if (-not (Test-Path src-tauri/icons/icon.ico)) { tauri icon apps/desktop/resources/icon.png --output src-tauri/icons }
|
||||
$env:MQDH_SOURCE_SHA = (git rev-parse HEAD)
|
||||
tauri build --bundles nsis --config "{`"version`":`"$version`"}"
|
||||
$setup = Get-ChildItem src-tauri/target/release/bundle/nsis -Filter '*.exe' | Select-Object -First 1
|
||||
if (-not $setup) { throw 'NSIS installer was not produced' }
|
||||
New-Item -ItemType Directory -Force .ci | Out-Null
|
||||
$final = ".ci/mqdh-$version-windows-x86_64-setup.exe"
|
||||
Copy-Item $setup.FullName $final
|
||||
node scripts/tauri/attach-installers.mjs --installer $final --format nsis --target x86_64-pc-windows-msvc
|
||||
& $final /S
|
||||
$installed = Join-Path $env:LOCALAPPDATA 'MQDH\MQDH.exe'
|
||||
if (-not (Test-Path $installed)) { throw "per-user NSIS install not found: $installed" }
|
||||
& $installed --version
|
||||
$home = Join-Path $env:TEMP ("mqdh-smoke-" + [guid]::NewGuid())
|
||||
$env:MQDH_HOME = $home
|
||||
& $installed --smoke
|
||||
if (Test-Path $installed) { & (Join-Path $env:LOCALAPPDATA 'MQDH\uninstall.exe') /S }
|
||||
Write-Output "build-windows: OK $final"
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage the verified portable tree as one Tauri resource archive.
|
||||
#
|
||||
# Tauri's Linux deb walker drops symlinks, and a pnpm `node_modules` tree is
|
||||
# built from symlinks. Shipping the cold-install-verified `.tar.gz` as a single
|
||||
# resource keeps the exact verified tree (symlinks intact) and lets the shell
|
||||
# extract it once into `MQDH_HOME/runtime` on first start.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
version="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' packages/marqdo/harness/package.json | head -1)"
|
||||
test -n "$version"
|
||||
archive="${1:-.ci/marqdo-harness-${version}-x86_64-unknown-linux-gnu.tar.gz}"
|
||||
test -f "$archive" || { echo "prepare-resources: missing $archive; run scripts/package.sh first" >&2; exit 1; }
|
||||
resources="src-tauri/resources"
|
||||
rm -rf "$resources"
|
||||
mkdir -p "$resources"
|
||||
cp "$archive" "$resources/mqdh-runtime.tar.gz"
|
||||
# The archive must contain the launcher, built CLI and web entries plus the
|
||||
# Node runtime; this is the same tree scripts/package.sh cold-installed. Write
|
||||
# the listing once: `tar | grep -q` would trip pipefail via SIGPIPE.
|
||||
listing="$(mktemp)"
|
||||
trap 'rm -f "$listing"' EXIT
|
||||
tar -tzf "$resources/mqdh-runtime.tar.gz" > "$listing"
|
||||
grep -qE '^[^/]+/scripts/mqdh\.mjs$' "$listing"
|
||||
grep -qE '^[^/]+/runtime/node$' "$listing"
|
||||
grep -qE '^[^/]+/apps/web/dist/index\.html$' "$listing"
|
||||
ls -lh "$resources/mqdh-runtime.tar.gz"
|
||||
echo "prepare-resources: OK $resources/mqdh-runtime.tar.gz"
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage the production MQDH tree for a native Tauri build on Windows/macOS.
|
||||
#
|
||||
# Linux reuses the cold-install-verified archive from scripts/package.sh; the
|
||||
# native lanes stage the same repository content and the platform Node runtime,
|
||||
# because the portable archive and install.sh are POSIX-only conveniences.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
root="$PWD"
|
||||
resources="src-tauri/resources"
|
||||
rm -rf "$resources"
|
||||
mkdir -p "$resources/mqdh"
|
||||
tar -C "$root" -cf - \
|
||||
--exclude=.git --exclude=.ci --exclude=.build --exclude=.scratch \
|
||||
--exclude=.issue-work --exclude=.app-verify --exclude=.integration-work \
|
||||
--exclude=node_modules/.cache --exclude='*.log' --exclude='*.tsbuildinfo' \
|
||||
--exclude=src-tauri/target --exclude=src-tauri/resources . \
|
||||
| tar -C "$resources/mqdh" -xf -
|
||||
git rev-parse HEAD > "$resources/mqdh/SOURCE_SHA"
|
||||
mkdir -p "$resources/mqdh/runtime"
|
||||
node_binary="$(command -v node)"
|
||||
cp "$node_binary" "$resources/mqdh/runtime/node"
|
||||
"$resources/mqdh/runtime/node" --version > "$resources/mqdh/runtime/VERSION"
|
||||
test -f "$resources/mqdh/scripts/mqdh.mjs"
|
||||
test -f "$resources/mqdh/apps/cli/lib/bin.js"
|
||||
test -f "$resources/mqdh/apps/web/dist/index.html"
|
||||
echo "stage-tree: OK $resources/mqdh"
|
||||
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
name = "mqdh-desktop"
|
||||
version = "0.0.0"
|
||||
description = "MQDH Tauri desktop shell for the existing Marqdo Harness workbench"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-single-instance = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
dirs = "6"
|
||||
open = "5"
|
||||
flate2 = "1"
|
||||
tar = "0.4"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
opt-level = "s"
|
||||
panic = "abort"
|
||||
strip = true
|
||||
@@ -0,0 +1,24 @@
|
||||
//! Tauri build glue.
|
||||
//!
|
||||
//! The product version is owned by `packages/marqdo/harness/package.json`; it
|
||||
//! is embedded here only as a diagnostic (`--version`) value. The bundle
|
||||
//! version is supplied by `scripts/tauri/build-linux.sh` through `--config`,
|
||||
//! so there is no second version authority to maintain.
|
||||
use std::{env, fs, path::Path};
|
||||
|
||||
fn main() {
|
||||
let manifest = Path::new("../packages/marqdo/harness/package.json");
|
||||
println!("cargo:rerun-if-changed={}", manifest.display());
|
||||
let text = fs::read_to_string(manifest).expect("read packages/marqdo/harness/package.json");
|
||||
let version = text
|
||||
.split("\"version\"")
|
||||
.nth(1)
|
||||
.and_then(|rest| rest.split('"').nth(1))
|
||||
.expect("product manifest has no version");
|
||||
assert!(!version.is_empty(), "product version is empty");
|
||||
println!("cargo:rustc-env=MQDH_PRODUCT_VERSION={version}");
|
||||
if let Ok(source) = env::var("MQDH_SOURCE_SHA") {
|
||||
println!("cargo:rustc-env=MQDH_EMBEDDED_SOURCE_SHA={source}");
|
||||
}
|
||||
tauri_build::build();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "The MQDH shell exposes only Tauri core defaults. It has no shell, filesystem, HTTP or process permissions; the backend is started and supervised by the Rust layer.",
|
||||
"windows": ["main"],
|
||||
"permissions": ["core:default"]
|
||||
}
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 98 KiB |
@@ -0,0 +1,557 @@
|
||||
//! MQDH desktop shell (Tauri 2).
|
||||
//!
|
||||
//! This crate contains desktop adaptation only. The product UI, routes,
|
||||
//! business state and Harness service stay in the existing MQDH workbench. The
|
||||
//! shell:
|
||||
//!
|
||||
//! 1. resolves the bundled, prebuilt MQDH tree and its Node runtime;
|
||||
//! 2. starts the existing `scripts/mqdh.mjs` launcher on loopback with an
|
||||
//! OS-assigned port;
|
||||
//! 3. waits for the readiness line printed by the existing DSH web server and
|
||||
//! loads the one workbench URL in the system WebView;
|
||||
//! 4. closes only the process tree it started.
|
||||
//!
|
||||
//! There is no generic shell/process/filesystem IPC: the WebView can only
|
||||
//! navigate inside the local origin this process started. No updater lives in
|
||||
//! the shell; update discovery remains in the existing MQDH distribution code.
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Child, Command, Stdio};
|
||||
use std::sync::atomic::{AtomicU16, Ordering};
|
||||
use std::sync::mpsc;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use flate2::read::GzDecoder;
|
||||
use tar::Archive;
|
||||
use tauri::{Manager, RunEvent, Url, WebviewUrl, WebviewWindowBuilder};
|
||||
|
||||
/// Product version embedded from the package manifest at compile time.
|
||||
const VERSION: &str = env!("MQDH_PRODUCT_VERSION");
|
||||
|
||||
/// Source SHA embedded by the release build when available.
|
||||
const SOURCE_SHA: &str = match option_env!("MQDH_EMBEDDED_SOURCE_SHA") {
|
||||
Some(value) => value,
|
||||
None => "",
|
||||
};
|
||||
|
||||
/// Loopback host used by the existing MQDH launcher.
|
||||
const LOOPBACK: &str = "127.0.0.1";
|
||||
|
||||
/// Readiness budget for a cold first start (resource extraction, profile setup).
|
||||
const READY_TIMEOUT: Duration = Duration::from_secs(120);
|
||||
|
||||
/// One owned backend process tree.
|
||||
struct ShellState {
|
||||
child: Mutex<Option<Child>>,
|
||||
port: AtomicU16,
|
||||
home: PathBuf,
|
||||
tree: PathBuf,
|
||||
}
|
||||
|
||||
impl ShellState {
|
||||
/// Stop only the process tree this shell started, never unrelated services.
|
||||
fn stop(&self) {
|
||||
let Some(mut child) = self.child.lock().ok().and_then(|mut guard| guard.take()) else {
|
||||
return;
|
||||
};
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let pid = child.id() as i32;
|
||||
// The child was started as its own process group, so the negative
|
||||
// pid targets the launcher and every descendant it owns.
|
||||
unsafe { libc::kill(-pid, libc::SIGTERM) };
|
||||
let deadline = Instant::now() + Duration::from_secs(8);
|
||||
while Instant::now() < deadline {
|
||||
if matches!(child.try_wait(), Ok(Some(_))) {
|
||||
return;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
unsafe { libc::kill(-pid, libc::SIGKILL) };
|
||||
let _ = child.wait();
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let _ = Command::new("taskkill")
|
||||
.args(["/PID", &child.id().to_string(), "/T", "/F"])
|
||||
.output();
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
}
|
||||
#[cfg(not(any(unix, windows)))]
|
||||
{
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ShellState {
|
||||
fn drop(&mut self) {
|
||||
self.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// Redact the readiness token before persisting diagnostics.
|
||||
fn redact(line: &str) -> String {
|
||||
let mut value = line.to_string();
|
||||
if let Some(index) = value.find("token=") {
|
||||
let start = index + "token=".len();
|
||||
let end = value[start..]
|
||||
.find(|character: char| character == '&' || character.is_whitespace())
|
||||
.map(|offset| start + offset)
|
||||
.unwrap_or(value.len());
|
||||
value.replace_range(start..end, "<redacted>");
|
||||
}
|
||||
value
|
||||
}
|
||||
|
||||
/// Append one line to the shell log; never fail startup because logging failed.
|
||||
fn log_line(home: &Path, message: &str) {
|
||||
let directory = home.join("logs");
|
||||
if fs::create_dir_all(&directory).is_err() {
|
||||
return;
|
||||
}
|
||||
let line = format!(
|
||||
"{} {} {}\n",
|
||||
chrono_like_now(),
|
||||
if SOURCE_SHA.is_empty() { "-" } else { SOURCE_SHA },
|
||||
redact(message)
|
||||
);
|
||||
if let Ok(mut file) = OpenOptions::new().create(true).append(true).open(directory.join("mqdh-desktop.log")) {
|
||||
let _ = file.write_all(line.as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
/// UTC timestamp without pulling a date-time dependency into the shell.
|
||||
fn chrono_like_now() -> String {
|
||||
let seconds = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.map(|duration| duration.as_secs())
|
||||
.unwrap_or(0);
|
||||
format!("unix:{seconds}")
|
||||
}
|
||||
|
||||
/// Resolve the same `MQDH_HOME` the CLI and the portable launch use, so an
|
||||
/// existing user keeps their knowledge, configuration and runtime.
|
||||
fn resolve_home() -> PathBuf {
|
||||
if let Some(value) = std::env::var_os("MQDH_HOME") {
|
||||
if !value.is_empty() {
|
||||
return PathBuf::from(value);
|
||||
}
|
||||
}
|
||||
if let Some(value) = std::env::var_os("XDG_DATA_HOME") {
|
||||
if !value.is_empty() {
|
||||
return PathBuf::from(value).join("marqdo-harness");
|
||||
}
|
||||
}
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
return home.join(".local").join("share").join("marqdo-harness");
|
||||
}
|
||||
PathBuf::from(".mqdh")
|
||||
}
|
||||
|
||||
/// Extract the verified portable tree into the user data directory once.
|
||||
///
|
||||
/// Tauri's Linux deb walker drops symlinks, and the pnpm `node_modules` tree is
|
||||
/// symlink-based. The installer therefore ships the cold-install-verified
|
||||
/// `.tar.gz` as one resource and the shell materialises it here, preserving the
|
||||
/// exact bytes and symlinks. Later starts reuse the completed tree.
|
||||
fn ensure_runtime(archive: &Path, home: &Path) -> Result<(PathBuf, PathBuf), String> {
|
||||
let root = home.join("runtime");
|
||||
let tree = root.join("mqdh");
|
||||
let node_name = if cfg!(windows) { "node.exe" } else { "node" };
|
||||
let marked = tree.join(".complete");
|
||||
if marked.is_file()
|
||||
&& tree.join("scripts").join("mqdh.mjs").is_file()
|
||||
&& tree.join("runtime").join(node_name).is_file()
|
||||
{
|
||||
return Ok((tree.clone(), tree.join("runtime").join(node_name)));
|
||||
}
|
||||
fs::create_dir_all(&root).map_err(|error| format!("cannot create {}: {error}", root.display()))?;
|
||||
let temporary = root.join(format!("extract-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&temporary);
|
||||
fs::create_dir_all(&temporary).map_err(|error| format!("cannot create extraction dir: {error}"))?;
|
||||
log_line(home, &format!("runtime: extracting {}", archive.display()));
|
||||
let file = File::open(archive).map_err(|error| format!("cannot open {}: {error}", archive.display()))?;
|
||||
let mut bundle = Archive::new(GzDecoder::new(file));
|
||||
let entries = bundle.entries().map_err(|error| format!("cannot read runtime archive: {error}"))?;
|
||||
for entry in entries {
|
||||
let mut entry = entry.map_err(|error| format!("cannot read runtime entry: {error}"))?;
|
||||
let path = entry.path().map_err(|error| format!("invalid runtime entry path: {error}"))?.to_path_buf();
|
||||
if path.is_absolute()
|
||||
|| path.components().any(|component| matches!(component, std::path::Component::ParentDir))
|
||||
{
|
||||
return Err(format!("runtime archive contains an unsafe path: {}", path.display()));
|
||||
}
|
||||
entry
|
||||
.unpack_in(&temporary)
|
||||
.map_err(|error| format!("cannot unpack {}: {error}", path.display()))?;
|
||||
}
|
||||
let top = fs::read_dir(&temporary)
|
||||
.map_err(|error| format!("cannot inspect extraction dir: {error}"))?
|
||||
.filter_map(Result::ok)
|
||||
.find(|entry| entry.path().is_dir())
|
||||
.map(|entry| entry.path())
|
||||
.ok_or_else(|| "runtime archive has no tree directory".to_string())?;
|
||||
let _ = fs::remove_dir_all(&tree);
|
||||
fs::rename(&top, &tree).map_err(|error| format!("cannot activate runtime tree: {error}"))?;
|
||||
let _ = fs::remove_dir_all(&temporary);
|
||||
let node = tree.join("runtime").join(node_name);
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if let Ok(metadata) = fs::metadata(&node) {
|
||||
let mut permissions = metadata.permissions();
|
||||
permissions.set_mode(0o755);
|
||||
let _ = fs::set_permissions(&node, permissions);
|
||||
}
|
||||
}
|
||||
fs::write(&marked, b"ok\n").map_err(|error| format!("cannot mark runtime tree: {error}"))?;
|
||||
if !tree.join("scripts").join("mqdh.mjs").is_file() || !node.is_file() {
|
||||
return Err("extracted runtime tree is incomplete".to_string());
|
||||
}
|
||||
log_line(home, &format!("runtime: ready {}", tree.display()));
|
||||
Ok((tree, node))
|
||||
}
|
||||
|
||||
/// Locate a bundled runtime archive beside the executable (deb/windows layout).
|
||||
fn resolve_runtime(home: &Path, app: Option<&tauri::AppHandle>, executable: &Path) -> Result<(PathBuf, PathBuf), String> {
|
||||
if let Some(value) = std::env::var_os("MQDH_TAURI_TREE") {
|
||||
let tree = PathBuf::from(value);
|
||||
let node = if cfg!(windows) { tree.join("runtime").join("node.exe") } else { tree.join("runtime").join("node") };
|
||||
if tree.join("scripts").join("mqdh.mjs").is_file() && node.is_file() {
|
||||
return Ok((tree, node));
|
||||
}
|
||||
}
|
||||
let mut archives: Vec<PathBuf> = Vec::new();
|
||||
if let Some(app) = app {
|
||||
if let Ok(resource) = app.path().resource_dir() {
|
||||
archives.push(resource.join("mqdh-runtime.tar.gz"));
|
||||
}
|
||||
}
|
||||
if let Some(value) = std::env::var_os("MQDH_TAURI_RUNTIME_ARCHIVE") {
|
||||
archives.push(PathBuf::from(value));
|
||||
}
|
||||
if let Some(directory) = executable.parent() {
|
||||
archives.push(directory.join("..").join("lib").join("MQDH").join("mqdh-runtime.tar.gz"));
|
||||
archives.push(directory.join("resources").join("mqdh-runtime.tar.gz"));
|
||||
}
|
||||
archives.push(PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("resources").join("mqdh-runtime.tar.gz"));
|
||||
for archive in archives {
|
||||
if archive.is_file() {
|
||||
return ensure_runtime(&archive, home);
|
||||
}
|
||||
}
|
||||
Err("bundled MQDH runtime archive is missing from the installation".to_string())
|
||||
}
|
||||
|
||||
/// Locate the local workbench URL in the launcher's readiness output.
|
||||
fn extract_url(line: &str) -> Option<String> {
|
||||
let marker = format!("http://{LOOPBACK}:");
|
||||
let start = line.find(&marker)?;
|
||||
let tail = line.get(start..)?;
|
||||
let end = tail
|
||||
.find(|character: char| character.is_whitespace())
|
||||
.unwrap_or(tail.len());
|
||||
let url = tail.get(..end)?.trim();
|
||||
if url.contains("token=") {
|
||||
Some(url.to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the backend command with the existing launcher and product home.
|
||||
fn backend_command(node: &Path, tree: &Path, home: &Path) -> Command {
|
||||
let script = tree.join("scripts").join("mqdh.mjs");
|
||||
let mut command = Command::new(node);
|
||||
command
|
||||
.arg(script)
|
||||
.arg("--host")
|
||||
.arg(LOOPBACK)
|
||||
.arg("--port")
|
||||
.arg("0")
|
||||
.arg("--no-open")
|
||||
.current_dir(tree)
|
||||
.env("MQDH_HOME", home)
|
||||
.env("MQDH_TAURI", "1")
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::process::CommandExt;
|
||||
command.process_group(0);
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
// CREATE_NO_WINDOW: the launcher is a helper, not a user-facing console.
|
||||
command.creation_flags(0x08000000);
|
||||
}
|
||||
command
|
||||
}
|
||||
|
||||
/// Render a static startup error inside the window without a second page build.
|
||||
fn show_error(window: &tauri::WebviewWindow, detail: &str) {
|
||||
let escaped = serde_json::to_string(detail).unwrap_or_else(|_| "\"启动失败\"".to_string());
|
||||
let script = format!(
|
||||
"document.body.innerHTML = '<main style=\"max-width:36rem;padding:2rem;font:14px/1.7 system-ui,sans-serif\"><h1 style=\"font-size:1.15rem\">MQDH 未能启动本地工作台</h1><p>本地 Harness 服务启动超时或异常退出。应用只使用本机回环服务。</p><p style=\"opacity:.7\">请退出后重新打开;诊断日志位于用户数据目录的 logs/mqdh-desktop.log。</p><p style=\"opacity:.5;font-size:.85em\"></p></main>'; document.querySelector('p:last-child').textContent = {escaped};"
|
||||
);
|
||||
let _ = window.eval(&script);
|
||||
}
|
||||
|
||||
/// Test-only smoke: start the real bundled backend through the packaged tree
|
||||
/// without creating a window, so CI can prove resources + launcher + readiness
|
||||
/// on a headless Linux host. It never connects to a non-loopback origin.
|
||||
fn run_smoke() -> ! {
|
||||
let home = resolve_home();
|
||||
let _ = fs::create_dir_all(&home);
|
||||
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("mqdh-desktop"));
|
||||
let (tree, node) = match resolve_runtime(&home, None, &exe) {
|
||||
Ok(value) => value,
|
||||
Err(error) => {
|
||||
eprintln!("mqdh-desktop-smoke: FAIL {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
log_line(&home, &format!("smoke: tree={} version={VERSION}", tree.display()));
|
||||
let mut command = backend_command(&node, &tree, &home);
|
||||
let mut child = match command.spawn() {
|
||||
Ok(child) => child,
|
||||
Err(error) => {
|
||||
eprintln!("mqdh-desktop-smoke: FAIL spawn {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
let Some(stdout) = child.stdout.take() else {
|
||||
eprintln!("mqdh-desktop-smoke: FAIL no backend stdout");
|
||||
let _ = child.kill();
|
||||
std::process::exit(1);
|
||||
};
|
||||
let (ready_tx, ready_rx) = mpsc::channel::<u16>();
|
||||
std::thread::spawn(move || {
|
||||
let reader = BufReader::new(stdout);
|
||||
for line in reader.lines().map_while(Result::ok) {
|
||||
if let Some(url) = extract_url(&line) {
|
||||
if let Ok(parsed) = Url::parse(&url) {
|
||||
if let Some(port) = parsed.port() {
|
||||
let _ = ready_tx.send(port);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
match ready_rx.recv_timeout(READY_TIMEOUT) {
|
||||
Ok(port) => {
|
||||
println!("mqdh-desktop-smoke: ready origin=http://{LOOPBACK}:{port}");
|
||||
let pid = child.id() as i32;
|
||||
#[cfg(unix)]
|
||||
unsafe { libc::kill(-pid, libc::SIGTERM) };
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let _ = Command::new("taskkill").args(["/PID", &pid.to_string(), "/T", "/F"]).output();
|
||||
}
|
||||
let deadline = Instant::now() + Duration::from_secs(8);
|
||||
while Instant::now() < deadline {
|
||||
if matches!(child.try_wait(), Ok(Some(_))) {
|
||||
break;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
std::process::exit(0);
|
||||
}
|
||||
Err(_) => {
|
||||
log_line(&home, "smoke: readiness timeout");
|
||||
eprintln!("mqdh-desktop-smoke: FAIL readiness timeout");
|
||||
let _ = child.kill();
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let arguments: Vec<String> = std::env::args().skip(1).collect();
|
||||
if arguments.iter().any(|argument| argument == "--version" || argument == "-V") {
|
||||
println!("mqdh {VERSION}");
|
||||
return;
|
||||
}
|
||||
if arguments.iter().any(|argument| argument == "--smoke") {
|
||||
run_smoke();
|
||||
}
|
||||
// Window startup never handles smoke; the branch is kept false so the
|
||||
// shared setup below has one code path.
|
||||
let smoke = false;
|
||||
|
||||
let builder = tauri::Builder::default().plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.show();
|
||||
let _ = window.unminimize();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}));
|
||||
|
||||
let app = builder
|
||||
.setup(move |app| {
|
||||
let home = resolve_home();
|
||||
let executable = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("mqdh-desktop"));
|
||||
let (tree, node) = match resolve_runtime(&home, Some(app.handle()), &executable) {
|
||||
Ok(value) => value,
|
||||
Err(error) => {
|
||||
log_line(&home, &format!("startup: {error}"));
|
||||
if smoke {
|
||||
eprintln!("mqdh-desktop-smoke: FAIL {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
return Err(std::io::Error::new(std::io::ErrorKind::Other, error).into());
|
||||
}
|
||||
};
|
||||
if let Err(error) = fs::create_dir_all(&home) {
|
||||
return Err(std::io::Error::new(std::io::ErrorKind::Other, format!("cannot create MQDH_HOME {}: {error}", home.display())).into());
|
||||
}
|
||||
|
||||
let state = Arc::new(ShellState {
|
||||
child: Mutex::new(None),
|
||||
port: AtomicU16::new(0),
|
||||
home: home.clone(),
|
||||
tree: tree.clone(),
|
||||
});
|
||||
app.manage(state.clone());
|
||||
log_line(
|
||||
&home,
|
||||
&format!("startup: version={VERSION} tree={} node={}", tree.display(), node.display()),
|
||||
);
|
||||
|
||||
let mut command = backend_command(&node, &tree, &home);
|
||||
let mut child = match command.spawn() {
|
||||
Ok(child) => child,
|
||||
Err(error) => {
|
||||
log_line(&home, &format!("spawn failed: {error}"));
|
||||
if smoke {
|
||||
eprintln!("mqdh-desktop-smoke: FAIL spawn {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
return Err(std::io::Error::new(std::io::ErrorKind::Other, format!("cannot start the MQDH backend: {error}")).into());
|
||||
}
|
||||
};
|
||||
let stdout = child.stdout.take();
|
||||
let stderr = child.stderr.take();
|
||||
*state.child.lock().expect("backend mutex") = Some(child);
|
||||
|
||||
let (ready_tx, ready_rx) = mpsc::channel::<String>();
|
||||
let state_for_stdout = state.clone();
|
||||
if let Some(stdout) = stdout {
|
||||
std::thread::spawn(move || {
|
||||
let reader = BufReader::new(stdout);
|
||||
for line in reader.lines() {
|
||||
let Ok(line) = line else { break };
|
||||
let home = state_for_stdout.home.clone();
|
||||
log_line(&home, &format!("backend: {line}"));
|
||||
if let Some(url) = extract_url(&line) {
|
||||
if let Ok(parsed) = Url::parse(&url) {
|
||||
if let Some(port) = parsed.port() {
|
||||
state_for_stdout.port.store(port, Ordering::SeqCst);
|
||||
log_line(&home, &format!("ready: origin=http://{LOOPBACK}:{port}"));
|
||||
let _ = ready_tx.send(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
let state_for_stderr = state.clone();
|
||||
if let Some(stderr) = stderr {
|
||||
std::thread::spawn(move || {
|
||||
let reader = BufReader::new(stderr);
|
||||
for line in reader.lines().map_while(Result::ok) {
|
||||
log_line(&state_for_stderr.home, &format!("backend stderr: {line}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if smoke {
|
||||
let state = state.clone();
|
||||
std::thread::spawn(move || match ready_rx.recv_timeout(READY_TIMEOUT) {
|
||||
Ok(_url) => {
|
||||
println!("mqdh-desktop-smoke: ready origin=http://{LOOPBACK}:{}", state.port.load(Ordering::SeqCst));
|
||||
state.stop();
|
||||
std::process::exit(0);
|
||||
}
|
||||
Err(_) => {
|
||||
log_line(&state.home, "smoke: readiness timeout");
|
||||
eprintln!("mqdh-desktop-smoke: FAIL readiness timeout");
|
||||
state.stop();
|
||||
std::process::exit(1);
|
||||
}
|
||||
});
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let navigation_state = state.clone();
|
||||
let window = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("ui/index.html".into()))
|
||||
.title("MQDH")
|
||||
.inner_size(1280.0, 860.0)
|
||||
.min_inner_size(760.0, 560.0)
|
||||
.center()
|
||||
.on_navigation(move |url| {
|
||||
let allowed = match url.scheme() {
|
||||
"tauri" => true,
|
||||
"about" => true,
|
||||
"http" | "https" => {
|
||||
let host = url.host_str().unwrap_or_default();
|
||||
let port = url.port().unwrap_or(0);
|
||||
(host == LOOPBACK && port != 0 && port == navigation_state.port.load(Ordering::SeqCst))
|
||||
|| host == "tauri.localhost"
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
if !allowed {
|
||||
let _ = open::that(url.as_str());
|
||||
log_line(&navigation_state.home, &format!("blocked navigation: {url}"));
|
||||
}
|
||||
allowed
|
||||
})
|
||||
.build()?;
|
||||
|
||||
let window_for_ready = window.clone();
|
||||
let state_for_ready = state.clone();
|
||||
std::thread::spawn(move || {
|
||||
match ready_rx.recv_timeout(READY_TIMEOUT) {
|
||||
Ok(url) => {
|
||||
let json = serde_json::to_string(&url).unwrap_or_default();
|
||||
let script = format!("window.location.replace({json});");
|
||||
let _ = window_for_ready.eval(&script);
|
||||
}
|
||||
Err(_) => {
|
||||
log_line(&state_for_ready.home, "startup: readiness timeout");
|
||||
show_error(&window_for_ready, "本地服务在 120 秒内未就绪");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building the MQDH desktop shell");
|
||||
|
||||
app.run(|app_handle, event| {
|
||||
if let RunEvent::ExitRequested { .. } = event {
|
||||
if let Some(state) = app_handle.try_state::<Arc<ShellState>>() {
|
||||
state.stop();
|
||||
}
|
||||
}
|
||||
if let RunEvent::Exit = event {
|
||||
if let Some(state) = app_handle.try_state::<Arc<ShellState>>() {
|
||||
state.stop();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "MQDH",
|
||||
"version": "0.0.0",
|
||||
"identifier": "cn.cflmy.mqdh",
|
||||
"build": {
|
||||
"frontendDist": "ui"
|
||||
},
|
||||
"app": {
|
||||
"windows": [],
|
||||
"security": {
|
||||
"csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:",
|
||||
"assetProtocol": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": [
|
||||
"deb"
|
||||
],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": {
|
||||
"resources/mqdh-runtime.tar.gz": "mqdh-runtime.tar.gz"
|
||||
},
|
||||
"category": "Productivity",
|
||||
"shortDescription": "Marqdo Harness workbench",
|
||||
"longDescription": "MQDH is the Marqdo desktop workbench for reproducible Markdown documents and Marqdo computation. It reuses the existing /mqdh web workbench and the independently released Marqdo runtime.",
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": [
|
||||
"libwebkit2gtk-4.1-0",
|
||||
"libgtk-3-0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"windows": {
|
||||
"nsis": {
|
||||
"installMode": "currentUser",
|
||||
"displayLanguageSelector": false,
|
||||
"installerIcon": "icons/icon.ico"
|
||||
}
|
||||
},
|
||||
"macOS": {
|
||||
"minimumSystemVersion": "11.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>MQDH 启动失败</title>
|
||||
<style>
|
||||
:root { color-scheme: light dark; }
|
||||
html, body { height: 100%; margin: 0; }
|
||||
body { display: grid; place-items: center; font: 14px/1.7 system-ui, sans-serif; background: Canvas; color: CanvasText; }
|
||||
main { max-width: 36rem; padding: 2rem; }
|
||||
h1 { font-size: 1.15rem; margin: 0 0 .75rem; }
|
||||
p, li { opacity: .8; }
|
||||
code { font-size: .85em; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>MQDH 未能启动本地工作台</h1>
|
||||
<p>可能是本地服务启动超时或后端异常退出。应用只使用本机 loopback 服务,不会连接外部页面。</p>
|
||||
<ul>
|
||||
<li>确认没有其它程序阻止本机回环端口;</li>
|
||||
<li>退出后重新打开 MQDH;</li>
|
||||
<li>查看用户数据目录下的 <code>logs/mqdh-desktop.log</code>(其中不含会话令牌)。</li>
|
||||
</ul>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>MQDH</title>
|
||||
<style>
|
||||
:root { color-scheme: light dark; }
|
||||
html, body { height: 100%; margin: 0; }
|
||||
body { display: grid; place-items: center; font: 14px/1.6 system-ui, sans-serif; background: Canvas; color: CanvasText; }
|
||||
main { max-width: 32rem; padding: 2rem; text-align: center; }
|
||||
h1 { font-size: 1.25rem; margin: 0 0 .5rem; }
|
||||
p { margin: 0; opacity: .72; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>MQDH 正在启动工作台…</h1>
|
||||
<p>本地 Harness 服务就绪后会自动打开。若长时间无响应,请退出后重新打开,或查看用户数据目录下的 logs/mqdh-desktop.log。</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@@ -56,6 +56,7 @@
|
||||
"packages/client/*/tests/**/*.host.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "./packages/marqdo/ui" },
|
||||
{ "path": "./packages/client/ui-action-cards" },
|
||||
{ "path": "./packages/client/ui-creation-recommendations" },
|
||||
{ "path": "./packages/client/ui-plugin-recommendations" },
|
||||
|
||||
@@ -20,11 +20,10 @@ function isBuildFaceClient(value: unknown): boolean {
|
||||
*/
|
||||
export default defineConfig(({ env }) => {
|
||||
const client = isBuildFaceClient(env?.DSH_BUILD_FACE)
|
||||
// Downstream Marqdo packages ship TypeScript executed by Node's native type
|
||||
// stripping; they have no lib/types entry and must not enter the upstream
|
||||
// bundling graph (recorded in docs/mqdh/upstream-delta.md).
|
||||
// Product server packages run as TypeScript. Its browser contribution uses
|
||||
// the same client artifact pipeline as the inherited shell.
|
||||
const packages = workspacePackageGlobs(globSync(['vendor/*/package.json', 'packages/*/*/package.json'], { cwd: import.meta.dirname }))
|
||||
.filter(directory => !directory.startsWith('packages/marqdo/'))
|
||||
.filter(directory => !directory.startsWith('packages/marqdo/') || directory === 'packages/marqdo/ui')
|
||||
return {
|
||||
workspace: [...packages, 'apps/cli', ...client ? [] : ['apps/desktop-host']],
|
||||
entry: client ? '' : ['lib/types/{index,startup}.js'],
|
||||
|
||||