fix(extension): 入口脚本目录解析——176 部署树路径深度不同致 trial 报入口缺失
_resolve_extension_entry_dir 按 parents[4] 推导,175 仓库布局成立, 176 部署树(bioflow_service 独立树)深度不同 → 找不到 run_extension.py → 试运行报「入口脚本缺失」。修复:env BIOFLOW_EXT_ENTRY_DIR 优先 + 从 __file__ 向上逐级搜索 */bioflow_kernel/cli/run_extension.py + 兜底。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import shlex
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
@@ -261,8 +262,22 @@ def _default_exec_config() -> ExtensionExecConfig:
|
||||
|
||||
|
||||
def _resolve_extension_entry_dir() -> str:
|
||||
"""宿主入口脚本目录 = repo 根 bioflow_kernel/cli(按 __file__ 推导,零硬编码)。"""
|
||||
"""宿主入口脚本目录 = 部署树 bioflow_kernel/cli(env 优先 + 多候选推导)。
|
||||
|
||||
2026-09-15 实测:parents[4] 推导在 175 仓库布局成立,176 部署树路径深度
|
||||
不同 → 找到不存在位置 → 试运行报「入口脚本缺失」。修复:
|
||||
1. BIOFLOW_EXT_ENTRY_DIR env 显式指定(部署树配置)
|
||||
2. 从 __file__ 向上逐级找 */bioflow_kernel/cli/run_extension.py
|
||||
3. 兜底 parents[4] 推导
|
||||
"""
|
||||
env_dir = os.environ.get("BIOFLOW_EXT_ENTRY_DIR", "").strip()
|
||||
if env_dir and Path(env_dir).is_dir():
|
||||
return env_dir
|
||||
here = Path(__file__).resolve()
|
||||
for parent in [here] + list(here.parents):
|
||||
candidate = parent / "bioflow_kernel" / "cli"
|
||||
if (candidate / "run_extension.py").is_file():
|
||||
return str(candidate)
|
||||
return str(here.parents[4] / "bioflow_kernel" / "cli")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user