@melaya/runner 1.0.31 → 1.0.32
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/dist/pythonEnv.js +21 -0
- package/package.json +1 -1
package/dist/pythonEnv.js
CHANGED
|
@@ -70,6 +70,16 @@ const PIP_DEPS = [
|
|
|
70
70
|
"python-docx",
|
|
71
71
|
"python-pptx",
|
|
72
72
|
"ddgs", // duckduckgo search rebrand — shared.tools.core imports DDGS
|
|
73
|
+
// Scrapling — full-text article fetcher used by shared.tools.core.
|
|
74
|
+
// Without it, web_search emits the "Snippets only (Scrapling
|
|
75
|
+
// unavailable)" fallback, agents get 1-line DDG titles instead of
|
|
76
|
+
// article bodies, and small models hallucinate to fill the gap.
|
|
77
|
+
// [fetchers] extra brings curl_cffi for the TLS-impersonating
|
|
78
|
+
// AsyncFetcher (no browser needed) AND playwright for the optional
|
|
79
|
+
// StealthyFetcher rescue path. The stealth path also needs
|
|
80
|
+
// `scrapling install` to download Chromium — best-effort run below
|
|
81
|
+
// (failure non-fatal: AsyncFetcher fast-path still works without it).
|
|
82
|
+
"scrapling[fetchers]",
|
|
73
83
|
];
|
|
74
84
|
export function venvPython() {
|
|
75
85
|
return platform() === "win32"
|
|
@@ -149,6 +159,17 @@ export async function ensurePythonEnv(systemPython, expectedVersion, onProgress
|
|
|
149
159
|
reason: `pip install failed (exit ${acode}). Check the lines above for the actual pip error.`,
|
|
150
160
|
};
|
|
151
161
|
}
|
|
162
|
+
// Scrapling browser binaries — best-effort. The fast-path AsyncFetcher
|
|
163
|
+
// (curl_cffi TLS impersonation) works without this; only StealthyFetcher
|
|
164
|
+
// (Cloudflare-bypass rescue path) needs Chromium. If `scrapling install`
|
|
165
|
+
// fails (offline, network blip, browser-download mirror down) we don't
|
|
166
|
+
// fail the venv — the search just stays on the fast path. Logs are
|
|
167
|
+
// surfaced so the operator sees what happened.
|
|
168
|
+
onProgress("installing scrapling browsers (best-effort, for stealth rescue path)");
|
|
169
|
+
const scrCode = await runProc(venvPython(), ["-m", "scrapling", "install"], onProgress);
|
|
170
|
+
if (scrCode !== 0) {
|
|
171
|
+
onProgress(`(scrapling install exited ${scrCode} — fast-path fetcher still works; stealth-rescue disabled)`);
|
|
172
|
+
}
|
|
152
173
|
writeFileSync(VENV_MARK, expectedVersion, "utf-8");
|
|
153
174
|
// sanity: confirm shortuuid + agentscope (via PYTHONPATH) resolve now.
|
|
154
175
|
// Probe must mirror the spawn env so PYTHONPATH=CACHE_DIR points at
|