diff --git a/.github/workflows/build-exe-for-python-sdk.yml b/.github/workflows/build-exe-for-python-sdk.yml deleted file mode 100644 index 218ae14f64..0000000000 --- a/.github/workflows/build-exe-for-python-sdk.yml +++ /dev/null @@ -1,530 +0,0 @@ -name: Build single-exe - -# Native builds for the release targets; see -# .agents/notes/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md. -# A full target run retains one SDK wheel and five runtime wheels; subset -# dispatch retains the SDK wheel and selected runtime wheels. Bare executables -# and source closures are test inputs. Run manually or call it from the Python -# release workflow. There is no `pull_request` trigger: a label trigger would -# list gray skipped checks on every unrelated PR label event. Checkout uses the -# triggering ref, so dispatch needs no separate ref input. -on: - workflow_call: - inputs: - targets: - description: Comma-separated pkg targets to build; empty builds all five. - type: string - required: false - default: '' - release: - description: Run as the native builder for the Python release workflow. - type: boolean - required: false - default: false - ci: - description: Run Python runtime CI validation for the selected targets. - type: boolean - required: false - default: false - secrets: - DEEPSEEK_API_KEY_EXTERNAL: - description: Real DeepSeek API key for trusted installed-wheel pull-request tests. - required: false - workflow_dispatch: - inputs: - targets: - description: >- - Comma-separated pkg targets to build. Any subset of: - node24-linux-x64, node24-linux-arm64, node24-macos-arm64, - node24-macos-x64, node24-win-x64. Empty builds all five. - type: string - required: false - default: '' - -concurrency: - # Keep the called workflow distinct from its caller's concurrency group; - # github.workflow identifies the caller inside a reusable workflow and keeps - # an ordinary CI run from cancelling a full release validation on the same ref. - group: build-single-exe-${{ github.workflow }}-${{ github.ref }} - # Release-owned builds are part of an intentional publication transaction. - cancel-in-progress: ${{ !inputs.release }} - -permissions: - contents: read - -env: - # CI runs must never report to the production telemetry endpoint baked - # into apps/cli/cordis.yml (AppCLIEntry disables the row when set). - DSH_TELEMETRY_DISABLED: '1' - -jobs: - # Job-level conditions cannot inspect `matrix`, so validate target names and - # construct the matrix before the dependent jobs. - plan: - name: plan targets - if: inputs.ci || inputs.release || github.event_name == 'workflow_dispatch' - runs-on: >- - ${{ inputs.ci && !inputs.release && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' - && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} - timeout-minutes: 5 - outputs: - matrix: ${{ steps.plan.outputs.matrix }} - version: ${{ steps.version.outputs.version }} - repository-version: ${{ steps.version.outputs.repository-version }} - steps: - - uses: actions/checkout@v7.0.1 - - - name: Resolve repository version - id: version - run: | - set -euo pipefail - python3 - <<'PY' >> "$GITHUB_OUTPUT" - import runpy - - release = runpy.run_path("scripts/build-python-release.py") - repository_version = release["repository_version"]() - wheel_version = release["pep440_version"](repository_version) - print(f"repository-version={repository_version}") - print(f"version={wheel_version}") - PY - - - name: Compute matrix from targets input - id: plan - env: - # Blank dispatch inputs build all targets. - TARGETS: ${{ inputs.targets || 'node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-macos-x64,node24-win-x64' }} - run: | - set -euo pipefail - matrix='[]' - IFS=',' read -r -a targets <<< "$TARGETS" - for raw in "${targets[@]}"; do - t="$(echo "$raw" | xargs)" # trim surrounding whitespace - [ -z "$t" ] && continue - # Native-only: hosted arm64 Linux uses ubuntu-24.04-arm, while - # macos-latest is Apple Silicon; macos-15-intel is native x64. - case "$t" in - node24-linux-x64) runner=ubuntu-latest ;; - node24-linux-arm64) runner=ubuntu-24.04-arm ;; - node24-macos-arm64) runner=macos-latest ;; - node24-macos-x64) runner=macos-15-intel ;; - node24-win-x64) runner=windows-2025 ;; - *) - echo "::error::Unknown target '$t'. Supported: node24-linux-x64, node24-linux-arm64, node24-macos-arm64, node24-macos-x64, node24-win-x64." - exit 1 - ;; - esac - matrix="$(jq -c --arg target "$t" --arg runner "$runner" '. + [{target: $target, runner: $runner}]' <<< "$matrix")" - done - if [ "$matrix" = '[]' ]; then - echo "::error::The targets input selected nothing to build." - exit 1 - fi - echo "Matrix: $matrix" - echo "matrix=$matrix" >> "$GITHUB_OUTPUT" - - sdk-wheel: - needs: plan - name: deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - runs-on: >- - ${{ inputs.ci && !inputs.release && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' - && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }} - timeout-minutes: 5 - steps: - - uses: actions/checkout@v7.0.1 - - - uses: actions/setup-python@v6.3.0 - with: - python-version: '3.10' - - - name: Install Python build tooling - run: python -m pip install uv==0.11.23 - - - name: Build release-shaped SDK wheel - run: >- - python scripts/build-python-release.py - --package sdk - --output-dir dist-python - - - uses: actions/upload-artifact@v7.0.1 - with: - name: deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - path: dist-python/deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - if-no-files-found: error - retention-days: 7 - - # Blacksmith x64 CI builds use 2 vCPU for compilation, bundling, and wheel smokes. - # Release macOS builds use larger GitHub runners; ordinary CI and direct - # builder dispatches retain the standard native target matrix. - build: - needs: [plan, sdk-wheel] - name: ${{ matrix.target }} - runs-on: >- - ${{ inputs.release && matrix.target == 'node24-macos-x64' && 'macos-15-large' - || inputs.release && matrix.target == 'node24-macos-arm64' && 'macos-15-xlarge' - || inputs.ci && !inputs.release && matrix.target == 'node24-linux-x64' - && vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-2vcpu-ubuntu-2404' - || inputs.ci && !inputs.release && matrix.target == 'node24-win-x64' - && vars.DSH_CI_FAILOVER_WINDOWS == 'blacksmith' && 'blacksmith-2vcpu-windows-2025' - || matrix.runner }} - timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(needs.plan.outputs.matrix) }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-js-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} - - - name: Enable Windows Developer Mode (symlink support) - if: runner.os == 'Windows' - shell: pwsh - run: >- - reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" - /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1" - - # setup-node's built-in pnpm store cache keys on platform AND arch, so - # the Linux architectures sharing runner.os stay on separate caches. - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - cache: pnpm - - - uses: actions/setup-python@v6.3.0 - with: - python-version: '3.10' - - - name: Install Python build tooling - run: python -m pip install uv==0.11.23 - - # Cache pkg's target Node binary; lockfile changes roll the - # exact key while the restore prefix can seed its replacement. - - uses: actions/cache@v6.1.0 - with: - path: ~/.pkg-cache - key: pkg-fetch-${{ matrix.target }}-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - pkg-fetch-${{ matrix.target }}- - - - name: Install (immutable) - # node-gyp fetches Node headers from nodejs.org during install; that - # endpoint stalls intermittently (observed 10 s connect timeouts). - # Bounded retries mirror the wine lane's transfer policy without a - # mirror, since these installs also resolve native addons. - shell: bash - run: | - for attempt in 1 2 3; do - if pnpm install --frozen-lockfile; then exit 0; fi - [ "$attempt" -lt 3 ] && sleep 10 - done - exit 1 - - - name: Rebuild Linux node-pty against manylinux 2.28 - if: runner.os == 'Linux' - env: - RUNNER_ARCH: ${{ runner.arch }} - run: | - set -euo pipefail - case "$RUNNER_ARCH" in - X64) image=quay.io/pypa/manylinux_2_28_x86_64 ;; - ARM64) image=quay.io/pypa/manylinux_2_28_aarch64 ;; - *) echo "::error::Unsupported Linux runner architecture $RUNNER_ARCH"; exit 1 ;; - esac - addon_dir="$(realpath packages/subprocess/subprocess-local/node_modules/node-pty)" - pnpm_setup_root="$(realpath "$(dirname "$(dirname "$PNPM_HOME")")")" - # Verification installs would install node-gyp inside the package and package it into the exe. - (cd "$addon_dir" && npm_config_build_from_source=true pnpm --config.verifyDepsBeforeRun=false run install) - addon="$addon_dir/build/Release/pty.node" - [ -f "$addon_dir/build/Makefile" ] || { - echo "::error::node-pty install did not generate $addon_dir/build/Makefile" - exit 1 - } - docker run --rm \ - --user "$(id -u):$(id -g)" \ - -v "$PWD:$PWD" \ - -v "$HOME/.cache/node-gyp:$HOME/.cache/node-gyp:ro" \ - -v "$pnpm_setup_root:$pnpm_setup_root:ro" \ - -w "$addon_dir" \ - "$image" \ - bash -euxo pipefail -c \ - 'rm -rf build/Release && make -C build -j2 BUILDTYPE=Release' - [ -f "$addon" ] || { echo "::error::$addon missing after manylinux rebuild"; exit 1; } - readelf --version-info "$addon" | tee node-pty-glibc-versions.txt - maximum="$(sed -n 's/.*Name: GLIBC_\([0-9.]*\).*/\1/p' node-pty-glibc-versions.txt | sort -V | tail -1)" - [ -n "$maximum" ] || { echo "::error::No GLIBC requirements found in $addon"; exit 1; } - dpkg --compare-versions "$maximum" le 2.28 || { - echo "::error::node-pty addon requires GLIBC_$maximum but wheel claims manylinux_2_28" - exit 1 - } - - - name: Build single-exe - env: - DSH_BUILD_CLIENT_PROFILE: official - # Brotli runs at quality 9 through the vendored pkg patch: the same - # payload measured 16.3 s at quality 9 against 132.8 s at pkg's default - # quality 11, for an archive 10% larger. Which quality each lane uses is - # therefore not a workflow choice. - run: >- - pnpm exec tsx scripts/build-exe-for-python-sdk.ts --targets=${{ matrix.target }} - ${{ inputs.ci && github.event_name == 'pull_request' && '--build-artifacts' || '' }} - - - name: Resolve platform outputs (POSIX) - id: runtime-posix - if: runner.os != 'Windows' - env: - TARGET: ${{ matrix.target }} - VERSION: ${{ needs.plan.outputs.version }} - run: | - set -euo pipefail - platform="${TARGET#node24-}" - exe="$PWD/dist-exe/deepseek-harness-sdk-runtime-$platform" - case "$platform" in - linux-x64) wheel=deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_x86_64.whl ;; - linux-arm64) wheel=deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_aarch64.whl ;; - macos-arm64) wheel=deepseek_harness_runtime_bin-$VERSION-py3-none-macosx_14_0_arm64.whl ;; - macos-x64) wheel=deepseek_harness_runtime_bin-$VERSION-py3-none-macosx_14_0_x86_64.whl ;; - *) echo "::error::Unsupported runtime platform $platform"; exit 1 ;; - esac - [ -x "$exe" ] || { echo "::error::$exe missing or not executable"; exit 1; } - echo "platform=$platform" >> "$GITHUB_OUTPUT" - echo "exe=$exe" >> "$GITHUB_OUTPUT" - echo "wheel=$wheel" >> "$GITHUB_OUTPUT" - - - name: Resolve platform outputs (Windows) - id: runtime-windows - if: runner.os == 'Windows' - shell: pwsh - env: - TARGET: ${{ matrix.target }} - VERSION: ${{ needs.plan.outputs.version }} - run: | - if ($env:TARGET -ne 'node24-win-x64') { throw "Unsupported runtime target $env:TARGET" } - $platform = 'win-x64' - $exe = Join-Path $PWD 'dist-exe\deepseek-harness-sdk-runtime-win-x64.exe' - $wheel = "deepseek_harness_runtime_bin-$env:VERSION-py3-none-win_amd64.whl" - if (-not (Test-Path -LiteralPath $exe -PathType Leaf)) { throw "Runtime executable is missing at $exe" } - "platform=$platform" >> $env:GITHUB_OUTPUT - "exe=$exe" >> $env:GITHUB_OUTPUT - "wheel=$wheel" >> $env:GITHUB_OUTPUT - - - name: Build release-shaped runtime wheel - run: >- - python scripts/build-python-release.py - --package runtime - --platform "${{ steps.runtime-posix.outputs.platform || steps.runtime-windows.outputs.platform }}" - --runtime-exe "${{ steps.runtime-posix.outputs.exe || steps.runtime-windows.outputs.exe }}" - --output-dir dist-python - - - uses: actions/download-artifact@v8.0.1 - with: - name: deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - path: dist-python - - - name: Install local SDK and runtime wheels into a clean venv (POSIX) - id: smoke-venv-posix - if: runner.os != 'Windows' - env: - RUNTIME_WHEEL: ${{ steps.runtime-posix.outputs.wheel }} - SDK_WHEEL: deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - run: | - set -euo pipefail - venv="$(python -c 'import tempfile; print(tempfile.mkdtemp(prefix="dsh-sdk-smoke-"))')" - python -m venv "$venv" - smoke_python="$venv/bin/python" - "$smoke_python" -m pip install \ - "dist-python/$SDK_WHEEL" \ - "dist-python/$RUNTIME_WHEEL" \ - 'pytest>=8.0' - echo "python=$smoke_python" >> "$GITHUB_OUTPUT" - - - name: Install local SDK and runtime wheels into a clean venv (Windows) - id: smoke-venv-windows - if: runner.os == 'Windows' - shell: pwsh - env: - RUNTIME_WHEEL: ${{ steps.runtime-windows.outputs.wheel }} - SDK_WHEEL: deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - run: | - $venv = (& python -c 'import tempfile; print(tempfile.mkdtemp(prefix="dsh-sdk-smoke-"))').Trim() - python -m venv $venv - $smokePython = Join-Path $venv 'Scripts\python.exe' - & $smokePython -m pip install "dist-python/$env:SDK_WHEEL" "dist-python/$env:RUNTIME_WHEEL" 'pytest>=8.0' - if ($LASTEXITCODE -ne 0) { throw "Wheel installation failed with exit code $LASTEXITCODE" } - "python=$smokePython" >> $env:GITHUB_OUTPUT - - - name: Run installed-wheel keyless black-box tests (POSIX) - if: runner.os != 'Windows' - run: | - set -euo pipefail - blackbox_root="$(python -c 'import tempfile; print(tempfile.mkdtemp(prefix="dsh-sdk-blackbox-"))')" - cd "$blackbox_root" - env -u PYTHONPATH -u DSH_RUNTIME_MODE \ - "${{ steps.smoke-venv-posix.outputs.python }}" \ - "$GITHUB_WORKSPACE/scripts/smoke-python-runtime.py" \ - --scenario all \ - --installed-wheel - - - name: Run installed-wheel keyless black-box tests (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - $blackboxRoot = (& python -c 'import tempfile; print(tempfile.mkdtemp(prefix="dsh-sdk-blackbox-"))').Trim() - Remove-Item Env:PYTHONPATH -ErrorAction SilentlyContinue - Remove-Item Env:DSH_RUNTIME_MODE -ErrorAction SilentlyContinue - Push-Location $blackboxRoot - try { - & "${{ steps.smoke-venv-windows.outputs.python }}" "$env:GITHUB_WORKSPACE\scripts\smoke-python-runtime.py" --scenario all --installed-wheel - if ($LASTEXITCODE -ne 0) { throw "Installed-wheel black-box failed with exit code $LASTEXITCODE" } - } finally { - Pop-Location - } - - - name: Run installed-wheel native command tests (POSIX) - if: runner.os != 'Windows' - run: >- - "${{ steps.smoke-venv-posix.outputs.python }}" -I - "$GITHUB_WORKSPACE/python/sdk/tests/run_installed_commands.py" - - - name: Run installed-wheel native command tests (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - & "${{ steps.smoke-venv-windows.outputs.python }}" -I "$env:GITHUB_WORKSPACE\python\sdk\tests\run_installed_commands.py" - if ($LASTEXITCODE -ne 0) { throw "Installed-wheel native command tests failed with exit code $LASTEXITCODE" } - - - name: Preflight installed-wheel real API test (POSIX) - if: >- - inputs.ci - && runner.os != 'Windows' - && (github.event_name != 'pull_request' - || !(github.event.pull_request.head.repo.fork - || github.event.pull_request.user.login == 'dependabot[bot]')) - env: - DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }} - run: | - set -euo pipefail - if [ -z "${DEEPSEEK_API_KEY:-}" ]; then - echo "::error::DEEPSEEK_API_KEY_EXTERNAL is empty; the installed-wheel real API test cannot self-skip." - exit 1 - fi - - - name: Preflight installed-wheel real API test (Windows) - if: >- - inputs.ci - && runner.os == 'Windows' - && (github.event_name != 'pull_request' - || !(github.event.pull_request.head.repo.fork - || github.event.pull_request.user.login == 'dependabot[bot]')) - shell: pwsh - env: - DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }} - run: | - if ([string]::IsNullOrWhiteSpace($env:DEEPSEEK_API_KEY)) { - throw 'DEEPSEEK_API_KEY_EXTERNAL is empty; the installed-wheel real API test cannot self-skip.' - } - - - name: Run installed-wheel real API black-box test (POSIX) - if: >- - inputs.ci - && runner.os != 'Windows' - && (github.event_name != 'pull_request' - || !(github.event.pull_request.head.repo.fork - || github.event.pull_request.user.login == 'dependabot[bot]')) - env: - DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }} - DEEPSEEK_BASE_URL: https://api.deepseek.com/anthropic - run: | - set -euo pipefail - blackbox_root="$(python -c 'import tempfile; print(tempfile.mkdtemp(prefix="dsh-sdk-blackbox-live-"))')" - cd "$blackbox_root" - env -u PYTHONPATH -u DSH_RUNTIME_MODE \ - "${{ steps.smoke-venv-posix.outputs.python }}" \ - "$GITHUB_WORKSPACE/scripts/smoke-python-runtime.py" \ - --scenario sdk-live \ - --installed-wheel - - - name: Run installed-wheel real API black-box test (Windows) - if: >- - inputs.ci - && runner.os == 'Windows' - && (github.event_name != 'pull_request' - || !(github.event.pull_request.head.repo.fork - || github.event.pull_request.user.login == 'dependabot[bot]')) - shell: pwsh - env: - DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }} - DEEPSEEK_BASE_URL: https://api.deepseek.com/anthropic - run: | - $blackboxRoot = (& python -c 'import tempfile; print(tempfile.mkdtemp(prefix="dsh-sdk-blackbox-live-"))').Trim() - Remove-Item Env:PYTHONPATH -ErrorAction SilentlyContinue - Remove-Item Env:DSH_RUNTIME_MODE -ErrorAction SilentlyContinue - Push-Location $blackboxRoot - try { - & "${{ steps.smoke-venv-windows.outputs.python }}" "$env:GITHUB_WORKSPACE\scripts\smoke-python-runtime.py" --scenario sdk-live --installed-wheel - if ($LASTEXITCODE -ne 0) { throw "Installed-wheel live API smoke failed with exit code $LASTEXITCODE" } - } finally { - Pop-Location - } - - - name: Check Linux GLIBC requirements - if: runner.os == 'Linux' - run: | - set -euo pipefail - readelf --version-info "${{ steps.runtime-posix.outputs.exe }}" | tee glibc-versions.txt - maximum="$(sed -n 's/.*Name: GLIBC_\([0-9.]*\).*/\1/p' glibc-versions.txt | sort -V | tail -1)" - [ -n "$maximum" ] || { echo "::error::No GLIBC requirements found"; exit 1; } - dpkg --compare-versions "$maximum" le 2.28 || { - echo "::error::Executable requires GLIBC_$maximum but wheel claims manylinux_2_28" - exit 1 - } - - - name: Check macOS payload architecture and deployment target - if: runner.os == 'macOS' - env: - EXE: ${{ steps.runtime-posix.outputs.exe }} - PLATFORM: ${{ steps.runtime-posix.outputs.platform }} - run: | - set -euo pipefail - case "$PLATFORM" in - macos-arm64) macho_arch=arm64 ;; - macos-x64) macho_arch=x86_64 ;; - *) echo "::error::Unsupported macOS platform $PLATFORM"; exit 1 ;; - esac - for payload in "$EXE" "$EXE-rg" "$EXE-spawn-helper"; do - lipo "$payload" -verify_arch "$macho_arch" - done - python3 scripts/check-macos-deployment-target.py \ - --platform "$PLATFORM" "$EXE" "$EXE-rg" "$EXE-spawn-helper" - - - name: Run wheel in a manylinux 2.28 container - if: runner.os == 'Linux' - env: - RUNNER_ARCH: ${{ runner.arch }} - RUNTIME_WHEEL: ${{ steps.runtime-posix.outputs.wheel }} - SDK_WHEEL: deepseek_harness_sdk-${{ needs.plan.outputs.version }}-py3-none-any.whl - run: | - set -euo pipefail - case "$RUNNER_ARCH" in - X64) image=quay.io/pypa/manylinux_2_28_x86_64 ;; - ARM64) image=quay.io/pypa/manylinux_2_28_aarch64 ;; - *) echo "::error::Unsupported Linux runner architecture $RUNNER_ARCH"; exit 1 ;; - esac - docker run --rm -e RUNTIME_WHEEL -e SDK_WHEEL -e DSH_TELEMETRY_DISABLED -v "$PWD:/work" -w /work "$image" bash -euxo pipefail -c ' - /opt/python/cp310-cp310/bin/python -m venv /tmp/dsh-sdk - /tmp/dsh-sdk/bin/python -m pip install "/work/dist-python/$SDK_WHEEL" "/work/dist-python/$RUNTIME_WHEEL" - mkdir -p /tmp/dsh-sdk-manylinux-smoke - cd /tmp/dsh-sdk-manylinux-smoke - env -u PYTHONPATH -u DSH_RUNTIME_MODE /tmp/dsh-sdk/bin/python /work/scripts/smoke-python-runtime.py --scenario sdk-default --installed-wheel - env -u PYTHONPATH -u DSH_RUNTIME_MODE /tmp/dsh-sdk/bin/python /work/scripts/smoke-python-runtime.py --scenario sdk-mcp --installed-wheel - ' - - - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.runtime-posix.outputs.wheel || steps.runtime-windows.outputs.wheel }} - path: dist-python/${{ steps.runtime-posix.outputs.wheel || steps.runtime-windows.outputs.wheel }} - if-no-files-found: error - retention-days: 7 diff --git a/.github/workflows/build-exe-for-ssh-helper.yml b/.github/workflows/build-exe-for-ssh-helper.yml deleted file mode 100644 index 774486b4ac..0000000000 --- a/.github/workflows/build-exe-for-ssh-helper.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: Build SSH helper - -on: - workflow_call: - inputs: - targets: - description: Comma-separated native Node 24 targets; empty builds all four. - type: string - default: '' - release: - description: Retain a complete release build when another run starts. - type: boolean - default: false - workflow_dispatch: - inputs: - targets: - description: Linux/macOS x64/arm64 pkg targets; empty builds all four. - type: string - default: '' - -permissions: - contents: read - -concurrency: - group: ssh-helper-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ !inputs.release }} - -env: - DSH_TELEMETRY_DISABLED: '1' - -jobs: - plan: - runs-on: ubuntu-latest - timeout-minutes: 5 - outputs: - matrix: ${{ steps.targets.outputs.matrix }} - steps: - - name: Validate native targets - id: targets - env: - REQUESTED_TARGETS: ${{ inputs.targets }} - run: | - node --input-type=module <<'JS' - import { appendFileSync } from 'node:fs'; - const runners = { - 'node24-linux-x64': 'ubuntu-24.04', - 'node24-linux-arm64': 'ubuntu-24.04-arm', - 'node24-macos-arm64': 'macos-latest', - 'node24-macos-x64': 'macos-15-intel', - }; - const raw = process.env.REQUESTED_TARGETS; - const targets = raw ? raw.split(',').map(value => value.trim()) : Object.keys(runners); - if (new Set(targets).size !== targets.length || targets.some(target => !Object.hasOwn(runners, target))) throw new Error('Invalid or duplicate SSH helper target'); - appendFileSync(process.env.GITHUB_OUTPUT, `matrix=${JSON.stringify(targets.map(target => ({target, runner: runners[target]})))}\n`); - JS - - build: - needs: plan - name: ${{ matrix.target }} - runs-on: ${{ matrix.runner }} - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(needs.plan.outputs.matrix) }} - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - uses: pnpm/action-setup@v4 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v6 - with: - node-version: '^24.22.3' - cache: pnpm - - uses: actions/cache@v4 - with: - path: ~/.pkg-cache - key: ssh-pkg-${{ matrix.target }}-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: ssh-pkg-${{ matrix.target }}- - - name: Install dependencies - run: pnpm install --frozen-lockfile - - name: Prepare Linux compiler and sandbox - if: runner.os == 'Linux' - run: | - sudo apt-get update -q - sudo apt-get install -yq musl-tools bubblewrap - if sysctl kernel.apparmor_restrict_unprivileged_userns >/dev/null 2>&1; then - sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - fi - bwrap --ro-bind / / --dev /dev --unshare-pid --proc /proc --die-with-parent -- true - - name: Build compatible Linux PTY addon - if: runner.os == 'Linux' - run: bash scripts/prepare-linux-node-pty.sh - - name: Build native release archive - env: - HELPER_TARGET: ${{ matrix.target }} - run: pnpm exec tsx scripts/build-exe-for-ssh-helper.ts --target="$HELPER_TARGET" - - name: Verify relocated executable and confinement - env: - HELPER_TARGET: ${{ matrix.target }} - run: | - archives=(dist-exe/ssh-helper/*.tar.gz) - test "${#archives[@]}" -eq 1 - pnpm exec tsx scripts/verify-ssh-helper-artifact.ts --archive="${archives[0]}" --sandbox=required --report="dist-exe/ssh-helper/$HELPER_TARGET.json" - - name: Verify the packaged Landlock backend - if: runner.os == 'Linux' - env: - HELPER_TARGET: ${{ matrix.target }} - run: | - archives=(dist-exe/ssh-helper/*.tar.gz) - pnpm exec tsx scripts/verify-ssh-helper-artifact.ts --archive="${archives[0]}" --sandbox=required --backend=landlock-run --report="dist-exe/ssh-helper/$HELPER_TARGET.landlock.json" - - name: Verify OpenSSH on glibc 2.28 without Node - if: runner.os == 'Linux' - env: - HELPER_TARGET: ${{ matrix.target }} - run: | - archives=(dist-exe/ssh-helper/*.tar.gz) - test "${#archives[@]}" -eq 1 - pnpm exec tsx scripts/verify-ssh-helper-ssh.ts --archive="${archives[0]}" --report="dist-exe/ssh-helper/$HELPER_TARGET.ssh.json" - - name: Upload verified archive and evidence - uses: actions/upload-artifact@v7 - with: - name: ssh-helper-${{ matrix.target }} - path: dist-exe/ssh-helper/* - if-no-files-found: error diff --git a/.github/workflows/build-preview-cloudflare.yml b/.github/workflows/build-preview-cloudflare.yml deleted file mode 100644 index d0d2009318..0000000000 --- a/.github/workflows/build-preview-cloudflare.yml +++ /dev/null @@ -1,220 +0,0 @@ -name: Build PR preview - -# Every push to a pull request publishes that pull request's preview to -# Cloudflare Pages under its own branch alias, behind Cloudflare Access. The -# upload carries build products plus the snapshot diff page, which embeds -# committed `snapshots/` diff text: the workflow never grants the deployment -# platform access to this repository's sources. This lane also owns the -# aggregate test and script type checks that the required Linux consumers no -# longer repeat on every pull request. - -on: - pull_request: - types: [opened, synchronize, reopened] - -# Within one pull request the newest build wins. Across pull requests there is -# nothing to serialize: each uploads to its own branch alias, so two deployments -# never contend for the same URL. -concurrency: - group: build-preview-cloudflare-${{ github.event.pull_request.number }} - cancel-in-progress: true - -permissions: - contents: read - pull-requests: write - -env: - PRIMARY_NODE_VERSION: '^24.22.3' - # Cloudflare Pages project receiving the upload. Its preview deployments are - # the surface the Access application protects; the project's production branch - # is deliberately a name no deployment uses, so no unprotected URL exists. - CF_PROJECT: dsh-build-preview - # CI runs must never report to the production telemetry endpoint baked into - # apps/cli/cordis.yml (AppCLIEntry disables the row when set). - DSH_TELEMETRY_DISABLED: '1' - -jobs: - preview: - # The required outcome is the build, which runs four TypeScript programs - # (Host and Client package compilation, then each face's aggregate test and - # script check) after the Typert pass. Publishing is best effort: transport, - # Access, and comment failures warn instead of failing the check. - runs-on: >- - ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404' - || 'ubuntu-24.04' }} - name: cloudflare pages preview - steps: - # The pull_request checkout is the merge commit; depth 2 brings its first - # parent, the base branch tip, for the snapshot diff page. - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - fetch-depth: 2 - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Configure pnpm store path - id: pnpm-store - run: | - store_root="$HOME/.local/share/pnpm/store" - echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV" - store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent) - echo "path=$store_path" >> "$GITHUB_OUTPUT" - - # Read-only: the preview lane consumes the default-branch cache without - # putting cache upload on its own path. - - uses: actions/cache/restore@v6.1.0 - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm- - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - # apps/web consumes workspace packages as built lib products, and - # build:preview packs the image through the packer's installed bin - # (lib/bin.js), so neither half exists before the artifact build runs. - # The required Linux consumers emit artifacts only; the complete build - # here also runs the aggregate test and script checks, which share the - # Typert output and the two package compilations. - - name: Build workspace and check aggregate programs - run: pnpm run build - - - name: Build the preview page and pack the VFS image - env: - DSH_CLIENT_TITLE: DSH preview pr-${{ github.event.pull_request.number }} - run: pnpm --filter @deepseek-ai/dsh-web-frontend run build:preview - - # Sourcemaps carry complete sources and stay off the deployment platform. - # index.html is the served page, which cannot boot without a host - # injecting window.__DSH_BOOT__; replacing it with the worker page makes - # the deployment root the usable entry instead of a page that never boots. - - name: Shape the upload - run: | - find apps/web/dist -name '*.map' -delete - cp apps/web/dist/preview.html apps/web/dist/index.html - - # Reviewers read snapshot changes at /snapshot-diff/, which opens on the - # SDK blank-Session catalog (system prompt and tool schemas); the source - # chooser links to it. The page serves review only, so a failure warns - # like publication instead of failing the build. - - name: Render the snapshot diff page - id: snapshot-diff - continue-on-error: true - run: >- - pnpm exec tsx scripts/snapshot-diff-page.ts --base HEAD^1 --head HEAD - --out apps/web/dist/snapshot-diff - --preview-manifest apps/web/dist/preview/fixtures.json - - - name: Upload to Cloudflare Pages - id: upload - continue-on-error: true - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - run: | - npx --yes wrangler@4 pages deploy apps/web/dist \ - --project-name "$CF_PROJECT" \ - --branch "pr-${{ github.event.pull_request.number }}" \ - --commit-dirty=true - - # The image is what a worker boot fails on first and least visibly, so the - # run only passes once the protected URL serves it as gzip bytes. Three - # facts are asserted, each with its own failure meaning: - # 200 Access admitted the request; a 302 means the - # Access policy is missing its Service Auth rule - # for this token - # no content-encoding the platform did not claim transport - # compression, which would make the browser - # decode the body and leave the worker's - # DecompressionStream inflating a plain tar - # gzip magic 1f 8b the bytes really are the gzip member the - # packer wrote - # Accept-Encoding is sent because a browser sends it; the assertion is - # about what the platform does with a body that is already compressed. - - name: Verify the protected deployment serves the image - id: verify - continue-on-error: true - env: - CF_ACCESS_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }} - CF_ACCESS_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }} - run: | - url="https://pr-${{ github.event.pull_request.number }}.${CF_PROJECT}.pages.dev" - image="$url/preview/vfs-image.tar.gz" - code=000 - for attempt in 1 2 3 4 5; do - code=$(curl -sS -o image.bin -D headers.txt -w '%{http_code}' \ - -H 'Accept-Encoding: gzip' \ - -H "CF-Access-Client-Id: $CF_ACCESS_CLIENT_ID" \ - -H "CF-Access-Client-Secret: $CF_ACCESS_CLIENT_SECRET" \ - "$image" || echo 000) - echo "attempt $attempt: HTTP $code" - if [ "$code" = "200" ]; then break; fi - sleep 10 - done - if [ "$code" != "200" ]; then - echo "the protected image URL answered $code, not 200" - head -20 headers.txt - exit 1 - fi - if grep -qi '^content-encoding:' headers.txt; then - echo "the platform declared transport compression on an already-compressed image:" - grep -i '^content-encoding:' headers.txt - exit 1 - fi - magic=$(head -c 2 image.bin | od -An -tx1 | tr -d ' \n') - if [ "$magic" != "1f8b" ]; then - echo "image does not start with the gzip magic number: $magic" - exit 1 - fi - echo "image served as $(wc -c < image.bin) gzip bytes" - - # The alias URL follows from the pull request number, so it is stable - # across redeploys and worth stating once. The marker makes the comment - # idempotent: a pull request opened before this workflow existed never - # sees an `opened` event, and every later push must not restate the URL; - # an existing comment with older text is edited in place. - - name: Comment the preview URL - id: comment - continue-on-error: true - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR: ${{ github.event.pull_request.number }} - SNAPSHOT_DIFF: ${{ steps.snapshot-diff.outcome }} - run: | - marker='' - url="https://pr-$PR.${CF_PROJECT}.pages.dev" - links="[Preview for #$PR]($url)" - if [ "$SNAPSHOT_DIFF" = success ]; then links="$links · [snapshot changes]($url/snapshot-diff/)"; fi - # The marker sits on its own line: markdown renders no link on a - # line that opens with a raw HTML comment. - body=$(printf '%s\n\n%s\n' "$marker" "$links (requires Cloudflare Access sign-in)") - existing=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" --paginate \ - --jq "[.[] | select(.user.login == \"github-actions[bot]\" and (.body | contains(\"$marker\")))] | first // empty | [.id, .body] | @json") - if [ -z "$existing" ]; then - printf '%s' "$body" | gh pr comment "$PR" --body-file - - elif [ "$(jq -r '.[1]' <<< "$existing")" != "$body" ]; then - gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$(jq -r '.[0]' <<< "$existing")" -f body="$body" > /dev/null - else - echo "preview URL already commented" - fi - - # Publishing stays outside the required verdict: a snapshot diff page, - # Cloudflare, Access, or comment failure warns, while a build failure - # still fails this check. - - name: Report preview publication failures - if: >- - steps.snapshot-diff.outcome == 'failure' || steps.upload.outcome == 'failure' - || steps.verify.outcome == 'failure' || steps.comment.outcome == 'failure' - run: | - message='preview publication failed; the build passed, see the snapshot diff, upload, verify, and comment steps' - echo "::warning::$message" - echo "$message" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/cua-helper-package-macos.yml b/.github/workflows/cua-helper-package-macos.yml deleted file mode 100644 index 9d2eadbaa2..0000000000 --- a/.github/workflows/cua-helper-package-macos.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: Package CUA helper · macOS · arm64 + x64 - -on: - workflow_dispatch: - inputs: - preset: - description: '机器上的签名配置' - type: choice - options: [test, production] - default: test - required: true - workflow_call: - inputs: - reuse: - type: boolean - default: false - cua_macos_run_id: - type: string - default: '' - preset: - type: string - default: production - outputs: - artifact-id: - description: '包含两个架构的已签名、公证 helper 的产物编号' - value: ${{ jobs.package.outputs.artifact-id }} - run-id: - description: '产物所属的构建运行编号' - value: ${{ jobs.package.outputs.run-id }} - build-key: - description: '源码和构建配置的摘要' - value: ${{ jobs.package.outputs.build-key }} - -permissions: - contents: read - actions: read - -# Desktop uses the same keychain search list and optional system proxy transaction. -concurrency: - group: macos-desktop-package - cancel-in-progress: false - -jobs: - package: - runs-on: [self-hosted, macOS, ARM64, dsh-mac-package-trial] - timeout-minutes: 60 - outputs: - artifact-id: ${{ steps.retained.outputs.artifact-id || steps.upload.outputs.artifact-id }} - run-id: ${{ steps.retained.outputs.run-id || github.run_id }} - build-key: ${{ steps.build-inputs.outputs.build-key }} - env: - DSH_PACKAGING_PRESET: ${{ inputs.preset }} - DSH_TELEMETRY_DISABLED: '1' - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: true - - name: Validate run ref and preset - run: | - node -e 'const fs=require("node:fs"); const ref=process.env.GITHUB_REF; - if(!ref || (!ref.startsWith("refs/heads/") && !ref.startsWith("refs/tags/"))) throw Error("Select a trusted repository branch or release tag"); - const tag=ref.replace(/^refs\/tags\//, ""); - if(tag.startsWith("dsh-v") && tag!=="dsh-v"+JSON.parse(fs.readFileSync("package.json","utf8")).version) throw Error("Release tag must match product version"); - if(!["test","production"].includes(process.env.DSH_PACKAGING_PRESET)) throw Error("Invalid preset");' - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - package-manager-cache: false - - name: Record CUA helper build inputs - id: build-inputs - run: node scripts/cua-helper/build-inputs.ts - - name: Find reusable CUA helper - if: inputs.reuse - id: retained - env: - GH_TOKEN: ${{ github.token }} - CUA_MACOS_RUN_ID: ${{ inputs.cua_macos_run_id }} - CUA_BUILD_KEY: ${{ steps.build-inputs.outputs.build-key }} - run: node scripts/cua-helper/select-artifact.ts - - uses: pnpm/action-setup@v5.0.0 - if: steps.retained.outputs.artifact-id == '' - with: - dest: ${{ runner.temp }}/setup-pnpm-cua-${{ github.run_id }}-${{ github.run_attempt }} - - name: Install locked dependencies - if: steps.retained.outputs.artifact-id == '' - run: pnpm install --frozen-lockfile --ignore-scripts --ignore-pnpmfile - - name: Build and verify notarized applications - if: steps.retained.outputs.artifact-id == '' - env: - CUA_EXPECTED_BUILD_KEY: ${{ steps.build-inputs.outputs.build-key }} - run: | - mkdir -p dist - node --import tsx/esm scripts/cua-helper/package.ts --out dist/cua-helper - - uses: actions/upload-artifact@v7.0.1 - if: steps.retained.outputs.artifact-id == '' - id: upload - with: - name: cua-helper-macos-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.build-inputs.outputs.build-key }} - path: dist/cua-helper/* - if-no-files-found: error - compression-level: 0 - retention-days: 14 - - name: Record newly built artifact - if: steps.retained.outputs.artifact-id == '' - env: - CUA_ARTIFACT_ID: ${{ steps.upload.outputs.artifact-id }} - run: | - printf '已构建 CUA helper,run ID `%s`,artifact ID `%s`。\n' "$GITHUB_RUN_ID" "$CUA_ARTIFACT_ID" >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/cua-helper-package-windows.yml b/.github/workflows/cua-helper-package-windows.yml deleted file mode 100644 index 0c995bf0ce..0000000000 --- a/.github/workflows/cua-helper-package-windows.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Package CUA helper · Windows · x64 - -on: - workflow_dispatch: - workflow_call: - outputs: - artifact-id: - description: '包含 win-x64 helper ZIP 的产物编号' - value: ${{ jobs.package.outputs.artifact-id }} - run-id: - description: '产物所属的构建运行编号' - value: ${{ jobs.package.outputs.run-id }} - build-key: - description: '提交 SHA、.NET SDK 版本和 win-x64 RID 的 SHA-256 摘要' - value: ${{ jobs.package.outputs.build-key }} - -permissions: - contents: read - -jobs: - package: - runs-on: windows-latest - timeout-minutes: 30 - defaults: - run: - shell: pwsh - outputs: - artifact-id: ${{ steps.upload.outputs.artifact-id }} - run-id: ${{ github.run_id }} - build-key: ${{ steps.metadata.outputs.build-key }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - uses: actions/setup-dotnet@v5.4.0 - with: - dotnet-version: '10.0.x' - - name: Restore locked Windows helper and run protocol checks - run: | - dotnet restore packages/experimental/cua-windows/native/cua-windows.slnx --locked-mode - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet run --project packages/experimental/cua-windows/native/tests/Protocol.Tests.csproj --configuration Release --no-restore - - name: Publish Windows CUA helper - run: >- - dotnet publish packages/experimental/cua-windows/native/entry/CuaWindows.csproj - --configuration Release - --runtime win-x64 - --self-contained true - --no-restore - --output dist/cua-helper-win-x64 - # Standalone helper zip contract: flat root with cua-helper.json, - # dsh-cua-windows.exe, and its runtime files. Installed providers place - # the same payload under native/bin/win-x64. - - name: Add helper metadata - id: metadata - env: - GITHUB_SHA: ${{ github.sha }} - run: | - $ErrorActionPreference = 'Stop' - $directory = 'dist/cua-helper-win-x64' - $exe = Join-Path $directory 'dsh-cua-windows.exe' - if (-not (Test-Path $exe -PathType Leaf)) { throw "helper executable is missing: $exe" } - $version = (Get-Content package.json -Raw | ConvertFrom-Json).version - $commit = $env:GITHUB_SHA - $sdk = (& dotnet --version).Trim() - $keyBytes = [Text.Encoding]::UTF8.GetBytes("$commit`n$sdk`nwin-x64") - $buildKey = [Convert]::ToHexString([Security.Cryptography.SHA256]::HashData($keyBytes)).ToLowerInvariant() - $files = [ordered]@{} - Get-ChildItem $directory -Recurse -File | Sort-Object FullName | ForEach-Object { - $relative = [IO.Path]::GetRelativePath($directory, $_.FullName) -replace '\\', '/' - $files[$relative] = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant() - } - # sha256 is the executable alias of files[dsh-cua-windows.exe]. - # signing is an enum: unsigned or authenticode. - $metadata = [ordered]@{ - schemaVersion = 1 - platform = 'windows' - buildKey = $buildKey - version = $version - commit = $commit - architecture = 'x64' - executable = 'dsh-cua-windows.exe' - sha256 = $files['dsh-cua-windows.exe'] - signing = 'unsigned' - files = $files - } - $json = $metadata | ConvertTo-Json -Depth 5 - Set-Content -Path (Join-Path $directory 'cua-helper.json') -Value "$json`n" -NoNewline -Encoding utf8NoBOM - Add-Content -Path $env:GITHUB_OUTPUT -Value "build-key=$buildKey`n" -NoNewline -Encoding utf8 - - name: Archive publish output - run: | - $zipPath = 'dist/cua-helper-win-x64.zip' - Compress-Archive -Path dist/cua-helper-win-x64/* -DestinationPath $zipPath - $zip = [IO.Compression.ZipFile]::OpenRead((Resolve-Path $zipPath).Path) - try { - foreach ($name in 'dsh-cua-windows.exe', 'cua-helper.json') { - if (-not $zip.GetEntry($name)) { throw "Missing root entry in helper ZIP: $name" } - } - } finally { $zip.Dispose() } - - uses: actions/upload-artifact@v7.0.1 - id: upload - with: - name: cua-helper-windows-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.metadata.outputs.build-key }} - path: dist/cua-helper-win-x64.zip - if-no-files-found: error - compression-level: 0 - retention-days: 14 diff --git a/.github/workflows/desktop-publish.yml b/.github/workflows/desktop-publish.yml deleted file mode 100644 index a13d7ed461..0000000000 --- a/.github/workflows/desktop-publish.yml +++ /dev/null @@ -1,264 +0,0 @@ -name: Publish Desktop · COS - -run-name: Publish Desktop package ${{ inputs.package_run_id }} / attempt ${{ inputs.package_run_attempt || 'latest' }} - -on: - workflow_dispatch: - inputs: - package_run_id: - description: '打包运行 ID:填写成功的 Package Desktop run ID;发布环境和 release ID 沿用原包' - type: string - required: true - staging_percentage: - description: '更新灰度比例:0–100 整数,默认 100;留空沿用包内值,作用于原包所属渠道' - type: string - required: false - default: '100' - upload_website: - description: '同时上传官网安装包并刷新缓存(仅 production);取消后仅执行版本与自动更新发布' - type: boolean - default: true - required: true - package_run_attempt: - description: '打包尝试次数:留空选择最新一次,且必须成功;失败时不会回退到旧包' - type: string - required: false - default: '' - -permissions: - contents: read - actions: read - -jobs: - route: - runs-on: ubuntu-latest - outputs: - selection: ${{ steps.route.outputs.selection }} - runner: ${{ steps.route.outputs.runner }} - steps: - - name: Require master for publication - run: node -e "if (process.env.GITHUB_REF !== 'refs/heads/master') throw new Error('Desktop publication must be dispatched from master')" - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - name: Reject debugging packages before dependency installation - id: preflight - env: - GH_TOKEN: ${{ github.token }} - run: node apps/desktop-publisher/src/preflight-desktop-publish.mjs - - uses: pnpm/action-setup@v5.0.0 - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - run: pnpm install --frozen-lockfile - - name: Resolve original package and machine - id: route - env: - GH_TOKEN: ${{ github.token }} - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - DESKTOP_PACKAGE_ATTEMPT: ${{ steps.preflight.outputs.attempt }} - run: node --import tsx apps/desktop-publisher/src/resolve-desktop-publish-ci.ts - - prepare: - needs: route - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - timeout-minutes: 30 - outputs: - route: ${{ steps.local.outputs.route }} - preset: ${{ steps.local.outputs.preset }} - approval: ${{ steps.check.outputs.approval }} - website-approval: ${{ steps.check.outputs.website-approval }} - website-destination: ${{ steps.check.outputs.website-destination }} - label: ${{ steps.check.outputs.label }} - env: - DESKTOP_STAGING_PERCENTAGE: ${{ inputs.staging_percentage }} - DESKTOP_PACKAGE_SELECTION: ${{ needs.route.outputs.selection }} - DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }} - DSH_TELEMETRY_DISABLED: '1' - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: desktop-publisher - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: desktop-publisher/package.json - dest: ${{ runner.temp }}/publish-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration before dependency installation - working-directory: desktop-publisher - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm install --frozen-lockfile - working-directory: desktop-publisher - - name: Resolve retained package and approval environment - id: local - working-directory: desktop-publisher - env: - GH_TOKEN: ${{ github.token }} - run: node --import tsx apps/desktop-publisher/src/resolve-retained-desktop-publish-ci.ts - - name: Verify local package without upload credentials - id: check - working-directory: desktop-publisher - env: - DESKTOP_PUBLISH_ROUTE: ${{ steps.local.outputs.route }} - run: node --import tsx apps/desktop/scripts/publish-desktop-ci.ts --check - - publish: - name: Approve ${{ needs.prepare.outputs.label }} - needs: [route, prepare] - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - environment: ${{ needs.prepare.outputs.preset == 'production' && 'desktop-production' || 'desktop-test' }} - concurrency: - group: desktop-publish-${{ needs.route.outputs.runner }}-${{ needs.prepare.outputs.preset }} - cancel-in-progress: false - timeout-minutes: 90 - env: - DESKTOP_STAGING_PERCENTAGE: ${{ inputs.staging_percentage }} - DESKTOP_APPROVED_PACKAGE: ${{ needs.prepare.outputs.approval }} - DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }} - DSH_TELEMETRY_DISABLED: '1' - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: desktop-publisher - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: desktop-publisher/package.json - dest: ${{ runner.temp }}/publish-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration before dependency installation - working-directory: desktop-publisher - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm install --frozen-lockfile - working-directory: desktop-publisher - - name: Verify local package without upload credentials - id: check - working-directory: desktop-publisher - run: node --import tsx apps/desktop/scripts/publish-desktop-ci.ts --check - - name: Read machine GitHub App key - if: needs.prepare.outputs.preset == 'production' - id: key - env: - APP_KEY_FILE: ${{ steps.check.outputs.app-key-file }} - working-directory: desktop-publisher - run: node apps/desktop/scripts/read-desktop-app-key.mjs - - name: Create short-lived tag token - if: needs.prepare.outputs.preset == 'production' - id: app - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 - with: - client-id: ${{ steps.check.outputs.app-client-id }} - private-key: ${{ steps.key.outputs.private-key }} - owner: ${{ github.repository_owner }} - repositories: ${{ github.event.repository.name }} - permission-contents: write - - name: Publish files, update feeds and record release tag - id: publish - working-directory: desktop-publisher - env: - DESKTOP_TAG_TOKEN: ${{ steps.app.outputs.token }} - run: node --import tsx apps/desktop/scripts/publish-desktop-ci.ts --publish - - name: Retain publication audit - continue-on-error: true - if: always() && steps.publish.outputs.record != '' - uses: actions/upload-artifact@v7.0.1 - with: - name: desktop-publication-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.publish.outputs.record }}/ - if-no-files-found: error - retention-days: 30 - - upload-website-installer: - needs: [route, prepare, publish] - if: inputs.upload_website && needs.prepare.outputs.preset != 'test' - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - environment: desktop-production - timeout-minutes: 60 - concurrency: - group: desktop-website-upload-${{ needs.prepare.outputs.website-destination }} - cancel-in-progress: false - env: - DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }} - DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: website-publisher - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: website-publisher/package.json - dest: ${{ runner.temp }}/website-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration - working-directory: website-publisher - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm install --frozen-lockfile - working-directory: website-publisher - - name: Upload website installer - id: website - working-directory: website-publisher - run: node --import tsx apps/desktop-publisher/src/publish-website-ci.ts upload - - name: Archive website publication diagnostics - if: always() && steps.website.outputs.record != '' - continue-on-error: true - uses: actions/upload-artifact@v7.0.1 - with: - name: website-upload-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.website.outputs.record }}/ - if-no-files-found: warn - retention-days: 30 - - purge-website-installer: - needs: [route, prepare, upload-website-installer] - if: inputs.upload_website && needs.prepare.outputs.preset != 'test' - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - environment: desktop-production - timeout-minutes: 60 - concurrency: - group: desktop-website-purge-${{ needs.prepare.outputs.website-destination }} - cancel-in-progress: false - env: - DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }} - DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: website-publisher - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: website-publisher/package.json - dest: ${{ runner.temp }}/website-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration - working-directory: website-publisher - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm install --frozen-lockfile - working-directory: website-publisher - - name: Recover and observe website cache purge - id: website - working-directory: website-publisher - run: node --import tsx apps/desktop-publisher/src/publish-website-ci.ts purge - - name: Archive website publication diagnostics - if: always() && steps.website.outputs.record != '' - continue-on-error: true - uses: actions/upload-artifact@v7.0.1 - with: - name: website-purge-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.website.outputs.record }}/ - if-no-files-found: warn - retention-days: 30 diff --git a/.github/workflows/desktop-rollout.yml b/.github/workflows/desktop-rollout.yml deleted file mode 100644 index 6f0fb9e8ba..0000000000 --- a/.github/workflows/desktop-rollout.yml +++ /dev/null @@ -1,262 +0,0 @@ -name: Publish Desktop · Rollout & Website - -run-name: Rollout Desktop package ${{ inputs.package_run_id }} / attempt ${{ inputs.package_run_attempt }} · ${{ inputs.rollout_percentage && format('{0}%', inputs.rollout_percentage) || 'website only' }} - -on: - workflow_dispatch: - inputs: - package_run_id: - description: '已经完成首次 COS 发布的 Package Desktop run ID' - type: string - required: true - rollout_percentage: - description: '目标放量比例:0–100 整数,只允许保持或增加;留空只发布官网' - type: string - required: false - default: '' - upload_website: - description: '上传已发布版本的官网安装包并刷新缓存(仅 production,不要求放量达到 100%)' - type: boolean - default: false - required: true - package_run_attempt: - description: '已发布的原打包 attempt;默认 1,请核对原 run' - type: string - required: true - default: '1' - -permissions: - contents: read - actions: read - -jobs: - route: - runs-on: ubuntu-latest - outputs: - selection: ${{ steps.route.outputs.selection }} - runner: ${{ steps.route.outputs.runner }} - steps: - - name: Require master for publication - run: node -e "if (process.env.GITHUB_REF !== 'refs/heads/master') throw new Error('Desktop publication must be dispatched from master')" - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - name: Reject debugging packages before dependency installation - id: preflight - env: - GH_TOKEN: ${{ github.token }} - run: node apps/desktop-publisher/src/preflight-desktop-publish.mjs - - uses: pnpm/action-setup@v5.0.0 - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts - - name: Resolve original package and machine - id: route - env: - GH_TOKEN: ${{ github.token }} - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - DESKTOP_PACKAGE_ATTEMPT: ${{ steps.preflight.outputs.attempt }} - working-directory: apps/desktop-publisher - run: node --import tsx src/resolve-desktop-publish-ci.ts - - prepare: - needs: route - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - timeout-minutes: 30 - outputs: - route: ${{ steps.local.outputs.route }} - preset: ${{ steps.local.outputs.preset }} - rollout-requested: ${{ steps.check.outputs.rollout-requested }} - approval: ${{ steps.check.outputs.approval }} - website-approval: ${{ steps.check.outputs.website-approval }} - website-destination: ${{ steps.check.outputs.website-destination }} - label: ${{ steps.check.outputs.label }} - env: - DESKTOP_ROLLOUT_PERCENTAGE: ${{ inputs.rollout_percentage }} - DESKTOP_PACKAGE_SELECTION: ${{ needs.route.outputs.selection }} - DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }} - DSH_TELEMETRY_DISABLED: '1' - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: desktop-rollout - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: desktop-rollout/package.json - dest: ${{ runner.temp }}/publish-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration before dependency installation - working-directory: desktop-rollout - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts - working-directory: desktop-rollout - - name: Resolve retained package and approval environment - id: local - working-directory: desktop-rollout/apps/desktop-publisher - env: - GH_TOKEN: ${{ github.token }} - run: node --import tsx src/publish-desktop-rollout-ci.ts route - - name: Verify initial publication and metadata without upload credentials - id: check - working-directory: desktop-rollout/apps/desktop-publisher - env: - DESKTOP_PUBLISH_ROUTE: ${{ steps.local.outputs.route }} - run: node --import tsx src/publish-desktop-rollout-ci.ts check - - publish: - name: Approve ${{ needs.prepare.outputs.label }} - needs: [route, prepare] - if: needs.prepare.outputs.rollout-requested == 'true' - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - environment: ${{ needs.prepare.outputs.preset == 'production' && 'desktop-production' || 'desktop-test' }} - concurrency: - group: desktop-publish-${{ needs.route.outputs.runner }}-${{ needs.prepare.outputs.preset }} - cancel-in-progress: false - timeout-minutes: 90 - env: - DESKTOP_ROLLOUT_PERCENTAGE: ${{ inputs.rollout_percentage }} - DESKTOP_ROLLOUT_APPROVAL: ${{ needs.prepare.outputs.approval }} - DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }} - DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }} - DSH_TELEMETRY_DISABLED: '1' - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: desktop-rollout - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: desktop-rollout/package.json - dest: ${{ runner.temp }}/publish-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration before dependency installation - working-directory: desktop-rollout - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts - working-directory: desktop-rollout - - name: Verify initial publication and metadata without upload credentials - id: check - working-directory: desktop-rollout/apps/desktop-publisher - run: node --import tsx src/publish-desktop-rollout-ci.ts check - - name: Apply rollout to the published feed - id: publish - working-directory: desktop-rollout/apps/desktop-publisher - run: node --import tsx src/publish-desktop-rollout-ci.ts apply - - name: Retain publication audit - continue-on-error: true - if: always() && steps.publish.outputs.record != '' - uses: actions/upload-artifact@v7.0.1 - with: - name: desktop-publication-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.publish.outputs.record }}/ - if-no-files-found: error - retention-days: 30 - - upload-website-installer: - name: Website ${{ needs.prepare.outputs.label }} - needs: [route, prepare, publish] - if: ${{ !cancelled() && inputs.upload_website && needs.prepare.result == 'success' && needs.prepare.outputs.preset != 'test' && (needs.publish.result == 'success' || (needs.publish.result == 'skipped' && needs.prepare.outputs.rollout-requested == 'false')) }} - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - environment: desktop-production - timeout-minutes: 60 - concurrency: - group: desktop-website-upload-${{ needs.prepare.outputs.website-destination }} - cancel-in-progress: false - env: - DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }} - DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }} - DESKTOP_ROLLOUT_APPROVAL: ${{ needs.prepare.outputs.approval }} - DESKTOP_ROLLOUT_PERCENTAGE: ${{ inputs.rollout_percentage }} - DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: website-rollout - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: website-rollout/package.json - dest: ${{ runner.temp }}/website-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration - working-directory: website-rollout - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts - working-directory: website-rollout - - name: Upload website installer - id: website - working-directory: website-rollout/apps/desktop-publisher - run: node --import tsx src/publish-desktop-rollout-ci.ts website-upload - - name: Archive website feed verification - if: always() && steps.website.outputs.rollout-record != '' - continue-on-error: true - uses: actions/upload-artifact@v7.0.1 - with: - name: website-feed-verification-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.website.outputs.rollout-record }}/ - if-no-files-found: warn - retention-days: 30 - - name: Archive website publication diagnostics - if: always() && steps.website.outputs.record != '' - continue-on-error: true - uses: actions/upload-artifact@v7.0.1 - with: - name: website-upload-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.website.outputs.record }}/ - if-no-files-found: warn - retention-days: 30 - - purge-website-installer: - needs: [route, prepare, upload-website-installer] - if: ${{ !cancelled() && inputs.upload_website && needs.prepare.outputs.preset != 'test' && needs.upload-website-installer.result == 'success' }} - runs-on: [self-hosted, '${{ needs.route.outputs.runner }}'] - timeout-minutes: 60 - concurrency: - group: desktop-website-purge-${{ needs.prepare.outputs.website-destination }} - cancel-in-progress: false - env: - DESKTOP_PUBLISH_ROUTE: ${{ needs.prepare.outputs.route }} - DESKTOP_WEBSITE_APPROVAL: ${{ needs.prepare.outputs.website-approval }} - DESKTOP_UPLOAD_WEBSITE: ${{ inputs.upload_website }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: false - path: website-rollout - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: website-rollout/package.json - dest: ${{ runner.temp }}/website-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Check local publication configuration - working-directory: website-rollout - run: node apps/desktop-publisher/src/preflight-desktop-publish-local.mjs - - run: pnpm --filter @deepseek-ai/dsh-desktop-publisher --fail-if-no-match install --prod --frozen-lockfile --ignore-scripts - working-directory: website-rollout - - name: Recover and observe website cache purge - id: website - working-directory: website-rollout/apps/desktop-publisher - run: node --import tsx src/publish-desktop-rollout-ci.ts website-purge - - name: Archive website publication diagnostics - if: always() && steps.website.outputs.record != '' - continue-on-error: true - uses: actions/upload-artifact@v7.0.1 - with: - name: website-purge-${{ github.run_id }}-${{ github.run_attempt }} - path: ${{ steps.website.outputs.record }}/ - if-no-files-found: warn - retention-days: 30 diff --git a/.github/workflows/docs-pages.yml b/.github/workflows/docs-pages.yml deleted file mode 100644 index 4aef62f751..0000000000 --- a/.github/workflows/docs-pages.yml +++ /dev/null @@ -1,93 +0,0 @@ -# Publish the documentation website to GitHub Pages. This workflow is manual-only -# (workflow_dispatch) and intentionally does not listen to pull_request or push: -# the site presents a released snapshot, so publication is an explicit act from a -# dsh-v* tag and must never appear as a PR check. `release:verify` rejects every -# other ref, and the github-pages environment repeats that restriction as a -# deployment tag policy with required reviewers. -# -# The build signal does not depend on this workflow. Every pull request builds -# the production site through `check:ci:static`, and ci-master.yml builds it -# again on master. -name: Deploy documentation - -on: - workflow_dispatch: - -concurrency: - group: github-pages - cancel-in-progress: false - -permissions: - contents: read - -env: - PRIMARY_NODE_VERSION: '^24.22.3' - # Projected source links target the public repository, whose history can - # differ from this workflow's source repository. This stays on master rather - # than following the dispatched tag: that repository advances only to each - # release commit, so its master never carries unreleased work, and it retains - # only the most recent tags — following the tag would leave every projected - # source link on an older deploy unresolvable. - DOCS_REPOSITORY_REF: master - # CI runs must never report to the production telemetry endpoint baked - # into apps/cli/cordis.yml (AppCLIEntry disables the row when set). - DSH_TELEMETRY_DISABLED: '1' - -jobs: - build: - runs-on: blacksmith-8vcpu-ubuntu-2404 - permissions: - contents: read - pages: read - steps: - # Complete history: the release scripts read tags. - - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - - - uses: pnpm/action-setup@v5.0.0 - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - cache: pnpm - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - # One definition of "released" for the site and the npm sequence: this - # rejects every ref that is not a dsh-v* tag naming the version this tree - # carries. - - name: Verify release version - env: - RELEASE_PUBLISH: 'true' - run: pnpm run release:verify --family dsh - - - name: Configure Pages - id: pages - uses: actions/configure-pages@v6 - - - name: Verify and build documentation - env: - DOCS_BASE: ${{ steps.pages.outputs.base_path }}/ - run: pnpm run doc-sync - - - name: Upload Pages artifact - uses: actions/upload-pages-artifact@v5 - with: - path: website/.dist - - deploy: - needs: build - runs-on: ubuntu-latest - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v5 diff --git a/.github/workflows/macos-intel-package.yml b/.github/workflows/macos-intel-package.yml deleted file mode 100644 index 9b0b12a31f..0000000000 --- a/.github/workflows/macos-intel-package.yml +++ /dev/null @@ -1,247 +0,0 @@ -name: Package Desktop · macOS · Intel - -on: - workflow_dispatch: - inputs: - source_ref: - description: '打包源码:test 支持仓库内分支或 dsh-v* tag;production 仅支持 master 或 dsh-v* tag;源码须包含 CI 适配脚本' - type: string - default: master - required: true - preset: - description: '打包环境:选择机器上的 test 或 production 配置;同时决定后续发布环境' - type: choice - options: [test, production] - default: test - required: true - update_channel: - description: '升级通道:人工选择 nightly 或 stable,与版本后缀无关;默认通道由此打包输入确定' - type: choice - options: [nightly, stable] - default: nightly - required: true - version_mode: - description: '版本模式:default 按环境自动选择(test 取 build-number,production 取 follow-dsh);follow-dsh 跟随 dsh 包版本号;build-number 自动追加构建编号;manual 手填' - type: choice - options: [default, follow-dsh, build-number, manual] - default: default - required: true - build_version: - description: '手动版本号:仅 manual 时填写完整版本;须为产品原版本或受支持的预发布后缀' - type: string - default: '' - required: false - test_release_id: - description: '测试 release ID:32 位小写十六进制随机前缀(非鉴权);留空使用机器默认值,连续升级测试须保持相同值' - type: string - default: '' - required: false - compression_level: - description: 'ZIP 压缩等级:只影响 ZIP 和自动升级下载,不影响 DMG;3 打包较快,7 压缩更强' - type: choice - options: ['3', '7'] - default: '3' - required: true - skip_notarization: - description: '跳过公证和 stapling:仅限内部调试,禁止发布到 test / production 或用于自动更新;需要发布请勿勾选' - type: boolean - default: false - required: true - -permissions: - contents: read - -concurrency: - group: macos-desktop-package - cancel-in-progress: false - -jobs: - package: - outputs: - directory: ${{ steps.retained.outputs.directory }} - runner: ${{ steps.retained.outputs.runner }} - runner-name: ${{ steps.retained.outputs.runner-name }} - attempt: ${{ steps.retained.outputs.attempt }} - version: ${{ steps.settings.outputs.version }} - mode: ${{ steps.settings.outputs.mode }} - runs-on: [self-hosted, macOS, ARM64, dsh-mac-package-trial] - timeout-minutes: 180 - defaults: - run: - shell: bash - env: - DSH_DESKTOP_TARGET_PLATFORM: darwin - DSH_DESKTOP_TARGET_ARCH: x64 - PACKAGE_MACOS_ZIP_COMPRESSION_LEVEL: ${{ inputs.compression_level }} - PACKAGE_SKIP_NOTARIZATION: ${{ inputs.skip_notarization }} - PACKAGE_SOURCE_REF: ${{ inputs.source_ref }} - # TODO: Remove this legacy source_ref mode mapping on 2027-01-04 with the parser aliases. - PACKAGE_VERSION_MODE: ${{ inputs.version_mode == 'follow-dsh' && 'product' || inputs.version_mode == 'build-number' && 'auto' || inputs.version_mode }} - DSH_DESKTOP_UPDATE_CHANNEL: ${{ inputs.update_channel }} - DSH_TELEMETRY_DISABLED: '1' - DSH_PACKAGING_PRESET: ${{ inputs.preset }} - PACKAGE_TEST_RELEASE_ID: ${{ inputs.test_release_id }} - steps: - - uses: actions/checkout@v7.0.1 - id: checkout - with: - persist-credentials: false - clean: true - ref: ${{ inputs.source_ref }} - - name: Validate selected source and adapter support - run: >- - node -e "const fs=require('node:fs'); const ref=process.env.PACKAGE_SOURCE_REF; - const cp=require('node:child_process'); const preset=process.env.DSH_PACKAGING_PRESET; - if(!['test','production'].includes(preset)) throw Error('Unknown packaging preset'); - const tag=/^dsh-v[0-9][0-9A-Za-z.-]*$/.test(ref); - if(preset==='production' && ref!=='master' && !tag) throw Error('Production source must be master or dsh-v*'); - if(tag) { - const v=JSON.parse(fs.readFileSync('package.json','utf8')).version; - if(ref!=='dsh-v'+v) throw Error('Source tag must match product version'); - const tagged=cp.execFileSync('git',['rev-parse','--verify','refs/tags/'+ref+'^{commit}'],{encoding:'utf8'}).trim(); - const head=cp.execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim(); - if(tagged!==head) throw Error('Checkout does not match source tag'); - } else { - const branch=cp.execFileSync('git',['rev-parse','--abbrev-ref','HEAD'],{encoding:'utf8'}).trim(); - if(branch==='HEAD' || branch!==ref || ref.startsWith('refs/')) throw Error('Select a branch in this repository, not a SHA or PR ref'); - } - if(!fs.readFileSync('apps/desktop/scripts/prepare-macos-ci.mjs','utf8').includes('resolveDesktopBuildTarget')) throw Error('Source lacks Intel macOS CI support; select a newer source'); - if(!fs.readFileSync('apps/desktop/scripts/retain-desktop-ci.ts','utf8').includes('--check-runner')) throw Error('Source lacks independent Desktop artifact archival support; select a newer source'); - if(!fs.readFileSync('apps/desktop/scripts/desktop-ci-version.mjs','utf8').includes('PACKAGE_VERSION_MODE')) throw Error('Source lacks Desktop channel/version CI support; select a newer release');" - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Configure persistent package caches - env: - DSH_DESKTOP_PACKAGE_CACHE_DIR: ${{ runner.tool_cache }}/dsh-desktop-package-cache - run: | - echo "DSH_DESKTOP_PACKAGE_CACHE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR" >> "$GITHUB_ENV" - echo "PNPM_CONFIG_STORE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR/workspace-pnpm-store" >> "$GITHUB_ENV" - - name: Check Rosetta execution - run: arch -x86_64 /usr/bin/true - - name: Install locked dependencies - run: pnpm install --frozen-lockfile - - name: Check original machine archival route - env: - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - run: node --import tsx apps/desktop/scripts/retain-desktop-ci.ts --check-runner - - name: Validate preset and resolve build version - id: settings - env: - PACKAGE_BUILD_VERSION: ${{ inputs.build_version }} - run: node apps/desktop/scripts/prepare-macos-ci.mjs - - name: Check packaging configuration and toolchain - env: - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: | - args=() - if [[ "$PACKAGE_SKIP_NOTARIZATION" = true ]]; then args+=(--skip-notarization); fi - pnpm run package:desktop:mac:x64 --check --build-version "$PACKAGE_VERSION" "${args[@]}" - - name: Build and stage notarized Computer Use helpers - # A source whose dsh ships the Computer Use bundle packs the workspace provider into the Desktop runtime, - # which therefore needs the same notarized helper npm publication stages. - run: | - if ! node -e "process.exit(require('./apps/cli/package.json').dependencies?.['@deepseek-ai/dsh-cua-bundle'] ? 0 : 1)"; then - echo 'This source does not ship Computer Use in Desktop; no helper is staged.' - exit 0 - fi - if [[ ! -f scripts/cua-helper/package.ts ]]; then - echo '::warning::This source ships Computer Use but predates helper packaging; Computer Use cannot prepare its helper in this package.' - exit 0 - fi - mkdir -p dist - pnpm exec tsx scripts/cua-helper/package.ts --out dist/cua-helper - mkdir dist/cua-helper/extracted - tar -xzf dist/cua-helper/cua-helper.tgz -C dist/cua-helper/extracted - pnpm exec tsx scripts/cua-helper/stage.ts --from dist/cua-helper/extracted - - name: Build signed installers - env: - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: | - args=() - if [[ "$PACKAGE_SKIP_NOTARIZATION" = true ]]; then args+=(--skip-notarization); fi - pnpm run package:desktop:mac:x64 --build-version "$PACKAGE_VERSION" "${args[@]}" - - name: Retain complete package outside the checkout - id: retained - env: - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - PACKAGE_SOURCE_SHA: ${{ steps.checkout.outputs.commit }} - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: node --import tsx apps/desktop/scripts/retain-desktop-ci.ts - - name: Retain packaging diagnostics - continue-on-error: true - if: always() && steps.checkout.outcome == 'success' - uses: actions/upload-artifact@v7.0.1 - with: - name: macos-x64-package-logs-${{ github.run_id }}-${{ github.run_attempt }} - include-hidden-files: true - path: apps/desktop/.desktop-build/packaging-runs/ - if-no-files-found: warn - retention-days: 14 - - upload-artifact: - needs: package - runs-on: [self-hosted, '${{ needs.package.outputs.runner }}'] - timeout-minutes: 30 - env: - DESKTOP_RETAINED_DIRECTORY: ${{ needs.package.outputs.directory }} - DESKTOP_ARCHIVE_NAME: macos-x64-${{ needs.package.outputs.mode }}-${{ needs.package.outputs.version }}-${{ github.run_id }}-${{ needs.package.outputs.attempt }}.zip - DESKTOP_PACKAGE_ATTEMPT: ${{ needs.package.outputs.attempt }} - DESKTOP_PACKAGE_RUNNER: ${{ needs.package.outputs.runner-name }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - path: artifact-archiver - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: artifact-archiver/package.json - dest: ${{ runner.temp }}/archive-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Configure persistent package caches - env: - DSH_DESKTOP_PACKAGE_CACHE_DIR: ${{ runner.tool_cache }}/dsh-desktop-package-cache - run: | - echo "DSH_DESKTOP_PACKAGE_CACHE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR" >> "$GITHUB_ENV" - echo "PNPM_CONFIG_STORE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR/workspace-pnpm-store" >> "$GITHUB_ENV" - - run: pnpm install --frozen-lockfile - working-directory: artifact-archiver - - name: Archive verified retained build - id: archive - working-directory: artifact-archiver - run: node --import tsx apps/desktop/scripts/archive-desktop-ci.ts --split-macos - - name: Retain DMG installer - if: ${{ !cancelled() && steps.archive.outcome == 'success' }} - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.dmg-name }} - path: ${{ steps.archive.outputs.dmg-path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true - - name: Retain update ZIP - if: ${{ !cancelled() && steps.archive.outcome == 'success' }} - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.update-name }} - path: ${{ steps.archive.outputs.update-path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true - - name: Retain package metadata - if: ${{ !cancelled() && steps.archive.outcome == 'success' }} - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.metadata-name }} - path: ${{ steps.archive.outputs.metadata-path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true diff --git a/.github/workflows/macos-package.yml b/.github/workflows/macos-package.yml deleted file mode 100644 index 2bf64d6d3c..0000000000 --- a/.github/workflows/macos-package.yml +++ /dev/null @@ -1,244 +0,0 @@ -name: Package Desktop · macOS · Apple Silicon - -on: - workflow_dispatch: - inputs: - source_ref: - description: '打包源码:test 支持仓库内分支或 dsh-v* tag;production 仅支持 master 或 dsh-v* tag;源码须包含 CI 适配脚本' - type: string - default: master - required: true - preset: - description: '打包环境:选择机器上的 test 或 production 配置;同时决定后续发布环境' - type: choice - options: [test, production] - default: test - required: true - update_channel: - description: '升级通道:人工选择 nightly 或 stable,与版本后缀无关;默认通道由此打包输入确定' - type: choice - options: [nightly, stable] - default: nightly - required: true - version_mode: - description: '版本模式:default 按环境自动选择(test 取 build-number,production 取 follow-dsh);follow-dsh 跟随 dsh 包版本号;build-number 自动追加构建编号;manual 手填' - type: choice - options: [default, follow-dsh, build-number, manual] - default: default - required: true - build_version: - description: '手动版本号:仅 manual 时填写完整版本;须为产品原版本或受支持的预发布后缀' - type: string - default: '' - required: false - test_release_id: - description: '测试 release ID:32 位小写十六进制随机前缀(非鉴权);留空使用机器默认值,连续升级测试须保持相同值' - type: string - default: '' - required: false - compression_level: - description: 'ZIP 压缩等级:只影响 ZIP 和自动升级下载,不影响 DMG;3 打包较快,7 压缩更强' - type: choice - options: ['3', '7'] - default: '3' - required: true - skip_notarization: - description: '跳过公证和 stapling:仅限内部调试,禁止发布到 test / production 或用于自动更新;需要发布请勿勾选' - type: boolean - default: false - required: true - -permissions: - contents: read - -concurrency: - group: macos-desktop-package - cancel-in-progress: false - -jobs: - package: - outputs: - directory: ${{ steps.retained.outputs.directory }} - runner: ${{ steps.retained.outputs.runner }} - runner-name: ${{ steps.retained.outputs.runner-name }} - attempt: ${{ steps.retained.outputs.attempt }} - version: ${{ steps.settings.outputs.version }} - mode: ${{ steps.settings.outputs.mode }} - runs-on: [self-hosted, macOS, ARM64, dsh-mac-package-trial] - timeout-minutes: 180 - defaults: - run: - shell: bash - env: - DSH_DESKTOP_TARGET_PLATFORM: darwin - DSH_DESKTOP_TARGET_ARCH: arm64 - PACKAGE_MACOS_ZIP_COMPRESSION_LEVEL: ${{ inputs.compression_level }} - PACKAGE_SKIP_NOTARIZATION: ${{ inputs.skip_notarization }} - PACKAGE_SOURCE_REF: ${{ inputs.source_ref }} - # TODO: Remove this legacy source_ref mode mapping on 2027-01-04 with the parser aliases. - PACKAGE_VERSION_MODE: ${{ inputs.version_mode == 'follow-dsh' && 'product' || inputs.version_mode == 'build-number' && 'auto' || inputs.version_mode }} - DSH_DESKTOP_UPDATE_CHANNEL: ${{ inputs.update_channel }} - DSH_TELEMETRY_DISABLED: '1' - DSH_PACKAGING_PRESET: ${{ inputs.preset }} - PACKAGE_TEST_RELEASE_ID: ${{ inputs.test_release_id }} - steps: - - uses: actions/checkout@v7.0.1 - id: checkout - with: - persist-credentials: false - clean: true - ref: ${{ inputs.source_ref }} - - name: Validate selected source and adapter support - run: >- - node -e "const fs=require('node:fs'); const ref=process.env.PACKAGE_SOURCE_REF; - const cp=require('node:child_process'); const preset=process.env.DSH_PACKAGING_PRESET; - if(!['test','production'].includes(preset)) throw Error('Unknown packaging preset'); - const tag=/^dsh-v[0-9][0-9A-Za-z.-]*$/.test(ref); - if(preset==='production' && ref!=='master' && !tag) throw Error('Production source must be master or dsh-v*'); - if(tag) { - const v=JSON.parse(fs.readFileSync('package.json','utf8')).version; - if(ref!=='dsh-v'+v) throw Error('Source tag must match product version'); - const tagged=cp.execFileSync('git',['rev-parse','--verify','refs/tags/'+ref+'^{commit}'],{encoding:'utf8'}).trim(); - const head=cp.execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim(); - if(tagged!==head) throw Error('Checkout does not match source tag'); - } else { - const branch=cp.execFileSync('git',['rev-parse','--abbrev-ref','HEAD'],{encoding:'utf8'}).trim(); - if(branch==='HEAD' || branch!==ref || ref.startsWith('refs/')) throw Error('Select a branch in this repository, not a SHA or PR ref'); - } - if(!fs.readFileSync('apps/desktop/scripts/retain-desktop-ci.ts','utf8').includes('--check-runner')) throw Error('Source lacks independent Desktop artifact archival support; select a newer source'); - if(!fs.readFileSync('apps/desktop/scripts/desktop-ci-version.mjs','utf8').includes('PACKAGE_VERSION_MODE')) throw Error('Source lacks Desktop channel/version CI support; select a newer release');" - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Configure persistent package caches - env: - DSH_DESKTOP_PACKAGE_CACHE_DIR: ${{ runner.tool_cache }}/dsh-desktop-package-cache - run: | - echo "DSH_DESKTOP_PACKAGE_CACHE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR" >> "$GITHUB_ENV" - echo "PNPM_CONFIG_STORE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR/workspace-pnpm-store" >> "$GITHUB_ENV" - - name: Install locked dependencies - run: pnpm install --frozen-lockfile - - name: Check original machine archival route - env: - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - run: node --import tsx apps/desktop/scripts/retain-desktop-ci.ts --check-runner - - name: Validate preset and resolve build version - id: settings - env: - PACKAGE_BUILD_VERSION: ${{ inputs.build_version }} - run: node apps/desktop/scripts/prepare-macos-ci.mjs - - name: Check packaging configuration and toolchain - env: - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: | - args=() - if [[ "$PACKAGE_SKIP_NOTARIZATION" = true ]]; then args+=(--skip-notarization); fi - pnpm run package:desktop:mac:arm64 --check --build-version "$PACKAGE_VERSION" "${args[@]}" - - name: Build and stage notarized Computer Use helpers - # A source whose dsh ships the Computer Use bundle packs the workspace provider into the Desktop runtime, - # which therefore needs the same notarized helper npm publication stages. - run: | - if ! node -e "process.exit(require('./apps/cli/package.json').dependencies?.['@deepseek-ai/dsh-cua-bundle'] ? 0 : 1)"; then - echo 'This source does not ship Computer Use in Desktop; no helper is staged.' - exit 0 - fi - if [[ ! -f scripts/cua-helper/package.ts ]]; then - echo '::warning::This source ships Computer Use but predates helper packaging; Computer Use cannot prepare its helper in this package.' - exit 0 - fi - mkdir -p dist - pnpm exec tsx scripts/cua-helper/package.ts --out dist/cua-helper - mkdir dist/cua-helper/extracted - tar -xzf dist/cua-helper/cua-helper.tgz -C dist/cua-helper/extracted - pnpm exec tsx scripts/cua-helper/stage.ts --from dist/cua-helper/extracted - - name: Build signed installers - env: - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: | - args=() - if [[ "$PACKAGE_SKIP_NOTARIZATION" = true ]]; then args+=(--skip-notarization); fi - pnpm run package:desktop:mac:arm64 --build-version "$PACKAGE_VERSION" "${args[@]}" - - name: Retain complete package outside the checkout - id: retained - env: - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - PACKAGE_SOURCE_SHA: ${{ steps.checkout.outputs.commit }} - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: node --import tsx apps/desktop/scripts/retain-desktop-ci.ts - - name: Retain packaging diagnostics - continue-on-error: true - if: always() && steps.checkout.outcome == 'success' - uses: actions/upload-artifact@v7.0.1 - with: - name: macos-package-logs-${{ github.run_id }}-${{ github.run_attempt }} - include-hidden-files: true - path: apps/desktop/.desktop-build/packaging-runs/ - if-no-files-found: warn - retention-days: 14 - - upload-artifact: - needs: package - runs-on: [self-hosted, '${{ needs.package.outputs.runner }}'] - timeout-minutes: 30 - env: - DESKTOP_RETAINED_DIRECTORY: ${{ needs.package.outputs.directory }} - DESKTOP_ARCHIVE_NAME: macos-arm64-${{ needs.package.outputs.mode }}-${{ needs.package.outputs.version }}-${{ github.run_id }}-${{ needs.package.outputs.attempt }}.zip - DESKTOP_PACKAGE_ATTEMPT: ${{ needs.package.outputs.attempt }} - DESKTOP_PACKAGE_RUNNER: ${{ needs.package.outputs.runner-name }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - path: artifact-archiver - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: artifact-archiver/package.json - dest: ${{ runner.temp }}/archive-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Configure persistent package caches - env: - DSH_DESKTOP_PACKAGE_CACHE_DIR: ${{ runner.tool_cache }}/dsh-desktop-package-cache - run: | - echo "DSH_DESKTOP_PACKAGE_CACHE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR" >> "$GITHUB_ENV" - echo "PNPM_CONFIG_STORE_DIR=$DSH_DESKTOP_PACKAGE_CACHE_DIR/workspace-pnpm-store" >> "$GITHUB_ENV" - - run: pnpm install --frozen-lockfile - working-directory: artifact-archiver - - name: Archive verified retained build - id: archive - working-directory: artifact-archiver - run: node --import tsx apps/desktop/scripts/archive-desktop-ci.ts --split-macos - - name: Retain DMG installer - if: ${{ !cancelled() && steps.archive.outcome == 'success' }} - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.dmg-name }} - path: ${{ steps.archive.outputs.dmg-path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true - - name: Retain update ZIP - if: ${{ !cancelled() && steps.archive.outcome == 'success' }} - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.update-name }} - path: ${{ steps.archive.outputs.update-path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true - - name: Retain package metadata - if: ${{ !cancelled() && steps.archive.outcome == 'success' }} - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ steps.archive.outputs.metadata-name }} - path: ${{ steps.archive.outputs.metadata-path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true diff --git a/.github/workflows/node-addon-system-release.yml b/.github/workflows/node-addon-system-release.yml deleted file mode 100644 index 7411e2a724..0000000000 --- a/.github/workflows/node-addon-system-release.yml +++ /dev/null @@ -1,188 +0,0 @@ -# Build and publish the @deepseek-ai/node-addon-system package family from the -# harness source of record. Rehearsal and publication consume the same packed -# tarballs; each native binary is built on its matching architecture. -name: Node Addon System Release - -on: - workflow_dispatch: - inputs: - publish: - description: Publish packed tarballs to npm. Must run from a node-addon-system-v* tag. - required: true - type: boolean - default: false - -permissions: - contents: read - -concurrency: - # Stable/prerelease dist-tags are shared registry state; serialize release - # runs so two versions cannot race the final tag assignment. - group: ${{ github.workflow }} - cancel-in-progress: false - -defaults: - run: - working-directory: native/system - -jobs: - matrix: - name: Matrix - runs-on: ubuntu-24.04 - outputs: - prebuilds: ${{ steps.matrix.outputs.prebuilds }} - steps: - - uses: actions/checkout@v7.0.1 - - - id: matrix - run: echo "prebuilds=$(node ./scripts/github-matrix.mjs release-prebuild)" >> "$GITHUB_OUTPUT" - - build-prebuilds: - name: ${{ matrix.package }} - needs: matrix - runs-on: ${{ matrix.runner }} - strategy: - fail-fast: false - matrix: ${{ fromJson(needs.matrix.outputs.prebuilds) }} - steps: - - uses: actions/checkout@v7.0.1 - - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: package.json - - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - - - name: Install dependencies - run: pnpm install --filter @deepseek-ai/node-addon-system-workspace... --frozen-lockfile - - - name: Install musl toolchain - if: runner.os == 'Linux' - run: | - sudo apt-get update -q - sudo apt-get install -yq musl-tools - - - name: Build native binaries - run: pnpm build:native - - - name: Verify binary metadata - run: node ./scripts/verify-launcher-binary.mjs ${{ matrix.dir }} - - - name: Verify the built entry and flock - run: | - pnpm build:ts - pnpm build:test-oracle - pnpm test:flock - pnpm test:packaging - - - name: Upload prebuild artifact - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ matrix.artifact }} - path: native/system/${{ matrix.dir }}/bin/** - if-no-files-found: error - retention-days: 7 - - pack: - name: Pack npm tarballs - needs: build-prebuilds - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v7.0.1 - - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: package.json - - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - - - name: Install dependencies - run: pnpm install --filter @deepseek-ai/node-addon-system-workspace... --frozen-lockfile - - - name: Build TypeScript - run: pnpm build:ts - - - name: Verify release version - run: node ./scripts/verify-release.mjs - env: - RELEASE_PUBLISH: ${{ inputs.publish }} - - - name: Download prebuild artifacts - uses: actions/download-artifact@v8.0.1 - with: - pattern: prebuild-* - path: native/system/.release/prebuild-artifacts - - - name: Assemble and verify prebuilds - run: node ./scripts/assemble-prebuilds.mjs .release/prebuild-artifacts - - - name: Verify release payload - run: node ./scripts/verify-release.mjs --prebuilds - env: - RELEASE_PUBLISH: ${{ inputs.publish }} - - - name: Pack release tarballs - run: node ./scripts/pack-release.mjs dist/npm - - - name: Verify packed install - run: node ./scripts/verify-packed-install.mjs dist/npm - env: - NALR_REQUIRE_LANDLOCK: 1 - - - name: Upload npm tarballs - uses: actions/upload-artifact@v7.0.1 - with: - name: npm-tarballs - path: native/system/dist/npm/* - if-no-files-found: error - retention-days: 7 - - publish: - name: Publish to npm - if: inputs.publish - needs: pack - runs-on: ubuntu-24.04 - environment: npm-publish - permissions: - contents: read - id-token: write - steps: - # The publish script is the only repository file this job needs, and it - # imports nothing outside Node's builtins, so there is no install step. - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - registry-url: https://registry.npmjs.org - - - name: Download npm tarballs - uses: actions/download-artifact@v8.0.1 - with: - name: npm-tarballs - path: native/system/dist/npm - - - name: Configure npm token fallback - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - if [[ -n "$NPM_TOKEN" ]]; then - echo "NODE_AUTH_TOKEN=$NPM_TOKEN" >> "$GITHUB_ENV" - fi - - - name: Publish tarballs - # Publication is decided per package against the registry, so re-running - # this job over the same artifact skips what already landed instead of - # failing on it. A bare `npm publish` loop could not be retried: the - # registry answers a repeat of an existing version permanently. - run: node ./scripts/publish-release.mjs dist/npm diff --git a/.github/workflows/publish-ssh-helper.yml b/.github/workflows/publish-ssh-helper.yml deleted file mode 100644 index 6971be3335..0000000000 --- a/.github/workflows/publish-ssh-helper.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: Release (SSH helper) - -# Validation accepts any ref; publication requires the matching dsh-v tag. -on: - workflow_dispatch: - inputs: - publish: - description: Publish verified archives to GitHub Release. Must run from the matching dsh-v tag. - type: boolean - required: true - default: false - -permissions: - contents: read - -concurrency: - group: publish-ssh-helper-${{ github.ref }} - cancel-in-progress: false - -jobs: - validate: - runs-on: ubuntu-latest - outputs: - version: ${{ steps.source.outputs.version }} - commit: ${{ steps.source.outputs.commit }} - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Resolve source and validate publication tag - id: source - env: - PUBLISH: ${{ inputs.publish }} - run: | - node --input-type=module <<'JS' - import { readFileSync, appendFileSync } from 'node:fs'; - import { execFileSync } from 'node:child_process'; - const {version} = JSON.parse(readFileSync('package.json', 'utf8')); - if (process.env.PUBLISH === 'true' && (process.env.GITHUB_REF_TYPE !== 'tag' || process.env.GITHUB_REF_NAME !== `dsh-v${version}`)) throw new Error('Publication requires the matching dsh-v tag'); - const commit = execFileSync('git', ['rev-parse', 'HEAD'], {encoding:'utf8'}).trim(); - appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\ncommit=${commit}\n`); - JS - build: - needs: validate - uses: ./.github/workflows/build-exe-for-ssh-helper.yml - with: - release: true - verify: - needs: [validate, build] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - uses: pnpm/action-setup@v4 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v6 - with: - node-version: '^24.22.3' - cache: pnpm - - run: pnpm install --frozen-lockfile - - uses: actions/download-artifact@v8 - with: - pattern: ssh-helper-node24-* - path: dist-exe/ssh-helper - merge-multiple: true - - name: Require complete evidence from the selected source commit - env: - RELEASE_VERSION: ${{ needs.validate.outputs.version }} - SOURCE_COMMIT: ${{ needs.validate.outputs.commit }} - run: pnpm exec tsx scripts/ssh-helper/release.ts --directory=dist-exe/ssh-helper --version="$RELEASE_VERSION" --commit="$SOURCE_COMMIT" - - name: Upload verified release checksums - uses: actions/upload-artifact@v7 - with: - name: ssh-helper-release-checksums - path: dist-exe/ssh-helper/SHA256SUMS - if-no-files-found: error - - publish: - if: inputs.publish - needs: [validate, verify] - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/download-artifact@v8 - with: - pattern: ssh-helper-* - path: dist-exe/ssh-helper - merge-multiple: true - - name: Attach the verified archives to the GitHub release - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - RELEASE_TAG: ${{ github.ref_name }} - run: | - if ! gh release view "$RELEASE_TAG" >/dev/null 2>&1; then - gh release create "$RELEASE_TAG" --verify-tag --draft --title "$RELEASE_TAG" --notes 'SSH helper executables for Linux and macOS.' - fi - gh release upload "$RELEASE_TAG" dist-exe/ssh-helper/*.tar.gz dist-exe/ssh-helper/SHA256SUMS diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml deleted file mode 100644 index 0474ccfe92..0000000000 --- a/.github/workflows/python-release.yml +++ /dev/null @@ -1,248 +0,0 @@ -name: Release (Python) - -# A manual run with publish=false builds and validates the complete release -# without registry credentials. Publication is accepted only from a manual run -# on the matching python-v* tag when the private publisher-repository identity -# and public-PyPI switch are configured. -on: - workflow_dispatch: - inputs: - publish: - description: Publish the validated wheels to public PyPI. Must run from a python-v* tag. - required: true - type: boolean - default: false - -permissions: - contents: read - -concurrency: - # Public runs stay globally serialized across tags. Dry runs remain isolated - # by ref so they do not block an intentional publication. - group: ${{ github.event_name == 'workflow_dispatch' && inputs.publish && 'python-publication' || format('{0}-{1}', github.workflow, github.ref) }} - cancel-in-progress: false - -jobs: - build: - name: Build six wheels - uses: ./.github/workflows/build-exe-for-python-sdk.yml - with: - targets: node24-linux-x64,node24-linux-arm64,node24-macos-arm64,node24-macos-x64,node24-win-x64 - release: true - - python-compat: - name: Python ${{ matrix.python }} / installed SDK - needs: build - runs-on: ubuntu-latest - timeout-minutes: 10 - strategy: - fail-fast: false - matrix: - python: ['3.10', '3.14'] - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - - uses: actions/setup-python@v6.3.0 - with: - python-version: ${{ matrix.python }} - - - uses: actions/download-artifact@v8.0.1 - with: - pattern: deepseek_harness_* - path: dist - merge-multiple: true - - - name: Resolve installed wheel version - id: compatibility-version - run: | - python - <<'PY' >> "$GITHUB_OUTPUT" - import runpy - - release = runpy.run_path("scripts/build-python-release.py") - repository_version = release["repository_version"]() - print(f"version={release['pep440_version'](repository_version)}") - PY - - - name: Install local release wheels and run the public entry path - env: - VERSION: ${{ steps.compatibility-version.outputs.version }} - run: | - python -m pip install \ - "dist/deepseek_harness_sdk-$VERSION-py3-none-any.whl" \ - "dist/deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_x86_64.whl" - python scripts/smoke-python-runtime.py --scenario sdk-default - python scripts/smoke-python-runtime.py --scenario sdk-mcp - - validate: - name: Validate release candidate - needs: [build, python-compat] - runs-on: ubuntu-latest - timeout-minutes: 10 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - - uses: actions/setup-python@v6.3.0 - with: - python-version: '3.10' - - - name: Resolve release version - id: version - run: | - python3 - <<'PY' >> "$GITHUB_OUTPUT" - import runpy - - release = runpy.run_path("scripts/build-python-release.py") - repository_version = release["repository_version"]() - wheel_version = release["pep440_version"](repository_version) - print(f"repository-version={repository_version}") - print(f"version={wheel_version}") - PY - - - name: Authorize publication request - env: - PUBLISH: ${{ github.event_name == 'workflow_dispatch' && inputs.publish }} - PUBLIC_PYPI_RELEASE_ENABLED: ${{ vars.PUBLIC_PYPI_RELEASE_ENABLED }} - PYPI_PUBLISHER_REPOSITORY: ${{ vars.PYPI_PUBLISHER_REPOSITORY }} - REPOSITORY: ${{ github.repository }} - REF_NAME: ${{ github.ref_name }} - REF_TYPE: ${{ github.ref_type }} - REPOSITORY_VERSION: ${{ steps.version.outputs.repository-version }} - run: | - set -euo pipefail - if [ "$PUBLISH" = true ]; then - [ -n "$PYPI_PUBLISHER_REPOSITORY" ] || { - echo "::error::Set the repository variable PYPI_PUBLISHER_REPOSITORY before publication." - exit 1 - } - [ "$REPOSITORY" = "$PYPI_PUBLISHER_REPOSITORY" ] || { - echo "::error::This repository is not the configured PyPI publisher repository." - exit 1 - } - [ "$PUBLIC_PYPI_RELEASE_ENABLED" = true ] || { - echo "::error::Set PUBLIC_PYPI_RELEASE_ENABLED=true before public publication." - exit 1 - } - [ "$REF_TYPE" = tag ] && [ "$REF_NAME" = "python-v$REPOSITORY_VERSION" ] || { - echo "::error::Publication must run from tag python-v$REPOSITORY_VERSION." - exit 1 - } - fi - - - uses: actions/download-artifact@v8.0.1 - with: - pattern: deepseek_harness_* - path: dist - merge-multiple: true - - - name: Check release contents - env: - VERSION: ${{ steps.version.outputs.version }} - run: | - set -euo pipefail - expected="$(mktemp)" - actual="$(mktemp)" - printf '%s\n' \ - "deepseek_harness_runtime_bin-$VERSION-py3-none-macosx_14_0_arm64.whl" \ - "deepseek_harness_runtime_bin-$VERSION-py3-none-macosx_14_0_x86_64.whl" \ - "deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_aarch64.whl" \ - "deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_x86_64.whl" \ - "deepseek_harness_runtime_bin-$VERSION-py3-none-win_amd64.whl" \ - "deepseek_harness_sdk-$VERSION-py3-none-any.whl" > "$expected" - find dist -maxdepth 1 -type f -name '*.whl' -exec basename {} \; | sort > "$actual" - diff -u "$expected" "$actual" - while IFS= read -r wheel; do - size="$(stat -c '%s' "dist/$wheel")" - [ "$size" -lt 100000000 ] || { - echo "::error::$wheel is $size bytes; public PyPI accepts at most 100000000 bytes by default." - exit 1 - } - done < "$actual" - - - name: Validate package metadata - run: | - python -m pip install twine==6.2.0 - python -m twine check dist/*.whl - - - name: Record artifact hashes - run: | - cd dist - sha256sum *.whl | sort -k2 > SHA256SUMS - cat SHA256SUMS - - - uses: actions/upload-artifact@v7.0.1 - with: - name: python-release-${{ steps.version.outputs.version }} - path: dist/* - if-no-files-found: error - retention-days: 7 - - publish-runtime: - name: Publish runtime wheels to public PyPI - if: github.event_name == 'workflow_dispatch' && inputs.publish - needs: validate - runs-on: ubuntu-latest - timeout-minutes: 10 - environment: pypi-runtime - permissions: - contents: read - id-token: write - steps: - - uses: actions/download-artifact@v8.0.1 - with: - name: python-release-${{ needs.validate.outputs.version }} - path: dist - - - name: Verify release artifact hashes - run: cd dist && sha256sum -c SHA256SUMS - - - name: Select runtime wheels - run: | - mkdir -p dist/runtime - mv dist/deepseek_harness_runtime_bin-*.whl dist/runtime/ - - - name: Publish runtime wheels - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist/runtime/ - # Public attestations reveal the private publisher repository. OIDC - # authentication remains enabled without uploading that repository identity. - attestations: false - - # Keep the SDK in a dependent job. If its upload fails after the immutable - # runtime files arrive, "re-run failed jobs" resumes here without attempting - # to overwrite the runtime release. - publish-sdk: - name: Publish SDK wheel to public PyPI - if: github.event_name == 'workflow_dispatch' && inputs.publish - needs: [validate, publish-runtime] - runs-on: ubuntu-latest - timeout-minutes: 10 - environment: pypi - permissions: - contents: read - id-token: write - steps: - - uses: actions/download-artifact@v8.0.1 - with: - name: python-release-${{ needs.validate.outputs.version }} - path: dist - - - name: Verify release artifact hashes - run: cd dist && sha256sum -c SHA256SUMS - - - name: Select SDK wheel - run: | - mkdir -p dist/sdk - mv dist/deepseek_harness_sdk-*.whl dist/sdk/ - - - name: Publish SDK wheel - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist/sdk/ - attestations: false diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml deleted file mode 100644 index 5fe47786b0..0000000000 --- a/.github/workflows/release-publish.yml +++ /dev/null @@ -1,182 +0,0 @@ -# Publish the dsh release sequence to npm. This workflow is manual-only -# (workflow_dispatch) and intentionally does not listen to pull_request or push: -# publication is an explicit, reviewed act; dsh-v* tag validation is enabled by -# default and may be skipped through the dispatch input. It never appears as a PR check. It repacks the current tree before publishing -# so the bytes uploaded are exactly what this dispatch produced. -name: Release publish (dsh) - -on: - workflow_dispatch: - inputs: - cua_macos_run_id: - description: 'macOS CUA helper run ID,留空复用源码逐字节一致的产物,无匹配则构建' - type: string - required: false - default: '' - skip-tag-check: - description: Skip release tag validation for the selected ref; other publication checks still apply. - type: boolean - required: false - default: false - -permissions: - contents: read - actions: read - -env: - PRIMARY_NODE_VERSION: '^24.22.3' - DSH_TELEMETRY_DISABLED: '1' - -jobs: - cua-helper-macos: - if: startsWith(github.ref, 'refs/tags/dsh-v') || inputs.skip-tag-check - uses: ./.github/workflows/cua-helper-package-macos.yml - with: - reuse: true - preset: production - cua_macos_run_id: ${{ inputs.cua_macos_run_id }} - - pack: - name: Pack npm tarballs - needs: cua-helper-macos - runs-on: ubuntu-24.04 - permissions: - contents: read - actions: read - steps: - # Complete history: the release scripts read tags. - - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Configure pnpm store path - id: pnpm-store - run: | - store_root="$HOME/.local/share/pnpm/store" - echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV" - store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent) - echo "path=$store_path" >> "$GITHUB_OUTPUT" - - - uses: actions/cache/restore@v6.1.0 - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm- - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - - name: Verify release version - env: - RELEASE_PUBLISH: 'true' - run: pnpm run release:verify --family dsh ${{ inputs.skip-tag-check && '--skip-tag-check' || '' }} - - - name: Download selected macOS CUA helper - uses: actions/download-artifact@v8.0.1 - with: - artifact-ids: ${{ needs.cua-helper-macos.outputs.artifact-id }} - run-id: ${{ needs.cua-helper-macos.outputs.run-id }} - github-token: ${{ github.token }} - path: dist/cua-helper - - - name: Build - run: pnpm run build:official --serial - - - name: Stage verified macOS helper applications - env: - CUA_EXPECTED_BUILD_KEY: ${{ needs.cua-helper-macos.outputs.build-key }} - run: | - mkdir dist/cua-helper/extracted - tar -xzf dist/cua-helper/cua-helper.tgz -C dist/cua-helper/extracted - pnpm exec tsx scripts/cua-helper/stage.ts --from dist/cua-helper/extracted - - - name: Record macOS CUA source and publication retry instructions - env: - CUA_MACOS_RUN_ID: ${{ needs.cua-helper-macos.outputs.run-id }} - CUA_ARTIFACT_ID: ${{ needs.cua-helper-macos.outputs.artifact-id }} - run: | - { - printf '采用 macOS CUA helper 构建 run ID `%s`,artifact ID `%s`。\n\n' "$CUA_MACOS_RUN_ID" "$CUA_ARTIFACT_ID" - printf '%s\n\n' 'npm 部分发布失败时,只重跑 Publish to npm job,复用原 dsh-npm-tarballs;不要重跑全部 job。' - printf '需要重新打包时,可留空自动查找,或填写 `cua_macos_run_id=%s` 指定该 helper;源码和构建配置必须匹配。\n' "$CUA_MACOS_RUN_ID" - } >> "$GITHUB_STEP_SUMMARY" - - - name: Pack release tarballs - run: pnpm run release:pack --family dsh --out dist/npm - - # The harness packages declare the vendored framework as a peer, and this - # verification must not depend on the registry already carrying matching - # versions — one pull request may bump both families before either - # publishes — so it installs that family's pack output too. Only dist/npm - # is published. - - name: Pack the vendored framework for verification - run: pnpm run release:pack --family vendor --out dist/npm-vendor - - # dsh-sandbox-local declares the Landlock entry as a runtime dependency, so - # the verification needs its tarball. Its platform packages stay out: they - # are optional, and building them needs a musl toolchain per architecture. - - name: Pack the Landlock entry for verification - run: | - pnpm --dir native/system run build:ts - pnpm --dir native/system/packages/entry pack --pack-destination "$PWD/dist/npm-landlock" - - - name: Verify packed install - run: pnpm run release:verify-packed-install --family dsh --from dist/npm --from dist/npm-vendor --from dist/npm-landlock - - - uses: actions/upload-artifact@v7.0.1 - with: - name: dsh-npm-tarballs - path: dist/npm/* - if-no-files-found: error - retention-days: 7 - - publish: - name: Publish to npm - needs: pack - runs-on: ubuntu-24.04 - # Required reviewers and the allowed tags live on the environment; this is - # the only job in the sequence that can write to the registry. - environment: npm-publish - concurrency: - group: Release-publish - cancel-in-progress: false - permissions: - contents: read - steps: - # Checkout and install carry the release scripts only. There is no build - # step: publication uploads the bytes the pack job produced. - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - registry-url: https://registry.npmjs.org - - - name: Install (immutable, no package scripts) - run: pnpm install --frozen-lockfile --ignore-scripts - - - uses: actions/download-artifact@v8.0.1 - with: - name: dsh-npm-tarballs - path: dist/npm - - - name: Publish tarballs - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: pnpm run release:publish --family dsh --from dist/npm diff --git a/.github/workflows/release-vendor-publish.yml b/.github/workflows/release-vendor-publish.yml deleted file mode 100644 index 7823d74f6d..0000000000 --- a/.github/workflows/release-vendor-publish.yml +++ /dev/null @@ -1,126 +0,0 @@ -# Publish the vendored framework sequence to npm. This workflow is manual-only -# (workflow_dispatch) and intentionally does not listen to pull_request or push: -# publication must always be an explicit, reviewed act from a vendor-* tag, and -# it must never appear as a PR check. It repacks the current tree before -# publishing so the bytes uploaded are exactly what this dispatch produced. -name: Release publish (vendor) - -on: - workflow_dispatch: - inputs: - dist-tag: - description: Optional unused npm channel. Leave empty for latest (stable) or next (prerelease). - required: false - type: string - default: '' - -permissions: - contents: read - -env: - PRIMARY_NODE_VERSION: '^24.22.3' - DSH_TELEMETRY_DISABLED: '1' - -jobs: - pack: - name: Pack npm tarballs - runs-on: ubuntu-24.04 - steps: - # Complete history: the release scripts read tags. - - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Configure pnpm store path - id: pnpm-store - run: | - store_root="$HOME/.local/share/pnpm/store" - echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV" - store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent) - echo "path=$store_path" >> "$GITHUB_OUTPUT" - - - uses: actions/cache/restore@v6.1.0 - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm- - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - - name: Verify release version - env: - RELEASE_PUBLISH: 'true' - run: pnpm run release:verify --family vendor - - # The vendored packages publish their own sources and build outputs; the - # host build produces what their manifests select. - - name: Build - run: pnpm run build:lib:host - - - name: Pack release tarballs - run: pnpm run release:pack --family vendor --out dist/npm-vendor - - - name: Verify packed install - run: pnpm run release:verify-packed-install --family vendor --from dist/npm-vendor - - - uses: actions/upload-artifact@v7.0.1 - with: - name: vendor-npm-tarballs - path: dist/npm-vendor/* - if-no-files-found: error - retention-days: 7 - - publish: - name: Publish to npm - needs: pack - runs-on: ubuntu-24.04 - environment: npm-publish - concurrency: - group: Release-publish - cancel-in-progress: false - permissions: - contents: read - steps: - # Checkout and install carry the release scripts only; no build step. - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - registry-url: https://registry.npmjs.org - - - name: Install (immutable, no package scripts) - run: pnpm install --frozen-lockfile --ignore-scripts - - - uses: actions/download-artifact@v8.0.1 - with: - name: vendor-npm-tarballs - path: dist/npm-vendor - - - name: Publish tarballs - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - RELEASE_DIST_TAG: ${{ inputs.dist-tag }} - run: | - args=() - if [[ -n "$RELEASE_DIST_TAG" ]]; then - args+=(--dist-tag "$RELEASE_DIST_TAG") - fi - pnpm run release:publish --family vendor --from dist/npm-vendor "${args[@]}" diff --git a/.github/workflows/release-vendor.yml b/.github/workflows/release-vendor.yml deleted file mode 100644 index f5c75a354f..0000000000 --- a/.github/workflows/release-vendor.yml +++ /dev/null @@ -1,107 +0,0 @@ -# Pack the vendored framework sequence: the nine rescoped Cordis packages under -# vendor/, each on its own version line. This sequence releases independently of -# dsh and of the native packages. -# -# Pack runs without credentials on every pull request and master push. -# Publication is a manual workflow_dispatch of release-vendor-publish.yml from a -# vendor-* tag; a vendor release can carry several versions, so each package has -# its own tag. -name: Release (vendor) - -on: - pull_request: - push: - branches: [master] - workflow_dispatch: - -permissions: - contents: read - -concurrency: - # Pack runs per ref so concurrent pull requests never displace each other. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - PRIMARY_NODE_VERSION: '^24.22.3' - DSH_TELEMETRY_DISABLED: '1' - -jobs: - pack: - name: Pack npm tarballs - # Persistent runners accept only trusted, credential-free rehearsals. - runs-on: >- - ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' - && github.repository == 'deepseek-harness/deepseek-harness' - && github.actor != 'dependabot[bot]' - && ((github.event_name == 'push' && github.ref == 'refs/heads/master') - || (github.event_name == 'pull_request' - && github.event.pull_request.head.repo.full_name == github.repository - && github.event.pull_request.head.repo.fork == false - && github.event.pull_request.user.login != 'dependabot[bot]')) - && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]') - || 'ubuntu-24.04' }} - steps: - # Complete history: the release scripts read tags. - - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - clean: true - - - name: Configure runner-private caches - run: | - echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV" - echo "npm_config_devdir=${{ runner.temp }}/node-gyp" >> "$GITHUB_ENV" - echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV" - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - package-manager-cache: false - - - name: Configure pnpm store path - id: pnpm-store - run: | - store_root="$HOME/.local/share/pnpm/store" - echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV" - store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent) - echo "path=$store_path" >> "$GITHUB_OUTPUT" - - - uses: actions/cache/restore@v6.1.0 - if: runner.environment == 'github-hosted' - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm- - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - - name: Verify release version - run: pnpm run release:verify --family vendor - - # The vendored packages publish their own sources and build outputs; the - # host build produces what their manifests select. - - name: Build - run: ${{ github.event_name == 'pull_request' && 'pnpm exec tsx scripts/compile-referenced-projects.ts host-libraries' || 'pnpm run build:lib:host' }} - - # Concurrency here is rehearsal-only: the credentialed publish workflows - # invoke release:pack without the flag and keep the strictly serial path. - - name: Pack release tarballs - run: pnpm run release:pack --family vendor --out dist/npm-vendor --concurrency 8 - - - name: Verify packed install - run: pnpm run release:verify-packed-install --family vendor --from dist/npm-vendor - - - uses: actions/upload-artifact@v7.0.1 - with: - name: vendor-npm-tarballs - path: dist/npm-vendor/* - if-no-files-found: error - retention-days: 7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ab78a08ba6..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,190 +0,0 @@ -# Pack the dsh release sequence: every package under packages/ plus the apps/ -# entries, all on one version. The vendored framework and the native packages are -# separate sequences with their own workflows and version lines. -# -# Pack and dependency-layout verification run without credentials on every pull -# request and master push. Publication is a manual workflow_dispatch of -# release-publish.yml from a dsh-v* tag. -name: Release (dsh) - -on: - pull_request: - push: - branches: [master] - workflow_dispatch: - -permissions: - contents: read - -concurrency: - # Pack runs per ref so concurrent pull requests never displace each other. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - PRIMARY_NODE_VERSION: '^24.22.3' - DSH_TELEMETRY_DISABLED: '1' - -jobs: - dependencies: - name: Dependency layout - # Persistent runners accept only trusted, credential-free rehearsals. - runs-on: >- - ${{ vars.DSH_CI_FAILOVER_LINUX == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404' - || vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' - && github.repository == 'deepseek-harness/deepseek-harness' - && github.actor != 'dependabot[bot]' - && ((github.event_name == 'push' && github.ref == 'refs/heads/master') - || (github.event_name == 'pull_request' - && github.event.pull_request.head.repo.full_name == github.repository - && github.event.pull_request.head.repo.fork == false - && github.event.pull_request.user.login != 'dependabot[bot]')) - && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]') - || 'ubuntu-24.04' }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - clean: true - - - name: Configure runner-private caches - run: | - echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV" - echo "npm_config_devdir=${{ runner.temp }}/node-gyp" >> "$GITHUB_ENV" - echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV" - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - package-manager-cache: false - - - name: Configure pnpm store path - id: pnpm-store - run: | - store_root="$HOME/.local/share/pnpm/store" - echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV" - store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent) - echo "path=$store_path" >> "$GITHUB_OUTPUT" - - - uses: actions/cache/restore@v6.1.0 - if: runner.environment == 'github-hosted' - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm- - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - # The two verifications read different inputs (manifests versus an npm - # install in a scratch directory), so they run beside each other. - - name: Verify dependency policy and npm install layout - run: | - pnpm run verify-package-dependencies & - dependencies_pid=$! - pnpm run verify-npm-install-layout & - layout_pid=$! - dependencies_status=0 - wait "$dependencies_pid" || dependencies_status=$? - layout_status=0 - wait "$layout_pid" || layout_status=$? - if (( dependencies_status != 0 )); then exit "$dependencies_status"; fi - exit "$layout_status" - - pack: - name: Pack npm tarballs - # Persistent runners accept only trusted, credential-free rehearsals. - runs-on: >- - ${{ vars.DSH_CI_FAILOVER_LINUX == 'selfhosted' - && github.repository == 'deepseek-harness/deepseek-harness' - && github.actor != 'dependabot[bot]' - && ((github.event_name == 'push' && github.ref == 'refs/heads/master') - || (github.event_name == 'pull_request' - && github.event.pull_request.head.repo.full_name == github.repository - && github.event.pull_request.head.repo.fork == false - && github.event.pull_request.user.login != 'dependabot[bot]')) - && fromJSON('["self-hosted", "linux", "x64", "vm-backup"]') - || 'ubuntu-24.04' }} - steps: - # Complete history: the release scripts read tags. - - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - clean: true - - - name: Configure runner-private caches - run: | - echo "NODE_COMPILE_CACHE=${{ runner.temp }}/node-compile-cache" >> "$GITHUB_ENV" - echo "npm_config_devdir=${{ runner.temp }}/node-gyp" >> "$GITHUB_ENV" - echo "TMPDIR=${{ runner.temp }}" >> "$GITHUB_ENV" - - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }} - - - uses: actions/setup-node@v7.0.0 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - package-manager-cache: false - - - name: Configure pnpm store path - id: pnpm-store - run: | - store_root="$HOME/.local/share/pnpm/store" - echo "PNPM_CONFIG_STORE_DIR=$store_root" >> "$GITHUB_ENV" - store_path=$(PNPM_CONFIG_STORE_DIR="$store_root" pnpm store path --silent) - echo "path=$store_path" >> "$GITHUB_OUTPUT" - - - uses: actions/cache/restore@v6.1.0 - if: runner.environment == 'github-hosted' - with: - path: ${{ steps.pnpm-store.outputs.path }} - key: ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-node-${{ env.PRIMARY_NODE_VERSION }}-pnpm- - - - name: Install (immutable) - run: pnpm install --frozen-lockfile - - - name: Verify release version - run: pnpm run release:verify --family dsh - - - name: Build - run: ${{ github.event_name == 'pull_request' && 'pnpm run build:artifacts --profile official' || 'pnpm run build:official' }} - - # Concurrency here is rehearsal-only: the credentialed publish workflows - # invoke release:pack without the flag and keep the strictly serial path. - - name: Pack release tarballs - run: pnpm run release:pack --family dsh --out dist/npm --concurrency 8 - - # The harness packages declare the vendored framework as a peer, and this - # verification must not depend on the registry already carrying matching - # versions — one pull request may bump both families before either - # publishes — so it installs that family's pack output too. Only dist/npm - # is published. - - name: Pack the vendored framework for verification - run: pnpm run release:pack --family vendor --out dist/npm-vendor --concurrency 8 - - # dsh-sandbox-local declares the Landlock entry as a runtime dependency, so - # the verification needs its tarball. Its platform packages stay out: they - # are optional, and building them needs a musl toolchain per architecture. - - name: Pack the Landlock entry for verification - run: | - pnpm --dir native/system run build:ts - pnpm --dir native/system/packages/entry pack --pack-destination "$PWD/dist/npm-landlock" - - - name: Verify packed install - run: pnpm run release:verify-packed-install --family dsh --from dist/npm --from dist/npm-vendor --from dist/npm-landlock - - - uses: actions/upload-artifact@v7.0.1 - with: - name: dsh-npm-tarballs - path: dist/npm/* - if-no-files-found: error - retention-days: 7 diff --git a/.github/workflows/windows-package.yml b/.github/workflows/windows-package.yml deleted file mode 100644 index f4b66ea8ad..0000000000 --- a/.github/workflows/windows-package.yml +++ /dev/null @@ -1,278 +0,0 @@ -name: Package Desktop · Windows · x64 - -on: - workflow_dispatch: - inputs: - source_ref: - description: '打包源码:test 支持仓库内分支或 dsh-v* tag;production 仅支持 master 或 dsh-v* tag;源码须包含 CI 适配脚本' - type: string - default: master - required: true - preset: - description: '打包环境:选择机器上的 test 或 production 配置;同时决定后续发布环境' - type: choice - options: [test, production] - default: test - required: true - update_channel: - description: '升级通道:人工选择 nightly 或 stable,与版本后缀无关;默认通道由此打包输入确定' - type: choice - options: [nightly, stable] - default: nightly - required: true - version_mode: - description: '版本模式:default 按环境自动选择(test 取 build-number,production 取 follow-dsh);follow-dsh 跟随 dsh 包版本号;build-number 自动追加构建编号;manual 手填' - type: choice - options: [default, follow-dsh, build-number, manual] - default: default - required: true - build_version: - description: '手动版本号:仅 manual 时填写完整版本;须为产品原版本或受支持的预发布后缀' - type: string - default: '' - required: false - test_release_id: - description: '测试 release ID:32 位小写十六进制随机前缀(非鉴权);留空使用机器默认值,连续升级测试须保持相同值' - type: string - default: '' - required: false - compression_level: - description: '安装器压缩等级:3 打包较快,7 压缩更强;覆盖本轮机器配置' - type: choice - options: ['3', '7'] - default: '3' - required: true - signing: - description: '签名方式:unsigned 仅限内部调试,禁止发布到 test / production 或用于自动更新;需要发布请选择 signed(EV 硬件令牌)' - type: choice - options: [signed, unsigned] - default: signed - required: true - cache_namespace: - description: '缓存测量命名空间:留空使用共享缓存;新名称用于冷缓存,再次使用同名测热缓存,不清除现有缓存' - type: string - default: '' - required: false - -permissions: - contents: read - -concurrency: - group: windows-desktop-package - cancel-in-progress: false - -jobs: - package: - outputs: - directory: ${{ steps.retained.outputs.directory }} - runner: ${{ steps.retained.outputs.runner }} - runner-name: ${{ steps.retained.outputs.runner-name }} - attempt: ${{ steps.retained.outputs.attempt }} - version: ${{ steps.settings.outputs.version }} - mode: ${{ steps.settings.outputs.mode }} - runs-on: dsh-win-package-trial - timeout-minutes: 120 - defaults: - run: - shell: pwsh - env: - PACKAGE_SOURCE_REF: ${{ inputs.source_ref }} - # TODO: Remove this legacy source_ref mode mapping on 2027-01-04 with the parser aliases. - PACKAGE_VERSION_MODE: ${{ inputs.version_mode == 'follow-dsh' && 'product' || inputs.version_mode == 'build-number' && 'auto' || inputs.version_mode }} - DSH_DESKTOP_UPDATE_CHANNEL: ${{ inputs.update_channel }} - DSH_TELEMETRY_DISABLED: '1' - DSH_PACKAGING_PRESET: ${{ inputs.preset }} - PACKAGE_TEST_RELEASE_ID: ${{ inputs.test_release_id }} - PACKAGE_SIGNING: ${{ inputs.signing }} - PACKAGE_CACHE_NAMESPACE: ${{ inputs.cache_namespace }} - PACKAGE_WINDOWS_COMPRESSION_LEVEL: ${{ inputs.compression_level }} - steps: - - name: Reset packaging checkout - working-directory: ${{ runner.temp }} - run: | - $workspace = [IO.Path]::GetFullPath($env:GITHUB_WORKSPACE) - $parent = [IO.Path]::GetFullPath($env:RUNNER_WORKSPACE) - if ([IO.Path]::GetDirectoryName($workspace) -ne $parent) { throw 'Checkout must be a direct child of RUNNER_WORKSPACE' } - for ($item = [IO.DirectoryInfo]::new($workspace); $null -ne $item; $item = $item.Parent) { - if ($item.Exists -and ($item.Attributes -band [IO.FileAttributes]::ReparsePoint)) { throw 'Checkout ancestors cannot be links' } - } - node -e "const fs = require('node:fs'); fs.rmSync(process.argv[1], { recursive: true, force: true, maxRetries: 3 }); fs.mkdirSync(process.argv[1])" $workspace - if ($LASTEXITCODE -ne 0) { throw 'Checkout cleanup failed' } - - name: Checkout workflow helpers - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - ref: ${{ github.workflow_sha }} - sparse-checkout: apps/desktop/scripts - - name: Stage workflow helpers - id: helpers - run: | - $helpers = Join-Path $env:RUNNER_TEMP "packaging-helpers-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT" - New-Item -ItemType Directory -Path $helpers -ErrorAction Stop | Out-Null - foreach ($name in @('windows-packaging-priority.ps1', 'windows-packaging-summary.mjs')) { - Copy-Item -LiteralPath (Join-Path 'apps/desktop/scripts' $name) -Destination $helpers -ErrorAction Stop - } - "PACKAGE_CI_HELPERS=$helpers" >> $env:GITHUB_ENV - - uses: actions/checkout@v7.0.1 - id: checkout - with: - persist-credentials: false - clean: true - ref: ${{ inputs.source_ref }} - - name: Validate selected source and adapter support - run: >- - node -e "const fs=require('node:fs'); const ref=process.env.PACKAGE_SOURCE_REF; - const cp=require('node:child_process'); const preset=process.env.DSH_PACKAGING_PRESET; - if(!['test','production'].includes(preset)) throw Error('Unknown packaging preset'); - const tag=/^dsh-v[0-9][0-9A-Za-z.-]*$/.test(ref); - if(preset==='production' && ref!=='master' && !tag) throw Error('Production source must be master or dsh-v*'); - if(tag) { - const v=JSON.parse(fs.readFileSync('package.json','utf8')).version; - if(ref!=='dsh-v'+v) throw Error('Source tag must match product version'); - const tagged=cp.execFileSync('git',['rev-parse','--verify','refs/tags/'+ref+'^{commit}'],{encoding:'utf8'}).trim(); - const head=cp.execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim(); - if(tagged!==head) throw Error('Checkout does not match source tag'); - } else { - const branch=cp.execFileSync('git',['rev-parse','--abbrev-ref','HEAD'],{encoding:'utf8'}).trim(); - if(branch==='HEAD' || branch!==ref || ref.startsWith('refs/')) throw Error('Select a branch in this repository, not a SHA or PR ref'); - } - if(!fs.readFileSync('apps/desktop/scripts/retain-desktop-ci.ts','utf8').includes('--check-runner')) throw Error('Source lacks independent Desktop artifact archival support; select a newer source'); - if(!fs.readFileSync('apps/desktop/scripts/desktop-ci-version.mjs','utf8').includes('PACKAGE_VERSION_MODE')) throw Error('Source lacks Desktop channel/version CI support; select a newer release');" - - uses: pnpm/action-setup@v5.0.0 - with: - dest: ${{ runner.temp }}/setup-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Configure persistent pnpm store - # PNPM_HOME belongs to this run; keep downloaded packages outside its temporary directory. - env: - DSH_DESKTOP_PACKAGE_CACHE_DIR: ${{ runner.tool_cache }}/dsh-desktop-package-cache - run: | - $storeRoot = Join-Path ([IO.Path]::GetPathRoot($env:GITHUB_WORKSPACE)) '.pnpm-store' - $namespace = $env:PACKAGE_CACHE_NAMESPACE - if ($namespace) { - if ($namespace -cnotmatch '^[a-z0-9][a-z0-9-]{0,63}\z') { throw 'Cache namespace must contain 1-64 lowercase letters, digits or hyphens' } - if ($namespace -match '^(con|prn|aux|nul|com[1-9]|lpt[1-9])$') { throw 'Cache namespace cannot be a Windows device name' } - $storeRoot = Join-Path $storeRoot $namespace - $env:DSH_DESKTOP_PACKAGE_CACHE_DIR = Join-Path $env:DSH_DESKTOP_PACKAGE_CACHE_DIR $namespace - } - "DSH_DESKTOP_PACKAGE_CACHE_DIR=$env:DSH_DESKTOP_PACKAGE_CACHE_DIR" >> $env:GITHUB_ENV - "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV - - name: Install locked dependencies - run: | - & "$env:PACKAGE_CI_HELPERS/windows-packaging-priority.ps1" -BestEffort - node -e "const os=require('node:os'); console.log(JSON.stringify({node:process.version,availableParallelism:os.availableParallelism(),logicalCpus:os.cpus().length,totalMemoryBytes:os.totalmem(),freeMemoryBytes:os.freemem()}))" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - pnpm store path - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - pnpm install --frozen-lockfile - exit $LASTEXITCODE - - name: Check original machine archival route - env: - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - run: node --import tsx apps/desktop/scripts/retain-desktop-ci.ts --check-runner - - name: Validate preset and resolve build version - id: settings - env: - PACKAGE_BUILD_VERSION: ${{ inputs.build_version }} - run: node apps/desktop/scripts/prepare-windows-ci.mjs - - name: Summarize packaging parameters - if: always() && steps.helpers.outcome == 'success' - env: - PACKAGE_INPUT_VERSION_MODE: ${{ inputs.version_mode }} - PACKAGE_BUILD_VERSION: ${{ inputs.build_version }} - PACKAGE_SOURCE_SHA: ${{ steps.checkout.outputs.commit }} - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: node "$env:PACKAGE_CI_HELPERS/windows-packaging-summary.mjs" - - name: Check packaging configuration and toolchain - env: - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: | - $packageArgs = @('run', 'package:desktop:win:x64', '--check', '--build-version', $env:PACKAGE_VERSION) - if ($env:PACKAGE_SIGNING -eq 'unsigned') { $packageArgs += '--unsigned' } - pnpm @packageArgs - exit $LASTEXITCODE - - name: Build installer and verify packaged runtime - env: - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: | - & "$env:PACKAGE_CI_HELPERS/windows-packaging-priority.ps1" -BestEffort - $packageArgs = @('run', 'package:desktop:win:x64', '--build-version', $env:PACKAGE_VERSION) - if ($env:PACKAGE_SIGNING -eq 'unsigned') { $packageArgs += '--unsigned' } - pnpm @packageArgs - exit $LASTEXITCODE - - name: Retain complete package outside the checkout - id: retained - env: - DESKTOP_PUBLISH_RUNNERS: ${{ vars.DESKTOP_PUBLISH_RUNNERS }} - PACKAGE_SOURCE_SHA: ${{ steps.checkout.outputs.commit }} - PACKAGE_VERSION: ${{ steps.settings.outputs.version }} - run: node --import tsx apps/desktop/scripts/retain-desktop-ci.ts - - name: Retain packaging diagnostics - continue-on-error: true - if: always() && steps.checkout.outcome == 'success' - uses: actions/upload-artifact@v7.0.1 - with: - name: windows-package-logs-${{ github.run_id }}-${{ github.run_attempt }} - include-hidden-files: true - path: ${{ github.workspace }}/apps/desktop/.desktop-build/packaging-runs/ - if-no-files-found: warn - retention-days: 14 - - upload-artifact: - defaults: - run: - shell: pwsh - needs: package - runs-on: [self-hosted, '${{ needs.package.outputs.runner }}'] - timeout-minutes: 30 - env: - PACKAGE_CACHE_NAMESPACE: ${{ inputs.cache_namespace }} - DESKTOP_RETAINED_DIRECTORY: ${{ needs.package.outputs.directory }} - DESKTOP_ARCHIVE_NAME: windows-x64-${{ inputs.signing }}-${{ needs.package.outputs.version }}-${{ github.run_id }}-${{ needs.package.outputs.attempt }}.zip - DESKTOP_PACKAGE_ATTEMPT: ${{ needs.package.outputs.attempt }} - DESKTOP_PACKAGE_RUNNER: ${{ needs.package.outputs.runner-name }} - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - path: artifact-archiver - - uses: pnpm/action-setup@v5.0.0 - with: - package_json_file: artifact-archiver/package.json - dest: ${{ runner.temp }}/archive-pnpm-${{ github.run_id }}-${{ github.run_attempt }} - - uses: actions/setup-node@v7.0.0 - with: - node-version: '^24.22.3' - - name: Configure persistent pnpm store - # PNPM_HOME belongs to this run; keep downloaded packages outside its temporary directory. - env: - DSH_DESKTOP_PACKAGE_CACHE_DIR: ${{ runner.tool_cache }}/dsh-desktop-package-cache - run: | - $storeRoot = Join-Path ([IO.Path]::GetPathRoot($env:GITHUB_WORKSPACE)) '.pnpm-store' - $namespace = $env:PACKAGE_CACHE_NAMESPACE - if ($namespace) { - if ($namespace -cnotmatch '^[a-z0-9][a-z0-9-]{0,63}\z') { throw 'Cache namespace must contain 1-64 lowercase letters, digits or hyphens' } - if ($namespace -match '^(con|prn|aux|nul|com[1-9]|lpt[1-9])$') { throw 'Cache namespace cannot be a Windows device name' } - $storeRoot = Join-Path $storeRoot $namespace - $env:DSH_DESKTOP_PACKAGE_CACHE_DIR = Join-Path $env:DSH_DESKTOP_PACKAGE_CACHE_DIR $namespace - } - "DSH_DESKTOP_PACKAGE_CACHE_DIR=$env:DSH_DESKTOP_PACKAGE_CACHE_DIR" >> $env:GITHUB_ENV - "PNPM_CONFIG_STORE_DIR=$storeRoot" >> $env:GITHUB_ENV - - run: pnpm install --frozen-lockfile - working-directory: artifact-archiver - - name: Archive verified retained build - id: archive - working-directory: artifact-archiver - run: node --import tsx apps/desktop/scripts/archive-desktop-ci.ts - - name: Retain installers for the selected mode - if: success() - uses: actions/upload-artifact@v7.0.1 - with: - name: ${{ env.DESKTOP_ARCHIVE_NAME }} - path: ${{ steps.archive.outputs.path }} - archive: false - if-no-files-found: error - retention-days: 14 - overwrite: true diff --git a/.gitignore b/.gitignore index 7024b069d8..2eadc1f5eb 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,6 @@ native/system/test/bin/ # Generated company-signed CUA release record. /packages/experimental/cua-macos/cua-helper.json + +# Local CI output +/.ci/ diff --git a/AGENTS.md b/AGENTS.md index ab4d7ac6d9..401065e1d6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -190,3 +190,17 @@ Docs accompany every code change: update affected README and JSDoc contracts tog ## Vendoring policy `vendor/` packages are pinned source copies (manifest with upstream SHAs in [vendor/README.md](vendor/README.md)). Update via the sync procedure there; re-apply or retire the logged local modifications; rerun `pnpm run test && pnpm run build`. + + + +## Marqdo Harness downstream rules + +This repository is `app-harness` in the Marqdo ecosystem (parent path `apps/harness`, remote `https://git.cflmy.cn/cflmy/marqdo-app-harness.git`). Root conventions: [docs/REPOSITORY-CONVENTIONS.md](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/REPOSITORY-CONVENTIONS.md). + +- Keep the single product profile `mdh` and the single launcher `scripts/mdh.mjs`; do not add a second user-selectable execution mode or a second Marqdo parser. +- `@marqdo/*` packages own application behavior; upstream `packages/**` changes require an entry in [docs/mdh/upstream-delta.md](docs/mdh/upstream-delta.md). +- Never copy Marqdo CLI/stdlib/extension/tool source into this repository. Runtime artifacts are installed from trusted releases into `MDH_HOME`. +- Product defaults are loopback-only, telemetry/session-upload/plugin-install off, workspace-write sandbox on, and one-shot approval for every document execution or ecosystem mutation. +- Evidence discipline: record the app SHA, upstream SHA, CLI source SHA, Bundle digest, platform, command and exit code. Unrun gates stay `UNVERIFIED` in [docs/mdh/STATUS.md](docs/mdh/STATUS.md). +- Upstream contract defects go to `marqdo-cli`, `marqdo-std-*`, `marqdo-ext-*`, `marqdo-knowledge` or `marqdo-view`; this repository only consumes their published contracts. +- Run `scripts/ci.sh` before pushing; use `scripts/upstream.sh candidate ` for a synchronisation branch and never auto-merge upstream. diff --git a/README.md b/README.md index 7941e30f7b..31b5e841ad 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,14 @@ It is built on an **everything-is-a-plugin** architecture and powered by [Cordis Documentation: [https://deepseek-harness.github.io/deepseek-harness/](https://deepseek-harness.github.io/deepseek-harness/) +## Marqdo Harness (downstream) + +This repository is the **Marqdo Harness (MDH)** downstream fork of DeepSeek Harness. It is the official single-user application of the Marqdo ecosystem: it installs and verifies Marqdo runtimes, executes `.mq.md` documents through the public CLI contract, keeps a private local knowledge library, and preserves run evidence for reuse. + +The upstream history, MIT license and third-party notices are retained. `origin` is `https://git.cflmy.cn/cflmy/marqdo-app-harness.git`; `upstream` is the Gitea DSH mirror. Product documentation lives under [docs/mdh](docs/mdh/): [architecture](docs/mdh/ARCHITECTURE.md), [status](docs/mdh/STATUS.md), [upstream policy](docs/mdh/UPSTREAM.md) and [modification log](docs/mdh/upstream-delta.md). + +Run the product from this checkout with `node scripts/mdh.mjs` after `pnpm install && pnpm run build`. The web workbench is served at `/mdh` on the same loopback listener as the DSH client. The application does not bundle a Marqdo CLI, stdlib, extension or tool implementation; those are downloaded from trusted Gitea releases into an application-owned home. + ## Developer preview DeepSeek Harness is in _developer preview_ and iterating rapidly. **THERE WILL BE COMPATIBILITY-BREAKING CHANGES.** diff --git a/apps/cli/package.json b/apps/cli/package.json index 07dd27c73d..b5189cf998 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -29,14 +29,16 @@ "license": "MIT", "dependencies": { "@deepseek-ai/cordis": "workspace:~", - "@deepseek-ai/dsh-hmr": "workspace:*", + "@deepseek-ai/cordis-plugin-group": "workspace:~", "@deepseek-ai/cordis-plugin-include": "workspace:~", "@deepseek-ai/cordis-plugin-loader": "workspace:~", "@deepseek-ai/cordis-plugin-timer": "workspace:~", "@deepseek-ai/dsh-acp-app": "workspace:*", "@deepseek-ai/dsh-agent-instructions": "workspace:*", + "@deepseek-ai/dsh-agent-preset": "workspace:*", "@deepseek-ai/dsh-agent-tool-presentation": "workspace:*", "@deepseek-ai/dsh-app-boot": "workspace:*", + "@deepseek-ai/dsh-atomic-write": "workspace:*", "@deepseek-ai/dsh-base": "workspace:*", "@deepseek-ai/dsh-client-ui-agent-preset": "workspace:*", "@deepseek-ai/dsh-client-ui-cordis": "workspace:*", @@ -46,18 +48,37 @@ "@deepseek-ai/dsh-compaction-basic": "workspace:*", "@deepseek-ai/dsh-compaction-tool-result-pruner": "workspace:*", "@deepseek-ai/dsh-cordis-client-runner": "workspace:*", + "@deepseek-ai/dsh-cua-bundle": "workspace:*", + "@deepseek-ai/dsh-cua-mcp": "workspace:*", + "@deepseek-ai/dsh-deepseek-chat-import": "workspace:*", + "@deepseek-ai/dsh-experimental-auto-review": "workspace:*", + "@deepseek-ai/dsh-experimental-badge-skill-bundle": "workspace:*", + "@deepseek-ai/dsh-experimental-cot-translation-bundle": "workspace:*", + "@deepseek-ai/dsh-experimental-forge-bundle": "workspace:*", "@deepseek-ai/dsh-experimental-inspector-profile": "workspace:*", + "@deepseek-ai/dsh-experimental-liveshare": "workspace:*", + "@deepseek-ai/dsh-experimental-plugin-market-bundle": "workspace:*", + "@deepseek-ai/dsh-experimental-ralph-bundle": "workspace:*", + "@deepseek-ai/dsh-experimental-session-search": "workspace:*", + "@deepseek-ai/dsh-experimental-session-titles-bundle": "workspace:*", + "@deepseek-ai/dsh-experimental-terminal-bundle": "workspace:*", + "@deepseek-ai/dsh-experimental-tool-worktree": "workspace:*", + "@deepseek-ai/dsh-experimental-voice-input-bundle": "workspace:*", "@deepseek-ai/dsh-fs-local": "workspace:*", "@deepseek-ai/dsh-goal": "workspace:*", "@deepseek-ai/dsh-goal-round-driver": "workspace:*", "@deepseek-ai/dsh-headless": "workspace:*", + "@deepseek-ai/dsh-hmr": "workspace:*", "@deepseek-ai/dsh-home-paths": "workspace:*", + "@deepseek-ai/dsh-http-proxy": "workspace:*", "@deepseek-ai/dsh-jobs-local": "workspace:*", "@deepseek-ai/dsh-launch-environment": "workspace:*", "@deepseek-ai/dsh-mcp-client": "workspace:*", + "@deepseek-ai/dsh-mcp-resources": "workspace:*", "@deepseek-ai/dsh-official-bundles": "workspace:*", "@deepseek-ai/dsh-persona": "workspace:*", "@deepseek-ai/dsh-plan-mode": "workspace:*", + "@deepseek-ai/dsh-plugin-manager": "workspace:*", "@deepseek-ai/dsh-pwsh-local": "workspace:*", "@deepseek-ai/dsh-pwsh-sandbox": "workspace:*", "@deepseek-ai/dsh-schedule": "workspace:*", @@ -69,21 +90,21 @@ "@deepseek-ai/dsh-skill": "workspace:*", "@deepseek-ai/dsh-skill-filesystem": "workspace:*", "@deepseek-ai/dsh-skill-office": "workspace:*", - "@deepseek-ai/dsh-tool-workspace-dependencies": "workspace:*", "@deepseek-ai/dsh-terminal": "workspace:*", "@deepseek-ai/dsh-terminal-bash": "workspace:*", "@deepseek-ai/dsh-time-context": "workspace:*", + "@deepseek-ai/dsh-timeline": "workspace:*", "@deepseek-ai/dsh-tmux-context": "workspace:*", "@deepseek-ai/dsh-token-meter": "workspace:*", "@deepseek-ai/dsh-tool-ask-user": "workspace:*", "@deepseek-ai/dsh-tool-bash": "workspace:*", "@deepseek-ai/dsh-tool-bash-persistent": "workspace:*", "@deepseek-ai/dsh-tool-cordis": "workspace:*", - "@deepseek-ai/dsh-tool-present": "workspace:*", "@deepseek-ai/dsh-tool-fs": "workspace:*", "@deepseek-ai/dsh-tool-fs-search": "workspace:*", "@deepseek-ai/dsh-tool-goal": "workspace:*", "@deepseek-ai/dsh-tool-jobs": "workspace:*", + "@deepseek-ai/dsh-tool-present": "workspace:*", "@deepseek-ai/dsh-tool-pwsh": "workspace:*", "@deepseek-ai/dsh-tool-pwsh-persistent": "workspace:*", "@deepseek-ai/dsh-tool-schedule": "workspace:*", @@ -94,33 +115,13 @@ "@deepseek-ai/dsh-tool-todo": "workspace:*", "@deepseek-ai/dsh-tool-web": "workspace:*", "@deepseek-ai/dsh-tool-workflow": "workspace:*", + "@deepseek-ai/dsh-tool-workspace-dependencies": "workspace:*", "@deepseek-ai/dsh-web-app": "workspace:*", "@deepseek-ai/dsh-workflow-ptc": "workspace:*", "@deepseek-ai/schemastery": "workspace:~", "commander": "^15.0.0", "js-yaml": "^4.3.2", - "node-addon-require-builtin": "^0.1.10", - "@deepseek-ai/dsh-http-proxy": "workspace:*", - "@deepseek-ai/dsh-mcp-resources": "workspace:*", - "@deepseek-ai/dsh-plugin-manager": "workspace:*", - "@deepseek-ai/dsh-atomic-write": "workspace:*", - "@deepseek-ai/dsh-agent-preset": "workspace:*", - "@deepseek-ai/dsh-experimental-voice-input-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-auto-review": "workspace:*", - "@deepseek-ai/dsh-experimental-cot-translation-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-badge-skill-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-ralph-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-session-titles-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-terminal-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-liveshare": "workspace:*", - "@deepseek-ai/dsh-experimental-session-search": "workspace:*", - "@deepseek-ai/dsh-experimental-tool-worktree": "workspace:*", - "@deepseek-ai/dsh-cua-bundle": "workspace:*", - "@deepseek-ai/dsh-cua-mcp": "workspace:*", - "@deepseek-ai/dsh-timeline": "workspace:*", - "@deepseek-ai/dsh-experimental-plugin-market-bundle": "workspace:*", - "@deepseek-ai/dsh-experimental-forge-bundle": "workspace:*", - "@deepseek-ai/dsh-deepseek-chat-import": "workspace:*" + "node-addon-require-builtin": "^0.1.10" }, "devDependencies": { "@deepseek-ai/dsh-brand": "workspace:*", diff --git a/docs/mdh/ARCHITECTURE.md b/docs/mdh/ARCHITECTURE.md new file mode 100644 index 0000000000..bc815521d2 --- /dev/null +++ b/docs/mdh/ARCHITECTURE.md @@ -0,0 +1,152 @@ +# Marqdo Harness(MDH)架构 + +Marqdo Harness 是 Marqdo 生态的官方单用户应用:一个基于 [DeepSeek Harness](https://git.cflmy.cn/cflmy/deepseek-harness)(DSH)的下游 fork。 它复用 DSH 的模型接入、Agent Loop、会话、事件、工具审批和 Web 外壳,新增四类产品能力: + +1. **生态管理**:发现、安装、验证、切换与回退 Marqdo CLI / Bundle / Tool / Ext; +2. **文稿原生程序化执行(Marqdo PTC)**:以完整 `.mq.md` 为程序化调用单元, +经官方 `check` / `run` / `call` 与 Observation 1 产生可核对结果; +3. **私人知识库**:本地静态知识集合的导入、编译、检索、引用与沉淀; +4. **成果复用**:运行证据、离线阅读、知识候选与再次执行。 + +现行产品状态以 [STATUS.md](STATUS.md) 为准;本文描述边界和组件关系,不声称门禁已通过。 + +## 1. 与 DSH 的关系 + +| 能力 | 归属 | MDH 的处理 | +| --- | --- | --- | +| Agent Loop、模型适配、会话、持久事件、工具门禁、取消、子任务 | DSH 上游 | 复用,不建立第二套状态机 | +| Cordis、Profile、Bundle、Web 外壳 | DSH 上游 | 保留;产品通过唯一 `mdh` profile 叠层 | +| 文件、Shell、MCP 等通用工具 | DSH 上游 | 保留受控基础能力;关闭插件管理与默认外联 | +| 生态安装 / 更新 | MDH 下游 | `@marqdo/mdh-harness` 的 ecosystem 模块 | +| 文稿执行 | MDH 下游 | `marqdo_program` 单一模型入口 | +| 私人知识 | MDH 下游 | 集合、导入、索引适配、检索与授权 | +| 产品页面 | MDH 下游 | 复用 DSH Web 的 webserver route,新增 `/mdh` 工作台 | + +上游身份、同步规则和下游修改清单见 [UPSTREAM.md](UPSTREAM.md) 与 [upstream-delta.md](upstream-delta.md)。任何对上游包的修改都必须先登记在 delta 中。 + +## 2. 仓库与包 + +```text +apps/harness/ # 独立应用仓库(父仓 gitlink:apps/harness) +├── packages/marqdo/harness/ # @marqdo/mdh-harness:Cordis 插件与产品服务 +│ ├── src/core/ # home、原子写、锁、进程、Observation、ValueWire、tar +│ ├── src/ecosystem/ # 信任来源、安装事务、环境、回退 +│ ├── src/knowledge/ # 私人知识集合、导入、索引适配、检索 +│ ├── src/execution/ # Analysis 3、CLI argv、审批、证据 +│ ├── src/tools/ # 面向模型的六个操作 +│ ├── src/web/ # /mdh 页面与同源只读/受控写 API +│ └── tests/ # node:test 单元与真实 CLI 集成 +├── packages/marqdo/bundle/ # @marqdo/mdh-bundle:唯一产品 profile patch +├── scripts/mdh.mjs # 唯一产品启动器 +├── scripts/ci.sh # 组件 CI 入口 +├── scripts/package.sh # 下游应用归档 +└── scripts/upstream.sh # 上游同步候选 +``` + +`@marqdo/mdh-harness` 在运行期只依赖 Node 内置模块和 Cordis 注入的服务,不 import 上游包的实现。这样应用可以独立构建/测试,也避免复制上游状态机。上游包只通过 `ctx.tools`、`ctx.approval`、`ctx.systemPrompt`、`ctx.webServer` 等公开 seam 使用。 + +## 3. 产品装配 + +唯一正式入口是 `scripts/mdh.mjs`(安装后命令 `mdh`),唯一产品 profile 是 `mdh`: + +```json +{ + "dsh": { "profile": { "bundles": [ + "@deepseek-ai/dsh-base", + "@deepseek-ai/dsh-web-app", + "@marqdo/mdh-bundle" + ] } } +} +``` + +`@marqdo/mdh-bundle/cordis.patch.yml` 在 base + web-app 之上: + +- 插入 `mdh-harness` 与 `mdh-web` 两行; +- 关闭 `preset-ptc`(DSH 默认 Node PTC 模型入口),只保留 `marqdo_program`; +- 关闭 `plugin-manager` 服务与插件 market/manager 工具; +- 关闭 `session-log-deepseek`、`session-telemetry-otel`、`message-feedback`; +- 关闭默认 web search/fetch 工具与 DeepSeek 外联; +- 保留 bash/fs 沙箱与审批链,默认 `workspace-write`。 + +扫描 `--dump-config` 可以核对有效装配;MDH 不在运行期探测或降级到第二套协议。 + +## 4. 应用 home 与数据 + +```text +MDH_HOME/ # 默认 $XDG_DATA_HOME/marqdo-harness,0700 +├── harness/ # DSH profile/session/config(应用专属) +├── ecosystem/ +│ ├── artifacts/ # 已验收的内容身份(只读) +│ ├── staging/ # 未激活候选 +│ ├── environments/ # 一组 CLI + Bundle + Tool home +│ ├── current.json # 原子活动指针 +│ └── install.lock +├── knowledge/ +│ ├── sources// # 用户导入的原文副本 +│ ├── collections.json # 集合元数据与 revision +│ └── index// # 可重建的 Knowledge Tool 索引 +├── workspaces/ # 用户项目 +├── evidence/runs/ # 运行证据(0600,本机) +└── config/ # 产品配置 +``` + +规则: + +- 不覆盖用户已有的 `~/.dsh`;DSH home 固定在 `MDH_HOME/harness`。 +- 任务启动时固定环境 ID、CLI 绝对路径、Tool home、Bundle 与锁摘要;之后不从 +`current` 再解析。 +- 活动环境与回退目标不会被清理;staging 与未被引用的环境可受控清理。 +- 运行证据只记录引用与摘要,不把完整私有知识或模型密钥写入日志。 + +## 5. 文稿执行生命周期 + +```text +模型写/改工作区 .mq.md + -> marqdo_check: 绝对 CLI check --emit analysis.json(只读,Analysis 3) + -> 冻结 source digest / Analysis digest / env / grants + -> 审批(ctx.approval,一次授权只对本次 action) + -> marqdo_program: 固定 argv 的 run/call,--output jsonl/json + --observation-file + -> 校验 Observation 1:schema、run_id、连续 seq、唯一终态、Analysis digest + -> 有界结果 + evidence 引用;原始事件保存在 0600 证据文件 +``` + +- 模型不能提供任意 CLI argv、绝对路径根、URL 或授权 flags;`path` 必须在工作区内。 +- `pure` 不带任何资源 grant;`project`/`strict` 的 grant 由审批后映射为精确 flags。 +- 不用 stdout 最后一行或模型“成功”字样判定完成;EOF 无终态即 `incomplete`。 +- 同一次运行只产生一个序号序列;DSH 事件只保存引用/摘要。 +- 源文稿、锁或输入改变后,旧证据标记 `stale`,不会冒充当前结果。 + +## 6. 私人知识 + +- 集合由用户创建;导入默认复制到 `knowledge/sources`,原文件不被修改。 +- 导入拒绝越界路径、符号链接、特殊文件、超限、大小写/NFC 冲突; +`.mq.md` 或含执行区域的内容不得作为静态知识导入。 +- 检索优先调用已安装的 `marqdo-knowledge` 公开命令 +(`compile` / `check` / `query --format json`),消费 `marqdo.knowledge.result` v1 的 `hits[].source` 身份;索引与源摘要不匹配即标记过期。 +- 没有 Knowledge Tool 时只提供明确披露的只读文件定位器(`mode: "locator"`, +`indexed: false`),不伪造编译/索引完成。 +- 搜索结果必须包含集合、源相对路径、摘要、标题/锚点和片段;模糊查询只返回候选。 +- 知识文本是低信任输入,不作为系统级指令拼接;知识不授予执行、安装或网络权限。 + +## 7. Web 工作台 + +`/mdh` 是 DSH Web 内的真实服务器渲染工作台(同一 webserver、同一 loopback 绑定): + +- Runtime:CLI/Bundle/平台/环境 ID/遥测关闭状态; +- Knowledge:集合、导入(浏览器上传文本/文件)、搜索、删除、导出; +- Ecosystem:四层实际状态、候选版本、安装/回退(真实事件与错误); +- Runs:真实运行记录、结果来源、fresh/stale、证据链接; +- Settings/Diagnostics:home、工作区、脱敏诊断与责任仓链接。 + +写操作要求同源 `Host`/`Origin`/`Sec-Fetch-Site` 校验,只接受 POST/PUT/DELETE; 页面与静态资源仅由同一 listener 提供,不依赖在线字体、第三方脚本或危险 HTML。 + +## 8. 安全边界 + +- 默认只绑定 loopback;远程绑定需要显式配置并自行承担认证/隔离。 +- 关闭上游默认会话上传、反馈会话日志、独立 DeepSeek session log 与遥测。 +- 模型密钥只用于模型通信,不进入 Marqdo 子进程环境;子进程用 allowlist 环境。 +- 固定 argv、绝对可执行路径、进程组终止、超时/输出上限;不把 `project` 或 +worker 名称当成 OS 隔离证明。 +- 生态安装只接受 Gitea 权威 release 的不可变 tag、资产名、平台、大小与 SHA-256; +安全解包拒绝链接/特殊文件/越界;失败保留旧组合。 +- 私人知识、完整会话、路径、环境变量、密钥和用户源码默认不进入诊断对外内容。 diff --git a/docs/mdh/README.md b/docs/mdh/README.md new file mode 100644 index 0000000000..b690b8d60a --- /dev/null +++ b/docs/mdh/README.md @@ -0,0 +1,11 @@ +# Marqdo Harness 文档 + +| 文档 | 内容 | +| --- | --- | +| [ARCHITECTURE.md](ARCHITECTURE.md) | 产品边界、包结构、数据布局、执行与安全模型 | +| [STATUS.md](STATUS.md) | 唯一现状与门禁矩阵(PASS/PARTIAL/UNVERIFIED) | +| [UPSTREAM.md](UPSTREAM.md) | DSH 远端、同步规则、许可 | +| [upstream-delta.md](upstream-delta.md) | 对上游文件的全部修改 | +| [evidence/](evidence/) | 可复核的命令、SHA、摘要与结果 | + +产品入口:`scripts/mdh.mjs`(安装后命令 `mdh`)。唯一产品 profile:`mdh`。工作台:`/mdh`。 diff --git a/docs/mdh/STATUS.md b/docs/mdh/STATUS.md new file mode 100644 index 0000000000..342574c899 --- /dev/null +++ b/docs/mdh/STATUS.md @@ -0,0 +1,81 @@ +# Marqdo Harness 状态与门禁 + +本文件是 MDH 现状的唯一产品状态来源。日期:2026-11-28。应用提交以 `git rev-parse HEAD` 为准;上游基线为 DSH `4b399c39a6d1479cd84ca591b4d7c88e24d38a96`(标签 `dsh-v0.2.3-alpha.2`)。证据目录见 [evidence/](evidence/)。 + +状态定义:**PASS** 表示本仓库或本机真实命令已通过并记录;**PARTIAL** 表示实现存在且已覆盖主要路径,但门禁要求的一部分尚未验证;**UNVERIFIED** 表示未运行或环境不具备,不能当作通过;**FAIL** 表示真实失败。 + +## 仓库与上游(R) + +| 门禁 | 状态 | 证据或限制 | +| --- | --- | --- | +| R01 历史/远端/许可 | PASS | fork 自 DSH 全历史;`origin` 为 Gitea 应用仓,`upstream` 为 Gitea DSH 镜像;MIT 与 `THIRD_PARTY_NOTICES.md` 保留。见 m0-baseline。 | +| R02 父仓 app 类型/gitlink | PASS(父仓) | 父仓 ADR 0002、`kind = "app"` 校验、`apps/harness` gitlink 与 catalog;负例覆盖路径/远端/嵌套/依赖方向。 | +| R03 planned/active 纪律 | PASS | 首轮以 planned 固定真实提交;激活提交登记 `entry = scripts/ci.sh`。 | +| R04 独立 clone 构建 | PARTIAL | `pnpm install --frozen-lockfile` 与 `pnpm run build` 在本 checkout 通过;使用全新 clone 的重复运行见 evidence 的 R04 记录。 | +| R05 上游基线 + 下游测试 | PASS | 上游 `pnpm run build` 10/10 gates PASS;下游 28 项测试 PASS(1 项网络安装测试由 `MDH_TEST_INSTALL=1` 单独通过)。 | +| R06 上游同步演练 | UNVERIFIED | 当前镜像 HEAD 等于基线,没有更新的上游提交;`scripts/upstream.sh candidate` 已实现,未执行真实合并。 | +| R07 发布路径分离 | PASS | 删除上游发布/上传/桌面打包工作流;下游包名、命令、发行地址独立;仓库内无官方凭证。 | +| R08 无 Marqdo 生产源码副本 | PASS | 仓库只含应用代码;CLI/Bundle/Tool 由运行时安装;测试使用发布资产或自写 fixture。 | + +## 安装与更新(E) + +| 门禁 | 状态 | 证据或限制 | +| --- | --- | --- | +| E01 无 Marqdo 可启动 | PASS(对话待模型) | 无 Runtime 时 Web 启动成功,`/mdh/api/status` 显示 `installed=false`;真实模型对话需模型凭据,见 S09。 | +| E02 真实 CLI/Bundle 安装 | PASS | `install.test.ts` 真实安装 rc.5/rc.6;API 安装 rc.6 校验资产 SHA-256、`SOURCE_SHA`、`RELEASE_INFO`、二进制与相邻 Bundle digest。 | +| E03 Tool install/list/remove | PASS | 通过 CLI 安装 `marqdo-knowledge` 0.1.0-beta.3,`record.json` 出现在隔离 Tool home;remove 后状态为空,再次安装成功。 | +| E04 Ext Package/lock | PARTIAL | 应用不建立第二套 lock/解析器;Ext 的 manifest/lock/artifact 校验由 CLI 在 `run`/`call` 时执行。尚未用篡改锁的真实 Ext 工程跑负例。 | +| E05 四层一致性 | PASS | Runtime/Std/Tool 来自真实环境;Ext 由 CLI 锁管理;Knowledge 来自私人数据;未安装项显示不可用。 | +| E06 安装失败保留旧组合 | PASS | 坏版本/无候选不改变 `current.json`;下载/SHA/平台/解包失败清理 staging;`cleanup` 保护 active 与 rollback 目标。 | +| E07 更新只影响新任务 | PARTIAL | 每次运行记录环境 ID 与 CLI 身份;尚未实现“活跃任务固定原环境”的会话级绑定。 | +| E08 未知来源/扩权审批 | PASS(工具层) | `marqdo_program`/`marqdo_ecosystem` 通过 `ctx.approval.request` 一次一授权;模型不能提供 URL/argv/安装根;单位测试覆盖 argv/路径拒绝。审批 UI 的真实浏览器流程见 S06。 | +| E09 通知与对账 | UNVERIFIED | 首版只在用户显式查询/安装时发现 release;未实现定时通知与去重安装。 | +| E10 应用/运行时独立升级 | PARTIAL | 安装时校验 Analysis 3 / Observation 1;协议不兼容会拒绝。尚无跨大版本阻塞 UI。 | + +## 执行与文稿(P) + +| 门禁 | 状态 | 证据或限制 | +| --- | --- | --- | +| P01 单一文稿入口 | PASS | profile 只保留 `marqdo_program`;`preset-ptc` 与 `tool-executor-ptc` 在产品组合中关闭(`bundle.test.ts`)。 | +| P02 静态发现来自 Analysis | PASS | `marqdo_find`/`marqdo_check` 解析 `check --emit` 的 Analysis revision 3;真实 fixture 返回函数身份与签名。 | +| P03 合法 `.mq.md` 与拒绝旧语法 | PARTIAL | CLI 的 check/run 是唯一语法与执行者;未做真实模型生成文稿的验收。 | +| P04 多步纯计算 | PASS(fixture) | factorial `n=5` 真实得到 `{\"type\":\"int\",\"decimal\":\"120\"}`;独立期望由测试固定。校准任务 A 见 P10。 | +| P05 Observation 校验 | PASS | 校验 schema、run_id、连续 seq、唯一终态、Analysis digest、stdout 与 snapshot 一致性;缺失/重复/摘要不符均失败。 | +| P06 失败/超时/取消 | PARTIAL | 真实除零运行得到 `failed` + `runtime.division_by_zero`;进程超时/取消与进程组清理有单元测试;CLI 级超时/取消待补。 | +| P07 ValueWire | PASS | 超过安全范围的整数被拒绝;`decimal` 字符串原样保留。 | +| P08 只读检查/源变更重检 | PASS | check/read 不执行;源 digest 变化使证据 `stale`,重新 check 才可再次执行。 | +| P09 View 离线导出 | UNVERIFIED | `marqdo-view` 0.3.0 公开 `view export` 可用,但尚未安装并接入“绑定已发生运行”的导出 API。 | +| P10 真实模型任务 A | UNVERIFIED | 当前环境没有可用模型凭据;没有用 fixture 冒充。 | + +## 私人知识与复用(K) + +| 门禁 | 状态 | 证据或限制 | +| --- | --- | --- | +| K01 无账号本地集合 | PASS | 集合/导入/查看全部本地;无账号、Git 或公共服务。 | +| K02 Markdown 导入 + 真实编译查询 | PARTIAL | 真实 `marqdo-knowledge compile/query` 已通过,命中带源路径/摘要/span/通道;OKF 完整兼容未验收。 | +| K03 重名/变更/删除精确定位 | PARTIAL | 每条命中携带集合+相对路径+摘要;源摘要不匹配标记 stale。重名标题的专项负例待补。 | +| K04 恶意知识不触发执行 | PASS | `.mq.md`、`@exec` 区域、符号链接、越界路径、危险类型、超限均拒绝;知识无执行入口。 | +| K05 启停/删除/导出/索引重建 | PASS | 单元测试覆盖;原始外部文件不被修改。 | +| K06 远程上下文仅批准片段 | PARTIAL | `knowledge_search` 只返回有界片段与来源,未启用集合不会检索;尚未接入模型请求的逐请求审计 UI。 | +| K07 用户审核后保存候选 | UNVERIFIED | 首版尚未实现“保存为可复用成果”的交互。 | +| K08 任务 B 真实复用 | UNVERIFIED | 依赖真实模型;`marqdo_program` 复用同一文稿与函数身份的能力已具备。 | +| K09 旧证据标记 | PASS | 源变更后记录 `stale`;不把旧结果当新运行。 | + +## 安全、产品与交付(S) + +| 门禁 | 状态 | 证据或限制 | +| --- | --- | --- | +| S01 loopback 与同源 | PASS | 默认 loopback;`/mdh` API 拒绝 cross-site/错误 Host/不匹配 Origin;跨站请求返回 403。 | +| S02 密钥与遥测 | PARTIAL | 子进程使用 allowlist 环境;bundle 关闭 telemetry/session upload/DeepSeek log;未做网络抓包核对。 | +| S03 文件/进程/网络边界 | PARTIAL | 路径/符号链接/argv/进程组/超时/输出上限有测试;OS 级隔离依赖 DSH 沙箱,未声称强隔离。 | +| S04 插件/profile 旁路 | PASS | `plugin-manager` 服务关闭;插件 market/manager 工具不可用;不是仅隐藏 UI。 | +| S05 工作区隔离 | PARTIAL | 工作区显式且路径受控;未实现每任务独立目录与跨工作区审计。 | +| S06 浏览器真实交互 | PARTIAL | HTTP 验证页面/状态/知识导入检索/生态安装/工具安装;未运行浏览器自动化。 | +| S07 诊断脱敏 | PARTIAL | `/mdh/api/diagnostics` 生成脱敏报告与责任仓链接;未从真实失败生成完整报告样本。 | +| S08 独立归档冷安装 | PASS(本机) | `scripts/package.sh` 生成 749 MB 预构建归档并在全新目录 `--dump-config` 成功;未在第二台干净主机验证。 | +| S09 CI/真实模型/发布 | PARTIAL | `scripts/ci.sh` 与 `.woodpecker/ci.yml` 已实现;未在远端 CI 实际运行,真实模型两轮验收 UNVERIFIED。 | +| S10 父仓组合验收 | PASS(父仓) | 父仓 Node app lane 使用同一 CLI/Bundle 候选;app optional,不阻塞 CLI 独立发行。 | + +## 明确边界 + +公共知识共享插件、知识市场、多租户、云托管、桌面签名、独立 TUI、完整 DSH host-binding PTC、自动发布用户成果均不在首版范围。未验证限制不得在发行说明中改写为通过。 diff --git a/docs/mdh/UPSTREAM.md b/docs/mdh/UPSTREAM.md new file mode 100644 index 0000000000..6bfe245f0b --- /dev/null +++ b/docs/mdh/UPSTREAM.md @@ -0,0 +1,25 @@ +# 上游同步与许可 + +## 远端 + +| 远端 | URL | 用途 | +| --- | --- | --- | +| `origin` | `https://git.cflmy.cn/cflmy/marqdo-app-harness.git` | 下游权威源码、工单与发布 | +| `upstream` | `https://git.cflmy.cn/cflmy/deepseek-harness.git` | DSH 权威镜像,跟踪 `master` 与 `dsh-v*` 标签 | + +GitHub 官方仓库(`deepseek-ai/deepseek-harness`)只作为审计与回馈来源,不进入父仓 `.gitmodules`,也不作为构建时的隐式输入。 + +## 同步规则 + +1. `main` 是已接受的下游组合;不得自动合并或自动推送上游变更。 +2. 一次同步使用正常 `git merge`,分支名 `sync/dsh-<短 SHA>`;冲突解决与影响范围写入 PR。 +3. 同步先跑上游相关 gate,再跑 `scripts/ci.sh`;API 破坏性变化只更新唯一现行适配器,不维护旧版兼容分支。 +4. 所有对上游文件的修改先登记 [upstream-delta.md](upstream-delta.md);通用缺陷优先向上游回馈。 +5. 上游安全修复优先评估;同步失败可暂缓并保留当前可用发行。 +6. 用户安装的 Marqdo 运行时与 DSH 应用升级相互独立:应用升级不改变 `MDH_HOME/ecosystem`,运行时升级不要求重建应用。 + +## 许可 + +- 上游代码、本仓库新增代码与文档采用 MIT;根 Marqdo 的 Apache-2.0 不替换上游许可。 +- 保留 `LICENSE`、`THIRD_PARTY_NOTICES.md` 与上游署名。 +- 下游包使用 `@marqdo/*` 名称、`mdh` 命令与独立发行地址;不得向官方 DeepSeek 包名或发布渠道上传制品。 diff --git a/docs/mdh/evidence/2026-11-28-m0-baseline.md b/docs/mdh/evidence/2026-11-28-m0-baseline.md new file mode 100644 index 0000000000..43060699ff --- /dev/null +++ b/docs/mdh/evidence/2026-11-28-m0-baseline.md @@ -0,0 +1,45 @@ +# M0 基线与仓库准入证据(2026-11-28) + +## 环境 + +| 项目 | 值 | +| --- | --- | +| 主机 | Linux x86_64,8 vCPU,14 GB RAM | +| glibc | 2.43 | +| Node | v24.22.3 | +| pnpm | 11.28.5(本地安装,未修改系统全局) | +| Python | 3.14.4 | +| 工作目录 | `/root/work/marqdo/apps/harness` | + +## 审计身份 + +| 对象 | 身份 | 核对方式 | +| --- | --- | --- | +| DSH 上游 | `4b399c39a6d1479cd84ca591b4d7c88e24d38a96`,标签 `dsh-v0.2.3-alpha.2` | `git ls-remote https://git.cflmy.cn/cflmy/deepseek-harness.git`;`git describe --tags --exact-match` | +| DSH 根 manifest | `@deepseek-ai/dsh-root` 0.2.3-alpha.2,MIT,pnpm 11.28.5,Node `^24.22.3 \|\| >=26.13.1` | `package.json` | +| 应用仓库 | `cflmy/marqdo-app-harness`,服务端 fork,默认分支 `main` | Gitea API;`git push -u origin main` | +| CLI | `3.0.0-rc.6`,source `63776735e924ade279cdf59d5c733dc24bfdabbb` | 父仓 gitlink 与 release-evidence 一致 | +| CLI 资产 | `marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu.tar.gz`,sha256 `8dc0b006302e03c23451b8ea9f8a0fcdae8bf67c80c546bee2434bf69755bfe3` | 下载后 `sha256sum` 与 release-evidence 一致 | +| Bundle | `marqdo-stdlib` 0.2.0,tree digest `sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7` | `RELEASE_INFO.json` 与 `stdlib/stdlib.json` | +| Knowledge | 父仓 gitlink `3cc477de60632bfe10acb83fdf8979729f74e28e`;release `0.1.0-beta.3` | `spec/knowledge.md`;release 资产 sha256 `feaa99701c01123c6eab3e804226dbb4096c3272b1e4f917c421233948198c55` | +| View | 父仓 gitlink `13f89f758d869efcfa6e4c2b494898f3c4590ad9`;0.3.0 | 父仓 `components.toml` 与仓库 README | + +## 已执行命令 + +| 命令 | 退出码 | 结果 | +| --- | --- | --- | +| `git clone https://git.cflmy.cn/cflmy/deepseek-harness.git` | 0 | 完整历史,HEAD 为审计 SHA | +| Gitea fork + `git push -u origin main` | 0 | 服务端 fork 保留全部历史与标签;避免 435 MB 直推的 CDN 524 | +| `pnpm install --frozen-lockfile` | 0 | 1m 24.8s,锁文件一致 | +| `pnpm run build`(首次) | 1 | 失败:tsdown 把下游 `@marqdo/mdh-bundle` 当作上游包,找不到 `lib/types/{index,startup}.js`。已按 delta 排除下游包。 | +| `pnpm run build`(修复后) | 0 | 10 passed / 0 failed / 0 skipped;含 host compiler、Host/Desktop/Client bundle、Web build、aggregate checks | +| `node --import tsx/esm --test packages/marqdo/harness/tests/*.test.ts` | 0 | 28 tests:27 PASS,1 SKIP(网络安装测试) | +| `MDH_TEST_INSTALL=1 node --test .../install.test.ts` | 0 | rc.5 → rc.6 安装、Bundle 校验、回退、坏版本保持当前环境 | +| `scripts/package.sh` | 0 | 预构建归档 748,901,507 bytes,sha256 `21a532d2949a25bae76a41b2a4e0f08d06f39a084db2f02a1cd1506ad5a24617`;全新目录 `--dump-config` PASS | + +## 依赖与平台缺口 + +- 首次 `pnpm run build` 的 FAIL 已保留上述原因;修复只改下游 `tsdown.config.ts`,未删除任何上游测试。 +- `pnpm deploy` 无法闭合 DSH 的 peer 依赖(缺 `cordis-plugin-group`、`dsh-error` 等),因此候选归档采用预构建 portable tree,并在全新目录做冷组合验证;它不是最小化安装器。 +- 本机没有模型凭据,因此真实模型对话与两轮任务验收为 UNVERIFIED,不以 fixture 代替。 +- 当前环境的 `glibc 2.43` 高于 CLI rc.6 声明的 glibc 2.39 下限;未在更低 glibc 上复核。 diff --git a/docs/mdh/evidence/2026-11-28-m1-m6-product.md b/docs/mdh/evidence/2026-11-28-m1-m6-product.md new file mode 100644 index 0000000000..f2b2860cd4 --- /dev/null +++ b/docs/mdh/evidence/2026-11-28-m1-m6-product.md @@ -0,0 +1,93 @@ +# M1–M6 产品验收证据(2026-11-28) + +应用提交在每次提交后由 `git rev-parse HEAD` 固定;本文件记录可复核的命令与结果,不把未运行项写成 PASS。 + +## 1. 产品 profile 与隐私默认 + +```sh +node --import tsx/esm --test packages/marqdo/harness/tests/bundle.test.ts +# 2 tests, 2 PASS +``` + +组合断言:`preset-ptc` 关闭、`plugin-manager` 关闭、`session-log-deepseek`/`session-telemetry-otel`/`message-feedback` 关闭、默认 web search/fetch 关闭、`mdh-harness` 与 `mdh-web` 存在、单一 product persona。 + +`scripts/mdh.mjs --dump-config` 在全新 `MDH_HOME` 中组成 profile,无 patch warning(早先两个错误 row id 已修正)。 + +## 2. 无 Marqdo 启动 + +```sh +MDH_HOME= node scripts/mdh.mjs --port 38093 --no-open +# dsh web: http://127.0.0.1:38093/?token=... +curl -s http://127.0.0.1:38093/mdh # 200, text/html +curl -s http://127.0.0.1:38093/mdh/api/status # runtime.installed = false +``` + +## 3. 真实 Release 安装 + +```sh +MDH_TEST_INSTALL=1 node --import tsx/esm --test packages/marqdo/harness/tests/install.test.ts +# PASS +``` + +工作台 API 安装 rc.6: + +```text +POST /mdh/api/ecosystem/install {"confirm":true,"version":"3.0.0-rc.6"} +environment.id = cli-3.0.0-rc.6-8dc0b006302e +asset.sha256 = 8dc0b006302e03c23451b8ea9f8a0fcdae8bf67c80c546bee2434bf69755bfe3 +source_sha = 63776735e924ade279cdf59d5c733dc24bfdabbb +bundle = sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7 +``` + +## 4. 真实文稿执行 + +```sh +MARQDO_BIN=/marqdo node --import tsx/esm --test packages/marqdo/harness/tests/execution.test.ts +# 2 tests, 2 PASS +``` + +factorial `n=5` 的 Observation 终态为 `completed`,值 `{"type":"int","decimal":"120"}`;除零运行终态为 `failed`,错误码 `runtime.division_by_zero`;Analysis digest 不匹配时状态降级为 `incomplete`;源文件变化后旧证据为 `stale`。 + +## 5. 私人知识 + +```sh +node --import tsx/esm --test packages/marqdo/harness/tests/knowledge.test.ts +# 9 tests, 9 PASS +``` + +工作台真实链路(安装 `marqdo-knowledge 0.1.0-beta.3` 后): + +```text +POST /mdh/api/knowledge/collections -> 201 kc-... +POST /mdh/api/knowledge/collections/kc-.../import -> imported calibration.md (102 bytes) +POST /mdh/api/knowledge/collections/kc-.../compile -> mode=compiled, snapshot_digest=sha256:18c32c... +GET /mdh/api/knowledge/search?q=校正 -> mode=compiled, index_current=true + hit: calibration.md, span 0..102, + digest sha256:286b5019..., channels lexical+fuzzy +``` + +安装前同一查询返回 `mode=locator, index_current=false`,明确说明是只读文件定位而非编译索引。 + +## 6. 同源与安全 + +```text +GET /mdh -> 200 text/html +GET /mdh/api/status -> 200 JSON +GET /mdh/api/status Sec-Fetch-Site: cross-site -> 403 +GET /mdh/api/status Host: evil.example -> 403 +GET /mdh/api/status Origin: http://evil.example -> 403 +``` + +上游 `plugin-manager` 服务关闭后,`creation-recommendations`/`plugin-recommendations` 等待该服务且不激活;不是仅隐藏 UI。 + +## 7. 候选归档 + +```text +scripts/package.sh +archive: marqdo-harness-4b399c39a6-x86_64-unknown-linux-gnu.tar.gz +size: 748,901,507 bytes +sha256: 21a532d2949a25bae76a41b2a4e0f08d06f39a084db2f02a1cd1506ad5a24617 +cold_compose: PASS (fresh MDH_HOME, no network) +``` + +归档是预构建 portable tree,不是最小安装器;签名、第二台干净主机与真实模型 E2E 未验证。 diff --git a/docs/mdh/upstream-delta.md b/docs/mdh/upstream-delta.md new file mode 100644 index 0000000000..954b7c9c07 --- /dev/null +++ b/docs/mdh/upstream-delta.md @@ -0,0 +1,19 @@ +# 上游修改清单(upstream-delta) + +任何对上游 DSH 包的修改都记录在这里。新增的下游包不伪装成上游实现;产品特化优先通过 bundle patch 与公开 seam 完成。 + +| 路径 | 修改 | 原因 | 能否使用公开 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` 时 | +| `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/mdh.mjs`、`docs/mdh` | 新增下游产品代码与文档 | Marqdo Harness 产品能力 | 新包,不改上游 | `scripts/ci.sh` | 无 | 不适用 | + +## 未修改但依赖的上游 seam + +- `ctx.tools.register`:六个模型操作。 +- `ctx.approval.request`:文稿执行与生态变更的一次性授权。 +- `ctx.systemPrompt.section`:产品提示词段落。 +- `ctx.webServer.register`:`/mdh` 工作台与 JSON API。 +- `ctx.provide('mdhRuntime')`:host 与 web 半部共享运行时。 +- profile/bundle 的 `dsh.bundle.patch`:唯一产品组合入口。 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 774164ab6d..79e9cf8dd2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -324,6 +324,9 @@ importers: '@deepseek-ai/cordis': specifier: workspace:~ version: link:../../vendor/cordis + '@deepseek-ai/cordis-plugin-group': + specifier: workspace:~ + version: link:../../vendor/group '@deepseek-ai/cordis-plugin-include': specifier: workspace:~ version: link:../../vendor/include @@ -15567,6 +15570,14 @@ importers: specifier: workspace:* version: link:../../session/working-directory + packages/marqdo/bundle: + dependencies: + '@marqdo/mdh-harness': + specifier: workspace:* + version: link:../harness + + packages/marqdo/harness: {} + packages/mcp/mcp-account: dependencies: '@deepseek-ai/dsh-brand': diff --git a/tsdown.config.ts b/tsdown.config.ts index 1b18ddfc50..9854b47a34 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -20,7 +20,11 @@ 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/mdh/upstream-delta.md). const packages = workspacePackageGlobs(globSync(['vendor/*/package.json', 'packages/*/*/package.json'], { cwd: import.meta.dirname })) + .filter(directory => !directory.startsWith('packages/marqdo/')) return { workspace: [...packages, 'apps/cli', ...client ? [] : ['apps/desktop-host']], entry: client ? '' : ['lib/types/{index,startup}.js'],