feat(python-runtime): package the Windows x64 dsh executable

Add node24-win-x64 as the only supported Windows runtime target and publish it as a py3-none-win_amd64 wheel containing the conventional dsh and ripgrep .exe payload names. Keep Windows ARM64 rejected explicitly so Python cannot claim a carrier that CI and release automation do not build.

Teach the pkg builder to require a native x64 Windows host, validate both node-pty ConPTY addons, copy @vscode's win32 ripgrep executable, and recognize pkg's .exe output. Extend runtime resolution, wheel staging, payload validation, and the preset closure check so the Windows-specific PowerShell plugins and sidecars fail loud when omitted.

The sidecar resolver now maps a packaged main.exe to main-rg.exe; focused TypeScript and Python tests cover that name, the win_amd64 manifest, x64-only host selection, complete wheel payload, ConPTY inventory, and platform-conditioned plugin closure.
This commit is contained in:
Tianyi Cui
2026-08-24 19:09:40 +08:00
parent f76a225a7d
commit ca0b21661e
18 changed files with 380 additions and 53 deletions
+16 -3
View File
@@ -39,7 +39,15 @@ def _host_platform_tag() -> str:
machine = platform.machine().lower()
arch = "arm64" if machine in {"arm64", "aarch64"} else "x64" if machine in {"x86_64", "amd64"} else machine
system = platform.system().lower()
key = f"macos-{arch}" if system == "darwin" else f"linux-{arch}" if system == "linux" else system
key = (
f"macos-{arch}"
if system == "darwin"
else f"linux-{arch}"
if system == "linux"
else f"win-{arch}"
if system == "windows"
else system
)
try:
return _PLATFORMS[key][0]
except KeyError as exc:
@@ -69,16 +77,21 @@ class RuntimeBuildHook(BuildHookInterface):
runtime_files = sorted(
runtime_dir.glob("deepseek-harness-sdk-runtime-*") if runtime_dir.is_dir() else []
)
expected_files = [expected_executable, f"{expected_executable}-rg"]
expected_files = (
[expected_executable, f"{expected_executable.removesuffix('.exe')}-rg.exe"]
if expected_executable.endswith(".exe")
else [expected_executable, f"{expected_executable}-rg"]
)
if "-macos-" in expected_executable:
expected_files.append(f"{expected_executable}-spawn-helper")
expected_files.sort()
found_files = [path.name for path in runtime_files]
if found_files != expected_files:
raise RuntimeError(
f"runtime wheel {platform_tag} payload must be {expected_files}; found {found_files}"
)
for executable in runtime_files:
if executable.stat().st_mode & stat.S_IXUSR == 0:
if platform_tag != "win_amd64" and executable.stat().st_mode & stat.S_IXUSR == 0:
raise RuntimeError(f"runtime executable is not executable: {executable}")
build_data["pure_python"] = False
build_data["infer_tag"] = False
+2
View File
@@ -59,6 +59,7 @@
"@deepseek-ai/dsh-plan-mode": "workspace:^",
"@deepseek-ai/dsh-persona": "workspace:^",
"@deepseek-ai/dsh-pwsh-local": "workspace:^",
"@deepseek-ai/dsh-tool-pwsh-persistent": "workspace:^",
"@deepseek-ai/dsh-terminal": "workspace:^",
"@deepseek-ai/dsh-terminal-bash": "workspace:^",
"@deepseek-ai/dsh-repeat-tool-reminder": "workspace:^",
@@ -103,6 +104,7 @@
"@deepseek-ai/dsh-tool-fs": "workspace:^",
"@deepseek-ai/dsh-tool-fs-search": "workspace:^",
"@deepseek-ai/dsh-tool-goal": "workspace:^",
"@deepseek-ai/dsh-tool-pwsh": "workspace:^",
"@deepseek-ai/dsh-tool-ralph": "workspace:^",
"@deepseek-ai/dsh-tool-skill": "workspace:^",
"@deepseek-ai/dsh-tool-str-replace-editor": "workspace:^",
+4
View File
@@ -10,5 +10,9 @@
"macos-arm64": {
"tag": "macosx_14_0_arm64",
"executable": "deepseek-harness-sdk-runtime-macos-arm64"
},
"win-x64": {
"tag": "win_amd64",
"executable": "deepseek-harness-sdk-runtime-win-x64.exe"
}
}
@@ -4,9 +4,10 @@ Two runtime carriers coexist under ``runtime/``, both injected by the repo's
``scripts/build-exe-for-python-sdk.ts`` build (neither is checked into git):
- **exe (production)**: single-file Node executables named
``deepseek-harness-sdk-runtime-<platform>-<arch>`` (platform in {linux, macos}, arch in
{x64, arm64}) with a sibling ``-rg`` executable; macOS also uses a sibling
``-spawn-helper``. The target machine needs no Node installation.
``deepseek-harness-sdk-runtime-<platform>-<arch>`` for Linux/macOS and an
``.exe`` counterpart for Windows. Each has a sibling ripgrep executable;
macOS also uses a sibling ``-spawn-helper``. The target machine needs no
Node installation.
- **node (dev-only)**: the full deploy closure under ``runtime/node/``
(``package.json`` + ``node_modules/``), executed as ``node
runtime/node/node_modules/@deepseek-ai/dsh/lib/bin.js`` on a
@@ -30,7 +31,7 @@ PACKAGE_METADATA_FILENAME = "deepseek-harness-runtime.json"
RUNTIME_MODE_ENV_VAR = "DSH_RUNTIME_MODE"
_PLATFORM_TAGS = {"linux": "linux", "darwin": "macos"}
_PLATFORM_TAGS = {"linux": "linux", "darwin": "macos", "win32": "win"}
_ARCH_TAGS = {"x86_64": "x64", "amd64": "x64", "arm64": "arm64", "aarch64": "arm64"}
_EXE_ACQUISITION_HINT = (
@@ -62,13 +63,18 @@ def bundled_runtime_path() -> Path:
touching callers).
"""
tag = _current_platform_tag()
path = bundled_package_dir() / "runtime" / f"deepseek-harness-sdk-runtime-{tag}"
extension = ".exe" if tag.startswith("win-") else ""
path = bundled_package_dir() / "runtime" / f"deepseek-harness-sdk-runtime-{tag}{extension}"
if not path.is_file():
raise FileNotFoundError(
f"deepseek-harness-runtime-bin is missing the runtime executable at {path}. "
+ _EXE_ACQUISITION_HINT
)
ripgrep = Path(f"{path}-rg")
ripgrep = (
path.with_name(f"{path.stem}-rg.exe")
if tag.startswith("win-")
else Path(f"{path}-rg")
)
if not ripgrep.is_file():
raise FileNotFoundError(
f"deepseek-harness-runtime-bin is missing the ripgrep sidecar at {ripgrep}. "
@@ -110,11 +116,11 @@ def resolve_bundled_launch_args(mode: str | None = None) -> tuple[str, ...]:
def _current_platform_tag() -> str:
plat = _PLATFORM_TAGS.get(sys.platform)
arch = _ARCH_TAGS.get(platform.machine().lower())
if plat is None or arch is None:
if plat is None or arch is None or (plat == "win" and arch != "x64"):
raise FileNotFoundError(
"no bundled DeepSeek Harness SDK runtime exists for this platform "
f"(sys.platform={sys.platform!r}, machine={platform.machine()!r}); supported: "
"linux/macos on x64/arm64. " + _EXE_ACQUISITION_HINT
"Linux x64/arm64, macOS arm64, and Windows x64. " + _EXE_ACQUISITION_HINT
)
return f"{plat}-{arch}"