mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 15:00:45 +08:00
统一技能安装与 Skills 市场接入链路。
新增公开安装工具与多来源 provider 支持,补齐管理端与目录加载逻辑,并同步更新相关测试与文档以保证可见性和路径安全。 Made-with: Cursor
This commit is contained in:
parent
d5e30542aa
commit
4d9232f3b3
66 changed files with 7369 additions and 1099 deletions
|
|
@ -172,6 +172,36 @@ def run_command_tool() -> ToolSpec:
|
|||
command, normalized_cd_removed = _strip_leading_cd_chain(command)
|
||||
command, command_rewritten = _rewrite_workspace_absolute_refs(command, workdir=workdir)
|
||||
command, script_path_rewritten = _rewrite_python_script_arg(command, workdir=workdir)
|
||||
|
||||
def _external_skill_install_cli_blocked(raw_cmd: str) -> bool:
|
||||
s = str(raw_cmd or "").strip()
|
||||
if not s:
|
||||
return False
|
||||
low = s.lower()
|
||||
if re.match(r"^\s*cocoloop(?:\.cmd|\.exe)?\s+install(?:\s|$)", s, flags=re.IGNORECASE):
|
||||
return True
|
||||
if re.match(r"^\s*clawhub(?:\.cmd|\.exe)?\s+install(?:\s|$)", s, flags=re.IGNORECASE):
|
||||
return True
|
||||
if re.search(r"\bnpx\b", low) and "clawhub" in low:
|
||||
return True
|
||||
if re.match(r"^\s*npm(?:\.cmd|\.exe)?\s+install\b", low) and "clawhub" in low:
|
||||
return True
|
||||
return False
|
||||
|
||||
if _external_skill_install_cli_blocked(str(command or "")):
|
||||
return {
|
||||
"ok": False,
|
||||
"error_code": "skill_install_cli_blocked",
|
||||
"error": "skill_install_cli_blocked",
|
||||
"hint": "Oclaw has no shell skill installer. Use Admin POST /admin/api/skills/market/install or install-registry, or skill_auto_install.",
|
||||
"command": command,
|
||||
"cwd": str(workdir),
|
||||
"normalized_cd_removed": bool(normalized_cd_removed),
|
||||
"cwd_redirected_to_sandbox": bool(cwd_redirected_to_sandbox),
|
||||
"command_rewritten": bool(command_rewritten),
|
||||
"script_path_rewritten": bool(script_path_rewritten),
|
||||
"original_command": original_command,
|
||||
}
|
||||
try:
|
||||
os.makedirs(workdir, exist_ok=True)
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue