Files
agent-framework/python/packages
T
SergeyMenshykh d40670748d [BREAKING] Python: Align file skill folder discovery with agentskills.io spec (#5807)
* Align Python FileSkillsSource with agentskills.io spec

Update FileSkillsSource to scan spec-defined subdirectories instead of
recursive rglob for resource and script discovery:

- Resources: scan 'references/' and 'assets/' (was: entire skill tree)
- Scripts: scan 'scripts/' (was: entire skill tree)
- Add resource_directories and script_directories parameters for
  customization, with '.' root indicator for skill root files
- Add directory validation: reject '..' traversal, absolute paths, empty
  names; normalize separators and deduplicate directories
- Non-recursive scanning within each configured directory (top-level only)
- Containment check validates files against target directory, not just
  skill root, for stronger path-traversal defense
- Case-insensitive directory deduplication via os.path.normcase()
- Cross-platform absolute path rejection in directory validation
- Sort discovery results for stable ordering
- Update SkillsProvider.from_paths() to pass new parameters through
- Update all tests for new subdirectory-scoped discovery behavior

Resolves #5711.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review: tighten path validation and add containment guard

- Narrow Windows absolute path check to proper drive-root pattern
  (re.match r'^[A-Za-z]:[/\\]') to avoid rejecting valid POSIX names
- Add _is_path_within_directory guard before _has_symlink_in_path in
  both discovery methods to prevent ValueError on escaped paths

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Log warning on OSError during directory listing in skill discovery

Address review comment: _discover_resource_files and _discover_script_files
previously swallowed OSError silently when iterdir() failed. Now log a
warning so permission errors and transient FS failures are visible
instead of making resource/script directories silently disappear.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d40670748d ยท 2026-05-14 10:28:22 +00:00
History
..