Protected ReadonlyclientsProtected ReadonlyhashCaches each skill folder's content hash keyed on a cheap stat signature, so drift detection avoids re-reading unchanged files.
Protected ReadonlyloggerProtectednotifyProtected ReadonlypreferenceProtected ReadonlyrequestProtectedsubscriptionProtectedwatchingProtectedassertRejects skill names that are not a single, safe path segment. The name originates from
registry JSON, so guarding here prevents a .. or separator from escaping the skills
root when it is joined into a filesystem path.
ProtectedcleanDelete the existing folder (if any) and re-download fresh registry content.
ProtectedcomputeContent hash of a skill folder, reusing the cached result while the folder's file stats (size + mtime of the hash-relevant files) are unchanged. Any install, update, fix, or external edit changes those stats and invalidates the cache automatically.
A single recursive traversal collects the stats that form the cheap drift signature; the file contents are read (and hashed) only on a cache miss, so an unchanged folder is walked once and never re-read.
Removes a disconnected client and stops the watcher once no clients remain.
Dispose this object.
ProtecteddownloadProtecteddownloadOptionaltoken: stringProtecteddownloadOptionaltoken: stringProtectedencodeProtectedensureLazily starts a debounced recursive watch on ~/.agents/skills, notifying clients on
change. Uses @parcel/watcher (the same backend as Theia's filesystem watcher) so
additions and removals - including bare directory deletions - are reported reliably
across platforms.
ProtectedexistsProtectedextractExtracts the name field from a leading YAML frontmatter block, if present.
Clean-replaces a drifted skill with the registry content (delete folder + re-download).
ProtectedgithubOptionaltoken: stringProtectedheadersOptionaltoken: stringOptionalaccept: stringProtectedinitRuns once after construction to sweep any stale staging folders left behind by a backend crash mid-install (see writeSkill). Best-effort: failures are logged and swallowed so an unreachable skills root never blocks the service from starting.
Downloads a skill into ~/.agents/skills/<name> and writes the registry metadata file. Refuses to overwrite an existing folder.
Adopts an existing local skill folder by writing the registry metadata file without overwriting any other files.
Lists every skill folder under ~/.agents/skills, including drift information for registry-managed ones.
ProtectednotifyTells every connected client that the watcher stopped, so the UI can prompt a reload.
ProtectedparseProtectedreadProtectedreadSingle recursive traversal of the hash-relevant files under dir, capturing each
file's POSIX relative path, absolute path, size and mtime. Dot-prefixed entries are
skipped at every level, matching computeSkillContentHash.
ProtectedresolvePreference value (trimmed) when set, otherwise GITHUB_TOKEN from the environment.
ProtectedscheduleRegisters a frontend client and starts watching ~/.agents/skills for external changes.
ProtectedskillProtectedskillsProtectedstopProtectedsweepRemoves any .installing-* staging folders left under the skills root by a backend
crash mid-install. Same-process installs always clean their own staging in the
finally of writeSkill; this sweep handles the cross-process-crash case so
those folders do not accumulate forever.
ProtectedtoRemoves a skill folder - only when it carries our registry metadata file.
Removes the registry metadata file from a skill folder while keeping its other files.
Clean-replaces an installed skill with the latest registry content (delete folder + re-download).
ProtectedvalidateProtectedwriteProtectedwriteProtectedwriteWrites a freshly-downloaded skill plus its registry metadata into a sibling staging folder and then atomically swaps it into place, so an interrupted download never leaves a partially-written skill folder behind.
replaceExisting controls whether an existing target folder is removed first:
false (install): the target must not exist; the staging rename surfaces the race
if a concurrent install or external mkdir wins between the caller's existence check
and the rename, instead of silently clobbering that folder.true (update/fix): the user explicitly asked us to replace the folder.The staging folder is always cleaned up in finally, so a thrown error or an
already-existing target never leaves an orphan .installing-* folder behind.
Backend service that performs all skill filesystem and network work. The browser only triggers actions and renders results -
~/.agents/skillsis outside the browser FileService sandbox, so all fetch + filesystem writes happen here.