[FEATURE] 资源管理支持从标准 Agent Skills / Agent Plugins 仓库批量导入
Problem
Astron Agent already supports Skill folders in Resource Management and the standard Agent read_skill / run_skill runtime added by #1427. The missing step is repository-level ingestion: operators must clone a collection locally and upload every file through the browser before any Skill becomes selectable.
K-Dense-AI/scientific-agent-skills is a concrete standards-based fixture:
plugin.json
skills/
scanpy/SKILL.md
rdkit/SKILL.md
literature-review/SKILL.md
...It is an Agent Plugins 1.0.0 package with 160+ immediate skills/<name>/SKILL.md directories. The current /skill-file/upload-directory path accepts browser-provided multipart files and paths, but it has no repository URL/ref, import plan, collection metadata, source provenance, repeatable update path, or per-skill selection. Files rejected by the upload allowlist can also be skipped without giving an operator a repository-level compatibility report.
Proposed Solution
Add a dry-run-first external Skill repository importer to Resource Management.
Suggested MVP:
- Accept a public HTTPS Git repository URL, a required tag/commit SHA, and an optional skills subdirectory (default
skills/). - Fetch into an isolated temporary workspace with strict URL, redirect, timeout, total-size, file-count, and per-file limits. Reject private/reserved network targets; do not accept embedded credentials, submodules, Git LFS downloads, or arbitrary Git config.
- Read root
plugin.jsononly as optional collection/source metadata. Do not import hooks or execute repository code. - Discover immediate child directories containing
SKILL.md, parse the standard frontmatter (including nestedmetadata.version), and show a dry-run table with name, description, version, license, path, file count/size, unsupported files, and validation errors. - Let the operator select a reviewed subset before import. Import each selected Skill as a normal Resource Management folder so existing authorization, storage, audit, and Agent attachment flows remain authoritative.
- Persist provenance per imported Skill: repository URL, requested ref, resolved commit SHA, source path, content fingerprint, and imported timestamp.
- Define deterministic collision behavior (
skip,replace-unattached draft, or rename); never silently overwrite an existing folder. Return per-skill results so one invalid Skill does not hide successful imports. - Keep scheduled synchronization and automatic upstream updates out of the MVP. A later sync must produce a diff and require explicit approval.
Security Boundary
- Import is inert: no script, hook, package install, or Skill instruction runs during discovery/import.
- Archive/path traversal and symlink escapes must be rejected before storage.
- Unsupported or oversized files must be reported, not silently treated as a complete import.
- Repository credentials and private repository support are out of scope for the first slice.
- Imported Skills still use the existing sandbox behavior when an Agent later invokes
run_skill.
Acceptance Fixture: Scientific Agent Skills
Use K-Dense-AI/[email protected] as an integration fixture without downloading model/data dependencies:
- The importer resolves and records the immutable commit behind
v2.64.0. - Dry-run discovers
scanpy,rdkit, andliterature-reviewas separate Skills fromskills/. - Nested
metadata.versionis preserved for each Skill. - Every included file is either planned for import or reported with an explicit incompatibility; nothing is silently dropped.
- Selecting only those three Skills imports three independent Resource Management folders.
- Re-running the same ref is idempotent and reports unchanged content.
- An imported Skill appears in the existing Agent Skill selector and works through the existing
read_skillpath; runtime execution behavior remains governed by current sandbox configuration. - Malicious URL, redirect-to-private-IP, traversal, symlink escape, oversized archive, and duplicate-folder tests are included.
Alternatives
- Manual folder upload: works for a few Skills but loses repository/ref provenance and does not scale to a reviewed collection.
- Publish through SkillHub first: useful for governed team distribution and documented in K-Dense PR #241, but Astron Resource Management still lacks a direct repository intake path.
- Treat the whole Agent Plugin as one Skill: rejected because each immediate child has its own trigger, metadata, license, dependencies, and lifecycle.
Related
- Runtime Skill support: #1427 / #1424
- Scientific Agent Skills: https://github.com/K-Dense-AI/scientific-agent-skills
- K-Dense SkillHub/Astron guide: https://github.com/K-Dense-AI/scientific-agent-skills/pull/241
- SkillHub external repository importer design: https://github.com/iflytek/skillhub/issues/516
Source: iflytek/astron-agent