Fix Feishu MCP npx resolution
This commit is contained in:
+18
-2
@@ -2283,15 +2283,27 @@ def _feishu_paths(state: AgentState, account_id: str | None) -> dict[str, Path]:
|
||||
|
||||
def _feishu_command() -> list[str]:
|
||||
return [
|
||||
'npx',
|
||||
_feishu_npx_executable(),
|
||||
'-y',
|
||||
f'--registry={FEISHU_NPM_REGISTRY}',
|
||||
FEISHU_MCP_PACKAGE,
|
||||
]
|
||||
|
||||
|
||||
def _feishu_npx_executable() -> str:
|
||||
explicit = os.environ.get('CLAW_NPX_BIN')
|
||||
if explicit and Path(explicit).expanduser().exists():
|
||||
return str(Path(explicit).expanduser())
|
||||
node_bin_dir = os.environ.get('CLAW_NODE_BIN_DIR')
|
||||
if node_bin_dir:
|
||||
candidate = Path(node_bin_dir).expanduser() / 'npx'
|
||||
if candidate.exists():
|
||||
return str(candidate)
|
||||
return shutil.which('npx') or 'npx'
|
||||
|
||||
|
||||
def _feishu_env(paths: dict[str, Path]) -> dict[str, str]:
|
||||
return {
|
||||
env = {
|
||||
'HOME': str(paths['home']),
|
||||
'XDG_CONFIG_HOME': str(paths['config']),
|
||||
'npm_config_cache': str(paths['npm_cache']),
|
||||
@@ -2299,6 +2311,10 @@ def _feishu_env(paths: dict[str, Path]) -> dict[str, str]:
|
||||
'NO_UPDATE_NOTIFIER': 'true',
|
||||
'FEISHU_LOGIN_MODE': 'devicecode',
|
||||
}
|
||||
node_bin_dir = os.environ.get('CLAW_NODE_BIN_DIR')
|
||||
if node_bin_dir:
|
||||
env['PATH'] = f'{node_bin_dir}{os.pathsep}{os.environ.get("PATH", "")}'
|
||||
return env
|
||||
|
||||
|
||||
def _run_feishu_cli(
|
||||
|
||||
Reference in New Issue
Block a user