mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-11 13:37:47 +08:00
fix(document): select Office engines from declared native targets
This commit is contained in:
@@ -21,6 +21,7 @@ console command requires ``DSH_HOME`` for the same reason.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
@@ -89,13 +90,20 @@ def bundled_runtime_path() -> Path:
|
||||
+ _EXE_ACQUISITION_HINT
|
||||
)
|
||||
office = path.with_name(f"{path.name.removesuffix('.exe')}-office")
|
||||
engine = "wasm" if tag.startswith("linux-") else tag.replace("win-", "win32-").replace("macos-", "darwin-")
|
||||
for required in ("@deepseek-ai/libreoffice-kit/package.json", f"@deepseek-ai/libreoffice-kit-{engine}/prebuilds.json"):
|
||||
if not (office / "node_modules" / required).is_file():
|
||||
raise FileNotFoundError(
|
||||
f"deepseek-harness-runtime-bin is missing the Office sidecar at {office}. "
|
||||
+ _EXE_ACQUISITION_HINT
|
||||
)
|
||||
adapter = office / "node_modules/@deepseek-ai/libreoffice-kit/package.json"
|
||||
if not adapter.is_file():
|
||||
raise FileNotFoundError(
|
||||
f"deepseek-harness-runtime-bin is missing the Office sidecar at {office}. "
|
||||
+ _EXE_ACQUISITION_HINT
|
||||
)
|
||||
native = tag.replace("win-", "win32-").replace("macos-", "darwin-")
|
||||
declared = json.loads(adapter.read_text(encoding="utf-8")).get("optionalDependencies", {})
|
||||
engine = native if f"@deepseek-ai/libreoffice-kit-{native}" in declared else "wasm"
|
||||
if not (office / "node_modules" / f"@deepseek-ai/libreoffice-kit-{engine}/prebuilds.json").is_file():
|
||||
raise FileNotFoundError(
|
||||
f"deepseek-harness-runtime-bin is missing the Office sidecar engine {engine} at {office}. "
|
||||
+ _EXE_ACQUISITION_HINT
|
||||
)
|
||||
return path
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user