@tonyclaw/eval-harness 0.2.18 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -180,10 +180,12 @@ npx @tonyclaw/eval-harness --help
180
180
  npx @tonyclaw/eval-harness runner-presets
181
181
  ```
182
182
 
183
- The npm package is a thin Node.js launcher around the bundled Python source. It
184
- still requires Python 3.10+ on `PATH`, or set `EVAL_HARNESS_PYTHON` to the
185
- Python executable to use. When run outside this repository, it falls back to the
186
- package's bundled `config/eval.example.json` and `schemas/` directory.
183
+ The npm package uses an optional native package when one exists for the current
184
+ platform. On Windows x64, `@tonyclaw/eval-harness-win32-x64` bundles the Python
185
+ runtime, so users do not need to install Python just to run the harness CLI.
186
+ Other platforms currently fall back to the bundled Python source and require
187
+ Python 3.10+ on `PATH`, or set `EVAL_HARNESS_PYTHON` to the Python executable
188
+ to use. Set `EVAL_HARNESS_FORCE_PYTHON=1` to bypass the native binary.
187
189
 
188
190
  Without installation:
189
191
 
package/README.zh-CN.md CHANGED
@@ -143,10 +143,12 @@ npx @tonyclaw/eval-harness --help
143
143
  npx @tonyclaw/eval-harness runner-presets
144
144
  ```
145
145
 
146
- npm 包是一个很薄的 Node.js 启动器,会调用包内自带的 Python 源码。
147
- 运行机器仍然需要 `PATH` 中有 Python 3.10+,也可以通过
148
- `EVAL_HARNESS_PYTHON` 指定 Python 可执行文件。从仓库外运行时,它会
149
- fallback npm 包内置的 `config/eval.example.json` `schemas/`。
146
+ npm 主包会优先使用当前平台对应的 optional native 包。Windows x64 上
147
+ `@tonyclaw/eval-harness-win32-x64` 已内置 Python runtime,因此用户只运行
148
+ harness CLI 时不需要单独安装 Python。其他平台当前会 fallback 到 npm 包内置
149
+ Python 源码,仍需要 `PATH` 中有 Python 3.10+,也可以通过
150
+ `EVAL_HARNESS_PYTHON` 指定 Python 可执行文件。设置
151
+ `EVAL_HARNESS_FORCE_PYTHON=1` 可以强制绕过 native binary。
150
152
 
151
153
  不安装包也可以运行:
152
154
 
@@ -36,6 +36,52 @@ function pythonCandidates() {
36
36
  }
37
37
 
38
38
  const cliArgs = process.argv.slice(2);
39
+
40
+ function nativePackageCandidates() {
41
+ const key = `${process.platform}-${process.arch}`;
42
+ const packages = {
43
+ "win32-x64": {
44
+ name: "@tonyclaw/eval-harness-win32-x64",
45
+ executable: path.join("bin", "eval-harness.exe")
46
+ }
47
+ };
48
+ return packages[key] ? [packages[key]] : [];
49
+ }
50
+
51
+ function resolveNativeExecutable(candidate) {
52
+ try {
53
+ const packageJson = require.resolve(`${candidate.name}/package.json`, {
54
+ paths: [packageRoot, process.cwd()]
55
+ });
56
+ const executable = path.join(path.dirname(packageJson), candidate.executable);
57
+ return fs.existsSync(executable) ? executable : null;
58
+ } catch (_) {
59
+ return null;
60
+ }
61
+ }
62
+
63
+ if (env.EVAL_HARNESS_FORCE_PYTHON !== "1") {
64
+ for (const candidate of nativePackageCandidates()) {
65
+ const nativeExecutable = resolveNativeExecutable(candidate);
66
+ if (!nativeExecutable) {
67
+ continue;
68
+ }
69
+ const result = spawnSync(nativeExecutable, cliArgs, {
70
+ cwd: process.cwd(),
71
+ env,
72
+ stdio: "inherit"
73
+ });
74
+ if (result.error && result.error.code === "ENOENT") {
75
+ continue;
76
+ }
77
+ if (result.error) {
78
+ console.error(`eval-harness native launcher failed: ${result.error.message}`);
79
+ process.exit(1);
80
+ }
81
+ process.exit(result.status === null ? 1 : result.status);
82
+ }
83
+ }
84
+
39
85
  let lastError = null;
40
86
  for (const candidate of pythonCandidates()) {
41
87
  const result = spawnSync(
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@tonyclaw/eval-harness",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Evaluation harness for configurable runner work packages",
5
5
  "bin": {
6
6
  "eval-harness": "bin/eval-harness.js"
7
7
  },
8
+ "optionalDependencies": {
9
+ "@tonyclaw/eval-harness-win32-x64": "0.2.19"
10
+ },
8
11
  "files": [
9
12
  "bin/",
10
13
  "src/eval/**/*.py",
@@ -20,7 +23,8 @@
20
23
  "scripts": {
21
24
  "test": "python -m pytest",
22
25
  "smoke": "node bin/eval-harness.js --help",
23
- "pack:dry-run": "npm pack --dry-run"
26
+ "pack:dry-run": "npm pack --dry-run",
27
+ "build:native:win32-x64": "powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build-native-win32-x64.ps1"
24
28
  },
25
29
  "repository": {
26
30
  "type": "git",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eval-harness"
7
- version = "0.2.18"
7
+ version = "0.2.19"
8
8
  description = "Evaluation harness for configurable runner work packages"
9
9
  requires-python = ">=3.10"
10
10
  dependencies = []
@@ -1,3 +1,3 @@
1
1
  """Evaluation harness for configurable runner work packages."""
2
2
 
3
- __version__ = "0.2.18"
3
+ __version__ = "0.2.19"
package/src/eval/cli.py CHANGED
@@ -43,6 +43,11 @@ def default_packaged_path(relative_path: str, env_name: str) -> Path:
43
43
  local = Path(relative_path)
44
44
  if local.exists():
45
45
  return local
46
+ bundle_root = str(getattr(sys, "_MEIPASS", "") or "").strip()
47
+ if bundle_root:
48
+ bundled = Path(bundle_root) / relative_path
49
+ if bundled.exists():
50
+ return bundled
46
51
  packaged = Path(__file__).resolve().parents[2] / relative_path
47
52
  if packaged.exists():
48
53
  return packaged