@melaya/runner 1.1.34 → 1.1.35
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 +28 -2
- package/package.json +1 -1
package/dist/pythonEnv.js
CHANGED
|
@@ -496,12 +496,38 @@ export async function ensurePythonEnv(systemPython, expectedVersion, onProgress
|
|
|
496
496
|
// this passes, so a half-built venv is never cached as valid: the next
|
|
497
497
|
// launch re-enters this rebuild path and self-heals instead of returning a
|
|
498
498
|
// broken venv as ok.
|
|
499
|
-
|
|
499
|
+
// Importing the in-house agentscope eagerly loads its full submodule tree
|
|
500
|
+
// (model/tool/rag/embedding/…), so it drags in every third-party dep at load
|
|
501
|
+
// time. A single broken wheel therefore surfaces here as an "agentscope"
|
|
502
|
+
// failure even though our package is fine. Import each name in turn and, on
|
|
503
|
+
// the FIRST failure, emit a machine-parseable PROBE_FAIL line naming the exact
|
|
504
|
+
// module + error — captured below so the reason names the real culprit instead
|
|
505
|
+
// of the useless "agentscope import failed" (which sent every Mac 3.14→3.12
|
|
506
|
+
// dep breakage back as an unactionable message).
|
|
507
|
+
let probeErr = "";
|
|
508
|
+
const probe = await runProc(venvPython(), ["-c",
|
|
509
|
+
"import sys\n" +
|
|
510
|
+
"for _m in ('shortuuid','agentscope','anthropic','openai'):\n" +
|
|
511
|
+
" try:\n" +
|
|
512
|
+
" __import__(_m)\n" +
|
|
513
|
+
" except Exception as _e:\n" +
|
|
514
|
+
" import traceback\n" +
|
|
515
|
+
" sys.stderr.write('PROBE_FAIL module=%s %s: %s\\n' % (_m, type(_e).__name__, _e))\n" +
|
|
516
|
+
" traceback.print_exc()\n" +
|
|
517
|
+
" sys.exit(1)\n",
|
|
518
|
+
], (line) => {
|
|
519
|
+
if (/^PROBE_FAIL /.test(line))
|
|
520
|
+
probeErr = line.replace(/^PROBE_FAIL\s+/, "").trim();
|
|
521
|
+
onProgress(line);
|
|
522
|
+
}, { PYTHONPATH: CACHE_DIR });
|
|
500
523
|
if (probe !== 0) {
|
|
524
|
+
const where = venvMinorVersion() === null ? "" : `Python 3.${venvMinorVersion()} `;
|
|
501
525
|
return {
|
|
502
526
|
ok: false,
|
|
503
527
|
pythonPath: systemPython,
|
|
504
|
-
reason:
|
|
528
|
+
reason: probeErr
|
|
529
|
+
? `${where}venv import probe failed — ${probeErr}. Importing agentscope loads its whole dependency tree, so this is the dep that broke (not agentscope itself). See the traceback above; the venv will be rebuilt on next launch.`
|
|
530
|
+
: `agentscope import probe failed on the ${where}venv — a dependency did not import. See the lines above; the venv will be rebuilt on next launch.`,
|
|
505
531
|
};
|
|
506
532
|
}
|
|
507
533
|
writeFileSync(VENV_MARK, venvMarkerValue(expectedVersion), "utf-8");
|