Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix(skill): 技能源制品下载支持 HTTP(内网源场景)

huben945ac08b0d4b
diff --git a/jiuwenswarm/extensions/sdk/skill_source.py b/jiuwenswarm/extensions/sdk/skill_source.py
index 6c86816c9a..f8cdc3b501 100644
--- a/jiuwenswarm/extensions/sdk/skill_source.py
+++ b/jiuwenswarm/extensions/sdk/skill_source.py
@@ -286,7 +286,7 @@ class SkillSourceProvider(ABC):
) -> bytes:
"""Download artifact bytes under the platform's secure download policy.
- The default enforces HTTPS-only URLs, forbids redirects, applies the
+ The default accepts HTTP(S) URLs, forbids redirects, applies the
DownloadPolicy ``max_bytes``/``timeout_seconds`` limits (timeout is
clamped to at least 30s, matching the platform's historical behavior),
requires a ZIP payload (PK magic, intact archive) and checks the
@@ -295,8 +295,8 @@ class SkillSourceProvider(ABC):
"""
download_url = str(descriptor.download_url or "").strip()
parsed = urlparse(download_url)
- if parsed.scheme != "https" or not parsed.hostname:
- raise RuntimeError("skill 下载 URL 必须是 HTTPS 地址")
+ if parsed.scheme not in {"http", "https"} or not parsed.hostname:
+ raise RuntimeError("skill 下载 URL 必须是 HTTP 或 HTTPS 地址")
policy = download_policy or DownloadPolicy()
timeout = max(30.0, policy.timeout_seconds or DownloadPolicy.timeout_seconds)
async with httpx.AsyncClient(timeout=timeout, follow_redirects=False) as client:
diff --git a/jiuwenswarm/server/runtime/skill/skill_manager.py b/jiuwenswarm/server/runtime/skill/skill_manager.py
index 39d6968a0a..2b5db3d0bc 100644
--- a/jiuwenswarm/server/runtime/skill/skill_manager.py
+++ b/jiuwenswarm/server/runtime/skill/skill_manager.py
@@ -5138,12 +5138,12 @@ class SkillManager:
*,
allowed_hosts: tuple[str, ...] | None = None,
) -> None:
- """SkillHub / 远程归档下载主机白名单(import_local 与 Team Skills Hub 并集)。"""
+ """校验 SkillHub / 远程归档下载 URL 的协议和主机白名单。"""
if allowed_hosts:
parsed = urlparse(str(download_url or "").strip())
host = (parsed.hostname or "").strip().lower()
- if parsed.scheme != "https":
- raise RuntimeError("skill 下载 URL 必须使用 HTTPS")
+ if parsed.scheme not in {"http", "https"}:
+ raise RuntimeError("skill 下载 URL 必须使用 HTTP 或 HTTPS")
if not host:
raise RuntimeError("skill 下载 URL 缺少主机名")
if parsed.username or parsed.password:
@@ -5428,8 +5428,8 @@ class SkillManager:
max_bytes: int | None = None,
) -> bytes:
parsed = urlparse(str(download_url or "").strip())
- if parsed.scheme != "https" or not parsed.hostname:
- raise RuntimeError("skill 下载 URL 必须是 HTTPS 地址")
+ if parsed.scheme not in {"http", "https"} or not parsed.hostname:
+ raise RuntimeError("skill 下载 URL 必须是 HTTP 或 HTTPS 地址")
timeout = max(30.0, timeout or _TEAM_SKILLS_HUB_MARKET_TIMEOUT)
async with httpx.AsyncClient(timeout=timeout, follow_redirects=False) as client:
resp = await client.get(download_url)