refactor: 技能源头=global(公共技能),选装从global复制到org;packs=技能集清单
This commit is contained in:
parent
6814a0931b
commit
9be706d99b
@ -1,38 +1,37 @@
|
||||
"""技能集(skill pack)管理 + 安装能力。
|
||||
|
||||
技能库结构(pipeline-core 仓库内):
|
||||
skills_library/
|
||||
├── all/ # 完整技能库(每个技能一个目录,含 SKILL.md)
|
||||
技能目录结构(运行时 skills/ 根目录,相对 cwd):
|
||||
skills/
|
||||
├── global/ # 公共技能(预置技能部署时全量复制到此处,所有 agent 默认加载)
|
||||
│ ├── module-development-spec/SKILL.md
|
||||
│ └── ...
|
||||
└── packs/ # 技能集定义
|
||||
└── ocai-h5-dev/
|
||||
└── manifest.json # 元数据 + 引用的技能列表
|
||||
├── packs/ # 技能集定义(manifest 引用 global 里的技能名)
|
||||
│ └── ocai-h5-dev/manifest.json
|
||||
├── orgs/{org_id}/ # 机构技能(选装后,从 global 复制)
|
||||
└── ...
|
||||
|
||||
安装 = 把技能集里引用的技能从 all/ 复制到目标技能根目录的 orgs/{org_id}/ 下,
|
||||
skill_loader 的 org scope 会自动加载。
|
||||
安装 = 按技能集 manifest,把 global/ 里的技能复制到 orgs/{org_id}/ 下,
|
||||
skill_loader 的 org scope 自动加载。global 本身是公共技能,所有 agent 默认可见。
|
||||
"""
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
|
||||
|
||||
def get_library_dir():
|
||||
"""技能库根目录 = 技能根目录(skills/)下的 library/ 子目录(预置仓库)。
|
||||
def get_skills_base():
|
||||
"""技能根目录 skills/(相对 cwd),与 skill_loader 的 base_dir="skills" 一致。
|
||||
|
||||
与 skill_loader 的 base_dir="skills"(相对 cwd)统一:skills/ 是唯一技能根目录,
|
||||
library/ 是预置仓库,global/orgs/pipelines/projects/users 是运行时 scope。
|
||||
安装 = 从 library/all/ 复制到 orgs/{org_id}/。优先环境变量 PIPELINE_SKILLS_LIBRARY 覆盖。
|
||||
优先环境变量 PIPELINE_SKILLS_BASE 覆盖。
|
||||
"""
|
||||
env = os.environ.get("PIPELINE_SKILLS_LIBRARY", "")
|
||||
env = os.environ.get("PIPELINE_SKILLS_BASE", "")
|
||||
if env:
|
||||
return os.path.normpath(env)
|
||||
return os.path.normpath(os.path.join(os.getcwd(), "skills", "library"))
|
||||
return os.path.normpath(os.path.join(os.getcwd(), "skills"))
|
||||
|
||||
|
||||
LIBRARY_DIR = get_library_dir()
|
||||
PACKS_DIR = os.path.join(LIBRARY_DIR, "packs")
|
||||
ALL_DIR = os.path.join(LIBRARY_DIR, "all")
|
||||
SKILLS_BASE = get_skills_base()
|
||||
PACKS_DIR = os.path.join(SKILLS_BASE, "packs")
|
||||
ALL_DIR = os.path.join(SKILLS_BASE, "global") # 公共技能 = 选装的技能源头
|
||||
|
||||
|
||||
def list_packs():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user