@melaya/runner 1.0.33 → 1.0.34

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.
Files changed (2) hide show
  1. package/dist/pythonEnv.js +23 -5
  2. package/package.json +1 -1
package/dist/pythonEnv.js CHANGED
@@ -175,12 +175,30 @@ export async function ensurePythonEnv(systemPython, expectedVersion, onProgress
175
175
  }
176
176
  // Scrapling browser binaries — best-effort. The fast-path AsyncFetcher
177
177
  // (curl_cffi TLS impersonation) works without this; only StealthyFetcher
178
- // (Cloudflare-bypass rescue path) needs Chromium. If `scrapling install`
179
- // fails (offline, network blip, browser-download mirror down) we don't
180
- // fail the venv the search just stays on the fast path. Logs are
181
- // surfaced so the operator sees what happened.
178
+ // (Cloudflare-bypass rescue path) needs Chromium. Scrapling has no
179
+ // __main__.py invoke its CLI entry point via `from scrapling.cli
180
+ // import main; main(['install'])` so the call works the same on every
181
+ // platform without reaching into the venv's Scripts/bin folder.
182
+ // Non-fatal: if it fails (offline, mirror down, scrapling.cli rename in
183
+ // a future version) the search just stays on the fast path.
182
184
  onProgress("installing scrapling browsers (best-effort, for stealth rescue path)");
183
- const scrCode = await runProc(venvPython(), ["-m", "scrapling", "install"], onProgress);
185
+ const scrCode = await runProc(venvPython(), ["-c",
186
+ "import sys\n" +
187
+ "# Try every known CLI shape across scrapling versions, return 0 on first success.\n" +
188
+ "tried = []\n" +
189
+ "for mod, attr in (('scrapling.cli','main'), ('scrapling.__main__','main'), ('scrapling.cli','cli')):\n" +
190
+ " try:\n" +
191
+ " m = __import__(mod, fromlist=[attr])\n" +
192
+ " fn = getattr(m, attr)\n" +
193
+ " try: fn(['install'])\n" +
194
+ " except TypeError: fn() # zero-arg variants\n" +
195
+ " sys.exit(0)\n" +
196
+ " except Exception as e:\n" +
197
+ " tried.append(f'{mod}.{attr}: {type(e).__name__}: {e}')\n" +
198
+ " continue\n" +
199
+ "print('scrapling install: no working CLI entry — tried:'); [print(' -', t) for t in tried]\n" +
200
+ "sys.exit(2)\n",
201
+ ], onProgress);
184
202
  if (scrCode !== 0) {
185
203
  onProgress(`(scrapling install exited ${scrCode} — fast-path fetcher still works; stealth-rescue disabled)`);
186
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,