YueGuobin e68cc17ed5
feat: add fault injection system and external skills repository
## Summary

Add a complete fault injection system for GNS3 Copilot, migrate all
skills from local Python files to an external Git repository with
hot reload support, and restructure Copilot API under /copilot/.

## Key Changes

### Fault Injection
- New troubleshooting_injection mode with InjectionSkillsTool
- 368 fault scenarios across 39 protocol categories
- Context-based filtering (LLM must pass topology protocols)

### External Skills Repository
- SkillsManager: Git clone/pull, version tracking, smart updates
- SkillsLoader: YAML skills + Markdown prompts from external repo
- Hot reload via POST /copilot/reload/skills
- Configurable via gns3_server.conf

### Architecture
- API unified under /copilot/ prefix
- SkillsManager moved from Controller to agent module
- Lazy initialization with startup background preload
- Per-command Git timeout, smart update checks
- Forbidden commands hot-reloadable from external repo
- 32 INFO logs downgraded to DEBUG
2026-05-11 01:24:55 +08:00

71 lines
2.0 KiB
Python

# SPDX-License-Identifier: GPL-3.0-or-later
#
# GNS3-Copilot - AI-powered Network Lab Assistant for GNS3
#
# This file is part of GNS3-Copilot project.
#
# GNS3-Copilot is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# GNS3-Copilot is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNS3-Copilot. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2025 Yue Guobin
# Author: Yue Guobin
#
# Project Home: https://github.com/yueguobin/gns3-copilot
#
"""
Skills Package
This package provides skills management for GNS3 Copilot.
All skills are loaded from the external GNS3-Skills repository.
Directory Structure:
- skills/
- registry.py # SKILLS_REGISTRY and get_skill()
- manager.py # SkillsManager - Git clone/pull and hot reload
- loader.py # SkillsLoader - YAML/Markdown file loading
"""
from .registry import (
SKILLS_REGISTRY,
INJECTION_SKILLS_REGISTRY,
get_skill,
get_injection_skill,
DeviceSkillsTool,
InjectionSkillsTool,
set_skills_manager,
get_skills_manager,
reload_injection_skills,
reload_forbidden_commands,
reload_skills_repository,
get_skills_repository_info,
)
from .manager import SkillsManager
from .loader import SkillsLoader
__all__ = [
"SKILLS_REGISTRY",
"INJECTION_SKILLS_REGISTRY",
"get_skill",
"get_injection_skill",
"DeviceSkillsTool",
"InjectionSkillsTool",
"SkillsManager",
"SkillsLoader",
"set_skills_manager",
"get_skills_manager",
"reload_injection_skills",
"reload_skills_repository",
"get_skills_repository_info",
]